mega commit to remove gtk_object cruft, and much other stuff
[ardour.git] / gtk2_ardour / marker_time_axis_view.cc
index b07448e1a60780ac4c549555f080424382a3e28a..e08f5819519ecfbe1d87b0dc56e8875b4bd6b090 100644 (file)
@@ -20,8 +20,8 @@
 
 #include <algorithm>
 
-#include <gtk--.h>
-#include <gtkmmext/gtk_ui.h>
+#include <gtkmm.h>
+#include <gtkmm2ext/gtk_ui.h>
 
 #include "marker_time_axis_view.h"
 #include "marker_time_axis.h"
@@ -52,23 +52,23 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv)
        region_color = _trackview.color();
        stream_base_color = color_map[cMarkerTrackBase];
 
-       canvas_group = gtk_canvas_item_new (GTK_CANVAS_GROUP(_trackview.canvas_display), gtk_canvas_group_get_type (), 0);
+       //GTK2FIX -- how to get the group? is the canvas display really a group?
+       //canvas_group = gnome_canvas_item_new (GNOME_CANVAS_GROUP(_trackview.canvas_display), gnome_canvas_group_get_type (), 0);
+       canvas_group = new ArdourCanvas::Group (*_trackview.canvas_display);
 
-       canvas_rect = gtk_canvas_item_new (GTK_CANVAS_GROUP(canvas_group),
-               gtk_canvas_simplerect_get_type(),
-               "x1", 0.0,
-               "y1", 0.0,
-               "x2", 1000000.0,
-               "y2", (double)20,
-               "outline_color_rgba", color_map[cMarkerTrackOutline],
-               "fill_color_rgba", stream_base_color,
-               0) ;
-                                          
-       gtk_signal_connect(GTK_OBJECT(canvas_rect), "event", (GtkSignalFunc)PublicEditor::canvas_marker_time_axis_view_event, &_trackview) ;
+       canvas_rect =  new ArdourCanvas::SimpleRect (*canvas_group);
+       canvas_rect->property_x1() = 0.0;
+       canvas_rect->property_y1() = 0.0;
+       canvas_rect->property_x2() = 1000000.0;
+       canvas_rect->property_y2() = (double)20;
+       canvas_rect->property_outline_color_rgba() = color_map[cMarkerTrackOutline];
+       canvas_rect->property_fill_color_rgba() = stream_base_color;
+                  
+       canvas_rect->signal_event().connect (bind (mem_fun (_trackview.editor, &PublicEditor::canvas_marker_time_axis_view_event), canvas_rect, &_trackview));
 
        _samples_per_unit = _trackview.editor.get_current_zoom() ;
 
-       _trackview.editor.ZoomChanged.connect (slot(*this, &MarkerTimeAxisView::reset_samples_per_unit));
+       _trackview.editor.ZoomChanged.connect (mem_fun(*this, &MarkerTimeAxisView::reset_samples_per_unit));
 }
 
 /**
@@ -95,13 +95,13 @@ MarkerTimeAxisView::~MarkerTimeAxisView()
        
        if(canvas_rect)
        {
-               gtk_object_destroy(GTK_OBJECT(canvas_rect)) ;
+               delete canvas_rect;
                canvas_rect = 0 ;
        }
        
        if(canvas_group)
        {
-               gtk_object_destroy(GTK_OBJECT(canvas_group)) ;
+               delete canvas_group;
                canvas_group = 0 ;
        }
 }
@@ -123,7 +123,7 @@ MarkerTimeAxisView::set_height(gdouble h)
                return -1 ;
        }
        
-       gtk_object_set (GTK_OBJECT(canvas_rect), "y2", h, NULL);
+       canvas_rect->property_y2() = h;
 
        for (MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i)
        {
@@ -142,7 +142,8 @@ MarkerTimeAxisView::set_height(gdouble h)
 int
 MarkerTimeAxisView::set_position(gdouble x, gdouble y)
 {
-       gtk_canvas_item_set (canvas_group, "x", x, "y", y, NULL);
+       canvas_group->property_x() = x;
+       canvas_group->property_y() = y;
        return 0;
 }
 
@@ -174,7 +175,7 @@ MarkerTimeAxisView::set_samples_per_unit(gdouble spp)
  * @param color the new base color
  */
 void
-MarkerTimeAxisView::apply_color(GdkColor& color)
+MarkerTimeAxisView::apply_color(Gdk::Color& color)
 {
        region_color = color;
 
@@ -207,7 +208,7 @@ MarkerTimeAxisView::add_marker_view(ImageFrameView* ifv, std::string mark_type,
                return(0) ;
        }
        
-       MarkerView* mv = new MarkerView(GTK_CANVAS_GROUP(canvas_group),
+       MarkerView* mv = new MarkerView(canvas_group,
                 &_trackview,
                 ifv,
                 _trackview.editor.get_current_zoom(),
@@ -220,7 +221,7 @@ MarkerTimeAxisView::add_marker_view(ImageFrameView* ifv, std::string mark_type,
        ifv->add_marker_view_item(mv, src) ;
        marker_view_list.push_front(mv) ;
        
-       mv->GoingAway.connect(bind (slot (*this,&MarkerTimeAxisView::remove_marker_view), (void*)this)) ;
+       mv->GoingAway.connect(bind (mem_fun(*this,&MarkerTimeAxisView::remove_marker_view), (void*)this)) ;
        
         MarkerViewAdded(mv,src) ; /* EMIT_SIGNAL */
        
@@ -322,7 +323,7 @@ MarkerTimeAxisView::remove_named_marker_view(std::string item_id, void* src)
 void
 MarkerTimeAxisView::remove_marker_view(MarkerView* mv, void* src)
 {
-       ENSURE_GUI_THREAD(bind (slot (*this, &MarkerTimeAxisView::remove_marker_view), mv, src));
+       ENSURE_GUI_THREAD(bind (mem_fun(*this, &MarkerTimeAxisView::remove_marker_view), mv, src));
        
        MarkerViewList::iterator i;