20 |
#include <iostream> |
#include <iostream> |
21 |
#include <cstring> |
#include <cstring> |
22 |
|
|
23 |
#include <glibmmconfig.h> |
#include "compat.h" |
24 |
// threads.h must be included first to be able to build with |
// threads.h must be included first to be able to build with |
25 |
// G_DISABLE_DEPRECATED |
// G_DISABLE_DEPRECATED |
26 |
#if (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION == 31 && GLIBMM_MICRO_VERSION >= 2) || \ |
#if (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION == 31 && GLIBMM_MICRO_VERSION >= 2) || \ |
36 |
#include <gtkmm/aboutdialog.h> |
#include <gtkmm/aboutdialog.h> |
37 |
#include <gtkmm/filechooserdialog.h> |
#include <gtkmm/filechooserdialog.h> |
38 |
#include <gtkmm/messagedialog.h> |
#include <gtkmm/messagedialog.h> |
39 |
#include <gtkmm/stock.h> |
#if HAS_GTKMM_STOCK |
40 |
|
# include <gtkmm/stock.h> |
41 |
|
#endif |
42 |
#include <gtkmm/targetentry.h> |
#include <gtkmm/targetentry.h> |
43 |
#include <gtkmm/main.h> |
#include <gtkmm/main.h> |
44 |
#include <gtkmm/toggleaction.h> |
#if GTKMM_MAJOR_VERSION < 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 89) |
45 |
|
# include <gtkmm/toggleaction.h> |
46 |
|
#endif |
47 |
#include <gtkmm/accelmap.h> |
#include <gtkmm/accelmap.h> |
48 |
#if GTKMM_MAJOR_VERSION < 3 |
#if GTKMM_MAJOR_VERSION < 3 |
49 |
#include "wrapLabel.hh" |
#include "wrapLabel.hh" |
53 |
#include "compat.h" |
#include "compat.h" |
54 |
|
|
55 |
#include <stdio.h> |
#include <stdio.h> |
56 |
#include <sndfile.h> |
#ifdef LIBSNDFILE_HEADER_FILE |
57 |
|
# include LIBSNDFILE_HEADER_FILE(sndfile.h) |
58 |
|
#else |
59 |
|
# include <sndfile.h> |
60 |
|
#endif |
61 |
#include <assert.h> |
#include <assert.h> |
62 |
|
|
63 |
#include "mainwindow.h" |
#include "mainwindow.h" |
101 |
// set_border_width(5); |
// set_border_width(5); |
102 |
|
|
103 |
if (!Settings::singleton()->autoRestoreWindowDimension) { |
if (!Settings::singleton()->autoRestoreWindowDimension) { |
104 |
|
#if GTKMM_MAJOR_VERSION >= 3 |
105 |
|
set_default_size(895, 600); |
106 |
|
#else |
107 |
set_default_size(800, 600); |
set_default_size(800, 600); |
108 |
|
#endif |
109 |
set_position(Gtk::WIN_POS_CENTER); |
set_position(Gtk::WIN_POS_CENTER); |
110 |
} |
} |
111 |
|
|
117 |
|
|
118 |
// m_TreeView.set_reorderable(); |
// m_TreeView.set_reorderable(); |
119 |
|
|
120 |
|
#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 |
121 |
|
m_TreeView.signal_button_press_event().connect( |
122 |
|
sigc::mem_fun(*this, &MainWindow::on_button_release)); |
123 |
|
#else |
124 |
m_TreeView.signal_button_press_event().connect_notify( |
m_TreeView.signal_button_press_event().connect_notify( |
125 |
sigc::mem_fun(*this, &MainWindow::on_button_release)); |
sigc::mem_fun(*this, &MainWindow::on_button_release)); |
126 |
|
#endif |
127 |
|
|
128 |
// Add the TreeView tab, inside a ScrolledWindow, with the button underneath: |
// Add the TreeView tab, inside a ScrolledWindow, with the button underneath: |
129 |
m_ScrolledWindow.add(m_TreeView); |
m_ScrolledWindow.add(m_TreeView); |
136 |
m_ScrolledWindowScripts.add(m_TreeViewScripts); |
m_ScrolledWindowScripts.add(m_TreeViewScripts); |
137 |
m_ScrolledWindowScripts.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); |
m_ScrolledWindowScripts.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); |
138 |
|
|
139 |
|
#if GTKMM_MAJOR_VERSION < 3 |
140 |
m_TreeViewNotebook.set_size_request(300); |
m_TreeViewNotebook.set_size_request(300); |
141 |
|
#endif |
142 |
|
|
143 |
m_searchLabel.set_text(Glib::ustring(" ") + _("Filter:")); |
m_searchLabel.set_text(Glib::ustring(" ") + _("Filter:")); |
144 |
m_searchField.pack_start(m_searchLabel, Gtk::PACK_SHRINK); |
m_searchField.pack_start(m_searchLabel, Gtk::PACK_SHRINK); |
161 |
legend_hbox.add(labelLegend); |
legend_hbox.add(labelLegend); |
162 |
|
|
163 |
imageNoSample.set(redDot); |
imageNoSample.set(redDot); |
164 |
|
#if HAS_GTKMM_ALIGNMENT |
165 |
imageNoSample.set_alignment(Gtk::ALIGN_END); |
imageNoSample.set_alignment(Gtk::ALIGN_END); |
166 |
labelNoSample.set_alignment(Gtk::ALIGN_START); |
labelNoSample.set_alignment(Gtk::ALIGN_START); |
167 |
|
#else |
168 |
|
imageNoSample.set_halign(Gtk::ALIGN_END); |
169 |
|
labelNoSample.set_halign(Gtk::ALIGN_START); |
170 |
|
#endif |
171 |
legend_hbox.add(imageNoSample); |
legend_hbox.add(imageNoSample); |
172 |
legend_hbox.add(labelNoSample); |
legend_hbox.add(labelNoSample); |
173 |
|
|
174 |
imageMissingSample.set(yellowDot); |
imageMissingSample.set(yellowDot); |
175 |
|
#if HAS_GTKMM_ALIGNMENT |
176 |
imageMissingSample.set_alignment(Gtk::ALIGN_END); |
imageMissingSample.set_alignment(Gtk::ALIGN_END); |
177 |
labelMissingSample.set_alignment(Gtk::ALIGN_START); |
labelMissingSample.set_alignment(Gtk::ALIGN_START); |
178 |
|
#else |
179 |
|
imageMissingSample.set_halign(Gtk::ALIGN_END); |
180 |
|
labelMissingSample.set_halign(Gtk::ALIGN_START); |
181 |
|
#endif |
182 |
legend_hbox.add(imageMissingSample); |
legend_hbox.add(imageMissingSample); |
183 |
legend_hbox.add(labelMissingSample); |
legend_hbox.add(labelMissingSample); |
184 |
|
|
185 |
imageLooped.set(blackLoop); |
imageLooped.set(blackLoop); |
186 |
|
#if HAS_GTKMM_ALIGNMENT |
187 |
imageLooped.set_alignment(Gtk::ALIGN_END); |
imageLooped.set_alignment(Gtk::ALIGN_END); |
188 |
labelLooped.set_alignment(Gtk::ALIGN_START); |
labelLooped.set_alignment(Gtk::ALIGN_START); |
189 |
|
#else |
190 |
|
imageLooped.set_halign(Gtk::ALIGN_END); |
191 |
|
labelLooped.set_halign(Gtk::ALIGN_START); |
192 |
|
#endif |
193 |
legend_hbox.add(imageLooped); |
legend_hbox.add(imageLooped); |
194 |
legend_hbox.add(labelLooped); |
legend_hbox.add(labelLooped); |
195 |
|
|
196 |
imageSomeLoops.set(grayLoop); |
imageSomeLoops.set(grayLoop); |
197 |
|
#if HAS_GTKMM_ALIGNMENT |
198 |
imageSomeLoops.set_alignment(Gtk::ALIGN_END); |
imageSomeLoops.set_alignment(Gtk::ALIGN_END); |
199 |
labelSomeLoops.set_alignment(Gtk::ALIGN_START); |
labelSomeLoops.set_alignment(Gtk::ALIGN_START); |
200 |
|
#else |
201 |
|
imageSomeLoops.set_halign(Gtk::ALIGN_END); |
202 |
|
labelSomeLoops.set_halign(Gtk::ALIGN_START); |
203 |
|
#endif |
204 |
legend_hbox.add(imageSomeLoops); |
legend_hbox.add(imageSomeLoops); |
205 |
legend_hbox.add(labelSomeLoops); |
legend_hbox.add(labelSomeLoops); |
206 |
|
|
207 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
208 |
legend_hbox.show_all_children(); |
legend_hbox.show_all_children(); |
209 |
|
#endif |
210 |
} |
} |
211 |
dimreg_vbox.pack_start(legend_hbox, Gtk::PACK_SHRINK); |
dimreg_vbox.pack_start(legend_hbox, Gtk::PACK_SHRINK); |
212 |
m_HPaned.add2(dimreg_vbox); |
m_HPaned.add2(dimreg_vbox); |
220 |
m_TreeViewNotebook.append_page(m_ScrolledWindow, _("Instruments")); |
m_TreeViewNotebook.append_page(m_ScrolledWindow, _("Instruments")); |
221 |
m_TreeViewNotebook.append_page(m_ScrolledWindowScripts, _("Scripts")); |
m_TreeViewNotebook.append_page(m_ScrolledWindowScripts, _("Scripts")); |
222 |
|
|
223 |
|
#if USE_GLIB_ACTION |
224 |
|
m_actionGroup = Gio::SimpleActionGroup::create(); |
225 |
|
m_actionGroup->add_action( |
226 |
|
"New", sigc::mem_fun(*this, &MainWindow::on_action_file_new) |
227 |
|
); |
228 |
|
m_actionGroup->add_action( |
229 |
|
"Open", sigc::mem_fun(*this, &MainWindow::on_action_file_open) |
230 |
|
); |
231 |
|
m_actionGroup->add_action( |
232 |
|
"Save", sigc::mem_fun(*this, &MainWindow::on_action_file_save) |
233 |
|
); |
234 |
|
m_actionGroup->add_action( |
235 |
|
"SaveAs", sigc::mem_fun(*this, &MainWindow::on_action_file_save_as) |
236 |
|
); |
237 |
|
m_actionGroup->add_action( |
238 |
|
"Properties", sigc::mem_fun(*this, &MainWindow::on_action_file_properties) |
239 |
|
); |
240 |
|
m_actionGroup->add_action( |
241 |
|
"InstrProperties", sigc::mem_fun(*this, &MainWindow::show_instr_props) |
242 |
|
); |
243 |
|
m_actionMIDIRules = m_actionGroup->add_action( |
244 |
|
"MidiRules", sigc::mem_fun(*this, &MainWindow::show_midi_rules) |
245 |
|
); |
246 |
|
m_actionGroup->add_action( |
247 |
|
"ScriptSlots", sigc::mem_fun(*this, &MainWindow::show_script_slots) |
248 |
|
); |
249 |
|
m_actionGroup->add_action( |
250 |
|
"Quit", sigc::mem_fun(*this, &MainWindow::on_action_quit) |
251 |
|
); |
252 |
|
m_actionGroup->add_action( |
253 |
|
"MenuSample", sigc::mem_fun(*this, &MainWindow::show_samples_tab) |
254 |
|
); |
255 |
|
m_actionGroup->add_action( |
256 |
|
"MenuInstrument", sigc::mem_fun(*this, &MainWindow::show_intruments_tab) |
257 |
|
); |
258 |
|
m_actionGroup->add_action( |
259 |
|
"MenuScript", sigc::mem_fun(*this, &MainWindow::show_scripts_tab) |
260 |
|
); |
261 |
|
#else |
262 |
actionGroup = Gtk::ActionGroup::create(); |
actionGroup = Gtk::ActionGroup::create(); |
263 |
|
|
264 |
actionGroup->add(Gtk::Action::create("MenuFile", _("_File"))); |
actionGroup->add(Gtk::Action::create("MenuFile", _("_File"))); |
315 |
actionGroup->add(Gtk::Action::create("AssignScripts", _("Assign Script"))); |
actionGroup->add(Gtk::Action::create("AssignScripts", _("Assign Script"))); |
316 |
|
|
317 |
actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit"))); |
actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit"))); |
318 |
|
#endif |
319 |
|
|
320 |
const Gdk::ModifierType primaryModifierKey = |
const Gdk::ModifierType primaryModifierKey = |
321 |
#if defined(__APPLE__) |
#if defined(__APPLE__) |
324 |
Gdk::CONTROL_MASK; // Ctrl key on all other OSs |
Gdk::CONTROL_MASK; // Ctrl key on all other OSs |
325 |
#endif |
#endif |
326 |
|
|
327 |
|
#if USE_GLIB_ACTION |
328 |
|
m_actionCopyDimRgn = m_actionGroup->add_action( |
329 |
|
"CopyDimRgn", sigc::mem_fun(*this, &MainWindow::copy_selected_dimrgn) |
330 |
|
); |
331 |
|
m_actionPasteDimRgn = m_actionGroup->add_action( |
332 |
|
"PasteDimRgn", sigc::mem_fun(*this, &MainWindow::paste_copied_dimrgn) |
333 |
|
); |
334 |
|
m_actionAdjustClipboard = m_actionGroup->add_action( |
335 |
|
"AdjustClipboard", sigc::mem_fun(*this, &MainWindow::adjust_clipboard_content) |
336 |
|
); |
337 |
|
m_actionGroup->add_action( |
338 |
|
"SelectPrevInstr", sigc::mem_fun(*this, &MainWindow::select_prev_instrument) |
339 |
|
); |
340 |
|
m_actionGroup->add_action( |
341 |
|
"SelectNextInstr", sigc::mem_fun(*this, &MainWindow::select_next_instrument) |
342 |
|
); |
343 |
|
m_actionGroup->add_action( |
344 |
|
"SelectPrevRegion", sigc::mem_fun(*this, &MainWindow::select_prev_region) |
345 |
|
); |
346 |
|
m_actionGroup->add_action( |
347 |
|
"SelectNextRegion", sigc::mem_fun(*this, &MainWindow::select_next_region) |
348 |
|
); |
349 |
|
m_actionGroup->add_action( |
350 |
|
"SelectPrevDimRgnZone", sigc::mem_fun(*this, &MainWindow::select_prev_dim_rgn_zone) |
351 |
|
); |
352 |
|
m_actionGroup->add_action( |
353 |
|
"SelectNextDimRgnZone", sigc::mem_fun(*this, &MainWindow::select_next_dim_rgn_zone) |
354 |
|
); |
355 |
|
m_actionGroup->add_action( |
356 |
|
"SelectPrevDimension", sigc::mem_fun(*this, &MainWindow::select_prev_dimension) |
357 |
|
); |
358 |
|
m_actionGroup->add_action( |
359 |
|
"SelectNextDimension", sigc::mem_fun(*this, &MainWindow::select_next_dimension) |
360 |
|
); |
361 |
|
m_actionGroup->add_action( |
362 |
|
"SelectAddPrevDimRgnZone", sigc::mem_fun(*this, &MainWindow::select_add_prev_dim_rgn_zone) |
363 |
|
); |
364 |
|
m_actionGroup->add_action( |
365 |
|
"SelectAddNextDimRgnZone", sigc::mem_fun(*this, &MainWindow::select_add_next_dim_rgn_zone) |
366 |
|
); |
367 |
|
#else |
368 |
actionGroup->add(Gtk::Action::create("CopyDimRgn", |
actionGroup->add(Gtk::Action::create("CopyDimRgn", |
369 |
_("Copy selected dimension region")), |
_("Copy selected dimension region")), |
370 |
Gtk::AccelKey(GDK_KEY_c, Gdk::MOD1_MASK), |
Gtk::AccelKey(GDK_KEY_c, Gdk::MOD1_MASK), |
429 |
_("Add Next Dimension Region Zone to Selection")), |
_("Add Next Dimension Region Zone to Selection")), |
430 |
Gtk::AccelKey(GDK_KEY_Right, Gdk::MOD1_MASK | Gdk::SHIFT_MASK), |
Gtk::AccelKey(GDK_KEY_Right, Gdk::MOD1_MASK | Gdk::SHIFT_MASK), |
431 |
sigc::mem_fun(*this, &MainWindow::select_add_next_dim_rgn_zone)); |
sigc::mem_fun(*this, &MainWindow::select_add_next_dim_rgn_zone)); |
432 |
|
#endif |
433 |
|
|
434 |
|
#if USE_GLIB_ACTION |
435 |
|
m_actionToggleCopySampleUnity = m_actionGroup->add_action_bool("CopySampleUnity", true); |
436 |
|
m_actionToggleCopySampleTune = m_actionGroup->add_action_bool("CopySampleTune", true); |
437 |
|
m_actionToggleCopySampleLoop = m_actionGroup->add_action_bool("CopySampleLoop", true); |
438 |
|
#else |
439 |
Glib::RefPtr<Gtk::ToggleAction> toggle_action = |
Glib::RefPtr<Gtk::ToggleAction> toggle_action = |
440 |
Gtk::ToggleAction::create("CopySampleUnity", _("Copy Sample's _Unity Note")); |
Gtk::ToggleAction::create("CopySampleUnity", _("Copy Sample's _Unity Note")); |
441 |
toggle_action->set_active(true); |
toggle_action->set_active(true); |
450 |
Gtk::ToggleAction::create("CopySampleLoop", _("Copy Sample's _Loop Points")); |
Gtk::ToggleAction::create("CopySampleLoop", _("Copy Sample's _Loop Points")); |
451 |
toggle_action->set_active(true); |
toggle_action->set_active(true); |
452 |
actionGroup->add(toggle_action); |
actionGroup->add(toggle_action); |
453 |
|
#endif |
454 |
|
|
455 |
|
#if USE_GLIB_ACTION |
456 |
|
m_actionToggleStatusBar = |
457 |
|
m_actionGroup->add_action_bool("Statusbar", sigc::mem_fun(*this, &MainWindow::on_action_view_status_bar), true); |
458 |
|
m_actionToggleRestoreWinDim = |
459 |
|
m_actionGroup->add_action_bool("AutoRestoreWinDim", sigc::mem_fun(*this, &MainWindow::on_auto_restore_win_dim), Settings::singleton()->autoRestoreWindowDimension); |
460 |
|
m_actionToggleShowTooltips = m_actionGroup->add_action_bool( |
461 |
|
"ShowTooltips", sigc::mem_fun(*this, &MainWindow::on_action_show_tooltips), |
462 |
|
Settings::singleton()->showTooltips |
463 |
|
); |
464 |
|
m_actionToggleSaveWithTempFile = |
465 |
|
m_actionGroup->add_action_bool("SaveWithTemporaryFile", sigc::mem_fun(*this, &MainWindow::on_save_with_temporary_file), Settings::singleton()->saveWithTemporaryFile); |
466 |
|
m_actionGroup->add_action("RefreshAll", sigc::mem_fun(*this, &MainWindow::on_action_refresh_all)); |
467 |
|
#else |
468 |
actionGroup->add(Gtk::Action::create("MenuMacro", _("_Macro"))); |
actionGroup->add(Gtk::Action::create("MenuMacro", _("_Macro"))); |
469 |
|
|
470 |
|
|
484 |
*this, &MainWindow::on_auto_restore_win_dim)); |
*this, &MainWindow::on_auto_restore_win_dim)); |
485 |
|
|
486 |
toggle_action = |
toggle_action = |
487 |
|
Gtk::ToggleAction::create("ShowTooltips", _("Tooltips for Beginners")); |
488 |
|
toggle_action->set_active(Settings::singleton()->showTooltips); |
489 |
|
actionGroup->add( |
490 |
|
toggle_action, |
491 |
|
sigc::mem_fun(*this, &MainWindow::on_action_show_tooltips) |
492 |
|
); |
493 |
|
|
494 |
|
toggle_action = |
495 |
Gtk::ToggleAction::create("SaveWithTemporaryFile", _("Save with _temporary file")); |
Gtk::ToggleAction::create("SaveWithTemporaryFile", _("Save with _temporary file")); |
496 |
toggle_action->set_active(Settings::singleton()->saveWithTemporaryFile); |
toggle_action->set_active(Settings::singleton()->saveWithTemporaryFile); |
497 |
actionGroup->add(toggle_action, |
actionGroup->add(toggle_action, |
502 |
Gtk::Action::create("RefreshAll", _("_Refresh All")), |
Gtk::Action::create("RefreshAll", _("_Refresh All")), |
503 |
sigc::mem_fun(*this, &MainWindow::on_action_refresh_all) |
sigc::mem_fun(*this, &MainWindow::on_action_refresh_all) |
504 |
); |
); |
505 |
|
#endif |
506 |
|
|
507 |
|
#if USE_GLIB_ACTION |
508 |
|
m_actionGroup->add_action( |
509 |
|
"About", sigc::mem_fun(*this, &MainWindow::on_action_help_about) |
510 |
|
); |
511 |
|
m_actionGroup->add_action( |
512 |
|
"AddInstrument", sigc::mem_fun(*this, &MainWindow::on_action_add_instrument) |
513 |
|
); |
514 |
|
m_actionGroup->add_action( |
515 |
|
"DupInstrument", sigc::mem_fun(*this, &MainWindow::on_action_duplicate_instrument) |
516 |
|
); |
517 |
|
m_actionGroup->add_action( |
518 |
|
"CombInstruments", sigc::mem_fun(*this, &MainWindow::on_action_combine_instruments) |
519 |
|
); |
520 |
|
m_actionGroup->add_action( |
521 |
|
"RemoveInstrument", sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument) |
522 |
|
); |
523 |
|
#else |
524 |
action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP); |
action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP); |
525 |
actionGroup->add(Gtk::Action::create("MenuHelp", |
actionGroup->add(Gtk::Action::create("MenuHelp", |
526 |
action->property_label())); |
action->property_label())); |
544 |
Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE), |
Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE), |
545 |
sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument) |
sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument) |
546 |
); |
); |
547 |
|
#endif |
548 |
|
|
549 |
|
#if USE_GLIB_ACTION |
550 |
|
m_actionToggleWarnOnExtensions = m_actionGroup->add_action_bool( |
551 |
|
"WarnUserOnExtensions", sigc::mem_fun(*this, &MainWindow::on_action_warn_user_on_extensions), |
552 |
|
Settings::singleton()->warnUserOnExtensions |
553 |
|
); |
554 |
|
m_actionToggleSyncSamplerSelection = m_actionGroup->add_action_bool( |
555 |
|
"SyncSamplerInstrumentSelection", sigc::mem_fun(*this, &MainWindow::on_action_sync_sampler_instrument_selection), |
556 |
|
Settings::singleton()->syncSamplerInstrumentSelection |
557 |
|
); |
558 |
|
m_actionToggleMoveRootNoteWithRegion = m_actionGroup->add_action_bool( |
559 |
|
"MoveRootNoteWithRegionMoved", sigc::mem_fun(*this, &MainWindow::on_action_move_root_note_with_region_moved), |
560 |
|
Settings::singleton()->moveRootNoteWithRegionMoved |
561 |
|
); |
562 |
|
#else |
563 |
actionGroup->add(Gtk::Action::create("MenuSettings", _("_Settings"))); |
actionGroup->add(Gtk::Action::create("MenuSettings", _("_Settings"))); |
564 |
|
|
565 |
toggle_action = |
toggle_action = |
585 |
toggle_action, |
toggle_action, |
586 |
sigc::mem_fun(*this, &MainWindow::on_action_move_root_note_with_region_moved) |
sigc::mem_fun(*this, &MainWindow::on_action_move_root_note_with_region_moved) |
587 |
); |
); |
588 |
|
#endif |
589 |
|
|
590 |
|
#if USE_GLIB_ACTION |
591 |
|
m_actionGroup->add_action( |
592 |
|
"CombineInstruments", sigc::mem_fun(*this, &MainWindow::on_action_combine_instruments) |
593 |
|
); |
594 |
|
m_actionGroup->add_action( |
595 |
|
"MergeFiles", sigc::mem_fun(*this, &MainWindow::on_action_merge_files) |
596 |
|
); |
597 |
|
#else |
598 |
actionGroup->add(Gtk::Action::create("MenuTools", _("_Tools"))); |
actionGroup->add(Gtk::Action::create("MenuTools", _("_Tools"))); |
599 |
|
|
600 |
actionGroup->add( |
actionGroup->add( |
606 |
Gtk::Action::create("MergeFiles", _("_Merge Files...")), |
Gtk::Action::create("MergeFiles", _("_Merge Files...")), |
607 |
sigc::mem_fun(*this, &MainWindow::on_action_merge_files) |
sigc::mem_fun(*this, &MainWindow::on_action_merge_files) |
608 |
); |
); |
609 |
|
#endif |
610 |
|
|
611 |
// sample right-click popup actions |
// sample right-click popup actions |
612 |
|
#if USE_GLIB_ACTION |
613 |
|
m_actionSampleProperties = m_actionGroup->add_action( |
614 |
|
"SampleProperties", sigc::mem_fun(*this, &MainWindow::on_action_sample_properties) |
615 |
|
); |
616 |
|
m_actionAddSampleGroup = m_actionGroup->add_action( |
617 |
|
"AddGroup", sigc::mem_fun(*this, &MainWindow::on_action_add_group) |
618 |
|
); |
619 |
|
m_actionAddSample = m_actionGroup->add_action( |
620 |
|
"AddSample", sigc::mem_fun(*this, &MainWindow::on_action_add_sample) |
621 |
|
); |
622 |
|
m_actionRemoveSample = m_actionGroup->add_action( |
623 |
|
"RemoveSample", sigc::mem_fun(*this, &MainWindow::on_action_remove_sample) |
624 |
|
); |
625 |
|
m_actionGroup->add_action( |
626 |
|
"RemoveUnusedSamples", sigc::mem_fun(*this, &MainWindow::on_action_remove_unused_samples) |
627 |
|
); |
628 |
|
m_actionViewSampleRefs = m_actionGroup->add_action( |
629 |
|
"ShowSampleRefs", sigc::mem_fun(*this, &MainWindow::on_action_view_references) |
630 |
|
); |
631 |
|
m_actionReplaceSample = m_actionGroup->add_action( |
632 |
|
"ReplaceSample", sigc::mem_fun(*this, &MainWindow::on_action_replace_sample) |
633 |
|
); |
634 |
|
m_actionGroup->add_action( |
635 |
|
"ReplaceAllSamplesInAllGroups", sigc::mem_fun(*this, &MainWindow::on_action_replace_all_samples_in_all_groups) |
636 |
|
); |
637 |
|
#else |
638 |
actionGroup->add( |
actionGroup->add( |
639 |
Gtk::Action::create("SampleProperties", Gtk::Stock::PROPERTIES), |
Gtk::Action::create("SampleProperties", Gtk::Stock::PROPERTIES), |
640 |
sigc::mem_fun(*this, &MainWindow::on_action_sample_properties) |
sigc::mem_fun(*this, &MainWindow::on_action_sample_properties) |
669 |
_("Replace All Samples in All Groups...")), |
_("Replace All Samples in All Groups...")), |
670 |
sigc::mem_fun(*this, &MainWindow::on_action_replace_all_samples_in_all_groups) |
sigc::mem_fun(*this, &MainWindow::on_action_replace_all_samples_in_all_groups) |
671 |
); |
); |
672 |
|
#endif |
673 |
|
|
674 |
// script right-click popup actions |
// script right-click popup actions |
675 |
|
#if USE_GLIB_ACTION |
676 |
|
m_actionAddScriptGroup = m_actionGroup->add_action( |
677 |
|
"AddScriptGroup", sigc::mem_fun(*this, &MainWindow::on_action_add_script_group) |
678 |
|
); |
679 |
|
m_actionAddScript = m_actionGroup->add_action( |
680 |
|
"AddScript", sigc::mem_fun(*this, &MainWindow::on_action_add_script) |
681 |
|
); |
682 |
|
m_actionEditScript = m_actionGroup->add_action( |
683 |
|
"EditScript", sigc::mem_fun(*this, &MainWindow::on_action_edit_script) |
684 |
|
); |
685 |
|
m_actionRemoveScript = m_actionGroup->add_action( |
686 |
|
"RemoveScript", sigc::mem_fun(*this, &MainWindow::on_action_remove_script) |
687 |
|
); |
688 |
|
#else |
689 |
actionGroup->add( |
actionGroup->add( |
690 |
Gtk::Action::create("AddScriptGroup", _("Add _Group")), |
Gtk::Action::create("AddScriptGroup", _("Add _Group")), |
691 |
sigc::mem_fun(*this, &MainWindow::on_action_add_script_group) |
sigc::mem_fun(*this, &MainWindow::on_action_add_script_group) |
702 |
Gtk::Action::create("RemoveScript", Gtk::Stock::REMOVE), |
Gtk::Action::create("RemoveScript", Gtk::Stock::REMOVE), |
703 |
sigc::mem_fun(*this, &MainWindow::on_action_remove_script) |
sigc::mem_fun(*this, &MainWindow::on_action_remove_script) |
704 |
); |
); |
705 |
|
#endif |
706 |
|
|
707 |
|
#if USE_GTKMM_BUILDER |
708 |
|
insert_action_group("AppMenu", m_actionGroup); |
709 |
|
|
710 |
|
m_uiManager = Gtk::Builder::create(); |
711 |
|
Glib::ustring ui_info = |
712 |
|
"<interface>" |
713 |
|
" <menubar id='MenuBar'>" |
714 |
|
" <menu id='MenuFile'>" |
715 |
|
" <attribute name='label' translatable='yes'>_File</attribute>" |
716 |
|
" <section>" |
717 |
|
" <item id='New'>" |
718 |
|
" <attribute name='label' translatable='yes'>New</attribute>" |
719 |
|
" <attribute name='action'>AppMenu.New</attribute>" |
720 |
|
" </item>" |
721 |
|
" <item id='Open'>" |
722 |
|
" <attribute name='label' translatable='yes'>Open</attribute>" |
723 |
|
" <attribute name='action'>AppMenu.Open</attribute>" |
724 |
|
" </item>" |
725 |
|
" </section>" |
726 |
|
" <section>" |
727 |
|
" <item id='Save'>" |
728 |
|
" <attribute name='label' translatable='yes'>Save</attribute>" |
729 |
|
" <attribute name='action'>AppMenu.Save</attribute>" |
730 |
|
" </item>" |
731 |
|
" <item id='SaveAs'>" |
732 |
|
" <attribute name='label' translatable='yes'>Save As</attribute>" |
733 |
|
" <attribute name='action'>AppMenu.SaveAs</attribute>" |
734 |
|
" </item>" |
735 |
|
" </section>" |
736 |
|
" <section>" |
737 |
|
" <item id='Properties'>" |
738 |
|
" <attribute name='label' translatable='yes'>Properties</attribute>" |
739 |
|
" <attribute name='action'>AppMenu.Properties</attribute>" |
740 |
|
" </item>" |
741 |
|
" </section>" |
742 |
|
" <section>" |
743 |
|
" <item id='Quit'>" |
744 |
|
" <attribute name='label' translatable='yes'>Quit</attribute>" |
745 |
|
" <attribute name='action'>AppMenu.Quit</attribute>" |
746 |
|
" </item>" |
747 |
|
" </section>" |
748 |
|
" </menu>" |
749 |
|
" <menu id='MenuEdit'>" |
750 |
|
" <attribute name='label' translatable='yes'>Edit</attribute>" |
751 |
|
" <section>" |
752 |
|
" <item id='CopyDimRgn'>" |
753 |
|
" <attribute name='label' translatable='yes'>Copy Dimension Region</attribute>" |
754 |
|
" <attribute name='action'>AppMenu.CopyDimRgn</attribute>" |
755 |
|
" </item>" |
756 |
|
" <item id='AdjustClipboard'>" |
757 |
|
" <attribute name='label' translatable='yes'>Adjust Clipboard</attribute>" |
758 |
|
" <attribute name='action'>AppMenu.AdjustClipboard</attribute>" |
759 |
|
" </item>" |
760 |
|
" <item id='PasteDimRgn'>" |
761 |
|
" <attribute name='label' translatable='yes'>Paste Dimension Region</attribute>" |
762 |
|
" <attribute name='action'>AppMenu.PasteDimRgn</attribute>" |
763 |
|
" </item>" |
764 |
|
" </section>" |
765 |
|
" <item id='SelectPrevInstr'>" |
766 |
|
" <attribute name='label' translatable='yes'>Previous Instrument</attribute>" |
767 |
|
" <attribute name='action'>AppMenu.SelectPrevInstr</attribute>" |
768 |
|
" </item>" |
769 |
|
" <item id='SelectNextInstr'>" |
770 |
|
" <attribute name='label' translatable='yes'>Next Instrument</attribute>" |
771 |
|
" <attribute name='action'>AppMenu.SelectNextInstr</attribute>" |
772 |
|
" </item>" |
773 |
|
" <section>" |
774 |
|
" <item id='SelectPrevRegion'>" |
775 |
|
" <attribute name='label' translatable='yes'>Previous Region</attribute>" |
776 |
|
" <attribute name='action'>AppMenu.SelectPrevRegion</attribute>" |
777 |
|
" </item>" |
778 |
|
" <item id='SelectNextRegion'>" |
779 |
|
" <attribute name='label' translatable='yes'>Next Region</attribute>" |
780 |
|
" <attribute name='action'>AppMenu.SelectNextRegion</attribute>" |
781 |
|
" </item>" |
782 |
|
" </section>" |
783 |
|
" <item id='SelectPrevDimension'>" |
784 |
|
" <attribute name='label' translatable='yes'>Previous Dimension</attribute>" |
785 |
|
" <attribute name='action'>AppMenu.SelectPrevDimension</attribute>" |
786 |
|
" </item>" |
787 |
|
" <item id='SelectNextDimension'>" |
788 |
|
" <attribute name='label' translatable='yes'>Next Dimension</attribute>" |
789 |
|
" <attribute name='action'>AppMenu.SelectNextDimension</attribute>" |
790 |
|
" </item>" |
791 |
|
" <item id='SelectPrevDimRgnZone'>" |
792 |
|
" <attribute name='label' translatable='yes'>Previous Dimension Region Zone</attribute>" |
793 |
|
" <attribute name='action'>AppMenu.SelectPrevDimRgnZone</attribute>" |
794 |
|
" </item>" |
795 |
|
" <item id='SelectNextDimRgnZone'>" |
796 |
|
" <attribute name='label' translatable='yes'>Next Dimension Region Zone</attribute>" |
797 |
|
" <attribute name='action'>AppMenu.SelectNextDimRgnZone</attribute>" |
798 |
|
" </item>" |
799 |
|
" <item id='SelectAddPrevDimRgnZone'>" |
800 |
|
" <attribute name='label' translatable='yes'>Add Previous Dimension Region Zone</attribute>" |
801 |
|
" <attribute name='action'>AppMenu.SelectAddPrevDimRgnZone</attribute>" |
802 |
|
" </item>" |
803 |
|
" <item id='SelectAddNextDimRgnZone'>" |
804 |
|
" <attribute name='label' translatable='yes'>Add Next Dimension Region Zone</attribute>" |
805 |
|
" <attribute name='action'>AppMenu.SelectAddNextDimRgnZone</attribute>" |
806 |
|
" </item>" |
807 |
|
" <section>" |
808 |
|
" <item id='CopySampleUnity'>" |
809 |
|
" <attribute name='label' translatable='yes'>Copy Sample Unity</attribute>" |
810 |
|
" <attribute name='action'>AppMenu.CopySampleUnity</attribute>" |
811 |
|
" </item>" |
812 |
|
" <item id='CopySampleTune'>" |
813 |
|
" <attribute name='label' translatable='yes'>Copy Sample Tune</attribute>" |
814 |
|
" <attribute name='action'>AppMenu.CopySampleTune</attribute>" |
815 |
|
" </item>" |
816 |
|
" <item id='CopySampleLoop'>" |
817 |
|
" <attribute name='label' translatable='yes'>Copy Sample Loop</attribute>" |
818 |
|
" <attribute name='action'>AppMenu.CopySampleLoop</attribute>" |
819 |
|
" </item>" |
820 |
|
" </section>" |
821 |
|
" </menu>" |
822 |
|
" <menu id='MenuMacro'>" |
823 |
|
" <attribute name='label' translatable='yes'>Macro</attribute>" |
824 |
|
" <section>" |
825 |
|
" </section>" |
826 |
|
" </menu>" |
827 |
|
" <menu id='MenuSample'>" |
828 |
|
" <attribute name='label' translatable='yes'>Sample</attribute>" |
829 |
|
" <section>" |
830 |
|
" <item id='SampleProperties'>" |
831 |
|
" <attribute name='label' translatable='yes'>Properties</attribute>" |
832 |
|
" <attribute name='action'>AppMenu.SampleProperties</attribute>" |
833 |
|
" </item>" |
834 |
|
" <item id='AddGroup'>" |
835 |
|
" <attribute name='label' translatable='yes'>Add Group</attribute>" |
836 |
|
" <attribute name='action'>AppMenu.AddGroup</attribute>" |
837 |
|
" </item>" |
838 |
|
" <item id='AddSample'>" |
839 |
|
" <attribute name='label' translatable='yes'>Add Sample</attribute>" |
840 |
|
" <attribute name='action'>AppMenu.AddSample</attribute>" |
841 |
|
" </item>" |
842 |
|
" <item id='ShowSampleRefs'>" |
843 |
|
" <attribute name='label' translatable='yes'>Show Sample References</attribute>" |
844 |
|
" <attribute name='action'>AppMenu.ShowSampleRefs</attribute>" |
845 |
|
" </item>" |
846 |
|
" <item id='ReplaceSample'>" |
847 |
|
" <attribute name='label' translatable='yes'>Replace Sample</attribute>" |
848 |
|
" <attribute name='action'>AppMenu.ReplaceSample</attribute>" |
849 |
|
" </item>" |
850 |
|
" <item id='ReplaceAllSamplesInAllGroups'>" |
851 |
|
" <attribute name='label' translatable='yes'>Replace all Samples in all Groups</attribute>" |
852 |
|
" <attribute name='action'>AppMenu.ReplaceAllSamplesInAllGroups</attribute>" |
853 |
|
" </item>" |
854 |
|
" </section>" |
855 |
|
" <section>" |
856 |
|
" <item id='RemoveSample'>" |
857 |
|
" <attribute name='label' translatable='yes'>Remove Sample</attribute>" |
858 |
|
" <attribute name='action'>AppMenu.RemoveSample</attribute>" |
859 |
|
" </item>" |
860 |
|
" <item id='RemoveUnusedSamples'>" |
861 |
|
" <attribute name='label' translatable='yes'>Remove unused Samples</attribute>" |
862 |
|
" <attribute name='action'>AppMenu.RemoveUnusedSamples</attribute>" |
863 |
|
" </item>" |
864 |
|
" </section>" |
865 |
|
" </menu>" |
866 |
|
" <menu id='MenuInstrument'>" |
867 |
|
" <attribute name='label' translatable='yes'>Instrument</attribute>" |
868 |
|
" <section>" |
869 |
|
" <item id='InstrProperties'>" |
870 |
|
" <attribute name='label' translatable='yes'>Properties</attribute>" |
871 |
|
" <attribute name='action'>AppMenu.InstrProperties</attribute>" |
872 |
|
" </item>" |
873 |
|
" <item id='MidiRules'>" |
874 |
|
" <attribute name='label' translatable='yes'>MIDI Rules</attribute>" |
875 |
|
" <attribute name='action'>AppMenu.MidiRules</attribute>" |
876 |
|
" </item>" |
877 |
|
" <item id='ScriptSlots'>" |
878 |
|
" <attribute name='label' translatable='yes'>Script Slots</attribute>" |
879 |
|
" <attribute name='action'>AppMenu.ScriptSlots</attribute>" |
880 |
|
" </item>" |
881 |
|
" </section>" |
882 |
|
" <submenu id='AssignScripts'>" |
883 |
|
" <attribute name='label' translatable='yes'>Assign Scripts</attribute>" |
884 |
|
" </submenu>" |
885 |
|
" <section>" |
886 |
|
" <item id='AddInstrument'>" |
887 |
|
" <attribute name='label' translatable='yes'>Add Instrument</attribute>" |
888 |
|
" <attribute name='action'>AppMenu.AddInstrument</attribute>" |
889 |
|
" </item>" |
890 |
|
" <item id='DupInstrument'>" |
891 |
|
" <attribute name='label' translatable='yes'>Duplicate Instrument</attribute>" |
892 |
|
" <attribute name='action'>AppMenu.DupInstrument</attribute>" |
893 |
|
" </item>" |
894 |
|
" <item id='CombInstruments'>" |
895 |
|
" <attribute name='label' translatable='yes'>Combine Instrument</attribute>" |
896 |
|
" <attribute name='action'>AppMenu.CombInstruments</attribute>" |
897 |
|
" </item>" |
898 |
|
" </section>" |
899 |
|
" <section>" |
900 |
|
" <item id='RemoveInstrument'>" |
901 |
|
" <attribute name='label' translatable='yes'>Remove Instrument</attribute>" |
902 |
|
" <attribute name='action'>AppMenu.RemoveInstrument</attribute>" |
903 |
|
" </item>" |
904 |
|
" </section>" |
905 |
|
" </menu>" |
906 |
|
" <menu id='MenuScript'>" |
907 |
|
" <attribute name='label' translatable='yes'>Script</attribute>" |
908 |
|
" <section>" |
909 |
|
" <item id='AddScriptGroup'>" |
910 |
|
" <attribute name='label' translatable='yes'>Add Script Group</attribute>" |
911 |
|
" <attribute name='action'>AppMenu.AddScriptGroup</attribute>" |
912 |
|
" </item>" |
913 |
|
" <item id='AddScript'>" |
914 |
|
" <attribute name='label' translatable='yes'>Add Script</attribute>" |
915 |
|
" <attribute name='action'>AppMenu.AddScript</attribute>" |
916 |
|
" </item>" |
917 |
|
" <item id='EditScript'>" |
918 |
|
" <attribute name='label' translatable='yes'>Edit Script</attribute>" |
919 |
|
" <attribute name='action'>AppMenu.EditScript</attribute>" |
920 |
|
" </item>" |
921 |
|
" </section>" |
922 |
|
" <section>" |
923 |
|
" <item id='RemoveScript'>" |
924 |
|
" <attribute name='label' translatable='yes'>Remove Script</attribute>" |
925 |
|
" <attribute name='action'>AppMenu.RemoveScript</attribute>" |
926 |
|
" </item>" |
927 |
|
" </section>" |
928 |
|
" </menu>" |
929 |
|
" <menu id='MenuView'>" |
930 |
|
" <attribute name='label' translatable='yes'>View</attribute>" |
931 |
|
" <section>" |
932 |
|
" <item id='Statusbar'>" |
933 |
|
" <attribute name='label' translatable='yes'>Statusbar</attribute>" |
934 |
|
" <attribute name='action'>AppMenu.Statusbar</attribute>" |
935 |
|
" </item>" |
936 |
|
" <item id='ShowTooltips'>" |
937 |
|
" <attribute name='label' translatable='yes'>Tooltips for Beginners</attribute>" |
938 |
|
" <attribute name='action'>AppMenu.ShowTooltips</attribute>" |
939 |
|
" </item>" |
940 |
|
" <item id='AutoRestoreWinDim'>" |
941 |
|
" <attribute name='label' translatable='yes'>Auto restore Window Dimensions</attribute>" |
942 |
|
" <attribute name='action'>AppMenu.AutoRestoreWinDim</attribute>" |
943 |
|
" </item>" |
944 |
|
" </section>" |
945 |
|
" <section>" |
946 |
|
" <item id='RefreshAll'>" |
947 |
|
" <attribute name='label' translatable='yes'>Refresh All</attribute>" |
948 |
|
" <attribute name='action'>AppMenu.RefreshAll</attribute>" |
949 |
|
" </item>" |
950 |
|
" </section>" |
951 |
|
" </menu>" |
952 |
|
" <menu id='MenuTools'>" |
953 |
|
" <attribute name='label' translatable='yes'>Tools</attribute>" |
954 |
|
" <section>" |
955 |
|
" <item id='CombineInstruments'>" |
956 |
|
" <attribute name='label' translatable='yes'>Combine Instruments ...</attribute>" |
957 |
|
" <attribute name='action'>AppMenu.CombineInstruments</attribute>" |
958 |
|
" </item>" |
959 |
|
" <item id='MergeFiles'>" |
960 |
|
" <attribute name='label' translatable='yes'>Merge Files ...</attribute>" |
961 |
|
" <attribute name='action'>AppMenu.MergeFiles</attribute>" |
962 |
|
" </item>" |
963 |
|
" </section>" |
964 |
|
" </menu>" |
965 |
|
" <menu id='MenuSettings'>" |
966 |
|
" <attribute name='label' translatable='yes'>Settings</attribute>" |
967 |
|
" <section>" |
968 |
|
" <item id='WarnUserOnExtensions'>" |
969 |
|
" <attribute name='label' translatable='yes'>Warning on Format Extensions</attribute>" |
970 |
|
" <attribute name='action'>AppMenu.WarnUserOnExtensions</attribute>" |
971 |
|
" </item>" |
972 |
|
" <item id='SyncSamplerInstrumentSelection'>" |
973 |
|
" <attribute name='label' translatable='yes'>Synchronize Sampler Selection</attribute>" |
974 |
|
" <attribute name='action'>AppMenu.SyncSamplerInstrumentSelection</attribute>" |
975 |
|
" </item>" |
976 |
|
" <item id='MoveRootNoteWithRegionMoved'>" |
977 |
|
" <attribute name='label' translatable='yes'>Move Root Note with Region moved</attribute>" |
978 |
|
" <attribute name='action'>AppMenu.MoveRootNoteWithRegionMoved</attribute>" |
979 |
|
" </item>" |
980 |
|
" <item id='SaveWithTemporaryFile'>" |
981 |
|
" <attribute name='label' translatable='yes'>Save with temporary file</attribute>" |
982 |
|
" <attribute name='action'>AppMenu.SaveWithTemporaryFile</attribute>" |
983 |
|
" </item>" |
984 |
|
" </section>" |
985 |
|
" </menu>" |
986 |
|
" <menu id='MenuHelp'>" |
987 |
|
" <attribute name='label' translatable='yes'>Help</attribute>" |
988 |
|
" <section>" |
989 |
|
" <item id='About'>" |
990 |
|
" <attribute name='label' translatable='yes'>About ...</attribute>" |
991 |
|
" <attribute name='action'>AppMenu.About</attribute>" |
992 |
|
" </item>" |
993 |
|
" </section>" |
994 |
|
" </menu>" |
995 |
|
" </menubar>" |
996 |
|
// popups |
997 |
|
" <menu id='PopupMenu'>" |
998 |
|
" <section>" |
999 |
|
" <item id='InstrProperties'>" |
1000 |
|
" <attribute name='label' translatable='yes'>Instrument Properties</attribute>" |
1001 |
|
" <attribute name='action'>AppMenu.InstrProperties</attribute>" |
1002 |
|
" </item>" |
1003 |
|
" <item id='MidiRules'>" |
1004 |
|
" <attribute name='label' translatable='yes'>MIDI Rules</attribute>" |
1005 |
|
" <attribute name='action'>AppMenu.MidiRules</attribute>" |
1006 |
|
" </item>" |
1007 |
|
" <item id='ScriptSlots'>" |
1008 |
|
" <attribute name='label' translatable='yes'>Script Slots</attribute>" |
1009 |
|
" <attribute name='action'>AppMenu.ScriptSlots</attribute>" |
1010 |
|
" </item>" |
1011 |
|
" <item id='AddInstrument'>" |
1012 |
|
" <attribute name='label' translatable='yes'>Add Instrument</attribute>" |
1013 |
|
" <attribute name='action'>AppMenu.AddInstrument</attribute>" |
1014 |
|
" </item>" |
1015 |
|
" <item id='DupInstrument'>" |
1016 |
|
" <attribute name='label' translatable='yes'>Duplicate Instrument</attribute>" |
1017 |
|
" <attribute name='action'>AppMenu.DupInstrument</attribute>" |
1018 |
|
" </item>" |
1019 |
|
" <item id='CombInstruments'>" |
1020 |
|
" <attribute name='label' translatable='yes'>Combine Instruments</attribute>" |
1021 |
|
" <attribute name='action'>AppMenu.CombInstruments</attribute>" |
1022 |
|
" </item>" |
1023 |
|
" </section>" |
1024 |
|
" <section>" |
1025 |
|
" <item id='RemoveInstrument'>" |
1026 |
|
" <attribute name='label' translatable='yes'>Remove Instruments</attribute>" |
1027 |
|
" <attribute name='action'>AppMenu.RemoveInstrument</attribute>" |
1028 |
|
" </item>" |
1029 |
|
" </section>" |
1030 |
|
" </menu>" |
1031 |
|
" <menu id='SamplePopupMenu'>" |
1032 |
|
" <section>" |
1033 |
|
" <item id='SampleProperties'>" |
1034 |
|
" <attribute name='label' translatable='yes'>Sample Properties</attribute>" |
1035 |
|
" <attribute name='action'>AppMenu.SampleProperties</attribute>" |
1036 |
|
" </item>" |
1037 |
|
" <item id='AddGroup'>" |
1038 |
|
" <attribute name='label' translatable='yes'>Add Sample Group</attribute>" |
1039 |
|
" <attribute name='action'>AppMenu.AddGroup</attribute>" |
1040 |
|
" </item>" |
1041 |
|
" <item id='AddSample'>" |
1042 |
|
" <attribute name='label' translatable='yes'>Add Sample</attribute>" |
1043 |
|
" <attribute name='action'>AppMenu.AddSample</attribute>" |
1044 |
|
" </item>" |
1045 |
|
" <item id='ShowSampleRefs'>" |
1046 |
|
" <attribute name='label' translatable='yes'>Show Sample References ...</attribute>" |
1047 |
|
" <attribute name='action'>AppMenu.ShowSampleRefs</attribute>" |
1048 |
|
" </item>" |
1049 |
|
" <item id='ReplaceSample'>" |
1050 |
|
" <attribute name='label' translatable='yes'>Replace Sample</attribute>" |
1051 |
|
" <attribute name='action'>AppMenu.ReplaceSample</attribute>" |
1052 |
|
" </item>" |
1053 |
|
" <item id='ReplaceAllSamplesInAllGroups'>" |
1054 |
|
" <attribute name='label' translatable='yes'>Replace all Samples ...</attribute>" |
1055 |
|
" <attribute name='action'>AppMenu.ReplaceAllSamplesInAllGroups</attribute>" |
1056 |
|
" </item>" |
1057 |
|
" </section>" |
1058 |
|
" <section>" |
1059 |
|
" <item id='RemoveSample'>" |
1060 |
|
" <attribute name='label' translatable='yes'>Remove Sample</attribute>" |
1061 |
|
" <attribute name='action'>AppMenu.RemoveSample</attribute>" |
1062 |
|
" </item>" |
1063 |
|
" <item id='RemoveUnusedSamples'>" |
1064 |
|
" <attribute name='label' translatable='yes'>Remove unused Samples</attribute>" |
1065 |
|
" <attribute name='action'>AppMenu.RemoveUnusedSamples</attribute>" |
1066 |
|
" </item>" |
1067 |
|
" </section>" |
1068 |
|
" </menu>" |
1069 |
|
" <menu id='ScriptPopupMenu'>" |
1070 |
|
" <section>" |
1071 |
|
" <item id='AddScriptGroup'>" |
1072 |
|
" <attribute name='label' translatable='yes'>Add Script Group</attribute>" |
1073 |
|
" <attribute name='action'>AppMenu.AddScriptGroup</attribute>" |
1074 |
|
" </item>" |
1075 |
|
" <item id='AddScript'>" |
1076 |
|
" <attribute name='label' translatable='yes'>Add Script</attribute>" |
1077 |
|
" <attribute name='action'>AppMenu.AddScript</attribute>" |
1078 |
|
" </item>" |
1079 |
|
" <item id='EditScript'>" |
1080 |
|
" <attribute name='label' translatable='yes'>Edit Script</attribute>" |
1081 |
|
" <attribute name='action'>AppMenu.EditScript</attribute>" |
1082 |
|
" </item>" |
1083 |
|
" </section>" |
1084 |
|
" <section>" |
1085 |
|
" <item id='RemoveScript'>" |
1086 |
|
" <attribute name='label' translatable='yes'>Remove Script</attribute>" |
1087 |
|
" <attribute name='action'>AppMenu.RemoveScript</attribute>" |
1088 |
|
" </item>" |
1089 |
|
" </section>" |
1090 |
|
" </menu>" |
1091 |
|
"</interface>"; |
1092 |
|
m_uiManager->add_from_string(ui_info); |
1093 |
|
#else |
1094 |
uiManager = Gtk::UIManager::create(); |
uiManager = Gtk::UIManager::create(); |
1095 |
uiManager->insert_action_group(actionGroup); |
uiManager->insert_action_group(actionGroup); |
1096 |
add_accel_group(uiManager->get_accel_group()); |
add_accel_group(uiManager->get_accel_group()); |
1167 |
" </menu>" |
" </menu>" |
1168 |
" <menu action='MenuView'>" |
" <menu action='MenuView'>" |
1169 |
" <menuitem action='Statusbar'/>" |
" <menuitem action='Statusbar'/>" |
1170 |
|
" <menuitem action='ShowTooltips'/>" |
1171 |
" <menuitem action='AutoRestoreWinDim'/>" |
" <menuitem action='AutoRestoreWinDim'/>" |
1172 |
" <separator/>" |
" <separator/>" |
1173 |
" <menuitem action='RefreshAll'/>" |
" <menuitem action='RefreshAll'/>" |
1216 |
" </popup>" |
" </popup>" |
1217 |
"</ui>"; |
"</ui>"; |
1218 |
uiManager->add_ui_from_string(ui_info); |
uiManager->add_ui_from_string(ui_info); |
1219 |
|
#endif |
1220 |
|
|
1221 |
|
#if USE_GTKMM_BUILDER |
1222 |
|
popup_menu = new Gtk::Menu( |
1223 |
|
Glib::RefPtr<Gio::Menu>::cast_dynamic( |
1224 |
|
m_uiManager->get_object("PopupMenu") |
1225 |
|
) |
1226 |
|
); |
1227 |
|
sample_popup = new Gtk::Menu( |
1228 |
|
Glib::RefPtr<Gio::Menu>::cast_dynamic( |
1229 |
|
m_uiManager->get_object("SamplePopupMenu") |
1230 |
|
) |
1231 |
|
); |
1232 |
|
script_popup = new Gtk::Menu( |
1233 |
|
Glib::RefPtr<Gio::Menu>::cast_dynamic( |
1234 |
|
m_uiManager->get_object("ScriptPopupMenu") |
1235 |
|
) |
1236 |
|
); |
1237 |
|
#else |
1238 |
popup_menu = dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/PopupMenu")); |
popup_menu = dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/PopupMenu")); |
1239 |
|
|
1240 |
// Set tooltips for menu items (for some reason, setting a tooltip on the |
// Set tooltips for menu items (for some reason, setting a tooltip on the |
1254 |
{ |
{ |
1255 |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
1256 |
uiManager->get_widget("/MenuBar/MenuEdit/CopySampleLoop")); |
uiManager->get_widget("/MenuBar/MenuEdit/CopySampleLoop")); |
1257 |
item->set_tooltip_text(_("Used when dragging a sample to a region's sample reference field. You may disable this for example if you want to replace an existing sample in a region with a new sample, but don't want that the region's current loop informations to be altered by this action.")); |
item->set_tooltip_text(_("Used when dragging a sample to a region's sample reference field. You may disable this for example if you want to replace an existing sample in a region with a new sample, but don't want that the region's current loop information to be altered by this action.")); |
1258 |
} |
} |
1259 |
{ |
{ |
1260 |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
1269 |
{ |
{ |
1270 |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
1271 |
uiManager->get_widget("/MenuBar/MenuSettings/MoveRootNoteWithRegionMoved")); |
uiManager->get_widget("/MenuBar/MenuSettings/MoveRootNoteWithRegionMoved")); |
1272 |
item->set_tooltip_text(_("If checked, and when a region is moved by dragging it around on the virtual keyboard, the keybord position dependent pitch will move exactly with the amount of semi tones the region was moved around.")); |
item->set_tooltip_text(_("If checked, and when a region is moved by dragging it around on the virtual keyboard, the keyboard position dependent pitch will move exactly with the amount of semi tones the region was moved around.")); |
1273 |
} |
} |
1274 |
{ |
{ |
1275 |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
1300 |
uiManager->get_widget("/MenuBar/MenuTools/MergeFiles")); |
uiManager->get_widget("/MenuBar/MenuTools/MergeFiles")); |
1301 |
item->set_tooltip_text(_("Add instruments and samples of other .gig files to this .gig file.")); |
item->set_tooltip_text(_("Add instruments and samples of other .gig files to this .gig file.")); |
1302 |
} |
} |
1303 |
|
#endif |
1304 |
|
|
1305 |
|
#if USE_GTKMM_BUILDER |
1306 |
|
assign_scripts_menu = new Gtk::Menu( |
1307 |
|
Glib::RefPtr<Gio::Menu>::cast_dynamic( |
1308 |
|
m_uiManager->get_object("AssignScripts") |
1309 |
|
) |
1310 |
|
); |
1311 |
|
#else |
1312 |
instrument_menu = static_cast<Gtk::MenuItem*>( |
instrument_menu = static_cast<Gtk::MenuItem*>( |
1313 |
uiManager->get_widget("/MenuBar/MenuInstrument/AllInstruments"))->get_submenu(); |
uiManager->get_widget("/MenuBar/MenuInstrument/AllInstruments"))->get_submenu(); |
1314 |
|
|
1315 |
assign_scripts_menu = static_cast<Gtk::MenuItem*>( |
assign_scripts_menu = static_cast<Gtk::MenuItem*>( |
1316 |
uiManager->get_widget("/MenuBar/MenuInstrument/AssignScripts"))->get_submenu(); |
uiManager->get_widget("/MenuBar/MenuInstrument/AssignScripts"))->get_submenu(); |
1317 |
|
#endif |
1318 |
|
|
1319 |
|
#if USE_GTKMM_BUILDER |
1320 |
|
Gtk::Widget* menuBar = NULL; |
1321 |
|
m_uiManager->get_widget("MenuBar", menuBar); |
1322 |
|
#else |
1323 |
Gtk::Widget* menuBar = uiManager->get_widget("/MenuBar"); |
Gtk::Widget* menuBar = uiManager->get_widget("/MenuBar"); |
1324 |
|
#endif |
1325 |
|
|
1326 |
m_VBox.pack_start(*menuBar, Gtk::PACK_SHRINK); |
m_VBox.pack_start(*menuBar, Gtk::PACK_SHRINK); |
1327 |
m_VBox.pack_start(m_HPaned); |
m_VBox.pack_start(m_HPaned); |
1328 |
m_VBox.pack_start(m_RegionChooser, Gtk::PACK_SHRINK); |
m_VBox.pack_start(m_RegionChooser, Gtk::PACK_SHRINK); |
1333 |
set_file_is_shared(false); |
set_file_is_shared(false); |
1334 |
|
|
1335 |
// Status Bar: |
// Status Bar: |
1336 |
|
#if USE_GTKMM_BOX |
1337 |
|
# warning No status bar layout for GTKMM 4 yet |
1338 |
|
#else |
1339 |
m_StatusBar.pack_start(m_AttachedStateLabel, Gtk::PACK_SHRINK); |
m_StatusBar.pack_start(m_AttachedStateLabel, Gtk::PACK_SHRINK); |
1340 |
m_StatusBar.pack_start(m_AttachedStateImage, Gtk::PACK_SHRINK); |
m_StatusBar.pack_start(m_AttachedStateImage, Gtk::PACK_SHRINK); |
1341 |
|
#endif |
1342 |
m_StatusBar.show(); |
m_StatusBar.show(); |
1343 |
|
|
1344 |
m_RegionChooser.signal_region_selected().connect( |
m_RegionChooser.signal_region_selected().connect( |
1410 |
); |
); |
1411 |
} |
} |
1412 |
m_TreeViewSamples.set_headers_visible(true); |
m_TreeViewSamples.set_headers_visible(true); |
1413 |
|
#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 |
1414 |
|
m_TreeViewSamples.signal_button_press_event().connect( |
1415 |
|
sigc::mem_fun(*this, &MainWindow::on_sample_treeview_button_release) |
1416 |
|
); |
1417 |
|
#else |
1418 |
m_TreeViewSamples.signal_button_press_event().connect_notify( |
m_TreeViewSamples.signal_button_press_event().connect_notify( |
1419 |
sigc::mem_fun(*this, &MainWindow::on_sample_treeview_button_release) |
sigc::mem_fun(*this, &MainWindow::on_sample_treeview_button_release) |
1420 |
); |
); |
1421 |
|
#endif |
1422 |
m_refSamplesTreeModel->signal_row_changed().connect( |
m_refSamplesTreeModel->signal_row_changed().connect( |
1423 |
sigc::mem_fun(*this, &MainWindow::sample_name_changed) |
sigc::mem_fun(*this, &MainWindow::sample_name_changed) |
1424 |
); |
); |
1435 |
// m_TreeViewScripts.set_reorderable(); |
// m_TreeViewScripts.set_reorderable(); |
1436 |
m_TreeViewScripts.append_column_editable("Samples", m_ScriptsModel.m_col_name); |
m_TreeViewScripts.append_column_editable("Samples", m_ScriptsModel.m_col_name); |
1437 |
m_TreeViewScripts.set_headers_visible(false); |
m_TreeViewScripts.set_headers_visible(false); |
1438 |
|
#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 |
1439 |
|
m_TreeViewScripts.signal_button_press_event().connect( |
1440 |
|
sigc::mem_fun(*this, &MainWindow::on_script_treeview_button_release) |
1441 |
|
); |
1442 |
|
#else |
1443 |
m_TreeViewScripts.signal_button_press_event().connect_notify( |
m_TreeViewScripts.signal_button_press_event().connect_notify( |
1444 |
sigc::mem_fun(*this, &MainWindow::on_script_treeview_button_release) |
sigc::mem_fun(*this, &MainWindow::on_script_treeview_button_release) |
1445 |
); |
); |
1446 |
|
#endif |
1447 |
//FIXME: why the heck does this double click signal_row_activated() only fire while CTRL key is pressed ? |
//FIXME: why the heck does this double click signal_row_activated() only fire while CTRL key is pressed ? |
1448 |
m_TreeViewScripts.signal_row_activated().connect( |
m_TreeViewScripts.signal_row_activated().connect( |
1449 |
sigc::mem_fun(*this, &MainWindow::script_double_clicked) |
sigc::mem_fun(*this, &MainWindow::script_double_clicked) |
1549 |
file = 0; |
file = 0; |
1550 |
file_is_changed = false; |
file_is_changed = false; |
1551 |
|
|
1552 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
1553 |
show_all_children(); |
show_all_children(); |
1554 |
|
#endif |
1555 |
|
|
1556 |
// start with a new gig file by default |
// start with a new gig file by default |
1557 |
on_action_file_new(); |
on_action_file_new(); |
1572 |
|
|
1573 |
// setup macros and their keyboard accelerators |
// setup macros and their keyboard accelerators |
1574 |
{ |
{ |
1575 |
|
#if USE_GTKMM_BUILDER |
1576 |
|
menuMacro = new Gtk::Menu( |
1577 |
|
Glib::RefPtr<Gio::Menu>::cast_dynamic( |
1578 |
|
m_uiManager->get_object("MenuMacro") |
1579 |
|
) |
1580 |
|
); |
1581 |
|
#else |
1582 |
Gtk::Menu* menuMacro = dynamic_cast<Gtk::MenuItem*>( |
Gtk::Menu* menuMacro = dynamic_cast<Gtk::MenuItem*>( |
1583 |
uiManager->get_widget("/MenuBar/MenuMacro") |
uiManager->get_widget("/MenuBar/MenuMacro") |
1584 |
)->get_submenu(); |
)->get_submenu(); |
1585 |
|
#endif |
1586 |
|
|
1587 |
const Gdk::ModifierType noModifier = (Gdk::ModifierType)0; |
const Gdk::ModifierType noModifier = (Gdk::ModifierType)0; |
1588 |
Gtk::AccelMap::add_entry("<Macros>/macro_0", GDK_KEY_F1, noModifier); |
Gtk::AccelMap::add_entry("<Macros>/macro_0", GDK_KEY_F1, noModifier); |
1624 |
assign_scripts_menu->set_accel_group(accelGroup); |
assign_scripts_menu->set_accel_group(accelGroup); |
1625 |
} |
} |
1626 |
|
|
1627 |
|
on_show_tooltips_changed(); |
1628 |
|
|
1629 |
Glib::signal_idle().connect_once( |
Glib::signal_idle().connect_once( |
1630 |
sigc::mem_fun(*this, &MainWindow::bringToFront), |
sigc::mem_fun(*this, &MainWindow::bringToFront), |
1631 |
200 |
200 |
1645 |
} |
} |
1646 |
|
|
1647 |
void MainWindow::updateMacroMenu() { |
void MainWindow::updateMacroMenu() { |
1648 |
|
#if !USE_GTKMM_BUILDER |
1649 |
Gtk::Menu* menuMacro = dynamic_cast<Gtk::MenuItem*>( |
Gtk::Menu* menuMacro = dynamic_cast<Gtk::MenuItem*>( |
1650 |
uiManager->get_widget("/MenuBar/MenuMacro") |
uiManager->get_widget("/MenuBar/MenuMacro") |
1651 |
)->get_submenu(); |
)->get_submenu(); |
1652 |
|
#endif |
1653 |
|
|
1654 |
// remove all entries from "Macro" menu |
// remove all entries from "Macro" menu |
1655 |
{ |
{ |
1707 |
item->set_accel_path("<Macros>/SetupMacros"); |
item->set_accel_path("<Macros>/SetupMacros"); |
1708 |
} |
} |
1709 |
|
|
1710 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
1711 |
menuMacro->show_all_children(); |
menuMacro->show_all_children(); |
1712 |
|
#endif |
1713 |
} |
} |
1714 |
|
|
1715 |
void MainWindow::onMacroSelected(int iMacro) { |
void MainWindow::onMacroSelected(int iMacro) { |
1775 |
gig::Instrument* instrument = 0; |
gig::Instrument* instrument = 0; |
1776 |
std::vector<Gtk::TreeModel::Path> rows = m_TreeView.get_selection()->get_selected_rows(); |
std::vector<Gtk::TreeModel::Path> rows = m_TreeView.get_selection()->get_selected_rows(); |
1777 |
if (rows.empty()) return NULL; |
if (rows.empty()) return NULL; |
1778 |
Gtk::TreeModel::const_iterator it = m_refTreeModel->get_iter(rows[0]); |
//NOTE: was const_iterator before, which did not compile with GTKMM4 development branch, probably going to be fixed before final GTKMM4 release though. |
1779 |
|
Gtk::TreeModel::iterator it = m_refTreeModel->get_iter(rows[0]); |
1780 |
if (it) { |
if (it) { |
1781 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
1782 |
instrument = row[m_Columns.m_col_instr]; |
instrument = row[m_Columns.m_col_instr]; |
1842 |
|
|
1843 |
void MainWindow::on_sel_change() |
void MainWindow::on_sel_change() |
1844 |
{ |
{ |
1845 |
|
#if !USE_GTKMM_BUILDER |
1846 |
// select item in instrument menu |
// select item in instrument menu |
1847 |
std::vector<Gtk::TreeModel::Path> rows = m_TreeView.get_selection()->get_selected_rows(); |
std::vector<Gtk::TreeModel::Path> rows = m_TreeView.get_selection()->get_selected_rows(); |
1848 |
if (!rows.empty()) { |
if (!rows.empty()) { |
1855 |
static_cast<Gtk::RadioMenuItem*>(children[index])->set_active(); |
static_cast<Gtk::RadioMenuItem*>(children[index])->set_active(); |
1856 |
} |
} |
1857 |
} |
} |
1858 |
|
#endif |
1859 |
|
|
1860 |
updateScriptListOfMenu(); |
updateScriptListOfMenu(); |
1861 |
|
|
2066 |
ProgressDialog::ProgressDialog(const Glib::ustring& title, Gtk::Window& parent) |
ProgressDialog::ProgressDialog(const Glib::ustring& title, Gtk::Window& parent) |
2067 |
: Gtk::Dialog(title, parent, true) |
: Gtk::Dialog(title, parent, true) |
2068 |
{ |
{ |
2069 |
|
#if USE_GTKMM_BOX |
2070 |
|
get_content_area()->pack_start(progressBar); |
2071 |
|
#else |
2072 |
get_vbox()->pack_start(progressBar); |
get_vbox()->pack_start(progressBar); |
2073 |
|
#endif |
2074 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
2075 |
show_all_children(); |
show_all_children(); |
2076 |
|
#endif |
2077 |
resize(600,50); |
resize(600,50); |
2078 |
} |
} |
2079 |
|
|
2086 |
m_refTreeModel->clear(); |
m_refTreeModel->clear(); |
2087 |
m_refSamplesTreeModel->clear(); |
m_refSamplesTreeModel->clear(); |
2088 |
m_refScriptsTreeModel->clear(); |
m_refScriptsTreeModel->clear(); |
2089 |
|
#if !USE_GTKMM_BUILDER |
2090 |
// remove all entries from "Instrument" menu |
// remove all entries from "Instrument" menu |
2091 |
while (!instrument_menu->get_children().empty()) { |
while (!instrument_menu->get_children().empty()) { |
2092 |
remove_instrument_from_menu(0); |
remove_instrument_from_menu(0); |
2093 |
} |
} |
2094 |
|
#endif |
2095 |
// free libgig's gig::File instance |
// free libgig's gig::File instance |
2096 |
if (file && !file_is_shared) delete file; |
if (file && !file_is_shared) delete file; |
2097 |
file = NULL; |
file = NULL; |
2103 |
m_refTreeModel->clear(); |
m_refTreeModel->clear(); |
2104 |
m_refSamplesTreeModel->clear(); |
m_refSamplesTreeModel->clear(); |
2105 |
m_refScriptsTreeModel->clear(); |
m_refScriptsTreeModel->clear(); |
2106 |
|
#if !USE_GTKMM_BUILDER |
2107 |
// remove all entries from "Instrument" menu |
// remove all entries from "Instrument" menu |
2108 |
while (!instrument_menu->get_children().empty()) { |
while (!instrument_menu->get_children().empty()) { |
2109 |
remove_instrument_from_menu(0); |
remove_instrument_from_menu(0); |
2110 |
} |
} |
2111 |
|
#endif |
2112 |
|
|
2113 |
if (!this->file) return; |
if (!this->file) return; |
2114 |
|
|
2142 |
g_free(msg); |
g_free(msg); |
2143 |
dialog.set_secondary_text(_("If you close without saving, your changes will be lost.")); |
dialog.set_secondary_text(_("If you close without saving, your changes will be lost.")); |
2144 |
dialog.add_button(_("Close _Without Saving"), Gtk::RESPONSE_NO); |
dialog.add_button(_("Close _Without Saving"), Gtk::RESPONSE_NO); |
2145 |
|
#if HAS_GTKMM_STOCK |
2146 |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
2147 |
dialog.add_button(file_has_name ? Gtk::Stock::SAVE : Gtk::Stock::SAVE_AS, Gtk::RESPONSE_YES); |
dialog.add_button(file_has_name ? Gtk::Stock::SAVE : Gtk::Stock::SAVE_AS, Gtk::RESPONSE_YES); |
2148 |
|
#else |
2149 |
|
dialog.add_button(_("_OK"), Gtk::RESPONSE_OK); |
2150 |
|
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL); |
2151 |
|
#endif |
2152 |
dialog.set_default_response(Gtk::RESPONSE_YES); |
dialog.set_default_response(Gtk::RESPONSE_YES); |
2153 |
int response = dialog.run(); |
int response = dialog.run(); |
2154 |
dialog.hide(); |
dialog.hide(); |
2179 |
"used by the sampler until you tell the sampler explicitly to " |
"used by the sampler until you tell the sampler explicitly to " |
2180 |
"load it.")); |
"load it.")); |
2181 |
dialog.add_button(_("_Yes, Detach"), Gtk::RESPONSE_YES); |
dialog.add_button(_("_Yes, Detach"), Gtk::RESPONSE_YES); |
2182 |
|
#if HAS_GTKMM_STOCK |
2183 |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
2184 |
|
#else |
2185 |
|
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL); |
2186 |
|
#endif |
2187 |
dialog.set_default_response(Gtk::RESPONSE_CANCEL); |
dialog.set_default_response(Gtk::RESPONSE_CANCEL); |
2188 |
int response = dialog.run(); |
int response = dialog.run(); |
2189 |
dialog.hide(); |
dialog.hide(); |
2197 |
if (file_is_shared && !leaving_shared_mode_dialog()) return; |
if (file_is_shared && !leaving_shared_mode_dialog()) return; |
2198 |
|
|
2199 |
Gtk::FileChooserDialog dialog(*this, _("Open file")); |
Gtk::FileChooserDialog dialog(*this, _("Open file")); |
2200 |
|
#if HAS_GTKMM_STOCK |
2201 |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
2202 |
dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); |
dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); |
2203 |
|
#else |
2204 |
|
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL); |
2205 |
|
dialog.add_button(_("_Open"), Gtk::RESPONSE_OK); |
2206 |
|
#endif |
2207 |
dialog.set_default_response(Gtk::RESPONSE_OK); |
dialog.set_default_response(Gtk::RESPONSE_OK); |
2208 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
2209 |
Gtk::FileFilter filter; |
Gtk::FileFilter filter; |
2235 |
Glib::filename_display_basename(name) + "' ...", |
Glib::filename_display_basename(name) + "' ...", |
2236 |
*this |
*this |
2237 |
); |
); |
2238 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
2239 |
progress_dialog->show_all(); |
progress_dialog->show_all(); |
2240 |
|
#endif |
2241 |
loader = new Loader(name); //FIXME: memory leak! |
loader = new Loader(name); //FIXME: memory leak! |
2242 |
loader->signal_progress().connect( |
loader->signal_progress().connect( |
2243 |
sigc::mem_fun(*this, &MainWindow::on_loader_progress)); |
sigc::mem_fun(*this, &MainWindow::on_loader_progress)); |
2271 |
// make sure the selected item in the "instruments" tree view is |
// make sure the selected item in the "instruments" tree view is |
2272 |
// visible (scroll to it) |
// visible (scroll to it) |
2273 |
m_TreeView.scroll_to_row(Gtk::TreePath(ToString(i))); |
m_TreeView.scroll_to_row(Gtk::TreePath(ToString(i))); |
2274 |
|
#if !USE_GTKMM_BUILDER |
2275 |
// select item in instrument menu |
// select item in instrument menu |
2276 |
{ |
{ |
2277 |
const std::vector<Gtk::Widget*> children = |
const std::vector<Gtk::Widget*> children = |
2278 |
instrument_menu->get_children(); |
instrument_menu->get_children(); |
2279 |
static_cast<Gtk::RadioMenuItem*>(children[i])->set_active(); |
static_cast<Gtk::RadioMenuItem*>(children[i])->set_active(); |
2280 |
} |
} |
2281 |
|
#endif |
2282 |
// update region chooser and dimension region chooser |
// update region chooser and dimension region chooser |
2283 |
m_RegionChooser.set_instrument(instr); |
m_RegionChooser.set_instrument(instr); |
2284 |
break; |
break; |
2350 |
Glib::filename_display_basename(this->filename) + "' ...", |
Glib::filename_display_basename(this->filename) + "' ...", |
2351 |
*this |
*this |
2352 |
); |
); |
2353 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
2354 |
progress_dialog->show_all(); |
progress_dialog->show_all(); |
2355 |
|
#endif |
2356 |
saver = new Saver(this->file); //FIXME: memory leak! |
saver = new Saver(this->file); //FIXME: memory leak! |
2357 |
saver->signal_progress().connect( |
saver->signal_progress().connect( |
2358 |
sigc::mem_fun(*this, &MainWindow::on_saver_progress)); |
sigc::mem_fun(*this, &MainWindow::on_saver_progress)); |
2405 |
bool MainWindow::file_save_as() |
bool MainWindow::file_save_as() |
2406 |
{ |
{ |
2407 |
Gtk::FileChooserDialog dialog(*this, _("Save as"), Gtk::FILE_CHOOSER_ACTION_SAVE); |
Gtk::FileChooserDialog dialog(*this, _("Save as"), Gtk::FILE_CHOOSER_ACTION_SAVE); |
2408 |
|
#if HAS_GTKMM_STOCK |
2409 |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
2410 |
dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); |
dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); |
2411 |
|
#else |
2412 |
|
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL); |
2413 |
|
dialog.add_button(_("_Save"), Gtk::RESPONSE_OK); |
2414 |
|
#endif |
2415 |
dialog.set_default_response(Gtk::RESPONSE_OK); |
dialog.set_default_response(Gtk::RESPONSE_OK); |
2416 |
dialog.set_do_overwrite_confirmation(); |
dialog.set_do_overwrite_confirmation(); |
2417 |
|
|
2440 |
} |
} |
2441 |
|
|
2442 |
// show warning in the dialog |
// show warning in the dialog |
2443 |
Gtk::HBox descriptionArea; |
HBox descriptionArea; |
2444 |
descriptionArea.set_spacing(15); |
descriptionArea.set_spacing(15); |
2445 |
Gtk::Image warningIcon; |
Gtk::Image warningIcon; |
2446 |
warningIcon.set_from_icon_name("dialog-warning", |
warningIcon.set_from_icon_name("dialog-warning", |
2461 |
"same .gig file will end up in corrupted sample wave data!\n") |
"same .gig file will end up in corrupted sample wave data!\n") |
2462 |
); |
); |
2463 |
descriptionArea.pack_start(description); |
descriptionArea.pack_start(description); |
2464 |
|
#if USE_GTKMM_BOX |
2465 |
|
dialog.get_content_area()->pack_start(descriptionArea, Gtk::PACK_SHRINK); |
2466 |
|
#else |
2467 |
dialog.get_vbox()->pack_start(descriptionArea, Gtk::PACK_SHRINK); |
dialog.get_vbox()->pack_start(descriptionArea, Gtk::PACK_SHRINK); |
2468 |
|
#endif |
2469 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
2470 |
descriptionArea.show_all(); |
descriptionArea.show_all(); |
2471 |
|
#endif |
2472 |
|
|
2473 |
if (dialog.run() == Gtk::RESPONSE_OK) { |
if (dialog.run() == Gtk::RESPONSE_OK) { |
2474 |
std::string filename = dialog.get_filename(); |
std::string filename = dialog.get_filename(); |
2482 |
Glib::filename_display_basename(filename) + "' ...", |
Glib::filename_display_basename(filename) + "' ...", |
2483 |
*this |
*this |
2484 |
); |
); |
2485 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
2486 |
progress_dialog->show_all(); |
progress_dialog->show_all(); |
2487 |
|
#endif |
2488 |
|
|
2489 |
saver = new Saver(file, filename); //FIXME: memory leak! |
saver = new Saver(file, filename); //FIXME: memory leak! |
2490 |
saver->signal_progress().connect( |
saver->signal_progress().connect( |
2608 |
!Settings::singleton()->warnUserOnExtensions; |
!Settings::singleton()->warnUserOnExtensions; |
2609 |
} |
} |
2610 |
|
|
2611 |
|
void MainWindow::on_action_show_tooltips() { |
2612 |
|
Settings::singleton()->showTooltips = |
2613 |
|
!Settings::singleton()->showTooltips; |
2614 |
|
|
2615 |
|
on_show_tooltips_changed(); |
2616 |
|
} |
2617 |
|
|
2618 |
|
void MainWindow::on_show_tooltips_changed() { |
2619 |
|
const bool b = Settings::singleton()->showTooltips; |
2620 |
|
|
2621 |
|
dimreg_label.set_has_tooltip(b); |
2622 |
|
dimreg_all_regions.set_has_tooltip(b); |
2623 |
|
dimreg_all_dimregs.set_has_tooltip(b); |
2624 |
|
dimreg_stereo.set_has_tooltip(b); |
2625 |
|
m_TreeView.set_has_tooltip(b); |
2626 |
|
m_TreeViewSamples.set_has_tooltip(b); |
2627 |
|
m_TreeViewScripts.set_has_tooltip(b); |
2628 |
|
|
2629 |
|
set_has_tooltip(b); |
2630 |
|
} |
2631 |
|
|
2632 |
void MainWindow::on_action_sync_sampler_instrument_selection() { |
void MainWindow::on_action_sync_sampler_instrument_selection() { |
2633 |
Settings::singleton()->syncSamplerInstrumentSelection = |
Settings::singleton()->syncSamplerInstrumentSelection = |
2634 |
!Settings::singleton()->syncSamplerInstrumentSelection; |
!Settings::singleton()->syncSamplerInstrumentSelection; |
2686 |
eSourceForm(_("Source form")), |
eSourceForm(_("Source form")), |
2687 |
eCommissioned(_("Commissioned")), |
eCommissioned(_("Commissioned")), |
2688 |
eSubject(_("Subject")), |
eSubject(_("Subject")), |
2689 |
|
#if HAS_GTKMM_STOCK |
2690 |
quitButton(Gtk::Stock::CLOSE), |
quitButton(Gtk::Stock::CLOSE), |
2691 |
|
#else |
2692 |
|
quitButton(_("_Close")), |
2693 |
|
#endif |
2694 |
table(2, 1), |
table(2, 1), |
2695 |
m_file(NULL) |
m_file(NULL) |
2696 |
{ |
{ |
2737 |
table.add(eCommissioned); |
table.add(eCommissioned); |
2738 |
table.add(eSubject); |
table.add(eSubject); |
2739 |
|
|
2740 |
|
#if USE_GTKMM_GRID |
2741 |
|
table.set_column_spacing(5); |
2742 |
|
#else |
2743 |
table.set_col_spacings(5); |
table.set_col_spacings(5); |
2744 |
|
#endif |
2745 |
|
|
2746 |
add(vbox); |
add(vbox); |
2747 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22) |
2748 |
|
table.set_margin(5); |
2749 |
|
#else |
2750 |
table.set_border_width(5); |
table.set_border_width(5); |
2751 |
|
#endif |
2752 |
vbox.add(table); |
vbox.add(table); |
2753 |
vbox.pack_start(buttonBox, Gtk::PACK_SHRINK); |
vbox.pack_start(buttonBox, Gtk::PACK_SHRINK); |
2754 |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
2755 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22) |
2756 |
|
buttonBox.set_margin(5); |
2757 |
|
#else |
2758 |
buttonBox.set_border_width(5); |
buttonBox.set_border_width(5); |
2759 |
|
#endif |
2760 |
buttonBox.show(); |
buttonBox.show(); |
2761 |
buttonBox.pack_start(quitButton); |
buttonBox.pack_start(quitButton); |
2762 |
quitButton.set_can_default(); |
quitButton.set_can_default(); |
2768 |
|
|
2769 |
quitButton.show(); |
quitButton.show(); |
2770 |
vbox.show(); |
vbox.show(); |
2771 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
2772 |
show_all_children(); |
show_all_children(); |
2773 |
|
#endif |
2774 |
} |
} |
2775 |
|
|
2776 |
void PropDialog::set_file(gig::File* file) |
void PropDialog::set_file(gig::File* file) |
2833 |
} |
} |
2834 |
|
|
2835 |
InstrumentProps::InstrumentProps() : |
InstrumentProps::InstrumentProps() : |
2836 |
|
#if HAS_GTKMM_STOCK |
2837 |
quitButton(Gtk::Stock::CLOSE), |
quitButton(Gtk::Stock::CLOSE), |
2838 |
|
#else |
2839 |
|
quitButton(_("_Close")), |
2840 |
|
#endif |
2841 |
table(2,1), |
table(2,1), |
2842 |
eName(_("Name")), |
eName(_("Name")), |
2843 |
eIsDrum(_("Is drum")), |
eIsDrum(_("Is drum")), |
2883 |
|
|
2884 |
eName.signal_value_changed().connect(sig_name_changed.make_slot()); |
eName.signal_value_changed().connect(sig_name_changed.make_slot()); |
2885 |
|
|
2886 |
|
#if USE_GTKMM_GRID |
2887 |
|
table.set_column_spacing(5); |
2888 |
|
#else |
2889 |
table.set_col_spacings(5); |
table.set_col_spacings(5); |
2890 |
|
#endif |
2891 |
|
|
2892 |
table.add(eName); |
table.add(eName); |
2893 |
table.add(eIsDrum); |
table.add(eIsDrum); |
2903 |
table.add(eDimensionKeyRangeHigh); |
table.add(eDimensionKeyRangeHigh); |
2904 |
|
|
2905 |
add(vbox); |
add(vbox); |
2906 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22) |
2907 |
|
table.set_margin(5); |
2908 |
|
#else |
2909 |
table.set_border_width(5); |
table.set_border_width(5); |
2910 |
|
#endif |
2911 |
vbox.pack_start(table); |
vbox.pack_start(table); |
2912 |
table.show(); |
table.show(); |
2913 |
vbox.pack_start(buttonBox, Gtk::PACK_SHRINK); |
vbox.pack_start(buttonBox, Gtk::PACK_SHRINK); |
2914 |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
2915 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22) |
2916 |
|
buttonBox.set_margin(5); |
2917 |
|
#else |
2918 |
buttonBox.set_border_width(5); |
buttonBox.set_border_width(5); |
2919 |
|
#endif |
2920 |
buttonBox.show(); |
buttonBox.show(); |
2921 |
buttonBox.pack_start(quitButton); |
buttonBox.pack_start(quitButton); |
2922 |
quitButton.set_can_default(); |
quitButton.set_can_default(); |
2927 |
|
|
2928 |
quitButton.show(); |
quitButton.show(); |
2929 |
vbox.show(); |
vbox.show(); |
2930 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
2931 |
show_all_children(); |
show_all_children(); |
2932 |
|
#endif |
2933 |
} |
} |
2934 |
|
|
2935 |
void InstrumentProps::set_instrument(gig::Instrument* instrument) |
void InstrumentProps::set_instrument(gig::Instrument* instrument) |
3004 |
row[m_Columns.m_col_instr] = instrument; |
row[m_Columns.m_col_instr] = instrument; |
3005 |
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
3006 |
|
|
3007 |
|
#if !USE_GTKMM_BUILDER |
3008 |
add_instrument_to_menu(name); |
add_instrument_to_menu(name); |
3009 |
|
#endif |
3010 |
} |
} |
3011 |
instrument_name_connection.unblock(); |
instrument_name_connection.unblock(); |
3012 |
|
#if !USE_GTKMM_BUILDER |
3013 |
uiManager->get_widget("/MenuBar/MenuInstrument/AllInstruments")->show(); |
uiManager->get_widget("/MenuBar/MenuInstrument/AllInstruments")->show(); |
3014 |
|
#endif |
3015 |
|
|
3016 |
updateSampleRefCountMap(gig); |
updateSampleRefCountMap(gig); |
3017 |
|
|
3082 |
instrumentProps.hide(); |
instrumentProps.hide(); |
3083 |
return false; |
return false; |
3084 |
} |
} |
3085 |
Gtk::TreeModel::const_iterator it = m_refTreeModel->get_iter(rows[0]); |
//NOTE: was const_iterator before, which did not compile with GTKMM4 development branch, probably going to be fixed before final GTKMM4 release though. |
3086 |
|
Gtk::TreeModel::iterator it = m_refTreeModel->get_iter(rows[0]); |
3087 |
if (it) { |
if (it) { |
3088 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
3089 |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
3100 |
} else { |
} else { |
3101 |
instrumentProps.hide(); |
instrumentProps.hide(); |
3102 |
} |
} |
3103 |
return it; |
//NOTE: explicit boolean cast required for GTKMM4 development branch here |
3104 |
|
return it ? true : false; |
3105 |
} |
} |
3106 |
|
|
3107 |
void MainWindow::show_instr_props() |
void MainWindow::show_instr_props() |
3196 |
} |
} |
3197 |
|
|
3198 |
void MainWindow::on_action_view_status_bar() { |
void MainWindow::on_action_view_status_bar() { |
3199 |
|
#if USE_GLIB_ACTION |
3200 |
|
bool active = false; |
3201 |
|
m_actionToggleStatusBar->get_state(active); |
3202 |
|
// for some reason toggle state does not change automatically |
3203 |
|
active = !active; |
3204 |
|
m_actionToggleStatusBar->change_state(active); |
3205 |
|
if (active) |
3206 |
|
m_StatusBar.show(); |
3207 |
|
else |
3208 |
|
m_StatusBar.hide(); |
3209 |
|
#else |
3210 |
Gtk::CheckMenuItem* item = |
Gtk::CheckMenuItem* item = |
3211 |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar")); |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar")); |
3212 |
if (!item) { |
if (!item) { |
3215 |
} |
} |
3216 |
if (item->get_active()) m_StatusBar.show(); |
if (item->get_active()) m_StatusBar.show(); |
3217 |
else m_StatusBar.hide(); |
else m_StatusBar.hide(); |
3218 |
|
#endif |
3219 |
} |
} |
3220 |
|
|
3221 |
void MainWindow::on_auto_restore_win_dim() { |
void MainWindow::on_auto_restore_win_dim() { |
3222 |
|
#if USE_GLIB_ACTION |
3223 |
|
bool active = false; |
3224 |
|
m_actionToggleRestoreWinDim->get_state(active); |
3225 |
|
// for some reason toggle state does not change automatically |
3226 |
|
active = !active; |
3227 |
|
m_actionToggleRestoreWinDim->change_state(active); |
3228 |
|
Settings::singleton()->autoRestoreWindowDimension = active; |
3229 |
|
#else |
3230 |
Gtk::CheckMenuItem* item = |
Gtk::CheckMenuItem* item = |
3231 |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/AutoRestoreWinDim")); |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/AutoRestoreWinDim")); |
3232 |
if (!item) { |
if (!item) { |
3234 |
return; |
return; |
3235 |
} |
} |
3236 |
Settings::singleton()->autoRestoreWindowDimension = item->get_active(); |
Settings::singleton()->autoRestoreWindowDimension = item->get_active(); |
3237 |
|
#endif |
3238 |
} |
} |
3239 |
|
|
3240 |
void MainWindow::on_save_with_temporary_file() { |
void MainWindow::on_save_with_temporary_file() { |
3241 |
|
#if USE_GLIB_ACTION |
3242 |
|
bool active = false; |
3243 |
|
m_actionToggleSaveWithTempFile->get_state(active); |
3244 |
|
// for some reason toggle state does not change automatically |
3245 |
|
active = !active; |
3246 |
|
m_actionToggleSaveWithTempFile->change_state(active); |
3247 |
|
Settings::singleton()->saveWithTemporaryFile = active; |
3248 |
|
#else |
3249 |
Gtk::CheckMenuItem* item = |
Gtk::CheckMenuItem* item = |
3250 |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuSettings/SaveWithTemporaryFile")); |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuSettings/SaveWithTemporaryFile")); |
3251 |
if (!item) { |
if (!item) { |
3253 |
return; |
return; |
3254 |
} |
} |
3255 |
Settings::singleton()->saveWithTemporaryFile = item->get_active(); |
Settings::singleton()->saveWithTemporaryFile = item->get_active(); |
3256 |
|
#endif |
3257 |
} |
} |
3258 |
|
|
3259 |
bool MainWindow::is_copy_samples_unity_note_enabled() const { |
bool MainWindow::is_copy_samples_unity_note_enabled() const { |
3260 |
|
#if USE_GLIB_ACTION |
3261 |
|
bool active = false; |
3262 |
|
m_actionToggleCopySampleUnity->get_state(active); |
3263 |
|
return active; |
3264 |
|
#else |
3265 |
Gtk::CheckMenuItem* item = |
Gtk::CheckMenuItem* item = |
3266 |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuEdit/CopySampleUnity")); |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuEdit/CopySampleUnity")); |
3267 |
if (!item) { |
if (!item) { |
3269 |
return true; |
return true; |
3270 |
} |
} |
3271 |
return item->get_active(); |
return item->get_active(); |
3272 |
|
#endif |
3273 |
} |
} |
3274 |
|
|
3275 |
bool MainWindow::is_copy_samples_fine_tune_enabled() const { |
bool MainWindow::is_copy_samples_fine_tune_enabled() const { |
3276 |
|
#if USE_GLIB_ACTION |
3277 |
|
bool active = false; |
3278 |
|
m_actionToggleCopySampleTune->get_state(active); |
3279 |
|
return active; |
3280 |
|
#else |
3281 |
Gtk::CheckMenuItem* item = |
Gtk::CheckMenuItem* item = |
3282 |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuEdit/CopySampleTune")); |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuEdit/CopySampleTune")); |
3283 |
if (!item) { |
if (!item) { |
3285 |
return true; |
return true; |
3286 |
} |
} |
3287 |
return item->get_active(); |
return item->get_active(); |
3288 |
|
#endif |
3289 |
} |
} |
3290 |
|
|
3291 |
bool MainWindow::is_copy_samples_loop_enabled() const { |
bool MainWindow::is_copy_samples_loop_enabled() const { |
3292 |
|
#if USE_GLIB_ACTION |
3293 |
|
bool active = false; |
3294 |
|
m_actionToggleCopySampleLoop->get_state(active); |
3295 |
|
return active; |
3296 |
|
#else |
3297 |
Gtk::CheckMenuItem* item = |
Gtk::CheckMenuItem* item = |
3298 |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuEdit/CopySampleLoop")); |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuEdit/CopySampleLoop")); |
3299 |
if (!item) { |
if (!item) { |
3301 |
return true; |
return true; |
3302 |
} |
} |
3303 |
return item->get_active(); |
return item->get_active(); |
3304 |
|
#endif |
3305 |
} |
} |
3306 |
|
|
3307 |
void MainWindow::on_button_release(GdkEventButton* button) |
#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 |
3308 |
{ |
bool MainWindow::on_button_release(Gdk::EventButton& _button) { |
3309 |
|
GdkEventButton* button = _button.gobj(); |
3310 |
|
#else |
3311 |
|
void MainWindow::on_button_release(GdkEventButton* button) { |
3312 |
|
#endif |
3313 |
if (button->type == GDK_2BUTTON_PRESS) { |
if (button->type == GDK_2BUTTON_PRESS) { |
3314 |
show_instr_props(); |
show_instr_props(); |
3315 |
} else if (button->type == GDK_BUTTON_PRESS && button->button == 3) { |
} else if (button->type == GDK_BUTTON_PRESS && button->button == 3) { |
3316 |
// gig v2 files have no midi rules |
// gig v2 files have no midi rules |
3317 |
const bool bEnabled = !(file->pVersion && file->pVersion->major == 2); |
const bool bEnabled = !(file->pVersion && file->pVersion->major == 2); |
3318 |
|
#if USE_GTKMM_BUILDER |
3319 |
|
m_actionMIDIRules->property_enabled() = bEnabled; |
3320 |
|
#else |
3321 |
static_cast<Gtk::MenuItem*>( |
static_cast<Gtk::MenuItem*>( |
3322 |
uiManager->get_widget("/MenuBar/MenuInstrument/MidiRules"))->set_sensitive( |
uiManager->get_widget("/MenuBar/MenuInstrument/MidiRules"))->set_sensitive( |
3323 |
bEnabled |
bEnabled |
3326 |
uiManager->get_widget("/PopupMenu/MidiRules"))->set_sensitive( |
uiManager->get_widget("/PopupMenu/MidiRules"))->set_sensitive( |
3327 |
bEnabled |
bEnabled |
3328 |
); |
); |
3329 |
|
#endif |
3330 |
popup_menu->popup(button->button, button->time); |
popup_menu->popup(button->button, button->time); |
3331 |
} |
} |
3332 |
|
#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 |
3333 |
|
return false; |
3334 |
|
#endif |
3335 |
} |
} |
3336 |
|
|
3337 |
|
#if !USE_GTKMM_BUILDER |
3338 |
void MainWindow::on_instrument_selection_change(Gtk::RadioMenuItem* item) { |
void MainWindow::on_instrument_selection_change(Gtk::RadioMenuItem* item) { |
3339 |
if (item->get_active()) { |
if (item->get_active()) { |
3340 |
const std::vector<Gtk::Widget*> children = |
const std::vector<Gtk::Widget*> children = |
3349 |
} |
} |
3350 |
} |
} |
3351 |
} |
} |
3352 |
|
#endif |
3353 |
|
|
3354 |
void MainWindow::select_instrument(gig::Instrument* instrument) { |
void MainWindow::select_instrument(gig::Instrument* instrument) { |
3355 |
if (!instrument) return; |
if (!instrument) return; |
3364 |
// select and show the respective instrument in the list view |
// select and show the respective instrument in the list view |
3365 |
show_intruments_tab(); |
show_intruments_tab(); |
3366 |
m_TreeView.get_selection()->unselect_all(); |
m_TreeView.get_selection()->unselect_all(); |
3367 |
|
|
3368 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22) |
3369 |
|
auto iterSel = model->children()[i].get_iter(); |
3370 |
|
m_TreeView.get_selection()->select(iterSel); |
3371 |
|
#else |
3372 |
m_TreeView.get_selection()->select(model->children()[i]); |
m_TreeView.get_selection()->select(model->children()[i]); |
3373 |
|
#endif |
3374 |
std::vector<Gtk::TreeModel::Path> rows = |
std::vector<Gtk::TreeModel::Path> rows = |
3375 |
m_TreeView.get_selection()->get_selected_rows(); |
m_TreeView.get_selection()->get_selected_rows(); |
3376 |
if (!rows.empty()) |
if (!rows.empty()) |
3395 |
// select and show the respective instrument in the list view |
// select and show the respective instrument in the list view |
3396 |
show_intruments_tab(); |
show_intruments_tab(); |
3397 |
m_TreeView.get_selection()->unselect_all(); |
m_TreeView.get_selection()->unselect_all(); |
3398 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22) |
3399 |
|
auto iterSel = model->children()[i].get_iter(); |
3400 |
|
m_TreeView.get_selection()->select(iterSel); |
3401 |
|
#else |
3402 |
m_TreeView.get_selection()->select(model->children()[i]); |
m_TreeView.get_selection()->select(model->children()[i]); |
3403 |
|
#endif |
3404 |
std::vector<Gtk::TreeModel::Path> rows = |
std::vector<Gtk::TreeModel::Path> rows = |
3405 |
m_TreeView.get_selection()->get_selected_rows(); |
m_TreeView.get_selection()->get_selected_rows(); |
3406 |
if (!rows.empty()) |
if (!rows.empty()) |
3431 |
if (rowSample[m_SamplesModel.m_col_sample] == sample) { |
if (rowSample[m_SamplesModel.m_col_sample] == sample) { |
3432 |
show_samples_tab(); |
show_samples_tab(); |
3433 |
m_TreeViewSamples.get_selection()->unselect_all(); |
m_TreeViewSamples.get_selection()->unselect_all(); |
3434 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22) |
3435 |
|
auto iterSel = rowGroup.children()[s].get_iter(); |
3436 |
|
m_TreeViewSamples.get_selection()->select(iterSel); |
3437 |
|
#else |
3438 |
m_TreeViewSamples.get_selection()->select(rowGroup.children()[s]); |
m_TreeViewSamples.get_selection()->select(rowGroup.children()[s]); |
3439 |
|
#endif |
3440 |
std::vector<Gtk::TreeModel::Path> rows = |
std::vector<Gtk::TreeModel::Path> rows = |
3441 |
m_TreeViewSamples.get_selection()->get_selected_rows(); |
m_TreeViewSamples.get_selection()->get_selected_rows(); |
3442 |
if (rows.empty()) return; |
if (rows.empty()) return; |
3447 |
} |
} |
3448 |
} |
} |
3449 |
|
|
3450 |
|
#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 |
3451 |
|
bool MainWindow::on_sample_treeview_button_release(Gdk::EventButton& _button) { |
3452 |
|
GdkEventButton* button = _button.gobj(); |
3453 |
|
#else |
3454 |
void MainWindow::on_sample_treeview_button_release(GdkEventButton* button) { |
void MainWindow::on_sample_treeview_button_release(GdkEventButton* button) { |
3455 |
|
#endif |
3456 |
if (button->type == GDK_BUTTON_PRESS && button->button == 3) { |
if (button->type == GDK_BUTTON_PRESS && button->button == 3) { |
3457 |
// by default if Ctrl keys is pressed down, then a mouse right-click |
// by default if Ctrl keys is pressed down, then a mouse right-click |
3458 |
// does not select the respective row, so we must assure this |
// does not select the respective row, so we must assure this |
3473 |
} |
} |
3474 |
}*/ |
}*/ |
3475 |
|
|
3476 |
|
#if !USE_GTKMM_BUILDER |
3477 |
Gtk::Menu* sample_popup = |
Gtk::Menu* sample_popup = |
3478 |
dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/SamplePopupMenu")); |
dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/SamplePopupMenu")); |
3479 |
|
#endif |
3480 |
|
|
3481 |
// update enabled/disabled state of sample popup items |
// update enabled/disabled state of sample popup items |
3482 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection(); |
3483 |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
3492 |
if (row[m_SamplesModel.m_col_sample]) nSamples++; |
if (row[m_SamplesModel.m_col_sample]) nSamples++; |
3493 |
} |
} |
3494 |
|
|
3495 |
|
#if USE_GTKMM_BUILDER |
3496 |
|
m_actionSampleProperties->property_enabled() = (n == 1); |
3497 |
|
m_actionAddSample->property_enabled() = (n); |
3498 |
|
m_actionAddSampleGroup->property_enabled() = (file); |
3499 |
|
m_actionViewSampleRefs->property_enabled() = (nSamples == 1); |
3500 |
|
m_actionRemoveSample->property_enabled() = (n); |
3501 |
|
m_actionReplaceSample->property_enabled() = (nSamples == 1); |
3502 |
|
#else |
3503 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/SampleProperties"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/SampleProperties"))-> |
3504 |
set_sensitive(n == 1); |
set_sensitive(n == 1); |
3505 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/AddSample"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/AddSample"))-> |
3510 |
set_sensitive(nSamples == 1); |
set_sensitive(nSamples == 1); |
3511 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/RemoveSample"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/RemoveSample"))-> |
3512 |
set_sensitive(n); |
set_sensitive(n); |
3513 |
|
#endif |
3514 |
// show sample popup |
// show sample popup |
3515 |
sample_popup->popup(button->button, button->time); |
sample_popup->popup(button->button, button->time); |
3516 |
|
|
3517 |
|
#if !USE_GTKMM_BUILDER |
3518 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/SampleProperties"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/SampleProperties"))-> |
3519 |
set_sensitive(n == 1); |
set_sensitive(n == 1); |
3520 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/AddSample"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/AddSample"))-> |
3525 |
set_sensitive(nSamples == 1); |
set_sensitive(nSamples == 1); |
3526 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/RemoveSample"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/RemoveSample"))-> |
3527 |
set_sensitive(n); |
set_sensitive(n); |
3528 |
|
#endif |
3529 |
} |
} |
3530 |
|
|
3531 |
|
#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 |
3532 |
|
return false; |
3533 |
|
#endif |
3534 |
} |
} |
3535 |
|
|
3536 |
|
#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 |
3537 |
|
bool MainWindow::on_script_treeview_button_release(Gdk::EventButton& _button) { |
3538 |
|
GdkEventButton* button = _button.gobj(); |
3539 |
|
#else |
3540 |
void MainWindow::on_script_treeview_button_release(GdkEventButton* button) { |
void MainWindow::on_script_treeview_button_release(GdkEventButton* button) { |
3541 |
|
#endif |
3542 |
if (button->type == GDK_BUTTON_PRESS && button->button == 3) { |
if (button->type == GDK_BUTTON_PRESS && button->button == 3) { |
3543 |
|
#if !USE_GTKMM_BUILDER |
3544 |
Gtk::Menu* script_popup = |
Gtk::Menu* script_popup = |
3545 |
dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/ScriptPopupMenu")); |
dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/ScriptPopupMenu")); |
3546 |
|
#endif |
3547 |
// update enabled/disabled state of sample popup items |
// update enabled/disabled state of sample popup items |
3548 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection(); |
3549 |
Gtk::TreeModel::iterator it = sel->get_selected(); |
Gtk::TreeModel::iterator it = sel->get_selected(); |
3554 |
group_selected = row[m_ScriptsModel.m_col_group]; |
group_selected = row[m_ScriptsModel.m_col_group]; |
3555 |
script_selected = row[m_ScriptsModel.m_col_script]; |
script_selected = row[m_ScriptsModel.m_col_script]; |
3556 |
} |
} |
3557 |
|
#if USE_GTKMM_BUILDER |
3558 |
|
m_actionAddScript->property_enabled() = (group_selected || script_selected); |
3559 |
|
m_actionAddScriptGroup->property_enabled() = (file); |
3560 |
|
m_actionEditScript->property_enabled() = (script_selected); |
3561 |
|
m_actionRemoveScript->property_enabled() = (group_selected || script_selected); |
3562 |
|
#else |
3563 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/AddScript"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/AddScript"))-> |
3564 |
set_sensitive(group_selected || script_selected); |
set_sensitive(group_selected || script_selected); |
3565 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/AddScriptGroup"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/AddScriptGroup"))-> |
3568 |
set_sensitive(script_selected); |
set_sensitive(script_selected); |
3569 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/RemoveScript"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/RemoveScript"))-> |
3570 |
set_sensitive(group_selected || script_selected); |
set_sensitive(group_selected || script_selected); |
3571 |
|
#endif |
3572 |
// show sample popup |
// show sample popup |
3573 |
script_popup->popup(button->button, button->time); |
script_popup->popup(button->button, button->time); |
3574 |
|
|
3575 |
|
#if !USE_GTKMM_BUILDER |
3576 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuScript/AddScript"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuScript/AddScript"))-> |
3577 |
set_sensitive(group_selected || script_selected); |
set_sensitive(group_selected || script_selected); |
3578 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuScript/AddScriptGroup"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuScript/AddScriptGroup"))-> |
3581 |
set_sensitive(script_selected); |
set_sensitive(script_selected); |
3582 |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuScript/RemoveScript"))-> |
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuScript/RemoveScript"))-> |
3583 |
set_sensitive(group_selected || script_selected); |
set_sensitive(group_selected || script_selected); |
3584 |
|
#endif |
3585 |
} |
} |
3586 |
|
#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 |
3587 |
|
return false; |
3588 |
|
#endif |
3589 |
} |
} |
3590 |
|
|
3591 |
void MainWindow::updateScriptListOfMenu() { |
void MainWindow::updateScriptListOfMenu() { |
3631 |
assign_scripts_menu->append(*item); |
assign_scripts_menu->append(*item); |
3632 |
} |
} |
3633 |
|
|
3634 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
3635 |
assign_scripts_menu->show_all_children(); |
assign_scripts_menu->show_all_children(); |
3636 |
|
#endif |
3637 |
} |
} |
3638 |
|
|
3639 |
|
#if !USE_GTKMM_BUILDER |
3640 |
Gtk::RadioMenuItem* MainWindow::add_instrument_to_menu( |
Gtk::RadioMenuItem* MainWindow::add_instrument_to_menu( |
3641 |
const Glib::ustring& name, int position) { |
const Glib::ustring& name, int position) { |
3642 |
|
|
3660 |
item)); |
item)); |
3661 |
return item; |
return item; |
3662 |
} |
} |
3663 |
|
#endif |
3664 |
|
|
3665 |
|
#if !USE_GTKMM_BUILDER |
3666 |
void MainWindow::remove_instrument_from_menu(int index) { |
void MainWindow::remove_instrument_from_menu(int index) { |
3667 |
const std::vector<Gtk::Widget*> children = |
const std::vector<Gtk::Widget*> children = |
3668 |
instrument_menu->get_children(); |
instrument_menu->get_children(); |
3670 |
instrument_menu->remove(*child); |
instrument_menu->remove(*child); |
3671 |
delete child; |
delete child; |
3672 |
} |
} |
3673 |
|
#endif |
3674 |
|
|
3675 |
void MainWindow::add_instrument(gig::Instrument* instrument) { |
void MainWindow::add_instrument(gig::Instrument* instrument) { |
3676 |
const Glib::ustring name(gig_to_utf8(instrument->pInfo->Name)); |
const Glib::ustring name(gig_to_utf8(instrument->pInfo->Name)); |
3685 |
rowInstr[m_Columns.m_col_scripts] = ""; |
rowInstr[m_Columns.m_col_scripts] = ""; |
3686 |
instrument_name_connection.unblock(); |
instrument_name_connection.unblock(); |
3687 |
|
|
3688 |
|
#if !USE_GTKMM_BUILDER |
3689 |
add_instrument_to_menu(name); |
add_instrument_to_menu(name); |
3690 |
|
#endif |
3691 |
select_instrument(instrument); |
select_instrument(instrument); |
3692 |
file_changed(); |
file_changed(); |
3693 |
} |
} |
3756 |
if (instr) file->DeleteInstrument(instr); |
if (instr) file->DeleteInstrument(instr); |
3757 |
file_changed(); |
file_changed(); |
3758 |
|
|
3759 |
|
#if !USE_GTKMM_BUILDER |
3760 |
remove_instrument_from_menu(index); |
remove_instrument_from_menu(index); |
3761 |
|
#endif |
3762 |
|
|
3763 |
// remove row from instruments tree view |
// remove row from instruments tree view |
3764 |
m_refTreeModel->erase(it); |
m_refTreeModel->erase(it); |
3973 |
|
|
3974 |
// show 'browse for file' dialog |
// show 'browse for file' dialog |
3975 |
Gtk::FileChooserDialog dialog(*this, replace ? _("Replace Sample with") : _("Add Sample(s)")); |
Gtk::FileChooserDialog dialog(*this, replace ? _("Replace Sample with") : _("Add Sample(s)")); |
3976 |
|
#if HAS_GTKMM_STOCK |
3977 |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
3978 |
dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); |
dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); |
3979 |
|
#else |
3980 |
|
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL); |
3981 |
|
dialog.add_button(_("_Open"), Gtk::RESPONSE_OK); |
3982 |
|
#endif |
3983 |
dialog.set_select_multiple(!replace); // allow multi audio file selection only when adding new samples, does not make sense when replacing a specific sample |
dialog.set_select_multiple(!replace); // allow multi audio file selection only when adding new samples, does not make sense when replacing a specific sample |
3984 |
|
|
3985 |
// matches all file types supported by libsndfile |
// matches all file types supported by libsndfile |
4028 |
for (std::vector<std::string>::iterator iter = filenames.begin(); |
for (std::vector<std::string>::iterator iter = filenames.begin(); |
4029 |
iter != filenames.end(); ++iter) { |
iter != filenames.end(); ++iter) { |
4030 |
printf("Adding sample %s\n",(*iter).c_str()); |
printf("Adding sample %s\n",(*iter).c_str()); |
4031 |
// use libsndfile to retrieve file informations |
// use libsndfile to retrieve file information |
4032 |
SF_INFO info; |
SF_INFO info; |
4033 |
info.format = 0; |
info.format = 0; |
4034 |
SNDFILE* hFile = sf_open((*iter).c_str(), SFM_READ, &info); |
SNDFILE* hFile = sf_open((*iter).c_str(), SFM_READ, &info); |
4169 |
Gtk::Label description(str); |
Gtk::Label description(str); |
4170 |
description.set_line_wrap(); |
description.set_line_wrap(); |
4171 |
#endif |
#endif |
4172 |
Gtk::HBox entryArea; |
HBox entryArea; |
4173 |
Gtk::Label entryLabel( _("Add filename extension: "), Gtk::ALIGN_START); |
Gtk::Label entryLabel( _("Add filename extension: "), Gtk::ALIGN_START); |
4174 |
Gtk::Entry postfixEntryBox; |
Gtk::Entry postfixEntryBox; |
4175 |
postfixEntryBox.set_text(".wav"); |
postfixEntryBox.set_text(".wav"); |
4176 |
entryArea.pack_start(entryLabel); |
entryArea.pack_start(entryLabel); |
4177 |
entryArea.pack_start(postfixEntryBox); |
entryArea.pack_start(postfixEntryBox); |
4178 |
|
#if USE_GTKMM_BOX |
4179 |
|
dialog.get_content_area()->pack_start(description, Gtk::PACK_SHRINK); |
4180 |
|
dialog.get_content_area()->pack_start(entryArea, Gtk::PACK_SHRINK); |
4181 |
|
#else |
4182 |
dialog.get_vbox()->pack_start(description, Gtk::PACK_SHRINK); |
dialog.get_vbox()->pack_start(description, Gtk::PACK_SHRINK); |
4183 |
dialog.get_vbox()->pack_start(entryArea, Gtk::PACK_SHRINK); |
dialog.get_vbox()->pack_start(entryArea, Gtk::PACK_SHRINK); |
4184 |
|
#endif |
4185 |
description.show(); |
description.show(); |
4186 |
|
|
4187 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
4188 |
entryArea.show_all(); |
entryArea.show_all(); |
4189 |
|
#else |
4190 |
|
entryArea.show(); |
4191 |
|
#endif |
4192 |
|
|
4193 |
|
#if HAS_GTKMM_STOCK |
4194 |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
4195 |
|
#else |
4196 |
|
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL); |
4197 |
|
#endif |
4198 |
dialog.add_button(_("Select"), Gtk::RESPONSE_OK); |
dialog.add_button(_("Select"), Gtk::RESPONSE_OK); |
4199 |
dialog.set_select_multiple(false); |
dialog.set_select_multiple(false); |
4200 |
if (current_sample_dir != "") { |
if (current_sample_dir != "") { |
4652 |
Gtk::TreeModel::Row row = *iter; |
Gtk::TreeModel::Row row = *iter; |
4653 |
Glib::ustring name = row[m_Columns.m_col_name]; |
Glib::ustring name = row[m_Columns.m_col_name]; |
4654 |
|
|
4655 |
|
#if !USE_GTKMM_BUILDER |
4656 |
// change name in instrument menu |
// change name in instrument menu |
4657 |
int index = path[0]; |
int index = path[0]; |
4658 |
const std::vector<Gtk::Widget*> children = instrument_menu->get_children(); |
const std::vector<Gtk::Widget*> children = instrument_menu->get_children(); |
4665 |
item->set_active(); |
item->set_active(); |
4666 |
#endif |
#endif |
4667 |
} |
} |
4668 |
|
#endif |
4669 |
|
|
4670 |
// change name in gig |
// change name in gig |
4671 |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
4690 |
trim(pattern); |
trim(pattern); |
4691 |
if (pattern.empty()) return true; |
if (pattern.empty()) return true; |
4692 |
|
|
4693 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22) |
4694 |
|
//HACK: on GTKMM4 development branch const_iterator cannot be easily converted to iterator, probably going to be fixed before final GTKMM4 release though. |
4695 |
|
Gtk::TreeModel::Row row = **(Gtk::TreeModel::iterator*)(&iter); |
4696 |
|
#else |
4697 |
Gtk::TreeModel::Row row = *iter; |
Gtk::TreeModel::Row row = *iter; |
4698 |
|
#endif |
4699 |
Glib::ustring name = row[m_Columns.m_col_name]; |
Glib::ustring name = row[m_Columns.m_col_name]; |
4700 |
name = name.lowercase(); |
name = name.lowercase(); |
4701 |
|
|
4727 |
} |
} |
4728 |
d->setSelectedInstruments(indeces); |
d->setSelectedInstruments(indeces); |
4729 |
|
|
4730 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
4731 |
d->show_all(); |
d->show_all(); |
4732 |
|
#else |
4733 |
|
d->show(); |
4734 |
|
#endif |
4735 |
d->run(); |
d->run(); |
4736 |
if (d->fileWasChanged()) { |
if (d->fileWasChanged()) { |
4737 |
// update GUI with new instrument just created |
// update GUI with new instrument just created |
4755 |
d->dimension_region_selected.connect( |
d->dimension_region_selected.connect( |
4756 |
sigc::mem_fun(*this, &MainWindow::select_dimension_region) |
sigc::mem_fun(*this, &MainWindow::select_dimension_region) |
4757 |
); |
); |
4758 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
4759 |
d->show_all(); |
d->show_all(); |
4760 |
|
#else |
4761 |
|
d->show(); |
4762 |
|
#endif |
4763 |
d->resize(500, 400); |
d->resize(500, 400); |
4764 |
d->run(); |
d->run(); |
4765 |
delete d; |
delete d; |
4843 |
Glib::filename_display_basename(this->filename) + "' ...", |
Glib::filename_display_basename(this->filename) + "' ...", |
4844 |
*this |
*this |
4845 |
); |
); |
4846 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
4847 |
progress_dialog->show_all(); |
progress_dialog->show_all(); |
4848 |
|
#else |
4849 |
|
progress_dialog->show(); |
4850 |
|
#endif |
4851 |
saver = new Saver(this->file); //FIXME: memory leak! |
saver = new Saver(this->file); //FIXME: memory leak! |
4852 |
saver->signal_progress().connect( |
saver->signal_progress().connect( |
4853 |
sigc::mem_fun(*this, &MainWindow::on_saver_progress)); |
sigc::mem_fun(*this, &MainWindow::on_saver_progress)); |
4874 |
} |
} |
4875 |
|
|
4876 |
Gtk::FileChooserDialog dialog(*this, _("Merge .gig files")); |
Gtk::FileChooserDialog dialog(*this, _("Merge .gig files")); |
4877 |
|
#if HAS_GTKMM_STOCK |
4878 |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
4879 |
|
#else |
4880 |
|
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL); |
4881 |
|
#endif |
4882 |
dialog.add_button(_("Merge"), Gtk::RESPONSE_OK); |
dialog.add_button(_("Merge"), Gtk::RESPONSE_OK); |
4883 |
dialog.set_default_response(Gtk::RESPONSE_CANCEL); |
dialog.set_default_response(Gtk::RESPONSE_CANCEL); |
4884 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
4895 |
dialog.set_select_multiple(true); |
dialog.set_select_multiple(true); |
4896 |
|
|
4897 |
// show warning in the file picker dialog |
// show warning in the file picker dialog |
4898 |
Gtk::HBox descriptionArea; |
HBox descriptionArea; |
4899 |
descriptionArea.set_spacing(15); |
descriptionArea.set_spacing(15); |
4900 |
Gtk::Image warningIcon; |
Gtk::Image warningIcon; |
4901 |
warningIcon.set_from_icon_name("dialog-warning", |
warningIcon.set_from_icon_name("dialog-warning", |
4918 |
"will accordingly be stored separately in the target .gig file!" |
"will accordingly be stored separately in the target .gig file!" |
4919 |
)); |
)); |
4920 |
descriptionArea.pack_start(description); |
descriptionArea.pack_start(description); |
4921 |
|
#if USE_GTKMM_BOX |
4922 |
|
# warning No description area implemented for dialog on GTKMM 3 |
4923 |
|
#else |
4924 |
dialog.get_vbox()->pack_start(descriptionArea, Gtk::PACK_SHRINK); |
dialog.get_vbox()->pack_start(descriptionArea, Gtk::PACK_SHRINK); |
4925 |
|
#endif |
4926 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
4927 |
descriptionArea.show_all(); |
descriptionArea.show_all(); |
4928 |
|
#else |
4929 |
|
descriptionArea.show(); |
4930 |
|
#endif |
4931 |
|
|
4932 |
if (dialog.run() == Gtk::RESPONSE_OK) { |
if (dialog.run() == Gtk::RESPONSE_OK) { |
4933 |
printf("on_action_merge_files self=%p\n", |
printf("on_action_merge_files self=%p\n", |
4963 |
} |
} |
4964 |
|
|
4965 |
{ |
{ |
4966 |
|
#if USE_GTKMM_BUILDER |
4967 |
|
m_actionToggleSyncSamplerSelection->property_enabled() = b; |
4968 |
|
#else |
4969 |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
4970 |
uiManager->get_widget("/MenuBar/MenuSettings/SyncSamplerInstrumentSelection")); |
uiManager->get_widget("/MenuBar/MenuSettings/SyncSamplerInstrumentSelection")); |
4971 |
if (item) item->set_sensitive(b); |
if (item) item->set_sensitive(b); |
4972 |
|
#endif |
4973 |
} |
} |
4974 |
} |
} |
4975 |
|
|
5126 |
|
|
5127 |
void MainWindow::updateClipboardCopyAvailable() { |
void MainWindow::updateClipboardCopyAvailable() { |
5128 |
bool bDimensionRegionCopyIsPossible = m_DimRegionChooser.get_main_dimregion(); |
bool bDimensionRegionCopyIsPossible = m_DimRegionChooser.get_main_dimregion(); |
5129 |
|
#if USE_GTKMM_BUILDER |
5130 |
|
m_actionCopyDimRgn->property_enabled() = bDimensionRegionCopyIsPossible; |
5131 |
|
#else |
5132 |
static_cast<Gtk::MenuItem*>( |
static_cast<Gtk::MenuItem*>( |
5133 |
uiManager->get_widget("/MenuBar/MenuEdit/CopyDimRgn") |
uiManager->get_widget("/MenuBar/MenuEdit/CopyDimRgn") |
5134 |
)->set_sensitive(bDimensionRegionCopyIsPossible); |
)->set_sensitive(bDimensionRegionCopyIsPossible); |
5135 |
|
#endif |
5136 |
} |
} |
5137 |
|
|
5138 |
|
#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 |
5139 |
|
void MainWindow::on_clipboard_owner_change(Gdk::EventOwnerChange& event) { |
5140 |
|
#else |
5141 |
void MainWindow::on_clipboard_owner_change(GdkEventOwnerChange* event) { |
void MainWindow::on_clipboard_owner_change(GdkEventOwnerChange* event) { |
5142 |
|
#endif |
5143 |
updateClipboardPasteAvailable(); |
updateClipboardPasteAvailable(); |
5144 |
} |
} |
5145 |
|
|
5206 |
std::find(targets.begin(), targets.end(), |
std::find(targets.begin(), targets.end(), |
5207 |
CLIPBOARD_DIMENSIONREGION_TARGET) != targets.end(); |
CLIPBOARD_DIMENSIONREGION_TARGET) != targets.end(); |
5208 |
|
|
5209 |
|
#if USE_GTKMM_BUILDER |
5210 |
|
m_actionPasteDimRgn->property_enabled() = bDimensionRegionPasteIsPossible; |
5211 |
|
m_actionAdjustClipboard->property_enabled() = bDimensionRegionPasteIsPossible; |
5212 |
|
#else |
5213 |
static_cast<Gtk::MenuItem*>( |
static_cast<Gtk::MenuItem*>( |
5214 |
uiManager->get_widget("/MenuBar/MenuEdit/PasteDimRgn") |
uiManager->get_widget("/MenuBar/MenuEdit/PasteDimRgn") |
5215 |
)->set_sensitive(bDimensionRegionPasteIsPossible); |
)->set_sensitive(bDimensionRegionPasteIsPossible); |
5217 |
static_cast<Gtk::MenuItem*>( |
static_cast<Gtk::MenuItem*>( |
5218 |
uiManager->get_widget("/MenuBar/MenuEdit/AdjustClipboard") |
uiManager->get_widget("/MenuBar/MenuEdit/AdjustClipboard") |
5219 |
)->set_sensitive(bDimensionRegionPasteIsPossible); |
)->set_sensitive(bDimensionRegionPasteIsPossible); |
5220 |
|
#endif |
5221 |
} |
} |
5222 |
|
|
5223 |
sigc::signal<void, gig::File*>& MainWindow::signal_file_structure_to_be_changed() { |
sigc::signal<void, gig::File*>& MainWindow::signal_file_structure_to_be_changed() { |