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
This commit is contained in:
Nick Mainsbridge 2008-09-17 19:04:16 +00:00
parent e6ea887276
commit dca4543c13
11 changed files with 124 additions and 119 deletions

View file

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

View file

@ -643,9 +643,6 @@ class Editor : public PublicEditor
/** The group containing all items that require horizontal scrolling. */ /** The group containing all items that require horizontal scrolling. */
ArdourCanvas::Group* _master_group; ArdourCanvas::Group* _master_group;
/** The group containiner marker bars */
ArdourCanvas::Group* _bar_group;
/* The group containing all trackviews. Only scrolled vertically. */ /* The group containing all trackviews. Only scrolled vertically. */
ArdourCanvas::Group* _trackview_group; ArdourCanvas::Group* _trackview_group;

View file

@ -113,34 +113,6 @@ Editor::initialize_canvas ()
track_canvas->set_center_scroll_region (false); track_canvas->set_center_scroll_region (false);
track_canvas->set_dither (Gdk::RGB_DITHER_NONE); 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<TargetEntry> 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 */ /* stuff for the verbose canvas cursor */
Pango::FontDescription* font = get_font_for_style (N_("VerboseCanvasCursor")); Pango::FontDescription* font = get_font_for_style (N_("VerboseCanvasCursor"));
@ -163,52 +135,55 @@ Editor::initialize_canvas ()
logo_item->show (); logo_item->show ();
} }
_master_group = new ArdourCanvas::Group (*track_canvas->root()); _master_group = new ArdourCanvas::Group (*track_canvas->root(), 0.0, 0.0);
_bar_group = new ArdourCanvas::Group (*_master_group);
_trackview_group = new ArdourCanvas::Group (*_master_group); transport_loop_range_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0);
_region_motion_group = new ArdourCanvas::Group (*_master_group); 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 */ /* 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 = 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_what() = (0x1 | 0x8);
meter_bar->property_outline_pixels() = 1; 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 = 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_what() = (0x1 | 0x8);
tempo_bar->property_outline_pixels() = 1; 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 = 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_what() = (0x1 | 0x8);
range_marker_bar->property_outline_pixels() = 1; 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 = 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_what() = (0x1 | 0x8);
transport_marker_bar->property_outline_pixels() = 1; 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 = 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_what() = (0x1 | 0x8);
marker_bar->property_outline_pixels() = 1; 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 = 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_what() = (0x1 | 0x8);
cd_marker_bar->property_outline_pixels() = 1; 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 (*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 = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0);
range_marker_drag_rect->hide (); 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); 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); 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->property_outline_pixels() = 0;
transport_bar_drag_rect->hide (); 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 = 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->property_outline_pixels() = 0;
transport_punch_range_rect->hide(); transport_punch_range_rect->hide();
transport_loop_range_rect->lower_to_bottom (); // loop on the bottom // 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_punchin_line = new ArdourCanvas::SimpleLine (*_master_group); transport_punchin_line = new ArdourCanvas::SimpleLine (*_master_group);
transport_punchin_line->property_x1() = 0.0; transport_punchin_line->property_x1() = 0.0;
@ -293,12 +258,41 @@ Editor::initialize_canvas ()
playhead_cursor = new Cursor (*this, &Editor::canvas_playhead_cursor_event); playhead_cursor = new Cursor (*this, &Editor::canvas_playhead_cursor_event);
initial_ruler_update_required = true; initial_ruler_update_required = true;
track_canvas->signal_size_allocate().connect (mem_fun(*this, &Editor::track_canvas_allocate));
if (logo_item) { if (logo_item) {
logo_item->lower_to_bottom (); 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<TargetEntry> 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)); ColorsChanged.connect (mem_fun (*this, &Editor::color_handler));
color_handler(); color_handler();
@ -407,32 +401,30 @@ Editor::controls_layout_size_request (Requisition* req)
screen = Gdk::Screen::get_default(); screen = Gdk::Screen::get_default();
} }
edit_controls_vbox.check_resize(); gint width = max (edit_controls_vbox.get_width(), controls_layout.get_width());
req->width = max (edit_controls_vbox.get_width(), controls_layout.get_width());
/* don't get too big. the fudge factors here are just guesses */ /* 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 width = min (width, screen->get_width() - 300);
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()) { if (req->width != width) {
/* req->width = width;
We're increasing the size of the canvas while the bottom is visible. }
We scroll down to keep in step with the controls layout.
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); controls_layout.set_size (edit_controls_vbox.get_width(), pos );
vertical_adjustment.set_value (pos + canvas_timebars_vsize - canvas_height); controls_layout.set_size_request(edit_controls_vbox.get_width(), -1);
} else { time_button_event_box.set_size_request(edit_controls_vbox.get_width(), -1);
vertical_adjustment.set_upper (pos + canvas_timebars_vsize); zoom_box.set_size_request(edit_controls_vbox.get_width(), -1);
} }
} }

View file

@ -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)); ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::handle_gui_changes), what, src));
if (what == "track_height") { 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 of on first-idle
*/ */
track_canvas->update_now (); //track_canvas->update_now ();
redisplay_route_list (); redisplay_route_list ();
} }
@ -364,11 +364,14 @@ Editor::redisplay_route_list ()
full_canvas_height = position; full_canvas_height = position;
/* make sure the cursors stay on top of every newly added track */ vertical_adjustment.set_upper (position + canvas_timebars_vsize);
if ((vertical_adjustment.get_value() + canvas_height) > vertical_adjustment.get_upper()) {
cursor_group->raise_to_top (); /*
We're increasing the size of the canvas while the bottom is visible.
//reset_scrolling_region (); 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) { if (Config->get_sync_all_route_ordering() && !ignore_route_list_reorder) {
ignore_route_order_sync = true; ignore_route_order_sync = true;

View file

@ -90,6 +90,7 @@ Editor::initialize_rulers ()
visible_timebars = 1; /*this will be changed below */ visible_timebars = 1; /*this will be changed below */
ruler_pressed_button = 0; ruler_pressed_button = 0;
canvas_timebars_vsize = 0;
} }
bool bool

View file

@ -224,53 +224,55 @@ TimeAxisView::~TimeAxisView()
guint32 guint32
TimeAxisView::show_at (double y, int& nth, VBox *parent) TimeAxisView::show_at (double y, int& nth, VBox *parent)
{ {
gdouble ix1, ix2, iy1, iy2;
effective_height = 0;
if (control_parent) { if (control_parent) {
control_parent->reorder_child (controls_hbox, nth); control_parent->reorder_child (controls_hbox, nth);
} else { } else {
control_parent = parent; control_parent = parent;
parent->pack_start (controls_hbox, false, false); parent->pack_start (controls_hbox, false, false);
parent->reorder_child (controls_hbox, nth); 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); order = nth;
iy1 += editor.get_trackview_group_vertical_offset ();
Group* pg = canvas_display->property_parent(); if (y_position != y) {
pg->i2w (ix1, iy1); /* 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->raise_to_top ();
canvas_display->show();/* XXX not necessary */
y_position = y; if (_marked_for_display) {
order = nth; canvas_display->show();
controls_hbox.show ();
controls_ebox.show ();
}
_hidden = false; _hidden = false;
/* height in pixels depends on _order, so update it now we've changed _order */
set_height (height);
effective_height = current_height(); effective_height = current_height();
/* now show children */ /* now show children */
for (Children::iterator i = children.begin(); i != children.end(); ++i) { 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)) { if (canvas_item_visible ((*i)->canvas_display)) {
++nth; ++nth;
effective_height += (*i)->show_at (y + effective_height, nth, parent); effective_height += (*i)->show_at (y + effective_height, nth, parent);
@ -391,6 +393,7 @@ TimeAxisView::set_heights (uint32_t h)
void void
TimeAxisView::set_height(uint32_t h) TimeAxisView::set_height(uint32_t h)
{ {
controls_ebox.property_height_request () = h;
height = h; height = h;
for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
@ -1046,7 +1049,7 @@ TimeAxisView::compute_controls_size_info ()
Gtk::Table one_row_table (1, 8); Gtk::Table one_row_table (1, 8);
Button* buttons[5]; Button* buttons[5];
const int border_width = 2; 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 + 2 // 2 pixels for the hseparator between TimeAxisView control areas
+ 10; // resizer button (3 x 2 pixel elements + 2 x 2 pixel gaps) + 10; // resizer button (3 x 2 pixel elements + 2 x 2 pixel gaps)

View file

@ -16,6 +16,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <cassert>
#include <ardour/analyser.h> #include <ardour/analyser.h>
#include <ardour/audiofilesource.h> #include <ardour/audiofilesource.h>

View file

@ -24,6 +24,7 @@
#include <list> #include <list>
#include <stdint.h> #include <stdint.h>
#include <stdint.h>
#include <sigc++/signal.h> #include <sigc++/signal.h>
namespace ARDOUR namespace ARDOUR

View file

@ -17,6 +17,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <cstring>
#include <string.h> #include <string.h>

View file

@ -29,6 +29,7 @@
#include <cstdlib> #include <cstdlib>
#undef __USE_SVID #undef __USE_SVID
#include <cstring>
#include <unistd.h> #include <unistd.h>
#include <inttypes.h> #include <inttypes.h>
#include <float.h> #include <float.h>

View file

@ -1,4 +1,4 @@
/* glib/glibmmconfig.h. Generated by configure. */ /* glib/glibmmconfig.h. Generated from glibmmconfig.h.in by configure. */
#ifndef _GLIBMM_CONFIG_H #ifndef _GLIBMM_CONFIG_H
#define _GLIBMM_CONFIG_H 1 #define _GLIBMM_CONFIG_H 1
@ -78,7 +78,7 @@
#ifdef GLIBMM_DLL #ifdef GLIBMM_DLL
#if defined(GLIBMM_BUILD) && defined(_WINDLL) #if defined(GLIBMM_BUILD) && defined(_WINDLL)
/* Do not dllexport as it is handled by gendef on MSVC */ /* Do not dllexport as it is handled by gendef on MSVC */
#define GLIBMM_API #define GLIBMM_API
#elif !defined(GLIBMM_BUILD) #elif !defined(GLIBMM_BUILD)
#define GLIBMM_API __declspec(dllimport) #define GLIBMM_API __declspec(dllimport)
#else #else