diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index e93c74e2de..58be43ee6a 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -1054,7 +1054,20 @@ ARDOUR_UI::on_theme_changed () void ARDOUR_UI::focus_on_clock () { - // TODO cast to a tabbable and call focus_on_clock to its clock + // TODO: how do we handle detached windows? Use WindowManager? + + if (editor->tabbed() && _tabs.get_current_page() == _tabs.page_num (editor->contents())) { + editor->focus_on_clock (); + } + if (mixer->tabbed() && _tabs.get_current_page() == _tabs.page_num (mixer->contents())) { + mixer->focus_on_clock (); + } + if (recorder->tabbed() && _tabs.get_current_page() == _tabs.page_num (recorder->contents())) { + recorder->focus_on_clock (); + } + if (trigger_page->tabbed() && _tabs.get_current_page() == _tabs.page_num (trigger_page->contents())) { + trigger_page->focus_on_clock (); + } } bool diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 7ee59bc6c1..ed9f70fd52 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -2147,6 +2147,12 @@ Editor::set_edit_point_preference (EditPoint ep, bool force) instant_save (); } +void +Editor::focus_on_clock() +{ + _application_bar.focus_on_clock(); +} + int Editor::set_state (const XMLNode& node, int version) { diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index d44c1d3e59..77f0785238 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -512,6 +512,8 @@ public: bool rb_click (GdkEvent*, Temporal::timepos_t const &); void line_drag_click (GdkEvent*, Temporal::timepos_t const &, double); + void focus_on_clock(); + protected: void map_transport_state (); void map_position_change (samplepos_t); diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index d317e100af..ada04a5264 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -2535,6 +2535,12 @@ Mixer_UI::set_strip_width (Width w, bool save) } } +void +Mixer_UI::focus_on_clock() +{ + _application_bar.focus_on_clock(); +} + int Mixer_UI::set_state (const XMLNode& node, int version) { diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 4e05a8b040..5f7114388d 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -144,6 +144,8 @@ public: void register_actions (); + void focus_on_clock(); + void load_bindings (); Gtkmm2ext::Bindings* bindings; diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index b2339bfaf3..3be2222a72 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -406,7 +406,6 @@ public: virtual MixerStrip* get_current_mixer_strip () const = 0; - virtual Temporal::TempoMap::WritableSharedPtr begin_tempo_map_edit () = 0; virtual void abort_tempo_map_edit () = 0; void commit_tempo_map_edit (Temporal::TempoMap::WritableSharedPtr& map, bool with_update = false) { @@ -449,6 +448,8 @@ public: virtual void end_track_drag () = 0; virtual bool track_dragging() const = 0; + virtual void focus_on_clock() = 0; + /// Singleton instance, set up by Editor::Editor() static PublicEditor* _instance; diff --git a/gtk2_ardour/recorder_ui.cc b/gtk2_ardour/recorder_ui.cc index f8f8590646..680a8515a7 100644 --- a/gtk2_ardour/recorder_ui.cc +++ b/gtk2_ardour/recorder_ui.cc @@ -361,6 +361,12 @@ RecorderUI::get_state () const return *node; } +void +RecorderUI::focus_on_clock() +{ + _application_bar.focus_on_clock(); +} + int RecorderUI::set_state (const XMLNode& node, int version) { diff --git a/gtk2_ardour/recorder_ui.h b/gtk2_ardour/recorder_ui.h index 38ddaad132..02fdf64fd7 100644 --- a/gtk2_ardour/recorder_ui.h +++ b/gtk2_ardour/recorder_ui.h @@ -73,6 +73,8 @@ public: void spill_port (std::string const&); void add_track (std::string const&); + void focus_on_clock(); + private: void load_bindings (); void register_actions (); diff --git a/gtk2_ardour/trigger_page.cc b/gtk2_ardour/trigger_page.cc index 4861fc0d9a..e90a229112 100644 --- a/gtk2_ardour/trigger_page.cc +++ b/gtk2_ardour/trigger_page.cc @@ -251,6 +251,12 @@ TriggerPage::get_state () const return *node; } +void +TriggerPage::focus_on_clock() +{ + _application_bar.focus_on_clock(); +} + int TriggerPage::set_state (const XMLNode& node, int version) { diff --git a/gtk2_ardour/trigger_page.h b/gtk2_ardour/trigger_page.h index 129d242e42..6f08a06fbe 100644 --- a/gtk2_ardour/trigger_page.h +++ b/gtk2_ardour/trigger_page.h @@ -64,6 +64,8 @@ public: RouteProcessorSelection& selection() { return _selection; } + void focus_on_clock(); + private: void load_bindings (); void register_actions ();