]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decode/row.hpp
Move row/annotation color management out of DecodeTrace
[pulseview.git] / pv / data / decode / row.hpp
index 8486c5075fe0bd39d09736c750ace8bf5e2109f8..000bdf9e6b935c8ee838367c7a5c8460badfcca9 100644 (file)
 
 #include <vector>
 
-#include "annotation.hpp"
+#include <QColor>
+
+#include <pv/data/decode/annotation.hpp>
+#include <pv/data/decode/decoder.hpp>
 
 struct srd_decoder;
 struct srd_decoder_annotation_row;
@@ -31,28 +34,52 @@ namespace pv {
 namespace data {
 namespace decode {
 
+#define DECODE_COLOR_SATURATION (180) /* 0-255 */
+#define DECODE_COLOR_VALUE (170) /* 0-255 */
+
+struct AnnotationClass;
+class Decoder;
+
 class Row
 {
 public:
        Row();
 
-       Row(int index, const srd_decoder *decoder,
-               const srd_decoder_annotation_row *row = nullptr);
+       Row(uint32_t index, Decoder* decoder,
+               const srd_decoder_annotation_row* srd_row = nullptr);
 
-       const srd_decoder* decoder() const;
-       const srd_decoder_annotation_row* row() const;
+       const Decoder* decoder() const;
+       const srd_decoder_annotation_row* get_srd_row() const;
 
        const QString title() const;
-       const QString class_name() const;
-       int index() const;
+       const QString description() const;
+       vector<AnnotationClass*> ann_classes() const;
+       uint32_t index() const;
+
+       bool visible() const;
+       void set_visible(bool visible);
 
-       bool operator<(const Row &other) const;
-       bool operator==(const Row &other) const;
+       void set_base_color(QColor base_color);
+       const QColor color() const;
+       const QColor get_class_color(uint32_t ann_class_id) const;
+       const QColor get_bright_class_color(uint32_t ann_class_id) const;
+       const QColor get_dark_class_color(uint32_t ann_class_id) const;
+
+       bool has_hidden_classes() const;
+
+       bool operator<(const Row& other) const;
+       bool operator==(const Row& other) const;
 
 private:
-       int index_;
-       const srd_decoder *decoder_;
-       const srd_decoder_annotation_row *row_;
+       uint32_t index_;
+       Decoder* decoder_;
+       const srd_decoder_annotation_row* srd_row_;
+       bool visible_;
+
+       QColor color_;
+       map<uint32_t, QColor> ann_class_color_;
+       map<uint32_t, QColor> ann_bright_class_color_;
+       map<uint32_t, QColor> ann_dark_class_color_;
 };
 
 }  // namespace decode