X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fcontrol_point.cc;h=bc7301dc1cdeffa3d40d09a4d74a1c6f0b00780f;hb=91c057494be9f97020211ee1855c2d1d190df95c;hp=5893c29e283d02923c6818461c8ea0bc386c4709;hpb=b65f8073ba306ac2d85133875746767e7c6b0eb6;p=ardour.git diff --git a/gtk2_ardour/control_point.cc b/gtk2_ardour/control_point.cc index 5893c29e28..bc7301dc1c 100644 --- a/gtk2_ardour/control_point.cc +++ b/gtk2_ardour/control_point.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2007 Paul Davis + Copyright (C) 2002-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,7 +26,6 @@ #include "i18n.h" using namespace std; -using namespace sigc; using namespace ARDOUR; using namespace PBD; using namespace Gnome; // for Canvas @@ -41,16 +40,15 @@ ControlPoint::ControlPoint (AutomationLine& al) _y = 0; _shape = Full; _size = 4.0; - _selected = false; _item = new Canvas::SimpleRect (_line.canvas_group()); _item->property_draw() = true; _item->property_fill() = false; - _item->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointFill.get(); + _item->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointFill.get(); _item->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get(); _item->property_outline_pixels() = 1; _item->set_data ("control_point", this); - _item->signal_event().connect (mem_fun (this, &ControlPoint::event_handler)); + _item->signal_event().connect (sigc::mem_fun (this, &ControlPoint::event_handler)); hide (); set_visible (false); @@ -70,13 +68,12 @@ ControlPoint::ControlPoint (const ControlPoint& other, bool /*dummy_arg_to_force _y = other._y; _shape = other._shape; _size = other._size; - _selected = false; _item = new Canvas::SimpleRect (_line.canvas_group()); _item->property_fill() = false; _item->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get(); _item->property_outline_pixels() = 1; - + /* NOTE: no event handling in copied ControlPoints */ hide (); @@ -111,41 +108,38 @@ ControlPoint::set_visible (bool yn) { _item->property_draw() = (gboolean) yn; } - + +bool +ControlPoint::visible () const +{ + return _item->property_draw (); +} + void ControlPoint::reset (double x, double y, AutomationList::iterator mi, uint32_t vi, ShapeType shape) { + /* If this is too big, libart will confuse itself and segfault after it casts the bounding box + of this automation line to ints. Sigh. + */ + + if (x > INT32_MAX) { + x = INT32_MAX; + } + _model = mi; _view_index = vi; move_to (x, y, shape); } void -ControlPoint::show_color (bool entered, bool hide_too) +ControlPoint::set_color () { uint32_t color = 0; - if (entered) { - if (_selected) { - color = ARDOUR_UI::config()->canvasvar_EnteredControlPointSelected.get(); - set_visible(true); - } else { - color = ARDOUR_UI::config()->canvasvar_EnteredControlPointOutline.get(); - if (hide_too) { - set_visible(false); - } - } - + if (_selected) { + color = ARDOUR_UI::config()->canvasvar_ControlPointSelected.get(); } else { - if (_selected) { - color = ARDOUR_UI::config()->canvasvar_ControlPointSelected.get(); - set_visible(true); - } else { - color = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get(); - if (hide_too) { - set_visible(false); - } - } + color = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get(); } _item->property_outline_color_rgba() = color; @@ -156,15 +150,6 @@ void ControlPoint::set_size (double sz) { _size = sz; - -#if 0 - if (_size > 6.0) { - item->property_fill() = (gboolean) TRUE; - } else { - item->property_fill() = (gboolean) FALSE; - } -#endif - move_to (_x, _y, _shape); } @@ -200,3 +185,8 @@ ControlPoint::move_to (double x, double y, ShapeType shape) _shape = shape; } +void +ControlPoint::i2w (double& x, double& y) const +{ + _item->i2w (x, y); +}