#include "i18n.h"
-Marker::Marker (PublicEditor& ed, GnomeCanvasGroup *parent, guint32 rgba, const string& annotation,
- Type type, gint (*callback)(GnomeCanvasItem *, GdkEvent *, gpointer), jack_nframes_t frame)
+Marker::Marker (PublicEditor& ed, Gnome::Canvas::Group& parent, guint32 rgba, const string& annotation,
+ Type type, gint (*callback)(Gnome::Canvas::Item *, GdkEvent *, gpointer), jack_nframes_t frame)
: editor (ed), _type(type)
{
switch (type) {
case Mark:
- points = gnome_canvas_points_new (6);
+ points = new Gnome::Canvas::Points ();
- points->coords[0] = 0.0;
- points->coords[1] = 0.0;
-
- points->coords[2] = 6.0;
- points->coords[3] = 0.0;
-
- points->coords[4] = 6.0;
- points->coords[5] = 5.0;
-
- points->coords[6] = 3.0;
- points->coords[7] = 10.0;
-
- points->coords[8] = 0.0;
- points->coords[9] = 5.0;
-
- points->coords[10] = 0.0;
- points->coords[11] = 0.0;
+ points->push_back (Gnome::Art::Point (0.0, 0.0));
+ points->push_back (Gnome::Art::Point (6.0, 0.0));
+
+ points->push_back (Gnome::Art::Point (6.0, 5.0));
+ points->push_back (Gnome::Art::Point (3.0, 10.0));
+
+ points->push_back (Gnome::Art::Point (0.0, 5.0));
+ points->push_back (Gnome::Art::Point (0.0, 0.0));
shift = 3;
label_offset = 8.0;
case Tempo:
case Meter:
- points = gnome_canvas_points_new (6);
- points->coords[0] = 3.0;
- points->coords[1] = 0.0;
-
- points->coords[2] = 6.0;
- points->coords[3] = 5.0;
-
- points->coords[4] = 6.0;
- points->coords[5] = 10.0;
-
- points->coords[6] = 0.0;
- points->coords[7] = 10.0;
-
- points->coords[8] = 0.0;
- points->coords[9] = 5.0;
-
- points->coords[10] = 3.0;
- points->coords[11] = 0.0;
-
+ points = new Gnome::Canvas::Points ();
+ points->push_back (Gnome::Art::Point (3.0, 0.0));
+ points->push_back (Gnome::Art::Point (6.0, 5.0));
+
+ points->push_back (Gnome::Art::Point (6.0, 10.0));
+ points->push_back (Gnome::Art::Point (0.0, 10.0));
+ points->push_back (Gnome::Art::Point (0.0, 5.0));
+ points->push_back (Gnome::Art::Point (3.0, 0.0));
+
shift = 3;
label_offset = 8.0;
break;
case Start:
- points = gnome_canvas_points_new (6);
+ points = new Gnome::Canvas::Points ();
+ points->push_back (Gnome::Art::Point (0.0, 0.0));
+ points->push_back (Gnome::Art::Point (5.0, 0.0));
+ points->push_back (Gnome::Art::Point (10.0, 5.0));
+ points->push_back (Gnome::Art::Point (5.0, 10.0));
+ points->push_back (Gnome::Art::Point (0.0, 10.0));
+ points->push_back (Gnome::Art::Point (0.0, 0.0));
- points->coords[0] = 0.0;
- points->coords[1] = 0.0;
-
- points->coords[2] = 5.0;
- points->coords[3] = 0.0;
-
- points->coords[4] = 10.0;
- points->coords[5] = 5.0;
-
- points->coords[6] = 5.0;
- points->coords[7] = 10.0;
-
- points->coords[8] = 0.0;
- points->coords[9] = 10.0;
-
- points->coords[10] = 0.0;
- points->coords[11] = 0.0;
-
shift = 10;
label_offset = 12.0;
break;
case End:
- points = gnome_canvas_points_new (6);
-
- points->coords[0] = 5.0;
- points->coords[1] = 0.0;
-
- points->coords[2] = 10.0;
- points->coords[3] = 0.0;
-
- points->coords[4] = 10.0;
- points->coords[5] = 10.0;
-
- points->coords[6] = 5.0;
- points->coords[7] = 10.0;
-
- points->coords[8] = 0.0;
- points->coords[9] = 5.0;
-
- points->coords[10] = 5.0;
- points->coords[11] = 0.0;
+ points = new Gnome::Canvas::Points ();
+ points->push_back (Gnome::Art::Point (5.0, 0.0));
+ points->push_back (Gnome::Art::Point (10.0, 0.0));
+ points->push_back (Gnome::Art::Point (10.0, 10.0));
+ points->push_back (Gnome::Art::Point (5.0, 10.0));
+ points->push_back (Gnome::Art::Point (0.0, 5.0));
+ points->push_back (Gnome::Art::Point (5.0, 0.0));
shift = 0;
label_offset = 12.0;
break;
case LoopStart:
- points = gnome_canvas_points_new (7);
-
- points->coords[0] = 0.0;
- points->coords[1] = 0.0;
-
- points->coords[2] = 4.0;
- points->coords[3] = 0.0;
-
- points->coords[4] = 4.0;
- points->coords[5] = 8.0;
-
- points->coords[6] = 8.0;
- points->coords[7] = 8.0;
-
- points->coords[8] = 8.0;
- points->coords[9] = 11.0;
-
- points->coords[10] = 0.0;
- points->coords[11] = 11.0;
-
- points->coords[12] = 0.0;
- points->coords[13] = 0.0;
+ points = new Gnome::Canvas::Points ();
+ points->push_back (Gnome::Art::Point (0.0, 0.0));
+ points->push_back (Gnome::Art::Point (4.0, 0.0));
+ points->push_back (Gnome::Art::Point (4.0, 8.0));
+ points->push_back (Gnome::Art::Point (8.0, 8.0));
+ points->push_back (Gnome::Art::Point (8.0, 11.0));
+ points->push_back (Gnome::Art::Point (0.0, 11.0));
+ points->push_back (Gnome::Art::Point (0.0, 0.0));
shift = 0;
label_offset = 11.0;
break;
case LoopEnd:
- points = gnome_canvas_points_new (7);
-
- points->coords[0] = 8.0;
- points->coords[1] = 0.0;
-
- points->coords[2] = 8.0;
- points->coords[3] = 11.0;
-
- points->coords[4] = 0.0;
- points->coords[5] = 11.0;
-
- points->coords[6] = 0.0;
- points->coords[7] = 8.0;
-
- points->coords[8] = 4.0;
- points->coords[9] = 8.0;
-
- points->coords[10] = 4.0;
- points->coords[11] = 0.0;
-
- points->coords[12] = 8.0;
- points->coords[13] = 0.0;
+ points = new Gnome::Canvas::Points ();
+ points->push_back (Gnome::Art::Point (8.0, 0.0));
+ points->push_back (Gnome::Art::Point (8.0, 11.0));
+ points->push_back (Gnome::Art::Point (0.0, 11.0));
+ points->push_back (Gnome::Art::Point (0.0, 8.0));
+ points->push_back (Gnome::Art::Point (4.0, 8.0));
+ points->push_back (Gnome::Art::Point (4.0, 0.0));
+ points->push_back (Gnome::Art::Point (8.0, 0.0));
shift = 8;
label_offset = 11.0;
break;
case PunchIn:
- points = gnome_canvas_points_new (6);
+ points = new Gnome::Canvas::Points ();
+ points->push_back (Gnome::Art::Point (0.0, 0.0));
+ points->push_back (Gnome::Art::Point (8.0, 0.0));
+ points->push_back (Gnome::Art::Point (4.0, 4.0));
+ points->push_back (Gnome::Art::Point (4.0, 11.0));
+ points->push_back (Gnome::Art::Point (0.0, 11.0));
+ points->push_back (Gnome::Art::Point (0.0, 0.0));
- points->coords[0] = 0.0;
- points->coords[1] = 0.0;
-
- points->coords[2] = 8.0;
- points->coords[3] = 0.0;
-
- points->coords[4] = 4.0;
- points->coords[5] = 4.0;
-
- points->coords[6] = 4.0;
- points->coords[7] = 11.0;
-
- points->coords[8] = 0.0;
- points->coords[9] = 11.0;
-
- points->coords[10] = 0.0;
- points->coords[11] = 0.0;
-
shift = 0;
label_offset = 10.0;
break;
case PunchOut:
- points = gnome_canvas_points_new (6);
+ points = new Gnome::Canvas::Points ();
+ points->push_back (Gnome::Art::Point (0.0, 0.0));
+ points->push_back (Gnome::Art::Point (8.0, 0.0));
+ points->push_back (Gnome::Art::Point (8.0, 11.0));
+ points->push_back (Gnome::Art::Point (4.0, 11.0));
+ points->push_back (Gnome::Art::Point (4.0, 4.0));
+ points->push_back (Gnome::Art::Point (0.0, 0.0));
- points->coords[0] = 0.0;
- points->coords[1] = 0.0;
-
- points->coords[2] = 8.0;
- points->coords[3] = 0.0;
-
- points->coords[4] = 8.0;
- points->coords[5] = 11.0;
-
- points->coords[6] = 4.0;
- points->coords[7] = 11.0;
-
- points->coords[8] = 4.0;
- points->coords[9] = 4.0;
-
- points->coords[10] = 0.0;
- points->coords[11] = 0.0;
-
shift = 8;
label_offset = 11.0;
break;
unit_position -= shift;
- group = gnome_canvas_item_new (parent,
- gnome_canvas_group_get_type(),
- "x", unit_position,
- "y", 1.0,
- NULL);
-
+ group = &parent;
+ group->set_property ("x", unit_position);
+ group->set_property ("y", 1.0);
// cerr << "set mark al points, nc = " << points->num_points << endl;
- mark = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group),
- gnome_canvas_polygon_get_type(),
- "points", points,
- "fill_color_rgba", rgba,
- "outline_color", "black",
- NULL);
-
- string fontname = get_font_for_style (N_("MarkerText"));
-
- text = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group),
- gnome_canvas_text_get_type (),
- "text", annotation.c_str(),
- "x", label_offset,
- "y", 0.0,
- "font", fontname.c_str(),
- "anchor", GTK_ANCHOR_NW,
- "fill_color", "black",
- NULL);
-
- gtk_object_set_data (GTK_OBJECT(group), "marker", this);
+ mark = new Gnome::Canvas::Polygon (*group);
+ mark->set_property ("points", points);
+ mark->set_property ("fill_color_rgba", rgba);
+ mark->set_property ("outline_color", Gdk::Color ("black"));
+
+ Pango::FontDescription font = get_font_for_style (N_("MarkerText"));
+
+ text = new Gnome::Canvas::Text (*group);
+ text->set_property ("text", annotation.c_str());
+ text->set_property ("x", label_offset);
+ text->set_property ("y", 0.0);
+ text->set_property ("fontdesc", font);
+ text->set_property ("anchor", Gtk::ANCHOR_NW);
+ text->set_property ("fill_color", Gdk::Color ("black"));
+
+ group->set_data ("marker", this);
gtk_signal_connect (GTK_OBJECT(group), "event", (GtkSignalFunc) callback, &editor);
editor.ZoomChanged.connect (mem_fun(*this, &Marker::reposition));
{
/* destroying the group destroys its contents */
gtk_object_destroy (GTK_OBJECT(group));
- gnome_canvas_points_unref (points);
+ gnome_canvas_points_unref (points->gobj());
}
void
Marker::set_name (const string& name)
{
- gnome_canvas_item_set (text, "text", name.c_str(), NULL);
+ text->set_property ("text", name.c_str());
}
void
{
double new_unit_position = editor.frame_to_unit (frame);
new_unit_position -= shift;
- gnome_canvas_item_move (group, new_unit_position - unit_position, 0.0);
+ group->move (new_unit_position - unit_position, 0.0);
frame_position = frame;
unit_position = new_unit_position;
}
void
Marker::show ()
{
- gnome_canvas_item_show (group);
+ group->show();
}
void
Marker::hide ()
{
- gnome_canvas_item_hide (group);
+ group->hide();
}
void
Marker::set_color_rgba (uint32_t color)
{
- gnome_canvas_item_set (mark, "fill_color_rgba", color, NULL);
+ mark->set_property ("fill_color_rgba", color);
}
/***********************************************************************/
-TempoMarker::TempoMarker (PublicEditor& editor, GnomeCanvasGroup *parent, guint32 rgba, const string& text,
+TempoMarker::TempoMarker (PublicEditor& editor, Gnome::Canvas::Group& parent, guint32 rgba, const string& text,
ARDOUR::TempoSection& temp,
- gint (*callback)(GnomeCanvasItem *, GdkEvent *, gpointer))
+ gint (*callback)(Gnome::Canvas::Item *, GdkEvent *, gpointer))
: Marker (editor, parent, rgba, text, Tempo, callback, 0),
_tempo (temp)
{
set_position (_tempo.frame());
- gtk_object_set_data (GTK_OBJECT(group), "tempo_marker", this);
+ group->set_data ("tempo_marker", this);
}
TempoMarker::~TempoMarker ()
/***********************************************************************/
-MeterMarker::MeterMarker (PublicEditor& editor, GnomeCanvasGroup *parent, guint32 rgba, const string& text,
+MeterMarker::MeterMarker (PublicEditor& editor, Gnome::Canvas::Group& parent, guint32 rgba, const string& text,
ARDOUR::MeterSection& m,
- gint (*callback)(GnomeCanvasItem *, GdkEvent *, gpointer))
+ gint (*callback)(Gnome::Canvas::Item *, GdkEvent *, gpointer))
: Marker (editor, parent, rgba, text, Meter, callback, 0),
_meter (m)
{