diff options
Diffstat (limited to 'gtk2_ardour/automation_line.cc')
-rw-r--r-- | gtk2_ardour/automation_line.cc | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 94ca7802f0..2551b40c75 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -46,6 +46,8 @@ using std::isinf; #include "evoral/Curve.hpp" +#include "canvas/debug.h" + #include "automation_line.h" #include "control_point.h" #include "gui_thread.h" @@ -101,8 +103,10 @@ AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanv _height = 0; group = new ArdourCanvas::Group (&parent); + CANVAS_DEBUG_NAME (group, "region gain envelope group"); - line = new ArdourCanvas::Curve (group); + line = new ArdourCanvas::PolyLine (group); + CANVAS_DEBUG_NAME (line, "region gain envelope line"); line->set_data ("line", this); line->set_outline_width (2.0); @@ -151,20 +155,28 @@ AutomationLine::show () } } 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)->set_visible (true); (*i)->show (); } } else if (_visible & SelectedControlPoints) { for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) { - (*i)->set_visible ((*i)->get_selected()); + if ((*i)->get_selected()) { + (*i)->show (); + } else { + (*i)->hide (); + } } } else { for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) { - (*i)->set_visible (false); + (*i)->hide (); } } } @@ -172,7 +184,11 @@ AutomationLine::show () void AutomationLine::hide () { - set_visibility (VisibleAspects (0)); + /* leave control points setting unchanged, we are just hiding the + overall line + */ + + set_visibility (AutomationLine::VisibleAspects (_visible & ~Line)); } double @@ -1072,22 +1088,34 @@ AutomationLine::set_list (boost::shared_ptr<ARDOUR::AutomationList> list) void AutomationLine::add_visibility (VisibleAspects va) { + VisibleAspects old = _visible; + _visible = VisibleAspects (_visible | va); - show (); + + if (old != _visible) { + show (); + } } void AutomationLine::set_visibility (VisibleAspects va) { - _visible = va; - show (); + if (_visible != va) { + _visible = va; + show (); + } } void AutomationLine::remove_visibility (VisibleAspects va) { + VisibleAspects old = _visible; + _visible = VisibleAspects (_visible & ~va); - show (); + + if (old != _visible) { + show (); + } } void @@ -1222,9 +1250,8 @@ AutomationLine::add_visible_control_point (uint32_t view_index, uint32_t pi, dou if (_visible & ControlPoints) { control_points[view_index]->show (); - control_points[view_index]->set_visible (true); } else { - control_points[view_index]->set_visible (false); + control_points[view_index]->hide (); } } |