From dca4543c133a0d522b3df86c5f741e66d04e9e6c Mon Sep 17 00:00:00 2001 From: Nick Mainsbridge Date: Wed, 17 Sep 2008 19:04:16 +0000 Subject: Fix track height, partial merge of recent 2.0 updates (speed up track resizing, fix disappearing automation controls), rework layers and groups on canvas. git-svn-id: svn://localhost/ardour2/branches/3.0@3744 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/automation_time_axis.cc | 5 ++ gtk2_ardour/editor.h | 3 - gtk2_ardour/editor_canvas.cc | 146 +++++++++++++++++------------------- gtk2_ardour/editor_route_list.cc | 17 +++-- gtk2_ardour/editor_rulers.cc | 1 + gtk2_ardour/time_axis_view.cc | 65 ++++++++-------- libs/ardour/analyser.cc | 1 + libs/ardour/ardour/export_status.h | 1 + libs/ardour/export_file_io.cc | 1 + libs/ardour/export_utilities.cc | 1 + libs/glibmm2/glib/glibmmconfig.h | 4 +- 11 files changed, 125 insertions(+), 120 deletions(-) diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 47d0ebe61e..bc371a5826 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -444,6 +444,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) { diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 6385b37ef8..32de17a8a1 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -643,9 +643,6 @@ class Editor : public PublicEditor /** The group containing all items that require horizontal scrolling. */ ArdourCanvas::Group* _master_group; - /** The group containiner marker bars */ - ArdourCanvas::Group* _bar_group; - /* The group containing all trackviews. Only scrolled vertically. */ ArdourCanvas::Group* _trackview_group; diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 51093f3bcf..b74ece99be 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -113,34 +113,6 @@ Editor::initialize_canvas () track_canvas->set_center_scroll_region (false); track_canvas->set_dither (Gdk::RGB_DITHER_NONE); - /* need to handle 4 specific types of events as catch-alls */ - - track_canvas->signal_scroll_event().connect (mem_fun (*this, &Editor::track_canvas_scroll_event)); - track_canvas->signal_motion_notify_event().connect (mem_fun (*this, &Editor::track_canvas_motion_notify_event)); - track_canvas->signal_button_press_event().connect (mem_fun (*this, &Editor::track_canvas_button_press_event)); - track_canvas->signal_button_release_event().connect (mem_fun (*this, &Editor::track_canvas_button_release_event)); - - track_canvas->set_name ("EditorMainCanvas"); - track_canvas->add_events (Gdk::POINTER_MOTION_HINT_MASK|Gdk::SCROLL_MASK); - track_canvas->signal_leave_notify_event().connect (mem_fun(*this, &Editor::left_track_canvas)); - track_canvas->signal_enter_notify_event().connect (mem_fun(*this, &Editor::entered_track_canvas)); - track_canvas->set_flags (CAN_FOCUS); - - /* set up drag-n-drop */ - - vector target_table; - - // Drag-N-Drop from the region list can generate this target - target_table.push_back (TargetEntry ("regions")); - target_table.push_back (TargetEntry ("routes")); - - target_table.push_back (TargetEntry ("text/plain")); - target_table.push_back (TargetEntry ("text/uri-list")); - target_table.push_back (TargetEntry ("application/x-rootwin-drop")); - - track_canvas->drag_dest_set (target_table); - track_canvas->signal_drag_data_received().connect (mem_fun(*this, &Editor::track_canvas_drag_data_received)); - /* stuff for the verbose canvas cursor */ Pango::FontDescription* font = get_font_for_style (N_("VerboseCanvasCursor")); @@ -163,52 +135,55 @@ Editor::initialize_canvas () logo_item->show (); } - _master_group = new ArdourCanvas::Group (*track_canvas->root()); - _bar_group = new ArdourCanvas::Group (*_master_group); - _trackview_group = new ArdourCanvas::Group (*_master_group); - _region_motion_group = new ArdourCanvas::Group (*_master_group); + _master_group = new ArdourCanvas::Group (*track_canvas->root(), 0.0, 0.0); + + transport_loop_range_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0); + transport_loop_range_rect->property_outline_pixels() = 1; + transport_loop_range_rect->hide(); + + /* a group to hold time (measure) lines */ + time_line_group = new ArdourCanvas::Group (*_master_group, 0.0, 0.0); + + _trackview_group = new ArdourCanvas::Group (*_master_group, 0.0, 0.0); + _region_motion_group = new ArdourCanvas::Group (*_master_group, 0.0, 0.0); /* el barrio */ - meter_bar_group = new ArdourCanvas::Group (*_bar_group); + meter_bar_group = new ArdourCanvas::Group (*track_canvas->root()); meter_bar = new ArdourCanvas::SimpleRect (*meter_bar_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0); meter_bar->property_outline_what() = (0x1 | 0x8); meter_bar->property_outline_pixels() = 1; - tempo_bar_group = new ArdourCanvas::Group (*_bar_group); + tempo_bar_group = new ArdourCanvas::Group (*track_canvas->root()); tempo_bar = new ArdourCanvas::SimpleRect (*tempo_bar_group, 0.0, 0.0, max_canvas_coordinate, (timebar_height-1.0)); tempo_bar->property_outline_what() = (0x1 | 0x8); tempo_bar->property_outline_pixels() = 1; - range_marker_bar_group = new ArdourCanvas::Group (*_bar_group); + range_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root()); range_marker_bar = new ArdourCanvas::SimpleRect (*range_marker_bar_group, 0.0, 0.0, max_canvas_coordinate, (timebar_height-1.0)); range_marker_bar->property_outline_what() = (0x1 | 0x8); range_marker_bar->property_outline_pixels() = 1; - transport_marker_bar_group = new ArdourCanvas::Group (*_bar_group); + transport_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root()); transport_marker_bar = new ArdourCanvas::SimpleRect (*transport_marker_bar_group, 0.0, 0.0, max_canvas_coordinate, (timebar_height-1.0)); transport_marker_bar->property_outline_what() = (0x1 | 0x8); transport_marker_bar->property_outline_pixels() = 1; - marker_bar_group = new ArdourCanvas::Group (*_bar_group); + marker_bar_group = new ArdourCanvas::Group (*track_canvas->root()); marker_bar = new ArdourCanvas::SimpleRect (*marker_bar_group, 0.0, 0.0, max_canvas_coordinate, (timebar_height-1.0)); marker_bar->property_outline_what() = (0x1 | 0x8); marker_bar->property_outline_pixels() = 1; - cd_marker_bar_group = new ArdourCanvas::Group (*_bar_group); + cd_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root()); cd_marker_bar = new ArdourCanvas::SimpleRect (*cd_marker_bar_group, 0.0, 0.0, max_canvas_coordinate, (timebar_height-1.0)); cd_marker_bar->property_outline_what() = (0x1 | 0x8); cd_marker_bar->property_outline_pixels() = 1; - /* a group to hold time (measure) lines */ - - time_line_group = new ArdourCanvas::Group(*_master_group, 0.0, 0.0); - range_marker_drag_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, 0.0); //range_marker_drag_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0); range_marker_drag_rect->hide (); - timebar_group = new ArdourCanvas::Group (*_master_group); + timebar_group = new ArdourCanvas::Group (*track_canvas->root()); cursor_group = new ArdourCanvas::Group (*track_canvas->root(), 0.0, 0.0); meter_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height * 5.0); @@ -237,21 +212,11 @@ Editor::initialize_canvas () transport_bar_drag_rect->property_outline_pixels() = 0; transport_bar_drag_rect->hide (); - transport_loop_range_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0); - transport_loop_range_rect->property_outline_pixels() = 1; - transport_loop_range_rect->hide(); - transport_punch_range_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0); transport_punch_range_rect->property_outline_pixels() = 0; transport_punch_range_rect->hide(); - transport_loop_range_rect->lower_to_bottom (); // loop on the bottom - - time_line_group->lower_to_bottom(); - _trackview_group->raise_to_top(); - _bar_group->raise_to_top(); - timebar_group->raise_to_top(); - timebar_group->raise(1); +// transport_loop_range_rect->lower_to_bottom (); // loop on the bottom transport_punchin_line = new ArdourCanvas::SimpleLine (*_master_group); transport_punchin_line->property_x1() = 0.0; @@ -293,12 +258,41 @@ Editor::initialize_canvas () playhead_cursor = new Cursor (*this, &Editor::canvas_playhead_cursor_event); initial_ruler_update_required = true; - track_canvas->signal_size_allocate().connect (mem_fun(*this, &Editor::track_canvas_allocate)); if (logo_item) { logo_item->lower_to_bottom (); } + /* need to handle 4 specific types of events as catch-alls */ + + track_canvas->signal_scroll_event().connect (mem_fun (*this, &Editor::track_canvas_scroll_event)); + track_canvas->signal_motion_notify_event().connect (mem_fun (*this, &Editor::track_canvas_motion_notify_event)); + track_canvas->signal_button_press_event().connect (mem_fun (*this, &Editor::track_canvas_button_press_event)); + track_canvas->signal_button_release_event().connect (mem_fun (*this, &Editor::track_canvas_button_release_event)); + + track_canvas->set_name ("EditorMainCanvas"); + track_canvas->add_events (Gdk::POINTER_MOTION_HINT_MASK|Gdk::SCROLL_MASK); + track_canvas->signal_leave_notify_event().connect (mem_fun(*this, &Editor::left_track_canvas)); + track_canvas->signal_enter_notify_event().connect (mem_fun(*this, &Editor::entered_track_canvas)); + track_canvas->set_flags (CAN_FOCUS); + + /* set up drag-n-drop */ + + vector target_table; + + // Drag-N-Drop from the region list can generate this target + target_table.push_back (TargetEntry ("regions")); + target_table.push_back (TargetEntry ("routes")); + + target_table.push_back (TargetEntry ("text/plain")); + target_table.push_back (TargetEntry ("text/uri-list")); + target_table.push_back (TargetEntry ("application/x-rootwin-drop")); + + track_canvas->drag_dest_set (target_table); + track_canvas->signal_drag_data_received().connect (mem_fun(*this, &Editor::track_canvas_drag_data_received)); + + track_canvas->signal_size_allocate().connect (mem_fun(*this, &Editor::track_canvas_allocate)); + ColorsChanged.connect (mem_fun (*this, &Editor::color_handler)); color_handler(); @@ -407,32 +401,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); - - 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. + width = min (width, screen->get_width() - 300); + + 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); } } diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index 64e6660a5a..f2b8456fd9 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -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 (); } @@ -364,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; diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 47ea8d01a0..30a1ac992b 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -90,6 +90,7 @@ Editor::initialize_rulers () visible_timebars = 1; /*this will be changed below */ ruler_pressed_button = 0; + canvas_timebars_vsize = 0; } bool diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index f1d5eb1c67..d852fc1277 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -224,53 +224,55 @@ 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_hbox, nth); - } else { + } else { control_parent = parent; parent->pack_start (controls_hbox, false, false); parent->reorder_child (controls_hbox, nth); } - //controls_frame.show (); - controls_hbox.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 ... + */ + canvas_display->property_y () = y; +// canvas_display->move (0.0, 0.0); + + 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; - _hidden = false; - - /* height in pixels depends on _order, so update it now we've changed _order */ + canvas_display->raise_to_top (); - set_height (height); + if (_marked_for_display) { + canvas_display->show(); + controls_hbox.show (); + controls_ebox.show (); + } + _hidden = false; + effective_height = current_height(); /* now show children */ for (Children::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); @@ -391,6 +393,7 @@ TimeAxisView::set_heights (uint32_t h) void TimeAxisView::set_height(uint32_t h) { + controls_ebox.property_height_request () = h; height = h; for (list::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { @@ -1046,7 +1049,7 @@ TimeAxisView::compute_controls_size_info () Gtk::Table one_row_table (1, 8); Button* buttons[5]; const int border_width = 2; - const int extra_height = (2 * border_width) + const int extra_height = (2 * border_width); + 2 // 2 pixels for the hseparator between TimeAxisView control areas + 10; // resizer button (3 x 2 pixel elements + 2 x 2 pixel gaps) diff --git a/libs/ardour/analyser.cc b/libs/ardour/analyser.cc index 2e14c74b86..823d425bcf 100644 --- a/libs/ardour/analyser.cc +++ b/libs/ardour/analyser.cc @@ -16,6 +16,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include #include diff --git a/libs/ardour/ardour/export_status.h b/libs/ardour/ardour/export_status.h index f207268155..210e9585a4 100644 --- a/libs/ardour/ardour/export_status.h +++ b/libs/ardour/ardour/export_status.h @@ -24,6 +24,7 @@ #include #include +#include #include namespace ARDOUR diff --git a/libs/ardour/export_file_io.cc b/libs/ardour/export_file_io.cc index 7da6e8a60c..d4e8710759 100644 --- a/libs/ardour/export_file_io.cc +++ b/libs/ardour/export_file_io.cc @@ -17,6 +17,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include diff --git a/libs/ardour/export_utilities.cc b/libs/ardour/export_utilities.cc index 64fa62ded5..bd6677e363 100644 --- a/libs/ardour/export_utilities.cc +++ b/libs/ardour/export_utilities.cc @@ -29,6 +29,7 @@ #include #undef __USE_SVID +#include #include #include #include diff --git a/libs/glibmm2/glib/glibmmconfig.h b/libs/glibmm2/glib/glibmmconfig.h index 140cc376af..4e4bfa308f 100644 --- a/libs/glibmm2/glib/glibmmconfig.h +++ b/libs/glibmm2/glib/glibmmconfig.h @@ -1,4 +1,4 @@ -/* glib/glibmmconfig.h. Generated by configure. */ +/* glib/glibmmconfig.h. Generated from glibmmconfig.h.in by configure. */ #ifndef _GLIBMM_CONFIG_H #define _GLIBMM_CONFIG_H 1 @@ -78,7 +78,7 @@ #ifdef GLIBMM_DLL #if defined(GLIBMM_BUILD) && defined(_WINDLL) /* Do not dllexport as it is handled by gendef on MSVC */ - #define GLIBMM_API + #define GLIBMM_API #elif !defined(GLIBMM_BUILD) #define GLIBMM_API __declspec(dllimport) #else -- cgit v1.2.3