--- gigedit/trunk/src/gigedit/mainwindow.h 2014/06/08 19:09:26 2610
+++ gigedit/trunk/src/gigedit/mainwindow.h 2015/06/11 20:29:22 2772
@@ -1,5 +1,5 @@
/* -*- c++ -*-
- * Copyright (C) 2006 - 2014 Andreas Persson
+ * Copyright (C) 2006 - 2015 Andreas Persson
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -118,9 +118,9 @@
NoteEntry eDimensionKeyRangeHigh;
};
-class LoadDialog : public Gtk::Dialog {
+class ProgressDialog : public Gtk::Dialog {
public:
- LoadDialog(const Glib::ustring& title, Gtk::Window& parent);
+ ProgressDialog(const Glib::ustring& title, Gtk::Window& parent);
void set_fraction(float fraction) { progressBar.set_fraction(fraction); }
protected:
Gtk::ProgressBar progressBar;
@@ -131,10 +131,12 @@
Loader(const char* filename);
void launch();
Glib::Dispatcher& signal_progress();
- Glib::Dispatcher& signal_finished();
+ Glib::Dispatcher& signal_finished(); ///< Finished successfully, without error.
+ Glib::Dispatcher& signal_error();
void progress_callback(float fraction);
float get_progress();
- const char* filename;
+ const Glib::ustring filename;
+ Glib::ustring error_message;
gig::File* gig;
private:
@@ -142,6 +144,30 @@
void thread_function();
Glib::Dispatcher finished_dispatcher;
Glib::Dispatcher progress_dispatcher;
+ Glib::Dispatcher error_dispatcher;
+ Glib::Threads::Mutex progressMutex;
+ float progress;
+};
+
+class Saver : public sigc::trackable {
+public:
+ Saver(gig::File* file, Glib::ustring filename = ""); ///< one argument means "save", two arguments means "save as"
+ void launch();
+ Glib::Dispatcher& signal_progress();
+ Glib::Dispatcher& signal_finished(); ///< Finished successfully, without error.
+ Glib::Dispatcher& signal_error();
+ void progress_callback(float fraction);
+ float get_progress();
+ gig::File* gig;
+ const Glib::ustring filename;
+ Glib::ustring error_message;
+
+private:
+ Glib::Threads::Thread* thread;
+ void thread_function();
+ Glib::Dispatcher finished_dispatcher;
+ Glib::Dispatcher progress_dispatcher;
+ Glib::Dispatcher error_dispatcher;
Glib::Threads::Mutex progressMutex;
float progress;
};
@@ -170,6 +196,8 @@
sigc::signal& signal_keyboard_key_hit();
sigc::signal& signal_keyboard_key_released();
+ sigc::signal& signal_switch_sampler_instrument();
+
protected:
Glib::RefPtr actionGroup;
Glib::RefPtr uiManager;
@@ -199,12 +227,22 @@
sigc::signal note_on_signal;
sigc::signal note_off_signal;
+ sigc::signal switch_sampler_instrument_signal;
+
void on_instrument_selection_change(Gtk::RadioMenuItem* item);
void on_sel_change();
void region_changed();
void dimreg_changed();
+ void select_instrument(gig::Instrument* instrument);
+ bool select_dimension_region(gig::DimensionRegion* dimRgn);
+ void select_sample(gig::Sample* sample);
void on_loader_progress();
void on_loader_finished();
+ void on_loader_error();
+ void on_saver_progress();
+ void on_saver_error();
+ void on_saver_finished();
+
void dimreg_all_dimregs_toggled();
gig::Instrument* get_instrument();
void add_region_to_dimregs(gig::Region* region, bool stereo, bool all_dimregs);
@@ -231,17 +269,23 @@
Gtk::Menu* instrument_menu;
+ std::map sample_ref_count;
+
class SamplesModel : public Gtk::TreeModel::ColumnRecord {
public:
SamplesModel() {
add(m_col_name);
add(m_col_sample);
add(m_col_group);
+ add(m_col_refcount);
+ add(m_color);
}
Gtk::TreeModelColumn m_col_name;
Gtk::TreeModelColumn m_col_sample;
Gtk::TreeModelColumn m_col_group;
+ Gtk::TreeModelColumn m_col_refcount;
+ Gtk::TreeModelColumn m_color;
} m_SamplesModel;
class SamplesTreeStore : public Gtk::TreeStore {
@@ -314,7 +358,9 @@
void show_midi_rules();
void show_script_slots();
void on_action_view_status_bar();
+ void on_action_refresh_all();
void on_action_warn_user_on_extensions();
+ void on_action_sync_sampler_instrument_selection();
void on_action_help_about();
// sample right-click popup actions
@@ -322,9 +368,11 @@
void on_action_sample_properties();
void on_action_add_group();
void on_action_add_sample();
+ void on_action_replace_sample();
void on_action_replace_all_samples_in_all_groups();
void on_action_remove_sample();
-
+ void on_action_remove_unused_samples();
+
// script right-click popup actions
void on_script_treeview_button_release(GdkEventButton* button);
void on_action_add_script_group();
@@ -336,14 +384,20 @@
void on_action_duplicate_instrument();
void on_action_remove_instrument();
+ void show_samples_tab();
+ void show_intruments_tab();
+ void show_scripts_tab();
+
void add_instrument(gig::Instrument* instrument);
Gtk::RadioMenuItem* add_instrument_to_menu(const Glib::ustring& name,
int position = -1);
void remove_instrument_from_menu(int index);
- LoadDialog* load_dialog;
+ ProgressDialog* progress_dialog;
Loader* loader;
+ Saver* saver;
void load_gig(gig::File* gig, const char* filename, bool isSharedInstrument = false);
+ void updateSampleRefCountMap(gig::File* gig);
gig::File* file;
bool file_is_shared;
@@ -360,6 +414,13 @@
bool check_if_savable();
void on_button_release(GdkEventButton* button);
+ void on_instruments_treeview_drag_begin(const Glib::RefPtr& context);
+ void on_instruments_treeview_drag_data_get(const Glib::RefPtr&,
+ Gtk::SelectionData& selection_data, guint, guint);
+ void on_instruments_treeview_drop_drag_data_received(
+ const Glib::RefPtr& context, int, int,
+ const Gtk::SelectionData& selection_data, guint, guint time
+ );
void on_scripts_treeview_drag_begin(const Glib::RefPtr& context);
void on_scripts_treeview_drag_data_get(const Glib::RefPtr&,
Gtk::SelectionData& selection_data, guint, guint);
@@ -373,6 +434,7 @@
void script_name_changed(const Gtk::TreeModel::Path& path,
const Gtk::TreeModel::iterator& iter);
+ void script_double_clicked(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
void sample_name_changed(const Gtk::TreeModel::Path& path,
const Gtk::TreeModel::iterator& iter);
void instrument_name_changed(const Gtk::TreeModel::Path& path,
@@ -381,9 +443,16 @@
sigc::connection instrument_name_connection;
void on_action_combine_instruments();
+ void on_action_view_references();
void on_action_merge_files();
void mergeFiles(const std::vector& filenames);
+ void on_sample_ref_changed(gig::Sample* oldSample, gig::Sample* newSample);
+ void on_sample_ref_count_incremented(gig::Sample* sample, int offset);
+ void on_samples_to_be_removed(std::list samples);
+
+ void add_or_replace_sample(bool replace);
+
void __import_queued_samples();
void __clear();
void __refreshEntireGUI();