AnalogSignal: Use Q_OBJECT and implement vdiv selector in dialog
[pulseview.git] / pv / view / analogsignal.hpp
index dd2b31dc74f20e4d536accc5652c125af29d5947..07de4eb436541cbc281a22d3df85dbcf7e84fa4a 100644 (file)
@@ -36,12 +36,16 @@ namespace view {
 
 class AnalogSignal : public Signal
 {
+       Q_OBJECT
+
 private:
        static const QColor SignalColours[4];
        static const QColor GridMajorColor, GridMinorColor;
 
        static const float EnvelopeThreshold;
 
+       static const int MaximumVDivs;
+
 public:
        AnalogSignal(pv::Session &session,
                std::shared_ptr<sigrok::Channel> channel,
@@ -103,18 +107,26 @@ private:
                const double pixels_offset, const double samples_per_pixel);
 
        /**
-        * Computes the scale factor from the scale index.
+        * Computes the scale factor from the scale index and vdiv settings.
         */
-       float scale() const;
+       void update_scale();
+
+protected:
+       void populate_popup_form(QWidget *parent, QFormLayout *form);
+
+private Q_SLOTS:
+       void on_vdivs_changed(int vdivs);
 
 private:
        std::shared_ptr<pv::data::Analog> data_;
 
+       float scale_;
        int scale_index_;
        int scale_index_drag_offset_;
 
        int div_height_;
        int vdivs_;  // divs per positive/negative side
+       float resolution_; // e.g. 10 for 10 V/div
 };
 
 } // namespace view