- draw_hover_mark(p);
-
- p.end();
-}
-
-void Ruler::mouseMoveEvent(QMouseEvent *e)
-{
- if (!(e->buttons() & Qt::LeftButton))
- return;
-
- if ((e->pos() - _mouse_down_point).manhattanLength() <
- QApplication::startDragDistance())
- return;
-
- _dragging = true;
-
- if (shared_ptr<TimeMarker> m = _grabbed_marker.lock())
- m->set_time(_view.offset() +
- ((double)e->x() + 0.5) * _view.scale());
-}
-
-void Ruler::mousePressEvent(QMouseEvent *e)
-{
- if (e->buttons() & Qt::LeftButton)
- {
- _mouse_down_point = e->pos();
-
- _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();
+ draw_hover_mark(p, text_height);
+
+ // The cursor labels are not drawn with the arrows exactly on the
+ // bottom line of the widget, because then the selection shadow
+ // would be clipped away.
+ const QRect r = rect().adjusted(0, 0, 0, -ViewItem::HighlightRadius);
+
+ // Draw the items
+ const vector< shared_ptr<TimeItem> > items(view_.time_items());
+ for (auto &i : items) {
+ const bool highlight = !dragging_ &&
+ i->label_rect(r).contains(mouse_point_);
+ i->paint_label(p, r, highlight);