/[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 3637 - (hide annotations) (download) (as text)
Thu Oct 24 13:12:52 2019 UTC (4 years, 6 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 27540 byte(s)
* Implemented sample property dialog.
* Bumped version (1.1.1.svn6).

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

  ViewVC Help
Powered by ViewVC