X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_cursors.cc;h=7f39cbe17548f7214662072a1a32e9dfd89b6a97;hb=2e9fcceb1e389aad4a3771c357f8504f27a49470;hp=740b96f9655a983700202c267ad17a320b463523;hpb=ad017365f7a73f8ba57f667cc1aa36478b48c50e;p=ardour.git diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc index 740b96f965..7f39cbe175 100644 --- a/gtk2_ardour/editor_cursors.cc +++ b/gtk2_ardour/editor_cursors.cc @@ -33,8 +33,7 @@ using namespace Gtk; EditorCursor::EditorCursor (Editor& ed, bool (Editor::*callbck)(GdkEvent*,ArdourCanvas::Item*)) : _editor (ed) - , _track_canvas_item (new ArdourCanvas::Arrow (_editor.get_hscroll_group())) - , _length (1.0) + , _track_canvas_item (new ArdourCanvas::Arrow (_editor.get_cursor_scroll_group())) { CANVAS_DEBUG_NAME (_track_canvas_item, "track canvas editor cursor"); @@ -48,14 +47,15 @@ EditorCursor::EditorCursor (Editor& ed, bool (Editor::*callbck)(GdkEvent*,Ardour _track_canvas_item->Event.connect (sigc::bind (sigc::mem_fun (ed, callbck), _track_canvas_item)); _track_canvas_item->set_y1 (ArdourCanvas::COORD_MAX); - - _current_frame = 1; /* force redraw at 0 */ + + _track_canvas_item->set_x (0); + + _current_sample = 1; /* force redraw at 0 */ } EditorCursor::EditorCursor (Editor& ed) : _editor (ed) , _track_canvas_item (new ArdourCanvas::Arrow (_editor.get_hscroll_group())) - , _length (1.0) { CANVAS_DEBUG_NAME (_track_canvas_item, "track canvas cursor"); @@ -63,8 +63,10 @@ EditorCursor::EditorCursor (Editor& ed) _track_canvas_item->set_show_head (1, false); _track_canvas_item->set_y1 (ArdourCanvas::COORD_MAX); _track_canvas_item->set_ignore_events (true); - - _current_frame = 1; /* force redraw at 0 */ + + _track_canvas_item->set_x (0); + + _current_sample = 1; /* force redraw at 0 */ } EditorCursor::~EditorCursor () @@ -73,17 +75,17 @@ EditorCursor::~EditorCursor () } void -EditorCursor::set_position (framepos_t frame) +EditorCursor::set_position (samplepos_t sample) { - PositionChanged (frame); + if (_current_sample != sample) { PositionChanged (sample); } - double const new_pos = _editor.sample_to_pixel_unrounded (frame); + double const new_pos = _editor.sample_to_pixel_unrounded (sample); - if (new_pos != _track_canvas_item->x ()) { + if (rint(new_pos) != rint(_track_canvas_item->x ())) { _track_canvas_item->set_x (new_pos); } - _current_frame = frame; + _current_sample = sample; } void @@ -99,7 +101,7 @@ EditorCursor::hide () } void -EditorCursor::set_color (ArdourCanvas::Color color) +EditorCursor::set_color (Gtkmm2ext::Color color) { _track_canvas_item->set_color (color); }