- const QRect r = rect();
- pair<Cursor, Cursor> &cursors = _view.cursors();
- cursors.first.paint_label(p, r);
- cursors.second.paint_label(p, r);
+void Ruler::mousePressEvent(QMouseEvent *e)
+{
+ if (e->buttons() & Qt::LeftButton) {
+ _grabbed_marker.reset();
+
+ clear_selection();
+
+ if (_view.cursors_shown()) {
+ CursorPair &cursors = _view.cursors();
+ if (cursors.first()->get_label_rect(
+ rect()).contains(e->pos()))
+ _grabbed_marker = cursors.first();
+ else if (cursors.second()->get_label_rect(
+ rect()).contains(e->pos()))
+ _grabbed_marker = cursors.second();
+ }
+
+ if (shared_ptr<TimeMarker> m = _grabbed_marker.lock())
+ m->select();
+
+ selection_changed();
+ }
+}
+
+void Ruler::mouseReleaseEvent(QMouseEvent *)
+{
+ _grabbed_marker.reset();