X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fviews%2Ftrace%2Fview.cpp;h=79277b4e17074708b0f1e3718ef6eeb4996d2c93;hb=3b2ead4fbeb899188564ec9c69c216708311a881;hp=f1d7aa3dfca872a29bc81f5c0c2c444e4a34e03e;hpb=f4ab4b5c657e5613caba82feaa81a8a400e4f331;p=pulseview.git diff --git a/pv/views/trace/view.cpp b/pv/views/trace/view.cpp index f1d7aa3..79277b4 100644 --- a/pv/views/trace/view.cpp +++ b/pv/views/trace/view.cpp @@ -495,9 +495,12 @@ const Timestamp& View::ruler_offset() const return ruler_offset_; } -void View::set_zero_position(pv::util::Timestamp& position) +void View::set_zero_position(const pv::util::Timestamp& position) { - ruler_shift_ = -position; + // ruler shift is a negative offset and the new zero position is relative + // to the current offset. Hence, we adjust the ruler shift only by the + // difference. + ruler_shift_ = -(position + (-ruler_shift_)); // Force an immediate update of the offsets set_offset(offset_, true); @@ -1215,7 +1218,8 @@ void View::set_scroll_default() void View::determine_if_header_was_shrunk() { - const int header_pane_width = splitter_->sizes().front(); + const int header_pane_width = + splitter_->sizes().front(); // clazy:exclude=detaching-temporary // Allow for a slight margin of error so that we also accept // slight differences when e.g. a label name change increased @@ -1234,7 +1238,7 @@ void View::resize_header_to_fit() // splitter to the maximum allowed position. int splitter_area_width = 0; - for (int w : splitter_->sizes()) + for (int w : splitter_->sizes()) // clazy:exclude=range-loop splitter_area_width += w; // Make sure the header has enough horizontal space to show all labels fully