--- gigedit/trunk/src/gigedit/mainwindow.h 2008/02/06 22:08:29 1673 +++ gigedit/trunk/src/gigedit/mainwindow.h 2013/02/24 15:19:39 2423 @@ -1,5 +1,5 @@ /* -*- c++ -*- - * Copyright (C) 2006 - 2008 Andreas Persson + * Copyright (C) 2006 - 2013 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 @@ -40,27 +40,18 @@ #include "regionchooser.h" #include "dimregionchooser.h" #include "dimregionedit.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,71 +72,17 @@ 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))); - } - - 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; @@ -163,7 +100,6 @@ BoolEntry ePianoReleaseMode; NoteEntry eDimensionKeyRangeLow; NoteEntry eDimensionKeyRangeHigh; - sigc::signal instrument_changed; }; class LoadDialog : public Gtk::Dialog { @@ -186,11 +122,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 +145,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(); @@ -239,6 +176,7 @@ 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; @@ -308,7 +246,6 @@ Gtk::CheckButton dimreg_stereo; DimRegionEdit dimreg_edit; - Gtk::Notebook m_Notebook; Gtk::Notebook m_TreeViewNotebook; struct SampleImportItem { @@ -340,6 +277,7 @@ void on_action_remove_sample(); void on_action_add_instrument(); + void on_action_duplicate_instrument(); void on_action_remove_instrument(); LoadDialog* load_dialog; @@ -351,7 +289,8 @@ bool file_has_name; bool file_is_changed; std::string filename; - std::string current_dir; + std::string current_gig_dir; + std::string current_sample_dir; void set_file_is_shared(bool);