From 67e19c177f473807cd6510751bcf4a48574e6088 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 8 Aug 2015 08:36:29 -0400 Subject: radically change Keyboard/Binding API design to disconnect Gtk::Action lookup from binding definition We need this because we need binding information/objects before all Actions have been defined. --- gtk2_ardour/ardour_ui.cc | 28 ++- gtk2_ardour/ardour_ui.h | 3 +- gtk2_ardour/ardour_ui_dependents.cc | 10 +- gtk2_ardour/ardour_ui_dialogs.cc | 6 +- gtk2_ardour/ardour_ui_ed.cc | 286 ++++++++++++------------ gtk2_ardour/editor.cc | 4 +- gtk2_ardour/editor.h | 1 - gtk2_ardour/editor_actions.cc | 383 ++++++++++++++++---------------- gtk2_ardour/mixer_actor.cc | 43 ++-- gtk2_ardour/mixer_actor.h | 3 +- gtk2_ardour/monitor_section.cc | 31 ++- gtk2_ardour/processor_box.cc | 46 ++-- gtk2_ardour/processor_box.h | 2 - gtk2_ardour/public_editor.h | 2 +- gtk2_ardour/step_entry.cc | 10 +- gtk2_ardour/step_entry.h | 4 +- gtk2_ardour/window_manager.cc | 12 +- libs/gtkmm2ext/actions.cc | 204 ----------------- libs/gtkmm2ext/bindings.cc | 426 +++++++++++++++++------------------- libs/gtkmm2ext/gtk_ui.cc | 3 +- libs/gtkmm2ext/gtkmm2ext/actions.h | 18 +- libs/gtkmm2ext/gtkmm2ext/bindings.h | 77 +++++-- libs/gtkmm2ext/gtkmm2ext/keyboard.h | 10 +- libs/gtkmm2ext/keyboard.cc | 27 ++- libs/surfaces/mackie/gui.cc | 3 +- 25 files changed, 727 insertions(+), 915 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index fec3463dbb..fa9331d886 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -238,6 +238,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) , secondary_clock (new MainClock (X_("secondary"), X_("secondary"), false)) , big_clock (new AudioClock (X_("bigclock"), false, "big", true, true, false, false)) , video_timeline(0) + , global_bindings (0) , ignore_dual_punch (false) , editor (0) , mixer (0) @@ -584,17 +585,21 @@ ARDOUR_UI::post_engine () check_memory_locking(); - /* this is the first point at which all the keybindings are available */ + /* this is the first point at which all the possible actions are + * available, because some of the available actions are dependent on + * aspects of the engine/backend. + */ if (ARDOUR_COMMAND_LINE::show_key_actions) { - for (map::const_iterator mb = Bindings::bindings_for_state.begin(); mb != Bindings::bindings_for_state.end(); ++mb) { + for (list::const_iterator mb = Bindings::bindings.begin(); mb != Bindings::bindings.end(); ++mb) { vector names; vector paths; vector keys; - - mb->second->get_all_actions (names, paths, keys); + +#warning Paul fix this before tabbed is merged + // mb->second->get_all_actions (names, paths, keys); vector::iterator n; vector::iterator k; @@ -608,7 +613,9 @@ ARDOUR_UI::post_engine () AudioEngine::instance()->stop (); exit (0); } - + + Bindings::associate_all (); + /* this being a GUI and all, we want peakfiles */ AudioFileSource::set_build_peakfiles (true); @@ -5173,7 +5180,7 @@ ARDOUR_UI::key_event_handler (GdkEventKey* ev, Gtk::Window* event_window) if (w) { bindings = reinterpret_cast(w->get_data ("ardour-bindings")); } else { - bindings = &global_bindings; + bindings = global_bindings; } DEBUG_TRACE (DEBUG::Accelerators, string_compose ("main window key event, bindings = %1, global = %2\n", bindings, &global_bindings)); @@ -5289,7 +5296,7 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey DEBUG_TRACE (DEBUG::Accelerators, "\tnot yet handled, try global bindings\n"); - if (global_bindings.activate (k, Bindings::Press)) { + if (global_bindings->activate (k, Bindings::Press)) { DEBUG_TRACE (DEBUG::Accelerators, "\t\thandled\n"); return true; } @@ -5329,7 +5336,7 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey DEBUG_TRACE (DEBUG::Accelerators, "\tnot yet handled, try global bindings\n"); - if (global_bindings.activate (k, Bindings::Press)) { + if (global_bindings->activate (k, Bindings::Press)) { DEBUG_TRACE (DEBUG::Accelerators, "\t\thandled\n"); return true; } @@ -5342,7 +5349,8 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey void ARDOUR_UI::load_bindings () { - global_bindings.set_action_map (global_actions); - global_bindings.load (X_("global")); + if ((global_bindings = Bindings::get_bindings ("global")) == 0) { + error << _("Global keybindings are missing") << endmsg; + } } diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index b202a0dff5..9ccbf30c98 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -333,8 +333,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr bool tabbed_window_state_event_handler (GdkEventWindowState*, void* object); bool key_event_handler (GdkEventKey*, Gtk::Window* window); - Gtkmm2ext::ActionMap global_actions; - Gtkmm2ext::Bindings global_bindings; + Gtkmm2ext::Bindings* global_bindings; protected: friend class PublicEditor; diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index c413236e11..c4762c6b96 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -73,7 +73,6 @@ ARDOUR_UI::we_have_dependents () /* all actions are defined */ - ActionManager::enable_accelerators (); ActionManager::load_menus (ARDOUR_COMMAND_LINE::menus_file); editor->track_mixer_selection (); @@ -205,6 +204,13 @@ tab_window_root_drop (GtkNotebook* src, int ARDOUR_UI::setup_windows () { + /* actions do not need to be defined when we load keybindings. They + * will be lazily discovered. But bindings do need to exist when we + * create windows/tabs with their own binding sets. + */ + + keyboard->setup_keybindings (); + /* we don't use a widget with its own window for the tab close button, which makes it impossible to rely on GTK+ to generate signals for events occuring "in" this widget. Instead, we pre-connect a @@ -218,8 +224,6 @@ ARDOUR_UI::setup_windows () rc_option_editor = new RCOptionEditor; rc_option_editor->StateChange.connect (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_state_change)); - keyboard->setup_keybindings (); - if (create_editor ()) { error << _("UI: cannot setup editor") << endmsg; return -1; diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 5997c9045b..7bc36dbc1f 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -478,9 +478,9 @@ ARDOUR_UI::create_key_editor () { KeyEditor* kedit = new KeyEditor; - kedit->add_tab (_("Global"), global_bindings); - kedit->add_tab (_("Editing"), editor->bindings); - kedit->add_tab (_("Mixing"), mixer->bindings); + kedit->add_tab (_("Global"), *global_bindings); + kedit->add_tab (_("Editing"), *editor->bindings); + kedit->add_tab (_("Mixing"), *mixer->bindings); return kedit; } diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index dd53b2f0c4..e984bd261c 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -95,153 +95,153 @@ ARDOUR_UI::create_editor () void ARDOUR_UI::install_actions () { - Glib::RefPtr main_actions = global_actions.create_action_group (X_("Main")); - Glib::RefPtr main_menu_actions = global_actions.create_action_group (X_("Main_menu")); + Glib::RefPtr main_actions = Actions.create_action_group (X_("Main")); + Glib::RefPtr main_menu_actions = Actions.create_action_group (X_("Main_menu")); Glib::RefPtr act; /* menus + submenus that need action items */ - global_actions.register_action (main_menu_actions, X_("Session"), _("Session")); - act = global_actions.register_action (main_menu_actions, X_("Cleanup"), _("Clean-up")); + Actions.register_action (main_menu_actions, X_("Session"), _("Session")); + act = Actions.register_action (main_menu_actions, X_("Cleanup"), _("Clean-up")); ActionManager::write_sensitive_actions.push_back (act); - global_actions.register_action (main_menu_actions, X_("Sync"), _("Sync")); - global_actions.register_action (main_menu_actions, X_("TransportOptions"), _("Options")); - global_actions.register_action (main_menu_actions, X_("WindowMenu"), _("Window")); - global_actions.register_action (main_menu_actions, X_("MixerMenu"), _("Mixer")); - global_actions.register_action (main_menu_actions, X_("EditorMenu"), _("Editor")); - global_actions.register_action (main_menu_actions, X_("PrefsMenu"), _("Preferences")); - global_actions.register_action (main_menu_actions, X_("DetachMenu"), _("Detach")); - global_actions.register_action (main_menu_actions, X_("Help"), _("Help")); - global_actions.register_action (main_menu_actions, X_("KeyMouseActions"), _("Misc. Shortcuts")); - global_actions.register_action (main_menu_actions, X_("AudioFileFormat"), _("Audio File Format")); - global_actions.register_action (main_menu_actions, X_("AudioFileFormatHeader"), _("File Type")); - global_actions.register_action (main_menu_actions, X_("AudioFileFormatData"), _("Sample Format")); - global_actions.register_action (main_menu_actions, X_("ControlSurfaces"), _("Control Surfaces")); - global_actions.register_action (main_menu_actions, X_("Plugins"), _("Plugins")); - global_actions.register_action (main_menu_actions, X_("Metering"), _("Metering")); - global_actions.register_action (main_menu_actions, X_("MeteringFallOffRate"), _("Fall Off Rate")); - global_actions.register_action (main_menu_actions, X_("MeteringHoldTime"), _("Hold Time")); - global_actions.register_action (main_menu_actions, X_("Denormals"), _("Denormal Handling")); + Actions.register_action (main_menu_actions, X_("Sync"), _("Sync")); + Actions.register_action (main_menu_actions, X_("TransportOptions"), _("Options")); + Actions.register_action (main_menu_actions, X_("WindowMenu"), _("Window")); + Actions.register_action (main_menu_actions, X_("MixerMenu"), _("Mixer")); + Actions.register_action (main_menu_actions, X_("EditorMenu"), _("Editor")); + Actions.register_action (main_menu_actions, X_("PrefsMenu"), _("Preferences")); + Actions.register_action (main_menu_actions, X_("DetachMenu"), _("Detach")); + Actions.register_action (main_menu_actions, X_("Help"), _("Help")); + Actions.register_action (main_menu_actions, X_("KeyMouseActions"), _("Misc. Shortcuts")); + Actions.register_action (main_menu_actions, X_("AudioFileFormat"), _("Audio File Format")); + Actions.register_action (main_menu_actions, X_("AudioFileFormatHeader"), _("File Type")); + Actions.register_action (main_menu_actions, X_("AudioFileFormatData"), _("Sample Format")); + Actions.register_action (main_menu_actions, X_("ControlSurfaces"), _("Control Surfaces")); + Actions.register_action (main_menu_actions, X_("Plugins"), _("Plugins")); + Actions.register_action (main_menu_actions, X_("Metering"), _("Metering")); + Actions.register_action (main_menu_actions, X_("MeteringFallOffRate"), _("Fall Off Rate")); + Actions.register_action (main_menu_actions, X_("MeteringHoldTime"), _("Hold Time")); + Actions.register_action (main_menu_actions, X_("Denormals"), _("Denormal Handling")); /* the real actions */ - act = global_actions.register_action (main_actions, X_("New"), _("New..."), hide_return (sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::get_session_parameters), false, true, ""))); + act = Actions.register_action (main_actions, X_("New"), _("New..."), hide_return (sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::get_session_parameters), false, true, ""))); - global_actions.register_action (main_actions, X_("Open"), _("Open..."), sigc::mem_fun(*this, &ARDOUR_UI::open_session)); - global_actions.register_action (main_actions, X_("Recent"), _("Recent..."), sigc::mem_fun(*this, &ARDOUR_UI::open_recent_session)); - act = global_actions.register_action (main_actions, X_("Close"), _("Close"), sigc::mem_fun(*this, &ARDOUR_UI::close_session)); + Actions.register_action (main_actions, X_("Open"), _("Open..."), sigc::mem_fun(*this, &ARDOUR_UI::open_session)); + Actions.register_action (main_actions, X_("Recent"), _("Recent..."), sigc::mem_fun(*this, &ARDOUR_UI::open_recent_session)); + act = Actions.register_action (main_actions, X_("Close"), _("Close"), sigc::mem_fun(*this, &ARDOUR_UI::close_session)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("AddTrackBus"), _("Add Track or Bus..."), + act = Actions.register_action (main_actions, X_("AddTrackBus"), _("Add Track or Bus..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::add_route), (Gtk::Window*) 0)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); - act = ActionManager::register_action (main_actions, X_("duplicate-routes"), _("Duplicate Tracks/Busses..."), + act = Actions.register_action (main_actions, X_("duplicate-routes"), _("Duplicate Tracks/Busses..."), sigc::mem_fun(*this, &ARDOUR_UI::start_duplicate_routes)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); ActionManager::track_selection_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("cancel-solo"), _("Cancel Solo"), sigc::mem_fun(*this, &ARDOUR_UI::cancel_solo)); + act = Actions.register_action (main_actions, X_("cancel-solo"), _("Cancel Solo"), sigc::mem_fun(*this, &ARDOUR_UI::cancel_solo)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("OpenVideo"), _("Open Video"), - sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::add_video), (Gtk::Window*) 0)); + act = Actions.register_action (main_actions, X_("OpenVideo"), _("Open Video"), + sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::add_video), (Gtk::Window*) 0)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("CloseVideo"), _("Remove Video"), + act = Actions.register_action (main_actions, X_("CloseVideo"), _("Remove Video"), sigc::mem_fun (*this, &ARDOUR_UI::remove_video)); act->set_sensitive (false); - act = global_actions.register_action (main_actions, X_("ExportVideo"), _("Export to Video File"), + act = Actions.register_action (main_actions, X_("ExportVideo"), _("Export to Video File"), hide_return (sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::export_video), false))); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("SnapshotStay"), _("Snapshot (& keep working on current version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::snapshot_session), false)); + act = Actions.register_action (main_actions, X_("SnapshotStay"), _("Snapshot (& keep working on current version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::snapshot_session), false)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("SnapshotSwitch"), _("Snapshot (& switch to new version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::snapshot_session), true)); + act = Actions.register_action (main_actions, X_("SnapshotSwitch"), _("Snapshot (& switch to new version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::snapshot_session), true)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); - act = ActionManager::register_action (main_actions, X_("QuickSnapshotStay"), _("Quick Snapshot (& keep working on current version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::quick_snapshot_session), false)); + act = Actions::register_action (main_actions, X_("QuickSnapshotStay"), _("Quick Snapshot(& keep working on current version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::quick_snapshot_session), false)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); - act = global_actions::register_action (main_actions, X_("QuickSnapshotSwitch"), _("Quick Snapshot (& switch to new version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::quick_snapshot_session), true)); + act = Actions::register_action (main_actions, X_("QuickSnapshotSwitch"), _("Quick Snapshot (& switch to new version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::quick_snapshot_session), true)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("SaveAs"), _("Save As..."), sigc::mem_fun(*this, &ARDOUR_UI::save_session_as)); + act = Actions.register_action (main_actions, X_("SaveAs"), _("Save As..."), sigc::mem_fun(*this, &ARDOUR_UI::save_session_as)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("Rename"), _("Rename..."), sigc::mem_fun(*this, &ARDOUR_UI::rename_session)); + act = Actions.register_action (main_actions, X_("Rename"), _("Rename..."), sigc::mem_fun(*this, &ARDOUR_UI::rename_session)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("SaveTemplate"), _("Save Template..."), sigc::mem_fun(*this, &ARDOUR_UI::save_template)); + act = Actions.register_action (main_actions, X_("SaveTemplate"), _("Save Template..."), sigc::mem_fun(*this, &ARDOUR_UI::save_template)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("Metadata"), _("Metadata")); + act = Actions.register_action (main_actions, X_("Metadata"), _("Metadata")); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("EditMetadata"), _("Edit Metadata..."), sigc::mem_fun(*this, &ARDOUR_UI::edit_metadata)); + act = Actions.register_action (main_actions, X_("EditMetadata"), _("Edit Metadata..."), sigc::mem_fun(*this, &ARDOUR_UI::edit_metadata)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("ImportMetadata"), _("Import Metadata..."), sigc::mem_fun(*this, &ARDOUR_UI::import_metadata)); + act = Actions.register_action (main_actions, X_("ImportMetadata"), _("Import Metadata..."), sigc::mem_fun(*this, &ARDOUR_UI::import_metadata)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("ExportAudio"), _("Export to Audio File(s)..."), sigc::mem_fun (*editor, &PublicEditor::export_audio)); + act = Actions.register_action (main_actions, X_("ExportAudio"), _("Export to Audio File(s)..."), sigc::mem_fun (*editor, &PublicEditor::export_audio)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("StemExport"), _("Stem export..."), sigc::mem_fun (*editor, &PublicEditor::stem_export)); + act = Actions.register_action (main_actions, X_("StemExport"), _("Stem export..."), sigc::mem_fun (*editor, &PublicEditor::stem_export)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("Export"), _("Export")); + act = Actions.register_action (main_actions, X_("Export"), _("Export")); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("CleanupUnused"), _("Clean-up Unused Sources..."), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::cleanup)); + act = Actions.register_action (main_actions, X_("CleanupUnused"), _("Clean-up Unused Sources..."), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::cleanup)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("CleanupPeakFiles"), _("Reset Peak Files"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::cleanup_peakfiles)); + act = Actions.register_action (main_actions, X_("CleanupPeakFiles"), _("Reset Peak Files"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::cleanup_peakfiles)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("FlushWastebasket"), _("Flush Wastebasket"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::flush_trash)); + act = Actions.register_action (main_actions, X_("FlushWastebasket"), _("Flush Wastebasket"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::flush_trash)); ActionManager::write_sensitive_actions.push_back (act); ActionManager::session_sensitive_actions.push_back (act); /* these actions are intended to be shared across all windows */ - common_actions = global_actions.create_action_group (X_("Common")); - global_actions.register_action (common_actions, X_("Quit"), _("Quit"), (hide_return (sigc::mem_fun(*this, &ARDOUR_UI::finish)))); - global_actions.register_action (common_actions, X_("Hide"), _("Hide"), sigc::mem_fun (*this, &ARDOUR_UI::hide_application)); + common_actions = Actions.create_action_group (X_("Common")); + Actions.register_action (common_actions, X_("Quit"), _("Quit"), (hide_return (sigc::mem_fun(*this, &ARDOUR_UI::finish)))); + Actions.register_action (common_actions, X_("Hide"), _("Hide"), sigc::mem_fun (*this, &ARDOUR_UI::hide_application)); - global_actions.register_action (common_actions, X_("show-editor"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), editor)); - global_actions.register_action (common_actions, X_("show-mixer"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), mixer)); - global_actions.register_action (common_actions, X_("show-preferences"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor)); + Actions.register_action (common_actions, X_("show-editor"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), editor)); + Actions.register_action (common_actions, X_("show-mixer"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), mixer)); + Actions.register_action (common_actions, X_("show-preferences"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor)); - global_actions.register_action (common_actions, X_("hide-editor"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), editor)); - global_actions.register_action (common_actions, X_("hide-mixer"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), mixer)); - global_actions.register_action (common_actions, X_("hide-preferences"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), rc_option_editor)); + Actions.register_action (common_actions, X_("hide-editor"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), editor)); + Actions.register_action (common_actions, X_("hide-mixer"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), mixer)); + Actions.register_action (common_actions, X_("hide-preferences"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), rc_option_editor)); - global_actions.register_action (common_actions, X_("attach-editor"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), editor)); - global_actions.register_action (common_actions, X_("attach-mixer"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), mixer)); - global_actions.register_action (common_actions, X_("attach-preferences"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), rc_option_editor)); + Actions.register_action (common_actions, X_("attach-editor"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), editor)); + Actions.register_action (common_actions, X_("attach-mixer"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), mixer)); + Actions.register_action (common_actions, X_("attach-preferences"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), rc_option_editor)); - global_actions.register_action (common_actions, X_("detach-editor"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), editor)); - global_actions.register_action (common_actions, X_("detach-mixer"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), mixer)); - global_actions.register_action (common_actions, X_("detach-preferences"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), rc_option_editor)); + Actions.register_action (common_actions, X_("detach-editor"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), editor)); + Actions.register_action (common_actions, X_("detach-mixer"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), mixer)); + Actions.register_action (common_actions, X_("detach-preferences"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), rc_option_editor)); /* windows visibility actions */ - global_actions.register_toggle_action (common_actions, X_("ToggleMaximalEditor"), _("Maximise Editor Space"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_editing_space)); - global_actions.register_toggle_action (common_actions, X_("ToggleMaximalMixer"), _("Maximise Mixer Space"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_mixer_space)); + Actions.register_toggle_action (common_actions, X_("ToggleMaximalEditor"), _("Maximise Editor Space"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_editing_space)); + Actions.register_toggle_action (common_actions, X_("ToggleMaximalMixer"), _("Maximise Mixer Space"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_mixer_space)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_toggle_action (common_actions, X_("ToggleMixerList"), _("Toggle Mixer List"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_mixer_list)); @@ -251,11 +251,11 @@ ARDOUR_UI::install_actions () act->set_sensitive (false); if (Profile->get_mixbus()) - global_actions.register_action (common_actions, X_("show-ui-prefs"), _("Show more UI preferences"), sigc::mem_fun (*this, &ARDOUR_UI::show_ui_prefs)); + Actions.register_action (common_actions, X_("show-ui-prefs"), _("Show more UI preferences"), sigc::mem_fun (*this, &ARDOUR_UI::show_ui_prefs)); - global_actions.register_action (common_actions, X_("toggle-meterbridge"), S_("Window|Meterbridge"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_meterbridge)); + Actions.register_action (common_actions, X_("toggle-meterbridge"), S_("Window|Meterbridge"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_meterbridge)); - act = global_actions.register_action (common_actions, X_("NewMIDITracer"), _("MIDI Tracer"), sigc::mem_fun(*this, &ARDOUR_UI::new_midi_tracer_window)); + act = Actions.register_action (common_actions, X_("NewMIDITracer"), _("MIDI Tracer"), sigc::mem_fun(*this, &ARDOUR_UI::new_midi_tracer_window)); ActionManager::session_sensitive_actions.push_back (act); global_actions.register_action (common_actions, X_("chat"), _("Chat"), sigc::mem_fun(*this, &ARDOUR_UI::launch_chat)); @@ -269,37 +269,37 @@ if (Profile->get_mixbus()) global_actions.register_action (common_actions, X_("forums"), _("User Forums"), mem_fun(*this, &ARDOUR_UI::launch_forums)); global_actions.register_action (common_actions, X_("howto-report"), _("How to Report a Bug"), mem_fun(*this, &ARDOUR_UI::launch_howto_report)); - act = global_actions.register_action (common_actions, X_("Save"), _("Save"), sigc::hide_return (sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::save_state), string(""), false))); + act = Actions.register_action (common_actions, X_("Save"), _("Save"), sigc::hide_return (sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::save_state), string(""), false))); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); - Glib::RefPtr transport_actions = global_actions.create_action_group (X_("Transport")); + Glib::RefPtr transport_actions = Actions.create_action_group (X_("Transport")); /* do-nothing action for the "transport" menu bar item */ - global_actions.register_action (transport_actions, X_("Transport"), _("Transport")); + Actions.register_action (transport_actions, X_("Transport"), _("Transport")); /* these two are not used by key bindings, instead use ToggleRoll for that. these two do show up in menus and via button proxies. */ - act = global_actions.register_action (transport_actions, X_("Stop"), _("Stop"), sigc::mem_fun(*this, &ARDOUR_UI::transport_stop)); + act = Actions.register_action (transport_actions, X_("Stop"), _("Stop"), sigc::mem_fun(*this, &ARDOUR_UI::transport_stop)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("Roll"), _("Roll"), sigc::mem_fun(*this, &ARDOUR_UI::transport_roll)); + act = Actions.register_action (transport_actions, X_("Roll"), _("Roll"), sigc::mem_fun(*this, &ARDOUR_UI::transport_roll)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("ToggleRoll"), _("Start/Stop"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_roll), false, false)); + act = Actions.register_action (transport_actions, X_("ToggleRoll"), _("Start/Stop"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_roll), false, false)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("alternate-ToggleRoll"), _("Start/Stop"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_roll), false, false)); + act = Actions.register_action (transport_actions, X_("alternate-ToggleRoll"), _("Start/Stop"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_roll), false, false)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("ToggleRollMaybe"), _("Start/Continue/Stop"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_roll), false, true)); + act = Actions.register_action (transport_actions, X_("ToggleRollMaybe"), _("Start/Continue/Stop"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_roll), false, true)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("ToggleRollForgetCapture"), _("Stop and Forget Capture"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::toggle_roll), true, false)); + act = Actions.register_action (transport_actions, X_("ToggleRollForgetCapture"), _("Stop and Forget Capture"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::toggle_roll), true, false)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); @@ -309,202 +309,194 @@ if (Profile->get_mixbus()) - otherwise do nothing */ - act = global_actions.register_action (transport_actions, X_("TransitionToRoll"), _("Transition to Roll"), sigc::bind (sigc::mem_fun (*editor, &PublicEditor::transition_to_rolling), true)); + act = Actions.register_action (transport_actions, X_("TransitionToRoll"), _("Transition to Roll"), sigc::bind (sigc::mem_fun (*editor, &PublicEditor::transition_to_rolling), true)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("TransitionToReverse"), _("Transition to Reverse"), sigc::bind (sigc::mem_fun (*editor, &PublicEditor::transition_to_rolling), false)); + act = Actions.register_action (transport_actions, X_("TransitionToReverse"), _("Transition to Reverse"), sigc::bind (sigc::mem_fun (*editor, &PublicEditor::transition_to_rolling), false)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("Loop"), _("Play Loop Range"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_session_auto_loop)); + act = Actions.register_action (transport_actions, X_("Loop"), _("Play Loop Range"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_session_auto_loop)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("PlaySelection"), _("Play Selection"), sigc::mem_fun(*this, &ARDOUR_UI::transport_play_selection)); + act = Actions.register_action (transport_actions, X_("PlaySelection"), _("Play Selection"), sigc::mem_fun(*this, &ARDOUR_UI::transport_play_selection)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("PlayPreroll"), _("Play Selection w/Preroll"), sigc::mem_fun(*this, &ARDOUR_UI::transport_play_preroll)); + act = Actions.register_action (transport_actions, X_("PlayPreroll"), _("Play Selection w/Preroll"), sigc::mem_fun(*this, &ARDOUR_UI::transport_play_preroll)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("Record"), _("Enable Record"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_record), false)); + act = Actions.register_action (transport_actions, X_("Record"), _("Enable Record"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_record), false)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("record-roll"), _("Start Recording"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_record), true)); + act = Actions.register_action (transport_actions, X_("record-roll"), _("Start Recording"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_record), true)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("alternate-record-roll"), _("Start Recording"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_record), true)); + act = Actions.register_action (transport_actions, X_("alternate-record-roll"), _("Start Recording"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_record), true)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("Rewind"), _("Rewind"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_rewind), 0)); + act = Actions.register_action (transport_actions, X_("Rewind"), _("Rewind"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_rewind), 0)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("RewindSlow"), _("Rewind (Slow)"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_rewind), -1)); + act = Actions.register_action (transport_actions, X_("RewindSlow"), _("Rewind (Slow)"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_rewind), -1)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("RewindFast"), _("Rewind (Fast)"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_rewind), 1)); + act = Actions.register_action (transport_actions, X_("RewindFast"), _("Rewind (Fast)"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_rewind), 1)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("Forward"), _("Forward"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_forward), 0)); + act = Actions.register_action (transport_actions, X_("Forward"), _("Forward"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_forward), 0)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("ForwardSlow"), _("Forward (Slow)"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_forward), -1)); + act = Actions.register_action (transport_actions, X_("ForwardSlow"), _("Forward (Slow)"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_forward), -1)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("ForwardFast"), _("Forward (Fast)"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_forward), 1)); + act = Actions.register_action (transport_actions, X_("ForwardFast"), _("Forward (Fast)"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_forward), 1)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("GotoZero"), _("Go to Zero"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_zero)); + act = Actions.register_action (transport_actions, X_("GotoZero"), _("Go to Zero"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_zero)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("GotoStart"), _("Go to Start"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_start)); + act = Actions.register_action (transport_actions, X_("GotoStart"), _("Go to Start"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_start)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("alternate-GotoStart"), _("Go to Start"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_start)); + act = Actions.register_action (transport_actions, X_("alternate-GotoStart"), _("Go to Start"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_start)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("GotoEnd"), _("Go to End"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_end)); + act = Actions.register_action (transport_actions, X_("GotoEnd"), _("Go to End"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_end)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("GotoWallClock"), _("Go to Wall Clock"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_wallclock)); + act = Actions.register_action (transport_actions, X_("GotoWallClock"), _("Go to Wall Clock"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_wallclock)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); //these actions handle the numpad events, ProTools style - act = global_actions.register_action (transport_actions, X_("numpad-decimal"), _("Numpad Decimal"), mem_fun(*this, &ARDOUR_UI::transport_numpad_decimal)); + act = Actions.register_action (transport_actions, X_("numpad-decimal"), _("Numpad Decimal"), mem_fun(*this, &ARDOUR_UI::transport_numpad_decimal)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("alternate-numpad-decimal"), _("Numpad Decimal"), mem_fun(*this, &ARDOUR_UI::transport_numpad_decimal)); + act = Actions.register_action (transport_actions, X_("alternate-numpad-decimal"), _("Numpad Decimal"), mem_fun(*this, &ARDOUR_UI::transport_numpad_decimal)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("numpad-0"), _("Numpad 0"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 0)); + act = Actions.register_action (transport_actions, X_("numpad-0"), _("Numpad 0"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 0)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("numpad-1"), _("Numpad 1"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 1)); + act = Actions.register_action (transport_actions, X_("numpad-1"), _("Numpad 1"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 1)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("numpad-2"), _("Numpad 2"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 2)); + act = Actions.register_action (transport_actions, X_("numpad-2"), _("Numpad 2"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 2)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("numpad-3"), _("Numpad 3"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 3)); + act = Actions.register_action (transport_actions, X_("numpad-3"), _("Numpad 3"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 3)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("numpad-4"), _("Numpad 4"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 4)); + act = Actions.register_action (transport_actions, X_("numpad-4"), _("Numpad 4"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 4)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("numpad-5"), _("Numpad 5"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 5)); + act = Actions.register_action (transport_actions, X_("numpad-5"), _("Numpad 5"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 5)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("numpad-6"), _("Numpad 6"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 6)); + act = Actions.register_action (transport_actions, X_("numpad-6"), _("Numpad 6"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 6)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("numpad-7"), _("Numpad 7"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 7)); + act = Actions.register_action (transport_actions, X_("numpad-7"), _("Numpad 7"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 7)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("numpad-8"), _("Numpad 8"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 8)); + act = Actions.register_action (transport_actions, X_("numpad-8"), _("Numpad 8"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 8)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("numpad-9"), _("Numpad 9"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 9)); + act = Actions.register_action (transport_actions, X_("numpad-9"), _("Numpad 9"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 9)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("focus-on-clock"), _("Focus On Clock"), sigc::mem_fun(*this, &ARDOUR_UI::focus_on_clock)); + act = Actions.register_action (transport_actions, X_("focus-on-clock"), _("Focus On Clock"), sigc::mem_fun(*this, &ARDOUR_UI::focus_on_clock)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("primary-clock-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Timecode)); + act = Actions.register_action (transport_actions, X_("primary-clock-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Timecode)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("primary-clock-bbt"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::BBT)); + act = Actions.register_action (transport_actions, X_("primary-clock-bbt"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::BBT)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("primary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::MinSec)); + act = Actions.register_action (transport_actions, X_("primary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::MinSec)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("primary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Frames)); + act = Actions.register_action (transport_actions, X_("primary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Frames)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("secondary-clock-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Timecode)); + act = Actions.register_action (transport_actions, X_("secondary-clock-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Timecode)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("secondary-clock-bbt"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::BBT)); + act = Actions.register_action (transport_actions, X_("secondary-clock-bbt"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::BBT)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("secondary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::MinSec)); + act = Actions.register_action (transport_actions, X_("secondary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::MinSec)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("secondary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Frames)); + act = Actions.register_action (transport_actions, X_("secondary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Frames)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (transport_actions, X_("TogglePunchIn"), _("Punch In"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_punch_in)); + act = Actions.register_toggle_action (transport_actions, X_("TogglePunchIn"), _("Punch In"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_punch_in)); act->set_short_label (_("In")); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (transport_actions, X_("TogglePunchOut"), _("Punch Out"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_punch_out)); + act = Actions.register_toggle_action (transport_actions, X_("TogglePunchOut"), _("Punch Out"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_punch_out)); act->set_short_label (_("Out")); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (transport_actions, X_("TogglePunch"), _("Punch In/Out"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_punch)); + act = Actions.register_toggle_action (transport_actions, X_("TogglePunch"), _("Punch In/Out"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_punch)); act->set_short_label (_("In/Out")); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (transport_actions, X_("ToggleClick"), _("Click"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_click)); + act = Actions.register_toggle_action (transport_actions, X_("ToggleClick"), _("Click"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_click)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (transport_actions, X_("ToggleAutoInput"), _("Auto Input"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_auto_input)); + act = Actions.register_toggle_action (transport_actions, X_("ToggleAutoInput"), _("Auto Input"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_auto_input)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (transport_actions, X_("ToggleAutoPlay"), _("Auto Play"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_auto_play)); + act = Actions.register_toggle_action (transport_actions, X_("ToggleAutoPlay"), _("Auto Play"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_auto_play)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (transport_actions, X_("ToggleAutoReturn"), _("Auto Return"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_auto_return)); + act = Actions.register_toggle_action (transport_actions, X_("ToggleAutoReturn"), _("Auto Return"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_auto_return)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (transport_actions, X_("ToggleFollowEdits"), _("Follow Edits"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_follow_edits)); + act = Actions.register_toggle_action (transport_actions, X_("ToggleFollowEdits"), _("Follow Edits"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_follow_edits)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (transport_actions, X_("ToggleVideoSync"), _("Sync Startup to Video"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_video_sync)); + act = Actions.register_toggle_action (transport_actions, X_("ToggleVideoSync"), _("Sync Startup to Video"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_video_sync)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (transport_actions, X_("ToggleTimeMaster"), _("Time Master"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_time_master)); + act = Actions.register_toggle_action (transport_actions, X_("ToggleTimeMaster"), _("Time Master"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_time_master)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (transport_actions, X_("ToggleExternalSync"), _("Use External Positional Sync Source"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_external_sync)); + act = Actions.register_toggle_action (transport_actions, X_("ToggleExternalSync"), _("Use External Positional Sync Source"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_external_sync)); ActionManager::session_sensitive_actions.push_back (act); for (int i = 1; i <= 32; ++i) { string const a = string_compose (X_("ToggleRecordEnableTrack%1"), i); string const n = string_compose (_("Toggle Record Enable Track %1"), i); - act = global_actions.register_action (common_actions, a.c_str(), n.c_str(), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_record_enable), i - 1)); + act = Actions.register_action (common_actions, a.c_str(), n.c_str(), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_record_enable), i - 1)); ActionManager::session_sensitive_actions.push_back (act); } - Glib::RefPtr shuttle_actions = global_actions.create_action_group ("ShuttleActions"); + Glib::RefPtr shuttle_actions = Actions.create_action_group ("ShuttleActions"); shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), hide_return (sigc::bind (sigc::mem_fun (*Config, &RCConfiguration::set_shuttle_units), Percentage))); shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), hide_return (sigc::bind (sigc::mem_fun (*Config, &RCConfiguration::set_shuttle_units), Semitones))); - Glib::RefPtr option_actions = global_actions.create_action_group ("options"); + Glib::RefPtr option_actions = Actions.create_action_group ("options"); - act = global_actions.register_toggle_action (option_actions, X_("SendMTC"), _("Send MTC"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_send_mtc)); + act = Actions.register_toggle_action (option_actions, X_("SendMTC"), _("Send MTC"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_send_mtc)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (option_actions, X_("SendMMC"), _("Send MMC"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_send_mmc)); + act = Actions.register_toggle_action (option_actions, X_("SendMMC"), _("Send MMC"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_send_mmc)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (option_actions, X_("UseMMC"), _("Use MMC"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_use_mmc)); + act = Actions.register_toggle_action (option_actions, X_("UseMMC"), _("Use MMC"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_use_mmc)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (option_actions, X_("SendMidiClock"), _("Send MIDI Clock"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_send_midi_clock)); + act = Actions.register_toggle_action (option_actions, X_("SendMidiClock"), _("Send MIDI Clock"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_send_midi_clock)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_toggle_action (option_actions, X_("SendMIDIfeedback"), _("Send MIDI Feedback"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_send_midi_feedback)); + act = Actions.register_toggle_action (option_actions, X_("SendMIDIfeedback"), _("Send MIDI Feedback"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_send_midi_feedback)); ActionManager::session_sensitive_actions.push_back (act); /* MIDI */ - Glib::RefPtr midi_actions = global_actions.create_action_group (X_("MIDI")); - global_actions.register_action (midi_actions, X_("panic"), _("Panic"), sigc::mem_fun(*this, &ARDOUR_UI::midi_panic)); - - global_actions.install_action_group (shuttle_actions); - global_actions.install_action_group (option_actions); - global_actions.install_action_group (transport_actions); - global_actions.install_action_group (main_actions); - global_actions.install_action_group (main_menu_actions); - global_actions.install_action_group (common_actions); - global_actions.install_action_group (midi_actions); + Glib::RefPtr midi_actions = Actions.create_action_group (X_("MIDI")); + Actions.register_action (midi_actions, X_("panic"), _("Panic"), sigc::mem_fun(*this, &ARDOUR_UI::midi_panic)); } void diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 44cde59794..7cdd7d5b1f 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -816,12 +816,12 @@ Editor::Editor () /* Button bindings */ - button_bindings = new Bindings; + button_bindings = new Bindings ("editor-mouse"); XMLNode* node = button_settings(); if (node) { for (XMLNodeList::const_iterator i = node->children().begin(); i != node->children().end(); ++i) { - button_bindings->load (**i); + button_bindings->load_operation (**i); } } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 8c86203a68..8b50090853 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -550,7 +550,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void color_handler (); bool constructed; - Gtkmm2ext::ActionMap myactions; // to keep track of the playhead position for control_scroll boost::optional _control_scroll_target; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 3677aa8edc..9e4d700792 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -55,12 +55,15 @@ using namespace ARDOUR_UI_UTILS; using namespace PBD; using namespace Editing; +using Gtkmm2ext::Actions; +using Gtkmm2ext::Bindings; + /* Convenience functions to slightly reduce verbosity below */ RefPtr Editor::reg_sens (RefPtr group, char const * name, char const * label, sigc::slot slot) { - RefPtr act = myactions.register_action (group, name, label, slot); + RefPtr act = Actions.register_action (group, name, label, slot); ActionManager::session_sensitive_actions.push_back (act); return act; } @@ -68,14 +71,14 @@ Editor::reg_sens (RefPtr group, char const * name, char const * lab void Editor::toggle_reg_sens (RefPtr group, char const * name, char const * label, sigc::slot slot) { - RefPtr act = myactions.register_toggle_action (group, name, label, slot); + RefPtr act = Actions.register_toggle_action (group, name, label, slot); ActionManager::session_sensitive_actions.push_back (act); } void Editor::radio_reg_sens (RefPtr action_group, RadioAction::Group& radio_group, char const * name, char const * label, sigc::slot slot) { - RefPtr act = myactions.register_radio_action (action_group, radio_group, name, label, slot); + RefPtr act = Actions.register_radio_action (action_group, radio_group, name, label, slot); ActionManager::session_sensitive_actions.push_back (act); } @@ -84,78 +87,78 @@ Editor::register_actions () { RefPtr act; - editor_actions = myactions.create_action_group (X_("Editor")); - editor_menu_actions = myactions.create_action_group (X_("EditorMenu")); + editor_actions = Actions.create_action_group (X_("Editor")); + editor_menu_actions = Actions.create_action_group (X_("EditorMenu")); /* non-operative menu items for menu bar */ - myactions.register_action (editor_menu_actions, X_("AlignMenu"), _("Align")); - myactions.register_action (editor_menu_actions, X_("Autoconnect"), _("Autoconnect")); - myactions.register_action (editor_menu_actions, X_("Crossfades"), _("Crossfades")); - myactions.register_action (editor_menu_actions, X_("Edit"), _("Edit")); - myactions.register_action (editor_menu_actions, X_("EditCursorMovementOptions"), _("Move Selected Marker")); - myactions.register_action (editor_menu_actions, X_("EditSelectRangeOptions"), _("Select Range Operations")); - myactions.register_action (editor_menu_actions, X_("EditSelectRegionOptions"), _("Select Regions")); - myactions.register_action (editor_menu_actions, X_("EditPointMenu"), _("Edit Point")); - myactions.register_action (editor_menu_actions, X_("FadeMenu"), _("Fade")); - myactions.register_action (editor_menu_actions, X_("LatchMenu"), _("Latch")); - myactions.register_action (editor_menu_actions, X_("RegionMenu"), _("Region")); - myactions.register_action (editor_menu_actions, X_("RegionMenuLayering"), _("Layering")); - myactions.register_action (editor_menu_actions, X_("RegionMenuPosition"), _("Position")); - myactions.register_action (editor_menu_actions, X_("RegionMenuEdit"), _("Edit")); - myactions.register_action (editor_menu_actions, X_("RegionMenuTrim"), _("Trim")); - myactions.register_action (editor_menu_actions, X_("RegionMenuGain"), _("Gain")); - myactions.register_action (editor_menu_actions, X_("RegionMenuRanges"), _("Ranges")); - myactions.register_action (editor_menu_actions, X_("RegionMenuFades"), _("Fades")); - myactions.register_action (editor_menu_actions, X_("RegionMenuMIDI"), _("MIDI")); - myactions.register_action (editor_menu_actions, X_("RegionMenuDuplicate"), _("Duplicate")); - myactions.register_action (editor_menu_actions, X_("Link"), _("Link")); - myactions.register_action (editor_menu_actions, X_("ZoomFocusMenu"), _("Zoom Focus")); - myactions.register_action (editor_menu_actions, X_("LocateToMarker"), _("Locate to Markers")); - myactions.register_action (editor_menu_actions, X_("MarkerMenu"), _("Markers")); - myactions.register_action (editor_menu_actions, X_("MeterFalloff"), _("Meter falloff")); - myactions.register_action (editor_menu_actions, X_("MeterHold"), _("Meter hold")); - myactions.register_action (editor_menu_actions, X_("MIDI"), _("MIDI Options")); - myactions.register_action (editor_menu_actions, X_("MiscOptions"), _("Misc Options")); - myactions.register_action (editor_menu_actions, X_("Monitoring"), _("Monitoring")); - myactions.register_action (editor_menu_actions, X_("MoveActiveMarkMenu"), _("Active Mark")); - myactions.register_action (editor_menu_actions, X_("MovePlayHeadMenu"), _("Playhead")); - myactions.register_action (editor_menu_actions, X_("PlayMenu"), _("Play")); - myactions.register_action (editor_menu_actions, X_("PrimaryClockMenu"), _("Primary Clock")); - myactions.register_action (editor_menu_actions, X_("Pullup"), _("Pullup / Pulldown")); - myactions.register_action (editor_menu_actions, X_("RegionEditOps"), _("Region operations")); - myactions.register_action (editor_menu_actions, X_("RegionGainMenu"), _("Gain")); - myactions.register_action (editor_menu_actions, X_("RulerMenu"), _("Rulers")); - myactions.register_action (editor_menu_actions, X_("SavedViewMenu"), _("Views")); - myactions.register_action (editor_menu_actions, X_("ScrollMenu"), _("Scroll")); - myactions.register_action (editor_menu_actions, X_("SecondaryClockMenu"), _("Secondary Clock")); - myactions.register_action (editor_menu_actions, X_("Select"), _("Select")); - myactions.register_action (editor_menu_actions, X_("SelectMenu"), _("Select")); - myactions.register_action (editor_menu_actions, X_("SeparateMenu"), _("Separate")); - myactions.register_action (editor_menu_actions, X_("SetLoopMenu"), _("Loop")); - myactions.register_action (editor_menu_actions, X_("SetPunchMenu"), _("Punch")); - myactions.register_action (editor_menu_actions, X_("Solo"), _("Solo")); - myactions.register_action (editor_menu_actions, X_("Subframes"), _("Subframes")); - myactions.register_action (editor_menu_actions, X_("SyncMenu"), _("Sync")); - myactions.register_action (editor_menu_actions, X_("TempoMenu"), _("Tempo")); - myactions.register_action (editor_menu_actions, X_("Timecode"), _("Timecode fps")); - myactions.register_action (editor_menu_actions, X_("TrackHeightMenu"), _("Height")); - myactions.register_action (editor_menu_actions, X_("TrackMenu"), _("Track")); - myactions.register_action (editor_menu_actions, X_("Tools"), _("Tools")); - myactions.register_action (editor_menu_actions, X_("View"), _("View")); - myactions.register_action (editor_menu_actions, X_("ZoomFocus"), _("Zoom Focus")); - myactions.register_action (editor_menu_actions, X_("ZoomMenu"), _("Zoom")); + Actions.register_action (editor_menu_actions, X_("AlignMenu"), _("Align")); + Actions.register_action (editor_menu_actions, X_("Autoconnect"), _("Autoconnect")); + Actions.register_action (editor_menu_actions, X_("Crossfades"), _("Crossfades")); + Actions.register_action (editor_menu_actions, X_("Edit"), _("Edit")); + Actions.register_action (editor_menu_actions, X_("EditCursorMovementOptions"), _("Move Selected Marker")); + Actions.register_action (editor_menu_actions, X_("EditSelectRangeOptions"), _("Select Range Operations")); + Actions.register_action (editor_menu_actions, X_("EditSelectRegionOptions"), _("Select Regions")); + Actions.register_action (editor_menu_actions, X_("EditPointMenu"), _("Edit Point")); + Actions.register_action (editor_menu_actions, X_("FadeMenu"), _("Fade")); + Actions.register_action (editor_menu_actions, X_("LatchMenu"), _("Latch")); + Actions.register_action (editor_menu_actions, X_("RegionMenu"), _("Region")); + Actions.register_action (editor_menu_actions, X_("RegionMenuLayering"), _("Layering")); + Actions.register_action (editor_menu_actions, X_("RegionMenuPosition"), _("Position")); + Actions.register_action (editor_menu_actions, X_("RegionMenuEdit"), _("Edit")); + Actions.register_action (editor_menu_actions, X_("RegionMenuTrim"), _("Trim")); + Actions.register_action (editor_menu_actions, X_("RegionMenuGain"), _("Gain")); + Actions.register_action (editor_menu_actions, X_("RegionMenuRanges"), _("Ranges")); + Actions.register_action (editor_menu_actions, X_("RegionMenuFades"), _("Fades")); + Actions.register_action (editor_menu_actions, X_("RegionMenuMIDI"), _("MIDI")); + Actions.register_action (editor_menu_actions, X_("RegionMenuDuplicate"), _("Duplicate")); + Actions.register_action (editor_menu_actions, X_("Link"), _("Link")); + Actions.register_action (editor_menu_actions, X_("ZoomFocusMenu"), _("Zoom Focus")); + Actions.register_action (editor_menu_actions, X_("LocateToMarker"), _("Locate to Markers")); + Actions.register_action (editor_menu_actions, X_("MarkerMenu"), _("Markers")); + Actions.register_action (editor_menu_actions, X_("MeterFalloff"), _("Meter falloff")); + Actions.register_action (editor_menu_actions, X_("MeterHold"), _("Meter hold")); + Actions.register_action (editor_menu_actions, X_("MIDI"), _("MIDI Options")); + Actions.register_action (editor_menu_actions, X_("MiscOptions"), _("Misc Options")); + Actions.register_action (editor_menu_actions, X_("Monitoring"), _("Monitoring")); + Actions.register_action (editor_menu_actions, X_("MoveActiveMarkMenu"), _("Active Mark")); + Actions.register_action (editor_menu_actions, X_("MovePlayHeadMenu"), _("Playhead")); + Actions.register_action (editor_menu_actions, X_("PlayMenu"), _("Play")); + Actions.register_action (editor_menu_actions, X_("PrimaryClockMenu"), _("Primary Clock")); + Actions.register_action (editor_menu_actions, X_("Pullup"), _("Pullup / Pulldown")); + Actions.register_action (editor_menu_actions, X_("RegionEditOps"), _("Region operations")); + Actions.register_action (editor_menu_actions, X_("RegionGainMenu"), _("Gain")); + Actions.register_action (editor_menu_actions, X_("RulerMenu"), _("Rulers")); + Actions.register_action (editor_menu_actions, X_("SavedViewMenu"), _("Views")); + Actions.register_action (editor_menu_actions, X_("ScrollMenu"), _("Scroll")); + Actions.register_action (editor_menu_actions, X_("SecondaryClockMenu"), _("Secondary Clock")); + Actions.register_action (editor_menu_actions, X_("Select"), _("Select")); + Actions.register_action (editor_menu_actions, X_("SelectMenu"), _("Select")); + Actions.register_action (editor_menu_actions, X_("SeparateMenu"), _("Separate")); + Actions.register_action (editor_menu_actions, X_("SetLoopMenu"), _("Loop")); + Actions.register_action (editor_menu_actions, X_("SetPunchMenu"), _("Punch")); + Actions.register_action (editor_menu_actions, X_("Solo"), _("Solo")); + Actions.register_action (editor_menu_actions, X_("Subframes"), _("Subframes")); + Actions.register_action (editor_menu_actions, X_("SyncMenu"), _("Sync")); + Actions.register_action (editor_menu_actions, X_("TempoMenu"), _("Tempo")); + Actions.register_action (editor_menu_actions, X_("Timecode"), _("Timecode fps")); + Actions.register_action (editor_menu_actions, X_("TrackHeightMenu"), _("Height")); + Actions.register_action (editor_menu_actions, X_("TrackMenu"), _("Track")); + Actions.register_action (editor_menu_actions, X_("Tools"), _("Tools")); + Actions.register_action (editor_menu_actions, X_("View"), _("View")); + Actions.register_action (editor_menu_actions, X_("ZoomFocus"), _("Zoom Focus")); + Actions.register_action (editor_menu_actions, X_("ZoomMenu"), _("Zoom")); register_region_actions (); /* add named actions for the editor */ - myactions.register_action (editor_actions, "escape", _("Break drag or deselect all"), sigc::mem_fun (*this, &Editor::escape)); + Actions.register_action (editor_actions, "escape", _("Break drag or deselect all"), sigc::mem_fun (*this, &Editor::escape)); /* We don't bother registering "unlock" because it would be insensitive when required. Editor::unlock() must be invoked directly. */ - myactions.register_action (editor_actions, "lock", S_("Session|Lock"), sigc::mem_fun (*this, &Editor::lock)); + Actions.register_action (editor_actions, "lock", S_("Session|Lock"), sigc::mem_fun (*this, &Editor::lock)); toggle_reg_sens (editor_actions, "show-editor-mixer", _("Show Editor Mixer"), sigc::mem_fun (*this, &Editor::editor_mixer_button_toggled)); toggle_reg_sens (editor_actions, "show-editor-list", _("Show Editor List"), sigc::mem_fun (*this, &Editor::editor_list_button_toggled)); @@ -423,11 +426,11 @@ Editor::register_actions () toggle_reg_sens (editor_actions, "toggle-follow-playhead", _("Follow Playhead"), (sigc::mem_fun(*this, &Editor::toggle_follow_playhead))); act = reg_sens (editor_actions, "remove-last-capture", _("Remove Last Capture"), (sigc::mem_fun(*this, &Editor::remove_last_capture))); - myactions.register_toggle_action (editor_actions, "toggle-stationary-playhead", _("Stationary Playhead"), (mem_fun(*this, &Editor::toggle_stationary_playhead))); + Actions.register_toggle_action (editor_actions, "toggle-stationary-playhead", _("Stationary Playhead"), (mem_fun(*this, &Editor::toggle_stationary_playhead))); act = reg_sens (editor_actions, "insert-time", _("Insert Time"), (sigc::mem_fun(*this, &Editor::do_insert_time))); ActionManager::track_selection_sensitive_actions.push_back (act); - act = myactions.register_action (editor_actions, "remove-time", _("Remove Time"), (mem_fun(*this, &Editor::do_remove_time))); + act = Actions.register_action (editor_actions, "remove-time", _("Remove Time"), (mem_fun(*this, &Editor::do_remove_time))); ActionManager::session_sensitive_actions.push_back (act); ActionManager::track_selection_sensitive_actions.push_back (act); @@ -459,7 +462,7 @@ Editor::register_actions () toggle_reg_sens (editor_actions, "sound-midi-notes", _("Sound Selected MIDI Notes"), sigc::mem_fun (*this, &Editor::toggle_sound_midi_notes)); - Glib::RefPtr zoom_actions = myactions.create_action_group (X_("Zoom")); + Glib::RefPtr zoom_actions = Actions.create_action_group (X_("Zoom")); RadioAction::Group zoom_group; radio_reg_sens (zoom_actions, zoom_group, "zoom-focus-left", _("Zoom Focus Left"), sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusLeft)); @@ -469,148 +472,148 @@ Editor::register_actions () radio_reg_sens (zoom_actions, zoom_group, "zoom-focus-mouse", _("Zoom Focus Mouse"), sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusMouse)); radio_reg_sens (zoom_actions, zoom_group, "zoom-focus-edit", _("Zoom Focus Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_chosen), Editing::ZoomFocusEdit)); - myactions.register_action (editor_actions, X_("cycle-zoom-focus"), _("Next Zoom Focus"), sigc::mem_fun (*this, &Editor::cycle_zoom_focus)); + Actions.register_action (editor_actions, X_("cycle-zoom-focus"), _("Next Zoom Focus"), sigc::mem_fun (*this, &Editor::cycle_zoom_focus)); - Glib::RefPtr mouse_mode_actions = myactions.create_action_group (X_("MouseMode")); + Glib::RefPtr mouse_mode_actions = Actions.create_action_group (X_("MouseMode")); RadioAction::Group mouse_mode_group; - act = myactions.register_toggle_action (mouse_mode_actions, "set-mouse-mode-object-range", _("Smart Object Mode"), sigc::mem_fun (*this, &Editor::mouse_mode_object_range_toggled)); + act = Actions.register_toggle_action (mouse_mode_actions, "set-mouse-mode-object-range", _("Smart Object Mode"), sigc::mem_fun (*this, &Editor::mouse_mode_object_range_toggled)); smart_mode_action = Glib::RefPtr::cast_static (act); smart_mode_button.set_related_action (smart_mode_action); smart_mode_button.set_text (_("Smart")); smart_mode_button.set_name ("mouse mode button"); - act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-object", _("Object Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseObject)); + act = Actions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-object", _("Object Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseObject)); mouse_move_button.set_related_action (act); mouse_move_button.set_icon (Gtkmm2ext::ArdourIcon::ToolGrab); mouse_move_button.set_name ("mouse mode button"); - act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-range", _("Range Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseRange)); + act = Actions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-range", _("Range Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseRange)); mouse_select_button.set_related_action (act); mouse_select_button.set_icon (Gtkmm2ext::ArdourIcon::ToolRange); mouse_select_button.set_name ("mouse mode button"); - act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-draw", _("Note Drawing Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseDraw)); + act = Actions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-draw", _("Note Drawing Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseDraw)); mouse_draw_button.set_related_action (act); mouse_draw_button.set_icon (Gtkmm2ext::ArdourIcon::ToolDraw); mouse_draw_button.set_name ("mouse mode button"); - act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-audition", _("Audition Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseAudition)); + act = Actions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-audition", _("Audition Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseAudition)); mouse_audition_button.set_related_action (act); mouse_audition_button.set_icon (Gtkmm2ext::ArdourIcon::ToolAudition); mouse_audition_button.set_name ("mouse mode button"); - act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-timefx", _("Time FX Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseTimeFX)); + act = Actions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-timefx", _("Time FX Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseTimeFX)); mouse_timefx_button.set_related_action (act); mouse_timefx_button.set_icon (Gtkmm2ext::ArdourIcon::ToolStretch); mouse_timefx_button.set_name ("mouse mode button"); - act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-content", _("Content Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseContent)); + act = Actions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-content", _("Content Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseContent)); mouse_content_button.set_related_action (act); mouse_content_button.set_icon (Gtkmm2ext::ArdourIcon::ToolContent); mouse_content_button.set_name ("mouse mode button"); if(!Profile->get_mixbus()) { - act = myactions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-cut", _("Cut Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseCut)); + act = Actions.register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-cut", _("Cut Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseCut)); mouse_cut_button.set_related_action (act); mouse_cut_button.set_icon (Gtkmm2ext::ArdourIcon::ToolCut); mouse_cut_button.set_name ("mouse mode button"); } - myactions.register_action (editor_actions, "step-mouse-mode", _("Step Mouse Mode"), sigc::bind (sigc::mem_fun(*this, &Editor::step_mouse_mode), true)); + Actions.register_action (editor_actions, "step-mouse-mode", _("Step Mouse Mode"), sigc::bind (sigc::mem_fun(*this, &Editor::step_mouse_mode), true)); RadioAction::Group edit_point_group; - myactions.register_radio_action (editor_actions, edit_point_group, X_("edit-at-playhead"), _("Playhead"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead))); - myactions.register_radio_action (editor_actions, edit_point_group, X_("edit-at-mouse"), _("Mouse"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtMouse))); - myactions.register_radio_action (editor_actions, edit_point_group, X_("edit-at-selected-marker"), _("Marker"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtSelectedMarker))); + Actions.register_radio_action (editor_actions, edit_point_group, X_("edit-at-playhead"), _("Playhead"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead))); + Actions.register_radio_action (editor_actions, edit_point_group, X_("edit-at-mouse"), _("Mouse"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtMouse))); + Actions.register_radio_action (editor_actions, edit_point_group, X_("edit-at-selected-marker"), _("Marker"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtSelectedMarker))); - myactions.register_action (editor_actions, "cycle-edit-point", _("Change Edit Point"), sigc::bind (sigc::mem_fun (*this, &Editor::cycle_edit_point), false)); - myactions.register_action (editor_actions, "cycle-edit-point-with-marker", _("Change Edit Point Including Marker"), sigc::bind (sigc::mem_fun (*this, &Editor::cycle_edit_point), true)); + Actions.register_action (editor_actions, "cycle-edit-point", _("Change Edit Point"), sigc::bind (sigc::mem_fun (*this, &Editor::cycle_edit_point), false)); + Actions.register_action (editor_actions, "cycle-edit-point-with-marker", _("Change Edit Point Including Marker"), sigc::bind (sigc::mem_fun (*this, &Editor::cycle_edit_point), true)); -// myactions.register_action (editor_actions, "set-edit-splice", _("Splice"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Splice)); - myactions.register_action (editor_actions, "set-edit-ripple", _("Ripple"), bind (mem_fun (*this, &Editor::set_edit_mode), Ripple)); - myactions.register_action (editor_actions, "set-edit-slide", _("Slide"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Slide)); - myactions.register_action (editor_actions, "set-edit-lock", S_("EditMode|Lock"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Lock)); - myactions.register_action (editor_actions, "cycle-edit-mode", _("Cycle Edit Mode"), sigc::mem_fun (*this, &Editor::cycle_edit_mode)); +// Actions.register_action (editor_actions, "set-edit-splice", _("Splice"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Splice)); + Actions.register_action (editor_actions, "set-edit-ripple", _("Ripple"), bind (mem_fun (*this, &Editor::set_edit_mode), Ripple)); + Actions.register_action (editor_actions, "set-edit-slide", _("Slide"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Slide)); + Actions.register_action (editor_actions, "set-edit-lock", S_("EditMode|Lock"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Lock)); + Actions.register_action (editor_actions, "cycle-edit-mode", _("Cycle Edit Mode"), sigc::mem_fun (*this, &Editor::cycle_edit_mode)); - myactions.register_action (editor_actions, X_("SnapTo"), _("Snap to")); - myactions.register_action (editor_actions, X_("SnapMode"), _("Snap Mode")); + Actions.register_action (editor_actions, X_("SnapTo"), _("Snap to")); + Actions.register_action (editor_actions, X_("SnapMode"), _("Snap Mode")); RadioAction::Group snap_mode_group; - myactions.register_radio_action (editor_actions, snap_mode_group, X_("snap-off"), _("No Grid"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapOff))); - myactions.register_radio_action (editor_actions, snap_mode_group, X_("snap-normal"), _("Grid"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapNormal))); - myactions.register_radio_action (editor_actions, snap_mode_group, X_("snap-magnetic"), _("Magnetic"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapMagnetic))); + Actions.register_radio_action (editor_actions, snap_mode_group, X_("snap-off"), _("No Grid"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapOff))); + Actions.register_radio_action (editor_actions, snap_mode_group, X_("snap-normal"), _("Grid"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapNormal))); + Actions.register_radio_action (editor_actions, snap_mode_group, X_("snap-magnetic"), _("Magnetic"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_chosen), Editing::SnapMagnetic))); - myactions.register_action (editor_actions, X_("cycle-snap-mode"), _("Next Snap Mode"), sigc::mem_fun (*this, &Editor::cycle_snap_mode)); - myactions.register_action (editor_actions, X_("next-snap-choice"), _("Next Snap Choice"), sigc::mem_fun (*this, &Editor::next_snap_choice)); - myactions.register_action (editor_actions, X_("next-snap-choice-music-only"), _("Next Musical Snap Choice"), sigc::mem_fun (*this, &Editor::next_snap_choice_music_only)); - myactions.register_action (editor_actions, X_("prev-snap-choice"), _("Previous Snap Choice"), sigc::mem_fun (*this, &Editor::prev_snap_choice)); - myactions.register_action (editor_actions, X_("prev-snap-choice-music-only"), _("Previous Musical Snap Choice"), sigc::mem_fun (*this, &Editor::prev_snap_choice_music_only)); + Actions.register_action (editor_actions, X_("cycle-snap-mode"), _("Next Snap Mode"), sigc::mem_fun (*this, &Editor::cycle_snap_mode)); + Actions.register_action (editor_actions, X_("next-snap-choice"), _("Next Snap Choice"), sigc::mem_fun (*this, &Editor::next_snap_choice)); + Actions.register_action (editor_actions, X_("next-snap-choice-music-only"), _("Next Musical Snap Choice"), sigc::mem_fun (*this, &Editor::next_snap_choice_music_only)); + Actions.register_action (editor_actions, X_("prev-snap-choice"), _("Previous Snap Choice"), sigc::mem_fun (*this, &Editor::prev_snap_choice)); + Actions.register_action (editor_actions, X_("prev-snap-choice-music-only"), _("Previous Musical Snap Choice"), sigc::mem_fun (*this, &Editor::prev_snap_choice_music_only)); - Glib::RefPtr snap_actions = myactions.create_action_group (X_("Snap")); + Glib::RefPtr snap_actions = Actions.create_action_group (X_("Snap")); RadioAction::Group snap_choice_group; - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-cd-frame"), _("Snap to CD Frame"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToCDFrame))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-timecode-frame"), _("Snap to Timecode Frame"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToTimecodeFrame))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-timecode-seconds"), _("Snap to Timecode Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToTimecodeSeconds))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-timecode-minutes"), _("Snap to Timecode Minutes"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToTimecodeMinutes))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-seconds"), _("Snap to Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSeconds))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-minutes"), _("Snap to Minutes"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToMinutes))); - - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-onetwentyeighths"), _("Snap to One Twenty Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv128))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sixtyfourths"), _("Snap to Sixty Fourths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv64))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirtyseconds"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv32))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyeighths"), _("Snap to Twenty Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv28))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyfourths"), _("Snap to Twenty Fourths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv24))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentieths"), _("Snap to Twentieths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv20))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-asixteenthbeat"), _("Snap to Sixteenths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv16))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-fourteenths"), _("Snap to Fourteenths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv14))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twelfths"), _("Snap to Twelfths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv12))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-tenths"), _("Snap to Tenths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv10))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-eighths"), _("Snap to Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv8))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sevenths"), _("Snap to Sevenths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv7))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sixths"), _("Snap to Sixths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv6))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-fifths"), _("Snap to Fifths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv5))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-quarters"), _("Snap to Quarters"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv4))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirds"), _("Snap to Thirds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv3))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-halves"), _("Snap to Halves"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv2))); - - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-beat"), _("Snap to Beat"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeat))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-bar"), _("Snap to Bar"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBar))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-mark"), _("Snap to Mark"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToMark))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-start"), _("Snap to Region Start"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionStart))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-end"), _("Snap to Region End"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionEnd))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-sync"), _("Snap to Region Sync"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionSync))); - myactions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-boundary"), _("Snap to Region Boundary"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionBoundary))); - - myactions.register_toggle_action (editor_actions, X_("show-marker-lines"), _("Show Marker Lines"), sigc::mem_fun (*this, &Editor::toggle_marker_lines)); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-cd-frame"), _("Snap to CD Frame"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToCDFrame))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-timecode-frame"), _("Snap to Timecode Frame"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToTimecodeFrame))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-timecode-seconds"), _("Snap to Timecode Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToTimecodeSeconds))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-timecode-minutes"), _("Snap to Timecode Minutes"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToTimecodeMinutes))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-seconds"), _("Snap to Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSeconds))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-minutes"), _("Snap to Minutes"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToMinutes))); + + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-onetwentyeighths"), _("Snap to One Twenty Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv128))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sixtyfourths"), _("Snap to Sixty Fourths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv64))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirtyseconds"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv32))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyeighths"), _("Snap to Twenty Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv28))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyfourths"), _("Snap to Twenty Fourths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv24))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentieths"), _("Snap to Twentieths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv20))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-asixteenthbeat"), _("Snap to Sixteenths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv16))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-fourteenths"), _("Snap to Fourteenths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv14))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twelfths"), _("Snap to Twelfths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv12))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-tenths"), _("Snap to Tenths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv10))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-eighths"), _("Snap to Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv8))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sevenths"), _("Snap to Sevenths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv7))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sixths"), _("Snap to Sixths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv6))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-fifths"), _("Snap to Fifths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv5))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-quarters"), _("Snap to Quarters"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv4))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirds"), _("Snap to Thirds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv3))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-halves"), _("Snap to Halves"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv2))); + + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-beat"), _("Snap to Beat"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeat))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-bar"), _("Snap to Bar"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBar))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-mark"), _("Snap to Mark"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToMark))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-start"), _("Snap to Region Start"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionStart))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-end"), _("Snap to Region End"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionEnd))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-sync"), _("Snap to Region Sync"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionSync))); + Actions.register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-boundary"), _("Snap to Region Boundary"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionBoundary))); + + Actions.register_toggle_action (editor_actions, X_("show-marker-lines"), _("Show Marker Lines"), sigc::mem_fun (*this, &Editor::toggle_marker_lines)); /* RULERS */ - Glib::RefPtr ruler_actions = myactions.create_action_group (X_("Rulers")); - ruler_tempo_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (ruler_actions, X_("toggle-tempo-ruler"), _("Tempo"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_tempo))); - ruler_meter_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (ruler_actions, X_("toggle-meter-ruler"), _("Meter"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_meter))); - ruler_range_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (ruler_actions, X_("toggle-range-ruler"), _("Ranges"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_range_marker))); - ruler_marker_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (ruler_actions, X_("toggle-marker-ruler"), _("Markers"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_marker))); - ruler_cd_marker_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (ruler_actions, X_("toggle-cd-marker-ruler"), _("CD Markers"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_cd_marker))); - ruler_loop_punch_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (ruler_actions, X_("toggle-loop-punch-ruler"), _("Loop/Punch"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_transport_marker))); - ruler_bbt_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (ruler_actions, X_("toggle-bbt-ruler"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_bbt))); - ruler_samples_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (ruler_actions, X_("toggle-samples-ruler"), _("Samples"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_samples))); - ruler_timecode_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (ruler_actions, X_("toggle-timecode-ruler"), _("Timecode"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_timecode))); - ruler_minsec_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (ruler_actions, X_("toggle-minsec-ruler"), _("Min:Sec"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_minsec))); - - myactions.register_action (editor_menu_actions, X_("VideoMonitorMenu"), _("Video Monitor")); - - ruler_video_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (ruler_actions, X_("toggle-video-ruler"), _("Video"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_video_timeline))); - xjadeo_proc_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (editor_actions, X_("ToggleJadeo"), _("Video Monitor"), sigc::mem_fun (*this, &Editor::set_xjadeo_proc))); - - xjadeo_ontop_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (editor_actions, X_("toggle-vmon-ontop"), _("Always on Top"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 1))); - xjadeo_timecode_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (editor_actions, X_("toggle-vmon-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 2))); - xjadeo_frame_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (editor_actions, X_("toggle-vmon-frame"), _("Frame number"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 3))); - xjadeo_osdbg_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (editor_actions, X_("toggle-vmon-osdbg"), _("Timecode Background"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 4))); - xjadeo_fullscreen_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (editor_actions, X_("toggle-vmon-fullscreen"), _("Fullscreen"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 5))); - xjadeo_letterbox_action = Glib::RefPtr::cast_static (myactions.register_toggle_action (editor_actions, X_("toggle-vmon-letterbox"), _("Letterbox"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 6))); + Glib::RefPtr ruler_actions = Actions.create_action_group (X_("Rulers")); + ruler_tempo_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (ruler_actions, X_("toggle-tempo-ruler"), _("Tempo"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_tempo))); + ruler_meter_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (ruler_actions, X_("toggle-meter-ruler"), _("Meter"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_meter))); + ruler_range_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (ruler_actions, X_("toggle-range-ruler"), _("Ranges"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_range_marker))); + ruler_marker_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (ruler_actions, X_("toggle-marker-ruler"), _("Markers"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_marker))); + ruler_cd_marker_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (ruler_actions, X_("toggle-cd-marker-ruler"), _("CD Markers"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_cd_marker))); + ruler_loop_punch_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (ruler_actions, X_("toggle-loop-punch-ruler"), _("Loop/Punch"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_transport_marker))); + ruler_bbt_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (ruler_actions, X_("toggle-bbt-ruler"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_bbt))); + ruler_samples_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (ruler_actions, X_("toggle-samples-ruler"), _("Samples"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_samples))); + ruler_timecode_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (ruler_actions, X_("toggle-timecode-ruler"), _("Timecode"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_timecode))); + ruler_minsec_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (ruler_actions, X_("toggle-minsec-ruler"), _("Min:Sec"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_metric_minsec))); + + Actions.register_action (editor_menu_actions, X_("VideoMonitorMenu"), _("Video Monitor")); + + ruler_video_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (ruler_actions, X_("toggle-video-ruler"), _("Video"), sigc::bind (sigc::mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_video_timeline))); + xjadeo_proc_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (editor_actions, X_("ToggleJadeo"), _("Video Monitor"), sigc::mem_fun (*this, &Editor::set_xjadeo_proc))); + + xjadeo_ontop_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (editor_actions, X_("toggle-vmon-ontop"), _("Always on Top"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 1))); + xjadeo_timecode_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (editor_actions, X_("toggle-vmon-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 2))); + xjadeo_frame_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (editor_actions, X_("toggle-vmon-frame"), _("Frame number"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 3))); + xjadeo_osdbg_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (editor_actions, X_("toggle-vmon-osdbg"), _("Timecode Background"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 4))); + xjadeo_fullscreen_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (editor_actions, X_("toggle-vmon-fullscreen"), _("Fullscreen"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 5))); + xjadeo_letterbox_action = Glib::RefPtr::cast_static (Actions.register_toggle_action (editor_actions, X_("toggle-vmon-letterbox"), _("Letterbox"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 6))); xjadeo_zoom_100 = reg_sens (editor_actions, "zoom-vmon-100", _("Original Size"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 7)); /* set defaults here */ @@ -663,52 +666,52 @@ Editor::register_actions () /* REGION LIST */ - Glib::RefPtr rl_actions = myactions.create_action_group (X_("RegionList")); + Glib::RefPtr rl_actions = Actions.create_action_group (X_("RegionList")); RadioAction::Group sort_type_group; RadioAction::Group sort_order_group; /* the region list popup menu */ - myactions.register_action (rl_actions, X_("RegionListSort"), _("Sort")); + Actions.register_action (rl_actions, X_("RegionListSort"), _("Sort")); - act = myactions.register_action (rl_actions, X_("rlAudition"), _("Audition"), sigc::mem_fun(*this, &Editor::audition_region_from_region_list)); + act = Actions.register_action (rl_actions, X_("rlAudition"), _("Audition"), sigc::mem_fun(*this, &Editor::audition_region_from_region_list)); ActionManager::region_list_selection_sensitive_actions.push_back (act); - act = myactions.register_action (rl_actions, X_("rlHide"), _("Hide"), sigc::mem_fun(*this, &Editor::hide_region_from_region_list)); + act = Actions.register_action (rl_actions, X_("rlHide"), _("Hide"), sigc::mem_fun(*this, &Editor::hide_region_from_region_list)); ActionManager::region_list_selection_sensitive_actions.push_back (act); - act = myactions.register_action (rl_actions, X_("rlShow"), _("Show"), sigc::mem_fun(*this, &Editor::show_region_in_region_list)); + act = Actions.register_action (rl_actions, X_("rlShow"), _("Show"), sigc::mem_fun(*this, &Editor::show_region_in_region_list)); ActionManager::region_list_selection_sensitive_actions.push_back (act); - myactions.register_toggle_action (rl_actions, X_("rlShowAll"), _("Show All"), sigc::mem_fun(*_regions, &EditorRegions::toggle_full)); - myactions.register_toggle_action (rl_actions, X_("rlShowAuto"), _("Show Automatic Regions"), sigc::mem_fun (*_regions, &EditorRegions::toggle_show_auto_regions)); + Actions.register_toggle_action (rl_actions, X_("rlShowAll"), _("Show All"), sigc::mem_fun(*_regions, &EditorRegions::toggle_full)); + Actions.register_toggle_action (rl_actions, X_("rlShowAuto"), _("Show Automatic Regions"), sigc::mem_fun (*_regions, &EditorRegions::toggle_show_auto_regions)); - myactions.register_radio_action (rl_actions, sort_order_group, X_("SortAscending"), _("Ascending"), + Actions.register_radio_action (rl_actions, sort_order_group, X_("SortAscending"), _("Ascending"), sigc::bind (sigc::mem_fun (*_regions, &EditorRegions::reset_sort_direction), true)); - myactions.register_radio_action (rl_actions, sort_order_group, X_("SortDescending"), _("Descending"), + Actions.register_radio_action (rl_actions, sort_order_group, X_("SortDescending"), _("Descending"), sigc::bind (sigc::mem_fun (*_regions, &EditorRegions::reset_sort_direction), false)); - myactions.register_radio_action (rl_actions, sort_type_group, X_("SortByRegionName"), _("By Region Name"), + Actions.register_radio_action (rl_actions, sort_type_group, X_("SortByRegionName"), _("By Region Name"), sigc::bind (sigc::mem_fun (*_regions, &EditorRegions::reset_sort_type), ByName, false)); - myactions.register_radio_action (rl_actions, sort_type_group, X_("SortByRegionLength"), _("By Region Length"), + Actions.register_radio_action (rl_actions, sort_type_group, X_("SortByRegionLength"), _("By Region Length"), sigc::bind (sigc::mem_fun (*_regions, &EditorRegions::reset_sort_type), ByLength, false)); - myactions.register_radio_action (rl_actions, sort_type_group, X_("SortByRegionPosition"), _("By Region Position"), + Actions.register_radio_action (rl_actions, sort_type_group, X_("SortByRegionPosition"), _("By Region Position"), sigc::bind (sigc::mem_fun (*_regions, &EditorRegions::reset_sort_type), ByPosition, false)); - myactions.register_radio_action (rl_actions, sort_type_group, X_("SortByRegionTimestamp"), _("By Region Timestamp"), + Actions.register_radio_action (rl_actions, sort_type_group, X_("SortByRegionTimestamp"), _("By Region Timestamp"), sigc::bind (sigc::mem_fun (*_regions, &EditorRegions::reset_sort_type), ByTimestamp, false)); - myactions.register_radio_action (rl_actions, sort_type_group, X_("SortByRegionStartinFile"), _("By Region Start in File"), + Actions.register_radio_action (rl_actions, sort_type_group, X_("SortByRegionStartinFile"), _("By Region Start in File"), sigc::bind (sigc::mem_fun (*_regions, &EditorRegions::reset_sort_type), ByStartInFile, false)); - myactions.register_radio_action (rl_actions, sort_type_group, X_("SortByRegionEndinFile"), _("By Region End in File"), + Actions.register_radio_action (rl_actions, sort_type_group, X_("SortByRegionEndinFile"), _("By Region End in File"), sigc::bind (sigc::mem_fun (*_regions, &EditorRegions::reset_sort_type), ByEndInFile, false)); - myactions.register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileName"), _("By Source File Name"), + Actions.register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileName"), _("By Source File Name"), sigc::bind (sigc::mem_fun (*_regions, &EditorRegions::reset_sort_type), BySourceFileName, false)); - myactions.register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileLength"), _("By Source File Length"), + Actions.register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileLength"), _("By Source File Length"), sigc::bind (sigc::mem_fun (*_regions, &EditorRegions::reset_sort_type), BySourceFileLength, false)); - myactions.register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileCreationDate"), _("By Source File Creation Date"), + Actions.register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFileCreationDate"), _("By Source File Creation Date"), sigc::bind (sigc::mem_fun (*_regions, &EditorRegions::reset_sort_type), BySourceFileCreationDate, false)); - myactions.register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFilesystem"), _("By Source Filesystem"), + Actions.register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFilesystem"), _("By Source Filesystem"), sigc::bind (sigc::mem_fun (*_regions, &EditorRegions::reset_sort_type), BySourceFileFS, false)); - myactions.register_action (rl_actions, X_("removeUnusedRegions"), _("Remove Unused"), sigc::mem_fun (*_regions, &EditorRegions::remove_unused_regions)); + Actions.register_action (rl_actions, X_("removeUnusedRegions"), _("Remove Unused"), sigc::mem_fun (*_regions, &EditorRegions::remove_unused_regions)); act = reg_sens (editor_actions, X_("addExistingPTFiles"), _("Import PT session"), sigc::mem_fun (*this, &Editor::external_pt_dialog)); ActionManager::write_sensitive_actions.push_back (act); @@ -721,42 +724,33 @@ Editor::register_actions () act = reg_sens (editor_actions, X_("addExternalAudioToRegionList"), _("Import to Region List..."), sigc::bind (sigc::mem_fun(*this, &Editor::add_external_audio_action), ImportAsRegion)); ActionManager::write_sensitive_actions.push_back (act); - act = myactions.register_action (editor_actions, X_("importFromSession"), _("Import from Session"), sigc::mem_fun(*this, &Editor::session_import_dialog)); + act = Actions.register_action (editor_actions, X_("importFromSession"), _("Import from Session"), sigc::mem_fun(*this, &Editor::session_import_dialog)); ActionManager::write_sensitive_actions.push_back (act); - act = myactions.register_action (editor_actions, X_("bring-into-session"), _("Bring all media into session folder"), sigc::mem_fun(*this, &Editor::bring_all_sources_into_session)); + act = Actions.register_action (editor_actions, X_("bring-into-session"), _("Bring all media into session folder"), sigc::mem_fun(*this, &Editor::bring_all_sources_into_session)); ActionManager::write_sensitive_actions.push_back (act); - myactions.register_toggle_action (editor_actions, X_("ToggleSummary"), _("Show Summary"), sigc::mem_fun (*this, &Editor::set_summary)); + Actions.register_toggle_action (editor_actions, X_("ToggleSummary"), _("Show Summary"), sigc::mem_fun (*this, &Editor::set_summary)); - myactions.register_toggle_action (editor_actions, X_("ToggleGroupTabs"), _("Show Group Tabs"), sigc::mem_fun (*this, &Editor::set_group_tabs)); + Actions.register_toggle_action (editor_actions, X_("ToggleGroupTabs"), _("Show Group Tabs"), sigc::mem_fun (*this, &Editor::set_group_tabs)); - myactions.register_toggle_action (editor_actions, X_("ToggleMeasureVisibility"), _("Show Measure Lines"), sigc::mem_fun (*this, &Editor::toggle_measure_visibility)); + Actions.register_toggle_action (editor_actions, X_("ToggleMeasureVisibility"), _("Show Measure Lines"), sigc::mem_fun (*this, &Editor::toggle_measure_visibility)); /* if there is a logo in the editor canvas, its always visible at startup */ - act = myactions.register_toggle_action (editor_actions, X_("ToggleLogoVisibility"), _("Show Logo"), sigc::mem_fun (*this, &Editor::toggle_logo_visibility)); + act = Actions.register_toggle_action (editor_actions, X_("ToggleLogoVisibility"), _("Show Logo"), sigc::mem_fun (*this, &Editor::toggle_logo_visibility)); Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); tact->set_active (true); - myactions.register_action (editor_actions, X_("toggle-midi-input-active"), _("Toggle MIDI Input Active for Editor-Selected Tracks/Busses"), - sigc::bind (sigc::mem_fun (*this, &Editor::toggle_midi_input_active), false)); - - myactions.install_action_group (rl_actions); - myactions.install_action_group (ruler_actions); - myactions.install_action_group (zoom_actions); - myactions.install_action_group (mouse_mode_actions); - myactions.install_action_group (snap_actions); - myactions.install_action_group (editor_actions); - myactions.install_action_group (editor_menu_actions); + Actions.register_action (editor_actions, X_("toggle-midi-input-active"), _("Toggle MIDI Input Active for Editor-Selected Tracks/Busses"), + sigc::bind (sigc::mem_fun (*this, &Editor::toggle_midi_input_active), false)); } void Editor::load_bindings () { - bindings.set_action_map (myactions); - bindings.load (X_("editor")); + bindings = Bindings::get_bindings (X_("editor")); } void @@ -1780,7 +1774,7 @@ Editor::reset_canvas_action_sensitivity (bool onoff) void Editor::register_region_actions () { - _region_actions = ActionGroup::create (X_("Region")); + _region_actions = Actions.create_action_group (X_("Region")); /* PART 1: actions that operate on the selection, and for which the edit point type and location is irrelevant */ @@ -2053,5 +2047,4 @@ Editor::register_region_actions () _all_region_actions_sensitized = true; - ActionManager::add_action_group (_region_actions); } diff --git a/gtk2_ardour/mixer_actor.cc b/gtk2_ardour/mixer_actor.cc index 56b94d409d..eb5b5e8f71 100644 --- a/gtk2_ardour/mixer_actor.cc +++ b/gtk2_ardour/mixer_actor.cc @@ -28,6 +28,8 @@ #include "ardour/filesystem_paths.h" +#include "gtkmm2ext/bindings.h" + #include "actions.h" #include "mixer_actor.h" #include "mixer_strip.h" @@ -38,6 +40,8 @@ using namespace ARDOUR; using namespace Gtk; using namespace PBD; +using Gtkmm2ext::Actions; +using Gtkmm2ext::Bindings; MixerActor::MixerActor () { @@ -52,37 +56,36 @@ MixerActor::~MixerActor () void MixerActor::register_actions () { - Glib::RefPtr group = myactions.create_action_group (X_("Mixer")); + Glib::RefPtr group = Actions.create_action_group (X_("Mixer")); - myactions.register_action (group, "solo", _("Toggle Solo on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::solo_action)); - myactions.register_action (group, "mute", _("Toggle Mute on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::mute_action)); - myactions.register_action (group, "recenable", _("Toggle Rec-enable on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::rec_enable_action)); - myactions.register_action (group, "increment-gain", _("Decrease Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::step_gain_up_action)); - myactions.register_action (group, "decrement-gain", _("Increase Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::step_gain_down_action)); - myactions.register_action (group, "unity-gain", _("Set Gain to 0dB on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::unity_gain_action)); + Actions.register_action (group, "solo", _("Toggle Solo on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::solo_action)); + Actions.register_action (group, "mute", _("Toggle Mute on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::mute_action)); + Actions.register_action (group, "recenable", _("Toggle Rec-enable on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::rec_enable_action)); + Actions.register_action (group, "increment-gain", _("Decrease Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::step_gain_up_action)); + Actions.register_action (group, "decrement-gain", _("Increase Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::step_gain_down_action)); + Actions.register_action (group, "unity-gain", _("Set Gain to 0dB on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::unity_gain_action)); - myactions.register_action (group, "copy-processors", _("Copy Selected Processors"), sigc::mem_fun (*this, &MixerActor::copy_processors)); - myactions.register_action (group, "cut-processors", _("Cut Selected Processors"), sigc::mem_fun (*this, &MixerActor::cut_processors)); - myactions.register_action (group, "paste-processors", _("Paste Selected Processors"), sigc::mem_fun (*this, &MixerActor::paste_processors)); - myactions.register_action (group, "delete-processors", _("Delete Selected Processors"), sigc::mem_fun (*this, &MixerActor::delete_processors)); - myactions.register_action (group, "select-all-processors", _("Select All (visible) Processors"), sigc::mem_fun (*this, &MixerActor::select_all_processors)); - myactions.register_action (group, "toggle-processors", _("Toggle Selected Processors"), sigc::mem_fun (*this, &MixerActor::toggle_processors)); - myactions.register_action (group, "ab-plugins", _("Toggle Selected Plugins"), sigc::mem_fun (*this, &MixerActor::ab_plugins)); - myactions.register_action (group, "select-none", _("Deselect all strips and processors"), sigc::mem_fun (*this, &MixerActor::select_none)); + Actions.register_action (group, "copy-processors", _("Copy Selected Processors"), sigc::mem_fun (*this, &MixerActor::copy_processors)); + Actions.register_action (group, "cut-processors", _("Cut Selected Processors"), sigc::mem_fun (*this, &MixerActor::cut_processors)); + Actions.register_action (group, "paste-processors", _("Paste Selected Processors"), sigc::mem_fun (*this, &MixerActor::paste_processors)); + Actions.register_action (group, "delete-processors", _("Delete Selected Processors"), sigc::mem_fun (*this, &MixerActor::delete_processors)); + Actions.register_action (group, "select-all-processors", _("Select All (visible) Processors"), sigc::mem_fun (*this, &MixerActor::select_all_processors)); + Actions.register_action (group, "toggle-processors", _("Toggle Selected Processors"), sigc::mem_fun (*this, &MixerActor::toggle_processors)); + Actions.register_action (group, "ab-plugins", _("Toggle Selected Plugins"), sigc::mem_fun (*this, &MixerActor::ab_plugins)); + Actions.register_action (group, "select-none", _("Deselect all strips and processors"), sigc::mem_fun (*this, &MixerActor::select_none)); - myactions.register_action (group, "scroll-left", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &MixerActor::scroll_left)); - myactions.register_action (group, "scroll-right", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &MixerActor::scroll_right)); + Actions.register_action (group, "scroll-left", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &MixerActor::scroll_left)); + Actions.register_action (group, "scroll-right", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &MixerActor::scroll_right)); - myactions.register_action (group, "toggle-midi-input-active", _("Toggle MIDI Input Active for Mixer-Selected Tracks/Busses"), + Actions.register_action (group, "toggle-midi-input-active", _("Toggle MIDI Input Active for Mixer-Selected Tracks/Busses"), sigc::bind (sigc::mem_fun (*this, &MixerActor::toggle_midi_input_active), false)); } void MixerActor::load_bindings () { - bindings.set_action_map (myactions); - bindings.load (X_("mixer")); + bindings = Bindings::get_bindings (X_("mixer")); } void diff --git a/gtk2_ardour/mixer_actor.h b/gtk2_ardour/mixer_actor.h index d3e861b451..544a2ae0c0 100644 --- a/gtk2_ardour/mixer_actor.h +++ b/gtk2_ardour/mixer_actor.h @@ -39,12 +39,11 @@ class MixerActor : virtual public sigc::trackable void register_actions (); void load_bindings (); - Gtkmm2ext::Bindings bindings; + Gtkmm2ext::Bindings* bindings; protected: RouteProcessorSelection _selection; RouteUISelection _route_targets; - Gtkmm2ext::ActionMap myactions; virtual void set_route_targets_for_operation () = 0; diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index 49a5c754df..0bc5b98bc7 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -852,25 +852,24 @@ MonitorSection::register_actions () string action_descr; Glib::RefPtr act; - monitor_actions = myactions.create_action_group (X_("Monitor")); - myactions.install_action_group (monitor_actions); + monitor_actions = Actions.create_action_group (X_("Monitor")); - myactions.register_toggle_action (monitor_actions, "monitor-mono", _("Switch monitor to mono"), + Actions.register_toggle_action (monitor_actions, "monitor-mono", _("Switch monitor to mono"), sigc::mem_fun (*this, &MonitorSection::mono)); - myactions.register_toggle_action (monitor_actions, "monitor-cut-all", _("Cut monitor"), + Actions.register_toggle_action (monitor_actions, "monitor-cut-all", _("Cut monitor"), sigc::mem_fun (*this, &MonitorSection::cut_all)); - myactions.register_toggle_action (monitor_actions, "monitor-dim-all", _("Dim monitor"), + Actions.register_toggle_action (monitor_actions, "monitor-dim-all", _("Dim monitor"), sigc::mem_fun (*this, &MonitorSection::dim_all)); - act = myactions.register_toggle_action (monitor_actions, "toggle-exclusive-solo", _("Toggle exclusive solo mode"), + act = Actions.register_toggle_action (monitor_actions, "toggle-exclusive-solo", _("Toggle exclusive solo mode"), sigc::mem_fun (*this, &MonitorSection::toggle_exclusive_solo)); Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); tact->set_active (Config->get_exclusive_solo()); - act = myactions.register_toggle_action (monitor_actions, "toggle-mute-overrides-solo", _("Toggle mute overrides solo mode"), + act = Actions.register_toggle_action (monitor_actions, "toggle-mute-overrides-solo", _("Toggle mute overrides solo mode"), sigc::mem_fun (*this, &MonitorSection::toggle_mute_overrides_solo)); tact = Glib::RefPtr::cast_dynamic(act); @@ -880,38 +879,36 @@ MonitorSection::register_actions () action_name = string_compose (X_("monitor-cut-%1"), chn); action_descr = string_compose (_("Cut monitor channel %1"), chn); - myactions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), + Actions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), sigc::bind (sigc::mem_fun (*this, &MonitorSection::cut_channel), chn)); action_name = string_compose (X_("monitor-dim-%1"), chn); action_descr = string_compose (_("Dim monitor channel %1"), chn); - myactions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), + Actions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), sigc::bind (sigc::mem_fun (*this, &MonitorSection::dim_channel), chn)); action_name = string_compose (X_("monitor-solo-%1"), chn); action_descr = string_compose (_("Solo monitor channel %1"), chn); - myactions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), + Actions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), sigc::bind (sigc::mem_fun (*this, &MonitorSection::solo_channel), chn)); action_name = string_compose (X_("monitor-invert-%1"), chn); action_descr = string_compose (_("Invert monitor channel %1"), chn); - myactions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), + Actions.register_toggle_action (monitor_actions, action_name.c_str(), action_descr.c_str(), sigc::bind (sigc::mem_fun (*this, &MonitorSection::invert_channel), chn)); } - Glib::RefPtr solo_actions = myactions.create_action_group (X_("Solo")); + Glib::RefPtr solo_actions = Actions.create_action_group (X_("Solo")); RadioAction::Group solo_group; - myactions.register_radio_action (solo_actions, solo_group, "solo-use-in-place", _("In-place solo"), + Actions.register_radio_action (solo_actions, solo_group, "solo-use-in-place", _("In-place solo"), sigc::mem_fun (*this, &MonitorSection::solo_use_in_place)); - myactions.register_radio_action (solo_actions, solo_group, "solo-use-afl", _("After Fade Listen (AFL) solo"), + Actions.register_radio_action (solo_actions, solo_group, "solo-use-afl", _("After Fade Listen (AFL) solo"), sigc::mem_fun (*this, &MonitorSection::solo_use_afl)); - myactions.register_radio_action (solo_actions, solo_group, "solo-use-pfl", _("Pre Fade Listen (PFL) solo"), + Actions.register_radio_action (solo_actions, solo_group, "solo-use-pfl", _("Pre Fade Listen (PFL) solo"), sigc::mem_fun (*this, &MonitorSection::solo_use_pfl)); - - myactions.install_action_group (solo_actions); } void diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index b54a7817c8..8fa8d725c5 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -102,7 +102,6 @@ RefPtr ProcessorBox::rename_action; RefPtr ProcessorBox::delete_action; RefPtr ProcessorBox::edit_action; RefPtr ProcessorBox::edit_generic_action; -Gtkmm2ext::ActionMap ProcessorBox::processor_box_actions; static const uint32_t audio_port_color = 0x4A8A0EFF; // Green static const uint32_t midi_port_color = 0x960909FF; //Red @@ -2801,38 +2800,39 @@ ProcessorBox::get_generic_editor_window (boost::shared_ptr processor) void ProcessorBox::register_actions () { - Glib::RefPtr popup_act_grp = processor_box_actions.create_action_group (X_("ProcessorMenu")); + Glib::RefPtr popup_act_grp = Actions.create_action_group (X_("ProcessorMenu")); Glib::RefPtr act; /* new stuff */ - processor_box_actions.register_action (popup_act_grp, X_("newplugin"), _("New Plugin"), + Actions.register_action (popup_act_grp, X_("newplugin"), _("New Plugin"), sigc::ptr_fun (ProcessorBox::rb_choose_plugin)); - act = processor_box_actions.register_action (popup_act_grp, X_("newinsert"), _("New Insert"), + act = Actions.register_action (popup_act_grp, X_("newinsert"), _("New Insert"), sigc::ptr_fun (ProcessorBox::rb_choose_insert)); ActionManager::engine_sensitive_actions.push_back (act); - act = processor_box_actions.register_action (popup_act_grp, X_("newsend"), _("New External Send ..."), + act = Actions.register_action (popup_act_grp, X_("newsend"), _("New External Send ..."), sigc::ptr_fun (ProcessorBox::rb_choose_send)); ActionManager::engine_sensitive_actions.push_back (act); - processor_box_actions.register_action (popup_act_grp, X_("newaux"), _("New Aux Send ...")); + Actions.register_action (popup_act_grp, X_("newaux"), _("New Aux Send ...")); - processor_box_actions.register_action (popup_act_grp, X_("controls"), _("Controls")); - processor_box_actions.register_action (popup_act_grp, X_("send_options"), _("Send Options")); + Actions.register_action (popup_act_grp, X_("controls"), _("Controls")); + Actions.register_action (popup_act_grp, X_("send_options"), _("Send Options")); - processor_box_actions.register_action (popup_act_grp, X_("clear"), _("Clear (all)"), + Actions.register_action (popup_act_grp, X_("clear"), _("Clear (all)"), sigc::ptr_fun (ProcessorBox::rb_clear)); - processor_box_actions.register_action (popup_act_grp, X_("clear_pre"), _("Clear (pre-fader)"), + Actions.register_action (popup_act_grp, X_("clear_pre"), _("Clear (pre-fader)"), sigc::ptr_fun (ProcessorBox::rb_clear_pre)); - processor_box_actions.register_action (popup_act_grp, X_("clear_post"), _("Clear (post-fader)"), + Actions.register_action (popup_act_grp, X_("clear_post"), _("Clear (post-fader)"), sigc::ptr_fun (ProcessorBox::rb_clear_post)); /* standard editing stuff */ - cut_action = processor_box_actions.register_action (popup_act_grp, X_("cut"), _("Cut"), + + cut_action = Actions.register_action (popup_act_grp, X_("cut"), _("Cut"), sigc::ptr_fun (ProcessorBox::rb_cut)); - copy_action = processor_box_actions.register_action (popup_act_grp, X_("copy"), _("Copy"), + copy_action = Actions.register_action (popup_act_grp, X_("copy"), _("Copy"), sigc::ptr_fun (ProcessorBox::rb_copy)); - delete_action = processor_box_actions.register_action (popup_act_grp, X_("delete"), _("Delete"), + delete_action = Actions.register_action (popup_act_grp, X_("delete"), _("Delete"), sigc::ptr_fun (ProcessorBox::rb_delete)); ActionManager::plugin_selection_sensitive_actions.push_back (cut_action); @@ -2841,32 +2841,30 @@ ProcessorBox::register_actions () paste_action = processor_box_actions.register_action (popup_act_grp, X_("paste"), _("Paste"), sigc::ptr_fun (ProcessorBox::rb_paste)); - rename_action = processor_box_actions.register_action (popup_act_grp, X_("rename"), _("Rename"), + rename_action = Actions.register_action (popup_act_grp, X_("rename"), _("Rename"), sigc::ptr_fun (ProcessorBox::rb_rename)); - processor_box_actions.register_action (popup_act_grp, X_("selectall"), _("Select All"), + Actions.register_action (popup_act_grp, X_("selectall"), _("Select All"), sigc::ptr_fun (ProcessorBox::rb_select_all)); - processor_box_actions.register_action (popup_act_grp, X_("deselectall"), _("Deselect All"), + Actions.register_action (popup_act_grp, X_("deselectall"), _("Deselect All"), sigc::ptr_fun (ProcessorBox::rb_deselect_all)); /* activation etc. */ - processor_box_actions.register_action (popup_act_grp, X_("activate_all"), _("Activate All"), + Actions.register_action (popup_act_grp, X_("activate_all"), _("Activate All"), sigc::ptr_fun (ProcessorBox::rb_activate_all)); - processor_box_actions.register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate All"), + Actions.register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate All"), sigc::ptr_fun (ProcessorBox::rb_deactivate_all)); - processor_box_actions.register_action (popup_act_grp, X_("ab_plugins"), _("A/B Plugins"), + Actions.register_action (popup_act_grp, X_("ab_plugins"), _("A/B Plugins"), sigc::ptr_fun (ProcessorBox::rb_ab_plugins)); /* show editors */ - edit_action = processor_box_actions.register_action ( + edit_action = Actions.register_action ( popup_act_grp, X_("edit"), _("Edit..."), sigc::ptr_fun (ProcessorBox::rb_edit)); - edit_generic_action = processor_box_actions.register_action ( + edit_generic_action = Actions.register_action ( popup_act_grp, X_("edit-generic"), _("Edit with generic controls..."), sigc::ptr_fun (ProcessorBox::rb_edit_generic)); - - processor_box_actions.install_action_group (popup_act_grp); } void diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index 151788ec24..f2fc9d2df1 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -323,8 +323,6 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD #endif private: - static Gtkmm2ext::ActionMap processor_box_actions; - /* prevent copy construction */ ProcessorBox (ProcessorBox const &); diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 0274c40474..5c48d2db78 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -422,7 +422,7 @@ class PublicEditor : public Gtkmm2ext::Tabbable { PBD::Signal0 SnapChanged; PBD::Signal0 MouseModeChanged; - Gtkmm2ext::Bindings bindings; + Gtkmm2ext::Bindings* bindings; protected: friend class DisplaySuspender; diff --git a/gtk2_ardour/step_entry.cc b/gtk2_ardour/step_entry.cc index 979327f946..0ae223ff21 100644 --- a/gtk2_ardour/step_entry.cc +++ b/gtk2_ardour/step_entry.cc @@ -498,7 +498,7 @@ StepEntry::on_key_press_event (GdkEventKey* ev) if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) { KeyboardKey k (ev->state, ev->keyval); - if (bindings.activate (k, Bindings::Press)) { + if (bindings->activate (k, Bindings::Press)) { return true; } } @@ -512,7 +512,7 @@ StepEntry::on_key_release_event (GdkEventKey* ev) if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) { KeyboardKey k (ev->state, ev->keyval); - if (bindings.activate (k, Bindings::Release)) { + if (bindings->activate (k, Bindings::Release)) { return true; } } @@ -701,9 +701,9 @@ StepEntry::register_actions () void StepEntry::load_bindings () { - bindings.set_action_map (myactions); - bindings.load (X_("step-editing")); - set_data ("ardour-bindings", &bindings); + bindings = Bindings::get_bindings (X_("step-editing")); + bindings->set_action_map (myactions); + set_data ("ardour-bindings", bindings); } void diff --git a/gtk2_ardour/step_entry.h b/gtk2_ardour/step_entry.h index bd354f3f66..26c46d5c51 100644 --- a/gtk2_ardour/step_entry.h +++ b/gtk2_ardour/step_entry.h @@ -140,7 +140,6 @@ class StepEntry : public ArdourWindow /* actions */ void register_actions (); - Gtkmm2ext::ActionMap myactions; void insert_note (uint8_t); void insert_rest (); @@ -166,7 +165,8 @@ class StepEntry : public ArdourWindow bool radio_button_release (GdkEventButton*, Gtk::RadioButton*, int); void load_bindings (); - Gtkmm2ext::Bindings bindings; + Gtkmm2ext::ActionMap myactions; + Gtkmm2ext::Bindings* bindings; void inc_note_velocity (); void dec_note_velocity (); diff --git a/gtk2_ardour/window_manager.cc b/gtk2_ardour/window_manager.cc index eadfc196c3..eda2943648 100644 --- a/gtk2_ardour/window_manager.cc +++ b/gtk2_ardour/window_manager.cc @@ -22,6 +22,7 @@ #include "ardour/session_handle.h" +#include "gtkmm2ext/bindings.h" #include "gtkmm2ext/visibility_tracker.h" #include "actions.h" @@ -65,13 +66,12 @@ Manager::register_window (ProxyBase* info) if (!info->menu_name().empty()) { if (!window_actions) { - window_actions = ARDOUR_UI::instance()->global_actions.create_action_group (X_("Window")); - ARDOUR_UI::instance()->global_actions.install_action_group (window_actions); + window_actions = Gtkmm2ext::Actions.create_action_group (X_("Window")); } - info->set_action (ARDOUR_UI::instance()->global_actions.register_toggle_action (window_actions, - info->action_name().c_str(), info->menu_name().c_str(), - sigc::bind (sigc::mem_fun (*this, &Manager::toggle_window), info))); + info->set_action (Gtkmm2ext::Actions.register_toggle_action (window_actions, + info->action_name().c_str(), info->menu_name().c_str(), + sigc::bind (sigc::mem_fun (*this, &Manager::toggle_window), info))); } } @@ -90,7 +90,7 @@ void Manager::toggle_window (ProxyBase* proxy) { - Glib::RefPtr act = ARDOUR_UI::instance()->global_actions.find_action (string_compose ("%1/%2", window_actions->get_name(), proxy->action_name())); + Glib::RefPtr act = Gtkmm2ext::Actions.find_action (string_compose ("%1/%2", window_actions->get_name(), proxy->action_name())); if (!act) { return; } diff --git a/libs/gtkmm2ext/actions.cc b/libs/gtkmm2ext/actions.cc index c562816259..7eda4df542 100644 --- a/libs/gtkmm2ext/actions.cc +++ b/libs/gtkmm2ext/actions.cc @@ -53,164 +53,6 @@ using namespace Gtkmm2ext; RefPtr ActionManager::ui_manager; string ActionManager::unbound_string = "--"; -bool -ActionManager::lookup_entry (const ustring accel_path, Gtk::AccelKey& key) -{ - GtkAccelKey gkey; - bool known = gtk_accel_map_lookup_entry (accel_path.c_str(), &gkey); - - if (known) { - key = AccelKey (gkey.accel_key, Gdk::ModifierType (gkey.accel_mods)); - } else { - key = AccelKey (GDK_VoidSymbol, Gdk::ModifierType (0)); - } - - return known; -} - -struct SortActionsByLabel { - bool operator() (Glib::RefPtr a, Glib::RefPtr b) { - ustring astr = a->get_accel_path(); - ustring bstr = b->get_accel_path(); - return astr < bstr; - } -}; - -void -ActionManager::get_all_actions (vector& groups, vector& names, vector& tooltips, vector& bindings) -{ - /* the C++ API for functions used here appears to be broken in - gtkmm2.6, so we fall back to the C level. - */ - - GList* list = gtk_ui_manager_get_action_groups (ui_manager->gobj()); - GList* node; - GList* acts; - - for (node = list; node; node = g_list_next (node)) { - - GtkActionGroup* group = (GtkActionGroup*) node->data; - - /* first pass: collect them all */ - - typedef std::list > action_list; - action_list the_acts; - - for (acts = gtk_action_group_list_actions (group); acts; acts = g_list_next (acts)) { - GtkAction* action = (GtkAction*) acts->data; - the_acts.push_back (Glib::wrap (action, true)); - } - - /* now sort by label */ - - SortActionsByLabel cmp; - the_acts.sort (cmp); - - for (action_list::iterator a = the_acts.begin(); a != the_acts.end(); ++a) { - - string accel_path = (*a)->get_accel_path (); - - groups.push_back (gtk_action_group_get_name(group)); - names.push_back (accel_path.substr (accel_path.find_last_of ('/') + 1)); - tooltips.push_back ((*a)->get_tooltip ()); - - AccelKey key; - lookup_entry (accel_path, key); - bindings.push_back (AccelKey (key.get_key(), Gdk::ModifierType (key.get_mod()))); - } - } -} - -void -ActionManager::get_all_actions (vector& names, vector& paths, vector& tooltips, vector& keys, vector& bindings) -{ - /* the C++ API for functions used here appears to be broken in - gtkmm2.6, so we fall back to the C level. - */ - - GList* list = gtk_ui_manager_get_action_groups (ui_manager->gobj()); - GList* node; - GList* acts; - - for (node = list; node; node = g_list_next (node)) { - - GtkActionGroup* group = (GtkActionGroup*) node->data; - - /* first pass: collect them all */ - - typedef std::list > action_list; - action_list the_acts; - - for (acts = gtk_action_group_list_actions (group); acts; acts = g_list_next (acts)) { - GtkAction* action = (GtkAction*) acts->data; - the_acts.push_back (Glib::wrap (action, true)); - } - - /* now sort by label */ - - SortActionsByLabel cmp; - the_acts.sort (cmp); - - for (action_list::iterator a = the_acts.begin(); a != the_acts.end(); ++a) { - - ustring const label = (*a)->property_label (); - string const accel_path = (*a)->get_accel_path (); - - names.push_back (label); - paths.push_back (accel_path); - tooltips.push_back ((*a)->get_tooltip ()); - - AccelKey key; - keys.push_back (get_key_representation (accel_path, key)); - bindings.push_back (AccelKey (key.get_key(), Gdk::ModifierType (key.get_mod()))); - } - } -} - -void -ActionManager::enable_accelerators () -{ - /* the C++ API for functions used here appears to be broken in - gtkmm2.6, so we fall back to the C level. - */ - - GList* list = gtk_ui_manager_get_action_groups (ui_manager->gobj()); - GList* node; - GList* acts; - string ui_string = ""; - - /* get all actions, build a string describing them all as - */ - - for (node = list; node; node = g_list_next (node)) { - - GtkActionGroup* group = (GtkActionGroup*) node->data; - - for (acts = gtk_action_group_list_actions (group); acts; acts = g_list_next (acts)) { - ui_string += "data); - - ui_string += Glib::path_get_basename (fullpath); - ui_string += "\"/>"; - } - } - - ui_string += ""; - - /* and load it */ - - ui_manager->add_ui_from_string (ui_string); -} - struct ActionState { GtkAction* action; bool sensitive; @@ -278,12 +120,6 @@ ActionManager::disable_active_actions () actions_disabled = true; } -void -ActionManager::add_action_group (RefPtr grp) -{ - ui_manager->insert_action_group (grp); -} - Widget* ActionManager::get_widget (const char * name) { @@ -357,32 +193,6 @@ ActionManager::get_action (const char* group_name, const char* action_name) return act; } -RefPtr -ActionManager::get_action_from_name (const char* name) -{ - /* the C++ API for functions used here appears to be broken in - gtkmm2.6, so we fall back to the C level. - */ - - GList* list = gtk_ui_manager_get_action_groups (ui_manager->gobj()); - GList* node; - GList* acts; - - for (node = list; node; node = g_list_next (node)) { - - GtkActionGroup* group = (GtkActionGroup*) node->data; - - for (acts = gtk_action_group_list_actions (group); acts; acts = g_list_next (acts)) { - GtkAction* action = (GtkAction*) acts->data; - if (!strcmp (gtk_action_get_name (action), name)) { - return Glib::wrap (action, true); - } - } - } - - return RefPtr(); -} - void ActionManager::set_sensitive (vector >& actions, bool state) { @@ -452,20 +262,6 @@ ActionManager::set_toggleaction_state (string n, bool s) delete [] group_name; } -string -ActionManager::get_key_representation (const string& accel_path, AccelKey& key) -{ - bool known = lookup_entry (accel_path, key); - - if (known) { - uint32_t k = possibly_translate_legal_accelerator_to_real_key (key.get_key()); - key = AccelKey (k, Gdk::ModifierType (key.get_mod())); - return ui_manager->get_accel_group()->get_label (key.get_key(), Gdk::ModifierType (key.get_mod())); - } - - return unbound_string; -} - void ActionManager::do_action (const char* group, const char*action) { diff --git a/libs/gtkmm2ext/bindings.cc b/libs/gtkmm2ext/bindings.cc index fc05ec0336..232405bb97 100644 --- a/libs/gtkmm2ext/bindings.cc +++ b/libs/gtkmm2ext/bindings.cc @@ -42,8 +42,9 @@ using namespace Gtk; using namespace Gtkmm2ext; using namespace PBD; +ActionMap Gtkmm2ext::Actions; /* global. Gulp */ +list Bindings::bindings; /* global. Gulp */ uint32_t Bindings::_ignored_state = 0; -map Bindings::bindings_for_state; MouseButton::MouseButton (uint32_t state, uint32_t keycode) { @@ -228,16 +229,24 @@ KeyboardKey::make_key (const string& str, KeyboardKey& k) return true; } -Bindings::Bindings () - : action_map (0) +Bindings::Bindings (std::string const& name) + : _name (name) + , _action_map (Actions) { + bindings.push_back (this); } Bindings::~Bindings() { - if (!_name.empty()) { - remove_bindings_for_state (_name, *this); - } + bindings.remove (this); +} + +void +Bindings::set_action_map (ActionMap& actions) +{ + _action_map = actions; + dissociate (); + associate (); } bool @@ -258,14 +267,6 @@ Bindings::empty() const return empty_keys() && empty_mouse (); } -void -Bindings::set_action_map (ActionMap& am) -{ - action_map = &am; - press_bindings.clear (); - release_bindings.clear (); -} - bool Bindings::activate (KeyboardKey kb, Operation op) { @@ -288,21 +289,118 @@ Bindings::activate (KeyboardKey kb, Operation op) return false; } - /* lets do it ... */ + RefPtr action; + + if (!k->second.action) { + action = _action_map.find_action (k->second.action_name); + } + + if (action) { + /* lets do it ... */ + DEBUG_TRACE (DEBUG::Bindings, string_compose ("binding for %1: %2\n", kb, k->second.action_name)); + action->activate (); + } - DEBUG_TRACE (DEBUG::Bindings, string_compose ("binding for %1: %2\n", kb, k->second->get_name())); + /* return true even if the action could not be found */ - k->second->activate (); return true; } -bool -Bindings::replace (KeyboardKey kb, Operation op, string const & action_name, bool can_save) +void +Bindings::associate () +{ + KeybindingMap::iterator k; + + for (k = press_bindings.begin(); k != press_bindings.end(); ++k) { + k->second.action = _action_map.find_action (k->second.action_name); + if (k->second.action) { + push_to_gtk (k->first, k->second.action); + } + } + + for (k = release_bindings.begin(); k != release_bindings.end(); ++k) { + k->second.action = _action_map.find_action (k->second.action_name); + /* no working support in GTK for release bindings */ + } + + MouseButtonBindingMap::iterator b; + + for (b = button_press_bindings.begin(); b != button_press_bindings.end(); ++b) { + b->second.action = _action_map.find_action (b->second.action_name); + } + + for (b = button_release_bindings.begin(); b != button_release_bindings.end(); ++b) { + b->second.action = _action_map.find_action (b->second.action_name); + } +} + +void +Bindings::dissociate () { - if (!action_map) { - return false; + KeybindingMap::iterator k; + + for (k = press_bindings.begin(); k != press_bindings.end(); ++k) { + k->second.action.clear (); + } + for (k = release_bindings.begin(); k != release_bindings.end(); ++k) { + k->second.action.clear (); } +} + +void +Bindings::push_to_gtk (KeyboardKey kb, RefPtr what) +{ + /* GTK has the useful feature of showing key bindings for actions in + * menus. As of August 2015, we have no interest in trying to + * reimplement this functionality, so we will use it even though we no + * longer use GTK accelerators for handling key events. To do this, we + * need to make sure that there is a fully populated GTK AccelMap set + * up with all bindings/actions. + */ + + Gtk::AccelKey gtk_key; + + /* tweak the modifier used in the binding so that GTK will accept it + * and display something acceptable. The actual keyval should display + * correctly even if it involves a key that GTK would not allow + * as an accelerator. + */ + uint32_t gtk_legal_keyval = kb.key(); + possibly_translate_keyval_to_make_legal_accelerator (gtk_legal_keyval); + KeyboardKey gtk_binding (kb.state(), gtk_legal_keyval); + + + bool entry_exists = Gtk::AccelMap::lookup_entry (what->get_accel_path(), gtk_key); + + if (!entry_exists || gtk_key.get_key() == 0) { + + /* there is a trick happening here. It turns out that + * gtk_accel_map_add_entry() performs no validation checks on + * the accelerator keyval. This means we can use it to define + * ANY accelerator, even if they violate GTK's rules + * (e.g. about not using navigation keys). This works ONLY when + * the entry in the GTK accelerator map has not already been + * added. The entries will be added by the GTK UIManager when + * building menus, so this code must be called before that + * happens. + */ + + Gtk::AccelMap::add_entry (what->get_accel_path(), + gtk_binding.key(), + (Gdk::ModifierType) gtk_binding.state()); + } else { + warning << string_compose (_("There is more than one key binding defined for %1. Both will work, but only the first will be visible in menus"), what->get_accel_path()) << endmsg; + } + + if (!Gtk::AccelMap::lookup_entry (what->get_accel_path(), gtk_key) || gtk_key.get_key() == 0) { + cerr << "GTK binding using " << gtk_binding << " failed for " << what->get_accel_path() << " existing = " << gtk_key.get_key() << " + " << gtk_key.get_mod() << endl; + } +} + +bool +Bindings::replace (KeyboardKey kb, Operation op, string const & action_name, bool can_save) +{ /* We have to search the existing binding map by both action and * keybinding, because the following are possible: * @@ -312,7 +410,7 @@ Bindings::replace (KeyboardKey kb, Operation op, string const & action_name, boo * - action is not bound */ - RefPtr action = action_map->find_action (action_name); + RefPtr action = Actions.find_action (action_name); if (!action) { return false; @@ -338,13 +436,13 @@ Bindings::replace (KeyboardKey kb, Operation op, string const & action_name, boo /* now linear search by action */ for (k = kbm->begin(); k != kbm->end(); ++k) { - if (k->second == action) { + if (k->second.action_name == action_name) { kbm->erase (k); break; } } - add (kb, op, action, can_save); + add (kb, op, action_name, can_save); /* for now, this never fails */ @@ -352,7 +450,7 @@ Bindings::replace (KeyboardKey kb, Operation op, string const & action_name, boo } void -Bindings::add (KeyboardKey kb, Operation op, RefPtr what, bool can_save) +Bindings::add (KeyboardKey kb, Operation op, string const& action_name, bool can_save) { KeybindingMap* kbm = 0; @@ -367,59 +465,12 @@ Bindings::add (KeyboardKey kb, Operation op, RefPtr what, bool can_save) KeybindingMap::iterator k = kbm->find (kb); - if (k == kbm->end()) { - pair > newpair (kb, what); - kbm->insert (newpair); - } else { - k->second = what; - } - - /* GTK has the useful feature of showing key bindings for actions in - * menus. As of August 2015, we have no interest in trying to - * reimplement this functionality, so we will use it even though we no - * longer use GTK accelerators for handling key events. To do this, we - * need to make sure that there is a fully populated GTK AccelMap set - * up with all bindings/actions. - */ - - Gtk::AccelKey gtk_key; - - /* tweak the modifier used in the binding so that GTK will accept it - * and display something acceptable. The actual keyval should display - * correctly even if it involves a key that GTK would not allow - * as an accelerator. - */ - - uint32_t gtk_legal_keyval = kb.key(); - possibly_translate_keyval_to_make_legal_accelerator (gtk_legal_keyval); - KeyboardKey gtk_binding (kb.state(), gtk_legal_keyval); + if (k != kbm->end()) { + kbm->erase (k); + } + KeybindingMap::value_type new_pair (kb, ActionInfo (action_name)); - - bool entry_exists = Gtk::AccelMap::lookup_entry (what->get_accel_path(), gtk_key); - - if (!entry_exists || gtk_key.get_key() == 0) { - - /* there is a trick happening here. It turns out that - * gtk_accel_map_add_entry() performs no validation checks on - * the accelerator keyval. This means we can use it to define - * ANY accelerator, even if they violate GTK's rules - * (e.g. about not using navigation keys). This works ONLY when - * the entry in the GTK accelerator map has not already been - * added. The entries will be added by the GTK UIManager when - * building menus, so this code must be called before that - * happens. - */ - - Gtk::AccelMap::add_entry (what->get_accel_path(), - gtk_binding.key(), - (Gdk::ModifierType) gtk_binding.state()); - } else { - warning << string_compose (_("There is more than one key binding defined for %1. Both will work, but only the first will be visible in menus"), what->get_accel_path()) << endmsg; - } - - if (!Gtk::AccelMap::lookup_entry (what->get_accel_path(), gtk_key) || gtk_key.get_key() == 0) { - cerr << "GTK binding using " << gtk_binding << " failed for " << what->get_accel_path() << " existing = " << gtk_key.get_key() << " + " << gtk_key.get_mod() << endl; - } + kbm->insert (new_pair).first; if (can_save) { Keyboard::keybindings_changed (); @@ -466,7 +517,7 @@ Bindings::remove (RefPtr action, Operation op, bool can_save) } for (KeybindingMap::iterator k = kbm->begin(); k != kbm->end(); ++k) { - if (k->second == action) { + if (k->second.action == action) { kbm->erase (k); break; } @@ -498,14 +549,24 @@ Bindings::activate (MouseButton bb, Operation op) return false; } - /* lets do it ... */ + RefPtr action; + + if (!b->second.action) { + action = _action_map.find_action (b->second.action_name); + } + + if (action) { + /* lets do it ... */ + action->activate (); + } - b->second->activate (); + /* return true even if the action could not be found */ + return true; } void -Bindings::add (MouseButton bb, Operation op, RefPtr what) +Bindings::add (MouseButton bb, Operation op, string const& action_name) { MouseButtonBindingMap* bbm = 0; @@ -518,15 +579,8 @@ Bindings::add (MouseButton bb, Operation op, RefPtr what) break; } - MouseButtonBindingMap::iterator b = bbm->find (bb); - - if (b == bbm->end()) { - pair > newpair (bb, what); - bbm->insert (newpair); - // cerr << "Bindings added mouse button " << bb.button() << " w/ " << bb.state() << " => " << what->get_name() << endl; - } else { - b->second = what; - } + MouseButtonBindingMap::value_type newpair (bb, ActionInfo (action_name)); + bbm->insert (newpair); } void @@ -550,23 +604,6 @@ Bindings::remove (MouseButton bb, Operation op) } } -bool -Bindings::save (const string& path) -{ - XMLTree tree; - XMLNode* root = new XMLNode (X_("Bindings")); - tree.set_root (root); - - save (*root); - - if (!tree.write (path)) { - ::g_unlink (path.c_str()); - return false; - } - - return true; -} - void Bindings::save (XMLNode& root) { @@ -581,8 +618,7 @@ Bindings::save (XMLNode& root) child = new XMLNode (X_("Binding")); child->add_property (X_("key"), k->first.name()); - string ap = k->second->get_accel_path(); - child->add_property (X_("action"), ap.substr (ap.find ('/') + 1)); + child->add_property (X_("action"), k->second.action_name); presses->add_child_nocopy (*child); } @@ -590,8 +626,7 @@ Bindings::save (XMLNode& root) XMLNode* child; child = new XMLNode (X_("Binding")); child->add_property (X_("button"), k->first.name()); - string ap = k->second->get_accel_path(); - child->add_property (X_("action"), ap.substr (ap.find ('/') + 1)); + child->add_property (X_("action"), k->second.action_name); presses->add_child_nocopy (*child); } @@ -606,8 +641,7 @@ Bindings::save (XMLNode& root) child = new XMLNode (X_("Binding")); child->add_property (X_("key"), k->first.name()); - string ap = k->second->get_accel_path(); - child->add_property (X_("action"), ap.substr (ap.find ('/') + 1)); + child->add_property (X_("action"), k->second.action_name); releases->add_child_nocopy (*child); } @@ -615,8 +649,7 @@ Bindings::save (XMLNode& root) XMLNode* child; child = new XMLNode (X_("Binding")); child->add_property (X_("button"), k->first.name()); - string ap = k->second->get_accel_path(); - child->add_property (X_("action"), ap.substr (ap.find ('/') + 1)); + child->add_property (X_("action"), k->second.action_name); releases->add_child_nocopy (*child); } @@ -625,68 +658,23 @@ Bindings::save (XMLNode& root) } bool -Bindings::load (string const & name) +Bindings::load (XMLNode const& node) { - XMLTree tree; - - if (!action_map) { - return false; - } - - XMLNode const * node = Keyboard::bindings_node(); - - if (!node) { - error << string_compose (_("No keyboard binding information when loading bindings for \"%1\""), name) << endmsg; - return false; - } - - if (!_name.empty()) { - remove_bindings_for_state (_name, *this); - } - - const XMLNodeList& children (node->children()); - bool found = false; - - for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) { - - if ((*i)->name() == X_("Bindings")) { - XMLProperty const * prop = (*i)->property (X_("name")); - - if (!prop) { - continue; - } - - if (prop->value() == name) { - found = true; - node = *i; - break; - } - } - } + const XMLNodeList& children (node.children()); - if (!found) { - error << string_compose (_("Bindings for \"%1\" not found in keyboard binding node\n"), name) << endmsg; - return false; - } - press_bindings.clear (); release_bindings.clear (); - const XMLNodeList& bindings (node->children()); - - for (XMLNodeList::const_iterator i = bindings.begin(); i != bindings.end(); ++i) { + for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) { /* each node could be Press or Release */ - load (**i); + load_operation (**i); } - _name = name; - add_bindings_for_state (_name, *this); - return true; } void -Bindings::load (const XMLNode& node) +Bindings::load_operation (XMLNode const& node) { if (node.name() == X_("Press") || node.name() == X_("Release")) { @@ -714,37 +702,18 @@ Bindings::load (const XMLNode& node) continue; } - RefPtr act; - - if (action_map) { - act = action_map->find_action (ap->value()); - } - - if (!act) { - string::size_type slash = ap->value().find ('/'); - if (slash != string::npos) { - string group = ap->value().substr (0, slash); - string action = ap->value().substr (slash+1); - act = ActionManager::get_action (group.c_str(), action.c_str()); - } - } - - if (!act) { - continue; - } - if (kp) { KeyboardKey k; if (!KeyboardKey::make_key (kp->value(), k)) { continue; } - add (k, op, act); + add (k, op, ap->value()); } else { MouseButton b; if (!MouseButton::make_button (bp->value(), b)) { continue; } - add (b, op, act); + add (b, op, ap->value()); } } } @@ -757,23 +726,19 @@ Bindings::get_all_actions (std::vector& paths, std::vector& keys, std::vector >& actions) { - if (!action_map) { - return; - } - /* build a reverse map from actions to bindings */ typedef map,KeyboardKey> ReverseMap; ReverseMap rmap; for (KeybindingMap::const_iterator k = press_bindings.begin(); k != press_bindings.end(); ++k) { - rmap.insert (make_pair (k->second, k->first)); + rmap.insert (make_pair (k->second.action, k->first)); } /* get a list of all actions */ ActionMap::Actions all_actions; - action_map->get_actions (all_actions); + _action_map.get_actions (all_actions); for (ActionMap::Actions::const_iterator act = all_actions.begin(); act != all_actions.end(); ++act) { @@ -804,15 +769,16 @@ Bindings::get_all_actions (std::vector& names, ReverseMap rmap; for (KeybindingMap::const_iterator k = press_bindings.begin(); k != press_bindings.end(); ++k) { - rmap.insert (make_pair (k->second, k->first)); + rmap.insert (make_pair (k->second.action, k->first)); } /* get a list of all actions */ - ActionMap::Actions actions; - action_map->get_actions (actions); + ActionMap::Actions all_actions; + _action_map.get_actions (all_actions); - for (ActionMap::Actions::const_iterator act = actions.begin(); act != actions.end(); ++act) { + for (ActionMap::Actions::const_iterator act = all_actions.begin(); act != all_actions.end(); ++act) { + names.push_back ((*act)->get_name()); paths.push_back ((*act)->get_accel_path()); @@ -825,10 +791,32 @@ Bindings::get_all_actions (std::vector& names, } } +Bindings* +Bindings::get_bindings (string const& name) +{ + for (list::iterator b = bindings.begin(); b != bindings.end(); b++) { + if ((*b)->name() == name) { + return *b; + } + } + + return 0; +} + +void +Bindings::associate_all () +{ + for (list::iterator b = bindings.begin(); b != bindings.end(); b++) { + (*b)->associate (); + } +} + +/*==========================================ACTION MAP =========================================*/ + void ActionMap::get_actions (ActionMap::Actions& acts) { - for (_ActionMap::iterator a = actions.begin(); a != actions.end(); ++a) { + for (_ActionMap::iterator a = _actions.begin(); a != _actions.end(); ++a) { acts.push_back (a->second); } } @@ -836,9 +824,9 @@ ActionMap::get_actions (ActionMap::Actions& acts) RefPtr ActionMap::find_action (const string& name) { - _ActionMap::iterator a = actions.find (name); + _ActionMap::iterator a = _actions.find (name); - if (a != actions.end()) { + if (a != _actions.end()) { return a->second; } @@ -849,13 +837,19 @@ RefPtr ActionMap::create_action_group (const string& name) { RefPtr g = ActionGroup::create (name); - return g; -} -void -ActionMap::install_action_group (RefPtr group) -{ - ActionManager::ui_manager->insert_action_group (group); + /* this is one of the places where our own Action management code + has to touch the GTK one, because we want the GtkUIManager to + be able to create widgets (particularly Menus) from our actions. + + This is a a necessary step for that to happen. + */ + + if (g) { + ActionManager::ui_manager->insert_action_group (g); + } + + return g; } RefPtr @@ -869,7 +863,7 @@ ActionMap::register_action (RefPtr group, const char* name, const c fullpath += '/'; fullpath += name; - if (actions.insert (_ActionMap::value_type (fullpath, act)).second) { + if (_actions.insert (_ActionMap::value_type (fullpath, act)).second) { group->add (act); return act; } @@ -890,7 +884,7 @@ ActionMap::register_action (RefPtr group, fullpath += '/'; fullpath += name; - if (actions.insert (_ActionMap::value_type (fullpath, act)).second) { + if (_actions.insert (_ActionMap::value_type (fullpath, act)).second) { group->add (act, sl); return act; } @@ -914,7 +908,7 @@ ActionMap::register_radio_action (RefPtr group, fullpath += '/'; fullpath += name; - if (actions.insert (_ActionMap::value_type (fullpath, act)).second) { + if (_actions.insert (_ActionMap::value_type (fullpath, act)).second) { group->add (act, sl); return act; } @@ -940,7 +934,7 @@ ActionMap::register_radio_action (RefPtr group, fullpath += '/'; fullpath += name; - if (actions.insert (_ActionMap::value_type (fullpath, act)).second) { + if (_actions.insert (_ActionMap::value_type (fullpath, act)).second) { group->add (act, sigc::bind (sl, act->gobj())); return act; } @@ -962,7 +956,7 @@ ActionMap::register_toggle_action (RefPtr group, RefPtr act = ToggleAction::create (name, label); - if (actions.insert (_ActionMap::value_type (fullpath, act)).second) { + if (_actions.insert (_ActionMap::value_type (fullpath, act)).second) { group->add (act, sl); return act; } @@ -971,18 +965,6 @@ ActionMap::register_toggle_action (RefPtr group, return RefPtr(); } -void -Bindings::add_bindings_for_state (std::string const& name, Bindings& bindings) -{ - bindings_for_state.insert (make_pair (name, &bindings)); -} - -void -Bindings::remove_bindings_for_state (std::string const& name, Bindings& bindings) -{ - bindings_for_state.erase (name); -} - std::ostream& operator<<(std::ostream& out, Gtkmm2ext::KeyboardKey const & k) { char const *gdk_name = gdk_keyval_name (k.key()); return out << "Key " << k.key() << " (" << (gdk_name ? gdk_name : "no-key") << ") state " << k.state(); diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc index 64fef47ca5..6ae50db9a8 100644 --- a/libs/gtkmm2ext/gtk_ui.cc +++ b/libs/gtkmm2ext/gtk_ui.cc @@ -365,10 +365,11 @@ UI::set_tip (Widget *w, const gchar *tip, const gchar *hlp) } if (action) { +#warning Paul fix this before you think tabbed is done Gtk::AccelKey key; ustring ap = action->get_accel_path(); if (!ap.empty()) { - string shortcut = ActionManager::get_key_representation (ap, key); + string shortcut = string(); // ActionManager::get_key_representation (ap, key); if (!shortcut.empty()) { replace_all (shortcut, "<", ""); replace_all (shortcut, ">", "-"); diff --git a/libs/gtkmm2ext/gtkmm2ext/actions.h b/libs/gtkmm2ext/gtkmm2ext/actions.h index f0f4ffc572..88b9628273 100644 --- a/libs/gtkmm2ext/gtkmm2ext/actions.h +++ b/libs/gtkmm2ext/gtkmm2ext/actions.h @@ -45,26 +45,10 @@ namespace ActionManager { LIBGTKMM2EXT_API extern Gtk::Widget* get_widget (const char * name); LIBGTKMM2EXT_API extern Glib::RefPtr get_action (const char* group, const char* name); LIBGTKMM2EXT_API extern Glib::RefPtr get_action (const char* path); - LIBGTKMM2EXT_API extern Glib::RefPtr get_action_from_name (const char* name); + LIBGTKMM2EXT_API extern void do_action (const char* group, const char* name); LIBGTKMM2EXT_API extern void set_toggle_action (const char* group, const char* name, bool); - LIBGTKMM2EXT_API extern void add_action_group (Glib::RefPtr); - LIBGTKMM2EXT_API extern void enable_accelerators (); - - LIBGTKMM2EXT_API extern bool lookup_entry (const Glib::ustring accel_path, Gtk::AccelKey& key); - - LIBGTKMM2EXT_API extern void get_all_actions (std::vector& names, - std::vector& paths, - std::vector& tooltips, - std::vector& keys, - std::vector& bindings); - - LIBGTKMM2EXT_API extern void get_all_actions (std::vector& groups, - std::vector& paths, - std::vector& tooltips, - std::vector& bindings); - LIBGTKMM2EXT_API extern void check_toggleaction (std::string); LIBGTKMM2EXT_API extern void uncheck_toggleaction (std::string); LIBGTKMM2EXT_API extern void set_toggleaction_state (std::string, bool); diff --git a/libs/gtkmm2ext/gtkmm2ext/bindings.h b/libs/gtkmm2ext/gtkmm2ext/bindings.h index af451e10ed..c586676e3c 100644 --- a/libs/gtkmm2ext/gtkmm2ext/bindings.h +++ b/libs/gtkmm2ext/gtkmm2ext/bindings.h @@ -2,7 +2,11 @@ #define __libgtkmm2ext_bindings_h__ #include +#include +#include + #include + #include #include #include @@ -74,19 +78,13 @@ class LIBGTKMM2EXT_API ActionMap { ~ActionMap() {} Glib::RefPtr create_action_group (const std::string& group_name); - void install_action_group (Glib::RefPtr); - + Glib::RefPtr register_action (Glib::RefPtr group, const char* name, const char* label); Glib::RefPtr register_action (Glib::RefPtr group, const char* name, const char* label, sigc::slot sl); -<<<<<<< HEAD - Glib::RefPtr register_radio_action (const char* path, Gtk::RadioAction::Group&, - const char* name, const char* label, -======= Glib::RefPtr register_radio_action (Glib::RefPtr group, Gtk::RadioAction::Group&, const char* name, const char* label, ->>>>>>> changes to Bindings and Keyboard API to support (mostly) GTK-free keyboard bindings sigc::slot sl, int value); Glib::RefPtr register_radio_action (Glib::RefPtr group, @@ -100,11 +98,28 @@ class LIBGTKMM2EXT_API ActionMap { typedef std::vector > Actions; void get_actions (Actions&); - + private: +<<<<<<< HEAD typedef std::map > _ActionMap; _ActionMap actions; }; +======= + /* hash for faster lookup of actions by name */ + + typedef std::map > _ActionMap; + _ActionMap _actions; +}; +>>>>>>> radically change Keyboard/Binding API design to disconnect Gtk::Action lookup from binding definition + +/* single global action map for entire application. + * + * Actions are name-spaced by group, and it makes things + * much easier if there is a single place to look up + * any action. + */ + +LIBGTKMM2EXT_API extern ActionMap Actions; class LIBGTKMM2EXT_API Bindings { public: @@ -113,36 +128,56 @@ class LIBGTKMM2EXT_API Bindings { Release }; +<<<<<<< HEAD Bindings(); +======= + struct ActionInfo { + ActionInfo (std::string const& name) : action_name (name) {} + + std::string action_name; + Glib::RefPtr action; + }; + + Bindings (std::string const& name); +>>>>>>> radically change Keyboard/Binding API design to disconnect Gtk::Action lookup from binding definition ~Bindings (); + std::string const& name() const { return _name; } + + void associate (); + void dissociate (); + bool empty() const; bool empty_keys () const; bool empty_mouse () const; - void add (KeyboardKey, Operation, Glib::RefPtr, bool can_save = false); + void add (KeyboardKey, Operation, std::string const&, bool can_save = false); bool replace (KeyboardKey, Operation, std::string const& action_name, bool can_save = true); void remove (KeyboardKey, Operation, bool can_save = false); void remove (Glib::RefPtr, Operation, bool can_save = false); bool activate (KeyboardKey, Operation); - void add (MouseButton, Operation, Glib::RefPtr); + void add (MouseButton, Operation, std::string const&); void remove (MouseButton, Operation); bool activate (MouseButton, Operation); - bool load (const std::string& path); - void load (const XMLNode& node); - bool save (const std::string& path); + bool load (XMLNode const& node); + void load_operation (XMLNode const& node); void save (XMLNode& root); +<<<<<<< HEAD void set_action_map (ActionMap&); +======= +>>>>>>> radically change Keyboard/Binding API design to disconnect Gtk::Action lookup from binding definition static void set_ignored_state (int mask) { _ignored_state = mask; } static uint32_t ignored_state() { return _ignored_state; } + void set_action_map (ActionMap&); + /* used to list all actions */ void get_all_actions (std::vector& names, std::vector& paths, @@ -155,24 +190,26 @@ class LIBGTKMM2EXT_API Bindings { std::vector& keys, std::vector >& actions); - static std::map bindings_for_state; - - static void add_bindings_for_state (std::string const &, Bindings&); - static void remove_bindings_for_state (std::string const &, Bindings&); + /* all bindings currently in existence, as grouped into Bindings */ + static std::list bindings; + static Bindings* get_bindings (std::string const& name); + static void associate_all (); private: - typedef std::map > KeybindingMap; + typedef std::map KeybindingMap; std::string _name; + ActionMap& _action_map; KeybindingMap press_bindings; KeybindingMap release_bindings; - typedef std::map > MouseButtonBindingMap; + typedef std::map MouseButtonBindingMap; MouseButtonBindingMap button_press_bindings; MouseButtonBindingMap button_release_bindings; - ActionMap* action_map; static uint32_t _ignored_state; + + void push_to_gtk (KeyboardKey, Glib::RefPtr); }; } // namespace diff --git a/libs/gtkmm2ext/gtkmm2ext/keyboard.h b/libs/gtkmm2ext/gtkmm2ext/keyboard.h index 97d42f5cc8..48a1bdcaad 100644 --- a/libs/gtkmm2ext/gtkmm2ext/keyboard.h +++ b/libs/gtkmm2ext/gtkmm2ext/keyboard.h @@ -29,6 +29,7 @@ #include #include "pbd/stateful.h" +#include "pbd/signals.h" #include "gtkmm2ext/visibility.h" @@ -38,6 +39,8 @@ namespace Gtk { namespace Gtkmm2ext { +class Bindings; + class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful { public: @@ -170,12 +173,14 @@ class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful static bool load_keybindings (std::string const& path); static void save_keybindings (std::string const& path); - static XMLNode const * bindings_node() { return _bindings_node; } - int reset_bindings (); sigc::signal0 ZoomVerticalModifierReleased; + static std::vector bindings; + static Bindings* get_bindings (std::string const& name); + static PBD::Signal0 BindingsChanged; + protected: static Keyboard* _the_keyboard; @@ -196,7 +201,6 @@ class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful static bool can_save_keybindings; static bool bindings_changed_after_save_became_legal; static std::string _current_binding_name; - static XMLNode* _bindings_node; typedef std::pair two_strings; diff --git a/libs/gtkmm2ext/keyboard.cc b/libs/gtkmm2ext/keyboard.cc index b1f5d5561a..1b3f661e60 100644 --- a/libs/gtkmm2ext/keyboard.cc +++ b/libs/gtkmm2ext/keyboard.cc @@ -112,7 +112,7 @@ bool Keyboard::bindings_changed_after_save_became_legal = false; map Keyboard::binding_files; string Keyboard::_current_binding_name; Gtk::Window* Keyboard::pre_dialog_active_window = 0; -XMLNode* Keyboard::_bindings_node = 0; +PBD::Signal0 Keyboard::BindingsChanged; /* set this to initially contain the modifiers we care about, then track changes in ::set_edit_modifier() etc. */ GdkModifierType Keyboard::RelevantModifierKeyMask; @@ -643,6 +643,7 @@ Keyboard::keybindings_changed () } Keyboard::save_keybindings (); + BindingsChanged (); /* EMIT SIGNAL */ } void @@ -697,7 +698,22 @@ Keyboard::read_keybindings (string const & path) return -1; } - _bindings_node = new XMLNode (*tree.root ()); /* copy operation. Sorry */ + /* toplevel node is "BindingSet; children are "Bindings" */ + + XMLNodeList const& children = tree.root()->children(); + + for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) { + if ((*i)->name() == X_("Bindings")) { + XMLProperty const* name = (*i)->property (X_("name")); + if (!name) { + warning << _("Keyboard binding found without a name") << endmsg; + continue; + } + + Bindings* b = new Bindings (name->value()); + b->load (**i); + } + } return 0; } @@ -709,10 +725,10 @@ Keyboard::store_keybindings (string const & path) XMLNode* bnode; int ret = 0; - for (map::const_iterator c = Bindings::bindings_for_state.begin(); c != Bindings::bindings_for_state.end(); ++c) { + for (list::const_iterator b = Bindings::bindings.begin(); b != Bindings::bindings.end(); ++b) { bnode = new XMLNode (X_("Bindings")); - bnode->add_property (X_("name"), c->first); - c->second->save (*bnode); + bnode->add_property (X_("name"), (*b)->name()); + (*b)->save (*bnode); node->add_child_nocopy (*bnode); } @@ -744,6 +760,7 @@ Keyboard::reset_bindings () { PBD::Unwinder uw (can_save_keybindings, false); setup_keybindings (); + Bindings::associate_all (); } return 0; diff --git a/libs/surfaces/mackie/gui.cc b/libs/surfaces/mackie/gui.cc index 5d9208b663..599610f7ec 100644 --- a/libs/surfaces/mackie/gui.cc +++ b/libs/surfaces/mackie/gui.cc @@ -456,7 +456,8 @@ MackieControlProtocolGUI::build_available_action_menu () NodeMap nodes; NodeMap::iterator r; - ActionManager::get_all_actions (labels, paths, tooltips, keys, bindings); +#warning Paul fix this before you think tabbed is done + // get_all_actions (labels, paths, tooltips, keys, bindings); vector::iterator k; vector::iterator p; -- cgit v1.2.3