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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3471 - (show annotations) (download) (as text)
Sat Feb 16 19:13:37 2019 UTC (5 years, 2 months ago) by persson
File MIME type: text/x-c++hdr
File size: 24734 byte(s)
* Fix resource leak: join loader and saver threads after use

1 /* -*- c++ -*-
2 * Copyright (C) 2006 - 2019 Andreas Persson
3 *
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 #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/box.h>
34 #include <gtkmm/buttonbox.h>
35 #include <gtkmm/dialog.h>
36 #include <gtkmm/liststore.h>
37 #include <gtkmm/menu.h>
38 #include <gtkmm/paned.h>
39 #include <gtkmm/progressbar.h>
40 #include <gtkmm/radiomenuitem.h>
41 #include <gtkmm/scrolledwindow.h>
42 #include <gtkmm/treestore.h>
43 #include <gtkmm/treemodelfilter.h>
44 #include <gtkmm/window.h>
45 #include <gtkmm/statusbar.h>
46 #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>
57
58 #include "regionchooser.h"
59 #include "dimregionchooser.h"
60 #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;
68
69 class PropDialog : public ManagedWindow,
70 public PropEditor<DLS::Info> {
71 public:
72 PropDialog();
73 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:
82 ChoiceEntry<int> eFileFormat;
83 StringEntry eName;
84 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 ManagedWindow,
110 public PropEditor<gig::Instrument> {
111 public:
112 InstrumentProps();
113 void set_instrument(gig::Instrument* instrument);
114 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:
127 void set_Name(const gig::String& name);
128 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;
136 Table table;
137 StringEntry eName;
138 BoolEntry eIsDrum;
139 NumEntryTemp<uint16_t> eMIDIBank;
140 NumEntryTemp<uint32_t> eMIDIProgram;
141 NumEntryGain eAttenuation;
142 BoolEntryPlus6 eGainPlus6;
143 NumEntryTemp<uint16_t> eEffectSend;
144 NumEntryTemp<int16_t> eFineTune;
145 NumEntryTemp<uint16_t> ePitchbendRange;
146 BoolEntry ePianoReleaseMode;
147 NoteEntry eDimensionKeyRangeLow;
148 NoteEntry eDimensionKeyRangeHigh;
149 };
150
151 class ProgressDialog : public Gtk::Dialog {
152 public:
153 ProgressDialog(const Glib::ustring& title, Gtk::Window& parent);
154 void set_fraction(float fraction) { progressBar.set_fraction(fraction); }
155 protected:
156 Gtk::ProgressBar progressBar;
157 };
158
159 class LoaderSaverBase {
160 public:
161 void launch();
162 Glib::Dispatcher& signal_progress();
163 Glib::Dispatcher& signal_finished(); ///< Finished successfully, without error.
164 Glib::Dispatcher& signal_error();
165 void progress_callback(float fraction);
166 float get_progress();
167 void join();
168 const Glib::ustring filename;
169 Glib::ustring error_message;
170 gig::File* gig;
171
172 protected:
173 LoaderSaverBase(const Glib::ustring filename, gig::File* gig);
174
175 private:
176 Glib::Threads::Thread* thread;
177 void thread_function();
178 virtual void thread_function_sub(gig::progress_t& progress) = 0;
179 Glib::Dispatcher finished_dispatcher;
180 Glib::Dispatcher progress_dispatcher;
181 Glib::Dispatcher error_dispatcher;
182 Glib::Threads::Mutex progressMutex;
183 float progress;
184 };
185
186 class Loader : public LoaderSaverBase {
187 public:
188 Loader(const char* filename);
189
190 private:
191 void thread_function_sub(gig::progress_t& progress);
192 };
193
194 class Saver : public LoaderSaverBase {
195 public:
196 Saver(gig::File* file, Glib::ustring filename = ""); ///< one argument means "save", two arguments means "save as"
197
198 private:
199 void thread_function_sub(gig::progress_t& progress);
200 };
201
202 class MainWindow : public ManagedWindow {
203 public:
204 MainWindow();
205 virtual ~MainWindow();
206 void load_file(const char* name);
207 void load_instrument(gig::Instrument* instr);
208 void file_changed();
209 sigc::signal<void, gig::File*>& signal_file_structure_to_be_changed();
210 sigc::signal<void, gig::File*>& signal_file_structure_changed();
211 sigc::signal<void, std::list<gig::Sample*> >& signal_samples_to_be_removed();
212 sigc::signal<void>& signal_samples_removed();
213 sigc::signal<void, gig::Region*>& signal_region_to_be_changed();
214 sigc::signal<void, gig::Region*>& signal_region_changed();
215 sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_to_be_changed();
216 sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_changed();
217 sigc::signal<void, gig::Sample*>& signal_sample_changed();
218 sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& signal_sample_ref_changed();
219
220 sigc::signal<void, int/*key*/, int/*velocity*/>& signal_note_on();
221 sigc::signal<void, int/*key*/, int/*velocity*/>& signal_note_off();
222
223 sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_hit();
224 sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_released();
225
226 sigc::signal<void, gig::Instrument*>& signal_switch_sampler_instrument();
227
228 sigc::signal<void, gig::Script*> signal_script_to_be_changed;
229 sigc::signal<void, gig::Script*> signal_script_changed;
230
231 // implementation for abstract methods of interface class "ManagedWindow"
232 virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->mainWindowX; }
233 virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->mainWindowY; }
234 virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->mainWindowW; }
235 virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->mainWindowH; }
236
237 protected:
238 #if USE_GTKMM_BUILDER
239 Glib::RefPtr<Gio::SimpleActionGroup> m_actionGroup;
240 Glib::RefPtr<Gtk::Builder> m_uiManager;
241 #else
242 Glib::RefPtr<Gtk::ActionGroup> actionGroup;
243 Glib::RefPtr<Gtk::UIManager> uiManager;
244 #endif
245
246 #if USE_GLIB_ACTION
247 Glib::RefPtr<Gio::SimpleAction> m_actionMIDIRules;
248
249 Glib::RefPtr<Gio::SimpleAction> m_actionCopyDimRgn;
250 Glib::RefPtr<Gio::SimpleAction> m_actionPasteDimRgn;
251 Glib::RefPtr<Gio::SimpleAction> m_actionAdjustClipboard;
252
253 Glib::RefPtr<Gio::SimpleAction> m_actionSampleProperties;
254 Glib::RefPtr<Gio::SimpleAction> m_actionAddSample;
255 Glib::RefPtr<Gio::SimpleAction> m_actionRemoveSample;
256 Glib::RefPtr<Gio::SimpleAction> m_actionViewSampleRefs;
257 Glib::RefPtr<Gio::SimpleAction> m_actionReplaceSample;
258 Glib::RefPtr<Gio::SimpleAction> m_actionAddSampleGroup;
259
260 Glib::RefPtr<Gio::SimpleAction> m_actionAddScriptGroup;
261 Glib::RefPtr<Gio::SimpleAction> m_actionAddScript;
262 Glib::RefPtr<Gio::SimpleAction> m_actionEditScript;
263 Glib::RefPtr<Gio::SimpleAction> m_actionRemoveScript;
264
265 Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleUnity;
266 Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleTune;
267 Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleLoop;
268 Glib::RefPtr<Gio::SimpleAction> m_actionToggleStatusBar;
269 Glib::RefPtr<Gio::SimpleAction> m_actionToggleRestoreWinDim;
270 Glib::RefPtr<Gio::SimpleAction> m_actionToggleSaveWithTempFile;
271 Glib::RefPtr<Gio::SimpleAction> m_actionToggleWarnOnExtensions;
272 Glib::RefPtr<Gio::SimpleAction> m_actionToggleShowTooltips;
273 Glib::RefPtr<Gio::SimpleAction> m_actionToggleSyncSamplerSelection;
274 Glib::RefPtr<Gio::SimpleAction> m_actionToggleMoveRootNoteWithRegion;
275 #endif
276
277 Gtk::Statusbar m_StatusBar;
278 Gtk::Label m_AttachedStateLabel;
279 Gtk::Image m_AttachedStateImage;
280
281 RegionChooser m_RegionChooser;
282 DimRegionChooser m_DimRegionChooser;
283
284 PropDialog propDialog;
285 InstrumentProps instrumentProps;
286 MidiRules midiRules;
287
288 /**
289 * Ensures that the 2 signals MainWindow::dimreg_to_be_changed_signal and
290 * MainWindowv::dimreg_changed_signal are always triggered correctly as a
291 * pair. It behaves similar to a "mutex lock guard" design pattern.
292 */
293 class DimRegionChangeGuard : public SignalGuard<gig::DimensionRegion*> {
294 public:
295 DimRegionChangeGuard(MainWindow* w, gig::DimensionRegion* pDimReg) :
296 SignalGuard<gig::DimensionRegion*>(w->dimreg_to_be_changed_signal, w->dimreg_changed_signal, pDimReg)
297 {
298 }
299 };
300
301 sigc::signal<void, gig::File*> file_structure_to_be_changed_signal;
302 sigc::signal<void, gig::File*> file_structure_changed_signal;
303 sigc::signal<void, std::list<gig::Sample*> > samples_to_be_removed_signal;
304 sigc::signal<void> samples_removed_signal;
305 sigc::signal<void, gig::Region*> region_to_be_changed_signal;
306 sigc::signal<void, gig::Region*> region_changed_signal;
307 sigc::signal<void, gig::DimensionRegion*> dimreg_to_be_changed_signal;
308 sigc::signal<void, gig::DimensionRegion*> dimreg_changed_signal;
309 sigc::signal<void, gig::Sample*> sample_changed_signal;
310 sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/> sample_ref_changed_signal;
311
312 sigc::signal<void, int/*key*/, int/*velocity*/> note_on_signal;
313 sigc::signal<void, int/*key*/, int/*velocity*/> note_off_signal;
314
315 sigc::signal<void, gig::Instrument*> switch_sampler_instrument_signal;
316
317 #if !USE_GTKMM_BUILDER
318 void on_instrument_selection_change(Gtk::RadioMenuItem* item);
319 #endif
320 void on_sel_change();
321 void region_changed();
322 void dimreg_changed();
323 void select_instrument(gig::Instrument* instrument);
324 bool select_dimension_region(gig::DimensionRegion* dimRgn);
325 void select_sample(gig::Sample* sample);
326 void on_loader_progress();
327 void on_loader_finished();
328 void on_loader_error();
329 void on_saver_progress();
330 void on_saver_error();
331 void on_saver_finished();
332 void updateMacroMenu();
333 void onMacroSelected(int iMacro);
334 void setupMacros();
335 void onMacrosSetupChanged(const std::vector<Serialization::Archive>& macros);
336 void applyMacro(Serialization::Archive& macro);
337 void onScriptSlotsModified(gig::Instrument* pInstrument);
338 void bringToFront();
339
340 void dimreg_all_dimregs_toggled();
341 gig::Instrument* get_instrument();
342 void add_region_to_dimregs(gig::Region* region, bool stereo, bool all_dimregs);
343 void update_dimregs();
344
345 class ModelColumns : public Gtk::TreeModel::ColumnRecord {
346 public:
347 ModelColumns() {
348 add(m_col_nr);
349 add(m_col_name);
350 add(m_col_instr);
351 add(m_col_scripts);
352 add(m_col_tooltip);
353 }
354
355 Gtk::TreeModelColumn<int> m_col_nr;
356 Gtk::TreeModelColumn<Glib::ustring> m_col_name;
357 Gtk::TreeModelColumn<gig::Instrument*> m_col_instr;
358 Gtk::TreeModelColumn<Glib::ustring> m_col_scripts;
359 Gtk::TreeModelColumn<Glib::ustring> m_col_tooltip;
360 } m_Columns;
361
362 VBox m_VBox;
363 Gtk::HPaned m_HPaned;
364
365 Gtk::ScrolledWindow m_ScrolledWindow;
366
367 Gtk::TreeView m_TreeView;
368 Glib::RefPtr<Gtk::ListStore> m_refTreeModel;
369 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.
370
371 #if USE_GTKMM_BUILDER
372 Gtk::Menu* menuMacro;
373 #else
374 Gtk::Menu* instrument_menu; // kept for GTKMM 2 version only, will be completely removed in future
375 #endif
376 Gtk::Menu* assign_scripts_menu;
377
378 std::map<gig::Sample*,int> sample_ref_count;
379
380 class SamplesModel : public Gtk::TreeModel::ColumnRecord {
381 public:
382 SamplesModel() {
383 add(m_col_name);
384 add(m_col_sample);
385 add(m_col_group);
386 add(m_col_refcount);
387 add(m_color);
388 }
389
390 Gtk::TreeModelColumn<Glib::ustring> m_col_name;
391 Gtk::TreeModelColumn<gig::Sample*> m_col_sample;
392 Gtk::TreeModelColumn<gig::Group*> m_col_group;
393 Gtk::TreeModelColumn<Glib::ustring> m_col_refcount;
394 Gtk::TreeModelColumn<Glib::ustring> m_color;
395 } m_SamplesModel;
396
397 class SamplesTreeStore : public Gtk::TreeStore {
398 public:
399 static Glib::RefPtr<SamplesTreeStore> create(const SamplesModel& columns) {
400 return Glib::RefPtr<SamplesTreeStore>( new SamplesTreeStore(columns) );
401 }
402 protected:
403 SamplesTreeStore(const SamplesModel& columns) : Gtk::TreeStore(columns) {}
404 };
405
406 Gtk::ScrolledWindow m_ScrolledWindowSamples;
407 Gtk::TreeView m_TreeViewSamples;
408 Glib::RefPtr<SamplesTreeStore> m_refSamplesTreeModel;
409
410 class ScriptsModel : public Gtk::TreeModel::ColumnRecord {
411 public:
412 ScriptsModel() {
413 add(m_col_name);
414 add(m_col_script);
415 add(m_col_group);
416 }
417
418 Gtk::TreeModelColumn<Glib::ustring> m_col_name;
419 Gtk::TreeModelColumn<gig::Script*> m_col_script;
420 Gtk::TreeModelColumn<gig::ScriptGroup*> m_col_group;
421 } m_ScriptsModel;
422
423 class ScriptsTreeStore : public Gtk::TreeStore {
424 public:
425 static Glib::RefPtr<ScriptsTreeStore> create(const ScriptsModel& columns) {
426 return Glib::RefPtr<ScriptsTreeStore>( new ScriptsTreeStore(columns) );
427 }
428 protected:
429 ScriptsTreeStore(const ScriptsModel& columns) : Gtk::TreeStore(columns) {}
430 };
431
432 Gtk::ScrolledWindow m_ScrolledWindowScripts;
433 Gtk::TreeView m_TreeViewScripts;
434 Glib::RefPtr<ScriptsTreeStore> m_refScriptsTreeModel;
435
436 VBox dimreg_vbox;
437 HBox dimreg_hbox;
438 Gtk::Label dimreg_label;
439 Gtk::CheckButton dimreg_all_regions;
440 Gtk::CheckButton dimreg_all_dimregs;
441 Gtk::CheckButton dimreg_stereo;
442
443 HBox legend_hbox;
444 Gtk::Label labelLegend;
445 Gtk::Image imageNoSample;
446 Gtk::Label labelNoSample;
447 Gtk::Image imageMissingSample;
448 Gtk::Label labelMissingSample;
449 Gtk::Image imageLooped;
450 Gtk::Label labelLooped;
451 Gtk::Image imageSomeLoops;
452 Gtk::Label labelSomeLoops;
453 DimRegionEdit dimreg_edit;
454
455 VBox m_left_vbox;
456 Gtk::Notebook m_TreeViewNotebook;
457 HBox m_searchField;
458 Gtk::Label m_searchLabel;
459 Gtk::Entry m_searchText;
460
461 struct SampleImportItem {
462 gig::Sample* gig_sample; // pointer to the gig::Sample to
463 // which the sample data should be
464 // imported to
465 Glib::ustring sample_path; // file name of the sample to be
466 // imported
467 };
468 std::map<gig::Sample*, SampleImportItem> m_SampleImportQueue;
469
470
471 void on_action_file_new();
472 void on_action_file_open();
473 void on_action_file_save();
474 void on_action_file_save_as();
475 void on_action_file_properties();
476 void on_action_quit();
477 void show_instr_props();
478 bool instr_props_set_instrument();
479 void show_midi_rules();
480 void show_script_slots();
481 void on_action_view_status_bar();
482 void on_auto_restore_win_dim();
483 void on_save_with_temporary_file();
484 void on_action_refresh_all();
485 void on_action_warn_user_on_extensions();
486 void on_action_show_tooltips();
487 void on_show_tooltips_changed();
488 void on_action_sync_sampler_instrument_selection();
489 void on_action_move_root_note_with_region_moved();
490 void on_action_help_about();
491
492 void on_notebook_tab_switched(void* page, guint page_num);
493
494 // sample right-click popup actions
495 #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
496 bool on_sample_treeview_button_release(Gdk::EventButton& button);
497 #else
498 void on_sample_treeview_button_release(GdkEventButton* button);
499 #endif
500 void on_action_sample_properties();
501 void on_action_add_group();
502 void on_action_add_sample();
503 void on_action_replace_sample();
504 void on_action_replace_all_samples_in_all_groups();
505 void on_action_remove_sample();
506 void on_action_remove_unused_samples();
507
508 // script right-click popup actions
509 #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
510 bool on_script_treeview_button_release(Gdk::EventButton& button);
511 #else
512 void on_script_treeview_button_release(GdkEventButton* button);
513 #endif
514 void on_action_add_script_group();
515 void on_action_add_script();
516 void on_action_edit_script();
517 void on_action_remove_script();
518
519 void on_action_add_instrument();
520 void on_action_duplicate_instrument();
521 void on_action_remove_instrument();
522
523 void show_samples_tab();
524 void show_intruments_tab();
525 void show_scripts_tab();
526
527 void select_prev_instrument();
528 void select_next_instrument();
529 void select_instrument_by_dir(int dir);
530
531 void select_prev_region();
532 void select_next_region();
533
534 void select_next_dim_rgn_zone();
535 void select_prev_dim_rgn_zone();
536 void select_add_next_dim_rgn_zone();
537 void select_add_prev_dim_rgn_zone();
538 void select_prev_dimension();
539 void select_next_dimension();
540
541 Serialization::Archive m_serializationArchive; ///< Clipboard content.
542 std::vector<Serialization::Archive> m_macros; ///< User configured list of macros.
543
544 void copy_selected_dimrgn();
545 void paste_copied_dimrgn();
546 void adjust_clipboard_content();
547 void updateClipboardCopyAvailable();
548 void updateClipboardPasteAvailable();
549 #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
550 void on_clipboard_owner_change(Gdk::EventOwnerChange& event);
551 #else
552 void on_clipboard_owner_change(GdkEventOwnerChange* event);
553 #endif
554 void on_clipboard_get(Gtk::SelectionData& selection_data, guint info);
555 void on_clipboard_clear();
556 void on_clipboard_received(const Gtk::SelectionData& selection_data);
557 void on_clipboard_received_targets(const std::vector<Glib::ustring>& targets);
558
559 void add_instrument(gig::Instrument* instrument);
560 #if !USE_GTKMM_BUILDER
561 Gtk::RadioMenuItem* add_instrument_to_menu(const Glib::ustring& name,
562 int position = -1);
563 void remove_instrument_from_menu(int index);
564 #endif
565 bool onQueryTreeViewTooltip(int x, int y, bool keyboardTip, const Glib::RefPtr<Gtk::Tooltip>& tooltip);
566
567 ProgressDialog* progress_dialog;
568 Loader* loader;
569 Saver* saver;
570 void load_gig(gig::File* gig, const char* filename, bool isSharedInstrument = false);
571 void updateSampleRefCountMap(gig::File* gig);
572
573 gig::File* file;
574 bool file_is_shared;
575 bool file_has_name;
576 bool file_is_changed;
577 std::string filename;
578 std::string current_gig_dir;
579 std::string current_sample_dir;
580
581 void set_file_is_shared(bool);
582
583 bool file_save();
584 bool file_save_as();
585 bool check_if_savable();
586
587 #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
588 bool on_button_release(Gdk::EventButton& button);
589 #else
590 void on_button_release(GdkEventButton* button);
591 #endif
592 void on_instruments_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
593 void on_instruments_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
594 Gtk::SelectionData& selection_data, guint, guint);
595 void on_instruments_treeview_drop_drag_data_received(
596 const Glib::RefPtr<Gdk::DragContext>& context, int, int,
597 const Gtk::SelectionData& selection_data, guint, guint time
598 );
599 void on_scripts_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
600 void on_scripts_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
601 Gtk::SelectionData& selection_data, guint, guint);
602 void on_sample_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
603 void on_sample_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
604 Gtk::SelectionData& selection_data, guint, guint);
605 void on_sample_label_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context,
606 int, int,
607 const Gtk::SelectionData& selection_data,
608 guint, guint time);
609
610 void script_name_changed(const Gtk::TreeModel::Path& path,
611 const Gtk::TreeModel::iterator& iter);
612 void script_double_clicked(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
613 void sample_name_changed(const Gtk::TreeModel::Path& path,
614 const Gtk::TreeModel::iterator& iter);
615 void instrument_name_changed(const Gtk::TreeModel::Path& path,
616 const Gtk::TreeModel::iterator& iter);
617 void instr_name_changed_by_instr_props(Gtk::TreeModel::iterator& it);
618 bool instrument_row_visible(const Gtk::TreeModel::const_iterator& iter);
619 sigc::connection instrument_name_connection;
620
621 void on_action_combine_instruments();
622 void on_action_view_references();
623 void on_action_merge_files();
624 void mergeFiles(const std::vector<std::string>& filenames);
625
626 void on_sample_ref_changed(gig::Sample* oldSample, gig::Sample* newSample);
627 void on_sample_ref_count_incremented(gig::Sample* sample, int offset);
628 void on_samples_to_be_removed(std::list<gig::Sample*> samples);
629
630 void add_or_replace_sample(bool replace);
631
632 void __import_queued_samples();
633 void __clear();
634 void __refreshEntireGUI();
635 void updateScriptListOfMenu();
636 void assignScript(gig::Script* pScript);
637 void dropAllScriptSlots();
638
639 bool close_confirmation_dialog();
640 bool leaving_shared_mode_dialog();
641
642 Gtk::Menu* popup_menu;
643 #if USE_GTKMM_BUILDER
644 Gtk::Menu* sample_popup;
645 Gtk::Menu* script_popup;
646 #endif
647
648 bool on_delete_event(GdkEventAny* event);
649
650 bool first_call_to_drag_data_get;
651
652 bool is_copy_samples_unity_note_enabled() const;
653 bool is_copy_samples_fine_tune_enabled() const;
654 bool is_copy_samples_loop_enabled() const;
655 };
656
657 #endif

  ViewVC Help
Powered by ViewVC