Merge branch 'master' into cairocanvas
[ardour.git] / gtk2_ardour / editor_cursors.cc
index afe5b22bfcf4dd90a4f2da4edf24a1da7db2dc05..59b81b2b48195d43d24ce7609e91089cf68e85f4 100644 (file)
@@ -21,6 +21,7 @@
 #include <cmath>
 
 #include "canvas/canvas.h"
+#include "canvas/debug.h"
 
 #include "utils.h"
 #include "editor_cursors.h"
@@ -36,8 +37,8 @@ EditorCursor::EditorCursor (Editor& ed, bool (Editor::*callbck)(GdkEvent*,Ardour
        , _track_canvas_item (_editor._track_canvas->root ())
        , _length (1.0)
 {
-       _time_bars_canvas_item.set_outline_width (1);
-       _track_canvas_item.set_outline_width (1);
+       CANVAS_DEBUG_NAME ((&_time_bars_canvas_item), "timebars editor cursor");
+       CANVAS_DEBUG_NAME ((&_track_canvas_item), "track canvas editor cursor");
 
        _time_bars_canvas_item.set_show_head (0, true);
        _time_bars_canvas_item.set_head_height (0, 9);
@@ -67,15 +68,14 @@ EditorCursor::set_position (framepos_t frame)
 {
        PositionChanged (frame);
 
-       double const new_pos = _editor.frame_to_unit (frame);
+       double const new_pos = _editor.sample_to_pixel (frame);
 
        if (new_pos != _time_bars_canvas_item.x ()) {
                _time_bars_canvas_item.set_x (new_pos);
        }
 
        if (new_pos != _track_canvas_item.x0 ()) {
-               _track_canvas_item.set_x0 (new_pos);
-               _track_canvas_item.set_x1 (new_pos);
+               _track_canvas_item.set_x (new_pos, new_pos);
        }
        
        _current_frame = frame;