fix incorrect accumulation of export video options each time the dialog is used
[ardour.git] / gtk2_ardour / editor_cursors.cc
index ed5f3130132031d4e5c9f1616e5d2b33ea2fa5c6..3df7761007a09c46da17b799932c64c2403d58e8 100644 (file)
@@ -33,7 +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()))
+       , _track_canvas_item (new ArdourCanvas::Arrow (_editor.get_cursor_scroll_group()))
 {
        CANVAS_DEBUG_NAME (_track_canvas_item, "track canvas editor cursor");
 
@@ -48,9 +48,9 @@ EditorCursor::EditorCursor (Editor& ed, bool (Editor::*callbck)(GdkEvent*,Ardour
 
        _track_canvas_item->set_y1 (ArdourCanvas::COORD_MAX);
 
-    _track_canvas_item->set_x (0);
-       
-       _current_frame = 1; /* force redraw at 0 */
+       _track_canvas_item->set_x (0);
+
+       _current_sample = 1; /* force redraw at 0 */
 }
 
 EditorCursor::EditorCursor (Editor& ed)
@@ -63,10 +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);
-       
-    _track_canvas_item->set_x (0);
-    
-       _current_frame = 1; /* force redraw at 0 */
+
+       _track_canvas_item->set_x (0);
+
+       _current_sample = 1; /* force redraw at 0 */
 }
 
 EditorCursor::~EditorCursor ()
@@ -75,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 ()) {
-               _track_canvas_item->set_x (new_pos);
+       if (rint(new_pos) != rint(_track_canvas_item->x ())) {
+               _track_canvas_item->set_x (new_pos-0.5);  //accommodate the 1/2 pixel "line" offset in cairo
        }
 
-       _current_frame = frame;
+       _current_sample = sample;
 }
 
 void
@@ -101,7 +101,7 @@ EditorCursor::hide ()
 }
 
 void
-EditorCursor::set_color (ArdourCanvas::Color color)
+EditorCursor::set_color (Gtkmm2ext::Color color)
 {
        _track_canvas_item->set_color (color);
 }