X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fdecodetrace.h;h=9704f69a0d4b73e44ac94b7b1a151220ca67ad95;hb=8dbbc7f0b9ea59d0f0d62225772f8a56eee125f5;hp=420961ad1c9f4d83a1d873f3740aac9cb6ce1d63;hpb=ef40ad83ac7e2cb12b4ecfede4564ba3ef416905;p=pulseview.git diff --git a/pv/view/decodetrace.h b/pv/view/decodetrace.h index 420961a..9704f69 100644 --- a/pv/view/decodetrace.h +++ b/pv/view/decodetrace.h @@ -30,6 +30,7 @@ #include #include +#include struct srd_channel; struct srd_decoder; @@ -63,9 +64,9 @@ class DecodeTrace : public Trace private: struct ChannelSelector { - const QComboBox *_combo; - const std::shared_ptr _decoder; - const srd_channel *_pdch; + const QComboBox *combo_; + const std::shared_ptr decoder_; + const srd_channel *pdch_; }; private: @@ -89,7 +90,11 @@ public: 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 @@ -123,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, @@ -139,7 +143,24 @@ 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, std::shared_ptr &dec, @@ -154,6 +175,9 @@ private: void commit_channels(); +public: + void hover_point_changed(); + private Q_SLOTS: void on_new_decode_data(); @@ -168,21 +192,21 @@ private Q_SLOTS: void on_show_hide_decoder(int index); private: - pv::SigSession &_session; - std::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; + bindings_; - std::list _channel_selectors; - std::vector _decoder_forms; + std::list channel_selectors_; + std::vector decoder_forms_; - std::vector _cur_row_headings; - int _text_height, _row_height; + std::vector visible_rows_; + int text_height_, row_height_; - QSignalMapper _delete_mapper, _show_hide_mapper; + QSignalMapper delete_mapper_, show_hide_mapper_; }; } // namespace view