Remove unused variable and the accessor methods for it from ARDOUR_UI
[ardour.git] / gtk2_ardour / editor_rulers.cc
index 1a928002a8bafcd1944ef8b676a709204f789e74..a101d5cc030590af090cac096bf98180146a79b7 100644 (file)
@@ -151,9 +151,15 @@ Editor::ruler_button_press (GdkEventButton* ev)
 
        switch (ev->button) {
        case 1:
+               // Since we are about to move the playhead, cancel any running
+               // auditions.
+               if (session->is_auditioning()) {
+                       session->cancel_audition ();
+               }
                /* transport playhead */
                snap_to (where);
                session->request_locate (where);
+               _dragging_playhead = true;
                break;
 
        case 2:
@@ -187,7 +193,6 @@ Editor::ruler_button_release (GdkEventButton* ev)
                return FALSE;
        }
 
-       hide_verbose_canvas_cursor();
        stop_canvas_autoscroll();
        
        nframes_t where = leftmost_frame + pixel_to_frame (x);
@@ -195,6 +200,7 @@ Editor::ruler_button_release (GdkEventButton* ev)
        switch (ev->button) {
        case 1:
                /* transport playhead */
+               _dragging_playhead = false;
                snap_to (where);
                session->request_locate (where);
                break;
@@ -245,8 +251,8 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev)
        if (session == 0 || !ruler_pressed_button) {
                return FALSE;
        }
-       
-       double wcx=0,wcy=0;
+
+               double wcx=0,wcy=0;
        double cx=0,cy=0;
 
        gint x,y;
@@ -255,29 +261,30 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev)
        /* need to use the correct x,y, the event lies */
        time_canvas_event_box.get_window()->get_pointer (x, y, state);
 
-       
+
        track_canvas.c2w (x, y, wcx, wcy);
        track_canvas.w2c (wcx, wcy, cx, cy);
        
        nframes_t where = leftmost_frame + pixel_to_frame (x);
 
-
        /// ripped from maybe_autoscroll, and adapted to work here
        nframes_t one_page = (nframes_t) rint (canvas_width * frames_per_unit);
        nframes_t rightmost_frame = leftmost_frame + one_page;
 
+       jack_nframes_t frame = pixel_to_frame (cx);
+
        if (autoscroll_timeout_tag < 0) {
-               if (where > rightmost_frame) {
+               if (frame > rightmost_frame) {
                        if (rightmost_frame < max_frames) {
                                start_canvas_autoscroll (1);
                        }
-               } else if (where <= leftmost_frame) {
+               } else if (frame < leftmost_frame) {
                        if (leftmost_frame > 0) {
                                start_canvas_autoscroll (-1);
                        }
                } 
        } else {
-               if (where >= leftmost_frame && where < rightmost_frame) {
+               if (frame >= leftmost_frame && frame < rightmost_frame) {
                        stop_canvas_autoscroll ();
                }
        }
@@ -302,15 +309,14 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev)
                break;
        }
 
-       if (cursor)
-       {
+       if (cursor) {
                cursor->set_position (where);
                
                if (cursor == edit_cursor) {
                        edit_cursor_clock.set (where);
+               } else if (cursor == playhead_cursor) {
+                       UpdateAllTransportClocks (cursor->current_frame);
                }
-               
-               show_verbose_time_cursor (where, 10, cx, 0);
        }
        
        return TRUE;
@@ -376,7 +382,7 @@ Editor::popup_ruler_menu (nframes_t where, ItemType t)
                mitem->set_active(true);
        }
 
-       ruler_items.push_back (CheckMenuElem (X_("Timecode"), bind (mem_fun(*this, &Editor::ruler_toggled), (int)ruler_metric_smpte)));
+       ruler_items.push_back (CheckMenuElem (_("Timecode"), bind (mem_fun(*this, &Editor::ruler_toggled), (int)ruler_metric_smpte)));
        mitem = (CheckMenuItem *) &ruler_items.back(); 
        if (ruler_shown[ruler_metric_smpte]) {
                mitem->set_active(true);