X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fcrossfade_view.cc;h=f81e95a4a97341ca343d7db043f6171079e3406f;hb=54a80321064aa543023cd0b224ba9d433520983f;hp=04867e51c6efb94bc3f08dafac14811d58f4a8d6;hpb=e493b2b7c4fbbbfc457f02babf9546289b430177;p=ardour.git diff --git a/gtk2_ardour/crossfade_view.cc b/gtk2_ardour/crossfade_view.cc index 04867e51c6..f81e95a4a9 100644 --- a/gtk2_ardour/crossfade_view.cc +++ b/gtk2_ardour/crossfade_view.cc @@ -35,19 +35,21 @@ using namespace sigc; using namespace ARDOUR; using namespace Editing; +using namespace Gnome; +using namespace Canvas; sigc::signal CrossfadeView::GoingAway; -CrossfadeView::CrossfadeView (GtkCanvasGroup *parent, +CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent, AudioTimeAxisView &tv, Crossfade& xf, double spu, - GdkColor& basic_color, + Gdk::Color& basic_color, AudioRegionView& lview, AudioRegionView& rview) - : TimeAxisViewItem ("xf.name()", parent, tv, spu, basic_color, xf.position(), + : TimeAxisViewItem ("xf.name()", *parent, tv, spu, basic_color, xf.position(), xf.overlap_length(), TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowFrame)), crossfade (xf), left_view (lview), @@ -57,37 +59,31 @@ CrossfadeView::CrossfadeView (GtkCanvasGroup *parent, _valid = true; _visible = true; - fade_in = gtk_canvas_item_new (GTK_CANVAS_GROUP(group), - gtk_canvas_line_get_type(), - "fill_color_rgba", color_map[cCrossfadeLine], - "width_pixels", (guint) 1, - NULL); - - fade_out = gtk_canvas_item_new (GTK_CANVAS_GROUP(group), - gtk_canvas_line_get_type(), - "fill_color_rgba", color_map[cCrossfadeLine], - "width_pixels", (guint) 1, - NULL); + fade_in = new Line (*group); + fade_in->property_fill_color_rgba().set_value(color_map[cCrossfadeLine]); + fade_in->property_width_pixels().set_value(1); + + fade_out = new Line (*group); + fade_out->property_fill_color_rgba().set_value(color_map[cCrossfadeLine]); + fade_out->property_width_pixels().set_value(1); set_height (get_time_axis_view().height); /* no frame around the xfade or overlap rects */ - gtk_canvas_item_set (frame, "outline_what", 0, NULL); + frame->set_property ("outline_what", 0); /* never show the vestigial frame */ - gtk_canvas_item_hide (vestigial_frame); + vestigial_frame->hide(); show_vestigial = false; - gtk_object_set_data (GTK_OBJECT(group), "crossfadeview", this); - gtk_signal_connect (GTK_OBJECT(group), "event", - (GtkSignalFunc) PublicEditor::canvas_crossfade_view_event, - this); - + // GTK2FIX + // group->signal_event.connect (bind (mem_fun (tv.editor, &PublicEditor::canvas_crossfade_view_event), group, this)); + crossfade_changed (Change (~0)); - crossfade.StateChanged.connect (slot (*this, &CrossfadeView::crossfade_changed)); + crossfade.StateChanged.connect (mem_fun(*this, &CrossfadeView::crossfade_changed)); } CrossfadeView::~CrossfadeView () @@ -110,8 +106,8 @@ CrossfadeView::reset_width_dependent_items (double pixel_width) active_changed (); if (pixel_width < 5) { - gtk_canvas_item_hide (fade_in); - gtk_canvas_item_hide (fade_out); + fade_in->hide(); + fade_out->hide(); } } @@ -149,7 +145,7 @@ CrossfadeView::crossfade_changed (Change what_changed) void CrossfadeView::redraw_curves () { - GtkCanvasPoints* points; + Points* points; int32_t npoints; float* vec; @@ -178,12 +174,12 @@ CrossfadeView::redraw_curves () npoints = std::min (gdk_screen_width(), npoints); if (!_visible || !crossfade.active() || npoints < 3) { - gtk_canvas_item_hide (fade_in); - gtk_canvas_item_hide (fade_out); + fade_in->hide(); + fade_out->hide(); return; } else { - gtk_canvas_item_show (fade_in); - gtk_canvas_item_show (fade_out); + fade_in->show(); + fade_out->show(); } points = get_canvas_points ("xfade edit redraw", npoints); @@ -191,36 +187,38 @@ CrossfadeView::redraw_curves () crossfade.fade_in().get_vector (0, crossfade.length(), vec, npoints); for (int i = 0, pci = 0; i < npoints; ++i) { - points->coords[pci++] = i; - points->coords[pci++] = 2.0 + h - (h * vec[i]); + Art::Point &p = (*points)[pci++]; + p.set_x(i); + p.set_y(2.0 + h - (h * vec[i])); } - gtk_canvas_item_set (fade_in, "points", points, NULL); + fade_in->property_points().set_value(*points); crossfade.fade_out().get_vector (0, crossfade.length(), vec, npoints); for (int i = 0, pci = 0; i < npoints; ++i) { - points->coords[pci++] = i; - points->coords[pci++] = 2.0 + h - (h * vec[i]); + Art::Point &p = (*points)[pci++]; + p.set_x(i); + p.set_y(2.0 + h - (h * vec[i])); } - gtk_canvas_item_set (fade_out, "points", points, NULL); + fade_out->property_points().set_value(*points); delete [] vec; - gtk_canvas_points_unref (points); + delete points; /* XXX this is ugly, but it will have to wait till Crossfades are reimplented as regions. This puts crossfade views on top of a track, above all regions. */ - gtk_canvas_item_raise_to_top (group); + group->raise_to_top(); } void CrossfadeView::active_changed () { if (crossfade.active()) { - gtk_canvas_item_set (frame, "fill_color_rgba", color_map[cActiveCrossfade], NULL); + frame->set_property ("fill_color_rgba", color_map[cActiveCrossfade]); } else { - gtk_canvas_item_set (frame, "fill_color_rgba", color_map[cInactiveCrossfade], NULL); + frame->set_property ("fill_color_rgba", color_map[cInactiveCrossfade]); } redraw_curves (); @@ -245,19 +243,19 @@ CrossfadeView::upper_regionview () const void CrossfadeView::show () { - gtk_canvas_item_show (group); + group->show(); _visible = true; } void CrossfadeView::hide () { - gtk_canvas_item_hide (group); + group->hide(); _visible = false; } void CrossfadeView::fake_hide () { - gtk_canvas_item_hide (group); + group->hide(); }