X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Frowitemowner.cpp;fp=pv%2Fview%2Frowitemowner.cpp;h=0000000000000000000000000000000000000000;hb=af503b104d890a357c736c678bb00296d889c090;hp=49e6e1a59afca5b796252f44c26e93b90450b2c1;hpb=dbf74f26f6bd9fd5277f090fea8e4f5506c19911;p=pulseview.git diff --git a/pv/view/rowitemowner.cpp b/pv/view/rowitemowner.cpp deleted file mode 100644 index 49e6e1a..0000000 --- a/pv/view/rowitemowner.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * This file is part of the PulseView project. - * - * Copyright (C) 2014 Joel Holdsworth - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * 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 - */ - -#include - -#include "rowitem.hpp" -#include "rowitemowner.hpp" -#include "trace.hpp" - -using std::dynamic_pointer_cast; -using std::max; -using std::make_pair; -using std::min; -using std::pair; -using std::set; -using std::shared_ptr; -using std::vector; - -namespace pv { -namespace view { - -vector< shared_ptr >& RowItemOwner::child_items() -{ - return items_; -} - -const vector< shared_ptr >& RowItemOwner::child_items() const -{ - return items_; -} - -void RowItemOwner::clear_child_items() -{ - for (auto &i : items_) { - assert(i->owner() == this); - i->set_owner(nullptr); - } - items_.clear(); -} - -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) -{ - assert(item->owner() == this); - item->set_owner(nullptr); - auto iter = std::find(items_.begin(), items_.end(), item); - assert(iter != items_.end()); - items_.erase(iter); - - extents_changed(true, true); -} - -RowItemOwner::iterator RowItemOwner::begin() -{ - return iterator(this, items_.begin()); -} - -RowItemOwner::iterator RowItemOwner::end() -{ - return iterator(this); -} - -RowItemOwner::const_iterator RowItemOwner::begin() const -{ - return const_iterator(this, items_.cbegin()); -} - -RowItemOwner::const_iterator RowItemOwner::end() const -{ - 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; -} - -template -set< shared_ptr > RowItemOwner::list_by_type() -{ - set< shared_ptr > items; - for (const auto &r : *this) { - shared_ptr p = dynamic_pointer_cast(r); - if (p) - items.insert(p); - } - - return items; -} - -template set< shared_ptr > RowItemOwner::list_by_type(); - -pair RowItemOwner::v_extents() const -{ - pair extents(INT_MAX, INT_MIN); - - 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