]> sigrok.org Git - pulseview.git/commitdiff
RowItemOwner: Added list_row_item_owners
authorJoel Holdsworth <redacted>
Sat, 13 Jun 2015 09:19:14 +0000 (10:19 +0100)
committerUwe Hermann <redacted>
Tue, 30 Jun 2015 09:23:21 +0000 (11:23 +0200)
pv/view/rowitemowner.cpp
pv/view/rowitemowner.hpp
pv/view/view.cpp

index 8970f45a73727207fae763043efbb6df66467c21..ba2e1f4838ab44874b831b7ad06d9b79c12dd70c 100644 (file)
@@ -27,6 +27,7 @@ using std::max;
 using std::make_pair;
 using std::min;
 using std::pair;
 using std::make_pair;
 using std::min;
 using std::pair;
+using std::set;
 using std::shared_ptr;
 using std::vector;
 
 using std::shared_ptr;
 using std::vector;
 
@@ -92,6 +93,14 @@ RowItemOwner::const_iterator RowItemOwner::end() const
        return const_iterator(this);
 }
 
        return const_iterator(this);
 }
 
+set< RowItemOwner* > RowItemOwner::list_row_item_owners()
+{
+       set< RowItemOwner* > owners;
+       for (const auto &r : *this)
+               owners.insert(r->owner());
+       return owners;
+}
+
 pair<int, int> RowItemOwner::v_extents() const
 {
        pair<int, int> extents(INT_MAX, INT_MIN);
 pair<int, int> RowItemOwner::v_extents() const
 {
        pair<int, int> extents(INT_MAX, INT_MIN);
index f5c2abd7cd53867a510911fde780af4846333d4d..d72dddb2f2300848ed9ed8ee2a3b772193fe1e60 100644 (file)
@@ -118,6 +118,12 @@ public:
         */
        const_iterator end() const;
 
         */
        const_iterator end() const;
 
+       /**
+        * Makes a list of row item owners of all the row items that are
+        * decendants of this item.
+        */
+       std::set< RowItemOwner* > list_row_item_owners();
+
        /**
         * Computes the vertical extents of the contents of this row item owner.
         * @return A pair containing the minimum and maximum y-values.
        /**
         * Computes the vertical extents of the contents of this row item owner.
         * @return A pair containing the minimum and maximum y-values.
index 8b8059135bb5ca10a9e9fa17c89b0c29eff82112..f7f9834d6695dfc59784753a603e41e6ca0928d1 100644 (file)
@@ -401,12 +401,8 @@ void View::update_viewport()
 
 void View::restack_all_row_items()
 {
 
 void View::restack_all_row_items()
 {
-       // Make a set of owners
-       unordered_set< RowItemOwner* > owners;
-       for (const auto &r : *this)
-               owners.insert(r->owner());
-
-       // Make a list that is sorted from deepest first
+       // Make a list of owners that is sorted from deepest first
+       const auto owners = list_row_item_owners();
        vector< RowItemOwner* > sorted_owners(owners.begin(), owners.end());
        sort(sorted_owners.begin(), sorted_owners.end(),
                [](const RowItemOwner* a, const RowItemOwner *b) {
        vector< RowItemOwner* > sorted_owners(owners.begin(), owners.end());
        sort(sorted_owners.begin(), sorted_owners.end(),
                [](const RowItemOwner* a, const RowItemOwner *b) {