]> sigrok.org Git - pulseview.git/commitdiff
Setup analog probe colours
authorJoel Holdsworth <redacted>
Sat, 16 Mar 2013 08:44:04 +0000 (08:44 +0000)
committerJoel Holdsworth <redacted>
Thu, 21 Mar 2013 22:44:18 +0000 (22:44 +0000)
pv/sigsession.cpp
pv/view/analogsignal.cpp
pv/view/analogsignal.h

index 5af04b839be314cbc878e664fd6e0ddfb4e5ac41..55b33087a3dbd5b2533df32001efe8836b934974 100644 (file)
@@ -261,7 +261,7 @@ void SigSession::feed_in_header(const sr_dev_inst *sdi)
                        case SR_PROBE_ANALOG:
                                signal = shared_ptr<view::Signal>(
                                        new view::AnalogSignal(probe->name,
-                                               _analog_data));
+                                               _analog_data, probe->index));
                                break;
                        }
 
index a6f032b5793aa0422e8e71b07f5e5b2f56fb3e2d..03b05955e4820f90bfd40e12058ccef2d7d60701 100644 (file)
@@ -32,11 +32,19 @@ using namespace std;
 namespace pv {
 namespace view {
 
-AnalogSignal::AnalogSignal(QString name, shared_ptr<data::Analog> data) :
+const QColor AnalogSignal::SignalColours[4] = {
+       QColor(0xC4, 0xA0, 0x00),       // Yellow
+       QColor(0x87, 0x20, 0x7A),       // Magenta
+       QColor(0x20, 0x4A, 0x87),       // Blue
+       QColor(0x4E, 0x9A, 0x06)        // Green
+};
+
+AnalogSignal::AnalogSignal(QString name, shared_ptr<data::Analog> data,
+       int probe_index) :
        Signal(name),
        _data(data)
 {
-       _colour = Qt::blue;
+       _colour = SignalColours[probe_index % countof(SignalColours)];
 }
 
 void AnalogSignal::paint(QPainter &p, int y, int left, int right, double scale,
index 86471537abce44236291664b98a1e74084cc187d..6e4199acf16f7427382e8aeffee838791d8540e9 100644 (file)
@@ -35,9 +35,12 @@ namespace view {
 
 class AnalogSignal : public Signal
 {
+private:
+       static const QColor SignalColours[4];
+
 public:
        AnalogSignal(QString name,
-               boost::shared_ptr<pv::data::Analog> data);
+               boost::shared_ptr<pv::data::Analog> data, int probe_index);
 
        /**
         * Paints the signal with a QPainter