]> sigrok.org Git - pulseview.git/blobdiff - pv/view/analogsignal.cpp
RowItem: Replaced fixed signal heights with extents
[pulseview.git] / pv / view / analogsignal.cpp
index eaa25bccc947dac826d5bddf2eff50ec2fcdd325..250fb94e9bc6623c6720a581721662798cdb571c 100644 (file)
@@ -31,6 +31,7 @@
 #include <libsigrok/libsigrok.hpp>
 
 using std::max;
+using std::make_pair;
 using std::min;
 using std::shared_ptr;
 using std::deque;
@@ -40,6 +41,8 @@ using sigrok::Channel;
 namespace pv {
 namespace view {
 
+const int AnalogSignal::NominalHeight = 80;
+
 const QColor AnalogSignal::SignalColours[4] = {
        QColor(0xC4, 0xA0, 0x00),       // Yellow
        QColor(0x87, 0x20, 0x7A),       // Magenta
@@ -79,6 +82,11 @@ void AnalogSignal::set_scale(float scale)
        _scale = scale;
 }
 
+std::pair<int, int> AnalogSignal::v_extents() const
+{
+       return make_pair(-NominalHeight / 2, NominalHeight / 2);
+}
+
 void AnalogSignal::paint_back(QPainter &p, int left, int right)
 {
        if (_channel->enabled())