- /* only update if the playhead is on screen or we are following it */
-
- if (_follow_playhead) {
-
- playhead_cursor->canvas_item.show();
-
- if (frame != last_update_frame) {
-
- if (frame < leftmost_frame || frame > leftmost_frame + current_page_frames()) {
-
- if (session->transport_speed() < 0) {
- if (frame > (current_page_frames()/2)) {
- center_screen (frame-(current_page_frames()/2));
- } else {
- center_screen (current_page_frames()/2);
- }
- } else {
- center_screen (frame+(current_page_frames()/2));
- }
- }
-
- playhead_cursor->set_position (frame);
-
-#define CONTINUOUS_SCROLL
-#ifdef CONTINUOUS_SCROLL
-
- /* don't do continuous scroll till the new position is in the rightmost quarter of the
- editor canvas
- */
-
-#if 0
- if (frame > leftmost_frame + (3 * current_page_frames() / 4)) {
-
- if (frame > playhead_cursor->current_frame) {
- nframes_t delta = frame - playhead_cursor->current_frame;
- horizontal_adjustment.set_value (horizontal_adjustment.get_value() + (delta/frames_per_unit));
- } else {
- nframes_t delta = playhead_cursor->current_frame - frame;
- horizontal_adjustment.set_value (horizontal_adjustment.get_value() - (delta/frames_per_unit));
- }
- }
-#else
- if (!currentInitialized) {
- current = (frame - current_page_frames()/2) / frames_per_unit;
- currentInitialized = 1;
- }
-
- double target = (frame - current_page_frames()/2) / frames_per_unit;
- target = (target * 0.1) + (current * 0.9);
- horizontal_adjustment.set_value ( target );
- current = target;
-#endif
-
-#endif // CONTINUOUS_SCROLL
-
- }
-
- } else {
-
- if (frame != last_update_frame) {
- if (frame < leftmost_frame || frame > leftmost_frame + current_page_frames()) {
- playhead_cursor->canvas_item.hide();
- } else {
- playhead_cursor->set_position (frame);
- }
- }
- }