24 Feb
2009
24 Feb
'09
7:51 p.m.
enum { KEYCMD_RELOAD, ... };
No, I thought of using constants: #define KEYCMD_RELOAD (0) #define KEYCMD_OPEN (1) ...
commands[] = { {"reload", KEYCMD_RELOAD}, ... };
There are no mapping tables in my approach. commands[] is the same as symbols[] (like it is called in src/keys.cc) and contains all actions as well as their default key bindings. commands[] = { { "reload", { fltk::CTRL, 'r' } }, { "open" , { fltk::CTRL, 'o' } }, ... };
isPressed(&bindings[KEYCMD_RELOAD])
The isPressed()-call should be as short as possible. I would prefer "isPressed(KEYCMD_RELOAD);". --Tim