/[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 1415 by schoenebeck, Sat Oct 13 13:14:10 2007 UTC revision 3469 by persson, Tue Feb 12 18:54:58 2019 UTC
# Line 1  Line 1 
1  /*                                                         -*- c++ -*-  /*                                                         -*- c++ -*-
2   * Copyright (C) 2006, 2007 Andreas Persson   * Copyright (C) 2006 - 2019 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 20  Line 20 
20  #ifndef GIGEDIT_MAINWINDOW_H  #ifndef GIGEDIT_MAINWINDOW_H
21  #define GIGEDIT_MAINWINDOW_H  #define GIGEDIT_MAINWINDOW_H
22    
23  #include <gig.h>  #ifdef LIBGIG_HEADER_FILE
24    # include LIBGIG_HEADER_FILE(gig.h)
25    # include LIBGIG_HEADER_FILE(Serialization.h)
26    #else
27    # include <gig.h>
28    # include <Serialization.h>
29    #endif
30    
31    #include "compat.h"
32    
33  #include <gtkmm/actiongroup.h>  #include <gtkmm/box.h>
34  #include <gtkmm/buttonbox.h>  #include <gtkmm/buttonbox.h>
35  #include <gtkmm/dialog.h>  #include <gtkmm/dialog.h>
36  #include <gtkmm/liststore.h>  #include <gtkmm/liststore.h>
37    #include <gtkmm/menu.h>
38  #include <gtkmm/paned.h>  #include <gtkmm/paned.h>
39  #include <gtkmm/progressbar.h>  #include <gtkmm/progressbar.h>
40    #include <gtkmm/radiomenuitem.h>
41  #include <gtkmm/scrolledwindow.h>  #include <gtkmm/scrolledwindow.h>
42  #include <gtkmm/treestore.h>  #include <gtkmm/treestore.h>
43  #include <gtkmm/uimanager.h>  #include <gtkmm/treemodelfilter.h>
44  #include <gtkmm/window.h>  #include <gtkmm/window.h>
45  #include <gtkmm/statusbar.h>  #include <gtkmm/statusbar.h>
46  #include <gtkmm/image.h>  #include <gtkmm/image.h>
47    #include <gtkmm/entry.h>
48    #include <gtkmm/notebook.h>
49    
50    #if USE_GTKMM_BUILDER
51    # include <gtkmm/builder.h>
52    #else
53    # include <gtkmm/uimanager.h> // deprecated in gtkmm >= 3.21.4
54    #endif
55    
56  #include <sstream>  #include <sstream>
57    
58  #include "regionchooser.h"  #include "regionchooser.h"
59  #include "dimregionchooser.h"  #include "dimregionchooser.h"
60  #include "dimregionedit.h"  #include "dimregionedit.h"
61    #include "midirules.h"
62    #ifndef OLD_THREADS
63    #include <glibmm/threads.h>
64    #endif
65    #include "ManagedWindow.h"
66    
67  class MainWindow;  class MainWindow;
68    
69  class PropDialog : public Gtk::Window {  class PropDialog : public ManagedWindow,
70                       public PropEditor<DLS::Info> {
71  public:  public:
72      PropDialog();      PropDialog();
73      void set_info(DLS::Info* info);      void set_file(gig::File* file);
74    
75        // implementation for abstract methods of interface class "ManagedWindow"
76        virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->filePropsWindowX; }
77        virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->filePropsWindowY; }
78        virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->filePropsWindowW; }
79        virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->filePropsWindowH; }
80    
81  protected:  protected:
82      Gtk::Table table;      ChoiceEntry<int> eFileFormat;
83      Gtk::Label label[16];      StringEntry eName;
84      Gtk::Entry entry[16];      StringEntry eCreationDate;
85        StringEntryMultiLine eComments;
86        StringEntry eProduct;
87        StringEntry eCopyright;
88        StringEntry eArtists;
89        StringEntry eGenre;
90        StringEntry eKeywords;
91        StringEntry eEngineer;
92        StringEntry eTechnician;
93        StringEntry eSoftware;
94        StringEntry eMedium;
95        StringEntry eSource;
96        StringEntry eSourceForm;
97        StringEntry eCommissioned;
98        StringEntry eSubject;
99        VBox vbox;
100        HButtonBox buttonBox;
101        Gtk::Button quitButton;
102        Table table;
103    
104        gig::File* m_file;
105    
106        void set_FileFormat(int value);
107  };  };
108    
109  class InstrumentProps : public Gtk::Window {  class InstrumentProps : public ManagedWindow,
110                            public PropEditor<gig::Instrument> {
111  public:  public:
112      InstrumentProps();      InstrumentProps();
113      void set_instrument(gig::Instrument* instrument);      void set_instrument(gig::Instrument* instrument);
114      sigc::signal<void>& signal_instrument_changed();      gig::Instrument* get_instrument() { return m; }
115        void update_name();
116        sigc::signal<void>& signal_name_changed() {
117            return sig_name_changed;
118        }
119    
120        // implementation for abstract methods of interface class "ManagedWindow"
121        virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->instrPropsWindowX; }
122        virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->instrPropsWindowY; }
123        virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->instrPropsWindowW; }
124        virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->instrPropsWindowH; }
125    
126  protected:  protected:
127      Gtk::VBox vbox;      void set_Name(const gig::String& name);
128      Gtk::HButtonBox buttonBox;      void set_IsDrum(bool value);
129        void set_MIDIBank(uint16_t value);
130        void set_MIDIProgram(uint32_t value);
131    
132        sigc::signal<void> sig_name_changed;
133        VBox vbox;
134        HButtonBox buttonBox;
135      Gtk::Button quitButton;      Gtk::Button quitButton;
136      Gtk::Table table;      Table table;
137      StringEntry eName;      StringEntry eName;
138      BoolEntry eIsDrum;      BoolEntry eIsDrum;
139      NumEntryTemp<uint16_t> eMIDIBank;      NumEntryTemp<uint16_t> eMIDIBank;
# Line 75  protected: Line 146  protected:
146      BoolEntry ePianoReleaseMode;      BoolEntry ePianoReleaseMode;
147      NoteEntry eDimensionKeyRangeLow;      NoteEntry eDimensionKeyRangeLow;
148      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();  
     sigc::signal<void> instrument_changed;  
149  };  };
150    
151  class LoadDialog : public Gtk::Dialog {  class ProgressDialog : public Gtk::Dialog {
152  public:  public:
153      LoadDialog(const Glib::ustring& title, Gtk::Window& parent);      ProgressDialog(const Glib::ustring& title, Gtk::Window& parent);
154      void set_fraction(float fraction) { progressBar.set_fraction(fraction); }      void set_fraction(float fraction) { progressBar.set_fraction(fraction); }
155  protected:  protected:
156      Gtk::ProgressBar progressBar;      Gtk::ProgressBar progressBar;
# Line 97  public: Line 161  public:
161      Loader(const char* filename);      Loader(const char* filename);
162      void launch();      void launch();
163      Glib::Dispatcher& signal_progress();      Glib::Dispatcher& signal_progress();
164      Glib::Dispatcher& signal_finished();      Glib::Dispatcher& signal_finished(); ///< Finished successfully, without error.
165        Glib::Dispatcher& signal_error();
166        void progress_callback(float fraction);
167        float get_progress();
168        const Glib::ustring filename;
169        Glib::ustring error_message;
170        gig::File* gig;
171    
172    private:
173        Glib::Threads::Thread* thread;
174        void thread_function();
175        Glib::Dispatcher finished_dispatcher;
176        Glib::Dispatcher progress_dispatcher;
177        Glib::Dispatcher error_dispatcher;
178        Glib::Threads::Mutex progressMutex;
179        float progress;
180    };
181    
182    class Saver : public sigc::trackable {
183    public:
184        Saver(gig::File* file, Glib::ustring filename = ""); ///< one argument means "save", two arguments means "save as"
185        void launch();
186        Glib::Dispatcher& signal_progress();
187        Glib::Dispatcher& signal_finished(); ///< Finished successfully, without error.
188        Glib::Dispatcher& signal_error();
189      void progress_callback(float fraction);      void progress_callback(float fraction);
190      float get_progress();      float get_progress();
     const char* filename;  
191      gig::File* gig;      gig::File* gig;
192        const Glib::ustring filename;
193        Glib::ustring error_message;
194    
195  private:  private:
196      Glib::Thread* thread;      Glib::Threads::Thread* thread;
197      void thread_function();      void thread_function();
198      Glib::Dispatcher finished_dispatcher;      Glib::Dispatcher finished_dispatcher;
199      Glib::Dispatcher progress_dispatcher;      Glib::Dispatcher progress_dispatcher;
200      Glib::Mutex progressMutex;      Glib::Dispatcher error_dispatcher;
201        Glib::Threads::Mutex progressMutex;
202      float progress;      float progress;
203  };  };
204    
205  class MainWindow : public Gtk::Window {  class MainWindow : public ManagedWindow {
206  public:  public:
207      MainWindow();      MainWindow();
208      virtual ~MainWindow();      virtual ~MainWindow();
# Line 127  public: Line 217  public:
217      sigc::signal<void, gig::Region*>& signal_region_changed();      sigc::signal<void, gig::Region*>& signal_region_changed();
218      sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_to_be_changed();      sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_to_be_changed();
219      sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_changed();      sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_changed();
220        sigc::signal<void, gig::Sample*>& signal_sample_changed();
221      sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& signal_sample_ref_changed();      sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& signal_sample_ref_changed();
222    
223        sigc::signal<void, int/*key*/, int/*velocity*/>& signal_note_on();
224        sigc::signal<void, int/*key*/, int/*velocity*/>& signal_note_off();
225    
226        sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_hit();
227        sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_released();
228    
229        sigc::signal<void, gig::Instrument*>& signal_switch_sampler_instrument();
230    
231        sigc::signal<void, gig::Script*> signal_script_to_be_changed;
232        sigc::signal<void, gig::Script*> signal_script_changed;
233    
234        // implementation for abstract methods of interface class "ManagedWindow"
235        virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->mainWindowX; }
236        virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->mainWindowY; }
237        virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->mainWindowW; }
238        virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->mainWindowH; }
239    
240  protected:  protected:
241    #if USE_GTKMM_BUILDER
242        Glib::RefPtr<Gio::SimpleActionGroup> m_actionGroup;
243        Glib::RefPtr<Gtk::Builder> m_uiManager;
244    #else
245      Glib::RefPtr<Gtk::ActionGroup> actionGroup;      Glib::RefPtr<Gtk::ActionGroup> actionGroup;
246      Glib::RefPtr<Gtk::UIManager> uiManager;      Glib::RefPtr<Gtk::UIManager> uiManager;
247    #endif
248    
249    #if USE_GLIB_ACTION
250        Glib::RefPtr<Gio::SimpleAction> m_actionMIDIRules;
251    
252        Glib::RefPtr<Gio::SimpleAction> m_actionCopyDimRgn;
253        Glib::RefPtr<Gio::SimpleAction> m_actionPasteDimRgn;
254        Glib::RefPtr<Gio::SimpleAction> m_actionAdjustClipboard;
255    
256        Glib::RefPtr<Gio::SimpleAction> m_actionSampleProperties;
257        Glib::RefPtr<Gio::SimpleAction> m_actionAddSample;
258        Glib::RefPtr<Gio::SimpleAction> m_actionRemoveSample;
259        Glib::RefPtr<Gio::SimpleAction> m_actionViewSampleRefs;
260        Glib::RefPtr<Gio::SimpleAction> m_actionReplaceSample;
261        Glib::RefPtr<Gio::SimpleAction> m_actionAddSampleGroup;
262    
263        Glib::RefPtr<Gio::SimpleAction> m_actionAddScriptGroup;
264        Glib::RefPtr<Gio::SimpleAction> m_actionAddScript;
265        Glib::RefPtr<Gio::SimpleAction> m_actionEditScript;
266        Glib::RefPtr<Gio::SimpleAction> m_actionRemoveScript;
267    
268        Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleUnity;
269        Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleTune;
270        Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleLoop;
271        Glib::RefPtr<Gio::SimpleAction> m_actionToggleStatusBar;
272        Glib::RefPtr<Gio::SimpleAction> m_actionToggleRestoreWinDim;
273        Glib::RefPtr<Gio::SimpleAction> m_actionToggleSaveWithTempFile;
274        Glib::RefPtr<Gio::SimpleAction> m_actionToggleWarnOnExtensions;
275        Glib::RefPtr<Gio::SimpleAction> m_actionToggleShowTooltips;
276        Glib::RefPtr<Gio::SimpleAction> m_actionToggleSyncSamplerSelection;
277        Glib::RefPtr<Gio::SimpleAction> m_actionToggleMoveRootNoteWithRegion;
278    #endif
279    
280      Gtk::Statusbar m_StatusBar;      Gtk::Statusbar m_StatusBar;
281      Gtk::Label     m_AttachedStateLabel;      Gtk::Label     m_AttachedStateLabel;
# Line 142  protected: Line 286  protected:
286    
287      PropDialog propDialog;      PropDialog propDialog;
288      InstrumentProps instrumentProps;      InstrumentProps instrumentProps;
289        MidiRules midiRules;
290    
291        /**
292         * Ensures that the 2 signals MainWindow::dimreg_to_be_changed_signal and
293         * MainWindowv::dimreg_changed_signal are always triggered correctly as a
294         * pair. It behaves similar to a "mutex lock guard" design pattern.
295         */
296        class DimRegionChangeGuard : public SignalGuard<gig::DimensionRegion*> {
297        public:
298            DimRegionChangeGuard(MainWindow* w, gig::DimensionRegion* pDimReg) :
299            SignalGuard<gig::DimensionRegion*>(w->dimreg_to_be_changed_signal, w->dimreg_changed_signal, pDimReg)
300            {
301            }
302        };
303    
304      sigc::signal<void, gig::File*> file_structure_to_be_changed_signal;      sigc::signal<void, gig::File*> file_structure_to_be_changed_signal;
305      sigc::signal<void, gig::File*> file_structure_changed_signal;      sigc::signal<void, gig::File*> file_structure_changed_signal;
# Line 151  protected: Line 309  protected:
309      sigc::signal<void, gig::Region*> region_changed_signal;      sigc::signal<void, gig::Region*> region_changed_signal;
310      sigc::signal<void, gig::DimensionRegion*> dimreg_to_be_changed_signal;      sigc::signal<void, gig::DimensionRegion*> dimreg_to_be_changed_signal;
311      sigc::signal<void, gig::DimensionRegion*> dimreg_changed_signal;      sigc::signal<void, gig::DimensionRegion*> dimreg_changed_signal;
312        sigc::signal<void, gig::Sample*> sample_changed_signal;
313      sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/> sample_ref_changed_signal;      sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/> sample_ref_changed_signal;
314    
315      void on_instrument_selection_change(int index);      sigc::signal<void, int/*key*/, int/*velocity*/> note_on_signal;
316        sigc::signal<void, int/*key*/, int/*velocity*/> note_off_signal;
317    
318        sigc::signal<void, gig::Instrument*> switch_sampler_instrument_signal;
319    
320    #if !USE_GTKMM_BUILDER
321        void on_instrument_selection_change(Gtk::RadioMenuItem* item);
322    #endif
323      void on_sel_change();      void on_sel_change();
324      void region_changed();      void region_changed();
325      void dimreg_changed();      void dimreg_changed();
326        void select_instrument(gig::Instrument* instrument);
327        bool select_dimension_region(gig::DimensionRegion* dimRgn);
328        void select_sample(gig::Sample* sample);
329      void on_loader_progress();      void on_loader_progress();
330      void on_loader_finished();      void on_loader_finished();
331        void on_loader_error();
332        void on_saver_progress();
333        void on_saver_error();
334        void on_saver_finished();
335        void updateMacroMenu();
336        void onMacroSelected(int iMacro);
337        void setupMacros();
338        void onMacrosSetupChanged(const std::vector<Serialization::Archive>& macros);
339        void applyMacro(Serialization::Archive& macro);
340        void onScriptSlotsModified(gig::Instrument* pInstrument);
341        void bringToFront();
342    
343        void dimreg_all_dimregs_toggled();
344        gig::Instrument* get_instrument();
345        void add_region_to_dimregs(gig::Region* region, bool stereo, bool all_dimregs);
346        void update_dimregs();
347    
348      class ModelColumns : public Gtk::TreeModel::ColumnRecord {      class ModelColumns : public Gtk::TreeModel::ColumnRecord {
349      public:      public:
350          ModelColumns() {          ModelColumns() {
351              add(m_col_nr);
352            add(m_col_name);            add(m_col_name);
353            add(m_col_instr);            add(m_col_instr);
354              add(m_col_scripts);
355              add(m_col_tooltip);
356          }          }
357    
358            Gtk::TreeModelColumn<int> m_col_nr;
359          Gtk::TreeModelColumn<Glib::ustring> m_col_name;          Gtk::TreeModelColumn<Glib::ustring> m_col_name;
360          Gtk::TreeModelColumn<gig::Instrument*> m_col_instr;          Gtk::TreeModelColumn<gig::Instrument*> m_col_instr;
361            Gtk::TreeModelColumn<Glib::ustring> m_col_scripts;
362            Gtk::TreeModelColumn<Glib::ustring> m_col_tooltip;
363      } m_Columns;      } m_Columns;
364    
365      Gtk::VBox m_VBox;      VBox m_VBox;
366      Gtk::HPaned m_HPaned;      Gtk::HPaned m_HPaned;
367    
368      Gtk::ScrolledWindow m_ScrolledWindow;      Gtk::ScrolledWindow m_ScrolledWindow;
369    
370      Gtk::TreeView m_TreeView;      Gtk::TreeView m_TreeView;
371      Glib::RefPtr<Gtk::ListStore> m_refTreeModel;      Glib::RefPtr<Gtk::ListStore> m_refTreeModel;
372        Glib::RefPtr<Gtk::TreeModelFilter> m_refTreeModelFilter; //FIXME: I really would love to get rid of TreeModelFilter, because it causes behavior conflicts with get_model() all over the place (see the respective comments regarding get_model()), however I found no other way to filter a treeview effectively.
373    
374    #if USE_GTKMM_BUILDER
375        Gtk::Menu* menuMacro;
376    #else
377        Gtk::Menu* instrument_menu; // kept for GTKMM 2 version only, will be completely removed in future
378    #endif
379        Gtk::Menu* assign_scripts_menu;
380    
381        std::map<gig::Sample*,int> sample_ref_count;
382    
383      class SamplesModel : public Gtk::TreeModel::ColumnRecord {      class SamplesModel : public Gtk::TreeModel::ColumnRecord {
384      public:      public:
# Line 185  protected: Line 386  protected:
386              add(m_col_name);              add(m_col_name);
387              add(m_col_sample);              add(m_col_sample);
388              add(m_col_group);              add(m_col_group);
389                add(m_col_refcount);
390                add(m_color);
391          }          }
392    
393          Gtk::TreeModelColumn<Glib::ustring> m_col_name;          Gtk::TreeModelColumn<Glib::ustring> m_col_name;
394          Gtk::TreeModelColumn<gig::Sample*> m_col_sample;          Gtk::TreeModelColumn<gig::Sample*> m_col_sample;
395          Gtk::TreeModelColumn<gig::Group*> m_col_group;          Gtk::TreeModelColumn<gig::Group*> m_col_group;
396            Gtk::TreeModelColumn<Glib::ustring> m_col_refcount;
397            Gtk::TreeModelColumn<Glib::ustring> m_color;
398      } m_SamplesModel;      } m_SamplesModel;
399    
400      class SamplesTreeStore : public Gtk::TreeStore {      class SamplesTreeStore : public Gtk::TreeStore {
# Line 205  protected: Line 410  protected:
410      Gtk::TreeView m_TreeViewSamples;      Gtk::TreeView m_TreeViewSamples;
411      Glib::RefPtr<SamplesTreeStore> m_refSamplesTreeModel;      Glib::RefPtr<SamplesTreeStore> m_refSamplesTreeModel;
412    
413        class ScriptsModel : public Gtk::TreeModel::ColumnRecord {
414        public:
415            ScriptsModel() {
416                add(m_col_name);
417                add(m_col_script);
418                add(m_col_group);
419            }
420    
421            Gtk::TreeModelColumn<Glib::ustring> m_col_name;
422            Gtk::TreeModelColumn<gig::Script*> m_col_script;
423            Gtk::TreeModelColumn<gig::ScriptGroup*> m_col_group;
424        } m_ScriptsModel;
425    
426        class ScriptsTreeStore : public Gtk::TreeStore {
427        public:
428            static Glib::RefPtr<ScriptsTreeStore> create(const ScriptsModel& columns) {
429                return Glib::RefPtr<ScriptsTreeStore>( new ScriptsTreeStore(columns) );
430            }
431        protected:
432            ScriptsTreeStore(const ScriptsModel& columns) : Gtk::TreeStore(columns) {}
433        };
434    
435        Gtk::ScrolledWindow m_ScrolledWindowScripts;
436        Gtk::TreeView m_TreeViewScripts;
437        Glib::RefPtr<ScriptsTreeStore> m_refScriptsTreeModel;
438    
439        VBox dimreg_vbox;
440        HBox dimreg_hbox;
441        Gtk::Label dimreg_label;
442        Gtk::CheckButton dimreg_all_regions;
443        Gtk::CheckButton dimreg_all_dimregs;
444        Gtk::CheckButton dimreg_stereo;
445    
446        HBox legend_hbox;
447        Gtk::Label labelLegend;
448        Gtk::Image imageNoSample;
449        Gtk::Label labelNoSample;
450        Gtk::Image imageMissingSample;
451        Gtk::Label labelMissingSample;
452        Gtk::Image imageLooped;
453        Gtk::Label labelLooped;
454        Gtk::Image imageSomeLoops;
455        Gtk::Label labelSomeLoops;
456      DimRegionEdit dimreg_edit;      DimRegionEdit dimreg_edit;
457    
458      Gtk::Notebook m_Notebook;      VBox m_left_vbox;
459      Gtk::Notebook m_TreeViewNotebook;      Gtk::Notebook m_TreeViewNotebook;
460        HBox m_searchField;
461        Gtk::Label m_searchLabel;
462        Gtk::Entry m_searchText;
463    
464      struct SampleImportItem {      struct SampleImportItem {
465          gig::Sample*  gig_sample;  // pointer to the gig::Sample to          gig::Sample*  gig_sample;  // pointer to the gig::Sample to
# Line 217  protected: Line 468  protected:
468          Glib::ustring sample_path; // file name of the sample to be          Glib::ustring sample_path; // file name of the sample to be
469                                     // imported                                     // imported
470      };      };
471      std::list<SampleImportItem> m_SampleImportQueue;      std::map<gig::Sample*, SampleImportItem> m_SampleImportQueue;
472    
473    
474      void on_action_file_new();      void on_action_file_new();
# Line 227  protected: Line 478  protected:
478      void on_action_file_properties();      void on_action_file_properties();
479      void on_action_quit();      void on_action_quit();
480      void show_instr_props();      void show_instr_props();
481        bool instr_props_set_instrument();
482        void show_midi_rules();
483        void show_script_slots();
484      void on_action_view_status_bar();      void on_action_view_status_bar();
485        void on_auto_restore_win_dim();
486        void on_save_with_temporary_file();
487        void on_action_refresh_all();
488        void on_action_warn_user_on_extensions();
489        void on_action_show_tooltips();
490        void on_show_tooltips_changed();
491        void on_action_sync_sampler_instrument_selection();
492        void on_action_move_root_note_with_region_moved();
493      void on_action_help_about();      void on_action_help_about();
494    
495        void on_notebook_tab_switched(void* page, guint page_num);
496    
497      // sample right-click popup actions      // sample right-click popup actions
498    #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2
499        bool on_sample_treeview_button_release(Gdk::EventButton& button);
500    #else
501      void on_sample_treeview_button_release(GdkEventButton* button);      void on_sample_treeview_button_release(GdkEventButton* button);
502    #endif
503      void on_action_sample_properties();      void on_action_sample_properties();
504      void on_action_add_group();      void on_action_add_group();
505      void on_action_add_sample();      void on_action_add_sample();
506        void on_action_replace_sample();
507        void on_action_replace_all_samples_in_all_groups();
508      void on_action_remove_sample();      void on_action_remove_sample();
509        void on_action_remove_unused_samples();
510    
511        // script right-click popup actions
512    #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2
513        bool on_script_treeview_button_release(Gdk::EventButton& button);
514    #else
515        void on_script_treeview_button_release(GdkEventButton* button);
516    #endif
517        void on_action_add_script_group();
518        void on_action_add_script();
519        void on_action_edit_script();
520        void on_action_remove_script();
521    
522      void on_action_add_instrument();      void on_action_add_instrument();
523        void on_action_duplicate_instrument();
524      void on_action_remove_instrument();      void on_action_remove_instrument();
525    
526      LoadDialog* load_dialog;      void show_samples_tab();
527        void show_intruments_tab();
528        void show_scripts_tab();
529    
530        void select_prev_instrument();
531        void select_next_instrument();
532        void select_instrument_by_dir(int dir);
533    
534        void select_prev_region();
535        void select_next_region();
536    
537        void select_next_dim_rgn_zone();
538        void select_prev_dim_rgn_zone();
539        void select_add_next_dim_rgn_zone();
540        void select_add_prev_dim_rgn_zone();
541        void select_prev_dimension();
542        void select_next_dimension();
543    
544        Serialization::Archive m_serializationArchive; ///< Clipboard content.
545        std::vector<Serialization::Archive> m_macros; ///< User configured list of macros.
546    
547        void copy_selected_dimrgn();
548        void paste_copied_dimrgn();
549        void adjust_clipboard_content();
550        void updateClipboardCopyAvailable();
551        void updateClipboardPasteAvailable();
552    #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2
553        void on_clipboard_owner_change(Gdk::EventOwnerChange& event);
554    #else
555        void on_clipboard_owner_change(GdkEventOwnerChange* event);
556    #endif
557        void on_clipboard_get(Gtk::SelectionData& selection_data, guint info);
558        void on_clipboard_clear();
559        void on_clipboard_received(const Gtk::SelectionData& selection_data);
560        void on_clipboard_received_targets(const std::vector<Glib::ustring>& targets);
561    
562        void add_instrument(gig::Instrument* instrument);
563    #if !USE_GTKMM_BUILDER
564        Gtk::RadioMenuItem* add_instrument_to_menu(const Glib::ustring& name,
565                                                   int position = -1);
566        void remove_instrument_from_menu(int index);
567    #endif
568        bool onQueryTreeViewTooltip(int x, int y, bool keyboardTip, const Glib::RefPtr<Gtk::Tooltip>& tooltip);
569    
570        ProgressDialog* progress_dialog;
571      Loader* loader;      Loader* loader;
572        Saver* saver;
573      void load_gig(gig::File* gig, const char* filename, bool isSharedInstrument = false);      void load_gig(gig::File* gig, const char* filename, bool isSharedInstrument = false);
574        void updateSampleRefCountMap(gig::File* gig);
575    
576      gig::File* file;      gig::File* file;
577      bool file_is_shared;      bool file_is_shared;
578      bool file_has_name;      bool file_has_name;
579      bool file_is_changed;      bool file_is_changed;
580      std::string filename;      std::string filename;
581      std::string current_dir;      std::string current_gig_dir;
582        std::string current_sample_dir;
583    
584      void set_file_is_shared(bool);      void set_file_is_shared(bool);
585    
# Line 257  protected: Line 587  protected:
587      bool file_save_as();      bool file_save_as();
588      bool check_if_savable();      bool check_if_savable();
589    
590    #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2
591        bool on_button_release(Gdk::EventButton& button);
592    #else
593      void on_button_release(GdkEventButton* button);      void on_button_release(GdkEventButton* button);
594    #endif
595        void on_instruments_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
596        void on_instruments_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
597                                                   Gtk::SelectionData& selection_data, guint, guint);
598        void on_instruments_treeview_drop_drag_data_received(
599            const Glib::RefPtr<Gdk::DragContext>& context, int, int,
600            const Gtk::SelectionData& selection_data, guint, guint time
601        );
602        void on_scripts_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
603        void on_scripts_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
604                                               Gtk::SelectionData& selection_data, guint, guint);
605      void on_sample_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);      void on_sample_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
606      void on_sample_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,      void on_sample_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
607                                            Gtk::SelectionData& selection_data, guint, guint);                                            Gtk::SelectionData& selection_data, guint, guint);
# Line 266  protected: Line 610  protected:
610                                                   const Gtk::SelectionData& selection_data,                                                   const Gtk::SelectionData& selection_data,
611                                                   guint, guint time);                                                   guint, guint time);
612    
613        void script_name_changed(const Gtk::TreeModel::Path& path,
614                                 const Gtk::TreeModel::iterator& iter);
615        void script_double_clicked(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
616      void sample_name_changed(const Gtk::TreeModel::Path& path,      void sample_name_changed(const Gtk::TreeModel::Path& path,
617                               const Gtk::TreeModel::iterator& iter);                               const Gtk::TreeModel::iterator& iter);
618      void instrument_name_changed(const Gtk::TreeModel::Path& path,      void instrument_name_changed(const Gtk::TreeModel::Path& path,
619                                   const Gtk::TreeModel::iterator& iter);                                   const Gtk::TreeModel::iterator& iter);
620        void instr_name_changed_by_instr_props(Gtk::TreeModel::iterator& it);
621        bool instrument_row_visible(const Gtk::TreeModel::const_iterator& iter);
622        sigc::connection instrument_name_connection;
623    
624        void on_action_combine_instruments();
625        void on_action_view_references();
626        void on_action_merge_files();
627        void mergeFiles(const std::vector<std::string>& filenames);
628    
629        void on_sample_ref_changed(gig::Sample* oldSample, gig::Sample* newSample);
630        void on_sample_ref_count_incremented(gig::Sample* sample, int offset);
631        void on_samples_to_be_removed(std::list<gig::Sample*> samples);
632    
633        void add_or_replace_sample(bool replace);
634    
635      void __import_queued_samples();      void __import_queued_samples();
636      void __clear();      void __clear();
637        void __refreshEntireGUI();
638        void updateScriptListOfMenu();
639        void assignScript(gig::Script* pScript);
640        void dropAllScriptSlots();
641    
642      bool close_confirmation_dialog();      bool close_confirmation_dialog();
643      bool leaving_shared_mode_dialog();      bool leaving_shared_mode_dialog();
644    
645      Gtk::Menu* popup_menu;      Gtk::Menu* popup_menu;
646    #if USE_GTKMM_BUILDER
647        Gtk::Menu* sample_popup;
648        Gtk::Menu* script_popup;
649    #endif
650    
651      bool on_delete_event(GdkEventAny* event);      bool on_delete_event(GdkEventAny* event);
652    
653      bool first_call_to_drag_data_get;      bool first_call_to_drag_data_get;
654    
655        bool is_copy_samples_unity_note_enabled() const;
656        bool is_copy_samples_fine_tune_enabled() const;
657        bool is_copy_samples_loop_enabled() const;
658  };  };
659    
660  #endif  #endif

Legend:
Removed from v.1415  
changed lines
  Added in v.3469

  ViewVC Help
Powered by ViewVC