X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fviews%2Ftrace%2Fview.hpp;h=9529e7a3fee25a3c057a76c5c1c76a5ebc0c4d08;hp=bfa7ed3eaa5b4ed16e909aa75cb22587760aee76;hb=451dc5f33fbc4f559881acdf338c476a976fcbf2;hpb=1573bf16ba50d1c023ad3a9ce596f0ab6eaeacff diff --git a/pv/views/trace/view.hpp b/pv/views/trace/view.hpp index bfa7ed3e..9529e7a3 100644 --- a/pv/views/trace/view.hpp +++ b/pv/views/trace/view.hpp @@ -37,6 +37,7 @@ #include "cursorpair.hpp" #include "flag.hpp" +#include "trace.hpp" #include "tracetreeitemowner.hpp" using std::list; @@ -116,9 +117,9 @@ public: #ifdef ENABLE_DECODE virtual void clear_decode_signals(); - virtual void add_decode_signal(shared_ptr signalbase); + virtual void add_decode_signal(shared_ptr signal); - virtual void remove_decode_signal(shared_ptr signalbase); + virtual void remove_decode_signal(shared_ptr signal); #endif /** @@ -150,11 +151,21 @@ public: double scale() const; /** - * Returns the time offset of the left edge of the view in - * seconds. + * Returns the internal view version of the time offset of the left edge + * of the view in seconds. */ const pv::util::Timestamp& offset() const; + /** + * Returns the ruler version of the time offset of the left edge + * of the view in seconds. + */ + const pv::util::Timestamp& ruler_offset() const; + + void set_zero_position(pv::util::Timestamp& position); + + void reset_zero_position(); + /** * Returns the vertical scroll offset. */ @@ -180,6 +191,11 @@ public: */ const pv::util::Timestamp& tick_period() const; + /** + * Returns number of minor division ticks per time marking. + */ + unsigned int minor_tick_count() const; + /** * Returns the unit of time currently used. */ @@ -190,6 +206,20 @@ public: */ unsigned int depth() const; + /** + * Returns the currently displayed segment, starting at 0. + */ + uint32_t current_segment() const; + + /** + * Returns whether the currently shown segment can be influenced + * (selected) or not. + */ + bool segment_is_selectable() const; + + Trace::SegmentDisplayMode segment_display_mode() const; + void set_segment_display_mode(Trace::SegmentDisplayMode mode); + void zoom(double steps); void zoom(double steps, int offset); @@ -269,7 +299,7 @@ public: void restack_all_trace_tree_items(); Q_SIGNALS: - void hover_point_changed(); + void hover_point_changed(const QPoint &hp); void selection_changed(); @@ -295,8 +325,15 @@ Q_SIGNALS: /// Emitted when the time_unit changed. void time_unit_changed(); + /// Emitted when the currently selected segment changed + void segment_changed(int segment_id); + + /// Emitted when the multi-segment display mode changed + /// @param mode is a value of Trace::SegmentDisplayMode + void segment_display_mode_changed(int mode, bool segment_selectable); + public Q_SLOTS: - void trigger_event(util::Timestamp location); + void trigger_event(int segment_id, util::Timestamp location); private: void get_scroll_layout(double &length, pv::util::Timestamp &offset) const; @@ -323,9 +360,9 @@ private: void set_scroll_default(); - bool header_was_shrunk() const; + void determine_if_header_was_shrunk(); - void expand_header_to_fit(); + void resize_header_to_fit(); void update_layout(); @@ -347,6 +384,8 @@ private: void resizeEvent(QResizeEvent *event); + void update_hover_point(); + public: void row_item_appearance_changed(bool label, bool content); void time_item_appearance_changed(bool label, bool content); @@ -355,6 +394,7 @@ public: private Q_SLOTS: + void on_signal_name_changed(); void on_splitter_moved(); void h_scroll_value_changed(int value); @@ -363,17 +403,21 @@ private Q_SLOTS: void signals_changed(); void capture_state_updated(int state); + void on_new_segment(int new_segment_id); + void on_segment_completed(int new_segment_id); + void on_segment_changed(int segment); + + void on_settingViewTriggerIsZeroTime_changed(const QVariant new_value); + virtual void perform_delayed_view_update(); void process_sticky_events(); - void on_hover_point_changed(); - /** - * Sets the 'offset_' member and emits the 'offset_changed' + * Sets the 'offset_' and ruler_offset_ members and emits the 'offset_changed' * signal if needed. */ - void set_offset(const pv::util::Timestamp& offset); + void set_offset(const pv::util::Timestamp& offset, bool force_update = false); /** * Sets the 'scale_' member and emits the 'scale_changed' @@ -405,6 +449,11 @@ private Q_SLOTS: */ void set_time_unit(pv::util::TimeUnit time_unit); + /** + * Sets the current segment with the first segment starting at 0. + */ + void set_current_segment(uint32_t segment_id); + private: CustomScrollArea *scrollarea_; Viewport *viewport_; @@ -418,14 +467,22 @@ private: vector< shared_ptr > decode_traces_; #endif + Trace::SegmentDisplayMode segment_display_mode_; + + /// Signals whether the user can change the currently shown segment. + bool segment_selectable_; + /// The view time scale in seconds per pixel. double scale_; - /// The view time offset in seconds. + /// The internal view version of the time offset in seconds. pv::util::Timestamp offset_; + /// The ruler version of the time offset in seconds. + pv::util::Timestamp ruler_offset_; bool updating_scroll_; bool settings_restored_; + bool header_was_shrunk_; bool sticky_scrolling_; bool coloured_bg_; @@ -433,6 +490,7 @@ private: pv::util::Timestamp tick_period_; pv::util::SIPrefix tick_prefix_; + unsigned int minor_tick_count_; unsigned int tick_precision_; util::TimeUnit time_unit_; @@ -454,6 +512,16 @@ private: // A nonzero value indicates the v offset to restore. See View::resizeEvent() int saved_v_offset_; + + // These are used to determine whether the view was altered after acq started + double scale_at_acq_start_; + pv::util::Timestamp offset_at_acq_start_; + + // Used to suppress performing a "zoom to fit" when the session stops. This + // is needed when the view's settings are restored before acquisition ends. + // In that case we want to keep the restored settings, not have a "zoom to fit" + // mess them up. + bool suppress_zoom_to_fit_after_acq_; }; } // namespace trace