Correct the menu code to sortof work with the new IMTs.

The menu code at least compiles now. It should work for the default IMT
tables (ie, if imt_0 is there).
This commit is contained in:
Bill Currie 2013-01-16 20:31:46 +09:00
parent ace8d9ebc5
commit 2e8d9e7636
3 changed files with 12 additions and 12 deletions

View file

@ -153,7 +153,7 @@ get_keyname =
local int keynum;
local string keyname;
keynum = Key_LookupBinding(IMT_0, bindnum, binding);
keynum = Key_LookupBinding("imt_0", bindnum, binding);
if(keynum == -1) {
keyname = "";
} else {
@ -236,15 +236,15 @@ CB_MAIN_control_binding (Binding *binding, int key)
local int retval = 0, bindcnt = 0;
if(set_key_flag) {
bindcnt = Key_CountBinding(IMT_0, binding.command);
bindcnt = Key_CountBinding("imt_0", binding.command);
/* we are not binding keys for more than one command
by the menu (maybe extended later) */
if(bindcnt < 2) {
Key_SetBinding (IMT_0, key, binding.command);
Key_SetBinding ("imt_0", key, binding.command);
} else {
// else, remove a binding and assign a new one
Key_SetBinding (IMT_0, Key_LookupBinding(IMT_0, 1, binding.command), "");
Key_SetBinding (IMT_0, key, binding.command);
Key_SetBinding ("imt_0", Key_LookupBinding("imt_0", 1, binding.command), "");
Key_SetBinding ("imt_0", key, binding.command);
}
set_key_flag = 0;
@ -254,7 +254,7 @@ CB_MAIN_control_binding (Binding *binding, int key)
set_key_flag = 1;
retval = 1;
} else if(key == QFK_BACKSPACE || key == QFK_DELETE) {
Key_SetBinding (IMT_0, Key_LookupBinding(IMT_0, 1, binding.command), "");
Key_SetBinding ("imt_0", Key_LookupBinding("imt_0", 1, binding.command), "");
retval = 1;
}

View file

@ -2,9 +2,9 @@
#define __ruamoko_key_h
#include "QF/keys.h"
@extern string Key_SetBinding (int target, int keynum, string binding);
@extern int Key_LookupBinding (int target, int bindnum, string binding);
@extern int Key_CountBinding (int target, string binding);
@extern string Key_SetBinding (string imt, int keynum, string binding);
@extern int Key_LookupBinding (string imt, int bindnum, string binding);
@extern int Key_CountBinding (string imt, string binding);
@extern string Key_KeynumToString (int keynum);
#endif//__ruamoko_key_h

View file

@ -1,6 +1,6 @@
#include "key.h"
string (int target, int keynum, string binding) Key_SetBinding = #0;
int (int target, int bindnum, string binding) Key_LookupBinding = #0;
int (int target, string binding) Key_CountBinding = #0;
string (string imt, int keynum, string binding) Key_SetBinding = #0;
int (string imt, int bindnum, string binding) Key_LookupBinding = #0;
int (string imt, string binding) Key_CountBinding = #0;
string (int keynum) Key_KeynumToString = #0;