ann_classes_.at((size_t)cl->data).row = &(rows_.back());
}
- if (rows_.empty())
+ if (rows_.empty()) {
// Make sure there is a row for PDs without row declarations
- rows_.emplace_back(0, this);
+ rows_.push_back({0, this});
+
+ for (AnnotationClass& c : ann_classes_)
+ c.row = &(rows_.back());
+ }
}
Decoder::~Decoder()
return result;
}
+vector<AnnotationClass*> Decoder::ann_classes()
+{
+ vector<AnnotationClass*> result;
+
+ for (AnnotationClass& c : ann_classes_)
+ result.push_back(&c);
+
+ return result;
+}
+
AnnotationClass* Decoder::get_ann_class_by_id(size_t id)
{
if (id >= ann_classes_.size())
Row* get_row_by_id(size_t id);
vector<const AnnotationClass*> ann_classes() const;
+ vector<AnnotationClass*> ann_classes();
AnnotationClass* get_ann_class_by_id(size_t id);
uint32_t get_binary_class_count() const;
vector<AnnotationClass*> Row::ann_classes() const
{
+ assert(decoder_);
+
vector<AnnotationClass*> result;
- if (!srd_row_)
+ if (!srd_row_) {
+ if (index_ == 0) {
+ // When operating as the fallback row, all annotation classes belong to it
+ return decoder_->ann_classes();
+ }
return result;
- assert(decoder_);
+ }
for (GSList *l = srd_row_->ann_classes; l; l = l->next) {
size_t class_id = (size_t)l->data;
decode_signal_->get_annotation_subset(annotations, r.decode_row,
current_segment_, sample_range.first, sample_range.second);
- // Show row if there are visible annotations or when user wants to see
+ // Show row if there are visible annotations, when user wants to see
// all rows that have annotations somewhere and this one is one of them
+ // or when the row has at least one hidden annotation class
r.currently_visible = !annotations.empty();
if (!r.currently_visible) {
size_t ann_count = decode_signal_->get_annotation_count(r.decode_row, current_segment_);
- r.currently_visible = always_show_all_rows_ && (ann_count > 0);
+ r.currently_visible = (always_show_all_rows_ || r.has_hidden_classes) &&
+ (ann_count > 0);
}
if (r.currently_visible) {
if (hover_row) {
int row_y = get_row_y(hover_row);
- if ((hp.x() > 0) && (hp.x() < 2 * ArrowSize) &&
+ if ((hp.x() > 0) && (hp.x() < (int)(ArrowSize + 3 + hover_row->title_width)) &&
(hp.y() > (int)(row_y - ArrowSize)) && (hp.y() < (int)(row_y + ArrowSize)))
hover_row->expand_marker_highlighted = true;
}
continue;
unsigned int y = get_row_y(&r);
- if ((event->x() > 0) && (event->x() <= (int)(ArrowSize + 3)) &&
+ if ((event->x() > 0) && (event->x() <= (int)(ArrowSize + 3 + r.title_width)) &&
(event->y() > (int)(y - (default_row_height_ / 2))) &&
(event->y() <= (int)(y + (default_row_height_ / 2)))) {