]> sigrok.org Git - pulseview.git/commitdiff
DecodeTrace: Resize trace when hiding/deleting a stacked PD
authorSoeren Apel <redacted>
Fri, 14 Jul 2017 16:24:32 +0000 (18:24 +0200)
committerSoeren Apel <redacted>
Fri, 14 Jul 2017 16:24:32 +0000 (18:24 +0200)
The trace height depends on DecodeTrace::max_visible_rows_,
which needs to be updated when a stacked PD is hidden or
deleted. In order to do this, we reset max_visible_rows_ to
0 and then request a repaint.

pv/views/trace/decodetrace.cpp

index 9529c50a72650958ce7f0b3abdc93b67a01a6f21..b4857336f9e6e1e350bc73e91ef6409bcc3f7e2e 100644 (file)
@@ -950,6 +950,10 @@ void DecodeTrace::on_delete_decoder(int index)
 {
        decode_signal_->remove_decoder(index);
 
+       // Force re-calculation of the trace height, see paint_mid()
+       max_visible_rows_ = 0;
+       owner_->extents_changed(false, true);
+
        // Update the popup
        create_popup_form();
 }
@@ -961,6 +965,12 @@ void DecodeTrace::on_show_hide_decoder(int index)
        assert(index < (int)decoder_forms_.size());
        decoder_forms_[index]->set_decoder_visible(state);
 
+       if (!state) {
+               // Force re-calculation of the trace height, see paint_mid()
+               max_visible_rows_ = 0;
+               owner_->extents_changed(false, true);
+       }
+
        if (owner_)
                owner_->row_item_appearance_changed(false, true);
 }