X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fviews%2Ftrace%2Fview.cpp;h=8e2a2b329daa7bfae8ffbe96f507b550de88fa92;hp=2a4c4372194749d5c9ce9a6d0bf377d507f1cfd6;hb=39173000c5d0d164c52443d16a1dc434d538b198;hpb=4eba9990f617cba59193c7df8e6359ea642ccb27 diff --git a/pv/views/trace/view.cpp b/pv/views/trace/view.cpp index 2a4c4372..8e2a2b32 100644 --- a/pv/views/trace/view.cpp +++ b/pv/views/trace/view.cpp @@ -456,6 +456,16 @@ void View::set_scale(double scale) } } +pv::util::Timestamp View::absolute_to_ruler_time(const pv::util::Timestamp& abs_time) const +{ + return abs_time + zero_offset_; +} + +pv::util::Timestamp View::ruler_to_absolute_time(const pv::util::Timestamp& ruler_time) const +{ + return ruler_time - zero_offset_; +} + void View::set_offset(const pv::util::Timestamp& offset, bool force_update) { if ((offset_ != offset) || force_update) { @@ -790,37 +800,36 @@ bool View::cursors_shown() const void View::show_cursors(bool show) { - if (show_cursors_ != show) { - show_cursors_ = show; - cursor_state_changed(show); - ruler_->update(); - viewport_->update(); + if (show_cursors_ != show) { + show_cursors_ = show; - } else { - show_cursors_ = show; - } + cursor_state_changed(show); + ruler_->update(); + viewport_->update(); + } } -void View::set_cursors(pv::util::Timestamp& first, pv::util::Timestamp& second) { - assert(cursors); +void View::set_cursors(pv::util::Timestamp& first, pv::util::Timestamp& second) +{ + assert(cursors_); - cursors_->first()->set_time(first); - cursors_->second()->set_time(second); + cursors_->first()->set_time(first); + cursors_->second()->set_time(second); - ruler_->update(); - viewport_->update(); + ruler_->update(); + viewport_->update(); } void View::centre_cursors() { - assert(cursors); + assert(cursors_); - const double time_width = scale_ * viewport_->width(); - cursors_->first()->set_time(offset_ + time_width * 0.4); - cursors_->second()->set_time(offset_ + time_width * 0.6); + const double time_width = scale_ * viewport_->width(); + cursors_->first()->set_time(offset_ + time_width * 0.4); + cursors_->second()->set_time(offset_ + time_width * 0.6); - ruler_->update(); - viewport_->update(); + ruler_->update(); + viewport_->update(); } shared_ptr View::cursors() const