Restore mixer scroll offset after spill
authorRobin Gareus <robin@gareus.org>
Sat, 1 Sep 2018 19:32:57 +0000 (21:32 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 1 Sep 2018 19:32:57 +0000 (21:32 +0200)
gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h

index b9b9eccacab8b0c1d5a22fe2b0f5b6d230023efc..4f029e9b4b7be51c79d4182985b05ef48f4dde8e 100644 (file)
@@ -106,6 +106,7 @@ Mixer_UI::Mixer_UI ()
        , _monitor_section (0)
        , _plugin_selector (0)
        , _strip_width (UIConfiguration::instance().get_default_narrow_ms() ? Narrow : Wide)
+       , _spill_scroll_position (0)
        , ignore_reorder (false)
        , _in_group_rebuild_or_clear (false)
        , _route_deletion_in_progress (false)
@@ -1450,6 +1451,9 @@ Mixer_UI::redisplay_track_list ()
        if (ss) {
                boost::shared_ptr<VCA> sv = boost::dynamic_pointer_cast<VCA> (ss);
                if (sv) {
+                       if (_spill_scroll_position <= 0 && scroller.get_hscrollbar()) {
+                               _spill_scroll_position = scroller.get_hscrollbar()->get_adjustment()->get_value();
+                       }
                        spill_redisplay (sv);
                        return;
                }
@@ -1541,6 +1545,13 @@ Mixer_UI::redisplay_track_list ()
        }
 
        _group_tabs->set_dirty ();
+
+       if (_spill_scroll_position > 0 && scroller.get_hscrollbar()) {
+               Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
+               adj->set_value (max (adj->get_lower(), min (adj->get_upper(), _spill_scroll_position)));
+       }
+       _spill_scroll_position = 0;
+
 }
 
 void
index 2469f7450352754517ab431836293e833c359d95..1315f74f5dee05bc4905c980a409468fd1a1c4ba 100644 (file)
@@ -348,6 +348,7 @@ private:
        bool vca_button_release_event (GdkEventButton*, VCAMasterStrip*);
 
        Width _strip_width;
+       double _spill_scroll_position;
 
        void presentation_info_changed (PBD::PropertyChange const &);
        void sync_treeview_from_presentation_info (PBD::PropertyChange const &);