--- gigedit/trunk/src/gigedit/mainwindow.h 2007/07/05 17:12:20 1261 +++ gigedit/trunk/src/gigedit/mainwindow.h 2007/12/01 10:21:07 1533 @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include @@ -55,8 +57,48 @@ public: InstrumentProps(); void set_instrument(gig::Instrument* instrument); - sigc::signal signal_instrument_changed(); + sigc::signal& signal_instrument_changed(); protected: + gig::Instrument* instrument; + int update_model; + + template + void set_value(T value, sigc::slot setter) { + if (update_model == 0) { + setter(this, value); + instrument_changed(); + } + } + + template + void connect(C& widget, T gig::Instrument::* member) { + widget.signal_value_changed().connect( + sigc::compose( + sigc::bind(sigc::mem_fun(*this, &InstrumentProps::set_value), + sigc::bind(sigc::mem_fun(&InstrumentProps::set_member), member)), + sigc::mem_fun(widget, &C::get_value))); + } + + template + void connect(C& widget, void (InstrumentProps::*setter)(T)) { + widget.signal_value_changed().connect( + sigc::compose( + sigc::bind(sigc::mem_fun(*this, &InstrumentProps::set_value), + sigc::mem_fun(setter)), + sigc::mem_fun(widget, &C::get_value))); + } + + template + void set_member(T value, T gig::Instrument::* member) { + instrument->*member = value; + } + + void set_IsDrum(bool value); + void set_MIDIBank(uint16_t value); + void set_MIDIProgram(uint32_t value); + void set_DimensionKeyRange_low(uint8_t value); + void set_DimensionKeyRange_high(uint8_t value); + Gtk::VBox vbox; Gtk::HButtonBox buttonBox; Gtk::Button quitButton; @@ -74,9 +116,9 @@ NoteEntry eDimensionKeyRangeLow; NoteEntry eDimensionKeyRangeHigh; int rowno; + void add_prop(BoolEntry& prop); + void add_prop(BoolEntryPlus6& prop); void add_prop(LabelWidget& prop); - void key_range_low_changed(); - void key_range_high_changed(); sigc::signal instrument_changed; }; @@ -115,23 +157,50 @@ void load_file(const char* name); void load_instrument(gig::Instrument* instr); void file_changed(); + sigc::signal& signal_file_structure_to_be_changed(); + sigc::signal& signal_file_structure_changed(); + sigc::signal >& signal_samples_to_be_removed(); + sigc::signal& signal_samples_removed(); + sigc::signal& signal_region_to_be_changed(); + sigc::signal& signal_region_changed(); + sigc::signal& signal_dimreg_to_be_changed(); + sigc::signal& signal_dimreg_changed(); + sigc::signal& signal_sample_ref_changed(); protected: Glib::RefPtr actionGroup; Glib::RefPtr uiManager; + Gtk::Statusbar m_StatusBar; + Gtk::Label m_AttachedStateLabel; + Gtk::Image m_AttachedStateImage; + RegionChooser m_RegionChooser; DimRegionChooser m_DimRegionChooser; PropDialog propDialog; InstrumentProps instrumentProps; + sigc::signal file_structure_to_be_changed_signal; + sigc::signal file_structure_changed_signal; + sigc::signal > samples_to_be_removed_signal; + sigc::signal samples_removed_signal; + sigc::signal region_to_be_changed_signal; + sigc::signal region_changed_signal; + sigc::signal dimreg_to_be_changed_signal; + sigc::signal dimreg_changed_signal; + sigc::signal sample_ref_changed_signal; + void on_instrument_selection_change(int index); void on_sel_change(); void region_changed(); void dimreg_changed(); void on_loader_progress(); void on_loader_finished(); + void dimreg_all_dimregs_toggled(); + gig::Instrument* get_instrument(); + void add_region_to_dimregs(gig::Region* region, bool stereo, bool all_dimregs); + void update_dimregs(); class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: @@ -178,6 +247,12 @@ Gtk::TreeView m_TreeViewSamples; Glib::RefPtr m_refSamplesTreeModel; + Gtk::VBox dimreg_vbox; + Gtk::HBox dimreg_hbox; + Gtk::Label dimreg_label; + Gtk::CheckButton dimreg_all_regions; + Gtk::CheckButton dimreg_all_dimregs; + Gtk::CheckButton dimreg_stereo; DimRegionEdit dimreg_edit; Gtk::Notebook m_Notebook; @@ -200,6 +275,7 @@ void on_action_file_properties(); void on_action_quit(); void show_instr_props(); + void on_action_view_status_bar(); void on_action_help_about(); // sample right-click popup actions @@ -214,24 +290,30 @@ LoadDialog* load_dialog; Loader* loader; - void load_gig(gig::File* gig, const char* filename); + void load_gig(gig::File* gig, const char* filename, bool isSharedInstrument = false); gig::File* file; + bool file_is_shared; bool file_has_name; bool file_is_changed; std::string filename; std::string current_dir; + void set_file_is_shared(bool); + bool file_save(); bool file_save_as(); + bool check_if_savable(); void on_button_release(GdkEventButton* button); + void on_sample_treeview_drag_begin(const Glib::RefPtr& context); void on_sample_treeview_drag_data_get(const Glib::RefPtr&, Gtk::SelectionData& selection_data, guint, guint); void on_sample_label_drop_drag_data_received(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time); + void sample_name_changed(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter); void instrument_name_changed(const Gtk::TreeModel::Path& path, @@ -241,10 +323,13 @@ void __clear(); bool close_confirmation_dialog(); + bool leaving_shared_mode_dialog(); Gtk::Menu* popup_menu; bool on_delete_event(GdkEventAny* event); + + bool first_call_to_drag_data_get; }; #endif