Slight tweak to filtered node expansion logic.
When a filter is active, only expand parent nodes if either a) there is only one matching parent, or 2) the match actually hit a function contained in it. This allows the case where the intent of the filter is to find a particular set of files or subdirectories to be handled more efficiently.
This commit is contained in:
@@ -51,7 +51,8 @@ public:
|
|||||||
fComponentName(componentName),
|
fComponentName(componentName),
|
||||||
fSourceFile(sourceFile),
|
fSourceFile(sourceFile),
|
||||||
fFunction(function),
|
fFunction(function),
|
||||||
fFilterMatch()
|
fFilterMatch(),
|
||||||
|
fHasMatchingChild(false)
|
||||||
{
|
{
|
||||||
if (fSourceFile != NULL)
|
if (fSourceFile != NULL)
|
||||||
fSourceFile->AcquireReference();
|
fSourceFile->AcquireReference();
|
||||||
@@ -148,6 +149,16 @@ public:
|
|||||||
fFilterMatch = match;
|
fFilterMatch = match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HasMatchingChild() const
|
||||||
|
{
|
||||||
|
return fHasMatchingChild;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetHasMatchingChild()
|
||||||
|
{
|
||||||
|
fHasMatchingChild = true;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class ImageFunctionsView::FunctionsTableModel;
|
friend class ImageFunctionsView::FunctionsTableModel;
|
||||||
|
|
||||||
@@ -173,6 +184,7 @@ private:
|
|||||||
FunctionInstance* fFunction;
|
FunctionInstance* fFunction;
|
||||||
ChildPathComponentList fChildPathComponents;
|
ChildPathComponentList fChildPathComponents;
|
||||||
RegExp::MatchResult fFilterMatch;
|
RegExp::MatchResult fFilterMatch;
|
||||||
|
bool fHasMatchingChild;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -398,6 +410,16 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HasMatchingChildAt(void* parent, int32 index) const
|
||||||
|
{
|
||||||
|
SourcePathComponentNode* node
|
||||||
|
= (SourcePathComponentNode*)ChildAt(parent, index);
|
||||||
|
if (node != NULL)
|
||||||
|
return node->HasMatchingChild();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool GetFunctionPath(FunctionInstance* function, TreeTablePath& _path)
|
bool GetFunctionPath(FunctionInstance* function, TreeTablePath& _path)
|
||||||
{
|
{
|
||||||
if (function == NULL)
|
if (function == NULL)
|
||||||
@@ -543,7 +565,12 @@ private:
|
|||||||
nodeReference.Detach();
|
nodeReference.Detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (functionMatch.HasMatched())
|
||||||
|
currentNode->SetHasMatchingChild();
|
||||||
|
|
||||||
parentNode = currentNode;
|
parentNode = currentNode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return _AddFunctionNode(currentNode, function, file,
|
return _AddFunctionNode(currentNode, function, file,
|
||||||
@@ -806,9 +833,15 @@ ImageFunctionsView::_ExpandFilteredNodes()
|
|||||||
|
|
||||||
for (int32 i = 0; i < fFunctionsTableModel->CountChildren(
|
for (int32 i = 0; i < fFunctionsTableModel->CountChildren(
|
||||||
fFunctionsTableModel); i++) {
|
fFunctionsTableModel); i++) {
|
||||||
TreeTablePath path;
|
// only expand nodes if the match actually hit a function,
|
||||||
path.AddComponent(i);
|
// and not just the containing path.
|
||||||
fFunctionsTable->SetNodeExpanded(path, true, true);
|
if (fFunctionsTableModel->CountChildren(fFunctionsTableModel) == 1
|
||||||
|
|| fFunctionsTableModel->HasMatchingChildAt(fFunctionsTableModel,
|
||||||
|
i)) {
|
||||||
|
TreeTablePath path;
|
||||||
|
path.AddComponent(i);
|
||||||
|
fFunctionsTable->SetNodeExpanded(path, true, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fFunctionsTable->ResizeAllColumnsToPreferred();
|
fFunctionsTable->ResizeAllColumnsToPreferred();
|
||||||
|
|||||||
Reference in New Issue
Block a user