X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fview%2Fview.cpp;h=d460e8686c3e22decc8f0b9d11e3f0ab32d59bd9;hb=90472a514889734ae79d156f2c30a2c9ca1fd611;hp=546176b44acccb187086654522ac1966db1ad234;hpb=66e4eae9ce743016c3f6d4974bceb9b7fc0ae7d7;p=pulseview.git diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 546176b4..d460e868 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -57,6 +57,7 @@ #include "viewport.hpp" #include "pv/session.hpp" +#include "pv/globalsettings.hpp" #include "pv/devices/device.hpp" #include "pv/data/logic.hpp" #include "pv/data/logicsegment.hpp" @@ -159,6 +160,9 @@ View::View(Session &session, QWidget *parent) : saved_v_offset_(0), size_finalized_(false) { + GlobalSettings settings; + coloured_bg_ = settings.value(GlobalSettings::Key_View_ColouredBG).toBool(); + connect(scrollarea_.horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(h_scroll_value_changed(int))); connect(scrollarea_.verticalScrollBar(), SIGNAL(valueChanged(int)), @@ -563,6 +567,11 @@ void View::enable_sticky_scrolling(bool state) sticky_scrolling_ = state; } +void View::toggle_sticky_scrolling(void) +{ + sticky_scrolling_ = !sticky_scrolling_; +} + void View::enable_coloured_bg(bool state) { const vector> items( @@ -1192,11 +1201,11 @@ void View::signals_changed() } // Add and position the pending top levels items + int offset = v_extents().second; for (auto item : new_top_level_items) { add_child_item(item); // Position the item after the last item or at the top if there is none - int offset = v_extents().second; const pair extents = item->v_extents(); if (item->enabled()) @@ -1223,6 +1232,14 @@ 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 + GlobalSettings settings; + bool state = settings.value(GlobalSettings::Key_View_AlwaysZoomToFit).toBool(); + if (state) { + always_zoom_to_fit_ = true; + always_zoom_to_fit_changed(always_zoom_to_fit_); + } } if (state == Session::Stopped) { @@ -1233,7 +1250,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_); } } }