summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_cursors.cc
diff options
context:
space:
mode:
authorNick Mainsbridge <beatroute@iprimus.com.au>2005-11-13 03:53:51 +0000
committerNick Mainsbridge <beatroute@iprimus.com.au>2005-11-13 03:53:51 +0000
commit183f69970c6c436b102f8b2fbe1bc6070c9e9bfe (patch)
tree9e0831557d8b096605d7c80b563fec755b5cbdf0 /gtk2_ardour/editor_cursors.cc
parent1a3a77607768721f6834ddae09f532cdb6aec4a6 (diff)
some C++-ification of GnomeCanvasBlah
git-svn-id: svn://localhost/trunk/ardour2@82 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_cursors.cc')
-rw-r--r--gtk2_ardour/editor_cursors.cc51
1 files changed, 28 insertions, 23 deletions
diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc
index 7d2e5e3f11..7eae566f1c 100644
--- a/gtk2_ardour/editor_cursors.cc
+++ b/gtk2_ardour/editor_cursors.cc
@@ -33,13 +33,16 @@ using namespace Gtk;
Editor::Cursor::Cursor (Editor& ed, const string& color, bool (Editor::*callbck)(GdkEvent*))
: editor (ed), length(1.0)
{
- /* "randomly" initialize coords */
-
- points.push_back (Gnome::Art::Point (-9383839.0, 0.0));
- points.push_back (Gnome::Art::Point (1.0, 0.0));
- canvas_item = new Gnome::Canvas::Line (editor.cursor_group);
- canvas_item->set_property ("points", points.gobj());
+ /* "randomly" initialize coords */
+
+ points->push_back(Gnome::Art::Point(-9383839.0, 0.0));
+ points->push_back(Gnome::Art::Point(1.0, 0.0));
+ Gnome::Canvas::Group *group = editor.cursor_group;
+
+ // cerr << "set cursor points, nc = " << points->num_points << endl;
+
+ canvas_item = new Gnome::Canvas::Line (*group, *points);
canvas_item->set_property ("fill_color", color.c_str());
canvas_item->set_property ("width_pixels", 1);
canvas_item->set_property ("first_arrowhead", (gboolean) TRUE);
@@ -48,8 +51,10 @@ Editor::Cursor::Cursor (Editor& ed, const string& color, bool (Editor::*callbck)
canvas_item->set_property ("arrow_shape_b", 0.0);
canvas_item->set_property ("arrow_shape_c", 9.0);
+ // cerr << "cursor line @ " << canvas_item << endl;
+
canvas_item->set_data ("cursor", this);
- canvas_item->signal_event().connect (slot (ed, callback));
+ canvas_item->signal_event().connect (mem_fun (ed, callbck));
current_frame = 1; /* force redraw at 0 */
}
@@ -57,8 +62,8 @@ Editor::Cursor::Cursor (Editor& ed, const string& color, bool (Editor::*callbck)
Editor::Cursor::~Cursor ()
{
- gtk_object_destroy (GTK_OBJECT(canvas_item));
- gnome_canvas_points_unref (points);
+ gtk_object_destroy (GTK_OBJECT(canvas_item));
+ gnome_canvas_points_unref (points->gobj());
}
void
@@ -67,43 +72,43 @@ Editor::Cursor::set_position (jack_nframes_t frame)
double new_pos = editor.frame_to_unit (frame);
if (editor.session == 0) {
- gnome_canvas_item_hide (canvas_item);
+ canvas_item->hide();
} else {
- gnome_canvas_item_show (canvas_item);
+ canvas_item->show();
}
current_frame = frame;
- if (new_pos == points->coords[0]) {
+ if (new_pos == points->front().get_x()) {
/* change in position is not visible, so just raise it */
-
- gnome_canvas_item_raise_to_top (canvas_item);
+
+ canvas_item->raise_to_top();
return;
}
- points->coords[0] = new_pos;
- points->coords[2] = new_pos;
+ points->front().set_x(new_pos);
+ points->back().set_x(new_pos);
// cerr << "set cursor2 al points, nc = " << points->num_points << endl;
- gnome_canvas_item_set (canvas_item, "points", points, NULL);
- gnome_canvas_item_raise_to_top (canvas_item);
+ canvas_item->set_property ("points", points);
+ canvas_item->raise_to_top();
}
void
Editor::Cursor::set_length (double units)
{
length = units;
- points->coords[3] = points->coords[1] + length;
+ points->back().set_x (points->front().get_y() + length);
// cerr << "set cursor3 al points, nc = " << points->num_points << endl;
- gnome_canvas_item_set (canvas_item, "points", points, NULL);
+ canvas_item->set_property("points", points);
}
void
Editor::Cursor::set_y_axis (double position)
{
- points->coords[1] = position;
- points->coords[3] = position + length;
+ points->front().set_y (position);
+ points->back().set_x (position + length);
// cerr << "set cursor4 al points, nc = " << points->num_points << endl;
- gnome_canvas_item_set (canvas_item, "points", points, NULL);
+ canvas_item->set_property("points", points);
}