X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fview.cpp;h=04bb99205636fd50ffe18872f56dd3ba2dcd3bb5;hb=820ce18a827fe02f5ed73e2bbd16ecad9c8e2e94;hp=f6048f0401c3c8a16826307528f2861b2fbb31db;hpb=24c29d4f917ffac5a280d572cc04d1edb66a81b9;p=pulseview.git diff --git a/pv/view/view.cpp b/pv/view/view.cpp index f6048f0..04bb992 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -136,8 +136,8 @@ bool CustomAbstractScrollArea::viewportEvent(QEvent *event) } } -View::View(Session &session, QWidget *parent) : - ViewBase(session, parent), +View::View(Session &session, bool is_main_view, QWidget *parent) : + ViewBase(session, is_main_view, parent), viewport_(new Viewport(*this)), ruler_(new Ruler(*this)), header_(new Header(*this)), @@ -1232,6 +1232,16 @@ void View::capture_state_updated(int state) set_time_unit(util::TimeUnit::Samples); trigger_markers_.clear(); + + // Activate "always zoom to fit" if the setting is enabled and we're + // the main view of this session (other trace views may be used for + // zooming and we don't want to mess them up) + GlobalSettings settings; + bool state = settings.value(GlobalSettings::Key_View_AlwaysZoomToFit).toBool(); + if (is_main_view_ && state) { + always_zoom_to_fit_ = true; + always_zoom_to_fit_changed(always_zoom_to_fit_); + } } if (state == Session::Stopped) { @@ -1242,7 +1252,7 @@ void View::capture_state_updated(int state) // Reset "always zoom to fit", the acquisition has stopped if (always_zoom_to_fit_) { always_zoom_to_fit_ = false; - always_zoom_to_fit_changed(false); + always_zoom_to_fit_changed(always_zoom_to_fit_); } } }