]> sigrok.org Git - pulseview.git/blobdiff - sigview.h
Add initial scrolling support with a QAbstractScrollArea
[pulseview.git] / sigview.h
index d2bdbe4d1839402219dc42a3e8a397aa923b8029..cc7b78af35fa410a4775907a4d7cb3b996996daa 100644 (file)
--- a/sigview.h
+++ b/sigview.h
 #ifndef SIGVIEW_H
 #define SIGVIEW_H
 
-#include <QtOpenGL/QGLWidget>
-#include <QTimer>
+#include <stdint.h>
 
-class SigView : public QGLWidget
-{
+#include <QAbstractScrollArea>
+
+class SigSession;
+class SigViewport;
+
+class SigView : public QAbstractScrollArea {
        Q_OBJECT
+
+private:
+       static const double MaxScale;
+       static const double MinScale;
+
+       static const int LabelMarginWidth;
+       static const int RulerHeight;
+
 public:
-       explicit SigView(QWidget *parent = 0);
+       explicit SigView(SigSession &session, QWidget *parent = 0);
+
+       double scale() const;
+       double offset() const;
+       int v_offset() const;
+
+       void zoom(double steps);
+
+       void set_scale_offset(double scale, double offset);
+
+private:
+       void update_scroll();
+
+       void zoom(double steps, int offset);
+
+private:
+       bool viewportEvent(QEvent *e);
+
+       void resizeEvent(QResizeEvent *e);
+
+private slots:
+       void h_scroll_value_changed(int value);
+       void v_scroll_value_changed(int value);
+
+       void data_updated();
+
+private:
+       SigSession &_session;
 
-protected:
+       SigViewport *_viewport;
 
-       void initializeGL();
+       uint64_t _data_length;
 
-       void resizeGL(int width, int height);
+       double _scale;
+       double _offset;
 
-       void paintGL();
+       int _v_offset;
 
-signals:
-       
-public slots:
-       
+       friend class SigViewport;
 };
 
 #endif // SIGVIEW_H