fix audio clock restore, provide XMLNode::property (string) and speed up the property...
[ardour.git] / gtk2_ardour / marker_time_axis_view.cc
index e0a497bb0dc1fe8339c031cbf75f79c952eaf5c1..b6e87f871564a3cf8c0288b33ecc40e56e2a7fbf 100644 (file)
@@ -52,19 +52,17 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv)
        region_color = _trackview.color();
        stream_base_color = color_map[cMarkerTrackBase];
 
-       //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 Gnome::Canvas::Group (*_trackview.canvas_display);
-
-       canvas_rect =  new Gnome::Canvas::SimpleRect (*canvas_group);
-       canvas_rect->set_property ("x1", 0.0);
-       canvas_rect->set_property ("y1", 0.0);
-       canvas_rect->set_property ("x2", 1000000.0);
-       canvas_rect->set_property ("y2", (double)20);
-       canvas_rect->set_property ("outline_color_rgba", color_map[cMarkerTrackOutline]);
-       canvas_rect->set_property ("fill_color_rgba", stream_base_color);
+       canvas_group = new ArdourCanvas::Group (*_trackview.canvas_display);
+
+       canvas_rect =  new ArdourCanvas::SimpleRect (*canvas_group);
+       canvas_rect->property_x1() = 0.0;
+       canvas_rect->property_y1() = 0.0;
+       canvas_rect->property_x2() = max_frames;
+       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 (editor, &PublicEditor::canvas_marker_time_axis_view_event), canvas_rect, &_trackview));
+       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() ;
 
@@ -95,13 +93,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 +121,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,8 +140,8 @@ MarkerTimeAxisView::set_height(gdouble h)
 int
 MarkerTimeAxisView::set_position(gdouble x, gdouble y)
 {
-       canvas_group->set_property ("x", x);
-       canvas_group->set_property ("y", y);
+       canvas_group->property_x() = x;
+       canvas_group->property_y() = y;
        return 0;
 }
 
@@ -201,7 +199,7 @@ MarkerTimeAxisView::apply_color(Gdk::Color& color)
  * @param src the identity of the object that initiated the change
  */     
 MarkerView*
-MarkerTimeAxisView::add_marker_view(ImageFrameView* ifv, std::string mark_type, std::string mark_id, jack_nframes_t start, jack_nframes_t dur, void* src)
+MarkerTimeAxisView::add_marker_view(ImageFrameView* ifv, std::string mark_type, std::string mark_id, nframes_t start, nframes_t dur, void* src)
 {
        if(ifv->has_marker_view_item(mark_id))
        {
@@ -347,7 +345,7 @@ MarkerTimeAxisView::set_marker_duration_sec(double sec)
 {
   if(get_selected_time_axis_item() != 0)
   {
-         get_selected_time_axis_item()->set_duration((jack_nframes_t) (sec * _trackview.editor.current_session()->frame_rate()), this) ;
+         get_selected_time_axis_item()->set_duration((nframes_t) (sec * _trackview.editor.current_session()->frame_rate()), this) ;
   }
 }