I've stumbled across the way in which TheIde handles it's key mapping, and thought I'd try the same method in my application. It doesn't seem to documented anywhere though.
I think I've figured out how it all works (very clever, as usual ) but I'm having trouble making it work the way it does in TheIde source.
I've added the following code to my header and source file:
#define KEYGROUPNAME "Example Keys"
#define KEYNAMESPACE ExampleKeys
#define KEYFILE <Keys/KeysExample.key>
#include <CtrlLib/key_header.h> // replaced with key_source in source file
and my .key file looks like this:
KEY(KEY1, "Key assignment 1", K_CTRL_1)
In TheIde keys are then accessed with code such as:
IdeKeys::CUTLINE().key
but in my example case the code
ExampleKeys::KEY1().key
doesn't compile (KEY1 is not a member of ExampleKeys) unless I change it to:
ExampleKeys::COMBINE(AK_, KEY1)().key
which is obviously not very pretty. I cannot find any any obvious difference between the two implementations, so what is the problem? A missing preprocessor directive? I've attached an example app to illustrate.
I also think this stuff needs documenting (unless I'm being thick and just can't find it), since it's a nice feature that would be useful in many apps. I'll do this myself if you like and perhaps flesh out my example as well.
In TheIde keys are then accessed with code such as:
IdeKeys::CUTLINE().key
but in my example case the code
No, it is IdeKeys::AK_CUTLINE().
reference/AK is quite a good demonstration of AK stuff...
Quote:
ExampleKeys::COMBINE(AK_, KEY1)().key
Fortunately, there is need for COMBINE here....
Quote:
I also think this stuff needs documenting (unless I'm being thick and just can't find it), since it's a nice feature that would be useful in many apps. I'll do this myself if you like and perhaps flesh out my example as well.
Example is there, however, documentation would be nice. Especially if you would manage to do it in Topic++ so that I can directly put it into the uppsrc.