From dd96260d50c620b92e81b347e89dc77edd24717c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 26 Aug 2010 11:52:11 +0000 Subject: [PATCH] Cleaned up OutlineView::FindParent(), only do the visibility check if required. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38366 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/ColumnListView.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/kits/interface/ColumnListView.cpp b/src/kits/interface/ColumnListView.cpp index 6acaa32926..071fcc984f 100644 --- a/src/kits/interface/ColumnListView.cpp +++ b/src/kits/interface/ColumnListView.cpp @@ -4053,7 +4053,7 @@ OutlineView::RemoveRow(BRow* row) } } } - if (parentRow) { + if (parentRow != NULL) { if (parentRow->fIsExpanded) fItemsHeight -= subTreeHeight + 1; } else { @@ -4688,24 +4688,25 @@ OutlineView::SelectRange(BRow* start, BRow* end) bool -OutlineView::FindParent(BRow* row, BRow** outParent, bool* out_parentIsVisible) +OutlineView::FindParent(BRow* row, BRow** outParent, bool* outParentIsVisible) { bool result = false; - if (row && outParent) { + if (row != NULL && outParent != NULL) { *outParent = row->fParent; - // Walk up the parent chain to determine if this row is visible - bool isVisible = true; - for (BRow* currentRow = row->fParent; currentRow; currentRow = currentRow->fParent) { - if (!currentRow->fIsExpanded) { - isVisible = false; - break; + if (outParentIsVisible != NULL) { + // Walk up the parent chain to determine if this row is visible + *outParentIsVisible = true; + for (BRow* currentRow = row->fParent; currentRow != NULL; + currentRow = currentRow->fParent) { + if (!currentRow->fIsExpanded) { + *outParentIsVisible = false; + break; + } } } - if (out_parentIsVisible) - *out_parentIsVisible = isVisible; - result = (NULL != *outParent); + result = *outParent != NULL; } return result;