]> sigrok.org Git - pulseview.git/blobdiff - pv/views/trace/signal.hpp
Fix #1292/1294 by snapping to any edge when not hovering over a signal
[pulseview.git] / pv / views / trace / signal.hpp
index 2cc49a77d1962499c8bece819c5a0824485bf543..1b9f254330a79fd150f6f73165f5cb910a76b5be 100644 (file)
@@ -27,6 +27,8 @@
 
 #include <cstdint>
 
+#include <pv/data/logicsegment.hpp>
+
 #include "trace.hpp"
 #include "viewitemowner.hpp"
 
@@ -68,6 +70,15 @@ public:
 
        virtual shared_ptr<pv::data::SignalData> data() const = 0;
 
+       /**
+        * Determines the closest level change (i.e. edge) to a given sample, which
+        * is useful for e.g. the "snap to edge" functionality.
+        *
+        * @param sample_pos Sample to use
+        * @return The changes left and right of the given position
+        */
+       virtual vector<data::LogicSegment::EdgePair> get_nearest_level_changes(uint64_t sample_pos) = 0;
+
        /**
         * Returns true if the trace is visible and enabled.
         */
@@ -75,10 +86,6 @@ public:
 
        shared_ptr<data::SignalBase> base() const;
 
-       void set_current_segment(const int segment);
-
-       int get_current_segment() const;
-
        virtual void save_settings(QSettings &settings) const;
 
        virtual void restore_settings(QSettings &settings);
@@ -87,7 +94,7 @@ public:
 
        virtual void populate_popup_form(QWidget *parent, QFormLayout *form);
 
-       QMenu* create_context_menu(QWidget *parent);
+       QMenu* create_header_context_menu(QWidget *parent);
 
        void delete_pressed();
 
@@ -102,9 +109,6 @@ protected:
        pv::Session &session_;
 
        QComboBox *name_widget_;
-
-       /// The ID of the currently displayed segment
-       int current_segment_;
 };
 
 } // namespace trace