--- gigedit/trunk/src/gigedit/mainwindow.h 2007/10/13 13:14:10 1415 +++ gigedit/trunk/src/gigedit/mainwindow.h 2007/10/27 12:28:33 1460 @@ -59,6 +59,46 @@ 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; Gtk::Button quitButton; @@ -79,8 +119,6 @@ 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; };