Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: hongxing on October 19, 2005, 11:37:25 am

Title: how to change shortcut key of code completion plugin?
Post by: hongxing on October 19, 2005, 11:37:25 am
how to change shortcut key of code completion plugin?
e.x. to change to F12 or other
thanks!
Title: Re: how to change shortcut key of code completion plugin?
Post by: Urxae on October 19, 2005, 11:55:51 am
This is currently not easily done.

I just checked, and the shortcut is hard-coded into the plugin :?. That means the only way to change it is to compile from source after editing the line that says
Code
m_EditMenu->Append(idMenuCodeComplete, _("Complete code\tCtrl-Space"));
in codeblocks/src/plugins/codecompletion/codecompletion.cpp (it's in CodeCompletion::BuildMenu) to use your new shortcut setting, in your case changing it to
Code
m_EditMenu->Append(idMenuCodeComplete, _("Complete code\tF12"));
should work.

It might have been easier if the codecompletion plugin loaded its menu from an resource file, then you'd just have to edit a .xrc file in ${CODEBLOCKS_DIR}/share/CodeBlocks/codecompletion.zip, which could be done without getting the source and compiling.

IIRC keyboard shortcut editing is planned to be added, but only after version 1.0 is done.

But until someone changes the codecompletion plugin to load the menu from a resource file (Devs: this is a hint ;)) or the keyboard shortcut settings are implemented post-1.0, the above is the only way to do it, I'm afraid.
Title: Re: how to change shortcut key of code completion plugin?
Post by: thomas on October 19, 2005, 12:15:14 pm
Was going to say the same, Urxae beat me by a few minutes. :)
But I acually tried if it works ;)

Edit: plugins/codecompletion/codecompletion.cpp line 137
Replace the Ctrl-Space part with whatever you think suits you (F12 is indeed a bad choice because that is already taken for collapse/uncollapse, and the event never reaches the menu bar).

Sidenote:
Strangely, that plugin seems to have dependencies with every target, is that deliberate or by accident? Seems unusual that you have to recompile the whole application if you change one line in a plugin.
Title: Re: how to change shortcut key of code completion plugin?
Post by: mandrav on October 19, 2005, 01:01:12 pm
Quote
Sidenote:
Strangely, that plugin seems to have dependencies with every target, is that deliberate or by accident? Seems unusual that you have to recompile the whole application if you change one line in a plugin.

No it doesn't. Something must be wrong with your setup... (I 'm developing this and I edit it a lot; trust me: I would have noticed ;) )
Title: Re: how to change shortcut key of code completion plugin?
Post by: thomas on October 19, 2005, 01:12:15 pm
Hmm... must be me then.
But since I finally worked out how to do pluggable precompilation with gcc yesterday (i.e. without changing sources), it is not that bad anyway. Have to think of a way to automate that yet...
Title: Re: how to change shortcut key of code completion plugin?
Post by: mandrav on October 19, 2005, 03:11:28 pm
Hmm... must be me then.
But since I finally worked out how to do pluggable precompilation with gcc yesterday (i.e. without changing sources), it is not that bad anyway. Have to think of a way to automate that yet...
(emphasis added)

I have. I 'll start a new thread on how to build C::B using precompiled headers :lol: 8)
(teaser: Process terminated with status 0 (3 minutes, 33 seconds) - full rebuild, including wxScintilla and wxDockit which do not use PCH)
Title: Re: how to change shortcut key of code completion plugin?
Post by: rickg22 on October 19, 2005, 05:30:36 pm
Yes, please! :D Please do!
Title: Re: how to change shortcut key of code completion plugin?
Post by: Ceniza on October 19, 2005, 05:31:49 pm
Hmmm, he already did :P
Title: Re: how to change shortcut key of code completion plugin?
Post by: mandrav on October 19, 2005, 06:18:50 pm
Yes, the promised thread is here (http://forums.codeblocks.org/index.php/topic,1109.0.html).