]> sigrok.org Git - pulseview.git/blobdiff - pv/view/view.h
View: Replace compare_trace_v_offsets with a lambda
[pulseview.git] / pv / view / view.h
index bc99bdd775ef88c26fc235fef299d5a5eebe6a7a..6e097a4d68c11b4ba3e31df41e16f5a9d98a4dfc 100644 (file)
 
 #include <stdint.h>
 
+#include <memory>
+#include <set>
 #include <vector>
 
-#include <boost/shared_ptr.hpp>
-#include <boost/weak_ptr.hpp>
-
 #include <QAbstractScrollArea>
 #include <QSizeF>
 
+#include <pv/data/signaldata.h>
+
 #include "cursorpair.h"
 
 namespace pv {
@@ -39,6 +40,7 @@ class SigSession;
 
 namespace view {
 
+class CursorHeader;
 class Header;
 class Ruler;
 class Trace;
@@ -51,9 +53,6 @@ private:
        static const double MaxScale;
        static const double MinScale;
 
-       static const int LabelMarginWidth;
-       static const int RulerHeight;
-
        static const int MaxScrollValue;
 
 public:
@@ -71,6 +70,10 @@ public:
        SigSession& session();
        const SigSession& session() const;
 
+       Viewport* viewport();
+
+       const Viewport* viewport() const;
+
        /**
         * Returns the view time scale in seconds per pixel.
         */
@@ -88,6 +91,8 @@ public:
 
        void zoom_fit();
 
+       void zoom_one_to_one();
+
        /**
         * Sets the scale and offset.
         * @param scale The new view scale in seconds per pixel.
@@ -95,9 +100,14 @@ public:
         */
        void set_scale_offset(double scale, double offset);
 
-       std::vector< boost::shared_ptr<Trace> > get_traces() const;
+       std::vector< std::shared_ptr<Trace> > get_traces() const;
+
+       std::list<std::weak_ptr<SelectableItem> > selected_items() const;
+
+       std::set< std::shared_ptr<pv::data::SignalData> >
+               get_visible_data() const;
 
-       std::list<boost::weak_ptr<SelectableItem> > selected_items() const;
+       std::pair<double, double> get_time_extents() const;
 
        /**
         * Returns true if cursors are displayed. false otherwise.
@@ -130,7 +140,7 @@ public:
 
        void update_viewport();
 
-signals:
+Q_SIGNALS:
        void hover_point_changed();
 
        void signals_moved();
@@ -141,12 +151,18 @@ signals:
 
 private:
        void get_scroll_layout(double &length, double &offset) const;
-       
+
+       /**
+        * Simultaneously sets the zoom and offset.
+        * @param scale The scale to set the view to in seconds per pixel. This
+        * value is clamped between MinScale and MaxScale.
+        * @param offset The offset of the left edge of the view in seconds.
+        */
+       void set_zoom(double scale, int offset);
+
        void update_scroll();
 
-       static bool compare_trace_v_offsets(
-               const boost::shared_ptr<pv::view::Trace> &a,
-               const boost::shared_ptr<pv::view::Trace> &b);
+       void update_layout();
 
 private:
        bool eventFilter(QObject *object, QEvent *event);
@@ -155,7 +171,7 @@ private:
 
        void resizeEvent(QResizeEvent *e);
 
-private slots:
+private Q_SLOTS:
 
        void h_scroll_value_changed(int value);
        void v_scroll_value_changed(int value);
@@ -167,15 +183,18 @@ private slots:
 
        void on_signals_moved();
 
+       void on_geometry_updated();
+
+       void on_hover_point_changed();
+
 private:
        SigSession &_session;
 
        Viewport *_viewport;
        Ruler *_ruler;
+       CursorHeader *_cursorheader;
        Header *_header;
 
-       uint64_t _data_length;
-
        /// The view time scale in seconds per pixel.
        double _scale;