X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fviews%2Ftrace%2Fview.cpp;h=58056e5c9a82279285a4357de17d91b9b0bf5329;hb=558ad6ceb934ab7406d286c1a4ae08da4aba1448;hp=2bfe68c22468858d3bc24bd47034798dad78f607;hpb=3734c4645fc071fe7ecfb552d65d343e50b098e1;p=pulseview.git diff --git a/pv/views/trace/view.cpp b/pv/views/trace/view.cpp index 2bfe68c..58056e5 100644 --- a/pv/views/trace/view.cpp +++ b/pv/views/trace/view.cpp @@ -261,6 +261,7 @@ void View::add_signal(const shared_ptr signal) signals_.insert(signal); signal->set_segment_display_mode(segment_display_mode_); + signal->set_current_segment(current_segment_); connect(signal->base().get(), SIGNAL(name_changed(const QString&)), this, SLOT(on_signal_name_changed())); @@ -279,6 +280,7 @@ void View::add_decode_signal(shared_ptr signal) decode_traces_.push_back(d); d->set_segment_display_mode(segment_display_mode_); + d->set_current_segment(current_segment_); connect(signal.get(), SIGNAL(name_changed(const QString&)), this, SLOT(on_signal_name_changed())); @@ -486,6 +488,18 @@ void View::set_time_unit(pv::util::TimeUnit time_unit) } } +void View::set_current_segment(uint32_t segment_id) +{ + current_segment_ = segment_id; + + for (shared_ptr signal : signals_) + signal->set_current_segment(current_segment_); + for (shared_ptr dt : decode_traces_) + dt->set_current_segment(current_segment_); + + viewport_->update(); +} + bool View::segment_is_selectable() const { return segment_selectable_; @@ -1382,6 +1396,10 @@ void View::capture_state_updated(int state) // Enable sticky scrolling if the setting is enabled sticky_scrolling_ = settings.value(GlobalSettings::Key_View_StickyScrolling).toBool(); + + // Reset all traces to segment 0 + current_segment_ = 0; + set_current_segment(current_segment_); } if (state == Session::Stopped) { @@ -1418,17 +1436,32 @@ void View::on_new_segment(int new_segment_id) segment_changed(new_segment_id); } +void View::on_segment_completed(int segment_id) +{ + on_segment_changed(segment_id); + segment_changed(segment_id); +} + void View::on_segment_changed(int segment) { switch (segment_display_mode_) { case Trace::ShowLastSegmentOnly: case Trace::ShowSingleSegmentOnly: - current_segment_ = segment; - for (shared_ptr signal : signals_) - signal->set_current_segment(current_segment_); - for (shared_ptr dt : decode_traces_) - dt->set_current_segment(current_segment_); - viewport_->update(); + set_current_segment(segment); + break; + + case Trace::ShowLastCompleteSegmentOnly: + { + // Only update if all segments are complete + bool all_complete = true; + + for (shared_ptr signal : signals_) + if (!signal->base()->segment_is_complete(segment)) + all_complete = false; + + if (all_complete) + set_current_segment(segment); + } break; case Trace::ShowAllSegments: