retain selection on track-height change
authorRobin Gareus <robin@gareus.org>
Sat, 1 Nov 2014 15:48:22 +0000 (16:48 +0100)
committerRobin Gareus <robin@gareus.org>
Sat, 1 Nov 2014 15:54:52 +0000 (16:54 +0100)
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_axis_view.h

index 5167d243273c1d0383c27354ba15cc2414e77872..d6a152d63330b4199e0a1eb30cd726b33a6d069c 100644 (file)
@@ -98,6 +98,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
        , _order (0)
        , _effective_height (0)
        , _resize_drag_start (-1)
+       , _did_resize (false)
        , _preresize_cursor (0)
        , _have_preresize_cursor (false)
        , _ebox_release_can_act (true)
@@ -418,15 +419,16 @@ TimeAxisView::controls_ebox_motion (GdkEventMotion* ev)
                 * are pretending that the drag is taking place over the canvas
                 * (which perhaps in the glorious future, when track headers
                 * and the canvas are unified, will actually be true.)
-               */
+                */
 
                _editor.maybe_autoscroll (false, true, true);
 
                /* now schedule the actual TAV resize */
-                int32_t const delta = (int32_t) floor (ev->y_root - _resize_drag_start);
-                _editor.add_to_idle_resize (this, delta);
-                _resize_drag_start = ev->y_root;
-        } else {
+               int32_t const delta = (int32_t) floor (ev->y_root - _resize_drag_start);
+               _editor.add_to_idle_resize (this, delta);
+               _resize_drag_start = ev->y_root;
+               _did_resize = true;
+       } else {
                /* not dragging but ... */
                maybe_set_cursor (ev->y);
        }
@@ -484,6 +486,11 @@ TimeAxisView::controls_ebox_button_release (GdkEventButton* ev)
                }
                _editor.stop_canvas_autoscroll ();
                _resize_drag_start = -1;
+               if (_did_resize) {
+                       _did_resize = false;
+                       // don't change selection
+                       return true;
+               }
        }
 
        if (!_ebox_release_can_act) {
index 682514acfae51cf6b2e76bdc6ac84c226bcda795..cc7f7a0fe0d689fc1900736af4cc5aa21d4689a7 100644 (file)
@@ -297,9 +297,10 @@ private:
        int                  _order;
        uint32_t             _effective_height;
        double               _resize_drag_start;
+       bool                 _did_resize;
        GdkCursor*           _preresize_cursor;
        bool                 _have_preresize_cursor;
-       bool                  _ebox_release_can_act;
+       bool                 _ebox_release_can_act;
 
        static uint32_t button_height;
        static uint32_t extra_height;