From: Robin Gareus Date: Sat, 21 Oct 2017 15:27:03 +0000 (+0200) Subject: Tweak 842d758e: selection & move into view X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=231e25544bd67eda735e58567562522758b578d1;p=ardour.git Tweak 842d758e: selection & move into view Use separate editor + mixer flags for moving selected tracks into view. Changing selection in the Editor will only pan the mixer-view and vice- versa. This fixes an issue with the track that is being clicked-on to be moved out of view (due to groups) --- diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 09306f66e4..b827ac0eb1 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -400,6 +400,7 @@ Editor::Editor () , _ignore_region_action (false) , _last_region_menu_was_main (false) , _track_selection_change_without_scroll (false) + , _editor_track_selection_change_without_scroll (false) , cd_marker_bar_drag_rect (0) , range_bar_drag_rect (0) , transport_bar_drag_rect (0) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 78496c4ca4..07dc11aedb 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1883,6 +1883,7 @@ private: void marker_selection_changed (); bool _track_selection_change_without_scroll; + bool _editor_track_selection_change_without_scroll; void cancel_selection (); void cancel_time_selection (); diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index a263a4e1f7..79cda34f15 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -191,7 +191,7 @@ Editor::set_selected_track_as_side_effect (Selection::Operation op) return; } - PBD::Unwinder uw (_track_selection_change_without_scroll, true); + PBD::Unwinder uw (_editor_track_selection_change_without_scroll, true); RouteGroup* group = NULL; if (clicked_routeview) { @@ -1039,7 +1039,7 @@ Editor::presentation_info_changed (PropertyChange const & what_changed) break; default: set_selected_mixer_strip (*(selection->tracks.back())); - if (!_track_selection_change_without_scroll) { + if (!_track_selection_change_without_scroll && !_editor_track_selection_change_without_scroll) { ensure_time_axis_view_is_visible (*(selection->tracks.back()), false); } break; diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index ee2f22031f..1745d19f5c 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -111,6 +111,7 @@ Mixer_UI::Mixer_UI () , _route_deletion_in_progress (false) , _maximised (false) , _show_mixer_list (true) + , _strip_selection_change_without_scroll (false) , myactions (X_("mixer")) , _selection (*this, *this) { @@ -826,7 +827,7 @@ Mixer_UI::sync_treeview_from_presentation_info (PropertyChange const & what_chan } } - if (!_selection.axes.empty() && !PublicEditor::instance().track_selection_change_without_scroll ()) { + if (!_selection.axes.empty() && !PublicEditor::instance().track_selection_change_without_scroll () && !_strip_selection_change_without_scroll) { move_stripable_into_view ((*_selection.axes.begin())->stripable()); } @@ -918,6 +919,17 @@ struct MixerStripSorter { bool Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) { + /* Selecting a mixer-strip may also select grouped-tracks, and + * presentation_info_changed() being emitted and + * _selection.axes.begin() is being moved into view. This may + * effectively move the track that was clicked-on out of view. + * + * So here only the track that is actually clicked-on is moved into + * view (in case it's partially visible) + */ + PBD::Unwinder uw (_strip_selection_change_without_scroll, true); + move_stripable_into_view (strip->stripable()); + if (ev->button == 1) { if (_selection.selected (strip)) { /* primary-click: toggle selection state of strip */ diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index d0a051dfce..137913038e 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -376,6 +376,8 @@ private: // true if mixer list is visible bool _show_mixer_list; + bool _strip_selection_change_without_scroll; + mutable boost::weak_ptr spilled_strip; void escape ();