Fix track height, partial merge of recent 2.0 updates (speed up track resizing, fix...
[ardour.git] / gtk2_ardour / editor_route_list.cc
index db93f9ffeb9dc09cb7687fb8ad0f3c500a301b6f..f2b8456fd9b3a58a7f292bb830ef2d719a39c11f 100644 (file)
@@ -150,10 +150,10 @@ Editor::handle_gui_changes (const string & what, void *src)
        ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::handle_gui_changes), what, src));
        
        if (what == "track_height") {
-               /* make tracks change height while it happens, instead 
+               /* Optional :make tracks change height while it happens, instead 
                   of on first-idle
                */
-               track_canvas->update_now ();
+               //track_canvas->update_now ();
                redisplay_route_list ();
        }
 
@@ -323,8 +323,6 @@ Editor::redisplay_route_list ()
        uint32_t order;
        int n;
 
-       cerr << "RRL, nrld = " << no_route_list_redisplay << " with " << rows.size() << endl;
-       
        if (no_route_list_redisplay) {
                return;
        }
@@ -352,12 +350,10 @@ Editor::redisplay_route_list ()
 
                bool visible = (*i)[route_display_columns.visible];
 
-               cerr << "\tvisible = " << visible << endl;
-
                if (visible) {
                        tv->set_marked_for_display (true);
+                       cerr << tv->name() << " will be at " << position << endl;
                        position += tv->show_at (position, n, &edit_controls_vbox);
-                       cerr << "packed tv for " << tv->name() << " @ " << position << endl;
                } else {
                        tv->hide ();
                }
@@ -368,11 +364,14 @@ Editor::redisplay_route_list ()
 
        full_canvas_height = position;
 
-       /* make sure the cursors stay on top of every newly added track */
-
-       cursor_group->raise_to_top ();
-
-       //reset_scrolling_region ();
+       vertical_adjustment.set_upper (position + canvas_timebars_vsize);
+       if ((vertical_adjustment.get_value() + canvas_height) > vertical_adjustment.get_upper()) {
+               /* 
+                  We're increasing the size of the canvas while the bottom is visible.
+                  We scroll down to keep in step with the controls layout.
+               */
+               vertical_adjustment.set_value (position + canvas_timebars_vsize - canvas_height);
+       } 
 
        if (Config->get_sync_all_route_ordering() && !ignore_route_list_reorder) {
                ignore_route_order_sync = true;