summaryrefslogtreecommitdiff
path: root/gtk2_ardour/region_view.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-11-13 17:45:29 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-11-13 17:45:29 +0000
commita6d559553be37a880a88c229796a3b4f8fb9cd1b (patch)
tree37ac5bbb753606652ae06a898aac1b55209555c7 /gtk2_ardour/region_view.cc
parent312423f7fc1aebd3fece477f26dd0354a2726210 (diff)
sync point extends across entire region height
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2653 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/region_view.cc')
-rw-r--r--gtk2_ardour/region_view.cc70
1 files changed, 51 insertions, 19 deletions
diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc
index efd83ba60c..e3ab94e79e 100644
--- a/gtk2_ardour/region_view.cc
+++ b/gtk2_ardour/region_view.cc
@@ -69,6 +69,7 @@ RegionView::RegionView (ArdourCanvas::Group* parent,
TimeAxisViewItem::ShowFrame))
, _region (r)
, sync_mark(0)
+ , sync_line(0)
, editor(0)
, current_visible_sync_position(0.0)
, valid(false)
@@ -101,6 +102,7 @@ RegionView::RegionView (ArdourCanvas::Group* parent,
: TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), visibility)
, _region (r)
, sync_mark(0)
+ , sync_line(0)
, editor(0)
, current_visible_sync_position(0.0)
, valid(false)
@@ -118,6 +120,8 @@ RegionView::init (Gdk::Color& basic_color, bool wfd)
in_destructor = false;
_height = 0;
wait_for_data = wfd;
+ sync_mark = 0;
+ sync_line = 0;
compute_colors (basic_color);
@@ -127,19 +131,6 @@ RegionView::init (Gdk::Color& basic_color, bool wfd)
name_text->set_data ("regionview", this);
}
- /* an equilateral triangle */
-
- ArdourCanvas::Points shape;
- shape.push_back (Gnome::Art::Point (-((sync_mark_width-1)/2), 1));
- shape.push_back (Gnome::Art::Point ((sync_mark_width - 1)/2, 1));
- shape.push_back (Gnome::Art::Point (0, sync_mark_width - 1));
- shape.push_back (Gnome::Art::Point (-((sync_mark_width-1)/2), 1));
-
- sync_mark = new ArdourCanvas::Polygon (*group);
- sync_mark->property_points() = shape;
- sync_mark->property_fill_color_rgba() = fill_color;
- sync_mark->hide();
-
reset_width_dependent_items ((double) _region->length() / samples_per_unit);
set_height (trackview.height);
@@ -363,6 +354,7 @@ RegionView::set_colors ()
if (sync_mark) {
sync_mark->property_fill_color_rgba() = fill_color;
+ sync_line->property_fill_color_rgba() = fill_color;
}
}
@@ -427,15 +419,32 @@ RegionView::region_renamed ()
void
RegionView::region_sync_changed ()
{
- if (sync_mark == 0) {
- return;
- }
-
int sync_dir;
nframes_t sync_offset;
sync_offset = _region->sync_offset (sync_dir);
+ if (sync_offset == 0) {
+ /* no need for a sync mark */
+ if (sync_mark) {
+ sync_mark->hide();
+ sync_line->hide ();
+ }
+ return;
+ }
+
+ if (!sync_mark) {
+
+ /* points set below */
+
+ sync_mark = new ArdourCanvas::Polygon (*group);
+ sync_mark->property_fill_color_rgba() = fill_color;
+
+ sync_line = new ArdourCanvas::Line (*group);
+ sync_line->property_fill_color_rgba() = fill_color;
+ sync_line->property_width_pixels() = 1;
+ }
+
/* this has to handle both a genuine change of position, a change of samples_per_unit,
and a change in the bounds of the _region->
*/
@@ -443,8 +452,9 @@ RegionView::region_sync_changed ()
if (sync_offset == 0) {
/* no sync mark - its the start of the region */
-
+
sync_mark->hide();
+ sync_line->hide ();
} else {
@@ -453,6 +463,7 @@ RegionView::region_sync_changed ()
/* no sync mark - its out of the bounds of the region */
sync_mark->hide();
+ sync_line->hide ();
} else {
@@ -468,8 +479,14 @@ RegionView::region_sync_changed ()
points.push_back (Gnome::Art::Point (offset, sync_mark_width - 1));
points.push_back (Gnome::Art::Point (offset - ((sync_mark_width-1)/2), 1));
sync_mark->property_points().set_value (points);
- sync_mark->show();
+ sync_mark->show ();
+
+ points.clear ();
+ points.push_back (Gnome::Art::Point (offset, 0));
+ points.push_back (Gnome::Art::Point (offset, _height - NAME_HIGHLIGHT_SIZE));
+ sync_line->property_points().set_value (points);
+ sync_line->show ();
}
}
}
@@ -511,3 +528,18 @@ RegionView::get_fill_color ()
return fill_color;
}
+void
+RegionView::set_height (double h)
+{
+ if (sync_line) {
+ Points points;
+ int sync_dir;
+ nframes_t sync_offset;
+ sync_offset = _region->sync_offset (sync_dir);
+ double offset = sync_offset / samples_per_unit;
+
+ points.push_back (Gnome::Art::Point (offset, 0));
+ points.push_back (Gnome::Art::Point (offset, h - NAME_HIGHLIGHT_SIZE));
+ sync_line->property_points().set_value (points);
+ }
+}