X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fcontrol_point.cc;h=2a457c52f1ec487a19fcb06c375ccdb5d5644859;hb=cf52d6e4b40111eb04b244ec054055a4ec15dbe0;hp=801bd5bb82e073985a2c7e955d3482c77b50b1b4;hpb=6898dd04a61cb06bd2238128be27e1f0ab6d6e62;p=ardour.git diff --git a/gtk2_ardour/control_point.cc b/gtk2_ardour/control_point.cc index 801bd5bb82..2a457c52f1 100644 --- a/gtk2_ardour/control_point.cc +++ b/gtk2_ardour/control_point.cc @@ -18,17 +18,19 @@ */ #include "control_point.h" -#include "diamond.h" #include "automation_line.h" -#include "ardour_ui.h" #include "public_editor.h" +#include "ui_config.h" -#include "i18n.h" +#include "canvas/rectangle.h" + +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; using namespace PBD; -using namespace Gnome; // for Canvas + +PBD::Signal1 ControlPoint::CatchDeletion; ControlPoint::ControlPoint (AutomationLine& al) : _line (al) @@ -41,17 +43,14 @@ ControlPoint::ControlPoint (AutomationLine& al) _shape = Full; _size = 4.0; - _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_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get(); - _item->property_outline_pixels() = 1; + _item = new ArdourCanvas::Rectangle (&_line.canvas_group()); + _item->set_fill (true); + _item->set_fill_color (UIConfiguration::instance().color ("control point fill")); + _item->set_outline_color (UIConfiguration::instance().color ("control point outline")); _item->set_data ("control_point", this); - _item->signal_event().connect (sigc::mem_fun (this, &ControlPoint::event_handler)); + _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*/) @@ -69,19 +68,19 @@ ControlPoint::ControlPoint (const ControlPoint& other, bool /*dummy_arg_to_force _shape = other._shape; _size = other._size; - _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; + _item = new ArdourCanvas::Rectangle (&_line.canvas_group()); + _item->set_fill (true); + _item->set_outline_color (UIConfiguration::instance().color ("control point outline")); /* NOTE: no event handling in copied ControlPoints */ hide (); - set_visible (false); } ControlPoint::~ControlPoint () { + CatchDeletion (this); /* EMIT SIGNAL */ + delete _item; } @@ -103,29 +102,15 @@ 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 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); @@ -134,16 +119,13 @@ ControlPoint::reset (double x, double y, AutomationList::iterator mi, uint32_t v void ControlPoint::set_color () { - uint32_t color = 0; - if (_selected) { - color = ARDOUR_UI::config()->canvasvar_ControlPointSelected.get(); + _item->set_outline_color(UIConfiguration::instance().color ("control point selected outline"));; + _item->set_fill_color(UIConfiguration::instance().color ("control point selected fill")); } else { - color = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get(); + _item->set_outline_color(UIConfiguration::instance().color ("control point outline")); + _item->set_fill_color(UIConfiguration::instance().color ("control point fill")); } - - _item->property_outline_color_rgba() = color; - _item->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointFill.get(); } void @@ -175,18 +157,15 @@ ControlPoint::move_to (double x, double y, ShapeType shape) break; } - _item->property_x1() = x1; - _item->property_x2() = x2; - _item->property_y1() = y - half_size; - _item->property_y2() = y + half_size; + _item->set (ArdourCanvas::Rect (x1, y - half_size, x2, y + half_size)); _x = x; _y = y; _shape = shape; } -void -ControlPoint::i2w (double& x, double& y) const +ArdourCanvas::Item& +ControlPoint::item() const { - _item->i2w (x, y); + return *_item; }