13
0

Fix stacked regions display mode.

git-svn-id: svn://localhost/ardour2/branches/3.0@4337 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2008-12-23 04:11:24 +00:00
parent d724837a44
commit e6c2f03ca1
7 changed files with 39 additions and 22 deletions

View File

@ -194,7 +194,7 @@ CrossfadeView::redraw_curves ()
for (int i = 0, pci = 0; i < npoints; ++i) {
Art::Point &p = (*points)[pci++];
p.set_x(i);
p.set_y(_y_position + 2.0 + h - (h * vec[i]));
p.set_y(2.0 + h - (h * vec[i]));
}
fade_in->property_points() = *points;
@ -202,7 +202,7 @@ CrossfadeView::redraw_curves ()
for (int i = 0, pci = 0; i < npoints; ++i) {
Art::Point &p = (*points)[pci++];
p.set_x(i);
p.set_y(_y_position + 2.0 + h - (h * vec[i]));
p.set_y(2.0 + h - (h * vec[i]));
}
fade_out->property_points() = *points;

View File

@ -68,7 +68,6 @@ struct CrossfadeView : public TimeAxisViewItem
bool _visible;
double spu;
double _y_position;
double _height;
ArdourCanvas::Item *overlap_rect;

View File

@ -1,4 +1,3 @@
/*
Copyright (C) 2000-2001 Paul Davis
@ -3902,7 +3901,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
double ix1, ix2, iy1, iy2;
rv2->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2);
rv2->get_canvas_frame()->i2w (ix1, iy1);
if (-x_delta > ix1 + horizontal_adjustment.get_value()) {
// do_move = false;
x_delta = 0;
@ -3954,27 +3953,33 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
for (list<RegionView*>::const_iterator i = layered_regions.begin(); i != layered_regions.end(); ++i) {
RegionView* rv = (*i);
double ix1, ix2, iy1, iy2;
int32_t temp_pointer_y_span = pointer_y_span;
if (rv->region()->locked()) {
continue;
}
/* get item BBox, which will be relative to parent. so we have
to query on a child, then convert to world coordinates using
the parent.
*/
/* here we are calculating the y distance from the
top of the first track view to the top of the region
area of the track view that we're working on */
rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2);
rv->get_canvas_frame()->i2w (ix1, iy1);
/* this x value is just a dummy value so that we have something
to pass to i2w () */
double ix1 = 0;
/* distance from the top of this track view to the region area
of our track view is always 1 */
cerr << "adjust y from " << iy1 << " using "
<< vertical_adjustment.get_value() << " - "
<< canvas_timebars_vsize
<< endl;
double iy1 = 1;
iy1 += get_trackview_group_vertical_offset ();;
/* convert to world coordinates, ie distance from the top of
the ruler section */
rv->get_canvas_frame()->i2w (ix1, iy1);
/* compensate for the ruler section and the vertical scrollbar position */
iy1 += get_trackview_group_vertical_offset ();
if (drag_info.first_move) {
@ -3989,7 +3994,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
parent groups have different coordinates.
*/
rv->get_canvas_group()->property_y() = iy1 - 1;
rv->get_canvas_group()->property_y() = iy1 - 1;
rv->get_canvas_group()->reparent(*_region_motion_group);
rv->fake_set_opaque (true);
@ -4040,7 +4045,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
temp_pointer_y_span++;
}
/* find out where we'll be when we move and set height accordingly */
tvp2 = trackview_by_y_position (iy1 + y_delta);
temp_rtv = dynamic_cast<RouteTimeAxisView*>(tvp2);
rv->set_height (temp_rtv->current_height());

View File

@ -167,6 +167,7 @@ StreamView::add_region_view (boost::shared_ptr<Region> r)
// ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::add_region_view), r));
add_region_view_internal (r, true);
update_contents_height ();
}
void
@ -433,8 +434,7 @@ StreamView::update_contents_height ()
(*i)->set_height (height);
break;
case Stacked:
cout << "FIXME: Stacked regions: set y position" << endl;
//double const y = (*i)->region()->layer() * lh;
(*i)->set_y ((*i)->region()->layer() * lh);
(*i)->set_height (lh);
break;
}

View File

@ -72,7 +72,7 @@ public:
virtual int set_samples_per_unit (gdouble spp);
gdouble get_samples_per_unit () { return _samples_per_unit; }
void set_layer_display (LayerDisplay);
void set_layer_display (LayerDisplay);
ArdourCanvas::Group* background_group() { return _background_group; }
ArdourCanvas::Group* canvas_item() { return canvas_group; }

View File

@ -1048,3 +1048,14 @@ TimeAxisViewItem::idle_remove_this_item(TimeAxisViewItem* item, void* src)
return false;
}
void
TimeAxisViewItem::set_y (double y)
{
double const old = group->property_y ();
if (y != old) {
group->move (0, y - old);
}
}

View File

@ -208,6 +208,8 @@ class TimeAxisViewItem : public Selectable
*/
virtual void set_height(double h) ;
void set_y (double);
/**
*
*/