--- gigedit/trunk/src/gigedit/mainwindow.h 2008/04/26 08:52:15 1725 +++ gigedit/trunk/src/gigedit/mainwindow.h 2014/04/23 16:49:05 2541 @@ -1,5 +1,5 @@ /* -*- c++ -*- - * Copyright (C) 2006 - 2008 Andreas Persson + * Copyright (C) 2006 - 2014 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 @@ -26,8 +26,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -40,27 +42,19 @@ #include "regionchooser.h" #include "dimregionchooser.h" #include "dimregionedit.h" +#include "midirules.h" +#ifndef OLD_THREADS +#include +#endif class MainWindow; -class Table : public Gtk::Table -{ -public: - Table(int x, int y); - void add(BoolEntry& boolentry); - void add(BoolEntryPlus6& boolentry); - void add(LabelWidget& labelwidget); -private: - int rowno; -}; - -class PropDialog : public Gtk::Window { +class PropDialog : public Gtk::Window, + public PropEditor { public: PropDialog(); void set_info(DLS::Info* info); - sigc::signal& signal_info_changed(); protected: - sigc::signal info_changed; StringEntry eName; StringEntry eCreationDate; StringEntryMultiLine eComments; @@ -81,72 +75,25 @@ Gtk::HButtonBox buttonBox; Gtk::Button quitButton; Table table; - int update_model; - DLS::Info* info; - - template - void set_member(T value, T DLS::Info::* member) { - if (update_model == 0) { - info->*member = value; - info_changed(); - } - } - - template - void connect(C& widget, T DLS::Info::* member) { - widget.signal_value_changed().connect( - sigc::compose( - sigc::bind(sigc::mem_fun(*this, &PropDialog::set_member), member), - sigc::mem_fun(widget, &C::get_value))); - } }; -class InstrumentProps : public Gtk::Window { +class InstrumentProps : public Gtk::Window, + public PropEditor { public: InstrumentProps(); void set_instrument(gig::Instrument* instrument); - 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))); + gig::Instrument* get_instrument() { return m; } + void update_name(); + sigc::signal& signal_name_changed() { + return sig_name_changed; } - - 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; - } - +protected: + void set_Name(const gig::String& name); 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); + sigc::signal sig_name_changed; Gtk::VBox vbox; Gtk::HButtonBox buttonBox; Gtk::Button quitButton; @@ -163,7 +110,6 @@ BoolEntry ePianoReleaseMode; NoteEntry eDimensionKeyRangeLow; NoteEntry eDimensionKeyRangeHigh; - sigc::signal instrument_changed; }; class LoadDialog : public Gtk::Dialog { @@ -186,11 +132,11 @@ gig::File* gig; private: - Glib::Thread* thread; + Glib::Threads::Thread* thread; void thread_function(); Glib::Dispatcher finished_dispatcher; Glib::Dispatcher progress_dispatcher; - Glib::Mutex progressMutex; + Glib::Threads::Mutex progressMutex; float progress; }; @@ -209,6 +155,7 @@ sigc::signal& signal_region_changed(); sigc::signal& signal_dimreg_to_be_changed(); sigc::signal& signal_dimreg_changed(); + sigc::signal& signal_sample_changed(); sigc::signal& signal_sample_ref_changed(); sigc::signal& signal_note_on(); @@ -230,6 +177,7 @@ PropDialog propDialog; InstrumentProps instrumentProps; + MidiRules midiRules; sigc::signal file_structure_to_be_changed_signal; sigc::signal file_structure_changed_signal; @@ -239,12 +187,13 @@ sigc::signal region_changed_signal; sigc::signal dimreg_to_be_changed_signal; sigc::signal dimreg_changed_signal; + sigc::signal sample_changed_signal; sigc::signal sample_ref_changed_signal; sigc::signal note_on_signal; sigc::signal note_off_signal; - void on_instrument_selection_change(int index); + void on_instrument_selection_change(Gtk::RadioMenuItem* item); void on_sel_change(); void region_changed(); void dimreg_changed(); @@ -274,6 +223,8 @@ Gtk::TreeView m_TreeView; Glib::RefPtr m_refTreeModel; + Gtk::Menu* instrument_menu; + class SamplesModel : public Gtk::TreeModel::ColumnRecord { public: SamplesModel() { @@ -308,7 +259,6 @@ Gtk::CheckButton dimreg_stereo; DimRegionEdit dimreg_edit; - Gtk::Notebook m_Notebook; Gtk::Notebook m_TreeViewNotebook; struct SampleImportItem { @@ -328,7 +278,10 @@ void on_action_file_properties(); void on_action_quit(); void show_instr_props(); + bool instr_props_set_instrument(); + void show_midi_rules(); void on_action_view_status_bar(); + void on_action_warn_user_on_extensions(); void on_action_help_about(); // sample right-click popup actions @@ -340,8 +293,14 @@ void on_action_remove_sample(); void on_action_add_instrument(); + void on_action_duplicate_instrument(); void on_action_remove_instrument(); + 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; Loader* loader; void load_gig(gig::File* gig, const char* filename, bool isSharedInstrument = false); @@ -373,6 +332,8 @@ const Gtk::TreeModel::iterator& iter); void instrument_name_changed(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter); + void instr_name_changed_by_instr_props(Gtk::TreeModel::iterator& it); + sigc::connection instrument_name_connection; void __import_queued_samples(); void __clear(); @@ -385,6 +346,10 @@ bool on_delete_event(GdkEventAny* event); bool first_call_to_drag_data_get; + + bool is_copy_samples_unity_note_enabled() const; + bool is_copy_samples_fine_tune_enabled() const; + bool is_copy_samples_loop_enabled() const; }; #endif