const pv::util::Timestamp& diff = abs(time_ - other->time_);
return Ruler::format_time_with_distance(
- diff, time_, view_.tick_prefix(), view_.time_unit(), view_.tick_precision());
+ diff, view_.absolute_to_ruler_time(time_),
+ view_.tick_prefix(), view_.time_unit(), view_.tick_precision());
}
QRectF Cursor::label_rect(const QRectF &rect) const
if (value_widget_) {
updating_value_widget_ = true;
- value_widget_->setValue(time);
+ value_widget_->setValue(view_.absolute_to_ruler_time(time));
updating_value_widget_ = false;
}
popup->setLayout(form);
value_widget_ = new pv::widgets::TimestampSpinBox(parent);
- value_widget_->setValue(time_);
+ value_widget_->setValue(view_.absolute_to_ruler_time(time_));
connect(value_widget_, SIGNAL(valueChanged(const pv::util::Timestamp&)),
this, SLOT(on_value_changed(const pv::util::Timestamp&)));
void TimeMarker::on_value_changed(const pv::util::Timestamp& value)
{
if (!updating_value_widget_)
- set_time(value);
+ set_time(view_.ruler_to_absolute_time(value));
}
} // namespace trace
}
}
+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) {
void reset_zero_position();
+ pv::util::Timestamp absolute_to_ruler_time(const pv::util::Timestamp& abs_time) const;
+ pv::util::Timestamp ruler_to_absolute_time(const pv::util::Timestamp& ruler_time) const;
+
/**
* Returns the vertical scroll offset.
*/