const pv::util::Timestamp& diff = abs(time_ - other->time_);
return Ruler::format_time_with_distance(
- diff, view_.absolute_to_ruler_time(time_),
+ diff, view_.ruler()->get_ruler_time_from_absolute_time(time_),
view_.tick_prefix(), view_.time_unit(), view_.tick_precision());
}
return view_.ruler_offset() + ((double)x + 0.5) * view_.scale();
}
+pv::util::Timestamp Ruler::get_ruler_time_from_absolute_time(const pv::util::Timestamp& abs_time) const
+{
+ return abs_time + view_.zero_offset();
+}
+
+pv::util::Timestamp Ruler::get_absolute_time_from_ruler_time(const pv::util::Timestamp& ruler_time) const
+{
+ return ruler_time - view_.zero_offset();
+}
+
void Ruler::contextMenuEvent(QContextMenuEvent *event)
{
MarginWidget::contextMenuEvent(event);
pv::util::Timestamp get_absolute_time_from_x_pos(uint32_t x) const;
pv::util::Timestamp get_ruler_time_from_x_pos(uint32_t x) const;
+ pv::util::Timestamp get_ruler_time_from_absolute_time(const pv::util::Timestamp& abs_time) const;
+ pv::util::Timestamp get_absolute_time_from_ruler_time(const pv::util::Timestamp& ruler_time) const;
+
protected:
virtual void contextMenuEvent(QContextMenuEvent *event) override;
void resizeEvent(QResizeEvent*) override;
#include "timemarker.hpp"
#include "pv/widgets/timestampspinbox.hpp"
+#include "ruler.hpp"
#include "view.hpp"
#include <QApplication>
if (value_widget_) {
updating_value_widget_ = true;
- value_widget_->setValue(view_.absolute_to_ruler_time(time));
+ value_widget_->setValue(view_.ruler()->get_ruler_time_from_absolute_time(time));
updating_value_widget_ = false;
}
popup->setLayout(form);
value_widget_ = new pv::widgets::TimestampSpinBox(parent);
- value_widget_->setValue(view_.absolute_to_ruler_time(time_));
+ value_widget_->setValue(view_.ruler()->get_ruler_time_from_absolute_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(view_.ruler_to_absolute_time(value));
+ set_time(view_.ruler()->get_absolute_time_from_ruler_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) {
ruler_->update();
}
+pv::util::Timestamp View::zero_offset() const
+{
+ return zero_offset_;
+}
+
int View::owner_visual_v_offset() const
{
return -scrollarea_->verticalScrollBar()->sliderPosition();
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;
+ pv::util::Timestamp zero_offset() const;
/**
* Returns the vertical scroll offset.