From dbc27388bfc5e0cddbe6490404d3996eccd1f77d Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 29 Jan 2011 14:48:59 +0000 Subject: [PATCH] a radically new approach to sizing the track header layout that now allows ardour to shrink dramatically in vertical height. current lower limit is about 763 pixels WITH the editor mixer strip, and something much, much smaller without it git-svn-id: http://subversion.ardour.org/svn/ardour2/ardour2/branches/3.0@8608 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor.cc | 8 +++-- gtk2_ardour/editor.h | 6 ++-- gtk2_ardour/editor_actions.cc | 2 ++ gtk2_ardour/editor_canvas.cc | 69 +++++++++++++------------------------------ gtk2_ardour/editor_routes.cc | 3 ++ 5 files changed, 33 insertions(+), 55 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 931196115..f7c48daf3 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -485,7 +485,6 @@ 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 (sigc::mem_fun(*this, &Editor::edit_controls_button_release)); - controls_layout_size_request_connection = controls_layout.signal_size_request().connect (sigc::mem_fun (*this, &Editor::controls_layout_size_request)); _cursors = new MouseCursors; @@ -2107,9 +2106,9 @@ Editor::set_state (const XMLNode& node, int /*version*/) } } - set_default_size (g.base_width, g.base_height); + //set_default_size (g.base_width, g.base_height); move (x, y); - + if (_session && (prop = node.property ("playhead"))) { framepos_t pos; sscanf (prop->value().c_str(), "%" PRIi64, &pos); @@ -4849,6 +4848,8 @@ Editor::handle_new_route (RouteList& routes) RouteTimeAxisView *rtv; list new_views; + cerr << "Handle new route\n"; + for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) { boost::shared_ptr route = (*x); @@ -5473,3 +5474,4 @@ Editor::notebook_tab_clicked (GdkEventButton* ev, Gtk::Widget* page) return true; } + diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index aca401508..f16ca7872 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -934,11 +934,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::Table edit_packer; Gtk::Adjustment vertical_adjustment; - + Gtk::Layout controls_layout; bool control_layout_scroll (GdkEventScroll* ev); - void controls_layout_size_request (Gtk::Requisition*); - sigc::connection controls_layout_size_request_connection; + void reset_controls_layout_width (); + void reset_controls_layout_height (int32_t height); bool horizontal_scroll_left_press (); void horizontal_scroll_left_release (); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 3d94fd10b..6f1579bb5 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -1236,6 +1236,8 @@ Editor::parameter_changed (std::string p) _group_tabs->hide (); } + reset_controls_layout_width (); + Glib::RefPtr act = ActionManager::get_action (X_("Editor"), X_("ToggleGroupTabs")); if (act) { Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index a98f48a8a..79469d671 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -343,62 +343,33 @@ Editor::track_canvas_size_allocated () } void -Editor::controls_layout_size_request (Requisition* req) +Editor::reset_controls_layout_width () { - double pos = 0; - for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - pos += (*i)->effective_height (); - } - - gint height = min ((gint) pos, (gint) (physical_screen_height(get_window()) - 600)); - - bool changed = false; - - gint w = edit_controls_vbox.get_width(); - if (_group_tabs->is_mapped()) { - w += _group_tabs->get_width (); - } - - gint width = max (w, controls_layout.get_width()); - - /* don't get too big. the fudge factors here are just guesses */ - - width = min (width, (gint) (physical_screen_width(get_window()) - 300)); - - if ((req->width != width) || (req->height != height)) { - changed = true; - controls_layout_size_request_connection.disconnect (); - } + gint w = edit_controls_vbox.get_width(); - if (req->width != width) { - gint vbox_width = edit_controls_vbox.get_width(); - if (_group_tabs->is_mapped()) { - vbox_width += _group_tabs->get_width(); - } - req->width = width; + if (_group_tabs->is_mapped()) { + w += _group_tabs->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.property_width () = vbox_width; - controls_layout.property_width_request () = vbox_width; + /* the controls layout has no horizontal scrolling, its visible + width is always equal to the total width of its contents. + */ - // time_button_event_box.property_width_request () = vbox_width; - // zoom_box.property_width_request () = vbox_width; - } + controls_layout.property_width() = w; + controls_layout.property_width_request() = w; +} - if (req->height != height) { - req->height = height; - controls_layout.property_height () = (guint) floor (pos); - controls_layout.property_height_request () = height; - } +void +Editor::reset_controls_layout_height (int32_t h) +{ + /* set the height of the scrollable area (i.e. the sum of all contained widgets) + */ - if (changed) { - controls_layout_size_request_connection = controls_layout.signal_size_request().connect (sigc::mem_fun (*this, &Editor::controls_layout_size_request)); - } - //cerr << "sizes = " << req->width << " " << edit_controls_vbox.get_width() << " " << controls_layout.get_width() << " " << zoom_box.get_width() << " " << time_button_frame.get_width() << endl;//DEBUG + controls_layout.property_height() = h; + + /* size request is set elsewhere, see ::track_canvas_allocate() */ } - + bool Editor::track_canvas_map_handler (GdkEventAny* /*ev*/) { diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc index bc432990d..8ea152ba5 100644 --- a/gtk2_ardour/editor_routes.cc +++ b/gtk2_ardour/editor_routes.cc @@ -446,12 +446,15 @@ EditorRoutes::redisplay () n++; } + /* whenever we go idle, update the track view list to reflect the new order. we can't do this here, because we could mess up something that is traversing the track order and has caused a redisplay of the list. */ Glib::signal_idle().connect (sigc::mem_fun (*_editor, &Editor::sync_track_view_list_and_routes)); + _editor->reset_controls_layout_height (position); + _editor->reset_controls_layout_width (); _editor->full_canvas_height = position + _editor->canvas_timebars_vsize; _editor->vertical_adjustment.set_upper (_editor->full_canvas_height); -- 2.11.4.GIT