I have find a bug, that will at least cause the CC to build browser tree twice when we just do a header/implementation file switch after you double click on a tree item. Also, rebuild a browser tree will cause a re-flash on the tree, and your lose the mouse position, this is really annoying!!!
Look at the code:
void ClassBrowser::UpdateView()
{
m_pActiveProject = 0;
m_ActiveFilename.Clear();
if (m_pParser && !Manager::IsAppShuttingDown())
{
m_pActiveProject = Manager::Get()->GetProjectManager()->GetActiveProject();
cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
if (ed)
{
//m_ActiveFilename = ed->GetFilename().BeforeLast(_T('.'));
// the above line is a bug (see https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1559&group_id=5358)
m_ActiveFilename = ed->GetFilename().AfterLast(wxFILE_SEP_PATH);
if (m_ActiveFilename.Find(_T('.')) != wxNOT_FOUND)
{
m_ActiveFilename = ed->GetFilename().BeforeLast(wxFILE_SEP_PATH) + wxFILE_SEP_PATH + m_ActiveFilename.BeforeLast(_T('.'));
m_ActiveFilename.Append(_T('.'));
}
else
m_ActiveFilename = ed->GetFilename();
}
BuildTree();
wxSplitterWindow* splitter = XRCCTRL(*this, "splitterWin", wxSplitterWindow);
if (m_pParser->ClassBrowserOptions().treeMembers)
{
splitter->SplitHorizontally(m_Tree, m_TreeBottom);
m_TreeBottom->Show(true);
}
else
{
splitter->Unsplit();
m_TreeBottom->Show(false);
}
}
else
m_Tree->DeleteAllItems();
}
You can see:
Every time, this function is called, the m_ActiveFilename firstly be cleared, then a new m_ActiveFilename value was generated, and the tree was rebuild.
But how do we generate the m_ActiveFilename ?
For example, your active editor was :
"C:\BBB\AAA.cpp", at this time, the m_ActiveFilename was
"C:\BBB\AAA.", If you double click on the browser tree item to swap the file, and the caret jump to
"C:\BBB\AAA.h",
the m_ActiveFilename is still "C:\BBB\AAA.".
At this time, we don't need to rebuild the tree again.
Any comments???