X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=inline;f=gtk2_ardour%2Fcontrol_point.cc;h=ea50f8bab86c9510a21e777d88f4f7a8fe45c3d0;hb=603748d68af1009fac47b284bf6f8815745586c7;hp=78a3dc57d503740f99b266c3ffbcc9129be0f825;hpb=8687895abba4209a6de8d8a8fc1bda5996f0d875;p=ardour.git diff --git a/gtk2_ardour/control_point.cc b/gtk2_ardour/control_point.cc index 78a3dc57d5..ea50f8bab8 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 "canvas/rectangle.h" + #include "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) @@ -40,19 +42,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_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 (ARDOUR_UI::config()->get_ControlPointFill()); + _item->set_outline_color (ARDOUR_UI::config()->get_ControlPointOutline()); _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,21 +67,20 @@ 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; + _item = new ArdourCanvas::Rectangle (&_line.canvas_group()); + _item->set_fill (true); + _item->set_outline_color (ARDOUR_UI::config()->get_ControlPointOutline()); /* NOTE: no event handling in copied ControlPoints */ hide (); - set_visible (false); } ControlPoint::~ControlPoint () { + CatchDeletion (this); /* EMIT SIGNAL */ + delete _item; } @@ -105,10 +102,10 @@ ControlPoint::show() _item->show(); } -void -ControlPoint::set_visible (bool yn) +bool +ControlPoint::visible () const { - _item->property_draw() = (gboolean) yn; + return _item->visible (); } void @@ -120,50 +117,24 @@ ControlPoint::reset (double x, double y, AutomationList::iterator mi, uint32_t v } 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()->get_ControlPointSelected(); } 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()->get_ControlPointOutline(); } - _item->property_outline_color_rgba() = color; - _item->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointFill.get(); + _item->set_outline_color (color); + _item->set_fill_color (ARDOUR_UI::config()->get_ControlPointFill()); } 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); } @@ -189,13 +160,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; } +ArdourCanvas::Item& +ControlPoint::item() const +{ + return *_item; +}