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();
hide_button.hide();
}
} else if (h >= hNormal){
auto_button.show();
height_button.show();
clear_button.show();
hide_button.show_all();
}
if (changed) {

View file

@ -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;

View file

@ -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<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 */
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<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));
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));
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
*/
controls_layout.set_size (edit_controls_vbox.get_width(), (gint) pos);
controls_layout.set_size (edit_controls_vbox.get_width(), 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.
*/
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);
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));
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;

View file

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

View file

@ -224,9 +224,6 @@ 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 {
@ -234,17 +231,21 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
parent->pack_start (controls_hbox, false, false);
parent->reorder_child (controls_hbox, nth);
}
//controls_frame.show ();
controls_hbox.show ();
controls_ebox.show ();
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 ();
Group* pg = canvas_display->property_parent();
pg = canvas_display->property_parent();
pg->i2w (ix1, iy1);
if (iy1 < 0) {
@ -252,25 +253,26 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
}
canvas_display->move (0.0, y - iy1);
canvas_display->show();/* XXX not necessary */
y_position = y;
order = nth;
}
canvas_display->raise_to_top ();
if (_marked_for_display) {
canvas_display->show();
controls_hbox.show ();
controls_ebox.show ();
}
_hidden = false;
/* height in pixels depends on _order, so update it now we've changed _order */
set_height (height);
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<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);
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)

View file

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

View file

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

View file

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

View file

@ -29,6 +29,7 @@
#include <cstdlib>
#undef __USE_SVID
#include <cstring>
#include <unistd.h>
#include <inttypes.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
#define _GLIBMM_CONFIG_H 1