fix up visibility control for automation lines

This commit is contained in:
Paul Davis 2013-12-31 13:28:20 -05:00
parent 87c29025de
commit 68af0fdc07
3 changed files with 29 additions and 15 deletions

View File

@ -1323,7 +1323,8 @@ AudioRegionView::entered (bool internal_editing)
trackview.editor().set_current_trimmable (_region);
trackview.editor().set_current_movable (_region);
if (gain_line && trackview.editor().current_mouse_mode() == Editing::MouseGain) {
if (gain_line) {
/* these may or may not be visible depending on mouse mode */
gain_line->add_visibility (AutomationLine::ControlPoints);
}
@ -1341,7 +1342,7 @@ AudioRegionView::exited ()
trackview.editor().set_current_trimmable (boost::shared_ptr<Trimmable>());
trackview.editor().set_current_movable (boost::shared_ptr<Movable>());
if (gain_line && trackview.editor().current_mouse_mode() == Editing::MouseGain) {
if (gain_line) {
gain_line->remove_visibility (AutomationLine::ControlPoints);
}

View File

@ -144,6 +144,11 @@ 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) {
@ -168,7 +173,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
@ -1068,22 +1077,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

View File

@ -2043,7 +2043,6 @@ bool
Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
{
AutomationLine* al;
ControlPoint* cp;
Marker *marker;
Location *loc;
RegionView* rv;
@ -2052,13 +2051,6 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
switch (item_type) {
case ControlPointItem:
cp = reinterpret_cast<ControlPoint*>(item->get_data ("control_point"));
if (cp->line().the_list()->interpolation() != AutomationList::Discrete) {
if (cp->line().npoints() > 1 && !cp->get_selected()) {
cp->hide ();
}
}
if (is_drawable()) {
set_canvas_cursor (current_canvas_cursor);
}