]> sigrok.org Git - pulseview.git/commitdiff
Added view scale and offset
authorJoel Holdsworth <redacted>
Tue, 5 Jun 2012 10:20:06 +0000 (11:20 +0100)
committerJoel Holdsworth <redacted>
Mon, 3 Sep 2012 12:59:04 +0000 (13:59 +0100)
logicsignal.cpp
logicsignal.h
signal.h
sigview.cpp
sigview.h

index 7a86b7c6bfbd60ea26170823bfe43f7573fb13d3..09a65afca5a32188186f9352f77e328ff00f979f 100644 (file)
@@ -28,7 +28,8 @@ LogicSignal::LogicSignal(QString name, boost::shared_ptr<SignalData> data,
        assert(_probe_index >= 0);
 }
 
-void LogicSignal::paint(QGLWidget &widget, const QRect &rect)
+void LogicSignal::paint(QGLWidget &widget, const QRect &rect,
+       uint64_t scale, int64_t offset)
 {
        glColor3f(1,0,0);
        glBegin(GL_POLYGON);
index 91c70ab21a9d644bb0814d3601a44a2b0c9c6d4b..28c8247a90c7cb3d43ed358e4c388c2f43116ab2 100644 (file)
@@ -30,7 +30,16 @@ public:
        LogicSignal(QString name, boost::shared_ptr<SignalData> data,
                int probe_index);
 
-       void paint(QGLWidget &widget, const QRect &rect);
+       /**
+        * Paints the signal into a QGLWidget.
+        * @param widget the QGLWidget to paint into.
+        * @param rect the rectangular area to draw the trace into.
+        * @param scale the scale in femtoseconds per pixel.
+        * @param offset the time to show at the left hand edge of
+        *   the view in femtoseconds.
+        **/
+       void paint(QGLWidget &widget, const QRect &rect, uint64_t scale,
+               int64_t offset);
 
 private:
        int _probe_index;
index ee051dca62d315ebe307ea1d51ce520c4a5858b5..2cec1299e0cce040cf78d90a0441933c4512e9ce 100644 (file)
--- a/signal.h
+++ b/signal.h
@@ -36,7 +36,16 @@ protected:
 public:
        QString get_name() const;
 
-       virtual void paint(QGLWidget &widget, const QRect &rect) = 0;
+       /**
+        * Paints the signal into a QGLWidget.
+        * @param widget the QGLWidget to paint into.
+        * @param rect the rectangular area to draw the trace into.
+        * @param scale the scale in femtoseconds per pixel.
+        * @param offset the time to show at the left hand edge of
+        *   the view in femtoseconds.
+        **/
+       virtual void paint(QGLWidget &widget, const QRect &rect,
+               uint64_t scale, int64_t offset) = 0;
 
 protected:
        QString _name;
index 565e67e2eb8a4d968c5fcf8d0be78727168797a3..53fbdeaac148859251c7792ab726c40d6d174c4c 100644 (file)
@@ -32,7 +32,9 @@ const int SigView::SignalHeight = 50;
 
 SigView::SigView(SigSession &session, QWidget *parent) :
        QGLWidget(parent),
-        _session(session)
+        _session(session),
+       _scale(1000000000ULL),
+       _offset(0)
 {
        connect(&_session, SIGNAL(dataUpdated()),
                this, SLOT(dataUpdated()));
@@ -70,7 +72,7 @@ void SigView::paintGL()
        BOOST_FOREACH(const shared_ptr<Signal> s, sigs)
        {
                assert(s);
-               s->paint(*this, rect);
+               s->paint(*this, rect, _scale, _offset);
                rect.translate(0, SignalHeight);
        }
 }
index b43ae9a55e5b0b49987f94b3fb756eed76f97ff8..2c7ba1ddae34a97990fdf0b189be6d621676a939 100644 (file)
--- a/sigview.h
+++ b/sigview.h
@@ -49,6 +49,9 @@ private slots:
 
 private:
        SigSession &_session;
+
+       uint64_t _scale;
+       int64_t _offset;
 };
 
 #endif // SIGVIEW_H