]> sigrok.org Git - pulseview.git/blobdiff - pv/view/ruler.h
Update description for Trace::get_label_rect()
[pulseview.git] / pv / view / ruler.h
index e7575db1d534fe8a37af3cde9f8f4f08ddef019b..00fac244ba7c46eabfb9467b4dad103da0d0c9e9 100644 (file)
@@ -28,9 +28,6 @@
 namespace pv {
 namespace view {
 
-class TimeMarker;
-class View;
-
 class Ruler : public MarginWidget
 {
        Q_OBJECT
@@ -45,7 +42,17 @@ private:
 public:
        Ruler(View &parent);
 
-       void clear_selection();
+       /**
+        * Find a tick spacing and number formatting that does not cause
+        * the values to collide.
+        * @param p A QPainter used to determine the needed space for the values.
+        * @param scale A pv::view::View's scale.
+        * @param offset A pv::view::View's offset.
+        *
+        * @return The tick period to use in 'first' and the prefix in 'second'.
+        */
+       static std::pair<double, unsigned int> calculate_tick_spacing(
+               QPainter& p, double scale, double offset);
 
 public:
        QSize sizeHint() const;
@@ -53,23 +60,14 @@ public:
 private:
        void paintEvent(QPaintEvent *event);
 
-       void mouseMoveEvent(QMouseEvent *e);
-       void mousePressEvent(QMouseEvent *e);
-       void mouseReleaseEvent(QMouseEvent *);
-
 private:
        /**
         * Draw a hover arrow under the cursor position.
         */
        void draw_hover_mark(QPainter &p);
 
-private slots:
+private Q_SLOTS:
        void hover_point_changed();
-
-private:
-       std::weak_ptr<TimeMarker> _grabbed_marker;
-       QPoint _mouse_down_point;
-       bool _dragging;
 };
 
 } // namespace view