#include <QEvent>
#include <QScrollBar>
+#include "header.h"
+#include "ruler.h"
#include "view.h"
#include "viewport.h"
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),
this, SLOT(v_scroll_value_changed(int)));
connect(&_session, SIGNAL(data_updated()),
this, SLOT(data_updated()));
+
+ setViewportMargins(LabelMarginWidth, RulerHeight, 0, 0);
setViewport(_viewport);
}
+SigSession& View::session()
+{
+ return _session;
+}
+
double View::scale() const
{
return _scale;
{
_scale = scale;
_offset = offset;
+
update_scroll();
+ _ruler->update();
_viewport->update();
}
_scale *= pow(3.0/2.0, -steps);
_scale = max(min(_scale, MaxScale), MinScale);
_offset = cursor_offset - _scale * offset;
+
+ _ruler->update();
_viewport->update();
update_scroll();
}
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();
}