]> sigrok.org Git - pulseview.git/blobdiff - pv/view/view.hpp
View: Introduce settings_restored_
[pulseview.git] / pv / view / view.hpp
index aebc25401bb85d34cad008e28c99fa0104c8dce3..08e17d6056867f45be84bee8b62d61cad70f45df 100644 (file)
 
 #include <QAbstractScrollArea>
 #include <QSizeF>
-#include <QTimer>
+#include <QSplitter>
 
 #include <pv/data/signaldata.hpp>
-#include <pv/views/viewbase.hpp>
 #include <pv/util.hpp>
+#include <pv/views/viewbase.hpp>
 
 #include "cursorpair.hpp"
 #include "flag.hpp"
@@ -54,6 +54,10 @@ namespace pv {
 
 class Session;
 
+namespace data {
+class Logic;
+}
+
 namespace views {
 
 namespace TraceView {
@@ -67,16 +71,17 @@ class Trace;
 class Viewport;
 class TriggerMarker;
 
-class CustomAbstractScrollArea : public QAbstractScrollArea {
+class CustomScrollArea : public QAbstractScrollArea
+{
        Q_OBJECT
 
 public:
-       CustomAbstractScrollArea(QWidget *parent = nullptr);
-       void setViewportMargins(int left, int top, int right, int bottom);
+       CustomScrollArea(QWidget *parent = nullptr);
        bool viewportEvent(QEvent *event);
 };
 
-class View : public ViewBase, public TraceTreeItemOwner {
+class View : public ViewBase, public TraceTreeItemOwner
+{
        Q_OBJECT
 
 private:
@@ -90,7 +95,6 @@ private:
        static const pv::util::Timestamp MinScale;
 
        static const int MaxScrollValue;
-       static const int MaxViewAutoUpdateRate;
 
        static const int ScaleUnits[3];
 
@@ -107,7 +111,7 @@ public:
 
        virtual void clear_signals();
 
-       virtual void add_signal(const shared_ptr<Signal> signal);
+       void add_signal(const shared_ptr<Signal> signal);
 
 #ifdef ENABLE_DECODE
        virtual void clear_decode_signals();
@@ -210,11 +214,21 @@ public:
         */
        void enable_coloured_bg(bool state);
 
+       /**
+        * Returns true if the trace background should be drawn with a coloured background.
+        */
+       bool coloured_bg() const;
+
        /**
         * Enable or disable showing sampling points.
         */
        void enable_show_sampling_points(bool state);
 
+       /**
+        * Enable or disable showing the analog minor grid.
+        */
+       void enable_show_analog_minor_grid(bool state);
+
        /**
         * Returns true if cursors are displayed. false otherwise.
         */
@@ -301,12 +315,18 @@ private:
         */
        void calculate_tick_spacing();
 
+       void adjust_top_margin();
+
        void update_scroll();
 
        void reset_scroll();
 
        void set_scroll_default();
 
+       bool header_was_shrunk() const;
+
+       void expand_header_to_fit();
+
        void update_layout();
 
        TraceTreeItemOwner* find_prevalent_trace_group(
@@ -335,14 +355,16 @@ public:
 
 private Q_SLOTS:
 
+       void on_splitter_moved();
+       void on_repeat_splitter_expansion();
+
        void h_scroll_value_changed(int value);
        void v_scroll_value_changed();
 
        void signals_changed();
        void capture_state_updated(int state);
-       void data_updated();
 
-       void perform_delayed_view_update();
+       virtual void perform_delayed_view_update();
 
        void process_sticky_events();
 
@@ -385,9 +407,11 @@ private Q_SLOTS:
        void set_time_unit(pv::util::TimeUnit time_unit);
 
 private:
+       CustomScrollArea *scrollarea_;
        Viewport *viewport_;
        Ruler *ruler_;
        Header *header_;
+       QSplitter *splitter_;
 
        unordered_set< shared_ptr<Signal> > signals_;
 
@@ -395,8 +419,6 @@ private:
        vector< shared_ptr<DecodeTrace> > decode_traces_;
 #endif
 
-       CustomAbstractScrollArea scrollarea_;
-
        /// The view time scale in seconds per pixel.
        double scale_;
 
@@ -404,10 +426,11 @@ private:
        pv::util::Timestamp offset_;
 
        bool updating_scroll_;
+       bool settings_restored_;
+
        bool sticky_scrolling_;
        bool coloured_bg_;
        bool always_zoom_to_fit_;
-       QTimer delayed_view_updater_;
 
        pv::util::Timestamp tick_period_;
        pv::util::SIPrefix tick_prefix_;
@@ -432,8 +455,6 @@ private:
 
        // A nonzero value indicates the v offset to restore. See View::resizeEvent()
        int saved_v_offset_;
-
-       bool size_finalized_;
 };
 
 } // namespace TraceView