Implement "always zoom to fit" feature
[pulseview.git] / pv / view / view.hpp
index 3e0a347142fb91b69b72301c4adeaa60e109e07b..2c81e74782cbbac3d3948aec2c9ca963d90632ae 100644 (file)
@@ -69,6 +69,7 @@ private:
        static const double MinScale;
 
        static const int MaxScrollValue;
+       static const int MaxViewAutoUpdateRate;
 
        static const int ScaleUnits[3];
 
@@ -136,7 +137,7 @@ public:
        void zoom(double steps);
        void zoom(double steps, int offset);
 
-       void zoom_fit();
+       void zoom_fit(bool gui_state);
 
        void zoom_one_to_one();
 
@@ -152,6 +153,12 @@ public:
 
        std::pair<double, double> get_time_extents() const;
 
+       /**
+        * Enables or disables sticky scrolling, i.e. the view always shows
+        * the most recent samples when capturing data.
+        */
+       void enable_sticky_scrolling(bool state);
+
        /**
         * Returns true if cursors are displayed. false otherwise.
         */
@@ -200,6 +207,10 @@ Q_SIGNALS:
 
        void scale_offset_changed();
 
+       void sticky_scrolling_changed(bool state);
+
+       void always_zoom_to_fit_changed(bool state);
+
 private:
        void get_scroll_layout(double &length, double &offset) const;
 
@@ -269,6 +280,8 @@ private Q_SLOTS:
        void signals_changed();
        void data_updated();
 
+       void perform_delayed_view_update();
+
        void process_sticky_events();
 
        void on_hover_point_changed();
@@ -287,6 +300,9 @@ private:
        double offset_;
 
        bool updating_scroll_;
+       bool sticky_scrolling_;
+       bool always_zoom_to_fit_;
+       QTimer delayed_view_updater_;
 
        double tick_period_;
        unsigned int tick_prefix_;