Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
New code completion remarks/issues
ollydbg:
hi, all, here is another patch.
I have always compaint this bug, when the bottom tree was rebuild, the navigate position always go the the bottom of the tree. That means, the vertical scroll bar will always go the bottom of the window, so, the "private member tree items" always been shown, because they were under the "public member tree items".
see this post:
http://forums.codeblocks.org/index.php/topic,10693.0.html
In this patch, I just "remember" the first tree item, and force a navigation when the tree been built.
--- Code: ---Index: classbrowserbuilderthread.cpp
===================================================================
--- classbrowserbuilderthread.cpp (revision 5908)
+++ classbrowserbuilderthread.cpp (working copy)
@@ -780,22 +780,29 @@
#ifdef buildtree_measuring
wxStopWatch sw;
#endif
+
tree->Freeze();
+
+
#ifdef buildtree_measuring
Manager::Get()->GetLogManager()->DebugLog(F(_T("tree->Freeze() took : %d ms"),sw.Time()));
sw.Start();
#endif
+
tree->DeleteAllItems();
#ifdef buildtree_measuring
Manager::Get()->GetLogManager()->DebugLog(F(_T("tree->DeleteAllItems() took : %d ms"),sw.Time()));
sw.Start();
#endif
+
node = tree->AddRoot(_T("Members")); // not visible, so don't translate
+
#ifdef buildtree_measuring
Manager::Get()->GetLogManager()->DebugLog(F(_T("tree->AddRoot() took : %d ms"),sw.Time()));
#endif
}
+ wxTreeItemId firtItem;
if (data)
{
switch (data->m_SpecialFolder)
@@ -819,6 +826,8 @@
AddChildrenOf(tree, rootFuncs, data->m_pToken->GetSelf(), tkFunction);
AddChildrenOf(tree, rootVars, data->m_pToken->GetSelf(), tkVariable);
AddChildrenOf(tree, rootOthers, data->m_pToken->GetSelf(), ~(tkNamespace | tkClass | tkEnum | tkAnyFunction | tkVariable));
+ firtItem = rootCtorDtor;
+
}
else if (m_Options.sortType == bstScope && data->m_pToken->m_TokenKind & tkClass)
{
@@ -829,6 +838,9 @@
AddChildrenOf(tree, rootPublic, data->m_pToken->GetSelf(), ~(tkNamespace | tkClass | tkEnum), tsPublic);
AddChildrenOf(tree, rootProtected, data->m_pToken->GetSelf(), ~(tkNamespace | tkClass | tkEnum), tsProtected);
AddChildrenOf(tree, rootPrivate, data->m_pToken->GetSelf(), ~(tkNamespace | tkClass | tkEnum), tsPrivate);
+
+ firtItem = rootPublic;
+
}
else
{
@@ -866,7 +878,19 @@
if (bottom)
{
tree->ExpandAll();
+//// if(tree->GetRootItem())
+// tree->EnsureVisible(tree->GetRootItem());
+ //tree->EnsureVisible(node);
+ if(firtItem.IsOk())
+ {
+ tree->ScrollTo(firtItem);
+ tree->EnsureVisible(firtItem);
+ }
tree->Thaw();
+ //we should scrool to the first item!!
+// wxTreeItemIdValue cookie;
+// wxTreeItemId res = tree->GetFirstChild(start, cookie);
+
}
}
--- End code ---
ollydbg:
This is the third patch. I just add one major check,
--- Code: ---void NativeParser::OnEditorActivated(EditorBase* editor)
{
if (!m_pClassBrowser)
return;
cbEditor* ed = editor && editor->IsBuiltinEditor() ? static_cast<cbEditor*>(editor) : 0;
// cbEditor* ed = editor ? static_cast<cbEditor*>(editor) : 0;
// EditorManager* edMan = Manager::Get()->GetEditorManager();
// cbEditor* ed = edMan->GetBuiltinActiveEditor();
if (ed)
{
Parser* parser = FindParserFromEditor(ed);
if (parser && parser->ClassBrowserOptions().displayFilter == bdfFile)
{
// check header and implementation file swap, if yes, don't need to rebuild browser tree
m_pClassBrowser->UpdateView(true); ***************here
}
}
}
--- End code ---
I modify the UpdateView function prototype, void UpdateView(bool checkHeaderSwap = false);
Which means, if we do the editor change, that is eg: c:/abc.h to c:/abc.cpp, we don't need to rebuild the Browser tree.
also, a lot of c_str() function and wxWidgets version check macros have been removed, since using wx_str() is enough.
[attachment deleted by admin]
ollydbg:
I'm trying to document the parserthread.h. here is the patch to do this, some function prototypes were not described due to my little knowledge and English written ability. :(
I'd prefer some one can supplement this and help me. :D
[attachment deleted by admin]
MortenMacFly:
--- Quote from: ollydbg on November 10, 2009, 02:11:12 pm ---Hi, all, here, I announce this patch of the code completion plugin.
--- End quote ---
I am not sure about this one...
I am using CC in fact while debugging and this would not let me.
--- Quote from: ollydbg on November 10, 2009, 02:50:43 pm ---hi, all, here is another patch.
--- End quote ---
--- Quote from: ollydbg on November 10, 2009, 04:23:38 pm ---This is the third patch. I just add one major check,
--- End quote ---
--- Quote from: ollydbg on November 10, 2009, 04:32:24 pm ---I'm trying to document the parserthread.h.
--- End quote ---
Those three are looking good to me. I've applied them in my local copy for testing... (where appropriate).
ollydbg:
I'm so grad that several patches of visualfc and blueshake and mine has been tested and finally applied in the trunk. But it seems the documents are not so good, so, I will prepare another patch to fix some "bad or missing documents". :D
Currently, the latest trunk code has broken parsing the OpenCV prototype correctly. because in the OpenCV source code ,there are some statement like this:
--- Code: ---CVAPI(void) cvFunction(XXXXX);
--- End code ---
The new CC will regard the statement as two tokens, one is "CVAPI(void)", and the other is "cvFunction(XXXXX)", so, I'm not satisfied with this, maybe, I need to implement a macro replacement rule for the "CVAPI" macro. :wink:
By the way, I think this thread should be moved to CodeCompletion redesign sub-forum, because people here are all talking about the patches and the new CC features.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version