} \
MACRO_END
+ #define KEYBIND_IS_SPECIAL(func) (substring(func, 0 ,1) == "*")
+ #define KEYBIND_SPECIAL_DEF(key) KEYBIND_DEF(strcat("*", key), "")
+
KEYBIND_DEF("" , _("Moving"));
KEYBIND_DEF("+forward" , _("forward"));
KEYBIND_DEF("+back" , _("backpedal"));
KEYBIND_DEF("" , "");
KEYBIND_DEF("" , _("Client"));
KEYBIND_DEF("+show_info" , _("server info"));
+ // display the hardcoded shortcut to open the console as it works for all
+ // non-English keyboard layouts, unlike default keys (` and ~)
KEYBIND_DEF("toggleconsole" , _("enter console"));
+ // TODO make it translatable together with all key names
+ KEYBIND_SPECIAL_DEF("SHIFT+ESC");
KEYBIND_DEF("disconnect" , _("disconnect"));
KEYBIND_DEF("menu_showquitdialog" , _("quit"));
KEYBIND_DEF("" , "");
void KeyBinder_Bind_Change(entity btn, entity me)
{
string func = KeyBinds_Functions[me.selectedItem];
- if(func == "")
+ if(func == "" || KEYBIND_IS_SPECIAL(func))
return;
me.keyGrabButton.forcePressed = 1;
}
string func = KeyBinds_Functions[me.selectedItem];
- if(func == "")
+ if(func == "" || KEYBIND_IS_SPECIAL(func))
return;
n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
return;
string func = KeyBinds_Functions[me.selectedItem];
- if(func == "")
+ if(func == "" || KEYBIND_IS_SPECIAL(func))
return;
string descr = KeyBinds_Descriptions[me.selectedItem];
return;
string func = KeyBinds_Functions[me.selectedItem];
- if(func == "")
+ if(func == "" || KEYBIND_IS_SPECIAL(func))
return;
string descr = KeyBinds_Descriptions[me.selectedItem];
float n, j, k;
string func = KeyBinds_Functions[me.selectedItem];
- if(func == "")
+ if(func == "" || KEYBIND_IS_SPECIAL(func))
return;
n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
{
// handling of "unselectable" items
i = floor(0.5 + bound(0, i, me.nItems - 1));
+ if (KEYBIND_IS_SPECIAL(KeyBinds_Functions[i]))
+ {
+ SUPER(XonoticKeyBinder).setSelected(me, i - 1);
+ return;
+ }
if(me.pressed == 0 || me.pressed == 1) // keyboard or scrolling - skip unselectable items
{
if(i > me.previouslySelected)
s = draw_TextShortenToWidth(descr, me.columnFunctionSize, 0, me.realFontSize);
draw_Text(me.realUpperMargin * eY + extraMargin * eX, s, me.realFontSize, theColor, theAlpha, 0);
- if(func != "")
+
+ if (func == "")
+ return;
+
+ s = "";
+ if (KEYBIND_IS_SPECIAL(func))
+ s = substring(func, 1, -1);
+ else
{
n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
- s = "";
for(j = 0; j < n; ++j)
{
k = stof(argv(j));
s = strcat(s, keynumtostring(k));
}
}
- s = draw_TextShortenToWidth(s, me.columnKeysSize, 0, me.realFontSize);
- draw_CenterText(me.realUpperMargin * eY + (me.columnKeysOrigin + 0.5 * me.columnKeysSize) * eX, s, me.realFontSize, theColor, theAlpha, 0);
}
+ s = draw_TextShortenToWidth(s, me.columnKeysSize, 0, me.realFontSize);
+ draw_CenterText(me.realUpperMargin * eY + (me.columnKeysOrigin + 0.5 * me.columnKeysSize) * eX, s, me.realFontSize, theColor, theAlpha, 0);
}