From: Joel Holdsworth Date: Sun, 16 Nov 2014 19:47:13 +0000 (+0000) Subject: RowItemOwner: Added depth() method X-Git-Tag: pulseview-0.3.0~449 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=3e769a374963f37f7d52b65ef6c56bcdf1ef11fe RowItemOwner: Added depth() method --- diff --git a/pv/view/rowitemowner.h b/pv/view/rowitemowner.h index c2d38134..0fda9aa2 100644 --- a/pv/view/rowitemowner.h +++ b/pv/view/rowitemowner.h @@ -65,6 +65,11 @@ public: virtual int owner_v_offset() const = 0; + /** + * Returns the number of nested parents that this row item owner has. + */ + virtual unsigned int depth() const = 0; + /** * Returns a list of row items owned by this object. */ diff --git a/pv/view/tracegroup.cpp b/pv/view/tracegroup.cpp index 05a72dda..3058cec5 100644 --- a/pv/view/tracegroup.cpp +++ b/pv/view/tracegroup.cpp @@ -155,6 +155,11 @@ int TraceGroup::owner_v_offset() const return _owner ? layout_v_offset() + _owner->owner_v_offset() : 0; } +unsigned int TraceGroup::depth() const +{ + return _owner ? _owner->depth() + 1 : 0; +} + void TraceGroup::on_ungroup() { const vector< shared_ptr > items( diff --git a/pv/view/tracegroup.h b/pv/view/tracegroup.h index 218f42b1..a950eac9 100644 --- a/pv/view/tracegroup.h +++ b/pv/view/tracegroup.h @@ -110,6 +110,11 @@ public: */ int owner_v_offset() const; + /** + * Returns the number of nested parents that this row item owner has. + */ + unsigned int depth() const; + public: void appearance_changed(bool label, bool content); diff --git a/pv/view/view.cpp b/pv/view/view.cpp index d8925c1a..ba095fb8 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -186,6 +186,11 @@ int View::owner_v_offset() const return -_v_offset; } +unsigned int View::depth() const +{ + return 0; +} + void View::zoom(double steps) { zoom(steps, _viewport->width() / 2); diff --git a/pv/view/view.h b/pv/view/view.h index 71a38f11..2f746297 100644 --- a/pv/view/view.h +++ b/pv/view/view.h @@ -99,6 +99,11 @@ public: double offset() const; int owner_v_offset() const; + /** + * Returns the number of nested parents that this row item owner has. + */ + unsigned int depth() const; + void zoom(double steps); void zoom(double steps, int offset);