Tweak 842d758e: selection & move into view
authorRobin Gareus <robin@gareus.org>
Sat, 21 Oct 2017 15:27:03 +0000 (17:27 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 21 Oct 2017 19:07:18 +0000 (21:07 +0200)
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)

gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_selection.cc
gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h

index 09306f66e49b62591421106fc09a138a92f846ed..b827ac0eb1fee6a799a16e73e6a91b6fe042a11f 100644 (file)
@@ -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)
index 78496c4ca405bb3a04fff05ae8c27b6d601271b3..07dc11aedb78f8c717a224f3b83ba85080013d49 100644 (file)
@@ -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 ();
index a263a4e1f7c08deb5042e02f1825e97c135e5581..79cda34f1551f37682f5595652d2ace50b1c493e 100644 (file)
@@ -191,7 +191,7 @@ Editor::set_selected_track_as_side_effect (Selection::Operation op)
                return;
        }
 
-       PBD::Unwinder<bool> uw (_track_selection_change_without_scroll, true);
+       PBD::Unwinder<bool> 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;
index ee2f22031f7dbeeed29f01df2306f58f5944b2b3..1745d19f5cd9dc6845407365e5fe4941dc6773b8 100644 (file)
@@ -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<bool> 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 */
index d0a051dfce6603b6280f84614165b8b7a22af83f..137913038ec65dedf78e591c44827f59f4848101 100644 (file)
@@ -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<ARDOUR::Stripable> spilled_strip;
 
        void escape ();