Port matrix useability fix.
authornick_m <mainsbridge@gmail.com>
Sat, 4 Apr 2015 17:35:27 +0000 (03:35 +1000)
committernick_m <mainsbridge@gmail.com>
Sat, 4 Apr 2015 17:35:27 +0000 (03:35 +1000)
When a page has changed, leave the adjustment where it is on the axis whose
size remains the same.
On the changed axis, set the scroller to zero.

gtk2_ardour/port_matrix.cc

index ebf6413d39b73921b5293f9897994545a01a9849..40cc80a35014c0fc544b5b66eeb29d7ade40358a 100644 (file)
@@ -248,17 +248,26 @@ PortMatrix::setup_scrollbars ()
 {
        Adjustment* a = _hscroll.get_adjustment ();
        a->set_lower (0);
-       a->set_upper (_body->full_scroll_width());
        a->set_page_size (_body->alloc_scroll_width());
        a->set_step_increment (32);
        a->set_page_increment (128);
 
+       /* Set the adjustment to zero if the size has changed.*/
+       if (a->get_upper() != _body->full_scroll_width()) {
+               a->set_upper (_body->full_scroll_width());
+               a->set_value (0);
+       }
+
        a = _vscroll.get_adjustment ();
        a->set_lower (0);
-       a->set_upper (_body->full_scroll_height());
        a->set_page_size (_body->alloc_scroll_height());
        a->set_step_increment (32);
        a->set_page_increment (128);
+
+       if (a->get_upper() != _body->full_scroll_height()) {
+               a->set_upper (_body->full_scroll_height());
+               a->set_value (0);
+       }
 }
 
 /** Disassociate all of our ports from each other */