exercise subsurface rendering for x-fade curves
[ardour.git] / gtk2_ardour / automation_line.cc
index 8a11f199affa103206f2ff824a093a5484055c29..7e37c32eb734f3a37d22a0ad5e51f86a2623e7f4 100644 (file)
@@ -105,6 +105,7 @@ AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanv
        CANVAS_DEBUG_NAME (line, "region gain envelope line");
        line->set_data ("line", this);
        line->set_outline_width (2.0);
+       line->set_covers_threshold (4.0);
 
        line->Event.connect (sigc::mem_fun (*this, &AutomationLine::event_handler));
 
@@ -137,7 +138,7 @@ AutomationLine::event_handler (GdkEvent* event)
 }
 
 void
-AutomationLine::show ()
+AutomationLine::update_visibility ()
 {
        if (_visible & Line) {
                /* Only show the line there are some points, otherwise we may show an out-of-date line
@@ -149,32 +150,32 @@ AutomationLine::show ()
                } else {
                        line->hide ();
                }
-       } else {
-               line->hide();
-               /* if the line is not visible, then no control points should be visible */
-               for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
-                       (*i)->hide ();
-               }
-               return;
-       }
 
-       if (_visible & ControlPoints) {
-               for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
-                       (*i)->show ();
-               }
-       } else if (_visible & SelectedControlPoints) {
-               for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
-                       if ((*i)->get_selected()) {
+               if (_visible & ControlPoints) {
+                       for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
                                (*i)->show ();
-                       } else {
+                       }
+               } else if (_visible & SelectedControlPoints) {
+                       for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
+                               if ((*i)->get_selected()) {
+                                       (*i)->show ();
+                               } else {
+                                       (*i)->hide ();
+                               }
+                       }
+               } else {
+                       for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
                                (*i)->hide ();
                        }
                }
+
        } else {
+               line->hide ();
                for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
                        (*i)->hide ();
                }
        }
+
 }
 
 void
@@ -1006,9 +1007,7 @@ AutomationLine::reset_callback (const Evoral::ControlList& events)
 
                line->set (line_points);
 
-               if (_visible && alist->interpolation() != AutomationList::Discrete) {
-                       line->show();
-               }
+               update_visibility ();
        }
 
        set_selected_points (trackview.editor().get_selection().points);
@@ -1081,7 +1080,7 @@ AutomationLine::add_visibility (VisibleAspects va)
        _visible = VisibleAspects (_visible | va);
 
        if (old != _visible) {
-               show ();
+               update_visibility ();
        }
 }
 
@@ -1090,7 +1089,7 @@ AutomationLine::set_visibility (VisibleAspects va)
 {
        if (_visible != va) {
                _visible = va;
-               show ();
+               update_visibility ();
        }
 }
 
@@ -1102,7 +1101,7 @@ AutomationLine::remove_visibility (VisibleAspects va)
        _visible = VisibleAspects (_visible & ~va);
 
        if (old != _visible) {
-               show ();
+               update_visibility ();
        }
 }