X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fdata%2Fdecode%2Fannotation.cpp;h=b1dc6ef66c17efa6f44bd416bf546261380f2636;hb=9a5ef9a0d7966bf956f0b32bf3a57029a8d7d45a;hp=9f86b2bab84362e26503233c3cb516ee7ebcdf41;hpb=1dcd9b18186741d3ce3164f7e8d6cb13abb578d3;p=pulseview.git diff --git a/pv/data/decode/annotation.cpp b/pv/data/decode/annotation.cpp index 9f86b2ba..b1dc6ef6 100644 --- a/pv/data/decode/annotation.cpp +++ b/pv/data/decode/annotation.cpp @@ -66,8 +66,14 @@ Annotation& Annotation::operator=(Annotation&& a) return *this; } -Annotation::~Annotation() +const RowData* Annotation::row_data() const { + return data_; +} + +const Row* Annotation::row() const +{ + return data_->row(); } uint64_t Annotation::start_sample() const @@ -80,6 +86,11 @@ uint64_t Annotation::end_sample() const return end_sample_; } +uint64_t Annotation::length() const +{ + return end_sample_ - start_sample_; +} + Annotation::Class Annotation::ann_class_id() const { return ann_class_id_; @@ -93,6 +104,14 @@ const QString Annotation::ann_class_name() const return QString(ann_class->name); } +const QString Annotation::ann_class_description() const +{ + const AnnotationClass* ann_class = + data_->row()->decoder()->get_ann_class_by_id(ann_class_id_); + + return QString(ann_class->description); +} + const vector* Annotation::annotations() const { return texts_; @@ -103,9 +122,27 @@ const QString Annotation::longest_annotation() const return texts_->front(); } -const Row* Annotation::row() const +bool Annotation::visible() const { - return data_->row(); + const Row* row = data_->row(); + + return (row->visible() && row->class_is_visible(ann_class_id_) + && row->decoder()->visible()); +} + +const QColor Annotation::color() const +{ + return data_->row()->get_class_color(ann_class_id_); +} + +const QColor Annotation::bright_color() const +{ + return data_->row()->get_bright_class_color(ann_class_id_); +} + +const QColor Annotation::dark_color() const +{ + return data_->row()->get_dark_class_color(ann_class_id_); } bool Annotation::operator<(const Annotation &other) const