From c6464e9c34864b9b2347fb7b6ac50261991da8aa Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 12 Jan 2017 18:22:56 +0100 Subject: [PATCH] Move some actions into the global group: This allows common keyboard shortcuts from any Tab (Editor, Mixer). Discuss: should those actions/methods also be moved to ArdourUI instead of PublicEditor? --- gtk2_ardour/ardour.keys.in | 9 ++++++--- gtk2_ardour/ardour_ui_ed.cc | 13 +++++++++++++ gtk2_ardour/editor.h | 11 +++++++---- gtk2_ardour/editor_actions.cc | 6 ------ gtk2_ardour/public_editor.h | 13 ++++++++++--- 5 files changed, 36 insertions(+), 16 deletions(-) diff --git a/gtk2_ardour/ardour.keys.in b/gtk2_ardour/ardour.keys.in index cd870f88e8..d7499fcea7 100644 --- a/gtk2_ardour/ardour.keys.in +++ b/gtk2_ardour/ardour.keys.in @@ -147,8 +147,12 @@ This mode provides many different operations on both regions and control points, @sess|Common/Quit|<@PRIMARY@>q|quit @sess|Common/Hide|<@PRIMARY@>h|hide -@movp|Editor/jump-forward-to-mark|w|to next mark -@movp|Editor/jump-backward-to-mark|q|to previous mark + +;; editor actions available from any tab + +@sess|Common/jump-forward-to-mark|w|to next mark +@sess|Common/jump-backward-to-mark|q|to previous mark +@sess|Common/addExistingAudioFiles|<@PRIMARY@>i|import audio files ;; note that ctrl-w is special and consumed by the keyboard snooper @@ -168,7 +172,6 @@ This mode provides many different operations on both regions and control points, @select|Editor/select-all-within-cursors|u|all present in edit range @eep|Region/insert-region-from-region-list|i|insert from region list @select|Editor/invert-selection|<@TERTIARY@>i|invert selection -@edit|Editor/addExistingAudioFiles|<@PRIMARY@>i|import audio files @edit|Editor/toggle-midi-input-active|<@SECONDARY@>i|toggle sel. track MIDI input @mmode|MouseMode/set-mouse-mode-object|g|object mode @mmode|MouseMode/set-mouse-mode-content|e|content mode diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index ace6076e4d..4c65098c1a 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -341,6 +341,19 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); + act = global_actions.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 = global_actions.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 = global_actions.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 = global_actions.create_action_group (X_("Transport")); /* do-nothing action for the "transport" menu bar item */ diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index b96f67ab6b..dfe25420f6 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -655,6 +655,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void toggle_marker_lines (); void set_marker_line_visibility (bool); + void jump_forward_to_mark (); + void jump_backward_to_mark (); + uint32_t location_marker_color; uint32_t location_range_color; uint32_t location_loop_color; @@ -1337,8 +1340,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD /* import & embed */ void add_external_audio_action (Editing::ImportMode); - void external_audio_dialog (); - void session_import_dialog (); int check_whether_and_how_to_import(std::string, bool all_or_nothing = true); bool check_multichannel_status (const std::vector& paths); @@ -1401,6 +1402,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD AnalysisWindow* analysis_window; + /* import & embed */ + void external_audio_dialog (); + void session_import_dialog (); + /* import specific info */ struct EditorImportStatus : public ARDOUR::ImportStatus { @@ -1439,8 +1444,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void clear_locations (); void unhide_markers (); void unhide_ranges (); - void jump_forward_to_mark (); - void jump_backward_to_mark (); void cursor_align (bool playhead_to_edit); void toggle_skip_playback (); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index bcdee8a74b..f2ca7ad328 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -249,10 +249,7 @@ Editor::register_actions () reg_sens (editor_actions, a.c_str(), n.c_str(), sigc::bind (sigc::mem_fun (*this, &Editor::goto_nth_marker), i - 1)); } - - reg_sens (editor_actions, "jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(*this, &Editor::jump_forward_to_mark)); reg_sens (editor_actions, "alternate-jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(*this, &Editor::jump_forward_to_mark)); - reg_sens (editor_actions, "jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(*this, &Editor::jump_backward_to_mark)); reg_sens (editor_actions, "alternate-jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(*this, &Editor::jump_backward_to_mark)); reg_sens (editor_actions, "set-session-start-from-playhead", _("Set Session Start from Playhead"), sigc::mem_fun(*this, &Editor::set_session_start_from_playhead)); @@ -738,9 +735,6 @@ Editor::register_actions () /* the next two are duplicate items with different names for use in two different contexts */ - act = reg_sens (editor_actions, X_("addExistingAudioFiles"), _("Import"), sigc::mem_fun (*this, &Editor::external_audio_dialog)); - ActionManager::write_sensitive_actions.push_back (act); - 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); diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 54abee9213..4220ddbb72 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -192,6 +192,10 @@ class PublicEditor : public Gtkmm2ext::Tabbable { */ virtual void consider_auditioning (boost::shared_ptr r) = 0; + /* import dialogs -> ardour-ui ?! */ + virtual void external_audio_dialog () = 0; + virtual void session_import_dialog () = 0; + virtual void new_region_from_selection () = 0; virtual void separate_region_from_selection () = 0; @@ -218,6 +222,9 @@ class PublicEditor : public Gtkmm2ext::Tabbable { virtual void set_loop_range (framepos_t start, framepos_t end, std::string cmd) = 0; virtual void set_punch_range (framepos_t start, framepos_t end, std::string cmd) = 0; + virtual void jump_forward_to_mark () = 0; + virtual void jump_backward_to_mark () = 0; + virtual Editing::MouseMode effective_mouse_mode () const = 0; /** Import existing media */ @@ -256,9 +263,9 @@ class PublicEditor : public Gtkmm2ext::Tabbable { virtual void set_selected_mixer_strip (TimeAxisView&) = 0; virtual void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false) = 0; - virtual void set_stationary_playhead (bool yn) = 0; - virtual void toggle_stationary_playhead () = 0; - virtual bool stationary_playhead() const = 0; + virtual void set_stationary_playhead (bool yn) = 0; + virtual void toggle_stationary_playhead () = 0; + virtual bool stationary_playhead() const = 0; /** Set whether the editor should follow the playhead. * @param yn true to follow playhead, otherwise false.