]> sigrok.org Git - pulseview.git/commitdiff
SelectableItem: Moved in enabled(), and added to TriggerMarkers
authorJoel Holdsworth <redacted>
Sat, 6 Dec 2014 23:11:29 +0000 (23:11 +0000)
committerUwe Hermann <redacted>
Wed, 10 Dec 2014 17:06:15 +0000 (18:06 +0100)
pv/view/cursor.cpp
pv/view/cursor.hpp
pv/view/rowitem.hpp
pv/view/selectableitem.hpp
pv/view/timemarker.cpp

index 6a4733112fbb6882edf3d281aed570cd5f19f538..f4a5df6f10f4b2e5321b97be12d3d1d825e0a116 100644 (file)
@@ -45,6 +45,11 @@ Cursor::Cursor(View &view, double time) :
 {
 }
 
+bool Cursor::enabled() const
+{
+       return view_.cursors_shown();
+}
+
 QString Cursor::get_text() const
 {
        return pv::util::format_time(time_, view_.tick_prefix(), 2);
index fab7497e18830c53128277be14a801742105afb4..b23bd642b47130446a21b8fcf7b67c812acb7dc5 100644 (file)
@@ -48,6 +48,11 @@ public:
        Cursor(View &view, double time);
 
 public:
+       /**
+        * Returns true if the item is visible and enabled.
+        */
+       bool enabled() const;
+
        /**
         * Gets the text to show in the marker.
         */
index 39c6f04030d1d214b688aa7ffedbbb0a8530f023..4f973e3fc218647d355fcede1492d45fe0a3725c 100644 (file)
@@ -47,11 +47,6 @@ public:
         */
        RowItem();
 
-       /**
-        * Returns true if the item is visible and enabled.
-        */
-       virtual bool enabled() const = 0;
-
        /**
         * Gets the vertical layout offset of this signal.
         */
index 1f5944900bafa8d5ed9adafb482c3f77b32c8395..29a5c9557973b852504e4a1ff7d7ca7bdcdad80e 100644 (file)
@@ -48,6 +48,11 @@ public:
        SelectableItem();
 
 public:
+       /**
+        * Returns true if the item is visible and enabled.
+        */
+       virtual bool enabled() const = 0;
+
        /**
         * Returns true if the item has been selected by the user.
         */
index 7e23806896d5ed010d090412b03cd9fc877daac8..2f129a3297f985bd7222b4c302d98db6e2fe9c4c 100644 (file)
@@ -107,6 +107,9 @@ QRectF TimeMarker::get_label_rect(const QRect &rect) const
 
 void TimeMarker::paint_label(QPainter &p, const QRect &rect)
 {
+       if (!enabled())
+               return;
+
        const qreal x = (time_ - view_.offset()) / view_.scale();
        const QRectF r(get_label_rect(rect));