X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Ftracetreeitemowner.cpp;fp=pv%2Fview%2Ftracetreeitemowner.cpp;h=0000000000000000000000000000000000000000;hb=1573bf16ba50d1c023ad3a9ce596f0ab6eaeacff;hp=bff63c762135e2b402941a856118b7097cc77079;hpb=4c7a19d3d7049bcc9fb3185ce2bc91333a7ca9e1;p=pulseview.git diff --git a/pv/view/tracetreeitemowner.cpp b/pv/view/tracetreeitemowner.cpp deleted file mode 100644 index bff63c7..0000000 --- a/pv/view/tracetreeitemowner.cpp +++ /dev/null @@ -1,119 +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, see . - */ - -#include - -#include "tracetreeitem.hpp" -#include "trace.hpp" -#include "tracetreeitemowner.hpp" - -using std::find; -using std::make_pair; -using std::max; -using std::min; -using std::pair; -using std::shared_ptr; -using std::static_pointer_cast; -using std::vector; - -namespace pv { -namespace views { -namespace TraceView { - -const ViewItemOwner::item_list& TraceTreeItemOwner::child_items() const -{ - return items_; -} - -vector< shared_ptr > -TraceTreeItemOwner::trace_tree_child_items() const -{ - vector< shared_ptr > items; - for (auto &i : items_) { - assert(dynamic_pointer_cast(i)); - const shared_ptr t( - static_pointer_cast(i)); - items.push_back(t); - } - - return items; -} - -void TraceTreeItemOwner::clear_child_items() -{ - for (auto &t : trace_tree_child_items()) { - assert(t->owner() == this); - t->set_owner(nullptr); - } - items_.clear(); -} - -void TraceTreeItemOwner::add_child_item(shared_ptr item) -{ - assert(!item->owner()); - item->set_owner(this); - items_.push_back(item); - - extents_changed(true, true); -} - -void TraceTreeItemOwner::remove_child_item(shared_ptr item) -{ - assert(item->owner() == this); - item->set_owner(nullptr); - auto iter = find(items_.begin(), items_.end(), item); - assert(iter != items_.end()); - items_.erase(iter); - - extents_changed(true, true); -} - -pair TraceTreeItemOwner::v_extents() const -{ - bool has_children = false; - - pair extents(INT_MAX, INT_MIN); - for (const shared_ptr t : trace_tree_child_items()) { - assert(t); - if (!t->enabled()) - continue; - - has_children = true; - - const int child_offset = t->layout_v_offset(); - const pair child_extents = t->v_extents(); - extents.first = min(child_extents.first + child_offset, - extents.first); - extents.second = max(child_extents.second + child_offset, - extents.second); - } - - if (!has_children) - extents = make_pair(0, 0); - - return extents; -} - -void TraceTreeItemOwner::restack_items() -{ -} - -} // namespace TraceView -} // namespace views -} // namespace pv