From: Joel Holdsworth Date: Sun, 18 Nov 2012 13:24:34 +0000 (+0000) Subject: Moved signal margin out of signal rendering into initial layout X-Git-Tag: pulseview-0.1.0~212 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=8d44d030c3923055f2ea81d5334d3a3bce7900c2;p=pulseview.git Moved signal margin out of signal rendering into initial layout --- diff --git a/pv/view/logicsignal.cpp b/pv/view/logicsignal.cpp index cf3f3e5a..b2302e9e 100644 --- a/pv/view/logicsignal.cpp +++ b/pv/view/logicsignal.cpp @@ -32,7 +32,6 @@ using namespace std; namespace pv { namespace view { -const float LogicSignal::Margin = 10.0f; const float LogicSignal::Oversampling = 2.0f; const QColor LogicSignal::EdgeColour(0x80, 0x80, 0x80); @@ -73,8 +72,8 @@ void LogicSignal::paint(QPainter &p, const QRect &rect, double scale, assert(scale > 0); assert(_data); - const float high_offset = rect.top() + Margin + 0.5f; - const float low_offset = rect.bottom() - Margin + 0.5f; + const float high_offset = rect.top() + 0.5f; + const float low_offset = rect.bottom() + 0.5f; const deque< shared_ptr > &snapshots = _data->get_snapshots(); @@ -151,7 +150,7 @@ void LogicSignal::paint_caps(QPainter &p, QLineF *const lines, int LogicSignal::get_nominal_offset(const QRect &rect) const { - return rect.bottom() - Margin; + return rect.bottom(); } } // namespace view diff --git a/pv/view/logicsignal.h b/pv/view/logicsignal.h index dd4a030a..4241f801 100644 --- a/pv/view/logicsignal.h +++ b/pv/view/logicsignal.h @@ -34,7 +34,6 @@ namespace view { class LogicSignal : public Signal { private: - static const float Margin; static const float Oversampling; static const QColor EdgeColour; diff --git a/pv/view/view.cpp b/pv/view/view.cpp index e3210fa3..98b5c65d 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -52,7 +52,8 @@ const int View::RulerHeight = 30; const int View::MaxScrollValue = INT_MAX / 2; -const int View::SignalHeight = 50; +const int View::SignalHeight = 30; +const int View::SignalMargin = 10; const int View::SignalSnapGridSize = 10; const QColor View::CursorAreaColour(220, 231, 243); @@ -207,11 +208,11 @@ void View::update_scroll() void View::reset_signal_layout() { - int offset = 0; + int offset = SignalMargin; vector< shared_ptr > &sigs = _session.get_signals(); BOOST_FOREACH(shared_ptr s, sigs) { s->set_v_offset(offset); - offset += SignalHeight; + offset += SignalHeight + 2 * SignalMargin; } } diff --git a/pv/view/view.h b/pv/view/view.h index 6d7ac36d..1bf71322 100644 --- a/pv/view/view.h +++ b/pv/view/view.h @@ -54,6 +54,7 @@ private: public: static const int SignalHeight; + static const int SignalMargin; static const int SignalSnapGridSize; static const QColor CursorAreaColour;