X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fview.cpp;h=4e0fed063fca8c4d42e67c5bcb6cb58c23cee390;hb=ccdd3ef548ce34f25c6c168598556a350831aa37;hp=e0d3ada7be39df61149417fd6af1651703e90bca;hpb=1d19ef83d7598f3248086d456df55e844b229bb3;p=pulseview.git diff --git a/pv/view/view.cpp b/pv/view/view.cpp index e0d3ada..4e0fed0 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -26,6 +26,8 @@ #include #include +#include "header.h" +#include "ruler.h" #include "view.h" #include "viewport.h" @@ -45,10 +47,14 @@ const double View::MinScale = 1e-15; const int View::LabelMarginWidth = 70; const int View::RulerHeight = 30; +const int View::SignalHeight = 50; + View::View(SigSession &session, QWidget *parent) : QAbstractScrollArea(parent), _session(session), _viewport(new Viewport(*this)), + _ruler(new Ruler(*this)), + _header(new Header(*this)), _data_length(0), _scale(1e-6), _offset(0), @@ -60,6 +66,8 @@ View::View(SigSession &session, QWidget *parent) : this, SLOT(v_scroll_value_changed(int))); connect(&_session, SIGNAL(data_updated()), this, SLOT(data_updated())); + + setViewportMargins(LabelMarginWidth, RulerHeight, 0, 0); setViewport(_viewport); } @@ -92,7 +100,9 @@ void View::set_scale_offset(double scale, double offset) { _scale = scale; _offset = offset; + update_scroll(); + _ruler->update(); _viewport->update(); } @@ -128,6 +138,8 @@ void View::zoom(double steps, int offset) _scale *= pow(3.0/2.0, -steps); _scale = max(min(_scale, MaxScale), MinScale); _offset = cursor_offset - _scale * offset; + + _ruler->update(); _viewport->update(); update_scroll(); } @@ -150,18 +162,24 @@ bool View::viewportEvent(QEvent *e) void View::resizeEvent(QResizeEvent *e) { + _ruler->setGeometry(_viewport->x(), 0, + _viewport->width(), _viewport->y()); + _header->setGeometry(0, _viewport->y(), + _viewport->x(), _viewport->height()); update_scroll(); } void View::h_scroll_value_changed(int value) { _offset = _scale * value; + _ruler->update(); _viewport->update(); } void View::v_scroll_value_changed(int value) { _v_offset = value; + _header->update(); _viewport->update(); }