X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fdecodetrace.h;h=9704f69a0d4b73e44ac94b7b1a151220ca67ad95;hb=8dbbc7f0b9ea59d0f0d62225772f8a56eee125f5;hp=08558c98091af6668dca55c992df1784ee51c595;hpb=83c23cc9fa0d4501d9e6b8759251fa6337f5d491;p=pulseview.git diff --git a/pv/view/decodetrace.h b/pv/view/decodetrace.h index 08558c9..9704f69 100644 --- a/pv/view/decodetrace.h +++ b/pv/view/decodetrace.h @@ -25,14 +25,14 @@ #include #include +#include #include -#include - #include +#include -struct srd_probe; +struct srd_channel; struct srd_decoder; class QComboBox; @@ -62,11 +62,11 @@ class DecodeTrace : public Trace Q_OBJECT private: - struct ProbeSelector + struct ChannelSelector { - const QComboBox *_combo; - const boost::shared_ptr _decoder; - const srd_probe *_probe; + const QComboBox *combo_; + const std::shared_ptr decoder_; + const srd_channel *pdch_; }; private: @@ -74,6 +74,7 @@ private: static const QColor ErrorBgColour; static const QColor NoDecodeColour; + static const int ArrowSize; static const double EndCapWidth; static const int DrawPadding; @@ -82,14 +83,18 @@ private: public: DecodeTrace(pv::SigSession &session, - boost::shared_ptr decoder_stack, + std::shared_ptr decoder_stack, int index); bool enabled() const; - const boost::shared_ptr& decoder() const; + const std::shared_ptr& decoder() const; - void set_view(pv::view::View *view); + /** + * Computes the vertical extents of the contents of this row item. + * @return A pair containing the minimum and maximum y-values. + */ + std::pair v_extents() const; /** * Paints the background layer of the trace with a QPainter @@ -107,6 +112,14 @@ public: **/ void paint_mid(QPainter &p, int left, int right); + /** + * Paints the foreground layer of the trace with a QPainter + * @param p the QPainter to paint into. + * @param left the x-coordinate of the left edge of the signal + * @param right the x-coordinate of the right edge of the signal + **/ + void paint_fore(QPainter &p, int left, int right); + void populate_popup_form(QWidget *parent, QFormLayout *form); QMenu* create_context_menu(QWidget *parent); @@ -115,8 +128,7 @@ public: private: void draw_annotation(const pv::data::decode::Annotation &a, QPainter &p, - QColor text_colour, int text_height, int left, int right, - double samples_per_pixel, double pixels_offset, int y, + QColor text_colour, int text_height, int left, int right, int y, size_t base_colour) const; void draw_instant(const pv::data::decode::Annotation &a, QPainter &p, @@ -131,27 +143,47 @@ private: int left, int right); void draw_unresolved_period(QPainter &p, int h, int left, - int right, double samples_per_pixel, double pixels_offset); + int right) const; + + std::pair get_pixels_offset_samples_per_pixel() const; + + /** + * Determines the start and end sample for a given pixel range. + * @param x_start the X coordinate of the start sample in the view + * @param x_end the X coordinate of the end sample in the view + * @return Returns a pair containing the start sample and the end + * sample that correspond to the start and end coordinates. + */ + std::pair get_sample_range(int x_start, int x_end) const; + + int get_row_at_point(const QPoint &point); + + const QString get_annotation_at_point(const QPoint &point); + + void hide_hover_annotation(); void create_decoder_form(int index, - boost::shared_ptr &dec, + std::shared_ptr &dec, QWidget *parent, QFormLayout *form); - QComboBox* create_probe_selector(QWidget *parent, - const boost::shared_ptr &dec, - const srd_probe *const probe); + QComboBox* create_channel_selector(QWidget *parent, + const std::shared_ptr &dec, + const srd_channel *const pdch); + + void commit_decoder_channels( + std::shared_ptr &dec); - void commit_decoder_probes( - boost::shared_ptr &dec); + void commit_channels(); - void commit_probes(); +public: + void hover_point_changed(); -private slots: +private Q_SLOTS: void on_new_decode_data(); void on_delete(); - void on_probe_selected(int); + void on_channel_selected(int); void on_stack_decoder(srd_decoder *decoder); @@ -160,18 +192,21 @@ private slots: void on_show_hide_decoder(int index); private: - pv::SigSession &_session; - boost::shared_ptr _decoder_stack; + pv::SigSession &session_; + std::shared_ptr decoder_stack_; + + uint64_t decode_start_, decode_end_; - uint64_t _decode_start, _decode_end; + std::list< std::shared_ptr > + bindings_; - std::list< boost::shared_ptr > - _bindings; + std::list channel_selectors_; + std::vector decoder_forms_; - std::list _probe_selectors; - std::vector _decoder_forms; + std::vector visible_rows_; + int text_height_, row_height_; - QSignalMapper _delete_mapper, _show_hide_mapper; + QSignalMapper delete_mapper_, show_hide_mapper_; }; } // namespace view