--- gigedit/trunk/src/gigedit/mainwindow.h 2007/10/27 12:28:33 1460 +++ gigedit/trunk/src/gigedit/mainwindow.h 2012/03/04 09:01:40 2325 @@ -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 @@ -40,17 +40,68 @@ #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 { 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 { @@ -102,7 +153,7 @@ Gtk::VBox vbox; Gtk::HButtonBox buttonBox; Gtk::Button quitButton; - Gtk::Table table; + Table table; StringEntry eName; BoolEntry eIsDrum; NumEntryTemp eMIDIBank; @@ -115,10 +166,6 @@ BoolEntry ePianoReleaseMode; NoteEntry eDimensionKeyRangeLow; NoteEntry eDimensionKeyRangeHigh; - int rowno; - void add_prop(BoolEntry& prop); - void add_prop(BoolEntryPlus6& prop); - void add_prop(LabelWidget& prop); sigc::signal instrument_changed; }; @@ -142,11 +189,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; }; @@ -165,8 +212,15 @@ 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(); + sigc::signal& signal_note_off(); + + sigc::signal& signal_keyboard_key_hit(); + sigc::signal& signal_keyboard_key_released(); + protected: Glib::RefPtr actionGroup; Glib::RefPtr uiManager; @@ -189,14 +243,22 @@ 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_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: @@ -243,6 +305,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; @@ -273,6 +341,7 @@ void on_action_sample_properties(); void on_action_add_group(); void on_action_add_sample(); + void on_action_replace_all_samples_in_all_groups(); void on_action_remove_sample(); void on_action_add_instrument(); @@ -287,7 +356,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);