X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/26607f41ae9c6e8d805167e039ddf64eacee55a8..9c21efe30131c78c25763446e0754e2a0b54dc30:/contrib/utils/wxrcedit/editor.cpp diff --git a/contrib/utils/wxrcedit/editor.cpp b/contrib/utils/wxrcedit/editor.cpp index 9e313c7597..04b5cfde65 100644 --- a/contrib/utils/wxrcedit/editor.cpp +++ b/contrib/utils/wxrcedit/editor.cpp @@ -315,6 +315,19 @@ void EditorFrame::RefreshTree() + +static void RecursivelyExpand(wxTreeCtrl *t, wxTreeItemId item) +{ + t->Expand(item); + long cookie; + wxTreeItemId id = t->GetFirstChild(item, cookie); + while (id.IsOk()) + { + RecursivelyExpand(t, id); + id = t->GetNextChild(item, cookie); + } +} + bool EditorFrame::SelectNode(wxXmlNode *node, wxTreeItemId *root) { if (root == NULL) @@ -335,14 +348,16 @@ bool EditorFrame::SelectNode(wxXmlNode *node, wxTreeItemId *root) nd = (dt) ? dt->Node : NULL; if (nd == node) { + RecursivelyExpand(m_TreeCtrl, *root); m_TreeCtrl->SelectItem(item); m_TreeCtrl->EnsureVisible(item); - return TRUE; + return TRUE; } if (m_TreeCtrl->ItemHasChildren(item) && SelectNode(node, &item)) - return TRUE; + return TRUE; item = m_TreeCtrl->GetNextChild(*root, cookie); } + return FALSE; } @@ -391,18 +406,6 @@ void EditorFrame::NotifyChanged(int change_type) -static void RecursivelyExpand(wxTreeCtrl *t, wxTreeItemId item) -{ - t->Expand(item); - long cookie; - wxTreeItemId id = t->GetFirstChild(item, cookie); - while (id.IsOk()) - { - RecursivelyExpand(t, id); - id = t->GetNextChild(item, cookie); - } -} - void EditorFrame::OnTreeSel(wxTreeEvent& event) { XmlTreeData *dt = (XmlTreeData*)(m_TreeCtrl->GetItemData(event.GetItem()));