const sr_probe *const probe =
(const sr_probe *)l->data;
assert(probe);
- if (!probe->enabled)
- continue;
switch(probe->type) {
case SR_PROBE_LOGIC:
signal = shared_ptr<view::Signal>(
- new view::LogicSignal(
- probe->name,
- _logic_data,
- probe->index));
+ new view::LogicSignal(probe,
+ _logic_data));
break;
case SR_PROBE_ANALOG:
signal = shared_ptr<view::Signal>(
- new view::AnalogSignal(
- probe->name,
- _analog_data,
- probe->index));
+ new view::AnalogSignal(probe,
+ _analog_data));
break;
}
const float AnalogSignal::EnvelopeThreshold = 256.0f;
-AnalogSignal::AnalogSignal(QString name, shared_ptr<data::Analog> data,
- int probe_index) :
- Signal(name),
+AnalogSignal::AnalogSignal(const sr_probe *const probe,
+ shared_ptr<data::Analog> data) :
+ Signal(probe),
_data(data),
_scale(1.0f)
{
- _colour = SignalColours[probe_index % countof(SignalColours)];
+ _colour = SignalColours[probe->index % countof(SignalColours)];
}
AnalogSignal::~AnalogSignal()
assert(_data);
assert(right >= left);
+ if (!_probe->enabled)
+ return;
+
paint_axis(p, y, left, right);
const deque< shared_ptr<pv::data::AnalogSnapshot> > &snapshots =
static const float EnvelopeThreshold;
public:
- AnalogSignal(QString name,
- boost::shared_ptr<pv::data::Analog> data, int probe_index);
+ AnalogSignal(const sr_probe *const probe,
+ boost::shared_ptr<pv::data::Analog> data);
virtual ~AnalogSignal();
QColor(0xEE, 0xEE, 0xEC), // White
};
-LogicSignal::LogicSignal(QString name, shared_ptr<data::Logic> data,
- int probe_index) :
- Signal(name),
- _probe_index(probe_index),
+LogicSignal::LogicSignal(const sr_probe *const probe,
+ shared_ptr<data::Logic> data) :
+ Signal(probe),
_data(data)
{
- assert(_probe_index >= 0);
- _colour = SignalColours[_probe_index % countof(SignalColours)];
+ _colour = SignalColours[probe->index % countof(SignalColours)];
}
LogicSignal::~LogicSignal()
vector< pair<int64_t, bool> > edges;
+ assert(_probe);
assert(scale > 0);
assert(_data);
assert(right >= left);
+ if (!_probe->enabled)
+ return;
+
paint_axis(p, y, left, right);
const float high_offset = y - View::SignalHeight + 0.5f;
snapshot->get_subsampled_edges(edges,
min(max((int64_t)floor(start), (int64_t)0), last_sample),
min(max((int64_t)ceil(end), (int64_t)0), last_sample),
- samples_per_pixel / Oversampling, _probe_index);
+ samples_per_pixel / Oversampling, _probe->index);
assert(edges.size() >= 2);
// Paint the edges
static const QColor SignalColours[10];
public:
- LogicSignal(QString name,
- boost::shared_ptr<pv::data::Logic> data,
- int probe_index);
+ LogicSignal(const sr_probe *const probe,
+ boost::shared_ptr<pv::data::Logic> data);
virtual ~LogicSignal();
float x_offset, float y_offset);
private:
- int _probe_index;
boost::shared_ptr<pv::data::Logic> _data;
};
#include <extdef.h>
+#include <assert.h>
#include <math.h>
#include <QApplication>
const QPen Signal::SignalAxisPen(QColor(128, 128, 128, 64));
-Signal::Signal(QString name) :
- _name(name),
+Signal::Signal(const sr_probe *const probe) :
+ _probe(probe),
+ _name(probe->name),
_v_offset(0),
_selected(false)
{
+ assert(_probe);
}
QString Signal::get_name() const
{
p.setBrush(_colour);
+ if (!_probe->enabled)
+ return;
+
const QColor colour = get_colour();
compute_text_size(p);
#include <stdint.h>
+#include <libsigrok/libsigrok.h>
+
namespace pv {
namespace data {
static const QPen SignalAxisPen;
protected:
- Signal(QString name);
+ Signal(const sr_probe *const probe);
public:
/**
QRectF get_label_rect(int y, int right);
protected:
+ const sr_probe *const _probe;
+
QString _name;
QColor _colour;
int _v_offset;