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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3711 - (hide annotations) (download) (as text)
Fri Jan 10 14:22:25 2020 UTC (4 years, 3 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 27628 byte(s)
* Added boolean setting to main menu -> "View" -> "Instrument Properties
  by Double Click", which allows to prevent double clicking an
  instrument on the instruments list view from opening its properties
  dialog.

* Bumped version (1.1.1.svn11).

1 schoenebeck 1225 /* -*- c++ -*-
2 schoenebeck 3711 * Copyright (C) 2006 - 2020 Andreas Persson
3 schoenebeck 1225 *
4     * This program is free software; you can redistribute it and/or
5     * modify it under the terms of the GNU General Public License as
6     * published by the Free Software Foundation; either version 2, or (at
7     * your option) any later version.
8     *
9     * This program is distributed in the hope that it will be useful, but
10     * WITHOUT ANY WARRANTY; without even the implied warranty of
11     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12     * General Public License for more details.
13     *
14     * You should have received a copy of the GNU General Public License
15     * along with program; see the file COPYING. If not, write to the Free
16     * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17     * 02110-1301 USA.
18     */
19    
20     #ifndef GIGEDIT_MAINWINDOW_H
21     #define GIGEDIT_MAINWINDOW_H
22    
23 schoenebeck 3068 #ifdef LIBGIG_HEADER_FILE
24     # include LIBGIG_HEADER_FILE(gig.h)
25 schoenebeck 3145 # include LIBGIG_HEADER_FILE(Serialization.h)
26 schoenebeck 3068 #else
27     # include <gig.h>
28 schoenebeck 3145 # include <Serialization.h>
29 schoenebeck 3068 #endif
30 schoenebeck 1225
31 schoenebeck 3364 #include "compat.h"
32    
33 persson 2844 #include <gtkmm/box.h>
34 schoenebeck 1225 #include <gtkmm/buttonbox.h>
35     #include <gtkmm/dialog.h>
36     #include <gtkmm/liststore.h>
37 persson 2442 #include <gtkmm/menu.h>
38 schoenebeck 1225 #include <gtkmm/paned.h>
39     #include <gtkmm/progressbar.h>
40 persson 2442 #include <gtkmm/radiomenuitem.h>
41 schoenebeck 1225 #include <gtkmm/scrolledwindow.h>
42     #include <gtkmm/treestore.h>
43 schoenebeck 3340 #include <gtkmm/treemodelfilter.h>
44 schoenebeck 1225 #include <gtkmm/window.h>
45 schoenebeck 1411 #include <gtkmm/statusbar.h>
46     #include <gtkmm/image.h>
47 schoenebeck 3340 #include <gtkmm/entry.h>
48 schoenebeck 3342 #include <gtkmm/notebook.h>
49 schoenebeck 1225
50 schoenebeck 3364 #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 schoenebeck 1225 #include <sstream>
57    
58     #include "regionchooser.h"
59     #include "dimregionchooser.h"
60     #include "dimregionedit.h"
61 persson 2507 #include "midirules.h"
62 persson 3472 #ifdef GLIB_THREADS
63 persson 2325 #ifndef OLD_THREADS
64     #include <glibmm/threads.h>
65     #endif
66 persson 3472 #else
67     #include <thread>
68     #include <mutex>
69     #endif
70 schoenebeck 2893 #include "ManagedWindow.h"
71 schoenebeck 1225
72     class MainWindow;
73    
74 schoenebeck 3636 class FilePropDialog : public ManagedWindow,
75     public PropEditor<DLS::Info> {
76 persson 1582 public:
77 schoenebeck 3636 FilePropDialog();
78 schoenebeck 2560 void set_file(gig::File* file);
79 schoenebeck 2894
80     // implementation for abstract methods of interface class "ManagedWindow"
81     virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->filePropsWindowX; }
82     virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->filePropsWindowY; }
83     virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->filePropsWindowW; }
84     virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->filePropsWindowH; }
85    
86 schoenebeck 1225 protected:
87 schoenebeck 2560 ChoiceEntry<int> eFileFormat;
88 persson 1582 StringEntry eName;
89     StringEntry eCreationDate;
90     StringEntryMultiLine eComments;
91     StringEntry eProduct;
92     StringEntry eCopyright;
93     StringEntry eArtists;
94     StringEntry eGenre;
95     StringEntry eKeywords;
96     StringEntry eEngineer;
97     StringEntry eTechnician;
98     StringEntry eSoftware;
99     StringEntry eMedium;
100     StringEntry eSource;
101     StringEntry eSourceForm;
102     StringEntry eCommissioned;
103     StringEntry eSubject;
104 schoenebeck 3364 VBox vbox;
105     HButtonBox buttonBox;
106 persson 1582 Gtk::Button quitButton;
107     Table table;
108 schoenebeck 2560
109     gig::File* m_file;
110    
111 persson 3469 void set_FileFormat(int value);
112 schoenebeck 1225 };
113    
114 schoenebeck 2894 class InstrumentProps : public ManagedWindow,
115 persson 2423 public PropEditor<gig::Instrument> {
116 schoenebeck 1225 public:
117     InstrumentProps();
118     void set_instrument(gig::Instrument* instrument);
119 persson 2445 gig::Instrument* get_instrument() { return m; }
120     void update_name();
121     sigc::signal<void>& signal_name_changed() {
122     return sig_name_changed;
123     }
124 schoenebeck 2894
125     // implementation for abstract methods of interface class "ManagedWindow"
126     virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->instrPropsWindowX; }
127     virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->instrPropsWindowY; }
128     virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->instrPropsWindowW; }
129     virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->instrPropsWindowH; }
130    
131 schoenebeck 1225 protected:
132 persson 2445 void set_Name(const gig::String& name);
133 persson 1460 void set_IsDrum(bool value);
134     void set_MIDIBank(uint16_t value);
135     void set_MIDIProgram(uint32_t value);
136    
137 persson 2445 sigc::signal<void> sig_name_changed;
138 schoenebeck 3635 Gtk::Notebook tabs;
139     VBox vbox[3];
140 schoenebeck 3364 HButtonBox buttonBox;
141 schoenebeck 1225 Gtk::Button quitButton;
142 schoenebeck 3635
143     // tab 1
144 persson 1582 Table table;
145 schoenebeck 1225 StringEntry eName;
146     BoolEntry eIsDrum;
147     NumEntryTemp<uint16_t> eMIDIBank;
148     NumEntryTemp<uint32_t> eMIDIProgram;
149     NumEntryGain eAttenuation;
150     NumEntryTemp<uint16_t> eEffectSend;
151     NumEntryTemp<int16_t> eFineTune;
152     NumEntryTemp<uint16_t> ePitchbendRange;
153     BoolEntry ePianoReleaseMode;
154     NoteEntry eDimensionKeyRangeLow;
155     NoteEntry eDimensionKeyRangeHigh;
156 schoenebeck 3635
157     // tab 2
158     Table table2;
159     StringEntry eName2;
160     StringEntry eCreationDate;
161     StringEntryMultiLine eComments;
162     StringEntry eProduct;
163     StringEntry eCopyright;
164     StringEntry eArtists;
165     StringEntry eGenre;
166     StringEntry eKeywords;
167     StringEntry eEngineer;
168     StringEntry eTechnician;
169     StringEntry eSoftware;
170     StringEntry eMedium;
171     StringEntry eSource;
172     StringEntry eSourceForm;
173     StringEntry eCommissioned;
174     StringEntry eSubject;
175 schoenebeck 1225 };
176    
177 schoenebeck 3637 class SampleProps : public ManagedWindow,
178     public PropEditor<gig::Sample> {
179     public:
180     SampleProps();
181     void set_sample(gig::Sample* sample);
182     gig::Sample* get_sample() { return m; }
183     void update_name();
184     sigc::signal<void>& signal_name_changed() {
185     return sig_name_changed;
186     }
187    
188     // implementation for abstract methods of interface class "ManagedWindow"
189     virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->samplePropsWindowX; }
190     virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->samplePropsWindowY; }
191     virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->samplePropsWindowW; }
192     virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->samplePropsWindowH; }
193    
194     protected:
195     void set_Name(const gig::String& name);
196    
197     sigc::signal<void> sig_name_changed;
198     Gtk::Notebook tabs;
199     VBox vbox[3];
200     HButtonBox buttonBox;
201     Gtk::Button quitButton;
202    
203     // tab 1
204     Table table;
205     StringEntry eName;
206     NoteEntry eUnityNote;
207     ReadOnlyLabelWidget eSampleGroup;
208     ReadOnlyLabelWidget eSampleFormatInfo;
209     ReadOnlyLabelWidget eSampleID;
210     ReadOnlyLabelWidget eChecksum;
211     NumEntryTemp<uint32_t> eLoopsCount;
212     NumEntryTemp<uint32_t> eLoopStart;
213     NumEntryTemp<uint32_t> eLoopLength;
214     ChoiceEntry<gig::loop_type_t> eLoopType;
215     NumEntryTemp<uint32_t> eLoopPlayCount;
216     // tab 2
217     Table table2;
218     StringEntry eName2;
219     StringEntry eCreationDate;
220     StringEntryMultiLine eComments;
221     StringEntry eProduct;
222     StringEntry eCopyright;
223     StringEntry eArtists;
224     StringEntry eGenre;
225     StringEntry eKeywords;
226     StringEntry eEngineer;
227     StringEntry eTechnician;
228     StringEntry eSoftware;
229     StringEntry eMedium;
230     StringEntry eSource;
231     StringEntry eSourceForm;
232     StringEntry eCommissioned;
233     StringEntry eSubject;
234     };
235    
236 schoenebeck 2683 class ProgressDialog : public Gtk::Dialog {
237 schoenebeck 1225 public:
238 schoenebeck 2683 ProgressDialog(const Glib::ustring& title, Gtk::Window& parent);
239 schoenebeck 1225 void set_fraction(float fraction) { progressBar.set_fraction(fraction); }
240     protected:
241     Gtk::ProgressBar progressBar;
242     };
243    
244 persson 3470 class LoaderSaverBase {
245 schoenebeck 1225 public:
246     void launch();
247     Glib::Dispatcher& signal_progress();
248 schoenebeck 2683 Glib::Dispatcher& signal_finished(); ///< Finished successfully, without error.
249     Glib::Dispatcher& signal_error();
250 schoenebeck 1225 void progress_callback(float fraction);
251     float get_progress();
252 persson 3471 void join();
253 schoenebeck 2683 const Glib::ustring filename;
254     Glib::ustring error_message;
255 schoenebeck 1225 gig::File* gig;
256    
257 persson 3470 protected:
258     LoaderSaverBase(const Glib::ustring filename, gig::File* gig);
259    
260 schoenebeck 1225 private:
261 persson 3472 #ifdef GLIB_THREADS
262 persson 2325 Glib::Threads::Thread* thread;
263 persson 3472 Glib::Threads::Mutex progressMutex;
264     #else
265     std::thread thread;
266     std::mutex progressMutex;
267     #endif
268 schoenebeck 1225 void thread_function();
269 persson 3470 virtual void thread_function_sub(gig::progress_t& progress) = 0;
270 schoenebeck 1225 Glib::Dispatcher finished_dispatcher;
271     Glib::Dispatcher progress_dispatcher;
272 schoenebeck 2683 Glib::Dispatcher error_dispatcher;
273 schoenebeck 1225 float progress;
274     };
275    
276 persson 3470 class Loader : public LoaderSaverBase {
277 schoenebeck 2683 public:
278 persson 3470 Loader(const char* filename);
279    
280     private:
281     void thread_function_sub(gig::progress_t& progress);
282     };
283    
284     class Saver : public LoaderSaverBase {
285     public:
286 schoenebeck 2683 Saver(gig::File* file, Glib::ustring filename = ""); ///< one argument means "save", two arguments means "save as"
287    
288     private:
289 persson 3470 void thread_function_sub(gig::progress_t& progress);
290 schoenebeck 2683 };
291    
292 schoenebeck 2893 class MainWindow : public ManagedWindow {
293 schoenebeck 1225 public:
294     MainWindow();
295     virtual ~MainWindow();
296     void load_file(const char* name);
297     void load_instrument(gig::Instrument* instr);
298 persson 1261 void file_changed();
299 schoenebeck 1339 sigc::signal<void, gig::File*>& signal_file_structure_to_be_changed();
300     sigc::signal<void, gig::File*>& signal_file_structure_changed();
301     sigc::signal<void, std::list<gig::Sample*> >& signal_samples_to_be_removed();
302     sigc::signal<void>& signal_samples_removed();
303     sigc::signal<void, gig::Region*>& signal_region_to_be_changed();
304     sigc::signal<void, gig::Region*>& signal_region_changed();
305     sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_to_be_changed();
306     sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_changed();
307 schoenebeck 1853 sigc::signal<void, gig::Sample*>& signal_sample_changed();
308 schoenebeck 1339 sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& signal_sample_ref_changed();
309 schoenebeck 1225
310 schoenebeck 1654 sigc::signal<void, int/*key*/, int/*velocity*/>& signal_note_on();
311     sigc::signal<void, int/*key*/, int/*velocity*/>& signal_note_off();
312    
313 schoenebeck 1660 sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_hit();
314     sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_released();
315    
316 schoenebeck 2689 sigc::signal<void, gig::Instrument*>& signal_switch_sampler_instrument();
317 schoenebeck 2903
318     sigc::signal<void, gig::Script*> signal_script_to_be_changed;
319     sigc::signal<void, gig::Script*> signal_script_changed;
320    
321 schoenebeck 2893 // implementation for abstract methods of interface class "ManagedWindow"
322     virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->mainWindowX; }
323     virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->mainWindowY; }
324     virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->mainWindowW; }
325     virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->mainWindowH; }
326 schoenebeck 2689
327 schoenebeck 1225 protected:
328 schoenebeck 3364 #if USE_GTKMM_BUILDER
329     Glib::RefPtr<Gio::SimpleActionGroup> m_actionGroup;
330     Glib::RefPtr<Gtk::Builder> m_uiManager;
331     #else
332 schoenebeck 1225 Glib::RefPtr<Gtk::ActionGroup> actionGroup;
333     Glib::RefPtr<Gtk::UIManager> uiManager;
334 schoenebeck 3364 #endif
335 schoenebeck 1225
336 schoenebeck 3364 #if USE_GLIB_ACTION
337     Glib::RefPtr<Gio::SimpleAction> m_actionMIDIRules;
338    
339     Glib::RefPtr<Gio::SimpleAction> m_actionCopyDimRgn;
340     Glib::RefPtr<Gio::SimpleAction> m_actionPasteDimRgn;
341     Glib::RefPtr<Gio::SimpleAction> m_actionAdjustClipboard;
342    
343     Glib::RefPtr<Gio::SimpleAction> m_actionSampleProperties;
344     Glib::RefPtr<Gio::SimpleAction> m_actionAddSample;
345     Glib::RefPtr<Gio::SimpleAction> m_actionRemoveSample;
346     Glib::RefPtr<Gio::SimpleAction> m_actionViewSampleRefs;
347     Glib::RefPtr<Gio::SimpleAction> m_actionReplaceSample;
348     Glib::RefPtr<Gio::SimpleAction> m_actionAddSampleGroup;
349    
350     Glib::RefPtr<Gio::SimpleAction> m_actionAddScriptGroup;
351     Glib::RefPtr<Gio::SimpleAction> m_actionAddScript;
352     Glib::RefPtr<Gio::SimpleAction> m_actionEditScript;
353     Glib::RefPtr<Gio::SimpleAction> m_actionRemoveScript;
354    
355 schoenebeck 3711 Glib::RefPtr<Gio::SimpleAction> m_actionInstrDoubleClickOpensProps;
356    
357 schoenebeck 3364 Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleUnity;
358     Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleTune;
359     Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleLoop;
360     Glib::RefPtr<Gio::SimpleAction> m_actionToggleStatusBar;
361     Glib::RefPtr<Gio::SimpleAction> m_actionToggleRestoreWinDim;
362     Glib::RefPtr<Gio::SimpleAction> m_actionToggleSaveWithTempFile;
363     Glib::RefPtr<Gio::SimpleAction> m_actionToggleWarnOnExtensions;
364 schoenebeck 3409 Glib::RefPtr<Gio::SimpleAction> m_actionToggleShowTooltips;
365 schoenebeck 3364 Glib::RefPtr<Gio::SimpleAction> m_actionToggleSyncSamplerSelection;
366     Glib::RefPtr<Gio::SimpleAction> m_actionToggleMoveRootNoteWithRegion;
367     #endif
368    
369 schoenebeck 1411 Gtk::Statusbar m_StatusBar;
370     Gtk::Label m_AttachedStateLabel;
371     Gtk::Image m_AttachedStateImage;
372    
373 schoenebeck 1225 RegionChooser m_RegionChooser;
374     DimRegionChooser m_DimRegionChooser;
375    
376 schoenebeck 3636 FilePropDialog fileProps;
377 schoenebeck 1225 InstrumentProps instrumentProps;
378 schoenebeck 3637 SampleProps sampleProps;
379 persson 2507 MidiRules midiRules;
380 schoenebeck 1225
381 schoenebeck 3177 /**
382     * Ensures that the 2 signals MainWindow::dimreg_to_be_changed_signal and
383     * MainWindowv::dimreg_changed_signal are always triggered correctly as a
384     * pair. It behaves similar to a "mutex lock guard" design pattern.
385     */
386     class DimRegionChangeGuard : public SignalGuard<gig::DimensionRegion*> {
387     public:
388     DimRegionChangeGuard(MainWindow* w, gig::DimensionRegion* pDimReg) :
389     SignalGuard<gig::DimensionRegion*>(w->dimreg_to_be_changed_signal, w->dimreg_changed_signal, pDimReg)
390     {
391     }
392     };
393    
394 schoenebeck 1322 sigc::signal<void, gig::File*> file_structure_to_be_changed_signal;
395     sigc::signal<void, gig::File*> file_structure_changed_signal;
396     sigc::signal<void, std::list<gig::Sample*> > samples_to_be_removed_signal;
397     sigc::signal<void> samples_removed_signal;
398     sigc::signal<void, gig::Region*> region_to_be_changed_signal;
399     sigc::signal<void, gig::Region*> region_changed_signal;
400     sigc::signal<void, gig::DimensionRegion*> dimreg_to_be_changed_signal;
401     sigc::signal<void, gig::DimensionRegion*> dimreg_changed_signal;
402 schoenebeck 1853 sigc::signal<void, gig::Sample*> sample_changed_signal;
403 schoenebeck 1322 sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/> sample_ref_changed_signal;
404    
405 schoenebeck 1654 sigc::signal<void, int/*key*/, int/*velocity*/> note_on_signal;
406     sigc::signal<void, int/*key*/, int/*velocity*/> note_off_signal;
407    
408 schoenebeck 2689 sigc::signal<void, gig::Instrument*> switch_sampler_instrument_signal;
409    
410 schoenebeck 3364 #if !USE_GTKMM_BUILDER
411 persson 2442 void on_instrument_selection_change(Gtk::RadioMenuItem* item);
412 schoenebeck 3364 #endif
413 schoenebeck 1225 void on_sel_change();
414     void region_changed();
415     void dimreg_changed();
416 schoenebeck 2701 void select_instrument(gig::Instrument* instrument);
417 schoenebeck 2695 bool select_dimension_region(gig::DimensionRegion* dimRgn);
418 schoenebeck 2691 void select_sample(gig::Sample* sample);
419 schoenebeck 1225 void on_loader_progress();
420     void on_loader_finished();
421 schoenebeck 2683 void on_loader_error();
422     void on_saver_progress();
423     void on_saver_error();
424     void on_saver_finished();
425 schoenebeck 3157 void updateMacroMenu();
426     void onMacroSelected(int iMacro);
427     void setupMacros();
428     void onMacrosSetupChanged(const std::vector<Serialization::Archive>& macros);
429     void applyMacro(Serialization::Archive& macro);
430 schoenebeck 3197 void onScriptSlotsModified(gig::Instrument* pInstrument);
431 schoenebeck 3258 void bringToFront();
432 schoenebeck 2683
433 persson 1533 void dimreg_all_dimregs_toggled();
434     gig::Instrument* get_instrument();
435     void add_region_to_dimregs(gig::Region* region, bool stereo, bool all_dimregs);
436     void update_dimregs();
437 schoenebeck 1225
438     class ModelColumns : public Gtk::TreeModel::ColumnRecord {
439     public:
440     ModelColumns() {
441 schoenebeck 2994 add(m_col_nr);
442 schoenebeck 1225 add(m_col_name);
443     add(m_col_instr);
444 schoenebeck 3197 add(m_col_scripts);
445 schoenebeck 3418 add(m_col_tooltip);
446 schoenebeck 1225 }
447    
448 schoenebeck 2994 Gtk::TreeModelColumn<int> m_col_nr;
449 schoenebeck 1225 Gtk::TreeModelColumn<Glib::ustring> m_col_name;
450     Gtk::TreeModelColumn<gig::Instrument*> m_col_instr;
451 schoenebeck 3197 Gtk::TreeModelColumn<Glib::ustring> m_col_scripts;
452 schoenebeck 3418 Gtk::TreeModelColumn<Glib::ustring> m_col_tooltip;
453 schoenebeck 1225 } m_Columns;
454    
455 schoenebeck 3364 VBox m_VBox;
456 schoenebeck 1225 Gtk::HPaned m_HPaned;
457    
458     Gtk::ScrolledWindow m_ScrolledWindow;
459    
460     Gtk::TreeView m_TreeView;
461     Glib::RefPtr<Gtk::ListStore> m_refTreeModel;
462 schoenebeck 3340 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.
463 schoenebeck 1225
464 schoenebeck 3364 #if USE_GTKMM_BUILDER
465     Gtk::Menu* menuMacro;
466     #else
467     Gtk::Menu* instrument_menu; // kept for GTKMM 2 version only, will be completely removed in future
468     #endif
469 schoenebeck 3339 Gtk::Menu* assign_scripts_menu;
470 persson 2442
471 schoenebeck 2621 std::map<gig::Sample*,int> sample_ref_count;
472    
473 schoenebeck 1225 class SamplesModel : public Gtk::TreeModel::ColumnRecord {
474     public:
475     SamplesModel() {
476     add(m_col_name);
477     add(m_col_sample);
478     add(m_col_group);
479 schoenebeck 2621 add(m_col_refcount);
480     add(m_color);
481 schoenebeck 1225 }
482    
483     Gtk::TreeModelColumn<Glib::ustring> m_col_name;
484     Gtk::TreeModelColumn<gig::Sample*> m_col_sample;
485     Gtk::TreeModelColumn<gig::Group*> m_col_group;
486 schoenebeck 2621 Gtk::TreeModelColumn<Glib::ustring> m_col_refcount;
487     Gtk::TreeModelColumn<Glib::ustring> m_color;
488 schoenebeck 1225 } m_SamplesModel;
489    
490     class SamplesTreeStore : public Gtk::TreeStore {
491     public:
492     static Glib::RefPtr<SamplesTreeStore> create(const SamplesModel& columns) {
493     return Glib::RefPtr<SamplesTreeStore>( new SamplesTreeStore(columns) );
494     }
495     protected:
496     SamplesTreeStore(const SamplesModel& columns) : Gtk::TreeStore(columns) {}
497     };
498    
499     Gtk::ScrolledWindow m_ScrolledWindowSamples;
500     Gtk::TreeView m_TreeViewSamples;
501     Glib::RefPtr<SamplesTreeStore> m_refSamplesTreeModel;
502    
503 schoenebeck 2604 class ScriptsModel : public Gtk::TreeModel::ColumnRecord {
504     public:
505     ScriptsModel() {
506     add(m_col_name);
507     add(m_col_script);
508     add(m_col_group);
509     }
510    
511     Gtk::TreeModelColumn<Glib::ustring> m_col_name;
512     Gtk::TreeModelColumn<gig::Script*> m_col_script;
513     Gtk::TreeModelColumn<gig::ScriptGroup*> m_col_group;
514     } m_ScriptsModel;
515    
516     class ScriptsTreeStore : public Gtk::TreeStore {
517     public:
518     static Glib::RefPtr<ScriptsTreeStore> create(const ScriptsModel& columns) {
519     return Glib::RefPtr<ScriptsTreeStore>( new ScriptsTreeStore(columns) );
520     }
521     protected:
522     ScriptsTreeStore(const ScriptsModel& columns) : Gtk::TreeStore(columns) {}
523     };
524    
525     Gtk::ScrolledWindow m_ScrolledWindowScripts;
526     Gtk::TreeView m_TreeViewScripts;
527     Glib::RefPtr<ScriptsTreeStore> m_refScriptsTreeModel;
528    
529 schoenebeck 3364 VBox dimreg_vbox;
530     HBox dimreg_hbox;
531 persson 1533 Gtk::Label dimreg_label;
532     Gtk::CheckButton dimreg_all_regions;
533     Gtk::CheckButton dimreg_all_dimregs;
534     Gtk::CheckButton dimreg_stereo;
535 schoenebeck 3106
536 schoenebeck 3364 HBox legend_hbox;
537 schoenebeck 3109 Gtk::Label labelLegend;
538 schoenebeck 3106 Gtk::Image imageNoSample;
539     Gtk::Label labelNoSample;
540     Gtk::Image imageMissingSample;
541     Gtk::Label labelMissingSample;
542     Gtk::Image imageLooped;
543     Gtk::Label labelLooped;
544     Gtk::Image imageSomeLoops;
545     Gtk::Label labelSomeLoops;
546 schoenebeck 1225 DimRegionEdit dimreg_edit;
547    
548 schoenebeck 3364 VBox m_left_vbox;
549 schoenebeck 1225 Gtk::Notebook m_TreeViewNotebook;
550 schoenebeck 3364 HBox m_searchField;
551 schoenebeck 3340 Gtk::Label m_searchLabel;
552     Gtk::Entry m_searchText;
553 schoenebeck 1225
554     struct SampleImportItem {
555     gig::Sample* gig_sample; // pointer to the gig::Sample to
556     // which the sample data should be
557     // imported to
558     Glib::ustring sample_path; // file name of the sample to be
559     // imported
560     };
561 schoenebeck 3116 std::map<gig::Sample*, SampleImportItem> m_SampleImportQueue;
562 schoenebeck 1225
563    
564     void on_action_file_new();
565     void on_action_file_open();
566     void on_action_file_save();
567     void on_action_file_save_as();
568     void on_action_file_properties();
569 persson 1261 void on_action_quit();
570 schoenebeck 1225 void show_instr_props();
571 persson 2445 bool instr_props_set_instrument();
572 schoenebeck 3637 void show_sample_props();
573     bool sample_props_set_sample();
574     void sample_name_changed_by_sample_props(Gtk::TreeModel::iterator& it);
575 persson 2507 void show_midi_rules();
576 schoenebeck 2610 void show_script_slots();
577 schoenebeck 1415 void on_action_view_status_bar();
578 schoenebeck 2918 void on_auto_restore_win_dim();
579 schoenebeck 3711 void on_instr_double_click_opens_props();
580 schoenebeck 2967 void on_save_with_temporary_file();
581 schoenebeck 2772 void on_action_refresh_all();
582 schoenebeck 2541 void on_action_warn_user_on_extensions();
583 schoenebeck 3409 void on_action_show_tooltips();
584     void on_show_tooltips_changed();
585 schoenebeck 2689 void on_action_sync_sampler_instrument_selection();
586 schoenebeck 2773 void on_action_move_root_note_with_region_moved();
587 schoenebeck 1225 void on_action_help_about();
588    
589 schoenebeck 3344 void on_notebook_tab_switched(void* page, guint page_num);
590 schoenebeck 3340
591 schoenebeck 1225 // sample right-click popup actions
592 schoenebeck 3364 #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
593     bool on_sample_treeview_button_release(Gdk::EventButton& button);
594     #else
595 schoenebeck 1225 void on_sample_treeview_button_release(GdkEventButton* button);
596 schoenebeck 3364 #endif
597 schoenebeck 1225 void on_action_sample_properties();
598     void on_action_add_group();
599     void on_action_add_sample();
600 schoenebeck 2715 void on_action_replace_sample();
601 schoenebeck 1673 void on_action_replace_all_samples_in_all_groups();
602 schoenebeck 1225 void on_action_remove_sample();
603 schoenebeck 2772 void on_action_remove_unused_samples();
604    
605 schoenebeck 2604 // script right-click popup actions
606 schoenebeck 3364 #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
607     bool on_script_treeview_button_release(Gdk::EventButton& button);
608     #else
609 schoenebeck 2604 void on_script_treeview_button_release(GdkEventButton* button);
610 schoenebeck 3364 #endif
611 schoenebeck 2604 void on_action_add_script_group();
612     void on_action_add_script();
613     void on_action_edit_script();
614     void on_action_remove_script();
615 schoenebeck 1225
616     void on_action_add_instrument();
617 schoenebeck 2395 void on_action_duplicate_instrument();
618 schoenebeck 1225 void on_action_remove_instrument();
619    
620 schoenebeck 2625 void show_samples_tab();
621     void show_intruments_tab();
622     void show_scripts_tab();
623    
624 schoenebeck 3339 void select_prev_instrument();
625     void select_next_instrument();
626     void select_instrument_by_dir(int dir);
627    
628 schoenebeck 3123 void select_prev_region();
629     void select_next_region();
630    
631     void select_next_dim_rgn_zone();
632     void select_prev_dim_rgn_zone();
633 schoenebeck 3134 void select_add_next_dim_rgn_zone();
634     void select_add_prev_dim_rgn_zone();
635 schoenebeck 3123 void select_prev_dimension();
636     void select_next_dimension();
637    
638 schoenebeck 3157 Serialization::Archive m_serializationArchive; ///< Clipboard content.
639     std::vector<Serialization::Archive> m_macros; ///< User configured list of macros.
640 schoenebeck 3144
641     void copy_selected_dimrgn();
642     void paste_copied_dimrgn();
643 schoenebeck 3151 void adjust_clipboard_content();
644 schoenebeck 3144 void updateClipboardCopyAvailable();
645     void updateClipboardPasteAvailable();
646 schoenebeck 3364 #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
647     void on_clipboard_owner_change(Gdk::EventOwnerChange& event);
648     #else
649 schoenebeck 3144 void on_clipboard_owner_change(GdkEventOwnerChange* event);
650 schoenebeck 3364 #endif
651 schoenebeck 3144 void on_clipboard_get(Gtk::SelectionData& selection_data, guint info);
652     void on_clipboard_clear();
653     void on_clipboard_received(const Gtk::SelectionData& selection_data);
654     void on_clipboard_received_targets(const std::vector<Glib::ustring>& targets);
655    
656 persson 2442 void add_instrument(gig::Instrument* instrument);
657 schoenebeck 3364 #if !USE_GTKMM_BUILDER
658 persson 2442 Gtk::RadioMenuItem* add_instrument_to_menu(const Glib::ustring& name,
659     int position = -1);
660     void remove_instrument_from_menu(int index);
661 schoenebeck 3364 #endif
662 schoenebeck 3418 bool onQueryTreeViewTooltip(int x, int y, bool keyboardTip, const Glib::RefPtr<Gtk::Tooltip>& tooltip);
663 persson 2442
664 schoenebeck 2683 ProgressDialog* progress_dialog;
665 schoenebeck 1225 Loader* loader;
666 schoenebeck 2683 Saver* saver;
667 schoenebeck 1382 void load_gig(gig::File* gig, const char* filename, bool isSharedInstrument = false);
668 schoenebeck 2621 void updateSampleRefCountMap(gig::File* gig);
669 schoenebeck 1225
670     gig::File* file;
671 schoenebeck 1382 bool file_is_shared;
672 persson 1261 bool file_has_name;
673     bool file_is_changed;
674     std::string filename;
675 persson 1725 std::string current_gig_dir;
676     std::string current_sample_dir;
677 schoenebeck 1225
678 schoenebeck 1411 void set_file_is_shared(bool);
679    
680 persson 1261 bool file_save();
681     bool file_save_as();
682 persson 1303 bool check_if_savable();
683 persson 1261
684 schoenebeck 3364 #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
685     bool on_button_release(Gdk::EventButton& button);
686     #else
687 schoenebeck 1225 void on_button_release(GdkEventButton* button);
688 schoenebeck 3364 #endif
689 schoenebeck 2701 void on_instruments_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
690     void on_instruments_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
691     Gtk::SelectionData& selection_data, guint, guint);
692     void on_instruments_treeview_drop_drag_data_received(
693     const Glib::RefPtr<Gdk::DragContext>& context, int, int,
694     const Gtk::SelectionData& selection_data, guint, guint time
695     );
696 schoenebeck 2610 void on_scripts_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
697     void on_scripts_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
698     Gtk::SelectionData& selection_data, guint, guint);
699 persson 1303 void on_sample_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
700 schoenebeck 1225 void on_sample_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
701     Gtk::SelectionData& selection_data, guint, guint);
702     void on_sample_label_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context,
703     int, int,
704     const Gtk::SelectionData& selection_data,
705     guint, guint time);
706 persson 1303
707 schoenebeck 2604 void script_name_changed(const Gtk::TreeModel::Path& path,
708     const Gtk::TreeModel::iterator& iter);
709 schoenebeck 2644 void script_double_clicked(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
710 schoenebeck 1225 void sample_name_changed(const Gtk::TreeModel::Path& path,
711     const Gtk::TreeModel::iterator& iter);
712     void instrument_name_changed(const Gtk::TreeModel::Path& path,
713     const Gtk::TreeModel::iterator& iter);
714 persson 2445 void instr_name_changed_by_instr_props(Gtk::TreeModel::iterator& it);
715 schoenebeck 3340 bool instrument_row_visible(const Gtk::TreeModel::const_iterator& iter);
716 persson 2442 sigc::connection instrument_name_connection;
717 schoenebeck 1225
718 schoenebeck 2548 void on_action_combine_instruments();
719 schoenebeck 2624 void on_action_view_references();
720 schoenebeck 2553 void on_action_merge_files();
721     void mergeFiles(const std::vector<std::string>& filenames);
722 schoenebeck 2548
723 schoenebeck 2621 void on_sample_ref_changed(gig::Sample* oldSample, gig::Sample* newSample);
724     void on_sample_ref_count_incremented(gig::Sample* sample, int offset);
725     void on_samples_to_be_removed(std::list<gig::Sample*> samples);
726    
727 schoenebeck 2715 void add_or_replace_sample(bool replace);
728    
729 schoenebeck 1225 void __import_queued_samples();
730     void __clear();
731 schoenebeck 2553 void __refreshEntireGUI();
732 schoenebeck 3339 void updateScriptListOfMenu();
733     void assignScript(gig::Script* pScript);
734 schoenebeck 3419 void dropAllScriptSlots();
735 schoenebeck 1225
736 persson 1261 bool close_confirmation_dialog();
737 schoenebeck 1382 bool leaving_shared_mode_dialog();
738 persson 1261
739 schoenebeck 1225 Gtk::Menu* popup_menu;
740 schoenebeck 3364 #if USE_GTKMM_BUILDER
741     Gtk::Menu* sample_popup;
742     Gtk::Menu* script_popup;
743     #endif
744 persson 1261
745     bool on_delete_event(GdkEventAny* event);
746 persson 1303
747     bool first_call_to_drag_data_get;
748 persson 3469
749 schoenebeck 2464 bool is_copy_samples_unity_note_enabled() const;
750     bool is_copy_samples_fine_tune_enabled() const;
751     bool is_copy_samples_loop_enabled() const;
752 schoenebeck 1225 };
753    
754     #endif

  ViewVC Help
Powered by ViewVC