#include "mathsignal.hpp"
+#include <extdef.h>
#include <pv/globalsettings.hpp>
#include <pv/session.hpp>
#include <pv/data/analogsegment.hpp>
exprtk_parser_(nullptr),
fnc_sig_sample_(nullptr)
{
- set_name(QString(tr("Math%1")).arg(session_.get_next_signal_index(MathChannel)));
+ uint32_t sig_idx = session_.get_next_signal_index(MathChannel);
+ set_name(QString(tr("Math%1")).arg(sig_idx));
+ set_color(AnalogSignalColors[(sig_idx - 1) % countof(AnalogSignalColors)]);
set_data(std::make_shared<data::Analog>());
#include <QDebug>
-#include <pv/binding/decoder.hpp>
+#include <extdef.h>
#include <pv/session.hpp>
+#include <pv/binding/decoder.hpp>
using std::dynamic_pointer_cast;
using std::make_shared;
namespace pv {
namespace data {
+const QColor SignalBase::AnalogSignalColors[8] =
+{
+ QColor(0xC4, 0xA0, 0x00), // Yellow HSV: 49 / 100 / 77
+ QColor(0x87, 0x20, 0x7A), // Magenta HSV: 308 / 70 / 53
+ QColor(0x20, 0x4A, 0x87), // Blue HSV: 216 / 76 / 53
+ QColor(0x4E, 0x9A, 0x06), // Green HSV: 91 / 96 / 60
+ QColor(0xBF, 0x6E, 0x00), // Orange HSV: 35 / 100 / 75
+ QColor(0x5E, 0x20, 0x80), // Purple HSV: 280 / 75 / 50
+ QColor(0x20, 0x80, 0x7A), // Turqoise HSV: 177 / 75 / 50
+ QColor(0x80, 0x20, 0x24) // Red HSV: 358 / 75 / 50
+};
+
+const QColor SignalBase::LogicSignalColors[10] =
+{
+ QColor(0x16, 0x19, 0x1A), // Black
+ QColor(0x8F, 0x52, 0x02), // Brown
+ QColor(0xCC, 0x00, 0x00), // Red
+ QColor(0xF5, 0x79, 0x00), // Orange
+ QColor(0xED, 0xD4, 0x00), // Yellow
+ QColor(0x73, 0xD2, 0x16), // Green
+ QColor(0x34, 0x65, 0xA4), // Blue
+ QColor(0x75, 0x50, 0x7B), // Violet
+ QColor(0x88, 0x8A, 0x85), // Grey
+ QColor(0xEE, 0xEE, 0xEC), // White
+};
+
+
const int SignalBase::ColorBGAlpha = 8 * 256 / 100;
const uint64_t SignalBase::ConversionBlockSize = 4096;
const uint32_t SignalBase::ConversionDelay = 1000; // 1 second
this, SLOT(on_delayed_conversion_start()));
delayed_conversion_starter_.setSingleShot(true);
delayed_conversion_starter_.setInterval(ConversionDelay);
+
+ // Only logic and analog SR channels can have their colors auto-set
+ // because for them, we have an index that can be used
+ if (channel_type == LogicChannel)
+ set_color(LogicSignalColors[index() % countof(LogicSignalColors)]);
+ else if (channel_type == AnalogChannel)
+ set_color(AnalogSignalColors[index() % countof(AnalogSignalColors)]);
}
SignalBase::~SignalBase()
DynamicPreset = 0 ///< Conversion uses calculated values
};
+ static const QColor AnalogSignalColors[8];
+ static const QColor LogicSignalColors[10];
+
private:
static const int ColorBGAlpha;
static const uint64_t ConversionBlockSize;
namespace views {
namespace trace {
-const QColor AnalogSignal::SignalColors[4] = {
- QColor(0xC4, 0xA0, 0x00), // Yellow
- QColor(0x87, 0x20, 0x7A), // Magenta
- QColor(0x20, 0x4A, 0x87), // Blue
- QColor(0x4E, 0x9A, 0x06) // Green
-};
-
const QPen AnalogSignal::AxisPen(QColor(0, 0, 0, 30 * 256 / 100), 2);
const QColor AnalogSignal::GridMajorColor = QColor(0, 0, 0, 40 * 256 / 100);
const QColor AnalogSignal::GridMinorColor = QColor(0, 0, 0, 20 * 256 / 100);
settings.value(GlobalSettings::Key_View_ConversionThresholdDispMode).toInt();
div_height_ = settings.value(GlobalSettings::Key_View_DefaultDivHeight).toInt();
- base_->set_color(SignalColors[base_->index() % countof(SignalColors)]);
update_scale();
}
private:
static const QPen AxisPen;
- static const QColor SignalColors[4];
static const QColor GridMajorColor, GridMinorColor;
static const QColor SamplingPointColor;
static const QColor SamplingPointColorLo;
const QColor LogicSignal::LowColor(0xC0, 0x00, 0x00);
const QColor LogicSignal::SamplingPointColor(0x77, 0x77, 0x77);
-const QColor LogicSignal::SignalColors[10] = {
- QColor(0x16, 0x19, 0x1A), // Black
- QColor(0x8F, 0x52, 0x02), // Brown
- QColor(0xCC, 0x00, 0x00), // Red
- QColor(0xF5, 0x79, 0x00), // Orange
- QColor(0xED, 0xD4, 0x00), // Yellow
- QColor(0x73, 0xD2, 0x16), // Green
- QColor(0x34, 0x65, 0xA4), // Blue
- QColor(0x75, 0x50, 0x7B), // Violet
- QColor(0x88, 0x8A, 0x85), // Grey
- QColor(0xEE, 0xEE, 0xEC), // White
-};
-
QColor LogicSignal::TriggerMarkerBackgroundColor = QColor(0xED, 0xD4, 0x00);
const int LogicSignal::TriggerMarkerPadding = 2;
const char* LogicSignal::TriggerMarkerIcons[8] = {
{
shared_ptr<Trigger> trigger;
- base_->set_color(SignalColors[base->index() % countof(SignalColors)]);
-
GlobalSettings settings;
signal_height_ = settings.value(GlobalSettings::Key_View_DefaultLogicHeight).toInt();
show_sampling_points_ =
static const QColor LowColor;
static const QColor SamplingPointColor;
- static const QColor SignalColors[10];
-
static QColor TriggerMarkerBackgroundColor;
static const int TriggerMarkerPadding;
static const char* TriggerMarkerIcons[8];