diff options
author | Nick Mainsbridge <beatroute@iprimus.com.au> | 2008-09-24 19:23:43 +0000 |
---|---|---|
committer | Nick Mainsbridge <beatroute@iprimus.com.au> | 2008-09-24 19:23:43 +0000 |
commit | 8d3d1964400b44d3fbe67564a2cb9c12d7afda79 (patch) | |
tree | ff32a813e310ed60d6d0a3f3d9eab3d44df9606a /gtk2_ardour | |
parent | 8b0e9befb9bf3297df76520db5f069a995ebf92c (diff) |
fix feedback loop while track resizing
git-svn-id: svn://localhost/ardour2/branches/3.0@3803 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 31 |
3 files changed, 22 insertions, 12 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 60a93a63d6..c53a762df9 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -402,7 +402,7 @@ Editor::Editor () controls_layout.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK); controls_layout.signal_button_release_event().connect (mem_fun(*this, &Editor::edit_controls_button_release)); - controls_layout.signal_size_request().connect (mem_fun (*this, &Editor::controls_layout_size_request)); + controls_layout_size_request_connection = controls_layout.signal_size_request().connect (mem_fun (*this, &Editor::controls_layout_size_request)); edit_vscrollbar.set_adjustment (vertical_adjustment); edit_hscrollbar.set_adjustment (horizontal_adjustment); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 5d0290c378..a0918241bd 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -858,6 +858,7 @@ class Editor : public PublicEditor Gtk::Layout controls_layout; bool control_layout_scroll (GdkEventScroll* ev); void controls_layout_size_request (Gtk::Requisition*); + sigc::connection controls_layout_size_request_connection; Gtk::HScrollbar edit_hscrollbar; bool _dragging_hscrollbar; diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 2c728a4658..ec1315d40a 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -364,6 +364,7 @@ Editor::controls_layout_size_request (Requisition* req) TreeModel::Children rows = route_display_model->children(); TreeModel::Children::iterator i; double pos; + bool changed = false; for (pos = 0, i = rows.begin(); i != rows.end(); ++i) { TimeAxisView *tv = (*i)[route_display_columns.tv]; @@ -377,31 +378,39 @@ Editor::controls_layout_size_request (Requisition* req) if (!screen) { screen = Gdk::Screen::get_default(); } - + gint height = min ( (gint) pos, (screen->get_height() - 400)); gint width = max (edit_controls_vbox.get_width(), controls_layout.get_width()); /* don't get too big. the fudge factors here are just guesses */ width = min (width, screen->get_width() - 300); + if ((req->width != width) || (req->height != height)) { + changed = true; + controls_layout_size_request_connection.disconnect (); + } + if (req->width != width) { + gint vbox_width = edit_controls_vbox.get_width(); req->width = width; - time_button_event_box.set_size_request(edit_controls_vbox.get_width(), -1); - zoom_box.set_size_request(edit_controls_vbox.get_width(), -1); + + /* 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.property_width () = vbox_width; + controls_layout.property_width_request () = vbox_width; + + time_button_event_box.property_width_request () = vbox_width; + zoom_box.property_width_request () = vbox_width; } - gint height = min ( (gint) pos, (screen->get_height() - 400)); if (req->height != height) { req->height = height; + controls_layout.property_height () = (guint) floor (pos); } - if (width != edit_controls_vbox.get_width()) { - - /* 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(), pos ); - controls_layout.set_size_request(edit_controls_vbox.get_width(), -1); + if (changed) { + controls_layout_size_request_connection = controls_layout.signal_size_request().connect (mem_fun (*this, &Editor::controls_layout_size_request)); } } |