View: Determine time unit and use it in other classes
[pulseview.git] / pv / view / view.hpp
index b29fb157dce383eec55535fcd187ecf104eaa9b7..b7d35e3c4102207998243147b0d2ab942c31d8c7 100644 (file)
@@ -34,6 +34,7 @@
 #include <QTimer>
 
 #include <pv/data/signaldata.hpp>
+#include <pv/util.hpp>
 
 #include "cursorpair.hpp"
 #include "flag.hpp"
@@ -129,6 +130,11 @@ public:
         */
        double tick_period() const;
 
+       /**
+        * Returns the unit of time currently used.
+        */
+       util::TimeUnit time_unit() const;
+
        /**
         * Returns the number of nested parents that this row item owner has.
         */
@@ -137,7 +143,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();
 
@@ -209,6 +215,8 @@ Q_SIGNALS:
 
        void sticky_scrolling_changed(bool state);
 
+       void always_zoom_to_fit_changed(bool state);
+
 private:
        void get_scroll_layout(double &length, double &offset) const;
 
@@ -257,6 +265,8 @@ private:
                        std::shared_ptr<Signal> > &signal_map,
                std::set< std::shared_ptr<Trace> > &add_list);
 
+       void determine_time_unit();
+
 private:
        bool eventFilter(QObject *object, QEvent *event);
 
@@ -299,10 +309,12 @@ private:
 
        bool updating_scroll_;
        bool sticky_scrolling_;
+       bool always_zoom_to_fit_;
        QTimer delayed_view_updater_;
 
        double tick_period_;
        unsigned int tick_prefix_;
+       util::TimeUnit time_unit_;
 
        bool show_cursors_;
        std::shared_ptr<CursorPair> cursors_;