Author Topic: Patch: function arguments added to autocomplete tooltip  (Read 125434 times)

Offline p2rkw

  • Almost regular
  • **
  • Posts: 142
Re: Patch: function arguments added to autocomplete tooltip
« Reply #15 on: November 28, 2012, 09:29:35 pm »
I tried doxyblocks, but it seems that it only doubles functionality of doxywizard. My question was about display documentation in codeblocks.
to see doc, i.e. description of function parameters I have to minimize c::b and switch to browser, open documentation, search for function, remember parameters meaning and switch back to c::b. My intention was to display documentation in floating window above autocompletion. Something similar to http://netbeans.org/images_www/v7/1/screenshots/editor.png , for example:


And I agree that doxygen is the best tool to generate documentation, and IMO codeblocks should use its to generate docs.
Codeblocks already have (mostly unused) html viewer, maybe it can be used to display documentation? It is possible to make popup floating window with this viewer inside? It can be nice replacement for scintilla's call tip.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Patch: function arguments added to autocomplete tooltip
« Reply #16 on: November 28, 2012, 11:00:57 pm »
I think you could just use a wxPopupWindow. The info windows are popup windows.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Patch: function arguments added to autocomplete tooltip
« Reply #17 on: November 28, 2012, 11:02:53 pm »
I'd be rather careful with the popup window usage... we have very messy fights between the cc and the debugger popups.
Probably you'll have to see what is used to implement the current popup and probably add something to it.
Like a text control at the top/bottom with the comment.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Patch: function arguments added to autocomplete tooltip
« Reply #18 on: November 29, 2012, 12:29:36 am »
An alternative idea to a popup would be to have a "CC Documentation" tab in the logs at the bottom.  CC could update it whenever it felt necessary: docs on the symbol under the caret, docs on the current function, and, of course, docs on the current selection during auto-completion.  This idea should not interfere with other popups, but it also may not be as intuitive.

About documentation, I tried to detect when user changes selection in autocomplete but currently I can't do that.
Have you tried the work around of listening for key presses WXK_UP and WXK_DOWN, then requesting the current selection?

Offline p2rkw

  • Almost regular
  • **
  • Posts: 142
Re: Patch: function arguments added to autocomplete tooltip
« Reply #19 on: November 29, 2012, 01:09:53 am »
Alpha: yes I did. I added something like this:
Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(CodeCompletion::OnKeyDown));
to Codecompletion's ctor, but my event handler wasn't called.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Patch: function arguments added to autocomplete tooltip
« Reply #20 on: November 29, 2012, 02:28:57 am »
An alternative idea to a popup would be to have a "CC Documentation" tab in the logs at the bottom.  CC could update it whenever it felt necessary: docs on the symbol under the caret, docs on the current function, and, of course, docs on the current selection during auto-completion.  This idea should not interfere with other popups, but it also may not be as intuitive.
I like this idea.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Patch: function arguments added to autocomplete tooltip
« Reply #21 on: November 29, 2012, 02:36:07 am »
Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(CodeCompletion::OnKeyDown));
Key events are not generated inside a plugin, so it is necessary to Connect() to the editor with something like:
Code
cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
if (ed)
    ed->GetControl()->Connect(wxEVT_KEY_DOWN, (wxObjectEventFunction)&CodeCompletion::OnKeyDown, NULL, this);

...

void CodeCompletion::OnKeyDown(wxKeyEvent& event)
{
}

Also, take a look at:
Code
void CodeCompletion::EditorEventHook(cbEditor* editor, wxScintillaEvent& event)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Patch: function arguments added to autocomplete tooltip
« Reply #22 on: November 29, 2012, 06:24:37 am »
I think you could just use a wxPopupWindow.
Note that this is not available on the Mac. Maybe a HTML/RTF like control is indeed better.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Patch: function arguments added to autocomplete tooltip
« Reply #23 on: November 29, 2012, 01:46:10 pm »
We use mini frame or some such on Mac using an ifdef. The scintilla popup does the same thing.

Re html window... I would prefer the way it is done in netbeans. To have a html control means another persistent window on screen taking up space?? An alternative to two popups is to hack the tip window to add extra widgets to it.
« Last Edit: November 29, 2012, 02:48:01 pm by dmoore »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Patch: function arguments added to autocomplete tooltip
« Reply #24 on: November 29, 2012, 02:30:14 pm »
An alternative to two popups is to hack the tip window to add extra widgets to it.
wxTipWindow is unhackable... you'll have to use wxPopupWindow or wxPopupTransinientWindow.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Patch: function arguments added to autocomplete tooltip
« Reply #25 on: November 29, 2012, 02:50:45 pm »
Sorry meant auto complete window not tip window. And why wouldn't it be hackable? Just put a sizer and extra widgets in it. But we don't have to use scintillas implementation of auto complete at all.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Patch: function arguments added to autocomplete tooltip
« Reply #26 on: November 29, 2012, 02:55:21 pm »
To have a html control means another persistent window on screen taking up space??
Clearly, it should be one window only. I didn't mean to add another.
BTW: My experience with wxMiniFrame is (however) rather bad, as it steals focus.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Patch: function arguments added to autocomplete tooltip
« Reply #27 on: November 29, 2012, 03:47:01 pm »
Correction... wxSctintilla uses either wxPopupWindow or wxFrame to display the autocomplete list control (see line 917 of PlatWX.cpp). There is an #ifdef about COCOA in the wxPopupWindow derived version, so are you sure this isn't supported on Mac in newer versions of wxWidgets?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Patch: function arguments added to autocomplete tooltip
« Reply #28 on: November 29, 2012, 04:06:46 pm »
wxCocoa is available only in wx2.9+, for wx2.8 there is only wxCarbon.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Patch: function arguments added to autocomplete tooltip
« Reply #29 on: November 29, 2012, 04:30:27 pm »
Regardless, the point stands that there is a working implementation in wxScintilla using either PopupWindow or Frame that can be adapted.