]> sigrok.org Git - pulseview.git/commitdiff
Moved signal margin out of signal rendering into initial layout
authorJoel Holdsworth <redacted>
Sun, 18 Nov 2012 13:24:34 +0000 (13:24 +0000)
committerJoel Holdsworth <redacted>
Sun, 18 Nov 2012 13:25:01 +0000 (13:25 +0000)
pv/view/logicsignal.cpp
pv/view/logicsignal.h
pv/view/view.cpp
pv/view/view.h

index cf3f3e5a58dd076b1a58a9bfd39a3e93bf092de4..b2302e9e8cc75be8dd9a0aaca05d24a0b02e62d2 100644 (file)
@@ -32,7 +32,6 @@ using namespace std;
 namespace pv {
 namespace view {
 
 namespace pv {
 namespace view {
 
-const float LogicSignal::Margin = 10.0f;
 const float LogicSignal::Oversampling = 2.0f;
 
 const QColor LogicSignal::EdgeColour(0x80, 0x80, 0x80);
 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);
 
        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<pv::LogicDataSnapshot> > &snapshots =
                _data->get_snapshots();
 
        const deque< shared_ptr<pv::LogicDataSnapshot> > &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
 {
 
 int LogicSignal::get_nominal_offset(const QRect &rect) const
 {
-       return rect.bottom() - Margin;
+       return rect.bottom();
 }
 
 } // namespace view
 }
 
 } // namespace view
index dd4a030ac1fa2de62cb5690b8a5db3490bf9426b..4241f80138705359e7df2b4cde134bcace28ee99 100644 (file)
@@ -34,7 +34,6 @@ namespace view {
 class LogicSignal : public Signal
 {
 private:
 class LogicSignal : public Signal
 {
 private:
-       static const float Margin;
        static const float Oversampling;
 
        static const QColor EdgeColour;
        static const float Oversampling;
 
        static const QColor EdgeColour;
index e3210fa39f3b9ac9d7bffc20797dd689bf27ce1d..98b5c65dd1fc37f8b3084e5363bb936b4fc1611a 100644 (file)
@@ -52,7 +52,8 @@ const int View::RulerHeight = 30;
 
 const int View::MaxScrollValue = INT_MAX / 2;
 
 
 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);
 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()
 {
 
 void View::reset_signal_layout()
 {
-       int offset = 0;
+       int offset = SignalMargin;
        vector< shared_ptr<Signal> > &sigs = _session.get_signals();
        BOOST_FOREACH(shared_ptr<Signal> s, sigs) {
                s->set_v_offset(offset);
        vector< shared_ptr<Signal> > &sigs = _session.get_signals();
        BOOST_FOREACH(shared_ptr<Signal> s, sigs) {
                s->set_v_offset(offset);
-               offset += SignalHeight;
+               offset += SignalHeight + 2 * SignalMargin;
        }
 }
 
        }
 }
 
index 6d7ac36dfb49265ea9c6fe92e0d1a6fc33133ace..1bf7132267a6d29d03dd9e95d8a7ff96d15016db 100644 (file)
@@ -54,6 +54,7 @@ private:
 
 public:
        static const int SignalHeight;
 
 public:
        static const int SignalHeight;
+       static const int SignalMargin;
        static const int SignalSnapGridSize;
 
        static const QColor CursorAreaColour;
        static const int SignalSnapGridSize;
 
        static const QColor CursorAreaColour;