mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
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.
This commit is contained in:
parent
e7059e5a16
commit
87c29025de
4 changed files with 12 additions and 20 deletions
|
|
@ -148,16 +148,19 @@ AutomationLine::show ()
|
||||||
|
|
||||||
if (_visible & ControlPoints) {
|
if (_visible & ControlPoints) {
|
||||||
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
|
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
|
||||||
(*i)->set_visible (true);
|
|
||||||
(*i)->show ();
|
(*i)->show ();
|
||||||
}
|
}
|
||||||
} else if (_visible & SelectedControlPoints) {
|
} else if (_visible & SelectedControlPoints) {
|
||||||
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
|
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 {
|
} else {
|
||||||
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
|
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) {
|
if (_visible & ControlPoints) {
|
||||||
control_points[view_index]->show ();
|
control_points[view_index]->show ();
|
||||||
control_points[view_index]->set_visible (true);
|
|
||||||
} else {
|
} else {
|
||||||
control_points[view_index]->set_visible (false);
|
control_points[view_index]->hide ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ ControlPoint::ControlPoint (AutomationLine& al)
|
||||||
_size = 4.0;
|
_size = 4.0;
|
||||||
|
|
||||||
_item = new ArdourCanvas::Rectangle (&_line.canvas_group());
|
_item = new ArdourCanvas::Rectangle (&_line.canvas_group());
|
||||||
_item->property_draw() = true;
|
|
||||||
_item->set_fill (false);
|
_item->set_fill (false);
|
||||||
_item->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ControlPointFill());
|
_item->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ControlPointFill());
|
||||||
_item->set_outline_color (ARDOUR_UI::config()->get_canvasvar_ControlPointOutline());
|
_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));
|
_item->Event.connect (sigc::mem_fun (this, &ControlPoint::event_handler));
|
||||||
|
|
||||||
hide ();
|
hide ();
|
||||||
set_visible (false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlPoint::ControlPoint (const ControlPoint& other, bool /*dummy_arg_to_force_special_copy_constructor*/)
|
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 */
|
/* NOTE: no event handling in copied ControlPoints */
|
||||||
|
|
||||||
hide ();
|
hide ();
|
||||||
set_visible (false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlPoint::~ControlPoint ()
|
ControlPoint::~ControlPoint ()
|
||||||
|
|
@ -105,16 +102,10 @@ ControlPoint::show()
|
||||||
_item->show();
|
_item->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ControlPoint::set_visible (bool yn)
|
|
||||||
{
|
|
||||||
_item->property_draw() = (gboolean) yn;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ControlPoint::visible () const
|
ControlPoint::visible () const
|
||||||
{
|
{
|
||||||
return _item->property_draw ();
|
return _item->visible ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -60,15 +60,14 @@ class ControlPoint : public Selectable
|
||||||
|
|
||||||
void hide ();
|
void hide ();
|
||||||
void show ();
|
void show ();
|
||||||
void set_color ();
|
bool visible () const;
|
||||||
|
|
||||||
double size () const {
|
double size () const {
|
||||||
return _size;
|
return _size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_size (double);
|
void set_size (double);
|
||||||
void set_visible (bool);
|
void set_color ();
|
||||||
bool visible () const;
|
|
||||||
|
|
||||||
bool can_slide() const { return _can_slide; }
|
bool can_slide() const { return _can_slide; }
|
||||||
void set_can_slide(bool yn) { _can_slide = yn; }
|
void set_can_slide(bool yn) { _can_slide = yn; }
|
||||||
|
|
|
||||||
|
|
@ -1833,7 +1833,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
|
||||||
case ControlPointItem:
|
case ControlPointItem:
|
||||||
if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
|
if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
|
||||||
cp = static_cast<ControlPoint*>(item->get_data ("control_point"));
|
cp = static_cast<ControlPoint*>(item->get_data ("control_point"));
|
||||||
cp->set_visible (true);
|
cp->show ();
|
||||||
|
|
||||||
double at_x, at_y;
|
double at_x, at_y;
|
||||||
at_x = cp->get_x();
|
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"));
|
cp = reinterpret_cast<ControlPoint*>(item->get_data ("control_point"));
|
||||||
if (cp->line().the_list()->interpolation() != AutomationList::Discrete) {
|
if (cp->line().the_list()->interpolation() != AutomationList::Discrete) {
|
||||||
if (cp->line().npoints() > 1 && !cp->get_selected()) {
|
if (cp->line().npoints() > 1 && !cp->get_selected()) {
|
||||||
cp->set_visible (false);
|
cp->hide ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue