1 |
/* -*- c++ -*- |
/* -*- c++ -*- |
2 |
* Copyright (C) 2006 - 2017 Andreas Persson |
* Copyright (C) 2006 - 2019 Andreas Persson |
3 |
* |
* |
4 |
* This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
* modify it under the terms of the GNU General Public License as |
28 |
# include <Serialization.h> |
# include <Serialization.h> |
29 |
#endif |
#endif |
30 |
|
|
31 |
|
#include "compat.h" |
32 |
|
|
33 |
#include <gtkmm/box.h> |
#include <gtkmm/box.h> |
|
#include <gtkmm/actiongroup.h> |
|
34 |
#include <gtkmm/buttonbox.h> |
#include <gtkmm/buttonbox.h> |
35 |
#include <gtkmm/dialog.h> |
#include <gtkmm/dialog.h> |
36 |
#include <gtkmm/liststore.h> |
#include <gtkmm/liststore.h> |
40 |
#include <gtkmm/radiomenuitem.h> |
#include <gtkmm/radiomenuitem.h> |
41 |
#include <gtkmm/scrolledwindow.h> |
#include <gtkmm/scrolledwindow.h> |
42 |
#include <gtkmm/treestore.h> |
#include <gtkmm/treestore.h> |
43 |
#include <gtkmm/uimanager.h> |
#include <gtkmm/treemodelfilter.h> |
44 |
#include <gtkmm/window.h> |
#include <gtkmm/window.h> |
45 |
#include <gtkmm/statusbar.h> |
#include <gtkmm/statusbar.h> |
46 |
#include <gtkmm/image.h> |
#include <gtkmm/image.h> |
47 |
|
#include <gtkmm/entry.h> |
48 |
|
#include <gtkmm/notebook.h> |
49 |
|
|
50 |
|
#if USE_GTKMM_BUILDER |
51 |
|
# include <gtkmm/builder.h> |
52 |
|
#else |
53 |
|
# include <gtkmm/uimanager.h> // deprecated in gtkmm >= 3.21.4 |
54 |
|
#endif |
55 |
|
|
56 |
#include <sstream> |
#include <sstream> |
57 |
|
|
70 |
public PropEditor<DLS::Info> { |
public PropEditor<DLS::Info> { |
71 |
public: |
public: |
72 |
PropDialog(); |
PropDialog(); |
|
void set_info(DLS::Info* info); |
|
73 |
void set_file(gig::File* file); |
void set_file(gig::File* file); |
74 |
|
|
75 |
// implementation for abstract methods of interface class "ManagedWindow" |
// implementation for abstract methods of interface class "ManagedWindow" |
96 |
StringEntry eSourceForm; |
StringEntry eSourceForm; |
97 |
StringEntry eCommissioned; |
StringEntry eCommissioned; |
98 |
StringEntry eSubject; |
StringEntry eSubject; |
99 |
Gtk::VBox vbox; |
VBox vbox; |
100 |
Gtk::HButtonBox buttonBox; |
HButtonBox buttonBox; |
101 |
Gtk::Button quitButton; |
Gtk::Button quitButton; |
102 |
Table table; |
Table table; |
103 |
|
|
104 |
gig::File* m_file; |
gig::File* m_file; |
105 |
|
|
106 |
void onFileFormatChanged(); |
void set_FileFormat(int value); |
107 |
}; |
}; |
108 |
|
|
109 |
class InstrumentProps : public ManagedWindow, |
class InstrumentProps : public ManagedWindow, |
130 |
void set_MIDIProgram(uint32_t value); |
void set_MIDIProgram(uint32_t value); |
131 |
|
|
132 |
sigc::signal<void> sig_name_changed; |
sigc::signal<void> sig_name_changed; |
133 |
Gtk::VBox vbox; |
VBox vbox; |
134 |
Gtk::HButtonBox buttonBox; |
HButtonBox buttonBox; |
135 |
Gtk::Button quitButton; |
Gtk::Button quitButton; |
136 |
Table table; |
Table table; |
137 |
StringEntry eName; |
StringEntry eName; |
238 |
virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->mainWindowH; } |
virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->mainWindowH; } |
239 |
|
|
240 |
protected: |
protected: |
241 |
|
#if USE_GTKMM_BUILDER |
242 |
|
Glib::RefPtr<Gio::SimpleActionGroup> m_actionGroup; |
243 |
|
Glib::RefPtr<Gtk::Builder> m_uiManager; |
244 |
|
#else |
245 |
Glib::RefPtr<Gtk::ActionGroup> actionGroup; |
Glib::RefPtr<Gtk::ActionGroup> actionGroup; |
246 |
Glib::RefPtr<Gtk::UIManager> uiManager; |
Glib::RefPtr<Gtk::UIManager> uiManager; |
247 |
|
#endif |
248 |
|
|
249 |
|
#if USE_GLIB_ACTION |
250 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionMIDIRules; |
251 |
|
|
252 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionCopyDimRgn; |
253 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionPasteDimRgn; |
254 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionAdjustClipboard; |
255 |
|
|
256 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionSampleProperties; |
257 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionAddSample; |
258 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionRemoveSample; |
259 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionViewSampleRefs; |
260 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionReplaceSample; |
261 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionAddSampleGroup; |
262 |
|
|
263 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionAddScriptGroup; |
264 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionAddScript; |
265 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionEditScript; |
266 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionRemoveScript; |
267 |
|
|
268 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleUnity; |
269 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleTune; |
270 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleLoop; |
271 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleStatusBar; |
272 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleRestoreWinDim; |
273 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleSaveWithTempFile; |
274 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleWarnOnExtensions; |
275 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleShowTooltips; |
276 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleSyncSamplerSelection; |
277 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleMoveRootNoteWithRegion; |
278 |
|
#endif |
279 |
|
|
280 |
Gtk::Statusbar m_StatusBar; |
Gtk::Statusbar m_StatusBar; |
281 |
Gtk::Label m_AttachedStateLabel; |
Gtk::Label m_AttachedStateLabel; |
317 |
|
|
318 |
sigc::signal<void, gig::Instrument*> switch_sampler_instrument_signal; |
sigc::signal<void, gig::Instrument*> switch_sampler_instrument_signal; |
319 |
|
|
320 |
|
#if !USE_GTKMM_BUILDER |
321 |
void on_instrument_selection_change(Gtk::RadioMenuItem* item); |
void on_instrument_selection_change(Gtk::RadioMenuItem* item); |
322 |
|
#endif |
323 |
void on_sel_change(); |
void on_sel_change(); |
324 |
void region_changed(); |
void region_changed(); |
325 |
void dimreg_changed(); |
void dimreg_changed(); |
338 |
void onMacrosSetupChanged(const std::vector<Serialization::Archive>& macros); |
void onMacrosSetupChanged(const std::vector<Serialization::Archive>& macros); |
339 |
void applyMacro(Serialization::Archive& macro); |
void applyMacro(Serialization::Archive& macro); |
340 |
void onScriptSlotsModified(gig::Instrument* pInstrument); |
void onScriptSlotsModified(gig::Instrument* pInstrument); |
341 |
|
void bringToFront(); |
342 |
|
|
343 |
void dimreg_all_dimregs_toggled(); |
void dimreg_all_dimregs_toggled(); |
344 |
gig::Instrument* get_instrument(); |
gig::Instrument* get_instrument(); |
352 |
add(m_col_name); |
add(m_col_name); |
353 |
add(m_col_instr); |
add(m_col_instr); |
354 |
add(m_col_scripts); |
add(m_col_scripts); |
355 |
|
add(m_col_tooltip); |
356 |
} |
} |
357 |
|
|
358 |
Gtk::TreeModelColumn<int> m_col_nr; |
Gtk::TreeModelColumn<int> m_col_nr; |
359 |
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
360 |
Gtk::TreeModelColumn<gig::Instrument*> m_col_instr; |
Gtk::TreeModelColumn<gig::Instrument*> m_col_instr; |
361 |
Gtk::TreeModelColumn<Glib::ustring> m_col_scripts; |
Gtk::TreeModelColumn<Glib::ustring> m_col_scripts; |
362 |
|
Gtk::TreeModelColumn<Glib::ustring> m_col_tooltip; |
363 |
} m_Columns; |
} m_Columns; |
364 |
|
|
365 |
Gtk::VBox m_VBox; |
VBox m_VBox; |
366 |
Gtk::HPaned m_HPaned; |
Gtk::HPaned m_HPaned; |
367 |
|
|
368 |
Gtk::ScrolledWindow m_ScrolledWindow; |
Gtk::ScrolledWindow m_ScrolledWindow; |
369 |
|
|
370 |
Gtk::TreeView m_TreeView; |
Gtk::TreeView m_TreeView; |
371 |
Glib::RefPtr<Gtk::ListStore> m_refTreeModel; |
Glib::RefPtr<Gtk::ListStore> m_refTreeModel; |
372 |
|
Glib::RefPtr<Gtk::TreeModelFilter> m_refTreeModelFilter; //FIXME: I really would love to get rid of TreeModelFilter, because it causes behavior conflicts with get_model() all over the place (see the respective comments regarding get_model()), however I found no other way to filter a treeview effectively. |
373 |
|
|
374 |
Gtk::Menu* instrument_menu; |
#if USE_GTKMM_BUILDER |
375 |
|
Gtk::Menu* menuMacro; |
376 |
|
#else |
377 |
|
Gtk::Menu* instrument_menu; // kept for GTKMM 2 version only, will be completely removed in future |
378 |
|
#endif |
379 |
|
Gtk::Menu* assign_scripts_menu; |
380 |
|
|
381 |
std::map<gig::Sample*,int> sample_ref_count; |
std::map<gig::Sample*,int> sample_ref_count; |
382 |
|
|
436 |
Gtk::TreeView m_TreeViewScripts; |
Gtk::TreeView m_TreeViewScripts; |
437 |
Glib::RefPtr<ScriptsTreeStore> m_refScriptsTreeModel; |
Glib::RefPtr<ScriptsTreeStore> m_refScriptsTreeModel; |
438 |
|
|
439 |
Gtk::VBox dimreg_vbox; |
VBox dimreg_vbox; |
440 |
Gtk::HBox dimreg_hbox; |
HBox dimreg_hbox; |
441 |
Gtk::Label dimreg_label; |
Gtk::Label dimreg_label; |
442 |
Gtk::CheckButton dimreg_all_regions; |
Gtk::CheckButton dimreg_all_regions; |
443 |
Gtk::CheckButton dimreg_all_dimregs; |
Gtk::CheckButton dimreg_all_dimregs; |
444 |
Gtk::CheckButton dimreg_stereo; |
Gtk::CheckButton dimreg_stereo; |
445 |
|
|
446 |
Gtk::HBox legend_hbox; |
HBox legend_hbox; |
447 |
Gtk::Label labelLegend; |
Gtk::Label labelLegend; |
448 |
Gtk::Image imageNoSample; |
Gtk::Image imageNoSample; |
449 |
Gtk::Label labelNoSample; |
Gtk::Label labelNoSample; |
455 |
Gtk::Label labelSomeLoops; |
Gtk::Label labelSomeLoops; |
456 |
DimRegionEdit dimreg_edit; |
DimRegionEdit dimreg_edit; |
457 |
|
|
458 |
|
VBox m_left_vbox; |
459 |
Gtk::Notebook m_TreeViewNotebook; |
Gtk::Notebook m_TreeViewNotebook; |
460 |
|
HBox m_searchField; |
461 |
|
Gtk::Label m_searchLabel; |
462 |
|
Gtk::Entry m_searchText; |
463 |
|
|
464 |
struct SampleImportItem { |
struct SampleImportItem { |
465 |
gig::Sample* gig_sample; // pointer to the gig::Sample to |
gig::Sample* gig_sample; // pointer to the gig::Sample to |
486 |
void on_save_with_temporary_file(); |
void on_save_with_temporary_file(); |
487 |
void on_action_refresh_all(); |
void on_action_refresh_all(); |
488 |
void on_action_warn_user_on_extensions(); |
void on_action_warn_user_on_extensions(); |
489 |
|
void on_action_show_tooltips(); |
490 |
|
void on_show_tooltips_changed(); |
491 |
void on_action_sync_sampler_instrument_selection(); |
void on_action_sync_sampler_instrument_selection(); |
492 |
void on_action_move_root_note_with_region_moved(); |
void on_action_move_root_note_with_region_moved(); |
493 |
void on_action_help_about(); |
void on_action_help_about(); |
494 |
|
|
495 |
|
void on_notebook_tab_switched(void* page, guint page_num); |
496 |
|
|
497 |
// sample right-click popup actions |
// sample right-click popup actions |
498 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
499 |
|
bool on_sample_treeview_button_release(Gdk::EventButton& button); |
500 |
|
#else |
501 |
void on_sample_treeview_button_release(GdkEventButton* button); |
void on_sample_treeview_button_release(GdkEventButton* button); |
502 |
|
#endif |
503 |
void on_action_sample_properties(); |
void on_action_sample_properties(); |
504 |
void on_action_add_group(); |
void on_action_add_group(); |
505 |
void on_action_add_sample(); |
void on_action_add_sample(); |
509 |
void on_action_remove_unused_samples(); |
void on_action_remove_unused_samples(); |
510 |
|
|
511 |
// script right-click popup actions |
// script right-click popup actions |
512 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
513 |
|
bool on_script_treeview_button_release(Gdk::EventButton& button); |
514 |
|
#else |
515 |
void on_script_treeview_button_release(GdkEventButton* button); |
void on_script_treeview_button_release(GdkEventButton* button); |
516 |
|
#endif |
517 |
void on_action_add_script_group(); |
void on_action_add_script_group(); |
518 |
void on_action_add_script(); |
void on_action_add_script(); |
519 |
void on_action_edit_script(); |
void on_action_edit_script(); |
527 |
void show_intruments_tab(); |
void show_intruments_tab(); |
528 |
void show_scripts_tab(); |
void show_scripts_tab(); |
529 |
|
|
530 |
|
void select_prev_instrument(); |
531 |
|
void select_next_instrument(); |
532 |
|
void select_instrument_by_dir(int dir); |
533 |
|
|
534 |
void select_prev_region(); |
void select_prev_region(); |
535 |
void select_next_region(); |
void select_next_region(); |
536 |
|
|
549 |
void adjust_clipboard_content(); |
void adjust_clipboard_content(); |
550 |
void updateClipboardCopyAvailable(); |
void updateClipboardCopyAvailable(); |
551 |
void updateClipboardPasteAvailable(); |
void updateClipboardPasteAvailable(); |
552 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
553 |
|
void on_clipboard_owner_change(Gdk::EventOwnerChange& event); |
554 |
|
#else |
555 |
void on_clipboard_owner_change(GdkEventOwnerChange* event); |
void on_clipboard_owner_change(GdkEventOwnerChange* event); |
556 |
|
#endif |
557 |
void on_clipboard_get(Gtk::SelectionData& selection_data, guint info); |
void on_clipboard_get(Gtk::SelectionData& selection_data, guint info); |
558 |
void on_clipboard_clear(); |
void on_clipboard_clear(); |
559 |
void on_clipboard_received(const Gtk::SelectionData& selection_data); |
void on_clipboard_received(const Gtk::SelectionData& selection_data); |
560 |
void on_clipboard_received_targets(const std::vector<Glib::ustring>& targets); |
void on_clipboard_received_targets(const std::vector<Glib::ustring>& targets); |
561 |
|
|
562 |
void add_instrument(gig::Instrument* instrument); |
void add_instrument(gig::Instrument* instrument); |
563 |
|
#if !USE_GTKMM_BUILDER |
564 |
Gtk::RadioMenuItem* add_instrument_to_menu(const Glib::ustring& name, |
Gtk::RadioMenuItem* add_instrument_to_menu(const Glib::ustring& name, |
565 |
int position = -1); |
int position = -1); |
566 |
void remove_instrument_from_menu(int index); |
void remove_instrument_from_menu(int index); |
567 |
|
#endif |
568 |
|
bool onQueryTreeViewTooltip(int x, int y, bool keyboardTip, const Glib::RefPtr<Gtk::Tooltip>& tooltip); |
569 |
|
|
570 |
ProgressDialog* progress_dialog; |
ProgressDialog* progress_dialog; |
571 |
Loader* loader; |
Loader* loader; |
587 |
bool file_save_as(); |
bool file_save_as(); |
588 |
bool check_if_savable(); |
bool check_if_savable(); |
589 |
|
|
590 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
591 |
|
bool on_button_release(Gdk::EventButton& button); |
592 |
|
#else |
593 |
void on_button_release(GdkEventButton* button); |
void on_button_release(GdkEventButton* button); |
594 |
|
#endif |
595 |
void on_instruments_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context); |
void on_instruments_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context); |
596 |
void on_instruments_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, |
void on_instruments_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, |
597 |
Gtk::SelectionData& selection_data, guint, guint); |
Gtk::SelectionData& selection_data, guint, guint); |
618 |
void instrument_name_changed(const Gtk::TreeModel::Path& path, |
void instrument_name_changed(const Gtk::TreeModel::Path& path, |
619 |
const Gtk::TreeModel::iterator& iter); |
const Gtk::TreeModel::iterator& iter); |
620 |
void instr_name_changed_by_instr_props(Gtk::TreeModel::iterator& it); |
void instr_name_changed_by_instr_props(Gtk::TreeModel::iterator& it); |
621 |
|
bool instrument_row_visible(const Gtk::TreeModel::const_iterator& iter); |
622 |
sigc::connection instrument_name_connection; |
sigc::connection instrument_name_connection; |
623 |
|
|
624 |
void on_action_combine_instruments(); |
void on_action_combine_instruments(); |
635 |
void __import_queued_samples(); |
void __import_queued_samples(); |
636 |
void __clear(); |
void __clear(); |
637 |
void __refreshEntireGUI(); |
void __refreshEntireGUI(); |
638 |
|
void updateScriptListOfMenu(); |
639 |
|
void assignScript(gig::Script* pScript); |
640 |
|
void dropAllScriptSlots(); |
641 |
|
|
642 |
bool close_confirmation_dialog(); |
bool close_confirmation_dialog(); |
643 |
bool leaving_shared_mode_dialog(); |
bool leaving_shared_mode_dialog(); |
644 |
|
|
645 |
Gtk::Menu* popup_menu; |
Gtk::Menu* popup_menu; |
646 |
|
#if USE_GTKMM_BUILDER |
647 |
|
Gtk::Menu* sample_popup; |
648 |
|
Gtk::Menu* script_popup; |
649 |
|
#endif |
650 |
|
|
651 |
bool on_delete_event(GdkEventAny* event); |
bool on_delete_event(GdkEventAny* event); |
652 |
|
|
653 |
bool first_call_to_drag_data_get; |
bool first_call_to_drag_data_get; |
654 |
|
|
655 |
bool is_copy_samples_unity_note_enabled() const; |
bool is_copy_samples_unity_note_enabled() const; |
656 |
bool is_copy_samples_fine_tune_enabled() const; |
bool is_copy_samples_fine_tune_enabled() const; |
657 |
bool is_copy_samples_loop_enabled() const; |
bool is_copy_samples_loop_enabled() const; |