X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;ds=inline;f=pv%2Fview%2Fview.hpp;h=2f5d7020f05011c70594589ca95c4d50bae2bb65;hb=efdec55aec1a137460fa362a381ed1904182bfed;hp=5f81d443c8f53e08353e91d13b9534b7a6805dd7;hpb=c677193dc6e691493081fe87476a04e1674093a5;p=pulseview.git
diff --git a/pv/view/view.hpp b/pv/view/view.hpp
index 5f81d44..2f5d702 100644
--- a/pv/view/view.hpp
+++ b/pv/view/view.hpp
@@ -14,12 +14,11 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see .
*/
-#ifndef PULSEVIEW_PV_VIEW_VIEW_HPP
-#define PULSEVIEW_PV_VIEW_VIEW_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEW_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEW_HPP
#include
@@ -34,11 +33,12 @@
#include
#include
+#include
#include
#include "cursorpair.hpp"
#include "flag.hpp"
-#include "rowitemowner.hpp"
+#include "tracetreeitemowner.hpp"
namespace sigrok {
class ChannelGroup;
@@ -48,21 +48,35 @@ namespace pv {
class Session;
-namespace view {
+namespace views {
+
+namespace TraceView {
class CursorHeader;
+class DecodeTrace;
class Header;
class Ruler;
+class Signal;
class Trace;
class Viewport;
+class TriggerMarker;
-class View : public QAbstractScrollArea, public RowItemOwner {
+class CustomAbstractScrollArea : public QAbstractScrollArea {
+ Q_OBJECT
+
+public:
+ CustomAbstractScrollArea(QWidget *parent = 0);
+ void setViewportMargins(int left, int top, int right, int bottom);
+ bool viewportEvent(QEvent *event);
+};
+
+class View : public ViewBase, public TraceTreeItemOwner {
Q_OBJECT
private:
enum StickyEvents {
- RowItemHExtentsChanged = 1,
- RowItemVExtentsChanged = 2
+ TraceTreeItemHExtentsChanged = 1,
+ TraceTreeItemVExtentsChanged = 2
};
private:
@@ -80,20 +94,41 @@ public:
Session& session();
const Session& session() const;
+ /**
+ * Returns the signals contained in this view.
+ */
+ std::unordered_set< std::shared_ptr > signals() const;
+
+ virtual void clear_signals();
+
+ virtual void add_signal(const std::shared_ptr signal);
+
+#ifdef ENABLE_DECODE
+ virtual void clear_decode_signals();
+
+ virtual void add_decode_signal(std::shared_ptr signalbase);
+
+ virtual void remove_decode_signal(std::shared_ptr signalbase);
+#endif
+
/**
* Returns the view of the owner.
*/
- virtual pv::view::View* view();
+ virtual View* view();
/**
* Returns the view of the owner.
*/
- virtual const pv::view::View* view() const;
+ virtual const View* view() const;
Viewport* viewport();
const Viewport* viewport() const;
+ virtual void save_settings(QSettings &settings) const;
+
+ virtual void restore_settings(QSettings &settings);
+
/**
* Gets a list of time markers.
*/
@@ -170,6 +205,12 @@ public:
*/
void enable_sticky_scrolling(bool state);
+ /**
+ * Enables or disables coloured trace backgrounds. If they're not
+ * coloured then they will use alternating colors.
+ */
+ void enable_coloured_bg(bool state);
+
/**
* Returns true if cursors are displayed. false otherwise.
*/
@@ -207,9 +248,7 @@ public:
const QPoint& hover_point() const;
- void update_viewport();
-
- void restack_all_row_items();
+ void restack_all_trace_tree_items();
Q_SIGNALS:
void hover_point_changed();
@@ -238,6 +277,9 @@ Q_SIGNALS:
/// Emitted when the time_unit changed.
void time_unit_changed();
+public Q_SLOTS:
+ void trigger_event(util::Timestamp location);
+
private:
void get_scroll_layout(double &length, pv::util::Timestamp &offset) const;
@@ -257,32 +299,21 @@ private:
void update_scroll();
- void update_layout();
+ void reset_scroll();
- /**
- * Satisifies RowItem functionality.
- * @param p the QPainter to paint into.
- * @param rect the rectangle of the header area.
- * @param hover true if the label is being hovered over by the mouse.
- */
- void paint_label(QPainter &p, const QRect &rect, bool hover);
+ void set_scroll_default();
- /**
- * Computes the outline rectangle of a label.
- * @param rect the rectangle of the header area.
- * @return Returns the rectangle of the signal label.
- */
- QRectF label_rect(const QRectF &rect);
+ void update_layout();
- RowItemOwner* find_prevalent_trace_group(
+ TraceTreeItemOwner* find_prevalent_trace_group(
const std::shared_ptr &group,
- const std::unordered_map,
+ const std::unordered_map,
std::shared_ptr > &signal_map);
static std::vector< std::shared_ptr >
extract_new_traces_for_channels(
const std::vector< std::shared_ptr > &channels,
- const std::unordered_map,
+ const std::unordered_map,
std::shared_ptr > &signal_map,
std::set< std::shared_ptr > &add_list);
@@ -290,9 +321,7 @@ private:
bool eventFilter(QObject *object, QEvent *event);
- bool viewportEvent(QEvent *e);
-
- void resizeEvent(QResizeEvent *e);
+ void resizeEvent(QResizeEvent *event);
public:
void row_item_appearance_changed(bool label, bool content);
@@ -352,12 +381,18 @@ private Q_SLOTS:
void set_time_unit(pv::util::TimeUnit time_unit);
private:
- Session &session_;
-
Viewport *viewport_;
Ruler *ruler_;
Header *header_;
+ std::unordered_set< std::shared_ptr > signals_;
+
+#ifdef ENABLE_DECODE
+ std::vector< std::shared_ptr > decode_traces_;
+#endif
+
+ CustomAbstractScrollArea scrollarea_;
+
/// The view time scale in seconds per pixel.
double scale_;
@@ -380,13 +415,19 @@ private:
std::list< std::shared_ptr > flags_;
char next_flag_text_;
+ std::vector< std::shared_ptr > trigger_markers_;
+
QPoint hover_point_;
unsigned int sticky_events_;
QTimer lazy_event_handler_;
+
+ // This is true when the defaults couldn't be set due to insufficient info
+ bool scroll_needs_defaults;
};
-} // namespace view
+} // namespace TraceView
+} // namespace views
} // namespace pv
-#endif // PULSEVIEW_PV_VIEW_VIEW_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEW_HPP