#include <algorithm>
+#include <QApplication>
#include <QFormLayout>
#include <QToolBar>
namespace pv {
namespace view {
-const int LogicSignal::SignalHeight = 30;
-const int LogicSignal::SignalMargin = 10;
-
const float LogicSignal::Oversampling = 2.0f;
const QColor LogicSignal::EdgeColour(0x80, 0x80, 0x80);
shared_ptr<Channel> channel,
shared_ptr<data::Logic> data) :
Signal(session, channel),
+ signal_height_(QFontMetrics(QApplication::font()).height() * 2),
device_(device),
data_(data),
trigger_none_(nullptr),
std::pair<int, int> LogicSignal::v_extents() const
{
- return make_pair(-SignalHeight - SignalMargin, SignalMargin);
+ const int signal_margin =
+ QFontMetrics(QApplication::font()).height() / 2;
+ return make_pair(-signal_height_ - signal_margin, signal_margin);
+}
+
+int LogicSignal::scale_handle_offset() const
+{
+ return -signal_height_;
+}
+
+void LogicSignal::scale_handle_dragged(int offset)
+{
+ const int font_height = QFontMetrics(QApplication::font()).height();
+ const int units = (-offset / font_height);
+ signal_height_ = ((units < 1) ? 1 : units) * font_height;
}
void LogicSignal::paint_back(QPainter &p, const ViewItemPaintParams &pp)
if (!channel_->enabled())
return;
- const float high_offset = y - SignalHeight + 0.5f;
+ const float high_offset = y - signal_height_ + 0.5f;
const float low_offset = y + 0.5f;
const deque< shared_ptr<pv::data::LogicSegment> > &segments =
const QSize size = pixmap->size();
const QPoint point(
pp.right() - size.width() - pad * 2,
- y - (SignalHeight + size.height()) / 2);
+ y - (signal_height_ + size.height()) / 2);
p.setPen(QPen(TriggerMarkerBackgroundColour.darker()));
p.setBrush(TriggerMarkerBackgroundColour);
if (trigger) {
for (auto stage : trigger->stages()) {
const auto &matches = stage->matches();
- if (std::none_of(begin(matches), end(matches),
+ if (std::none_of(matches.begin(), matches.end(),
[&](shared_ptr<TriggerMatch> match) {
return match->channel() != channel_; }))
continue;