summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-12-31 11:55:30 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2013-12-31 11:55:30 -0500
commit87c29025def783379b433b944a498ecd582a8af1 (patch)
tree7b2ba9c97454da69bac58b05112f727ad8cc6990
parente7059e5a16f43bc6f267c009c9144693905f5cae (diff)
just use show() and hide() to manage control point visibility in automation lines
No need for the wierd old set_visible()/property_draw() stuff that was a hangover from gnomecanvas.
-rw-r--r--gtk2_ardour/automation_line.cc12
-rw-r--r--gtk2_ardour/control_point.cc11
-rw-r--r--gtk2_ardour/control_point.h5
-rw-r--r--gtk2_ardour/editor_mouse.cc4
4 files changed, 12 insertions, 20 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index d75243691a..831bdb00f9 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -148,16 +148,19 @@ AutomationLine::show ()
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 ();
}
}
}
@@ -1215,9 +1218,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 ();
}
}
diff --git a/gtk2_ardour/control_point.cc b/gtk2_ardour/control_point.cc
index 8491534ec8..5343ff5f24 100644
--- a/gtk2_ardour/control_point.cc
+++ b/gtk2_ardour/control_point.cc
@@ -44,7 +44,6 @@ ControlPoint::ControlPoint (AutomationLine& al)
_size = 4.0;
_item = new ArdourCanvas::Rectangle (&_line.canvas_group());
- _item->property_draw() = true;
_item->set_fill (false);
_item->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ControlPointFill());
_item->set_outline_color (ARDOUR_UI::config()->get_canvasvar_ControlPointOutline());
@@ -52,7 +51,6 @@ ControlPoint::ControlPoint (AutomationLine& al)
_item->Event.connect (sigc::mem_fun (this, &ControlPoint::event_handler));
hide ();
- set_visible (false);
}
ControlPoint::ControlPoint (const ControlPoint& other, bool /*dummy_arg_to_force_special_copy_constructor*/)
@@ -77,7 +75,6 @@ ControlPoint::ControlPoint (const ControlPoint& other, bool /*dummy_arg_to_force
/* NOTE: no event handling in copied ControlPoints */
hide ();
- set_visible (false);
}
ControlPoint::~ControlPoint ()
@@ -105,16 +102,10 @@ ControlPoint::show()
_item->show();
}
-void
-ControlPoint::set_visible (bool yn)
-{
- _item->property_draw() = (gboolean) yn;
-}
-
bool
ControlPoint::visible () const
{
- return _item->property_draw ();
+ return _item->visible ();
}
void
diff --git a/gtk2_ardour/control_point.h b/gtk2_ardour/control_point.h
index 1a7a1f22b8..ce4c30be96 100644
--- a/gtk2_ardour/control_point.h
+++ b/gtk2_ardour/control_point.h
@@ -60,15 +60,14 @@ class ControlPoint : public Selectable
void hide ();
void show ();
- void set_color ();
+ bool visible () const;
double size () const {
return _size;
}
void set_size (double);
- void set_visible (bool);
- bool visible () const;
+ void set_color ();
bool can_slide() const { return _can_slide; }
void set_can_slide(bool yn) { _can_slide = yn; }
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 0c2dfcbdcb..4f1410299d 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -1833,7 +1833,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
case ControlPointItem:
if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
cp = static_cast<ControlPoint*>(item->get_data ("control_point"));
- cp->set_visible (true);
+ cp->show ();
double at_x, at_y;
at_x = cp->get_x();
@@ -2055,7 +2055,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
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->set_visible (false);
+ cp->hide ();
}
}