Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
swap between a header file and a implementation file problem
(1/1)
ollydbg:
I find a problem, If I open the Codeblocks.cbp, and open the file:
sdk\cbeditor.cpp
Then, you will see NO cbEditor entry in the CC's symbol browser. (The options is: Current files symbols)
But once you do a swap to open the header file, which is
include\cbeditor.h
Then, you will see the cbEditor class information in the CC's symbol browser.
This means: the current way of doing header/implementation files can be improved.
At least, when we open cbeditor.cpp, the symbol tree should show the cbEditor.
right?
hakim:
Yup, that's the regression I reported here a bit earlier. It would be really nice if someone fixed it. BTW, it's just symbol browser bug - everything works just fine in code completion toolbar.
ollydbg:
The code snippet about this problem is show below.
In the classbrowser.cpp
--- Code: ---void ClassBrowser::UpdateView(bool checkHeaderSwap)
{
m_pActiveProject = 0;
TRACE(_T("ClassBrowser::UpdateView(), the old m_ActiveFilename = %s"),m_ActiveFilename.wx_str());
wxString oldActiveFilename = m_ActiveFilename;
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();
}
TRACE(_T("ClassBrowser::UpdateView(), the new m_ActiveFilename = %s"),m_ActiveFilename.wx_str());
if (checkHeaderSwap && oldActiveFilename.IsSameAs(m_ActiveFilename))
{
TRACE(_T("ClassBrowser::UpdateView() match the old filename, return!"));
return;
}
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();
}
--- End code ---
You will see, the function BuildTree() will build the tree control, basically depend on the variable: m_ActiveFilename
So, what does m_ActiveFilename means.
For example, you have these files in your project.
--- Code: ---a:\abc\def\hij.cpp
a:\abc\def\hij.h
--- End code ---
Then, open either the header file or the cpp file, you will get the
--- Code: ---m_ActiveFilename = "a:\abc\def\hij."
--- End code ---
So, a file search with prefix of "a:\abc\def\hij." will show all the tokens in both of the two files.
But this does not work if the header file and implementation file does NOT in the same directory. (As they don't share the same prefix string")
How can we solve this problem???
Loaden:
I solved this problem, I will create a patch based on CC branch. :D
ollydbg:
--- Quote from: Loaden on August 03, 2010, 04:34:56 pm ---I solved this problem, I will create a patch based on CC branch. :D
--- End quote ---
Nice work!!!
Navigation
[0] Message Index
Go to full version