--- gigedit/trunk/src/gigedit/mainwindow.h 2007/10/13 13:14:10 1415 +++ gigedit/trunk/src/gigedit/mainwindow.h 2008/02/03 00:19:55 1660 @@ -1,5 +1,5 @@ /* -*- c++ -*- - * Copyright (C) 2006, 2007 Andreas Persson + * Copyright (C) 2006 - 2008 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 @@ -43,14 +43,62 @@ 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 { public: PropDialog(); void set_info(DLS::Info* info); + sigc::signal& signal_info_changed(); protected: - Gtk::Table table; - Gtk::Label label[16]; - Gtk::Entry entry[16]; + sigc::signal info_changed; + StringEntry eName; + StringEntry eCreationDate; + StringEntryMultiLine eComments; + StringEntry eProduct; + StringEntry eCopyright; + StringEntry eArtists; + StringEntry eGenre; + StringEntry eKeywords; + StringEntry eEngineer; + StringEntry eTechnician; + StringEntry eSoftware; + StringEntry eMedium; + StringEntry eSource; + StringEntry eSourceForm; + StringEntry eCommissioned; + StringEntry eSubject; + Gtk::VBox vbox; + 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 { @@ -59,10 +107,50 @@ 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; - Gtk::Table table; + Table table; StringEntry eName; BoolEntry eIsDrum; NumEntryTemp eMIDIBank; @@ -75,12 +163,6 @@ BoolEntry ePianoReleaseMode; 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; }; @@ -129,6 +211,12 @@ sigc::signal& signal_dimreg_changed(); sigc::signal& signal_sample_ref_changed(); + sigc::signal& signal_note_on(); + sigc::signal& signal_note_off(); + + sigc::signal& signal_keyboard_key_hit(); + sigc::signal& signal_keyboard_key_released(); + protected: Glib::RefPtr actionGroup; Glib::RefPtr uiManager; @@ -153,12 +241,19 @@ sigc::signal dimreg_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_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: @@ -205,6 +300,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;