X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=sigview.h;h=cc7b78af35fa410a4775907a4d7cb3b996996daa;hb=adb4b10cf99ca7c257b2f749bff90b67286d9992;hp=2d450df21c0822374d36aa0bdccd9cf2b24f7b6a;hpb=04abfae9c8f8e4884e6535d6584df8b5f1e3a1db;p=pulseview.git diff --git a/sigview.h b/sigview.h index 2d450df2..cc7b78af 100644 --- a/sigview.h +++ b/sigview.h @@ -21,61 +21,63 @@ #ifndef SIGVIEW_H #define SIGVIEW_H -#include -#include +#include + +#include -class QPainter; -class QPaintEvent; class SigSession; +class SigViewport; -class SigView : public QGLWidget -{ +class SigView : public QAbstractScrollArea { Q_OBJECT private: - static const int SignalHeight; + static const double MaxScale; + static const double MinScale; + static const int LabelMarginWidth; static const int RulerHeight; - static const int MinorTickSubdivision; - static const int ScaleUnits[3]; - - static const QString SIPrefixes[9]; - static const int FirstSIPrefixPower; - public: explicit SigView(SigSession &session, QWidget *parent = 0); -protected: - - void initializeGL(); + double scale() const; + double offset() const; + int v_offset() const; - void resizeGL(int width, int height); + void zoom(double steps); - void paintEvent(QPaintEvent *event); + void set_scale_offset(double scale, double offset); private: - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void wheelEvent(QWheelEvent *event); + void update_scroll(); + + void zoom(double steps, int offset); private: - void setup_viewport(int width, int height); + bool viewportEvent(QEvent *e); - void paint_ruler(QPainter &p); + 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; + SigViewport *_viewport; + + uint64_t _data_length; + double _scale; double _offset; - QPoint _mouse_down_point; - double _mouse_down_offset; + int _v_offset; + + friend class SigViewport; }; #endif // SIGVIEW_H