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: svn://localhost/ardour2/branches/3.0@8608 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-01-29 14:48:59 +00:00
parent 8dde7e7f5d
commit 314f0d91d3
5 changed files with 34 additions and 56 deletions

View file

@ -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.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.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; _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); move (x, y);
if (_session && (prop = node.property ("playhead"))) { if (_session && (prop = node.property ("playhead"))) {
framepos_t pos; framepos_t pos;
sscanf (prop->value().c_str(), "%" PRIi64, &pos); sscanf (prop->value().c_str(), "%" PRIi64, &pos);
@ -4849,6 +4848,8 @@ Editor::handle_new_route (RouteList& routes)
RouteTimeAxisView *rtv; RouteTimeAxisView *rtv;
list<RouteTimeAxisView*> new_views; list<RouteTimeAxisView*> new_views;
cerr << "Handle new route\n";
for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) { for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) {
boost::shared_ptr<Route> route = (*x); boost::shared_ptr<Route> route = (*x);
@ -5473,3 +5474,4 @@ Editor::notebook_tab_clicked (GdkEventButton* ev, Gtk::Widget* page)
return true; return true;
} }

View file

@ -934,11 +934,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Gtk::Table edit_packer; Gtk::Table edit_packer;
Gtk::Adjustment vertical_adjustment; Gtk::Adjustment vertical_adjustment;
Gtk::Layout controls_layout; Gtk::Layout controls_layout;
bool control_layout_scroll (GdkEventScroll* ev); bool control_layout_scroll (GdkEventScroll* ev);
void controls_layout_size_request (Gtk::Requisition*); void reset_controls_layout_width ();
sigc::connection controls_layout_size_request_connection; void reset_controls_layout_height (int32_t height);
bool horizontal_scroll_left_press (); bool horizontal_scroll_left_press ();
void horizontal_scroll_left_release (); void horizontal_scroll_left_release ();

View file

@ -1236,6 +1236,8 @@ Editor::parameter_changed (std::string p)
_group_tabs->hide (); _group_tabs->hide ();
} }
reset_controls_layout_width ();
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleGroupTabs")); Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleGroupTabs"));
if (act) { if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act); Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);

View file

@ -343,62 +343,33 @@ Editor::track_canvas_size_allocated ()
} }
void void
Editor::controls_layout_size_request (Requisition* req) Editor::reset_controls_layout_width ()
{ {
double pos = 0; gint w = edit_controls_vbox.get_width();
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)); if (_group_tabs->is_mapped()) {
w += _group_tabs->get_width();
}
bool changed = false; /* the controls layout has no horizontal scrolling, its visible
width is always equal to the total width of its contents.
*/
gint w = edit_controls_vbox.get_width(); controls_layout.property_width() = w;
if (_group_tabs->is_mapped()) { controls_layout.property_width_request() = w;
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 ();
}
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;
/* 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;
}
if (req->height != height) {
req->height = height;
controls_layout.property_height () = (guint) floor (pos);
controls_layout.property_height_request () = height;
}
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
} }
void
Editor::reset_controls_layout_height (int32_t h)
{
/* set the height of the scrollable area (i.e. the sum of all contained widgets)
*/
controls_layout.property_height() = h;
/* size request is set elsewhere, see ::track_canvas_allocate() */
}
bool bool
Editor::track_canvas_map_handler (GdkEventAny* /*ev*/) Editor::track_canvas_map_handler (GdkEventAny* /*ev*/)
{ {

View file

@ -446,12 +446,15 @@ EditorRoutes::redisplay ()
n++; n++;
} }
/* whenever we go idle, update the track view list to reflect the new order. /* 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 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. 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)); 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->full_canvas_height = position + _editor->canvas_timebars_vsize;
_editor->vertical_adjustment.set_upper (_editor->full_canvas_height); _editor->vertical_adjustment.set_upper (_editor->full_canvas_height);