]> sigrok.org Git - pulseview.git/blobdiff - pv/view/analogsignal.cpp
Header: Keep a shared_ptr of the clicked item
[pulseview.git] / pv / view / analogsignal.cpp
index 7b49bbd2b7d454606d2ac5d51e482a331ca1b01c..eaa25bccc947dac826d5bddf2eff50ec2fcdd325 100644 (file)
@@ -49,9 +49,11 @@ const QColor AnalogSignal::SignalColours[4] = {
 
 const float AnalogSignal::EnvelopeThreshold = 256.0f;
 
-AnalogSignal::AnalogSignal(shared_ptr<Channel> channel,
+AnalogSignal::AnalogSignal(
+       pv::SigSession &session,
+       shared_ptr<Channel> channel,
        shared_ptr<data::Analog> data) :
-       Signal(channel),
+       Signal(session, channel),
        _data(data),
        _scale(1.0f)
 {
@@ -87,14 +89,17 @@ void AnalogSignal::paint_mid(QPainter &p, int left, int right)
 {
        assert(_data);
        assert(right >= left);
+       assert(_owner);
 
-       assert(_view);
-       const int y = _v_offset - _view->v_offset();
+       const int y = get_y();
 
-       const double scale = _view->scale();
+       const View *const view = _owner->view();
+       assert(view);
+
+       const double scale = view->scale();
        assert(scale > 0);
 
-       const double offset = _view->offset();
+       const double offset = view->offset();
 
        if (!_channel->enabled())
                return;