#include "analogsignal.hpp"
#include "pv/data/analog.hpp"
#include "pv/data/analogsegment.hpp"
+#include "pv/data/signalbase.hpp"
#include "pv/view/view.hpp"
#include <libsigrokcxx/libsigrokcxx.hpp>
using std::shared_ptr;
using std::deque;
-using sigrok::Channel;
-
namespace pv {
namespace view {
QColor(0x4E, 0x9A, 0x06) // Green
};
-const QColor AnalogSignal::GridMajorColor = QColor(0xB0, 0xB0, 0xB0);
-const QColor AnalogSignal::GridMinorColor = QColor(0xD0, 0xD0, 0xD0);
+const QColor AnalogSignal::GridMajorColor = QColor(0, 0, 0, 40*256/100);
+const QColor AnalogSignal::GridMinorColor = QColor(0, 0, 0, 20*256/100);
const float AnalogSignal::EnvelopeThreshold = 256.0f;
AnalogSignal::AnalogSignal(
pv::Session &session,
- shared_ptr<Channel> channel,
+ shared_ptr<data::SignalBase> channel,
shared_ptr<data::Analog> data) :
Signal(session, channel),
data_(data),
vdivs_(1),
resolution_(0)
{
- set_colour(SignalColours[channel_->index() % countof(SignalColours)]);
+ channel_->set_colour(SignalColours[channel_->index() % countof(SignalColours)]);
update_scale();
}
// Show the info section on the right side of the trace
const QString infotext = QString("%1 V/div").arg(resolution_);
- p.setPen(colour_);
+ p.setPen(channel_->colour());
p.setFont(QApplication::font());
const QRectF bounding_rect = QRectF(pp.left(),
void AnalogSignal::paint_grid(QPainter &p, int y, int left, int right)
{
- p.setPen(QPen(GridMajorColor, 0.5, Qt::DashLine));
+ p.setRenderHint(QPainter::Antialiasing, false);
+
+ p.setPen(QPen(GridMajorColor, 1, Qt::DashLine));
for (int i = 1; i <= vdivs_; i++) {
- const int dy = i * div_height_;
+ const float dy = i * div_height_;
p.drawLine(QLineF(left, y - dy, right, y - dy));
p.drawLine(QLineF(left, y + dy, right, y + dy));
}
- p.setPen(QPen(GridMinorColor, 0.5, Qt::DashLine));
+ p.setPen(QPen(GridMinorColor, 1, Qt::DashLine));
for (int i = 0; i < vdivs_; i++) {
- const int dy = i * div_height_;
+ const float dy = i * div_height_;
const float dy25 = dy + (0.25 * div_height_);
const float dy50 = dy + (0.50 * div_height_);
const float dy75 = dy + (0.75 * div_height_);
p.drawLine(QLineF(left, y - dy75, right, y - dy75));
p.drawLine(QLineF(left, y + dy75, right, y + dy75));
}
+
+ p.setRenderHint(QPainter::Antialiasing, true);
}
void AnalogSignal::paint_trace(QPainter &p,
const float *const samples = segment->get_samples(start, end);
assert(samples);
- p.setPen(colour_);
+ p.setPen(channel_->colour());
QPointF *points = new QPointF[sample_count];
QPointF *point = points;
return;
p.setPen(QPen(Qt::NoPen));
- p.setBrush(colour_);
+ p.setBrush(channel_->colour());
QRectF *const rects = new QRectF[e.length];
QRectF *rect = rects;
{
vdivs_ = vdivs;
- if (owner_)
+ if (owner_) {
+ // Call order is important, otherwise the lazy event handler won't work
owner_->extents_changed(false, true);
+ owner_->row_item_appearance_changed(false, true);
+ }
}
void AnalogSignal::on_resolution_changed(int index)