44   {
"RETURN", WKC_RETURN},
 
   45   {
"BACKQUOTE", WKC_BACKQUOTE},
 
   60   {
"NUM_PLUS", WKC_NUM_PLUS},
 
   61   {
"NUM_MINUS", WKC_NUM_MINUS},
 
   72 static uint16 
ParseCode(
const char *start, 
const char *end)
 
   75   while (start < end && *start == 
' ') start++;
 
   76   while (end > start && *end == 
' ') end--;
 
   77   for (uint i = 0; i < 
lengthof(_keycode_to_name); i++) {
 
   78     if (strlen(_keycode_to_name[i].name) == (size_t)(end - start) && strncasecmp(start, _keycode_to_name[i].name, end - start) == 0) {
 
   79       return _keycode_to_name[i].
keycode;
 
   82   if (end - start == 1) {
 
   83     if (*start >= 
'a' && *start <= 
'z') 
return *start - (
'a'-
'A');
 
   85     if (*(
const uint8 *)start < 128) 
return *start;
 
  101     const char *cur = start;
 
  102     while (*cur != 
'+' && cur != end) cur++;
 
  104     if (code == 0) 
return 0;
 
  105     if (code & WKC_SPECIAL_KEYS) {
 
  107       if (code & ~WKC_SPECIAL_KEYS) 
return 0;
 
  111       if (keycode & ~WKC_SPECIAL_KEYS) 
return 0;
 
  114     if (cur == end) 
break;
 
  128   const char *start = value;
 
  129   while (*start != 
'\0') {
 
  130     const char *end = start;
 
  131     while (*end != 
'\0' && *end != 
',') end++;
 
  133     if (keycode != 0) hotkey->
AddKeycode(keycode);
 
  134     start = (*end == 
',') ? end + 1: end;
 
  156   if (keycode & WKC_SHIFT) {
 
  161   if (keycode & WKC_CTRL) {
 
  166   if (keycode & WKC_ALT) {
 
  171   if (keycode & WKC_META) {
 
  177   keycode = keycode & ~WKC_SPECIAL_KEYS;
 
  179   for (uint i = 0; i < 
lengthof(_keycode_to_name); i++) {
 
  180     if (_keycode_to_name[i].keycode == keycode) {
 
  185   assert(keycode < 128);
 
  203   static char buf[128];
 
  205   for (uint i = 0; i < hotkey->keycodes.
Length(); i++) {
 
  223   if (default_keycode != 0) this->
AddKeycode(default_keycode);
 
  236   const uint16 *keycode = default_keycodes;
 
  237   while (*keycode != 0) {
 
  250   this->keycodes.
Include(keycode);
 
  253 HotkeyList::HotkeyList(
const char *ini_group, 
Hotkey *items, GlobalHotkeyHandlerFunc global_hotkey_handler) :
 
  254   global_hotkey_handler(global_hotkey_handler), ini_group(ini_group), items(items)
 
  257   *_hotkey_lists->
Append() = 
this;
 
  260 HotkeyList::~HotkeyList()
 
  262   _hotkey_lists->
Erase(_hotkey_lists->
Find(
this));
 
  272   for (
Hotkey *hotkey = this->items; hotkey->name != NULL; ++hotkey) {
 
  275       hotkey->keycodes.Clear();
 
  288   for (
const Hotkey *hotkey = this->items; hotkey->name != NULL; ++hotkey) {
 
  302   for (
const Hotkey *list = this->items; list->name != NULL; ++list) {
 
  303     if (list->keycodes.Contains(keycode | 
WKC_GLOBAL_HOTKEY) || (!global_only && list->keycodes.Contains(keycode))) {
 
  311 static void SaveLoadHotkeys(
bool save)
 
  316   for (
HotkeyList **list = _hotkey_lists->
Begin(); list != _hotkey_lists->
End(); ++list) {
 
  332   SaveLoadHotkeys(
false);
 
  338   SaveLoadHotkeys(
true);
 
  341 void HandleGlobalHotkeys(
WChar key, uint16 keycode)
 
  343   for (
HotkeyList **list = _hotkey_lists->
Begin(); list != _hotkey_lists->
End(); ++list) {
 
  344     if ((*list)->global_hotkey_handler == NULL) 
continue;
 
  346     int hotkey = (*list)->CheckMatch(keycode, 
true);
 
  347     if (hotkey >= 0 && ((*list)->global_hotkey_handler(hotkey) == 
ES_HANDLED)) 
return;