void MainWindow::on_actionViewShowCursors_triggered()
{
assert(_view);
- _view->show_cursors(_action_view_show_cursors->isChecked());
+
+ const bool show = !_view->cursors_shown();
+ if(show)
+ _view->centre_cursors();
+
+ _view->show_cursors(show);
}
void MainWindow::on_actionAbout_triggered()
_viewport->update();
}
+void View::centre_cursors()
+{
+ const double time_width = _scale * _viewport->width();
+ _cursors.first().set_time(_offset + time_width * 0.4);
+ _cursors.second().set_time(_offset + time_width * 0.6);
+ _ruler->update();
+ _viewport->update();
+}
+
CursorPair& View::cursors()
{
return _cursors;
*/
void show_cursors(bool show = true);
+ /**
+ * Moves the cursors to a convenient position in the view.
+ */
+ void centre_cursors();
+
/**
* Returns a reference to the pair of cursors.
*/