FS#10785: Add new context CONTEXT_MORSE_INPUT for keymaps which is used during morse input mode in virtual keyboard.

This will enable to use morse input on targets that doesn't have enough key for both the keyboard and morse input in one context.
Enable morse input on archosondio as an example.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24250 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Teruaki Kawashima 2010-01-16 13:54:10 +00:00
parent cf5178a5b1
commit b7f728d138
24 changed files with 55 additions and 4 deletions

View file

@ -75,6 +75,7 @@ enum {
CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */ CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */
CONTEXT_RECSCREEN, CONTEXT_RECSCREEN,
CONTEXT_KEYBOARD, CONTEXT_KEYBOARD,
CONTEXT_MORSE_INPUT,
CONTEXT_FM, CONTEXT_FM,
CONTEXT_USB_HID, CONTEXT_USB_HID,
CONTEXT_USB_HID_MODE_MULTIMEDIA, CONTEXT_USB_HID_MODE_MULTIMEDIA,

View file

@ -251,6 +251,7 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_PITCHSCREEN: case CONTEXT_PITCHSCREEN:
return button_context_pitchscreen; return button_context_pitchscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
} }
return button_context_standard; return button_context_standard;

View file

@ -250,6 +250,7 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_PITCHSCREEN: case CONTEXT_PITCHSCREEN:
return button_context_pitchscreen; return button_context_pitchscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
} }
return button_context_standard; return button_context_standard;

View file

@ -425,6 +425,7 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_RECSCREEN: case CONTEXT_RECSCREEN:
return button_context_recscreen; return button_context_recscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
#ifdef USB_ENABLE_HID #ifdef USB_ENABLE_HID
case CONTEXT_USB_HID: case CONTEXT_USB_HID:

View file

@ -325,6 +325,7 @@ const struct button_mapping* get_context_mapping(int context)
return button_context_recscreen; return button_context_recscreen;
#endif #endif
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
default: default:

View file

@ -691,6 +691,7 @@ static const struct button_mapping* get_context_mapping_remote( int context )
return remote_button_context_recscreen; return remote_button_context_recscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return ACTION_NONE; /* Any sensible mapping for this remote? */ return ACTION_NONE; /* Any sensible mapping for this remote? */
case CONTEXT_FM: case CONTEXT_FM:
@ -769,6 +770,7 @@ const struct button_mapping* get_context_mapping(int context)
return button_context_settings_right_is_inc; return button_context_settings_right_is_inc;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
case CONTEXT_FM: case CONTEXT_FM:

View file

@ -378,6 +378,7 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_PITCHSCREEN: case CONTEXT_PITCHSCREEN:
return button_context_pitchscreen; return button_context_pitchscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
} }
return button_context_standard; return button_context_standard;

View file

@ -506,6 +506,7 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_PITCHSCREEN: case CONTEXT_PITCHSCREEN:
return button_context_pitchscreen; return button_context_pitchscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
case CONTEXT_RECSCREEN: case CONTEXT_RECSCREEN:
return button_context_recscreen; return button_context_recscreen;

View file

@ -918,6 +918,7 @@ static const struct button_mapping* get_context_mapping_remote(int context)
case CONTEXT_RECSCREEN: case CONTEXT_RECSCREEN:
return remote_btn_ctxt_recscreen; return remote_btn_ctxt_recscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return remote_btn_ctxt_keyboard; return remote_btn_ctxt_keyboard;
case CONTEXT_FM: case CONTEXT_FM:
return remote_btn_ctxt_radio; return remote_btn_ctxt_radio;
@ -973,6 +974,7 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_RECSCREEN: case CONTEXT_RECSCREEN:
return button_context_recscreen; return button_context_recscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
case CONTEXT_FM: case CONTEXT_FM:
return button_context_radio; return button_context_radio;

View file

@ -441,6 +441,7 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_PITCHSCREEN: case CONTEXT_PITCHSCREEN:
return button_context_pitchscreen; return button_context_pitchscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
#if CONFIG_TUNER #if CONFIG_TUNER
case CONTEXT_FM: case CONTEXT_FM:

View file

@ -441,6 +441,7 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_PITCHSCREEN: case CONTEXT_PITCHSCREEN:
return button_context_pitchscreen; return button_context_pitchscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
#if CONFIG_TUNER #if CONFIG_TUNER
case CONTEXT_FM: case CONTEXT_FM:

View file

@ -414,6 +414,7 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_PITCHSCREEN: case CONTEXT_PITCHSCREEN:
return button_context_pitchscreen; return button_context_pitchscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
#ifdef HAVE_RECORDING #ifdef HAVE_RECORDING
case CONTEXT_RECSCREEN: case CONTEXT_RECSCREEN:

View file

@ -333,6 +333,7 @@ const struct button_mapping* get_context_mapping(int context)
return button_context_recscreen; return button_context_recscreen;
#endif #endif
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
default: default:

View file

@ -301,6 +301,7 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_PITCHSCREEN: case CONTEXT_PITCHSCREEN:
return button_context_pitchscreen; return button_context_pitchscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
} }
return button_context_standard; return button_context_standard;

View file

@ -582,6 +582,7 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_PITCHSCREEN: case CONTEXT_PITCHSCREEN:
return button_context_pitchscreen; return button_context_pitchscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
#ifdef USB_ENABLE_HID #ifdef USB_ENABLE_HID
case CONTEXT_USB_HID: case CONTEXT_USB_HID:

View file

@ -238,6 +238,7 @@ const struct button_mapping* target_get_context_mapping(int context)
case CONTEXT_PITCHSCREEN: case CONTEXT_PITCHSCREEN:
return button_context_pitchscreen; return button_context_pitchscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
} }
return button_context_standard; return button_context_standard;

View file

@ -169,6 +169,22 @@ static const struct button_mapping button_context_keyboard[] = {
LAST_ITEM_IN_LIST LAST_ITEM_IN_LIST
}; /* button_context_keyboard */ }; /* button_context_keyboard */
static const struct button_mapping button_context_morse_input[] = {
{ ACTION_KBD_CURSOR_LEFT, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_KBD_CURSOR_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_KBD_CURSOR_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
{ ACTION_KBD_CURSOR_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_KBD_BACKSPACE, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
{ ACTION_KBD_DONE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_KBD_ABORT, BUTTON_OFF, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_KBD_SELECT, BUTTON_UP, BUTTON_NONE },
{ ACTION_KBD_MORSE_SELECT, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_morse_input */
#if CONFIG_TUNER #if CONFIG_TUNER
static const struct button_mapping button_context_radio[] = { static const struct button_mapping button_context_radio[] = {
{ ACTION_FM_MENU, BUTTON_MENU | BUTTON_REPEAT, BUTTON_NONE }, { ACTION_FM_MENU, BUTTON_MENU | BUTTON_REPEAT, BUTTON_NONE },
@ -223,6 +239,8 @@ const struct button_mapping* get_context_mapping( int context )
#endif #endif
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
return button_context_keyboard; return button_context_keyboard;
case CONTEXT_MORSE_INPUT:
return button_context_morse_input;
#if CONFIG_TUNER #if CONFIG_TUNER
case CONTEXT_FM: case CONTEXT_FM:
return button_context_radio; return button_context_radio;

View file

@ -302,6 +302,7 @@ const struct button_mapping* get_context_mapping( int context )
case CONTEXT_SETTINGS_RECTRIGGER: case CONTEXT_SETTINGS_RECTRIGGER:
return button_context_recscreen; return button_context_recscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
case CONTEXT_FM: case CONTEXT_FM:
return button_context_radio; return button_context_radio;

View file

@ -270,7 +270,7 @@ static const struct button_mapping button_context_keyboard[] = {
{ ACTION_KBD_PAGE_FLIP, BUTTON_VOL_DOWN, BUTTON_NONE }, { ACTION_KBD_PAGE_FLIP, BUTTON_VOL_DOWN, BUTTON_NONE },
{ ACTION_KBD_MORSE_INPUT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_KBD_MORSE_INPUT, BUTTON_MENU|BUTTON_PLAY, BUTTON_NONE },
{ ACTION_KBD_MORSE_SELECT, BUTTON_MENU|BUTTON_REL, BUTTON_NONE }, { ACTION_KBD_MORSE_SELECT, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
LAST_ITEM_IN_LIST LAST_ITEM_IN_LIST
@ -427,7 +427,9 @@ const struct button_mapping* get_context_mapping(int context)
return button_context_pitchscreen; return button_context_pitchscreen;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
#ifdef USB_ENABLE_HID #ifdef USB_ENABLE_HID
case CONTEXT_USB_HID: case CONTEXT_USB_HID:
return button_context_usb_hid; return button_context_usb_hid;

View file

@ -433,6 +433,7 @@ static const struct button_mapping* get_context_mapping_remote( int context )
return remote_button_context_radio; return remote_button_context_radio;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return remote_button_context_keyboard; return remote_button_context_keyboard;
case CONTEXT_PITCHSCREEN: case CONTEXT_PITCHSCREEN:
@ -489,9 +490,9 @@ const struct button_mapping* get_context_mapping( int context )
return button_context_radio; return button_context_radio;
case CONTEXT_KEYBOARD: case CONTEXT_KEYBOARD:
case CONTEXT_MORSE_INPUT:
return button_context_keyboard; return button_context_keyboard;
case CONTEXT_PITCHSCREEN: case CONTEXT_PITCHSCREEN:
return button_context_pitchscreen; return button_context_pitchscreen;

View file

@ -735,7 +735,11 @@ int kbd_input(char* text, int buflen)
FOR_NB_SCREENS(l) FOR_NB_SCREENS(l)
screens[l].update(); screens[l].update();
button = get_action(CONTEXT_KEYBOARD, HZ/2); button = get_action(
#ifdef HAVE_MORSE_INPUT
morse_mode? CONTEXT_MORSE_INPUT:
#endif
CONTEXT_KEYBOARD, HZ/2);
#if NB_SCREENS > 1 #if NB_SCREENS > 1
button_screen = (get_action_statuscode(NULL) & ACTION_REMOTE) ? 1 : 0; button_screen = (get_action_statuscode(NULL) & ACTION_REMOTE) ? 1 : 0;
#endif #endif

View file

@ -38,6 +38,9 @@
/* define this if you have an Ondio style 6-key keyboard */ /* define this if you have an Ondio style 6-key keyboard */
#define CONFIG_KEYPAD ONDIO_PAD #define CONFIG_KEYPAD ONDIO_PAD
/* Define this to enable morse code input */
#define HAVE_MORSE_INPUT
#define AB_REPEAT_ENABLE 1 #define AB_REPEAT_ENABLE 1
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE

View file

@ -31,6 +31,9 @@
/* define this if you have an Ondio style 6-key keyboard */ /* define this if you have an Ondio style 6-key keyboard */
#define CONFIG_KEYPAD ONDIO_PAD #define CONFIG_KEYPAD ONDIO_PAD
/* Define this to enable morse code input */
#define HAVE_MORSE_INPUT
#define AB_REPEAT_ENABLE 1 #define AB_REPEAT_ENABLE 1
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE

View file

@ -51,6 +51,7 @@
\newcommand{\ActionKbdAbort}{\ButtonOff} \newcommand{\ActionKbdAbort}{\ButtonOff}
\newcommand{\ActionKbdUp}{\ButtonUp} \newcommand{\ActionKbdUp}{\ButtonUp}
\newcommand{\ActionKbdDown}{\ButtonDown} \newcommand{\ActionKbdDown}{\ButtonDown}
\newcommand{\ActionKbdMorseSelect}{\ButtonUp}
%Button actions, Pitch Screen context %Button actions, Pitch Screen context
\newcommand{\ActionPsToggleMode}{Long \ButtonMenu} \newcommand{\ActionPsToggleMode}{Long \ButtonMenu}