X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;ds=sidebyside;f=pv%2Fview%2Ftracetreeitemowner.cpp;h=b570c0386c3ef556e4e9cd41927749e212fcb5b6;hb=5ccfc97e20bbea19b9bc37905dd4cf63ee1f6303;hp=24174794456d01ffb2fd05cbf27601cdc1e16334;hpb=ac0708fb7e6b4010d90a569386810d3d2edc7eb9;p=pulseview.git
diff --git a/pv/view/tracetreeitemowner.cpp b/pv/view/tracetreeitemowner.cpp
index 2417479..b570c03 100644
--- a/pv/view/tracetreeitemowner.cpp
+++ b/pv/view/tracetreeitemowner.cpp
@@ -14,8 +14,7 @@
* 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
+ * along with this program; if not, see .
*/
#include
@@ -35,7 +34,8 @@ using std::static_pointer_cast;
using std::vector;
namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
const ViewItemOwner::item_list& TraceTreeItemOwner::child_items() const
{
@@ -87,13 +87,16 @@ void TraceTreeItemOwner::remove_child_item(std::shared_ptr item)
pair TraceTreeItemOwner::v_extents() const
{
- pair extents(INT_MAX, INT_MIN);
+ 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,
@@ -102,6 +105,9 @@ pair TraceTreeItemOwner::v_extents() const
extents.second);
}
+ if (!has_children)
+ extents = make_pair(0, 0);
+
return extents;
}
@@ -126,5 +132,6 @@ void TraceTreeItemOwner::restack_items()
{
}
-} // view
-} // pv
+} // namespace TraceView
+} // namespace views
+} // namespace pv