summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2008-12-23 04:11:24 +0000
committerCarl Hetherington <carl@carlh.net>2008-12-23 04:11:24 +0000
commite6c2f03ca1200381f379da8e84f8068d2901bbaf (patch)
tree854d8d689de112bf1652b8c5ec452249cc12bc99 /gtk2_ardour
parentd724837a4401b3d858d2a40b388d0cca8210cd5d (diff)
Fix stacked regions display mode.
git-svn-id: svn://localhost/ardour2/branches/3.0@4337 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/crossfade_view.cc4
-rw-r--r--gtk2_ardour/crossfade_view.h1
-rw-r--r--gtk2_ardour/editor_mouse.cc37
-rw-r--r--gtk2_ardour/streamview.cc4
-rw-r--r--gtk2_ardour/streamview.h2
-rw-r--r--gtk2_ardour/time_axis_view_item.cc11
-rw-r--r--gtk2_ardour/time_axis_view_item.h2
7 files changed, 39 insertions, 22 deletions
diff --git a/gtk2_ardour/crossfade_view.cc b/gtk2_ardour/crossfade_view.cc
index a412e310af..68dc2ecbe0 100644
--- a/gtk2_ardour/crossfade_view.cc
+++ b/gtk2_ardour/crossfade_view.cc
@@ -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;
diff --git a/gtk2_ardour/crossfade_view.h b/gtk2_ardour/crossfade_view.h
index 01e1672a35..6d45f05e79 100644
--- a/gtk2_ardour/crossfade_view.h
+++ b/gtk2_ardour/crossfade_view.h
@@ -68,7 +68,6 @@ struct CrossfadeView : public TimeAxisViewItem
bool _visible;
double spu;
- double _y_position;
double _height;
ArdourCanvas::Item *overlap_rect;
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index b652d129f6..c3a9bce7a8 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -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 */
+
+ double iy1 = 1;
+
+ /* convert to world coordinates, ie distance from the top of
+ the ruler section */
- cerr << "adjust y from " << iy1 << " using "
- << vertical_adjustment.get_value() << " - "
- << canvas_timebars_vsize
- << endl;
+ rv->get_canvas_frame()->i2w (ix1, iy1);
- iy1 += get_trackview_group_vertical_offset ();;
+ /* 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());
diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc
index 9658af06fc..beafdd841d 100644
--- a/gtk2_ardour/streamview.cc
+++ b/gtk2_ardour/streamview.cc
@@ -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;
}
diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h
index fe97489241..fa330dafae 100644
--- a/gtk2_ardour/streamview.h
+++ b/gtk2_ardour/streamview.h
@@ -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; }
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index 6469017469..be8b2ab471 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -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);
+ }
+}
+
+
+
diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h
index 0101995ca8..9643daf260 100644
--- a/gtk2_ardour/time_axis_view_item.h
+++ b/gtk2_ardour/time_axis_view_item.h
@@ -208,6 +208,8 @@ class TimeAxisViewItem : public Selectable
*/
virtual void set_height(double h) ;
+ void set_y (double);
+
/**
*
*/