Author Topic: how to change shortcut key of code completion plugin?  (Read 7996 times)

hongxing

  • Guest
how to change shortcut key of code completion plugin?
« 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!

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: how to change shortcut key of code completion plugin?
« Reply #1 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.
« Last Edit: October 19, 2005, 11:58:01 am by Urxae »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: how to change shortcut key of code completion plugin?
« Reply #2 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: how to change shortcut key of code completion plugin?
« Reply #3 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 ;) )
Be patient!
This bug will be fixed soon...

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: how to change shortcut key of code completion plugin?
« Reply #4 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...
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: how to change shortcut key of code completion plugin?
« Reply #5 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)
Be patient!
This bug will be fixed soon...

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: how to change shortcut key of code completion plugin?
« Reply #6 on: October 19, 2005, 05:30:36 pm »
Yes, please! :D Please do!

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: how to change shortcut key of code completion plugin?
« Reply #7 on: October 19, 2005, 05:31:49 pm »
Hmmm, he already did :P

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: how to change shortcut key of code completion plugin?
« Reply #8 on: October 19, 2005, 06:18:50 pm »
Yes, the promised thread is here.
Be patient!
This bug will be fixed soon...