Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
CC plugin interface redesign
dmoore:
--- Quote from: Alpha on October 30, 2013, 03:07:40 pm ---That is how I am intending it to work. Your plugin can also send cbEVT_SHOW_CALL_TIP, cbEVT_EDITOR_TOOLTIP and cbEVT_COMPLETE_CODE events for specialized situations (that the (hopefully more generic) CCManager does not handle).
--- End quote ---
Note sure how to do this. Should it be...
--- Code: --- CodeBlocksEvent evt(cbEVT_COMPLETE_CODE);
Manager::Get()->GetCCManager()->ProcessEvent(evt);
--- End code ---
Doesn't work because ProcessEvent member isn't exposed. And I suspect this won't work (and even if it does it's totally unintuitive):
--- Code: --- CodeBlocksEvent evt(cbEVT_COMPLETE_CODE);
Manager::Get()->GetPluginManager()->NotifyPlugins(evt);
--- End code ---
Also, how does one format the html for the doc string?
dmoore:
--- Quote from: dmoore on November 02, 2013, 03:10:45 pm ---
--- Code: --- CodeBlocksEvent evt(cbEVT_COMPLETE_CODE);
Manager::Get()->GetPluginManager()->NotifyPlugins(evt);
--- End code ---
--- End quote ---
So this works, but it is a little confusing for me to say "NotifyPlugins" when I actually mean "Notify CC Manager (to notify me)"
dmoore:
--- Quote from: Alpha on November 01, 2013, 02:31:12 am ---Currently poor API for this (change is planned). You must append the string "\n" + xyzNumber to the token's name.
id - unused by CCManager, passed back to the plugin so that the plugin can use it internally to know which token it represents
displayName - verbose text representation of token
name - minimal text representation of token (not currently used, but in place so that CCManager can change between verbose and minimal tooltip/autocomplete modes)
--- End quote ---
So it turns out that the old default STC behavior of appending a ? and a number e.g. "print?1" also works.
btw, is it expected that a plugin will need to register its own images:
--- Code: --- m_pImageList = new wxImageList(16, 16);
wxBitmap bmp;
bmp = cbLoadBitmap(prefix + _T("class_folder.png"), wxBITMAP_TYPE_PNG);
m_pImageList->Add(bmp); // Module
bmp = cbLoadBitmap(prefix + _T("class.png"), wxBITMAP_TYPE_PNG);
m_pImageList->Add(bmp); // Class
bmp = cbLoadBitmap(prefix + _T("class_public.png"), wxBITMAP_TYPE_PNG);
m_pImageList->Add(bmp); // Class Object
bmp = cbLoadBitmap(prefix + _T("typedef.png"), wxBITMAP_TYPE_PNG);
m_pImageList->Add(bmp); // Type
bmp = cbLoadBitmap(prefix + _T("var_public.png"), wxBITMAP_TYPE_PNG);
m_pImageList->Add(bmp); // Type Instance
bmp = cbLoadBitmap(prefix + _T("method_public.png"), wxBITMAP_TYPE_PNG);
m_pImageList->Add(bmp); // BuiltinFunctionType
bmp = cbLoadBitmap(prefix + _T("method_protected.png"), wxBITMAP_TYPE_PNG);
m_pImageList->Add(bmp); // BuiltinMethodType
bmp = cbLoadBitmap(prefix + _T("method_protected.png"), wxBITMAP_TYPE_PNG);
m_pImageList->Add(bmp); // Method
bmp = cbLoadBitmap(prefix + _T("method_private.png"), wxBITMAP_TYPE_PNG);
m_pImageList->Add(bmp); // Function
--- End code ---
in OnAttach and this in GetAutocompList:
--- Code: --- control->ClearRegisteredImages();
for (int i = 0; i < m_pImageList->GetImageCount(); i++)
control->RegisterImage(i+1,m_pImageList->GetBitmap(i));
m_state=STATE_NONE;
--- End code ---
Or is there some globally defined list of bitmaps that should be used? Or do you have some API planned to handle registering plugin defined images?
dmoore:
Ok, now calltips ...
1. what do I put in hlStart, hlEnd and argsPos?
--- Code: ---wxStringVec CodeCompletion::GetCallTips(int pos, int style, cbEditor* ed, int& hlStart, int& hlEnd, int& argsPos)
--- End code ---
For now I am leaving them untouched which means the active arg isn't highlighted
2. The active calltip is getting automatically hidden after less than second. Any idea why this might be happening?
dmoore:
Enough coding for today... screenshot attached. Still need to figure out:
* the issue with call tips hiding
* formatting the doc string
* add links to docs and handlers for them.
If you want to test the code is in svn here: http://developer.berlios.de/svn/?group_id=7745
PythonCodeComletion-cc contains the code that's compatible with your branch. I've hard-coded the links in the unix project file. I haven't tested on windows at all, so the windows project file may compile without tweaks, but no guarantee.
[attachment deleted by admin]
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version