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
This commit is contained in:
@@ -4053,7 +4053,7 @@ OutlineView::RemoveRow(BRow* row)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (parentRow) {
|
if (parentRow != NULL) {
|
||||||
if (parentRow->fIsExpanded)
|
if (parentRow->fIsExpanded)
|
||||||
fItemsHeight -= subTreeHeight + 1;
|
fItemsHeight -= subTreeHeight + 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -4688,24 +4688,25 @@ OutlineView::SelectRange(BRow* start, BRow* end)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
OutlineView::FindParent(BRow* row, BRow** outParent, bool* out_parentIsVisible)
|
OutlineView::FindParent(BRow* row, BRow** outParent, bool* outParentIsVisible)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if (row && outParent) {
|
if (row != NULL && outParent != NULL) {
|
||||||
*outParent = row->fParent;
|
*outParent = row->fParent;
|
||||||
|
|
||||||
// Walk up the parent chain to determine if this row is visible
|
if (outParentIsVisible != NULL) {
|
||||||
bool isVisible = true;
|
// Walk up the parent chain to determine if this row is visible
|
||||||
for (BRow* currentRow = row->fParent; currentRow; currentRow = currentRow->fParent) {
|
*outParentIsVisible = true;
|
||||||
if (!currentRow->fIsExpanded) {
|
for (BRow* currentRow = row->fParent; currentRow != NULL;
|
||||||
isVisible = false;
|
currentRow = currentRow->fParent) {
|
||||||
break;
|
if (!currentRow->fIsExpanded) {
|
||||||
|
*outParentIsVisible = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out_parentIsVisible)
|
result = *outParent != NULL;
|
||||||
*out_parentIsVisible = isVisible;
|
|
||||||
result = (NULL != *outParent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user