/[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 1261 by persson, Thu Jul 5 17:12:20 2007 UTC revision 1660 by schoenebeck, Sun Feb 3 00:19:55 2008 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    
# Line 41  Line 43 
43    
44  class MainWindow;  class MainWindow;
45    
46    class Table : public Gtk::Table
47    {
48    public:
49        Table(int x, int y);
50        void add(BoolEntry& boolentry);
51        void add(BoolEntryPlus6& boolentry);
52        void add(LabelWidget& labelwidget);
53    private:
54        int rowno;
55    };
56    
57  class PropDialog : public Gtk::Window {  class PropDialog : public Gtk::Window {
58  public:  public:
59      PropDialog();      PropDialog();
60      void set_info(DLS::Info* info);      void set_info(DLS::Info* info);
61        sigc::signal<void>& signal_info_changed();
62  protected:  protected:
63      Gtk::Table table;      sigc::signal<void> info_changed;
64      Gtk::Label label[16];      StringEntry eName;
65      Gtk::Entry entry[16];      StringEntry eCreationDate;
66        StringEntryMultiLine eComments;
67        StringEntry eProduct;
68        StringEntry eCopyright;
69        StringEntry eArtists;
70        StringEntry eGenre;
71        StringEntry eKeywords;
72        StringEntry eEngineer;
73        StringEntry eTechnician;
74        StringEntry eSoftware;
75        StringEntry eMedium;
76        StringEntry eSource;
77        StringEntry eSourceForm;
78        StringEntry eCommissioned;
79        StringEntry eSubject;
80        Gtk::VBox vbox;
81        Gtk::HButtonBox buttonBox;
82        Gtk::Button quitButton;
83        Table table;
84        int update_model;
85        DLS::Info* info;
86    
87        template<typename T>
88        void set_member(T value, T DLS::Info::* member) {
89            if (update_model == 0) {
90                info->*member = value;
91                info_changed();
92            }
93        }
94    
95        template<typename C, typename T>
96        void connect(C& widget, T DLS::Info::* member) {
97            widget.signal_value_changed().connect(
98                sigc::compose(
99                    sigc::bind(sigc::mem_fun(*this, &PropDialog::set_member<T>), member),
100                    sigc::mem_fun(widget, &C::get_value)));
101        }
102  };  };
103    
104  class InstrumentProps : public Gtk::Window {  class InstrumentProps : public Gtk::Window {
105  public:  public:
106      InstrumentProps();      InstrumentProps();
107      void set_instrument(gig::Instrument* instrument);      void set_instrument(gig::Instrument* instrument);
108      sigc::signal<void> signal_instrument_changed();      sigc::signal<void>& signal_instrument_changed();
109  protected:  protected:
110        gig::Instrument* instrument;
111        int update_model;
112    
113        template<typename T>
114        void set_value(T value, sigc::slot<void, InstrumentProps*, T> setter) {
115            if (update_model == 0) {
116                setter(this, value);
117                instrument_changed();
118            }
119        }
120    
121        template<typename C, typename T>
122        void connect(C& widget, T gig::Instrument::* member) {
123            widget.signal_value_changed().connect(
124                sigc::compose(
125                    sigc::bind(sigc::mem_fun(*this, &InstrumentProps::set_value<T>),
126                               sigc::bind(sigc::mem_fun(&InstrumentProps::set_member<T>), member)),
127                    sigc::mem_fun(widget, &C::get_value)));
128        }
129    
130        template<typename C, typename T>
131        void connect(C& widget, void (InstrumentProps::*setter)(T)) {
132            widget.signal_value_changed().connect(
133                sigc::compose(
134                    sigc::bind(sigc::mem_fun(*this, &InstrumentProps::set_value<T>),
135                               sigc::mem_fun(setter)),
136                    sigc::mem_fun(widget, &C::get_value)));
137        }
138    
139        template<typename T>
140        void set_member(T value, T gig::Instrument::* member) {
141            instrument->*member = value;
142        }
143    
144        void set_IsDrum(bool value);
145        void set_MIDIBank(uint16_t value);
146        void set_MIDIProgram(uint32_t value);
147        void set_DimensionKeyRange_low(uint8_t value);
148        void set_DimensionKeyRange_high(uint8_t value);
149    
150      Gtk::VBox vbox;      Gtk::VBox vbox;
151      Gtk::HButtonBox buttonBox;      Gtk::HButtonBox buttonBox;
152      Gtk::Button quitButton;      Gtk::Button quitButton;
153      Gtk::Table table;      Table table;
154      StringEntry eName;      StringEntry eName;
155      BoolEntry eIsDrum;      BoolEntry eIsDrum;
156      NumEntryTemp<uint16_t> eMIDIBank;      NumEntryTemp<uint16_t> eMIDIBank;
# Line 73  protected: Line 163  protected:
163      BoolEntry ePianoReleaseMode;      BoolEntry ePianoReleaseMode;
164      NoteEntry eDimensionKeyRangeLow;      NoteEntry eDimensionKeyRangeLow;
165      NoteEntry eDimensionKeyRangeHigh;      NoteEntry eDimensionKeyRangeHigh;
     int rowno;  
     void add_prop(LabelWidget& prop);  
     void key_range_low_changed();  
     void key_range_high_changed();  
166      sigc::signal<void> instrument_changed;      sigc::signal<void> instrument_changed;
167  };  };
168    
# Line 115  public: Line 201  public:
201      void load_file(const char* name);      void load_file(const char* name);
202      void load_instrument(gig::Instrument* instr);      void load_instrument(gig::Instrument* instr);
203      void file_changed();      void file_changed();
204        sigc::signal<void, gig::File*>& signal_file_structure_to_be_changed();
205        sigc::signal<void, gig::File*>& signal_file_structure_changed();
206        sigc::signal<void, std::list<gig::Sample*> >& signal_samples_to_be_removed();
207        sigc::signal<void>& signal_samples_removed();
208        sigc::signal<void, gig::Region*>& signal_region_to_be_changed();
209        sigc::signal<void, gig::Region*>& signal_region_changed();
210        sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_to_be_changed();
211        sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_changed();
212        sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& signal_sample_ref_changed();
213    
214        sigc::signal<void, int/*key*/, int/*velocity*/>& signal_note_on();
215        sigc::signal<void, int/*key*/, int/*velocity*/>& signal_note_off();
216    
217        sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_hit();
218        sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_released();
219    
220  protected:  protected:
221      Glib::RefPtr<Gtk::ActionGroup> actionGroup;      Glib::RefPtr<Gtk::ActionGroup> actionGroup;
222      Glib::RefPtr<Gtk::UIManager> uiManager;      Glib::RefPtr<Gtk::UIManager> uiManager;
223    
224        Gtk::Statusbar m_StatusBar;
225        Gtk::Label     m_AttachedStateLabel;
226        Gtk::Image     m_AttachedStateImage;
227    
228      RegionChooser m_RegionChooser;      RegionChooser m_RegionChooser;
229      DimRegionChooser m_DimRegionChooser;      DimRegionChooser m_DimRegionChooser;
230    
231      PropDialog propDialog;      PropDialog propDialog;
232      InstrumentProps instrumentProps;      InstrumentProps instrumentProps;
233    
234        sigc::signal<void, gig::File*> file_structure_to_be_changed_signal;
235        sigc::signal<void, gig::File*> file_structure_changed_signal;
236        sigc::signal<void, std::list<gig::Sample*> > samples_to_be_removed_signal;
237        sigc::signal<void> samples_removed_signal;
238        sigc::signal<void, gig::Region*> region_to_be_changed_signal;
239        sigc::signal<void, gig::Region*> region_changed_signal;
240        sigc::signal<void, gig::DimensionRegion*> dimreg_to_be_changed_signal;
241        sigc::signal<void, gig::DimensionRegion*> dimreg_changed_signal;
242        sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/> sample_ref_changed_signal;
243    
244        sigc::signal<void, int/*key*/, int/*velocity*/> note_on_signal;
245        sigc::signal<void, int/*key*/, int/*velocity*/> note_off_signal;
246    
247      void on_instrument_selection_change(int index);      void on_instrument_selection_change(int index);
248      void on_sel_change();      void on_sel_change();
249      void region_changed();      void region_changed();
250      void dimreg_changed();      void dimreg_changed();
251      void on_loader_progress();      void on_loader_progress();
252      void on_loader_finished();      void on_loader_finished();
253        void dimreg_all_dimregs_toggled();
254        gig::Instrument* get_instrument();
255        void add_region_to_dimregs(gig::Region* region, bool stereo, bool all_dimregs);
256        void update_dimregs();
257    
258      class ModelColumns : public Gtk::TreeModel::ColumnRecord {      class ModelColumns : public Gtk::TreeModel::ColumnRecord {
259      public:      public:
# Line 178  protected: Line 300  protected:
300      Gtk::TreeView m_TreeViewSamples;      Gtk::TreeView m_TreeViewSamples;
301      Glib::RefPtr<SamplesTreeStore> m_refSamplesTreeModel;      Glib::RefPtr<SamplesTreeStore> m_refSamplesTreeModel;
302    
303        Gtk::VBox dimreg_vbox;
304        Gtk::HBox dimreg_hbox;
305        Gtk::Label dimreg_label;
306        Gtk::CheckButton dimreg_all_regions;
307        Gtk::CheckButton dimreg_all_dimregs;
308        Gtk::CheckButton dimreg_stereo;
309      DimRegionEdit dimreg_edit;      DimRegionEdit dimreg_edit;
310    
311      Gtk::Notebook m_Notebook;      Gtk::Notebook m_Notebook;
# Line 200  protected: Line 328  protected:
328      void on_action_file_properties();      void on_action_file_properties();
329      void on_action_quit();      void on_action_quit();
330      void show_instr_props();      void show_instr_props();
331        void on_action_view_status_bar();
332      void on_action_help_about();      void on_action_help_about();
333    
334      // sample right-click popup actions      // sample right-click popup actions
# Line 214  protected: Line 343  protected:
343    
344      LoadDialog* load_dialog;      LoadDialog* load_dialog;
345      Loader* loader;      Loader* loader;
346      void load_gig(gig::File* gig, const char* filename);      void load_gig(gig::File* gig, const char* filename, bool isSharedInstrument = false);
347    
348      gig::File* file;      gig::File* file;
349        bool file_is_shared;
350      bool file_has_name;      bool file_has_name;
351      bool file_is_changed;      bool file_is_changed;
352      std::string filename;      std::string filename;
353      std::string current_dir;      std::string current_dir;
354    
355        void set_file_is_shared(bool);
356    
357      bool file_save();      bool file_save();
358      bool file_save_as();      bool file_save_as();
359        bool check_if_savable();
360    
361      void on_button_release(GdkEventButton* button);      void on_button_release(GdkEventButton* button);
362        void on_sample_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
363      void on_sample_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,      void on_sample_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
364                                            Gtk::SelectionData& selection_data, guint, guint);                                            Gtk::SelectionData& selection_data, guint, guint);
365      void on_sample_label_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context,      void on_sample_label_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context,
366                                                   int, int,                                                   int, int,
367                                                   const Gtk::SelectionData& selection_data,                                                   const Gtk::SelectionData& selection_data,
368                                                   guint, guint time);                                                   guint, guint time);
369    
370      void sample_name_changed(const Gtk::TreeModel::Path& path,      void sample_name_changed(const Gtk::TreeModel::Path& path,
371                               const Gtk::TreeModel::iterator& iter);                               const Gtk::TreeModel::iterator& iter);
372      void instrument_name_changed(const Gtk::TreeModel::Path& path,      void instrument_name_changed(const Gtk::TreeModel::Path& path,
# Line 241  protected: Line 376  protected:
376      void __clear();      void __clear();
377    
378      bool close_confirmation_dialog();      bool close_confirmation_dialog();
379        bool leaving_shared_mode_dialog();
380    
381      Gtk::Menu* popup_menu;      Gtk::Menu* popup_menu;
382    
383      bool on_delete_event(GdkEventAny* event);      bool on_delete_event(GdkEventAny* event);
384    
385        bool first_call_to_drag_data_get;
386  };  };
387    
388  #endif  #endif

Legend:
Removed from v.1261  
changed lines
  Added in v.1660

  ViewVC Help
Powered by ViewVC