diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index d9a364441d..9843fb71db 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -376,6 +376,21 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) xmlSetGenericErrorFunc (this, libxml_generic_error_func); xmlSetStructuredErrorFunc (this, libxml_structured_error_func); + /* Set this up early */ + + ActionManager::init (); + + /* we like keyboards */ + + keyboard = new ArdourKeyboard(*this); + + XMLNode* node = ARDOUR_UI::instance()->keyboard_settings(); + if (node) { + keyboard->set_state (*node, Stateful::loading_state_version); + } + + install_actions (); + UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::parameter_changed)); boost::function pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1)); UIConfiguration::instance().map_parameters (pc); @@ -439,23 +454,10 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) SessionEvent::create_per_thread_pool ("GUI", 4096); - /* we like keyboards */ - - keyboard = new ArdourKeyboard(*this); - - XMLNode* node = ARDOUR_UI::instance()->keyboard_settings(); - if (node) { - keyboard->set_state (*node, Stateful::loading_state_version); - } - UIConfiguration::instance().reset_dpi (); TimeAxisViewItem::set_constant_heights (); - /* Set this up so that our window proxies can register actions */ - - ActionManager::init (); - /* The following must happen after ARDOUR::init() so that Config is set up */ const XMLNode* ui_xml = Config->extra_xml (X_("UI")); @@ -5857,7 +5859,7 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey } } - DEBUG_TRACE (DEBUG::Accelerators, "\tnot yet handled, try global bindings\n"); + DEBUG_TRACE (DEBUG::Accelerators, string_compose ("\tnot yet handled, try global bindings (%1)\n", global_bindings)); if (global_bindings && global_bindings->activate (k, Bindings::Press)) { DEBUG_TRACE (DEBUG::Accelerators, "\t\thandled\n"); @@ -5907,7 +5909,7 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey } } - DEBUG_TRACE (DEBUG::Accelerators, "\tnot yet handled, try global bindings\n"); + DEBUG_TRACE (DEBUG::Accelerators, string_compose ("\tnot yet handled, try global bindings (%1)\n", global_bindings)); if (global_bindings && global_bindings->activate (k, Bindings::Press)) { DEBUG_TRACE (DEBUG::Accelerators, "\t\thandled\n"); diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 633cdd06a6..d5fa18da73 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -719,6 +719,7 @@ private: /* Keymap handling */ void install_actions (); + void install_dependent_actions (); void toggle_record_enable (uint16_t); diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index 1ab8277fff..dcf5761769 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -75,7 +75,8 @@ ARDOUR_UI::we_have_dependents () error << _("Global keybindings are missing") << endmsg; } - install_actions (); + install_dependent_actions (); + /* The monitor section relies on at least 1 action defined by us. Since that * action now exists, give it a chance to use it. */ @@ -85,7 +86,7 @@ ARDOUR_UI::we_have_dependents () */ ProcessorBox::register_actions (); StepEntry::setup_actions_and_bindings (); - + /* Global, editor, mixer, processor box actions are defined now. Link them with any bindings, so that GTK does not get a chance to define the GTK accel map entries first when we ask the GtkUIManager to diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index de039a11ba..a1861836aa 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -235,12 +235,6 @@ ARDOUR_UI::install_actions () act = ActionManager::register_action (main_actions, X_("ImportMetadata"), _("Import Metadata..."), sigc::mem_fun(*this, &ARDOUR_UI::import_metadata)); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::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 = ActionManager::register_action (main_actions, X_("StemExport"), _("Stem export..."), sigc::mem_fun (*editor, &PublicEditor::stem_export)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (main_actions, X_("Export"), _("Export")); ActionManager::session_sensitive_actions.push_back (act); @@ -263,120 +257,6 @@ ARDOUR_UI::install_actions () ActionManager::register_action (common_actions, X_("Quit"), _("Quit"), (hide_return (sigc::mem_fun(*this, &ARDOUR_UI::finish)))); ActionManager::register_action (common_actions, X_("Hide"), _("Hide"), sigc::mem_fun (*this, &ARDOUR_UI::hide_application)); - ActionManager::register_action (common_actions, X_("show-preferences"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor)); - ActionManager::register_action (common_actions, X_("menu-show-preferences"), _("Preferences"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor)); - - ActionManager::register_action (common_actions, X_("hide-editor"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), editor)); - ActionManager::register_action (common_actions, X_("hide-mixer"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), mixer)); - ActionManager::register_action (common_actions, X_("hide-preferences"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), rc_option_editor)); - - ActionManager::register_action (common_actions, X_("attach-editor"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), editor)); - ActionManager::register_action (common_actions, X_("attach-mixer"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), mixer)); - ActionManager::register_action (common_actions, X_("attach-preferences"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), rc_option_editor)); - - ActionManager::register_action (common_actions, X_("detach-editor"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), editor)); - ActionManager::register_action (common_actions, X_("detach-mixer"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), mixer)); - ActionManager::register_action (common_actions, X_("detach-preferences"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), rc_option_editor)); - - ActionManager::register_action (common_actions, X_("show-mixer"), _("Show Mixer"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), mixer)); - ActionManager::register_action (common_actions, X_("show-editor"), _("Show Editor"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), editor)); - - - /* these actions are all currently implemented by the Editor, but need - * to be accessible from anywhere as actions. - */ - - act = ActionManager::register_action (common_actions, "alternate-jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(editor, &PublicEditor::jump_forward_to_mark)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "alternate-jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(editor, &PublicEditor::jump_backward_to_mark)); - ActionManager::session_sensitive_actions.push_back (act); - - act = ActionManager::register_action (common_actions, "set-session-start-from-playhead", _("Set Session Start from Playhead"), sigc::mem_fun(editor, &PublicEditor::set_session_start_from_playhead)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "set-session-end-from-playhead", _("Set Session End from Playhead"), sigc::mem_fun(editor, &PublicEditor::set_session_end_from_playhead)); - ActionManager::session_sensitive_actions.push_back (act); - - act = ActionManager::register_action (common_actions, "toggle-location-at-playhead", _("Toggle Mark at Playhead"), sigc::mem_fun(editor, &PublicEditor::toggle_location_at_playhead_cursor)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "add-location-from-playhead", _("Add Mark from Playhead"), sigc::mem_fun(editor, &PublicEditor::add_location_from_playhead_cursor)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "alternate-add-location-from-playhead", _("Add Mark from Playhead"), sigc::mem_fun(editor, &PublicEditor::add_location_from_playhead_cursor)); - ActionManager::session_sensitive_actions.push_back (act); - - act = ActionManager::register_action (common_actions, "remove-location-from-playhead", _("Remove Mark at Playhead"), sigc::mem_fun(editor, &PublicEditor::remove_location_at_playhead_cursor)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "alternate-remove-location-from-playhead", _("Remove Mark at Playhead"), sigc::mem_fun(editor, &PublicEditor::remove_location_at_playhead_cursor)); - ActionManager::session_sensitive_actions.push_back (act); - - act = ActionManager::register_action (common_actions, "nudge-next-forward", _("Nudge Next Later"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::nudge_forward), true, false)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "nudge-next-backward", _("Nudge Next Earlier"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::nudge_backward), true, false)); - ActionManager::session_sensitive_actions.push_back (act); - - act = ActionManager::register_action (common_actions, "nudge-playhead-forward", _("Nudge Playhead Forward"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::nudge_forward), false, true)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "nudge-playhead-backward", _("Nudge Playhead Backward"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::nudge_backward), false, true)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "playhead-forward-to-grid", _("Playhead to Next Grid"), sigc::mem_fun(editor, &PublicEditor::playhead_forward_to_grid)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "playhead-backward-to-grid", _("Playhead to Previous Grid"), sigc::mem_fun(editor, &PublicEditor::playhead_backward_to_grid)); - ActionManager::session_sensitive_actions.push_back (act); - - act = ActionManager::register_action (common_actions, "start-range-from-playhead", _("Start Range from Playhead"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::keyboard_selection_begin), Editing::EDIT_IGNORE_MOUSE )); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "finish-range-from-playhead", _("Finish Range from Playhead"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::keyboard_selection_finish), false, Editing::EDIT_IGNORE_MOUSE )); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "start-range", _("Start Range"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::keyboard_selection_begin), Editing::EDIT_IGNORE_NONE)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "finish-range", _("Finish Range"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::keyboard_selection_finish), false, Editing::EDIT_IGNORE_NONE)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "start-punch-range", _("Start Punch Range"), sigc::mem_fun(editor, &PublicEditor::set_punch_start_from_edit_point)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "finish-punch-range", _("Finish Punch Range"), sigc::mem_fun(editor, &PublicEditor::set_punch_end_from_edit_point)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "start-loop-range", _("Start Loop Range"), sigc::mem_fun(editor, &PublicEditor::set_loop_start_from_edit_point)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "finish-loop-range", _("Finish Loop Range"), sigc::mem_fun(editor, &PublicEditor::set_loop_end_from_edit_point)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "alt-start-range", _("Start Range"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::keyboard_selection_begin), Editing::EDIT_IGNORE_NONE)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "alt-finish-range", _("Finish Range"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::keyboard_selection_finish), false, Editing::EDIT_IGNORE_NONE)); - ActionManager::session_sensitive_actions.push_back (act); - - act = ActionManager::register_action (common_actions, "select-all-tracks", _("Select All Tracks"), sigc::mem_fun(editor, &PublicEditor::select_all_tracks)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "deselect-all", _("Deselect All"), sigc::mem_fun(editor, &PublicEditor::deselect_all)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, "invert-selection", _("Invert Selection"), sigc::mem_fun(editor, &PublicEditor::invert_selection)); - ActionManager::session_sensitive_actions.push_back (act); - - /* These "change" actions are not intended to be used inside menus, but - are for the tab/window control buttons, which have somewhat odd - semantics. - */ - ActionManager::register_action (common_actions, X_("change-editor-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::button_change_tabbable_visibility), editor)); - ActionManager::register_action (common_actions, X_("change-mixer-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::button_change_tabbable_visibility), mixer)); - ActionManager::register_action (common_actions, X_("change-preferences-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::button_change_tabbable_visibility), rc_option_editor)); - - /* These "change" actions are not intended to be used inside menus, but - are for the tab/window control key bindings, which have somewhat odd - semantics. - */ - ActionManager::register_action (common_actions, X_("key-change-editor-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), editor)); - ActionManager::register_action (common_actions, X_("key-change-mixer-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), mixer)); - ActionManager::register_action (common_actions, X_("key-change-preferences-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), rc_option_editor)); - - ActionManager::register_action (common_actions, X_("previous-tab"), _("Previous Tab"), sigc::mem_fun (*this, &ARDOUR_UI::step_up_through_tabs)); - ActionManager::register_action (common_actions, X_("next-tab"), _("Next Tab"), sigc::mem_fun (*this, &ARDOUR_UI::step_down_through_tabs)); - - ActionManager::register_action (common_actions, X_("toggle-editor-and-mixer"), _("Toggle Editor & Mixer"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_editor_and_mixer)); - - /* windows visibility actions */ - - ActionManager::register_toggle_action (common_actions, X_("ToggleMaximalEditor"), _("Maximise Editor Space"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_editing_space)); - ActionManager::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); - if (Profile->get_mixbus()) { ActionManager::register_action (common_actions, X_("show-ui-prefs"), _("Show more UI preferences"), sigc::mem_fun (*this, &ARDOUR_UI::show_ui_prefs)); } @@ -402,18 +282,6 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); - act = ActionManager::register_action (common_actions, - "jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(*editor, &PublicEditor::jump_backward_to_mark)); - ActionManager::session_sensitive_actions.push_back (act); - - act = ActionManager::register_action (common_actions, - "jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(*editor, &PublicEditor::jump_forward_to_mark)); - ActionManager::session_sensitive_actions.push_back (act); - - act = ActionManager::register_action (common_actions, - X_("addExistingAudioFiles"), _("Import"), sigc::mem_fun (*editor, &PublicEditor::external_audio_dialog)); - ActionManager::session_sensitive_actions.push_back (act); - ActionManager::write_sensitive_actions.push_back (act); Glib::RefPtr transport_actions = ActionManager::create_action_group (global_bindings, X_("Transport")); @@ -445,20 +313,6 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - /* these two behave as follows: - - - if transport speed != 1.0 or != -1.0, change speed to 1.0 or -1.0 (respectively) - - otherwise do nothing - */ - - act = ActionManager::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 = ActionManager::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 = ActionManager::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); @@ -468,9 +322,6 @@ ARDOUR_UI::install_actions () act = ActionManager::register_action (transport_actions, X_("PlayPreroll"), _("Play 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 = ActionManager::register_action (transport_actions, X_("solo-selection"), _("Solo Selection"), sigc::bind (sigc::mem_fun(*editor, &PublicEditor::play_solo_selection), true)); - ActionManager::session_sensitive_actions.push_back (act); - ActionManager::transport_sensitive_actions.push_back (act); act = ActionManager::register_action (transport_actions, X_("RecordPreroll"), _("Record w/Preroll"), sigc::mem_fun(*this, &ARDOUR_UI::transport_rec_preroll)); @@ -666,6 +517,171 @@ ARDOUR_UI::install_actions () ActionManager::transport_sensitive_actions.push_back (act); } +void +ARDOUR_UI::install_dependent_actions () +{ + using namespace Glib; + using namespace Gtk; + + RefPtr main_actions = ActionManager::get_action_group (X_("Main")); + assert (main_actions); + RefPtr common_actions = ActionManager::get_action_group (X_("Common")); + assert (common_actions); + RefPtr transport_actions = ActionManager::get_action_group (X_("Transport")); + assert (transport_actions); + + RefPtr act; + + /* these two behave as follows: + + - if transport speed != 1.0 or != -1.0, change speed to 1.0 or -1.0 (respectively) + - otherwise do nothing + */ + + act = ActionManager::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 = ActionManager::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 = ActionManager::register_action (common_actions, "jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(*editor, &PublicEditor::jump_backward_to_mark)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (common_actions, "jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(*editor, &PublicEditor::jump_forward_to_mark)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (common_actions, X_("addExistingAudioFiles"), _("Import"), sigc::mem_fun (*editor, &PublicEditor::external_audio_dialog)); + ActionManager::session_sensitive_actions.push_back (act); + ActionManager::write_sensitive_actions.push_back (act); + + act = ActionManager::register_action (main_actions, X_("StemExport"), _("Stem export..."), sigc::mem_fun (*editor, &PublicEditor::stem_export)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::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); + + /* these actions are all currently implemented by the Editor, but need + * to be accessible from anywhere as actions. + */ + + act = ActionManager::register_action (common_actions, "alternate-jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(editor, &PublicEditor::jump_forward_to_mark)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "alternate-jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(editor, &PublicEditor::jump_backward_to_mark)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (common_actions, "set-session-start-from-playhead", _("Set Session Start from Playhead"), sigc::mem_fun(editor, &PublicEditor::set_session_start_from_playhead)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "set-session-end-from-playhead", _("Set Session End from Playhead"), sigc::mem_fun(editor, &PublicEditor::set_session_end_from_playhead)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (common_actions, "toggle-location-at-playhead", _("Toggle Mark at Playhead"), sigc::mem_fun(editor, &PublicEditor::toggle_location_at_playhead_cursor)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "add-location-from-playhead", _("Add Mark from Playhead"), sigc::mem_fun(editor, &PublicEditor::add_location_from_playhead_cursor)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "alternate-add-location-from-playhead", _("Add Mark from Playhead"), sigc::mem_fun(editor, &PublicEditor::add_location_from_playhead_cursor)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (common_actions, "remove-location-from-playhead", _("Remove Mark at Playhead"), sigc::mem_fun(editor, &PublicEditor::remove_location_at_playhead_cursor)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "alternate-remove-location-from-playhead", _("Remove Mark at Playhead"), sigc::mem_fun(editor, &PublicEditor::remove_location_at_playhead_cursor)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (common_actions, "nudge-next-forward", _("Nudge Next Later"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::nudge_forward), true, false)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "nudge-next-backward", _("Nudge Next Earlier"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::nudge_backward), true, false)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (common_actions, "nudge-playhead-forward", _("Nudge Playhead Forward"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::nudge_forward), false, true)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "nudge-playhead-backward", _("Nudge Playhead Backward"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::nudge_backward), false, true)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "playhead-forward-to-grid", _("Playhead to Next Grid"), sigc::mem_fun(editor, &PublicEditor::playhead_forward_to_grid)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "playhead-backward-to-grid", _("Playhead to Previous Grid"), sigc::mem_fun(editor, &PublicEditor::playhead_backward_to_grid)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (common_actions, "start-range-from-playhead", _("Start Range from Playhead"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::keyboard_selection_begin), Editing::EDIT_IGNORE_MOUSE )); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "finish-range-from-playhead", _("Finish Range from Playhead"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::keyboard_selection_finish), false, Editing::EDIT_IGNORE_MOUSE )); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "start-range", _("Start Range"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::keyboard_selection_begin), Editing::EDIT_IGNORE_NONE)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "finish-range", _("Finish Range"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::keyboard_selection_finish), false, Editing::EDIT_IGNORE_NONE)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "start-punch-range", _("Start Punch Range"), sigc::mem_fun(editor, &PublicEditor::set_punch_start_from_edit_point)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "finish-punch-range", _("Finish Punch Range"), sigc::mem_fun(editor, &PublicEditor::set_punch_end_from_edit_point)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "start-loop-range", _("Start Loop Range"), sigc::mem_fun(editor, &PublicEditor::set_loop_start_from_edit_point)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "finish-loop-range", _("Finish Loop Range"), sigc::mem_fun(editor, &PublicEditor::set_loop_end_from_edit_point)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "alt-start-range", _("Start Range"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::keyboard_selection_begin), Editing::EDIT_IGNORE_NONE)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "alt-finish-range", _("Finish Range"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::keyboard_selection_finish), false, Editing::EDIT_IGNORE_NONE)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (common_actions, "select-all-tracks", _("Select All Tracks"), sigc::mem_fun(editor, &PublicEditor::select_all_tracks)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "deselect-all", _("Deselect All"), sigc::mem_fun(editor, &PublicEditor::deselect_all)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "invert-selection", _("Invert Selection"), sigc::mem_fun(editor, &PublicEditor::invert_selection)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (transport_actions, X_("solo-selection"), _("Solo Selection"), sigc::bind (sigc::mem_fun(*editor, &PublicEditor::play_solo_selection), true)); + ActionManager::session_sensitive_actions.push_back (act); + ActionManager::transport_sensitive_actions.push_back (act); + + /* XXX */ + + ActionManager::register_action (common_actions, X_("show-preferences"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor)); + ActionManager::register_action (common_actions, X_("menu-show-preferences"), _("Preferences"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor)); + + ActionManager::register_action (common_actions, X_("hide-editor"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), editor)); + ActionManager::register_action (common_actions, X_("hide-mixer"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), mixer)); + ActionManager::register_action (common_actions, X_("hide-preferences"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), rc_option_editor)); + + ActionManager::register_action (common_actions, X_("attach-editor"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), editor)); + ActionManager::register_action (common_actions, X_("attach-mixer"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), mixer)); + ActionManager::register_action (common_actions, X_("attach-preferences"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), rc_option_editor)); + + ActionManager::register_action (common_actions, X_("detach-editor"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), editor)); + ActionManager::register_action (common_actions, X_("detach-mixer"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), mixer)); + ActionManager::register_action (common_actions, X_("detach-preferences"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), rc_option_editor)); + + ActionManager::register_action (common_actions, X_("show-mixer"), _("Show Mixer"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), mixer)); + ActionManager::register_action (common_actions, X_("show-editor"), _("Show Editor"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), editor)); + + /* These "change" actions are not intended to be used inside menus, but + are for the tab/window control buttons, which have somewhat odd + semantics. + */ + ActionManager::register_action (common_actions, X_("change-editor-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::button_change_tabbable_visibility), editor)); + ActionManager::register_action (common_actions, X_("change-mixer-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::button_change_tabbable_visibility), mixer)); + ActionManager::register_action (common_actions, X_("change-preferences-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::button_change_tabbable_visibility), rc_option_editor)); + + /* These "change" actions are not intended to be used inside menus, but + are for the tab/window control key bindings, which have somewhat odd + semantics. + */ + ActionManager::register_action (common_actions, X_("key-change-editor-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), editor)); + ActionManager::register_action (common_actions, X_("key-change-mixer-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), mixer)); + ActionManager::register_action (common_actions, X_("key-change-preferences-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), rc_option_editor)); + + ActionManager::register_action (common_actions, X_("previous-tab"), _("Previous Tab"), sigc::mem_fun (*this, &ARDOUR_UI::step_up_through_tabs)); + ActionManager::register_action (common_actions, X_("next-tab"), _("Next Tab"), sigc::mem_fun (*this, &ARDOUR_UI::step_down_through_tabs)); + + ActionManager::register_action (common_actions, X_("toggle-editor-and-mixer"), _("Toggle Editor & Mixer"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_editor_and_mixer)); + + /* windows visibility actions */ + + ActionManager::register_toggle_action (common_actions, X_("ToggleMaximalEditor"), _("Maximise Editor Space"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_editing_space)); + ActionManager::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); +} + void ARDOUR_UI::build_menu_bar () {