This adds SELECT as a shortcut ot the old button based input tool in the software keyboard
This commit is contained in:
d0k3 2020-11-11 00:07:09 +01:00
parent df4619b213
commit 608cf39e12
2 changed files with 7 additions and 6 deletions

View File

@ -58,10 +58,7 @@ static bool BuildKeyboard(TouchBox* swkbd, const char* keys, const u8* layout) {
} }
// next row // next row
if (layout[l++] != 0) { if (layout[l++] != 0) return false;
ShowPrompt(false, "Oh shit %lu %lu", k, l);
return false; // error!!!! THIS HAS TO GO!
}
p_y += SWKBD_STDKEY_HEIGHT + SWKDB_KEY_SPACING; p_y += SWKBD_STDKEY_HEIGHT + SWKDB_KEY_SPACING;
} }
@ -199,6 +196,7 @@ static char KeyboardWait(TouchBox* swkbd, bool uppercase) {
else if (pressed & BUTTON_R1) return KEY_CAPS; else if (pressed & BUTTON_R1) return KEY_CAPS;
else if (pressed & BUTTON_RIGHT) return KEY_RIGHT; else if (pressed & BUTTON_RIGHT) return KEY_RIGHT;
else if (pressed & BUTTON_LEFT) return KEY_LEFT; else if (pressed & BUTTON_LEFT) return KEY_LEFT;
else if (pressed & BUTTON_SELECT) return KEY_SWITCH;
else if (pressed & BUTTON_TOUCH) break; else if (pressed & BUTTON_TOUCH) break;
} }
@ -297,6 +295,9 @@ bool ShowKeyboard(char* inputstr, const u32 max_size, const char *format, ...) {
swkbd = swkbd_special; swkbd = swkbd_special;
} else if (key == KEY_NUMPAD) { } else if (key == KEY_NUMPAD) {
swkbd = swkbd_numpad; swkbd = swkbd_numpad;
} else if (key == KEY_SWITCH) {
ClearScreen(BOT_SCREEN, COLOR_STD_BG);
return ShowStringPrompt(inputstr, max_size, str);
} else if (key && (key < 0x80)) { } else if (key && (key < 0x80)) {
if ((cursor < (max_size-1)) && (inputstr_size < max_size)) { if ((cursor < (max_size-1)) && (inputstr_size < max_size)) {
// pad string (if cursor beyound string size) // pad string (if cursor beyound string size)

View File

@ -18,16 +18,16 @@ enum {
KEY_LEFT = 0x88, KEY_LEFT = 0x88,
KEY_RIGHT = 0x89, KEY_RIGHT = 0x89,
KEY_ESCAPE = 0x8A, KEY_ESCAPE = 0x8A,
KEY_SWITCH = 0x8B,
KEY_TXTBOX = 0xFF KEY_TXTBOX = 0xFF
}; };
// special key strings // special key strings
#define SWKBD_KEYSTR "", "DEL", "INS", "SUBMIT", "CAPS", "#$@", "123", "ABC", "\x1b", "\x1a", "ESC" #define SWKBD_KEYSTR "", "DEL", "INS", "SUBMIT", "CAPS", "#$@", "123", "ABC", "\x1b", "\x1a", "ESC", "SWITCH"
#define COLOR_SWKBD_NORMAL COLOR_GREY #define COLOR_SWKBD_NORMAL COLOR_GREY
#define COLOR_SWKBD_PRESSED COLOR_LIGHTGREY #define COLOR_SWKBD_PRESSED COLOR_LIGHTGREY
#define COLOR_SWKBD_BOX COLOR_DARKGREY #define COLOR_SWKBD_BOX COLOR_DARKGREY
#define COLOR_SWKBD_TEXTBOX COLOR_DARKGREY
#define COLOR_SWKBD_CHARS COLOR_BLACK #define COLOR_SWKBD_CHARS COLOR_BLACK
#define COLOR_SWKBD_ENTER COLOR_TINTEDBLUE #define COLOR_SWKBD_ENTER COLOR_TINTEDBLUE
#define COLOR_SWKBD_CAPS COLOR_TINTEDYELLOW #define COLOR_SWKBD_CAPS COLOR_TINTEDYELLOW