Пример #1
0
/**
 * @brief Called when we press a key when the node got the focus
 * @return True, if we use the event
 */
static qboolean UI_KeyBindingNodeKeyPressed (uiNode_t *node, unsigned int key, unsigned short unicode)
{
	const char *command;
	const char *binding;

	UI_RemoveFocus();

	/** @todo what about macro expansion? */
	if (!Q_strstart(node->text, "*binding:"))
		return qfalse;

	command = node->text + 9;

	/** @todo ensure that the binding for the key command is not executed */

	binding = Key_GetBinding(command, EXTRADATA(node).keySpace);
	if (binding[0] != '\0') {
		/* if it's the same command, do not change anything, otherwise
		 * show the reason why nothing was changed */
		if (!Q_streq(binding, command)) {
			const char *keyStr = Key_KeynumToString(key);
			UI_DisplayNotice(va(_("Key %s already bound"), keyStr), 2000, NULL);
		}
		return qfalse;
	}

	/* fire change event */
	if (node->onChange)
		UI_ExecuteEventActions(node, node->onChange);

	Key_SetBinding(key, command, EXTRADATA(node).keySpace);

	return qtrue;
}
Пример #2
0
static void CL_RImagesCvarChange (const char* cvarName, const char* oldValue, const char* newValue, void* data)
{
	UI_DisplayNotice(_("This change might require a restart."), 2000, nullptr);
}
Пример #3
0
static void CL_RContextCvarChange (const char* cvarName, const char* oldValue, const char* newValue, void* data)
{
	UI_DisplayNotice(_("This change requires a restart!"), 2000, nullptr);
}