using namespace sigc;
using namespace ARDOUR;
using namespace Editing;
+using namespace Gnome;
+using namespace Canvas;
sigc::signal<void,CrossfadeView*> CrossfadeView::GoingAway;
-CrossfadeView::CrossfadeView (GnomeCanvasGroup *parent,
+CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent,
AudioTimeAxisView &tv,
Crossfade& xf,
double spu,
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),
_valid = true;
_visible = true;
- fade_in = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group),
- gnome_canvas_line_get_type(),
- "fill_color_rgba", color_map[cCrossfadeLine],
- "width_pixels", (guint) 1,
- NULL);
-
- fade_out = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group),
- gnome_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 */
- gnome_canvas_item_set (frame, "outline_what", 0, NULL);
+ frame->set_property ("outline_what", 0);
/* never show the vestigial frame */
- gnome_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 (mem_fun(*this, &CrossfadeView::crossfade_changed));
active_changed ();
if (pixel_width < 5) {
- gnome_canvas_item_hide (fade_in);
- gnome_canvas_item_hide (fade_out);
+ fade_in->hide();
+ fade_out->hide();
}
}
void
CrossfadeView::redraw_curves ()
{
- GnomeCanvasPoints* points;
+ Points* points;
int32_t npoints;
float* vec;
npoints = std::min (gdk_screen_width(), npoints);
if (!_visible || !crossfade.active() || npoints < 3) {
- gnome_canvas_item_hide (fade_in);
- gnome_canvas_item_hide (fade_out);
+ fade_in->hide();
+ fade_out->hide();
return;
} else {
- gnome_canvas_item_show (fade_in);
- gnome_canvas_item_show (fade_out);
+ fade_in->show();
+ fade_out->show();
}
points = get_canvas_points ("xfade edit redraw", npoints);
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]));
}
- gnome_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]));
}
- gnome_canvas_item_set (fade_out, "points", points, NULL);
+ fade_out->property_points().set_value(*points);
delete [] vec;
- gnome_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.
*/
- gnome_canvas_item_raise_to_top (group);
+ group->raise_to_top();
}
void
CrossfadeView::active_changed ()
{
if (crossfade.active()) {
- gnome_canvas_item_set (frame, "fill_color_rgba", color_map[cActiveCrossfade], NULL);
+ frame->set_property ("fill_color_rgba", color_map[cActiveCrossfade]);
} else {
- gnome_canvas_item_set (frame, "fill_color_rgba", color_map[cInactiveCrossfade], NULL);
+ frame->set_property ("fill_color_rgba", color_map[cInactiveCrossfade]);
}
redraw_curves ();
void
CrossfadeView::show ()
{
- gnome_canvas_item_show (group);
+ group->show();
_visible = true;
}
void
CrossfadeView::hide ()
{
- gnome_canvas_item_hide (group);
+ group->hide();
_visible = false;
}
void
CrossfadeView::fake_hide ()
{
- gnome_canvas_item_hide (group);
+ group->hide();
}