X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fview%2Frowitemowner.cpp;h=a8bdadfa21079a7da1bb44e3a6d01711bc62f558;hb=448a72cf7f0225eace2335ec05b979c4e9a6b882;hp=8633525eb4cd9fb2976ea4f3a97a36df7f7163e8;hpb=6b71530299d18b4cdbf83ad88a17eb206758237a;p=pulseview.git diff --git a/pv/view/rowitemowner.cpp b/pv/view/rowitemowner.cpp index 8633525e..a8bdadfa 100644 --- a/pv/view/rowitemowner.cpp +++ b/pv/view/rowitemowner.cpp @@ -23,6 +23,10 @@ #include "rowitem.h" #include "rowitemowner.h" +using std::max; +using std::make_pair; +using std::min; +using std::pair; using std::shared_ptr; using std::vector; @@ -53,6 +57,8 @@ void RowItemOwner::add_child_item(std::shared_ptr item) assert(!item->owner()); item->set_owner(this); _items.push_back(item); + + extents_changed(true, true); } void RowItemOwner::remove_child_item(std::shared_ptr item) @@ -62,6 +68,8 @@ void RowItemOwner::remove_child_item(std::shared_ptr item) auto iter = std::find(_items.begin(), _items.end(), item); assert(iter != _items.end()); _items.erase(iter); + + extents_changed(true, true); } RowItemOwner::iterator RowItemOwner::begin() @@ -84,5 +92,28 @@ RowItemOwner::const_iterator RowItemOwner::end() const return const_iterator(this); } +pair RowItemOwner::v_extents() const +{ + pair extents(0, 0); + for (const shared_ptr r : child_items()) { + assert(r); + if (!r->enabled()) + continue; + + const int child_offset = r->layout_v_offset(); + const pair child_extents = r->v_extents(); + extents.first = min(child_extents.first + child_offset, + extents.first); + extents.second = max(child_extents.second + child_offset, + extents.second); + } + + return extents; +} + +void RowItemOwner::restack_items() +{ +} + } // view } // pv