User forums > Using Code::Blocks

[Feature Request] keyboard shortcuts for user defined tools

(1/4) > >>

dierk:
Keyboard shortcuts for user defined tools is a must working on different compilers like AVR GCC for using the programs on microcontrollers etc.
After building the code it have to be transfered to the controller. For this step you have to start an additional program like AVR Dude. Working only with menus sucks.

Pecan:

--- Quote from: dierk on March 19, 2007, 02:04:52 pm ---Keyboard shortcuts for user defined tools is a must working on different compilers like AVR GCC for using the programs on microcontrollers etc.
After building the code it have to be transfered to the controller. For this step you have to start an additional program like AVR Dude. Working only with menus sucks.



--- End quote ---

Unfortunately, adding hotkeys to the Tools menu will not work since that menu is rebuilt at every startup and every tool change. It does not honor the menu accelerators.

However, a little know plugin will work. Called KeyMacs. Say your tool is sixth in the list on the Tools menu. A KeyMac of "!T{DOWN 6}{ENTER}"
with a command key of, say, "Alt-Ctrl-T" will execute that tool.

   //-- KeyMacs
    KeyMacros Plugin

      KeyMacs Thread

Commodore64:
Are you sure of this? With the KeyBinder plugin (Settings -> Editor -> Keyboard shorcuts) I was able to associate a shortcut to every layout defined by me (the ones in View -> Layouts). These menu items are dynamically generated, so I don't see why the same should apply to items in the tool menu.

jamieo:
I've just been playing with this earlier today and now I see this topic...

You can set keyboard shortcuts and they work nicely.  However, when you restart some of them will be lost.  Then, when you restart some more will be lost.  I can confirm that it should work as pasting the missing items back into the ini file (from the backup) before restarting will restore your menu items....   until you shut down. :(

Notice, I said you can paste them in from the backup... here in lies the problem:


* I create some shortcuts in the tools menu using Ctrl-Alt-1 to 5 for simplicity.


* Shutdown codeblocks and compare the cbKeyBinder10.ini.bak and cbKeyBinder10.ini files

   cbKeyBinder10.ini contains 1 and 4 while cbKeyBinder10.ini.bak contains 2, 3 and 5.... 

All shortcuts have been saved but 3 of them to the wrong file!   :shock:


* Restart Codeblocks, 1 and 4 have been retained.


* Shutdown and recompare, 1 and 4 are now in the backup.


I've done this with many shortcuts and you loose a few each time you shut down until after a few restarts they are all gone.  I think it's obvious the code that saves the shortcuts is incorrectly writing some of them to the backup file - why it should even have the backup open is a mystery...  Note, I've have also lost shortcuts that are not in the tools menu but it is not often so I have not confirmed what happens as above. 

With the steps above I think an experienced codeblocks developer should be able to fix this without much hassle.  If not, I will try to look into it myself (not now, it's 3.30am!) but an experienced codeblocks developer I am not.  :)

Jamie

Pecan:
As I stated earlier, shortcuts cannot be preserved when applied to the Tools menu.

The Tools menu is dynamically rebuilt in many magic ways that are unknown and unseen by the KeyBinder plugin.

KeyBinder scans and memorized the shortcuts every 15 seconds. If a plugin or core module has modified a menu item in the background, KeyBinder will see the change, backup up the current keybinding, then rewrite the new bindings .ini file.

When the Tools menu is modified in the background, it is always rebuilt without its shortcuts. KeyBinder will slowly record this fact.

When a menu item is created/changed/destroyed there may be a delay in the way that wxWidgets executes the change. Some menu items may be mirrored in the .ini while others arn't until wxWidgets gets around to updating the UI menus.

Thus, the backup file and the .ini can mirror different menu system transition states.

Until a means is provided for KeyBinder to recognized the change, KeyMacs can provide a solution.

KeyMacs shortcuts for the Tools items are applied from the KeyMacs menu, not the Tools menu. KeyMacs is not dependent on KeyBinder.

    //-- KeyMacs
    KeyMacros Plugin
    KeyMacs Thread

Navigation

[0] Message Index

[#] Next page

Go to full version