fix (mostly) measure lines and click box text and meter markings
[ardour.git] / gtk2_ardour / automation_line.cc
index c21cf705829b2579fe9c8c7fec5473f9bdb11564..70bc676fca8cae35848bb730bc02f55292e9b3b3 100644 (file)
@@ -51,7 +51,7 @@ using namespace ARDOUR;
 using namespace Editing;
 using namespace Gnome; // for Canvas
 
-ControlPoint::ControlPoint (AutomationLine& al, sigc::slot<bool,GdkEvent*,ControlPoint*> handler)
+ControlPoint::ControlPoint (AutomationLine& al)
        : line (al)
 {
        model = al.the_list().end();
@@ -70,7 +70,7 @@ ControlPoint::ControlPoint (AutomationLine& al, sigc::slot<bool,GdkEvent*,Contro
        item->property_outline_color_rgba() = color_map[cControlPointOutline];
        item->property_outline_pixels() = 1;
        item->set_data ("control_point", this);
-       item->signal_event().connect (bind (handler, this));
+       item->signal_event().connect (mem_fun (this, &ControlPoint::event_handler));
 
        hide ();
        set_visible (false);
@@ -105,7 +105,13 @@ ControlPoint::ControlPoint (const ControlPoint& other, bool dummy_arg_to_force_s
 
 ControlPoint::~ControlPoint ()
 {
-       gtk_object_destroy (GTK_OBJECT(item));
+       delete item;
+}
+
+bool
+ControlPoint::event_handler (GdkEvent* event)
+{
+       return PublicEditor::instance().canvas_control_point_event (event, item, this);
 }
 
 void
@@ -123,7 +129,7 @@ ControlPoint::show()
 void
 ControlPoint::set_visible (bool yn)
 {
-       item->set_property ("draw", (gboolean) yn);
+       item->property_draw() = (gboolean) yn;
 }
 
 void
@@ -139,10 +145,10 @@ ControlPoint::show_color (bool entered, bool hide_too)
 {
        if (entered) {
                if (selected) {
-                       item->set_property ("outline_color_rgba", color_map[cEnteredControlPointSelected]);
+                       item->property_outline_color_rgba() = color_map[cEnteredControlPointSelected];
                        set_visible(true);
                } else {
-                       item->set_property ("outline_color_rgba", color_map[cEnteredControlPoint]);
+                       item->property_outline_color_rgba() = color_map[cEnteredControlPoint];
                        if (hide_too) {
                                set_visible(false);
                        }
@@ -150,10 +156,10 @@ ControlPoint::show_color (bool entered, bool hide_too)
 
        } else {
                if (selected) {
-                       item->set_property ("outline_color_rgba", color_map[cControlPointSelected]);
+                       item->property_outline_color_rgba() = color_map[cControlPointSelected];
                        set_visible(true);
                } else {
-                       item->set_property ("outline_color_rgba", color_map[cControlPoint]);
+                       item->property_outline_color_rgba() = color_map[cControlPoint];
                        if (hide_too) {
                                set_visible(false);
                        }
@@ -168,9 +174,9 @@ ControlPoint::set_size (double sz)
 
 #if 0  
        if (_size > 6.0) {
-               item->set_property ("fill", (gboolean) TRUE);
+               item->property_fill() = (gboolean) TRUE;
        } else {
-               item->set_property ("fill", (gboolean) FALSE);
+               item->property_fill() = (gboolean) FALSE;
        }
 #endif
 
@@ -199,10 +205,10 @@ ControlPoint::move_to (double x, double y, ShapeType shape)
                break;
        }
 
-       item->set_property ("x1", x1);
-       item->set_property ("x2", x2);
-       item->set_property ("y1", y - half_size);
-       item->set_property ("y2", y + half_size);
+       item->property_x1() = x1;
+       item->property_x2() = x2;
+       item->property_y1() = y - half_size;
+       item->property_y2() = y + half_size;
 
        _x = x;
        _y = y;
@@ -211,10 +217,7 @@ ControlPoint::move_to (double x, double y, ShapeType shape)
 
 /*****/
 
-AutomationLine::AutomationLine (string name, TimeAxisView& tv, Gnome::Canvas::Group& parent, AutomationList& al,
-                               slot<bool,GdkEvent*,ControlPoint*> point_handler,
-                               slot<bool,GdkEvent*,AutomationLine*> line_handler)
-
+AutomationLine::AutomationLine (const string & name, TimeAxisView& tv, ArdourCanvas::Group& parent, AutomationList& al)
        : trackview (tv),
          _name (name),
          alist (al),
@@ -225,19 +228,18 @@ AutomationLine::AutomationLine (string name, TimeAxisView& tv, Gnome::Canvas::Gr
        _vc_uses_gain_mapping = false;
        no_draw = false;
        _visible = true;
-       point_slot = point_handler;
        terminal_points_can_slide = true;
        _height = 0;
 
-       group = new Gnome::Canvas::Group (parent);
-       group->set_property ("x", 0.0);
-       group->set_property ("y", 0.0);
-
-       line = new Gnome::Canvas::Line (*group);
-       line->set_property ("width_pixels", (guint)1);
+       group = new ArdourCanvas::Group (parent);
+       group->property_x() = 0.0;
+       group->property_y() = 0.0;
 
+       line = new ArdourCanvas::Line (*group);
+       line->property_width_pixels() = (guint)1;
        line->set_data ("line", this);
-       line->signal_event().connect (bind (line_handler, this));
+
+       line->signal_event().connect (mem_fun (*this, &AutomationLine::event_handler));
 
        alist.StateChanged.connect (mem_fun(*this, &AutomationLine::list_changed));
 }
@@ -245,8 +247,13 @@ AutomationLine::AutomationLine (string name, TimeAxisView& tv, Gnome::Canvas::Gr
 AutomationLine::~AutomationLine ()
 {
        vector_delete (&control_points);
+       delete group;
+}
 
-       gtk_object_destroy (GTK_OBJECT(group));
+bool
+AutomationLine::event_handler (GdkEvent* event)
+{
+       return PublicEditor::instance().canvas_line_event (event, line, this);
 }
 
 void
@@ -312,7 +319,7 @@ void
 AutomationLine::set_line_color (uint32_t color)
 {
        _line_color = color;
-       line->set_property ("fill_color_rgba", color);
+       line->property_fill_color_rgba() = color;
 }
 
 void
@@ -736,7 +743,7 @@ AutomationLine::determine_visible_control_points (ALPoints& points)
                if (view_index >= control_points.size()) {
                        /* make sure we have enough control points */
 
-                       ControlPoint* ncp = new ControlPoint (*this, point_slot);
+                       ControlPoint* ncp = new ControlPoint (*this);
 
                        if (_height > (guint32) TimeAxisView::Larger) {
                                ncp->set_size (8.0);