Index: apps/keyboard.h =================================================================== --- apps/keyboard.h (revision 21649) +++ apps/keyboard.h (working copy) @@ -21,6 +21,52 @@ #ifndef _KEYBOARD_H #define _KEYBOARD_H +#include "config.h" + +#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ + (CONFIG_KEYPAD == IRIVER_H300_PAD) +#define KBD_CURSOR_KEYS /* certain key combos move the cursor even if not + in line edit mode */ +#define KBD_MODES /* I-Rivers can use picker, line edit and cursor keys */ +#define KBD_MORSE_INPUT /* I-Rivers have a Morse input mode */ + +#elif CONFIG_KEYPAD == ONDIO_PAD /* restricted Ondio keypad */ +#define KBD_MODES /* Ondio uses 2 modes, picker and line edit */ + +#elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) \ + || (CONFIG_KEYPAD == IPOD_4G_PAD) +#define KBD_MODES /* iPod uses 2 modes, picker and line edit */ +#define KBD_MORSE_INPUT + +#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD +#define KBD_MODES /* iFP7xx uses 2 modes, picker and line edit */ + +#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) || (CONFIG_KEYPAD == IAUDIO_M3_PAD) +#define KBD_MODES /* iAudios use 2 modes, picker and line edit */ + +#elif CONFIG_KEYPAD == IRIVER_H10_PAD +#define KBD_MODES /* iriver H10 uses 2 modes, picker and line edit */ +#define KBD_MORSE_INPUT + +#elif CONFIG_KEYPAD == GIGABEAT_PAD +#define KBD_CURSOR_KEYS +#define KBD_MODES +#define KBD_MORSE_INPUT + +#elif CONFIG_KEYPAD == SANSA_E200_PAD \ + || CONFIG_KEYPAD == SANSA_FUZE_PAD +#define KBD_CURSOR_KEYS +#define KBD_MODES + +#elif CONFIG_KEYPAD == SANSA_C200_PAD +#define KBD_CURSOR_KEYS +#define KBD_MODES + +#elif CONFIG_KEYPAD == MROBE100_PAD +#define KBD_MORSE_INPUT +#endif + + int kbd_input(char* buffer, int buflen); #ifdef HAVE_LCD_BITMAP Index: apps/recorder/keyboard.c =================================================================== --- apps/recorder/keyboard.c (revision 21649) +++ apps/recorder/keyboard.c (working copy) @@ -38,6 +38,7 @@ #include "keyboard.h" #include "viewport.h" #include "file.h" +#include "keyboard.h" #ifndef O_BINARY #define O_BINARY 0 @@ -47,49 +48,6 @@ #define DEFAULT_MARGIN 6 #define KBD_BUF_SIZE 500 -#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ - (CONFIG_KEYPAD == IRIVER_H300_PAD) -#define KBD_CURSOR_KEYS /* certain key combos move the cursor even if not - in line edit mode */ -#define KBD_MODES /* I-Rivers can use picker, line edit and cursor keys */ -#define KBD_MORSE_INPUT /* I-Rivers have a Morse input mode */ - -#elif CONFIG_KEYPAD == ONDIO_PAD /* restricted Ondio keypad */ -#define KBD_MODES /* Ondio uses 2 modes, picker and line edit */ - -#elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) \ - || (CONFIG_KEYPAD == IPOD_4G_PAD) -#define KBD_MODES /* iPod uses 2 modes, picker and line edit */ -#define KBD_MORSE_INPUT - -#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD -#define KBD_MODES /* iFP7xx uses 2 modes, picker and line edit */ - -#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) || (CONFIG_KEYPAD == IAUDIO_M3_PAD) -#define KBD_MODES /* iAudios use 2 modes, picker and line edit */ - -#elif CONFIG_KEYPAD == IRIVER_H10_PAD -#define KBD_MODES /* iriver H10 uses 2 modes, picker and line edit */ -#define KBD_MORSE_INPUT - -#elif CONFIG_KEYPAD == GIGABEAT_PAD -#define KBD_CURSOR_KEYS -#define KBD_MODES -#define KBD_MORSE_INPUT - -#elif CONFIG_KEYPAD == SANSA_E200_PAD \ - || CONFIG_KEYPAD == SANSA_FUZE_PAD -#define KBD_CURSOR_KEYS -#define KBD_MODES - -#elif CONFIG_KEYPAD == SANSA_C200_PAD -#define KBD_CURSOR_KEYS -#define KBD_MODES - -#elif CONFIG_KEYPAD == MROBE100_PAD -#define KBD_MORSE_INPUT -#endif - struct keyboard_parameters { const unsigned char* default_kbd; @@ -132,8 +90,6 @@ 0x06,0x0f,0x16,0x1d,0x0a,0x08,0x03,0x09,0x11,0x0b,0x19,0x1b,0x1c, 0x2f,0x27,0x23,0x21,0x20,0x30,0x38,0x3c,0x3e,0x3f, 0x73,0x55,0x4c,0x61,0x5a,0x80 }; - -static bool morse_mode = false; #endif /* Loads a custom keyboard into memory @@ -526,7 +482,7 @@ #ifdef KBD_MORSE_INPUT pm->old_main_y = pm->main_y; - if (morse_mode) + if (global_settings.text_morse) pm->main_y = sc->getheight() - pm->font_h; #endif } @@ -558,7 +514,7 @@ screens[l].clear_display(); #ifdef KBD_MORSE_INPUT - if (morse_mode) + if (global_settings.text_morse) { FOR_NB_SCREENS(l) { @@ -759,7 +715,7 @@ sc = &screens[button_screen]; #if defined KBD_MORSE_INPUT && !defined KBD_MODES - if (morse_mode) + if (global_settings.text_morse) { /* Remap some buttons for morse mode. */ if (button == ACTION_KBD_LEFT) @@ -786,7 +742,7 @@ { int k; #ifdef KBD_MORSE_INPUT - if (morse_mode) + if (global_settings.text_morse) break; #endif if (++pm->page >= pm->pages) @@ -799,7 +755,8 @@ #ifdef KBD_MORSE_INPUT case ACTION_KBD_MORSE_INPUT: - morse_mode = !morse_mode; + global_settings.text_morse = !global_settings.text_morse; + settings_save(); FOR_NB_SCREENS(l) { @@ -808,7 +765,7 @@ pm->x = pm->y = pm->page = 0; - if (morse_mode) + if (global_settings.text_morse) { pm->old_main_y = pm->main_y; pm->main_y = sc->getheight() - pm->font_h; @@ -826,7 +783,7 @@ #ifdef KBD_MODES #ifdef KBD_MORSE_INPUT /* allow cursor change in non line edit morse mode */ - if (pm->line_edit || morse_mode) + if (pm->line_edit || global_settings.text_morse) #else /* right doubles as cursor_right in line_edit */ if (pm->line_edit) @@ -849,7 +806,7 @@ { int k; #ifdef KBD_MORSE_INPUT - if (morse_mode) + if (global_settings.text_morse) break; #endif if (++pm->x >= pm->max_chars) @@ -871,7 +828,7 @@ #ifdef KBD_MODES #ifdef KBD_MORSE_INPUT /* allow cursor change in non line edit morse mode */ - if (pm->line_edit || morse_mode) + if (pm->line_edit || global_settings.text_morse) #else /* left doubles as cursor_left in line_edit */ if (pm->line_edit) @@ -894,7 +851,7 @@ { int k; #ifdef KBD_MORSE_INPUT - if (morse_mode) + if (global_settings.text_morse) break; #endif if (--pm->x < 0) @@ -915,7 +872,7 @@ case ACTION_KBD_DOWN: #ifdef KBD_MORSE_INPUT #ifdef KBD_MODES - if (morse_mode) + if (global_settings.text_morse) { pm->line_edit = !pm->line_edit; if(pm->line_edit) @@ -923,7 +880,7 @@ } else #else - if (morse_mode) + if (global_settings.text_morse) break; #endif #endif /* KBD_MORSE_INPUT */ @@ -958,7 +915,7 @@ case ACTION_KBD_UP: #ifdef KBD_MORSE_INPUT #ifdef KBD_MODES - if (morse_mode) + if (global_settings.text_morse) { pm->line_edit = !pm->line_edit; if(pm->line_edit) @@ -966,7 +923,7 @@ } else #else - if (morse_mode) + if (global_settings.text_morse) break; #endif #endif /* KBD_MORSE_INPUT */ @@ -1005,7 +962,7 @@ #ifdef KBD_MORSE_INPUT case ACTION_KBD_MORSE_SELECT: - if (morse_mode && morse_reading) + if (global_settings.text_morse && morse_reading) { morse_code <<= 1; if ((current_tick - morse_tick) > HZ/5) @@ -1019,9 +976,9 @@ case ACTION_KBD_SELECT_REM: #ifdef KBD_MORSE_INPUT #ifdef KBD_MODES - if (morse_mode && !pm->line_edit) + if (global_settings.text_morse && !pm->line_edit) #else - if (morse_mode) + if (global_settings.text_morse) #endif { morse_tick = current_tick; Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (revision 21649) +++ apps/lang/english.lang (working copy) @@ -12559,3 +12559,14 @@ touchscreen: "Reset Calibration" + + id: LANG_TEXT_MORSE + desc: in Settings ->Text input settings + user: core + + *: "Use Morse Code Input" + + + *: "Use Morse Code Input" + + + *: "Use Morse Code Input" + + Index: apps/settings.h =================================================================== --- apps/settings.h (revision 21649) +++ apps/settings.h (working copy) @@ -27,6 +27,7 @@ #include "inttypes.h" #include "config.h" #include "button.h" +#include "keyboard.h" #if CONFIG_CODEC == SWCODEC #include "audio.h" #endif @@ -733,6 +734,11 @@ struct touchscreen_parameter ts_calibration_data; #endif +#ifdef KBD_MORSE_INPUT + /* text input method setings */ + bool text_morse; +#endif /* KBD_MORSE_INPUT */ + /* If values are just added to the end, no need to bump plugin API version. */ /* new stuff to be added at the end */ Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (revision 21649) +++ apps/settings_list.c (working copy) @@ -33,7 +33,6 @@ #include "settings_list.h" #include "sound.h" #include "dsp.h" -#include "debug.h" #include "mpeg.h" #include "audio.h" #include "power.h" @@ -1520,6 +1519,12 @@ tsc_is_changed, tsc_set_default), #endif OFFON_SETTING(0, prevent_skip, LANG_PREVENT_SKIPPING, false, "prevent track skip", NULL), + + /* text input */ +#ifdef KBD_MORSE_INPUT + OFFON_SETTING(F_TEMPVAR, text_morse, LANG_TEXT_MORSE, false, + "use morse code input", NULL), +#endif }; const int nb_settings = sizeof(settings)/sizeof(*settings);