X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fview%2Fviewport.h;h=1f8f8f61095748e4290911e1fe5caa2d4cbedd74;hb=f0c0b38f812bfbb2bb1978d40e2ce93f1da3f89d;hp=46bf273358e769b2112dc913569bedce82f32f5f;hpb=cdf7bea7f0eead18de2616cbfd8697ac0fffb59b;p=pulseview.git diff --git a/pv/view/viewport.h b/pv/view/viewport.h index 46bf2733..1f8f8f61 100644 --- a/pv/view/viewport.h +++ b/pv/view/viewport.h @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * @@ -18,11 +18,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef PV_VIEW_VIEWPORT_H -#define PV_VIEW_VIEWPORT_H +#ifndef PULSEVIEW_PV_VIEW_VIEWPORT_H +#define PULSEVIEW_PV_VIEW_VIEWPORT_H -#include #include +#include +#include class QPainter; class QPaintEvent; @@ -33,50 +34,45 @@ namespace view { class View; -class Viewport : public QGLWidget +class Viewport : public QWidget { Q_OBJECT -private: - static const int SignalHeight; - - static const int MinorTickSubdivision; - static const int ScaleUnits[3]; - - static const QString SIPrefixes[9]; - static const int FirstSIPrefixPower; - public: explicit Viewport(View &parent); int get_total_height() const; -protected: - void initializeGL(); - - void resizeGL(int width, int height); + void signals_updated(); +protected: void paintEvent(QPaintEvent *event); private: + bool event(QEvent *event); void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void mouseDoubleClickEvent(QMouseEvent * event); void wheelEvent(QWheelEvent *event); + bool touchEvent(QTouchEvent *e); -private: - void setup_viewport(int width, int height); - - void paint_ruler(QPainter &p); +private Q_SLOTS: + void on_signals_moved(); private: View &_view; QPoint _mouse_down_point; double _mouse_down_offset; + bool _mouse_down_valid; + + double _pinch_offset0; + double _pinch_offset1; + bool _pinch_zoom_active; }; } // namespace view } // namespace pv -#endif // PV_VIEW_VIEWPORT_H +#endif // PULSEVIEW_PV_VIEW_VIEWPORT_H