/[svn]/gigedit/trunk/src/gigedit/mainwindow.h
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/mainwindow.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1303 by persson, Sun Aug 26 09:29:52 2007 UTC revision 2325 by persson, Sun Mar 4 09:01:40 2012 UTC
# Line 1  Line 1 
1  /*                                                         -*- c++ -*-  /*                                                         -*- c++ -*-
2   * Copyright (C) 2006, 2007 Andreas Persson   * Copyright (C) 2006 - 2008 Andreas Persson
3   *   *
4   * This program is free software; you can redistribute it and/or   * This program is free software; you can redistribute it and/or
5   * modify it under the terms of the GNU General Public License as   * modify it under the terms of the GNU General Public License as
# Line 32  Line 32 
32  #include <gtkmm/treestore.h>  #include <gtkmm/treestore.h>
33  #include <gtkmm/uimanager.h>  #include <gtkmm/uimanager.h>
34  #include <gtkmm/window.h>  #include <gtkmm/window.h>
35    #include <gtkmm/statusbar.h>
36    #include <gtkmm/image.h>
37    
38  #include <sstream>  #include <sstream>
39    
40  #include "regionchooser.h"  #include "regionchooser.h"
41  #include "dimregionchooser.h"  #include "dimregionchooser.h"
42  #include "dimregionedit.h"  #include "dimregionedit.h"
43    #ifndef OLD_THREADS
44    #include <glibmm/threads.h>
45    #endif
46    
47  class MainWindow;  class MainWindow;
48    
49    class Table : public Gtk::Table
50    {
51    public:
52        Table(int x, int y);
53        void add(BoolEntry& boolentry);
54        void add(BoolEntryPlus6& boolentry);
55        void add(LabelWidget& labelwidget);
56    private:
57        int rowno;
58    };
59    
60  class PropDialog : public Gtk::Window {  class PropDialog : public Gtk::Window {
61  public:  public:
62      PropDialog();      PropDialog();
63      void set_info(DLS::Info* info);      void set_info(DLS::Info* info);
64        sigc::signal<void>& signal_info_changed();
65  protected:  protected:
66      Gtk::Table table;      sigc::signal<void> info_changed;
67      Gtk::Label label[16];      StringEntry eName;
68      Gtk::Entry entry[16];      StringEntry eCreationDate;
69        StringEntryMultiLine eComments;
70        StringEntry eProduct;
71        StringEntry eCopyright;
72        StringEntry eArtists;
73        StringEntry eGenre;
74        StringEntry eKeywords;
75        StringEntry eEngineer;
76        StringEntry eTechnician;
77        StringEntry eSoftware;
78        StringEntry eMedium;
79        StringEntry eSource;
80        StringEntry eSourceForm;
81        StringEntry eCommissioned;
82        StringEntry eSubject;
83        Gtk::VBox vbox;
84        Gtk::HButtonBox buttonBox;
85        Gtk::Button quitButton;
86        Table table;
87        int update_model;
88        DLS::Info* info;
89    
90        template<typename T>
91        void set_member(T value, T DLS::Info::* member) {
92            if (update_model == 0) {
93                info->*member = value;
94                info_changed();
95            }
96        }
97    
98        template<typename C, typename T>
99        void connect(C& widget, T DLS::Info::* member) {
100            widget.signal_value_changed().connect(
101                sigc::compose(
102                    sigc::bind(sigc::mem_fun(*this, &PropDialog::set_member<T>), member),
103                    sigc::mem_fun(widget, &C::get_value)));
104        }
105  };  };
106    
107  class InstrumentProps : public Gtk::Window {  class InstrumentProps : public Gtk::Window {
108  public:  public:
109      InstrumentProps();      InstrumentProps();
110      void set_instrument(gig::Instrument* instrument);      void set_instrument(gig::Instrument* instrument);
111      sigc::signal<void> signal_instrument_changed();      sigc::signal<void>& signal_instrument_changed();
112  protected:  protected:
113        gig::Instrument* instrument;
114        int update_model;
115    
116        template<typename T>
117        void set_value(T value, sigc::slot<void, InstrumentProps*, T> setter) {
118            if (update_model == 0) {
119                setter(this, value);
120                instrument_changed();
121            }
122        }
123    
124        template<typename C, typename T>
125        void connect(C& widget, T gig::Instrument::* member) {
126            widget.signal_value_changed().connect(
127                sigc::compose(
128                    sigc::bind(sigc::mem_fun(*this, &InstrumentProps::set_value<T>),
129                               sigc::bind(sigc::mem_fun(&InstrumentProps::set_member<T>), member)),
130                    sigc::mem_fun(widget, &C::get_value)));
131        }
132    
133        template<typename C, typename T>
134        void connect(C& widget, void (InstrumentProps::*setter)(T)) {
135            widget.signal_value_changed().connect(
136                sigc::compose(
137                    sigc::bind(sigc::mem_fun(*this, &InstrumentProps::set_value<T>),
138                               sigc::mem_fun(setter)),
139                    sigc::mem_fun(widget, &C::get_value)));
140        }
141    
142        template<typename T>
143        void set_member(T value, T gig::Instrument::* member) {
144            instrument->*member = value;
145        }
146    
147        void set_IsDrum(bool value);
148        void set_MIDIBank(uint16_t value);
149        void set_MIDIProgram(uint32_t value);
150        void set_DimensionKeyRange_low(uint8_t value);
151        void set_DimensionKeyRange_high(uint8_t value);
152    
153      Gtk::VBox vbox;      Gtk::VBox vbox;
154      Gtk::HButtonBox buttonBox;      Gtk::HButtonBox buttonBox;
155      Gtk::Button quitButton;      Gtk::Button quitButton;
156      Gtk::Table table;      Table table;
157      StringEntry eName;      StringEntry eName;
158      BoolEntry eIsDrum;      BoolEntry eIsDrum;
159      NumEntryTemp<uint16_t> eMIDIBank;      NumEntryTemp<uint16_t> eMIDIBank;
# Line 73  protected: Line 166  protected:
166      BoolEntry ePianoReleaseMode;      BoolEntry ePianoReleaseMode;
167      NoteEntry eDimensionKeyRangeLow;      NoteEntry eDimensionKeyRangeLow;
168      NoteEntry eDimensionKeyRangeHigh;      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();  
169      sigc::signal<void> instrument_changed;      sigc::signal<void> instrument_changed;
170  };  };
171    
# Line 102  public: Line 189  public:
189      gig::File* gig;      gig::File* gig;
190    
191  private:  private:
192      Glib::Thread* thread;      Glib::Threads::Thread* thread;
193      void thread_function();      void thread_function();
194      Glib::Dispatcher finished_dispatcher;      Glib::Dispatcher finished_dispatcher;
195      Glib::Dispatcher progress_dispatcher;      Glib::Dispatcher progress_dispatcher;
196      Glib::Mutex progressMutex;      Glib::Threads::Mutex progressMutex;
197      float progress;      float progress;
198  };  };
199    
# Line 117  public: Line 204  public:
204      void load_file(const char* name);      void load_file(const char* name);
205      void load_instrument(gig::Instrument* instr);      void load_instrument(gig::Instrument* instr);
206      void file_changed();      void file_changed();
207        sigc::signal<void, gig::File*>& signal_file_structure_to_be_changed();
208        sigc::signal<void, gig::File*>& signal_file_structure_changed();
209        sigc::signal<void, std::list<gig::Sample*> >& signal_samples_to_be_removed();
210        sigc::signal<void>& signal_samples_removed();
211        sigc::signal<void, gig::Region*>& signal_region_to_be_changed();
212        sigc::signal<void, gig::Region*>& signal_region_changed();
213        sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_to_be_changed();
214        sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_changed();
215        sigc::signal<void, gig::Sample*>& signal_sample_changed();
216        sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& signal_sample_ref_changed();
217    
218        sigc::signal<void, int/*key*/, int/*velocity*/>& signal_note_on();
219        sigc::signal<void, int/*key*/, int/*velocity*/>& signal_note_off();
220    
221        sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_hit();
222        sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_released();
223    
224  protected:  protected:
225      Glib::RefPtr<Gtk::ActionGroup> actionGroup;      Glib::RefPtr<Gtk::ActionGroup> actionGroup;
226      Glib::RefPtr<Gtk::UIManager> uiManager;      Glib::RefPtr<Gtk::UIManager> uiManager;
227    
228        Gtk::Statusbar m_StatusBar;
229        Gtk::Label     m_AttachedStateLabel;
230        Gtk::Image     m_AttachedStateImage;
231    
232      RegionChooser m_RegionChooser;      RegionChooser m_RegionChooser;
233      DimRegionChooser m_DimRegionChooser;      DimRegionChooser m_DimRegionChooser;
234    
235      PropDialog propDialog;      PropDialog propDialog;
236      InstrumentProps instrumentProps;      InstrumentProps instrumentProps;
237    
238        sigc::signal<void, gig::File*> file_structure_to_be_changed_signal;
239        sigc::signal<void, gig::File*> file_structure_changed_signal;
240        sigc::signal<void, std::list<gig::Sample*> > samples_to_be_removed_signal;
241        sigc::signal<void> samples_removed_signal;
242        sigc::signal<void, gig::Region*> region_to_be_changed_signal;
243        sigc::signal<void, gig::Region*> region_changed_signal;
244        sigc::signal<void, gig::DimensionRegion*> dimreg_to_be_changed_signal;
245        sigc::signal<void, gig::DimensionRegion*> dimreg_changed_signal;
246        sigc::signal<void, gig::Sample*> sample_changed_signal;
247        sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/> sample_ref_changed_signal;
248    
249        sigc::signal<void, int/*key*/, int/*velocity*/> note_on_signal;
250        sigc::signal<void, int/*key*/, int/*velocity*/> note_off_signal;
251    
252      void on_instrument_selection_change(int index);      void on_instrument_selection_change(int index);
253      void on_sel_change();      void on_sel_change();
254      void region_changed();      void region_changed();
255      void dimreg_changed();      void dimreg_changed();
256      void on_loader_progress();      void on_loader_progress();
257      void on_loader_finished();      void on_loader_finished();
258        void dimreg_all_dimregs_toggled();
259        gig::Instrument* get_instrument();
260        void add_region_to_dimregs(gig::Region* region, bool stereo, bool all_dimregs);
261        void update_dimregs();
262    
263      class ModelColumns : public Gtk::TreeModel::ColumnRecord {      class ModelColumns : public Gtk::TreeModel::ColumnRecord {
264      public:      public:
# Line 180  protected: Line 305  protected:
305      Gtk::TreeView m_TreeViewSamples;      Gtk::TreeView m_TreeViewSamples;
306      Glib::RefPtr<SamplesTreeStore> m_refSamplesTreeModel;      Glib::RefPtr<SamplesTreeStore> m_refSamplesTreeModel;
307    
308        Gtk::VBox dimreg_vbox;
309        Gtk::HBox dimreg_hbox;
310        Gtk::Label dimreg_label;
311        Gtk::CheckButton dimreg_all_regions;
312        Gtk::CheckButton dimreg_all_dimregs;
313        Gtk::CheckButton dimreg_stereo;
314      DimRegionEdit dimreg_edit;      DimRegionEdit dimreg_edit;
315    
316      Gtk::Notebook m_Notebook;      Gtk::Notebook m_Notebook;
# Line 202  protected: Line 333  protected:
333      void on_action_file_properties();      void on_action_file_properties();
334      void on_action_quit();      void on_action_quit();
335      void show_instr_props();      void show_instr_props();
336        void on_action_view_status_bar();
337      void on_action_help_about();      void on_action_help_about();
338    
339      // sample right-click popup actions      // sample right-click popup actions
# Line 209  protected: Line 341  protected:
341      void on_action_sample_properties();      void on_action_sample_properties();
342      void on_action_add_group();      void on_action_add_group();
343      void on_action_add_sample();      void on_action_add_sample();
344        void on_action_replace_all_samples_in_all_groups();
345      void on_action_remove_sample();      void on_action_remove_sample();
346    
347      void on_action_add_instrument();      void on_action_add_instrument();
# Line 216  protected: Line 349  protected:
349    
350      LoadDialog* load_dialog;      LoadDialog* load_dialog;
351      Loader* loader;      Loader* loader;
352      void load_gig(gig::File* gig, const char* filename);      void load_gig(gig::File* gig, const char* filename, bool isSharedInstrument = false);
353    
354      gig::File* file;      gig::File* file;
355        bool file_is_shared;
356      bool file_has_name;      bool file_has_name;
357      bool file_is_changed;      bool file_is_changed;
358      std::string filename;      std::string filename;
359      std::string current_dir;      std::string current_gig_dir;
360        std::string current_sample_dir;
361    
362        void set_file_is_shared(bool);
363    
364      bool file_save();      bool file_save();
365      bool file_save_as();      bool file_save_as();
# Line 246  protected: Line 383  protected:
383      void __clear();      void __clear();
384    
385      bool close_confirmation_dialog();      bool close_confirmation_dialog();
386        bool leaving_shared_mode_dialog();
387    
388      Gtk::Menu* popup_menu;      Gtk::Menu* popup_menu;
389    

Legend:
Removed from v.1303  
changed lines
  Added in v.2325

  ViewVC Help
Powered by ViewVC