Speed up track resizing, fix disappearing automation controls when automation track has been made minimum size.

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3722 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Nick Mainsbridge 2008-09-14 10:08:57 +00:00
parent 4489fc159f
commit f1ef1b0069
5 changed files with 85 additions and 61 deletions

View file

@ -367,6 +367,11 @@ AutomationTimeAxisView::set_height (uint32_t h)
clear_button.hide();
hide_button.hide();
}
} else if (h >= hNormal){
auto_button.show();
height_button.show();
clear_button.show();
hide_button.show_all();
}
if (changed) {

View file

@ -486,15 +486,15 @@ Editor::Editor ()
edit_packer.attach (edit_vscrollbar, 0, 1, 0, 4, FILL, FILL|EXPAND, 0, 0);
edit_packer.attach (ruler_label_event_box, 1, 2, 0, 1, FILL, SHRINK, 0, 0);
edit_packer.attach (time_button_event_box, 1, 2, 1, 2, FILL, SHRINK, 0, 0);
edit_packer.attach (ruler_label_event_box, 1, 2, 0, 1, FILL, SHRINK, 0, 0);
edit_packer.attach (time_button_event_box, 1, 2, 1, 2, FILL, SHRINK, 0, 0);
edit_packer.attach (time_canvas_event_box, 2, 3, 0, 1, FILL|EXPAND, FILL, 0, 0);
edit_packer.attach (controls_layout, 1, 2, 2, 3, FILL, FILL|EXPAND, 0, 0);
edit_packer.attach (track_canvas_event_box, 2, 3, 1, 3, FILL|EXPAND, FILL|EXPAND, 0, 0);
edit_packer.attach (zoom_box, 1, 2, 3, 4, FILL, FILL, 0, 0);
edit_packer.attach (edit_hscrollbar, 2, 3, 3, 4, FILL|EXPAND, FILL, 0, 0);
edit_packer.attach (zoom_box, 1, 2, 3, 4, FILL, FILL, 0, 0);
edit_packer.attach (edit_hscrollbar, 2, 3, 3, 4, FILL|EXPAND, FILL, 0, 0);
bottom_hbox.set_border_width (2);
bottom_hbox.set_spacing (3);

View file

@ -390,32 +390,30 @@ Editor::controls_layout_size_request (Requisition* req)
screen = Gdk::Screen::get_default();
}
edit_controls_vbox.check_resize();
req->width = max (edit_controls_vbox.get_width(), controls_layout.get_width());
gint width = max (edit_controls_vbox.get_width(), controls_layout.get_width());
/* don't get too big. the fudge factors here are just guesses */
req->width = min (req->width, screen->get_width() - 300);
req->height = min ((gint) pos, (screen->get_height() - 400));
/* this one is important: it determines how big the layout thinks it really is, as
opposed to what it displays on the screen
*/
controls_layout.set_size (edit_controls_vbox.get_width(), (gint) pos);
controls_layout.set_size_request(edit_controls_vbox.get_width(), -1);
zoom_box.set_size_request(edit_controls_vbox.get_width(), -1);
time_button_event_box.set_size_request(edit_controls_vbox.get_width(), -1);
width = min (width, screen->get_width() - 300);
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.
if (req->width != width) {
req->width = width;
}
gint height = min ( (gint) pos, (screen->get_height() - 400));
if (req->height != height) {
req->height = height;
}
if ((width != edit_controls_vbox.get_width()) || height != pos) {
/* this one is important: it determines how big the layout thinks it really is, as
opposed to what it displays on the screen
*/
vertical_adjustment.set_upper (pos + canvas_timebars_vsize);
vertical_adjustment.set_value (pos + canvas_timebars_vsize - canvas_height);
} else {
vertical_adjustment.set_upper (pos + canvas_timebars_vsize);
controls_layout.set_size (edit_controls_vbox.get_width(), pos );
controls_layout.set_size_request(edit_controls_vbox.get_width(), -1);
time_button_event_box.set_size_request(edit_controls_vbox.get_width(), -1);
zoom_box.set_size_request(edit_controls_vbox.get_width(), -1);
}
//cerr << "sizes = " << req->width << " " << edit_controls_vbox.get_width() << " " << controls_layout.get_width() << " " << zoom_box.get_width() << " " << time_button_frame.get_width() << endl;//DEBUG

View file

@ -104,10 +104,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 ();
}
@ -313,11 +313,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;

View file

@ -211,51 +211,52 @@ TimeAxisView::~TimeAxisView()
guint32
TimeAxisView::show_at (double y, int& nth, VBox *parent)
{
gdouble ix1, ix2, iy1, iy2;
effective_height = 0;
if (control_parent) {
control_parent->reorder_child (controls_frame, nth);
} else {
} else {
control_parent = parent;
parent->pack_start (controls_frame, false, false);
parent->reorder_child (controls_frame, nth);
}
controls_frame.show ();
controls_ebox.show ();
/* the coordinates used here are in the system of the
item's parent ...
*/
canvas_display->get_bounds (ix1, iy1, ix2, iy2);
iy1 += editor.get_trackview_group_vertical_offset ();
Group* pg = canvas_display->property_parent();
pg->i2w (ix1, iy1);
order = nth;
if (y_position != y) {
/* the coordinates used here are in the system of the
item's parent ...
*/
Group* pg;
double ix1, iy1, ix2, iy2;
canvas_display->get_bounds (ix1, iy1, ix2, iy2);
iy1 += editor.get_trackview_group_vertical_offset ();
pg = canvas_display->property_parent();
pg->i2w (ix1, iy1);
if (iy1 < 0) {
iy1 = 0;
}
canvas_display->move (0.0, y - iy1);
y_position = y;
if (iy1 < 0) {
iy1 = 0;
}
canvas_display->move (0.0, y - iy1);
canvas_display->show();/* XXX not necessary */
y_position = y;
order = nth;
canvas_display->raise_to_top ();
if (_marked_for_display && _hidden) {
canvas_display->show();
controls_frame.show ();
controls_ebox.show ();
}
_hidden = false;
/* height in pixels depends on _order, so update it now we've changed _order */
set_height (height);
effective_height = current_height();
/* now show children */
for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
if ((*i)->marked_for_display()) {
(*i)->canvas_display->show();
}
if (canvas_item_visible ((*i)->canvas_display)) {
++nth;
effective_height += (*i)->show_at (y + effective_height, nth, parent);
@ -376,9 +377,26 @@ TimeAxisView::set_heights (uint32_t h)
void
TimeAxisView::set_height(uint32_t h)
{
height = h;
/* XXX suboptimal to give the 0th controls frame a different height.
it would be better to offset the entire controls_frame by one pixel..
*/
int x,y;
controls_frame.get_size_request (x, y);
if (order == 0) {
if (y != h + 1) {
controls_frame.set_size_request (-1, h + 1);
}
} else {
if (y != h) {
controls_frame.set_size_request (-1, h);
}
}
controls_frame.set_size_request (-1, current_height() + ((order == 0) ? 1 : 0));
if (h == height) {
return;
}
height = h;
if (canvas_item_visible (selection_group)) {
/* resize the selection rect */