X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=sigview.h;fp=sigview.h;h=cc7b78af35fa410a4775907a4d7cb3b996996daa;hp=0000000000000000000000000000000000000000;hb=adb4b10cf99ca7c257b2f749bff90b67286d9992;hpb=1e669074475e36ae5f7e1fbdc9ad5809beaccdf3 diff --git a/sigview.h b/sigview.h new file mode 100644 index 00000000..cc7b78af --- /dev/null +++ b/sigview.h @@ -0,0 +1,83 @@ +/* + * This file is part of the sigrok project. + * + * Copyright (C) 2012 Joel Holdsworth + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SIGVIEW_H +#define SIGVIEW_H + +#include + +#include + +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(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; + + SigViewport *_viewport; + + uint64_t _data_length; + + double _scale; + double _offset; + + int _v_offset; + + friend class SigViewport; +}; + +#endif // SIGVIEW_H