]> sigrok.org Git - pulseview.git/blobdiff - pv/view/ruler.cpp
Removed unneeded Cursor::Size constant
[pulseview.git] / pv / view / ruler.cpp
index 9e639383942ed1149702f9e369b16452a46eba1f..d323f9be0525be8c5e39f3621d6c4ca9f05e0f5b 100644 (file)
@@ -163,7 +163,8 @@ void Ruler::paintEvent(QPaintEvent*)
        } while (x < width());
 
        // Draw the cursors
-       draw_cursors(p, prefix);
+       if (_view.cursors_shown())
+               _view.cursors().draw_markers(p, rect(), prefix);
 
        // Draw the hover mark
        draw_hover_mark(p);
@@ -186,14 +187,13 @@ void Ruler::mousePressEvent(QMouseEvent *e)
                _grabbed_marker = NULL;
 
                if (_view.cursors_shown()) {
-                       std::pair<Cursor, Cursor> &cursors =
-                               _view.cursors();
-                       if (cursors.first.get_label_rect(
+                       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(
+                               _grabbed_marker = &cursors.first();
+                       else if (cursors.second().get_label_rect(
                                rect()).contains(e->pos()))
-                               _grabbed_marker = &cursors.second;
+                               _grabbed_marker = &cursors.second();
                }
        }
 }
@@ -203,17 +203,6 @@ void Ruler::mouseReleaseEvent(QMouseEvent *)
        _grabbed_marker = NULL;
 }
 
-void Ruler::draw_cursors(QPainter &p, unsigned int prefix)
-{
-       if (!_view.cursors_shown())
-               return;
-
-       const QRect r = rect();
-       pair<Cursor, Cursor> &cursors = _view.cursors();
-       cursors.first.paint_label(p, r, prefix);
-       cursors.second.paint_label(p, r, prefix);
-}
-
 void Ruler::draw_hover_mark(QPainter &p)
 {
        const int x = _view.hover_point().x();