summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2009-11-08 13:14:50 +0000
committerTeruaki Kawashima <teru@rockbox.org>2009-11-08 13:14:50 +0000
commit92fb1df03aa1d7cd33bb07f7222e36e954409e52 (patch)
tree79c471e6aceac1ca49ca98bdcb10b7f1b084119a
parentb92e778fd71dfc86d41e6ddf68cf7b35477bc927 (diff)
downloadrockbox-92fb1df03aa1d7cd33bb07f7222e36e954409e52.tar.gz
rockbox-92fb1df03aa1d7cd33bb07f7222e36e954409e52.zip
FS#10338: Add "use morse input " entry to settings menu
* Remember last used text input mode (keyboard or morse input) in settings. * Add setting "Use Morse Code Input" under Settings -> General Settings -> System. Now it is possible for some of targets without button combo for changing input mode to use morse input by changing the setting. it's not possible for them to change input mode during in the keyboard screen of course. There are still targets without morse input mode. Flyspray: FS#10338 Author: myself, David Johnston git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23567 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/features.txt4
-rw-r--r--apps/keymaps/keymap-creativezv.c1
-rw-r--r--apps/keymaps/keymap-creativezvm.c1
-rw-r--r--apps/keymaps/keymap-e200.c2
-rw-r--r--apps/keymaps/keymap-fuze.c1
-rw-r--r--apps/keymaps/keymap-m200.c1
-rw-r--r--apps/keymaps/keymap-mr500.c1
-rw-r--r--apps/keymaps/keymap-recorder.c1
-rw-r--r--apps/keymaps/keymap-x5.c3
-rw-r--r--apps/lang/english.lang17
-rw-r--r--apps/menus/settings_menu.c9
-rw-r--r--apps/recorder/keyboard.c138
-rw-r--r--apps/settings.h4
-rw-r--r--apps/settings_list.c4
-rw-r--r--firmware/export/config-creativezv.h3
-rw-r--r--firmware/export/config-creativezvm.h3
-rw-r--r--firmware/export/config-creativezvm60gb.h3
-rw-r--r--firmware/export/config-e200.h3
-rw-r--r--firmware/export/config-e200v2.h3
-rw-r--r--firmware/export/config-fmrecorder.h3
-rw-r--r--firmware/export/config-fuze.h3
-rw-r--r--firmware/export/config-gigabeat-s.h6
-rw-r--r--firmware/export/config-gigabeat.h3
-rw-r--r--firmware/export/config-h10.h3
-rw-r--r--firmware/export/config-h100.h3
-rw-r--r--firmware/export/config-h10_5gb.h3
-rw-r--r--firmware/export/config-h120.h3
-rw-r--r--firmware/export/config-h300.h3
-rw-r--r--firmware/export/config-hdd1630.h3
-rw-r--r--firmware/export/config-iaudiom5.h3
-rw-r--r--firmware/export/config-iaudiox5.h3
-rw-r--r--firmware/export/config-ipod1g2g.h3
-rw-r--r--firmware/export/config-ipod3g.h3
-rw-r--r--firmware/export/config-ipod4g.h3
-rw-r--r--firmware/export/config-ipodcolor.h3
-rw-r--r--firmware/export/config-ipodmini.h3
-rw-r--r--firmware/export/config-ipodmini2g.h3
-rw-r--r--firmware/export/config-ipodnano.h3
-rw-r--r--firmware/export/config-ipodnano2g.h3
-rw-r--r--firmware/export/config-ipodvideo.h3
-rw-r--r--firmware/export/config-m200.h3
-rw-r--r--firmware/export/config-m200v4.h3
-rw-r--r--firmware/export/config-mrobe100.h3
-rw-r--r--firmware/export/config-mrobe500.h3
-rw-r--r--firmware/export/config-recorder.h3
-rw-r--r--firmware/export/config-recorderv2.h3
-rw-r--r--firmware/export/config-sa9200.h3
-rw-r--r--firmware/export/config-view.h3
48 files changed, 222 insertions, 70 deletions
diff --git a/apps/features.txt b/apps/features.txt
index 888e9d2210..14204dfb6d 100644
--- a/apps/features.txt
+++ b/apps/features.txt
@@ -102,6 +102,10 @@ masf
masd
#endif
+#if defined(HAVE_MORSE_INPUT)
+morse_input
+#endif
+
#if defined(HAVE_PITCHSCREEN)
pitchscreen
#endif
diff --git a/apps/keymaps/keymap-creativezv.c b/apps/keymaps/keymap-creativezv.c
index c75a5b29cd..b88c1409cd 100644
--- a/apps/keymaps/keymap-creativezv.c
+++ b/apps/keymaps/keymap-creativezv.c
@@ -213,6 +213,7 @@ static const struct button_mapping button_context_keyboard[] = {
{ ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
diff --git a/apps/keymaps/keymap-creativezvm.c b/apps/keymaps/keymap-creativezvm.c
index 12694bc473..b355018892 100644
--- a/apps/keymaps/keymap-creativezvm.c
+++ b/apps/keymaps/keymap-creativezvm.c
@@ -212,6 +212,7 @@ static const struct button_mapping button_context_keyboard[] = {
{ ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
diff --git a/apps/keymaps/keymap-e200.c b/apps/keymaps/keymap-e200.c
index 487fb11130..2deac631ac 100644
--- a/apps/keymaps/keymap-e200.c
+++ b/apps/keymaps/keymap-e200.c
@@ -265,6 +265,8 @@ static const struct button_mapping button_context_keyboard[] = {
{ ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
{ ACTION_KBD_DONE, BUTTON_UP, BUTTON_NONE },
{ ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
+ { ACTION_KBD_MORSE_INPUT, BUTTON_REC|BUTTON_REL, BUTTON_REC },
+ { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
diff --git a/apps/keymaps/keymap-fuze.c b/apps/keymaps/keymap-fuze.c
index e44ee518f2..3e89cc595f 100644
--- a/apps/keymaps/keymap-fuze.c
+++ b/apps/keymaps/keymap-fuze.c
@@ -266,6 +266,7 @@ static const struct button_mapping button_context_keyboard[] = {
{ ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
{ ACTION_KBD_DONE, BUTTON_UP, BUTTON_NONE },
{ ACTION_KBD_ABORT, BUTTON_HOME|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
diff --git a/apps/keymaps/keymap-m200.c b/apps/keymaps/keymap-m200.c
index 78a4947b2f..e3aa093a81 100644
--- a/apps/keymaps/keymap-m200.c
+++ b/apps/keymaps/keymap-m200.c
@@ -274,6 +274,7 @@ static const struct button_mapping button_context_keyboard[] = {
{ ACTION_KBD_DONE, BUTTON_VOL_UP, BUTTON_NONE },
{ ACTION_KBD_DONE, BUTTON_VOL_DOWN, BUTTON_NONE },
{ ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
+ { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
diff --git a/apps/keymaps/keymap-mr500.c b/apps/keymaps/keymap-mr500.c
index 36ffea46de..0b1dc767f2 100644
--- a/apps/keymaps/keymap-mr500.c
+++ b/apps/keymaps/keymap-mr500.c
@@ -191,6 +191,7 @@ static const struct button_mapping button_context_keyboard[] = {
{ ACTION_KBD_UP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_RC_DOWN, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_KBD_MORSE_SELECT, BUTTON_RC_HEART|BUTTON_REL, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
diff --git a/apps/keymaps/keymap-recorder.c b/apps/keymaps/keymap-recorder.c
index 6c8ae0460e..0ab0e5f8c6 100644
--- a/apps/keymaps/keymap-recorder.c
+++ b/apps/keymaps/keymap-recorder.c
@@ -197,6 +197,7 @@ static const struct button_mapping button_context_keyboard[] = {
{ ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_KBD_MORSE_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
diff --git a/apps/keymaps/keymap-x5.c b/apps/keymaps/keymap-x5.c
index 8b94118ac1..69602d7ca7 100644
--- a/apps/keymaps/keymap-x5.c
+++ b/apps/keymaps/keymap-x5.c
@@ -132,9 +132,10 @@ static const struct button_mapping button_context_keyboard[] = {
{ ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_KBD_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
{ ACTION_KBD_DONE, BUTTON_PLAY, BUTTON_NONE },
{ ACTION_KBD_ABORT, BUTTON_REC, BUTTON_NONE },
+ { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 9fa1f7b7b3..198a3c7358 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -13210,3 +13210,20 @@
*: "Queue Last Shuffled"
</voice>
</phrase>
+<phrase>
+ id: LANG_MORSE_INPUT
+ desc: in Settings -> System
+ user: core
+ <source>
+ *: none
+ morse_input: "Use Morse Code Input"
+ </source>
+ <dest>
+ *: none
+ morse_input: "Use Morse Code Input"
+ </dest>
+ <voice>
+ *: none
+ morse_input: "Use Morse Code Input"
+ </voice>
+</phrase>
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index c11bf0eb3d..135e632479 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -257,6 +257,10 @@ MENUITEM_SETTING(usb_hid, &global_settings.usb_hid, NULL);
MENUITEM_SETTING(usb_keypad_mode, &global_settings.usb_keypad_mode, NULL);
#endif
+#ifdef HAVE_MORSE_INPUT
+MENUITEM_SETTING(morse_input, &global_settings.morse_input, NULL);
+#endif
+
#ifdef HAVE_BUTTON_LIGHT
MENUITEM_SETTING(buttonlight_timeout, &global_settings.buttonlight_timeout, NULL);
#endif
@@ -280,6 +284,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
#endif
&poweroff,
&limits_menu,
+#ifdef HAVE_MORSE_INPUT
+ &morse_input,
+#endif
#if CONFIG_CODEC == MAS3507D
&line_in,
#endif
@@ -287,7 +294,7 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
&car_adapter_mode,
#endif
#ifdef IPOD_ACCESSORY_PROTOCOL
- &serial_bitrate,
+ &serial_bitrate,
#endif
#ifdef HAVE_ACCESSORY_SUPPLY
&accessory_supply,
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index e6a3c927e3..1e9e8f32ab 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -49,45 +49,47 @@
#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
+#if (CONFIG_KEYPAD == ONDIO_PAD) \
+ || (CONFIG_KEYPAD == IPOD_1G2G_PAD) \
+ || (CONFIG_KEYPAD == IPOD_3G_PAD) \
+ || (CONFIG_KEYPAD == IPOD_4G_PAD) \
+ || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \
+ || (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) \
+ || (CONFIG_KEYPAD == IAUDIO_M3_PAD) \
+ || (CONFIG_KEYPAD == IRIVER_H10_PAD)
+/* no key combos to move the cursor if not in line edit mode */
+#define KBD_MODES /* uses 2 modes, picker and line edit */
+
+#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) \
+ || (CONFIG_KEYPAD == IRIVER_H300_PAD) \
+ || (CONFIG_KEYPAD == GIGABEAT_PAD) \
+ || (CONFIG_KEYPAD == GIGABEAT_S_PAD) \
+ || (CONFIG_KEYPAD == SANSA_E200_PAD) \
+ || (CONFIG_KEYPAD == SANSA_FUZE_PAD) \
+ || (CONFIG_KEYPAD == SANSA_C200_PAD) \
+ || (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
+/* certain key combos move the cursor even if not in line edit mode */
#define KBD_CURSOR_KEYS
-#define KBD_MODES
-#define KBD_MORSE_INPUT
+#define KBD_MODES /* uses 2 modes, picker and line edit */
-#elif CONFIG_KEYPAD == SANSA_E200_PAD \
- || CONFIG_KEYPAD == SANSA_FUZE_PAD \
- || CONFIG_KEYPAD == SANSA_C200_PAD \
- || CONFIG_KEYPAD == SAMSUNG_YH_PAD
-#define KBD_CURSOR_KEYS
-#define KBD_MODES
+#else
+#define KBD_CURSOR_KEYS /* certain keys move the cursor, no line edit mode */
+#endif
-#elif CONFIG_KEYPAD == MROBE100_PAD
-#define KBD_MORSE_INPUT
+#if (CONFIG_KEYPAD == IRIVER_H100_PAD) \
+ || (CONFIG_KEYPAD == IRIVER_H300_PAD) \
+ || (CONFIG_KEYPAD == IPOD_1G2G_PAD) \
+ || (CONFIG_KEYPAD == IPOD_3G_PAD) \
+ || (CONFIG_KEYPAD == IPOD_4G_PAD) \
+ || (CONFIG_KEYPAD == IRIVER_H10_PAD) \
+ || (CONFIG_KEYPAD == GIGABEAT_PAD) \
+ || (CONFIG_KEYPAD == GIGABEAT_S_PAD) \
+ || (CONFIG_KEYPAD == MROBE100_PAD) \
+ || (CONFIG_KEYPAD == SANSA_E200_PAD) \
+ || (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) \
+ || (CONFIG_KEYPAD == PHILIPS_SA9200_PAD)
+/* certain key combos toggle input mode between keyboard input and Morse input */
+#define KBD_TOGGLE_INPUT
#endif
struct keyboard_parameters
@@ -124,7 +126,7 @@ struct keyboard_parameters
static struct keyboard_parameters kbd_param[NB_SCREENS];
static bool kbd_loaded = false;
-#ifdef KBD_MORSE_INPUT
+#ifdef HAVE_MORSE_INPUT
/* FIXME: We should put this to a configuration file. */
static const char *morse_alphabets =
"abcdefghijklmnopqrstuvwxyz1234567890,.?-@ ";
@@ -134,7 +136,6 @@ static const unsigned char morse_codes[] = {
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
@@ -306,7 +307,8 @@ int kbd_input(char* text, int buflen)
unsigned char *utf8;
bool cur_blink = true; /* Cursor on/off flag */
int ret = 0; /* assume success */
-#ifdef KBD_MORSE_INPUT
+#ifdef HAVE_MORSE_INPUT
+ bool morse_mode = global_settings.morse_input;
bool morse_reading = false;
unsigned char morse_code = 0;
int morse_tick = 0;
@@ -534,10 +536,10 @@ int kbd_input(char* text, int buflen)
pm->main_x = 0;
pm->keyboard_margin -= pm->keyboard_margin/2;
-#ifdef KBD_MORSE_INPUT
+#ifdef HAVE_MORSE_INPUT
pm->old_main_y = pm->main_y;
if (morse_mode)
- pm->main_y = sc_h - pm->font_h;
+ pm->main_y = sc_h - pm->font_h - BUTTONBAR_HEIGHT;
#endif
}
@@ -567,7 +569,7 @@ int kbd_input(char* text, int buflen)
FOR_NB_SCREENS(l)
screens[l].clear_display();
-#ifdef KBD_MORSE_INPUT
+#ifdef HAVE_MORSE_INPUT
if (morse_mode)
{
FOR_NB_SCREENS(l)
@@ -615,7 +617,7 @@ int kbd_input(char* text, int buflen)
}
}
else
-#endif /* KBD_MORSE_INPUT */
+#endif /* HAVE_MORSE_INPUT */
{
/* draw page */
FOR_NB_SCREENS(l)
@@ -752,7 +754,7 @@ int kbd_input(char* text, int buflen)
sc->getwidth(), pm->font_h + 2);
else /* highlight the key that has focus */
#endif
-#ifdef KBD_MORSE_INPUT
+#ifdef HAVE_MORSE_INPUT
if(!morse_mode)
#endif
sc->fillrect(pm->font_w*pm->x,
@@ -771,14 +773,14 @@ int kbd_input(char* text, int buflen)
pm = &param[button_screen];
sc = &screens[button_screen];
-#if defined(KBD_MODES) || defined(KBD_MORSE_INPUT)
+#if defined(KBD_MODES) || defined(HAVE_MORSE_INPUT)
/* Remap some buttons to allow to move
* cursor in line edit mode and morse mode. */
-#if defined(KBD_MODES) && defined(KBD_MORSE_INPUT)
+#if defined(KBD_MODES) && defined(HAVE_MORSE_INPUT)
if (pm->line_edit || morse_mode)
#elif defined(KBD_MODES)
if (pm->line_edit)
-#else /* defined(KBD_MORSE_INPUT) */
+#else /* defined(HAVE_MORSE_INPUT) */
if (morse_mode)
#endif
{
@@ -787,7 +789,7 @@ int kbd_input(char* text, int buflen)
if (button == ACTION_KBD_RIGHT)
button = ACTION_KBD_CURSOR_RIGHT;
}
-#endif /* defined(KBD_MODES) || defined(KBD_MORSE_INPUT) */
+#endif /* defined(KBD_MODES) || defined(HAVE_MORSE_INPUT) */
switch ( button )
{
@@ -798,7 +800,7 @@ int kbd_input(char* text, int buflen)
case ACTION_KBD_PAGE_FLIP:
{
-#ifdef KBD_MORSE_INPUT
+#ifdef HAVE_MORSE_INPUT
if (morse_mode)
break;
#endif
@@ -810,7 +812,7 @@ int kbd_input(char* text, int buflen)
break;
}
-#ifdef KBD_MORSE_INPUT
+#if defined(HAVE_MORSE_INPUT) && defined(KBD_TOGGLE_INPUT)
case ACTION_KBD_MORSE_INPUT:
morse_mode = !morse_mode;
@@ -822,7 +824,7 @@ int kbd_input(char* text, int buflen)
if (morse_mode)
{
pm->old_main_y = pm->main_y;
- pm->main_y = sc->getheight() - pm->font_h;
+ pm->main_y = sc->getheight() - pm->font_h - BUTTONBAR_HEIGHT;
}
else
{
@@ -831,7 +833,7 @@ int kbd_input(char* text, int buflen)
}
/* FIXME: We should talk something like Morse mode.. */
break;
-#endif /* KBD_MORSE_INPUT */
+#endif /* KBD_TOGGLE_INPUT */
case ACTION_KBD_RIGHT:
if (++pm->x >= pm->max_chars)
@@ -864,7 +866,7 @@ int kbd_input(char* text, int buflen)
break;
case ACTION_KBD_DOWN:
-#ifdef KBD_MORSE_INPUT
+#ifdef HAVE_MORSE_INPUT
#ifdef KBD_MODES
if (morse_mode)
{
@@ -877,7 +879,7 @@ int kbd_input(char* text, int buflen)
if (morse_mode)
break;
#endif
-#endif /* KBD_MORSE_INPUT */
+#endif /* HAVE_MORSE_INPUT */
{
#ifdef KBD_MODES
if (pm->line_edit)
@@ -907,7 +909,7 @@ int kbd_input(char* text, int buflen)
break;
case ACTION_KBD_UP:
-#ifdef KBD_MORSE_INPUT
+#ifdef HAVE_MORSE_INPUT
#ifdef KBD_MODES
if (morse_mode)
{
@@ -920,7 +922,7 @@ int kbd_input(char* text, int buflen)
if (morse_mode)
break;
#endif
-#endif /* KBD_MORSE_INPUT */
+#endif /* HAVE_MORSE_INPUT */
{
#ifdef KBD_MODES
if (pm->line_edit)
@@ -955,7 +957,7 @@ int kbd_input(char* text, int buflen)
done = true;
break;
-#ifdef KBD_MORSE_INPUT
+#ifdef HAVE_MORSE_INPUT
case ACTION_KBD_MORSE_SELECT:
if (morse_mode && morse_reading)
{
@@ -965,10 +967,10 @@ int kbd_input(char* text, int buflen)
}
break;
-#endif /* KBD_MORSE_INPUT */
+#endif /* HAVE_MORSE_INPUT */
case ACTION_KBD_SELECT:
-#ifdef KBD_MORSE_INPUT
+#ifdef HAVE_MORSE_INPUT
#ifdef KBD_MODES
if (morse_mode && !pm->line_edit)
#else
@@ -984,7 +986,7 @@ int kbd_input(char* text, int buflen)
}
break;
}
-#endif /* KBD_MORSE_INPUT */
+#endif /* HAVE_MORSE_INPUT */
/* inserts the selected char */
#ifdef KBD_MODES
@@ -1088,7 +1090,7 @@ int kbd_input(char* text, int buflen)
/* speak revised text */
break;
-#if !defined (KBD_MODES) || defined (KBD_CURSOR_KEYS)
+#ifdef KBD_CURSOR_KEYS
case ACTION_KBD_BACKSPACE:
if (pm->hangul)
{
@@ -1114,7 +1116,7 @@ int kbd_input(char* text, int buflen)
if (global_settings.talk_menu) /* voice UI? */
talk_spell(text, false); /* speak revised text */
break;
-#endif /* !defined (KBD_MODES) || defined (KBD_CURSOR_KEYS) */
+#endif /* KBD_CURSOR_KEYS */
case ACTION_KBD_CURSOR_RIGHT:
pm->hangul = false;
@@ -1145,7 +1147,7 @@ int kbd_input(char* text, int buflen)
break;
case BUTTON_NONE:
-#ifdef KBD_MORSE_INPUT
+#ifdef HAVE_MORSE_INPUT
if (morse_reading)
{
int j;
@@ -1172,7 +1174,7 @@ int kbd_input(char* text, int buflen)
if (global_settings.talk_menu) /* voice UI? */
talk_spell(text, false); /* speak revised text */
}
-#endif /* KBD_MORSE_INPUT */
+#endif /* HAVE_MORSE_INPUT */
break;
default:
@@ -1198,6 +1200,14 @@ int kbd_input(char* text, int buflen)
if (ret < 0)
splash(HZ/2, ID2P(LANG_CANCEL));
+#ifdef HAVE_MORSE_INPUT
+ if(global_settings.morse_input != morse_mode)
+ {
+ global_settings.morse_input = morse_mode;
+ settings_save();
+ }
+#endif /* HAVE_MORSE_INPUT */
+
FOR_NB_SCREENS(l)
screens[l].setfont(FONT_UI);
viewportmanager_set_statusbar(oldbars);
diff --git a/apps/settings.h b/apps/settings.h
index 880078885f..eba592aca8 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -798,6 +798,10 @@ struct user_settings
int compressor_release_time;
#endif
+#ifdef HAVE_MORSE_INPUT
+ bool morse_input; /* text input method setting */
+#endif
+
};
/** global variables **/
diff --git a/apps/settings_list.c b/apps/settings_list.c
index b0a1a76b3a..9f290e2a18 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1635,6 +1635,10 @@ const struct settings_list settings[] = {
VIEWPORT_SETTING(remote_ui_vp_config, "remote ui viewport"),
#endif
#endif
+
+#ifdef HAVE_MORSE_INPUT
+ OFFON_SETTING(0, morse_input, LANG_MORSE_INPUT, false, "morse input", NULL),
+#endif
};
const int nb_settings = sizeof(settings)/sizeof(*settings);
diff --git a/firmware/export/config-creativezv.h b/firmware/export/config-creativezv.h
index 5454038f0c..eff5a506c0 100644
--- a/firmware/export/config-creativezv.h
+++ b/firmware/export/config-creativezv.h
@@ -76,6 +76,9 @@
#define HAVE_HEADPHONE_DETECTION
//#define HAVE_TOUCHPAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-creativezvm.h b/firmware/export/config-creativezvm.h
index 37d2eb48cf..d8005bb83d 100644
--- a/firmware/export/config-creativezvm.h
+++ b/firmware/export/config-creativezvm.h
@@ -77,6 +77,9 @@
#define HAVE_HEADPHONE_DETECTION
//#define HAVE_TOUCHPAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-creativezvm60gb.h b/firmware/export/config-creativezvm60gb.h
index e34515ca44..3e95ae7be7 100644
--- a/firmware/export/config-creativezvm60gb.h
+++ b/firmware/export/config-creativezvm60gb.h
@@ -76,6 +76,9 @@
#define HAVE_HEADPHONE_DETECTION
//#define HAVE_TOUCHPAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h
index dd65e6a37d..687878ce06 100644
--- a/firmware/export/config-e200.h
+++ b/firmware/export/config-e200.h
@@ -73,6 +73,9 @@
#define CONFIG_KEYPAD SANSA_E200_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
/* There is no hardware tone control */
diff --git a/firmware/export/config-e200v2.h b/firmware/export/config-e200v2.h
index b4985ecd6d..d42f28ac2f 100644
--- a/firmware/export/config-e200v2.h
+++ b/firmware/export/config-e200v2.h
@@ -73,6 +73,9 @@
#define CONFIG_KEYPAD SANSA_E200_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h
index 97dc52ebb5..d9f3a95f3e 100644
--- a/firmware/export/config-fmrecorder.h
+++ b/firmware/export/config-fmrecorder.h
@@ -48,6 +48,9 @@
/* define this if you have a Recorder style 10-key keyboard */
#define CONFIG_KEYPAD RECORDER_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* define this if you have a real-time clock */
#define CONFIG_RTC RTC_M41ST84W
diff --git a/firmware/export/config-fuze.h b/firmware/export/config-fuze.h
index e9b54e14fd..cc6669af39 100644
--- a/firmware/export/config-fuze.h
+++ b/firmware/export/config-fuze.h
@@ -78,6 +78,9 @@
#define CONFIG_KEYPAD SANSA_FUZE_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-gigabeat-s.h b/firmware/export/config-gigabeat-s.h
index 344c572e40..7f55797a07 100644
--- a/firmware/export/config-gigabeat-s.h
+++ b/firmware/export/config-gigabeat-s.h
@@ -49,10 +49,8 @@
#define CONFIG_KEYPAD GIGABEAT_S_PAD
-/* Define keyboard features */
-#define KBD_CURSOR_KEYS /* allow non-line edit cursor movement */
-#define KBD_MODES /* enable line edit */
-#define KBD_MORSE_INPUT /* enable morse code input */
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h
index a20a5d87ff..363312a415 100644
--- a/firmware/export/config-gigabeat.h
+++ b/firmware/export/config-gigabeat.h
@@ -65,6 +65,9 @@
#define CONFIG_KEYPAD GIGABEAT_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h
index 6ad7a8ddc5..cde1b6075e 100644
--- a/firmware/export/config-h10.h
+++ b/firmware/export/config-h10.h
@@ -76,6 +76,9 @@
#define CONFIG_KEYPAD IRIVER_H10_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index 520079b8a0..d01ee1f3f9 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -69,6 +69,9 @@
#define CONFIG_REMOTE_KEYPAD H100_REMOTE
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-h10_5gb.h b/firmware/export/config-h10_5gb.h
index e39c6a6bbf..e69f6c2b20 100644
--- a/firmware/export/config-h10_5gb.h
+++ b/firmware/export/config-h10_5gb.h
@@ -59,6 +59,9 @@
#define CONFIG_KEYPAD IRIVER_H10_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index da75c60ecf..8751c121cc 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -68,6 +68,9 @@
#define CONFIG_REMOTE_KEYPAD H100_REMOTE
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index 09fce49b10..d2348397d2 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -61,6 +61,9 @@
#define CONFIG_REMOTE_KEYPAD H300_REMOTE
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-hdd1630.h b/firmware/export/config-hdd1630.h
index f44f7d1729..c9a3b035ca 100644
--- a/firmware/export/config-hdd1630.h
+++ b/firmware/export/config-hdd1630.h
@@ -77,6 +77,9 @@
#define CONFIG_KEYPAD PHILIPS_HDD1630_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* define this if the target has volume keys which can be used in the lists */
#define HAVE_VOLUME_IN_LIST
diff --git a/firmware/export/config-iaudiom5.h b/firmware/export/config-iaudiom5.h
index 00e07a92cd..03add43dbf 100644
--- a/firmware/export/config-iaudiom5.h
+++ b/firmware/export/config-iaudiom5.h
@@ -83,6 +83,9 @@
#define CONFIG_KEYPAD IAUDIO_X5M5_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
#define AB_REPEAT_ENABLE 1
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h
index a6b48b98a8..bafe51f12d 100644
--- a/firmware/export/config-iaudiox5.h
+++ b/firmware/export/config-iaudiox5.h
@@ -85,6 +85,9 @@
#define CONFIG_KEYPAD IAUDIO_X5M5_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
#define AB_REPEAT_ENABLE 1
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
diff --git a/firmware/export/config-ipod1g2g.h b/firmware/export/config-ipod1g2g.h
index 835b75bd85..cde745e874 100644
--- a/firmware/export/config-ipod1g2g.h
+++ b/firmware/export/config-ipod1g2g.h
@@ -77,6 +77,9 @@
#define HAVE_SCROLLWHEEL
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h
index 7cab8846ef..e82cc92f56 100644
--- a/firmware/export/config-ipod3g.h
+++ b/firmware/export/config-ipod3g.h
@@ -78,6 +78,9 @@
#define HAVE_SCROLLWHEEL
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h
index 6195e0c1b6..c00a6788c6 100644
--- a/firmware/export/config-ipod4g.h
+++ b/firmware/export/config-ipod4g.h
@@ -76,6 +76,9 @@
#define CONFIG_KEYPAD IPOD_4G_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h
index 7c7897b67b..751522d47b 100644
--- a/firmware/export/config-ipodcolor.h
+++ b/firmware/export/config-ipodcolor.h
@@ -60,6 +60,9 @@
#define CONFIG_KEYPAD IPOD_4G_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h
index be3ab2bc96..129829ffbb 100644
--- a/firmware/export/config-ipodmini.h
+++ b/firmware/export/config-ipodmini.h
@@ -77,6 +77,9 @@
#define HAVE_SCROLLWHEEL
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h
index 53476b177f..8087269485 100644
--- a/firmware/export/config-ipodmini2g.h
+++ b/firmware/export/config-ipodmini2g.h
@@ -75,6 +75,9 @@
#define CONFIG_KEYPAD IPOD_4G_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h
index f1a4d6a65e..68ed152cda 100644
--- a/firmware/export/config-ipodnano.h
+++ b/firmware/export/config-ipodnano.h
@@ -60,6 +60,9 @@
#define CONFIG_KEYPAD IPOD_4G_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-ipodnano2g.h b/firmware/export/config-ipodnano2g.h
index bcc98e0da3..2e044335da 100644
--- a/firmware/export/config-ipodnano2g.h
+++ b/firmware/export/config-ipodnano2g.h
@@ -94,6 +94,9 @@
//#define AB_REPEAT_ENABLE 1
//#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index 9762e71a73..f00de9cbfd 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -62,6 +62,9 @@
#define CONFIG_KEYPAD IPOD_4G_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-m200.h b/firmware/export/config-m200.h
index 59f5ad7cfb..0f071e18ab 100644
--- a/firmware/export/config-m200.h
+++ b/firmware/export/config-m200.h
@@ -58,6 +58,9 @@
/* define this to indicate your device's keypad */
#define CONFIG_KEYPAD SANSA_M200_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* define this if you have a real-time clock */
#define CONFIG_RTC RTC_TCC77X
diff --git a/firmware/export/config-m200v4.h b/firmware/export/config-m200v4.h
index 13dcec92ff..af9f1aedc6 100644
--- a/firmware/export/config-m200v4.h
+++ b/firmware/export/config-m200v4.h
@@ -61,6 +61,9 @@
/* define this to indicate your device's keypad */
#define CONFIG_KEYPAD SANSA_M200_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* define this if you have a real-time clock */
#ifndef BOOTLOADER
#define CONFIG_RTC RTC_AS3514
diff --git a/firmware/export/config-mrobe100.h b/firmware/export/config-mrobe100.h
index 5a2790062d..90419914b2 100644
--- a/firmware/export/config-mrobe100.h
+++ b/firmware/export/config-mrobe100.h
@@ -64,6 +64,9 @@
#define CONFIG_KEYPAD MROBE100_PAD
#define CONFIG_REMOTE_KEYPAD MROBE_REMOTE
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
diff --git a/firmware/export/config-mrobe500.h b/firmware/export/config-mrobe500.h
index 82ba8a8e83..96e25c9247 100644
--- a/firmware/export/config-mrobe500.h
+++ b/firmware/export/config-mrobe500.h
@@ -138,6 +138,9 @@
#define HAVE_TOUCHSCREEN
#define HAVE_BUTTON_DATA
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* define this if the target has volume keys which can be used in the lists */
#define HAVE_VOLUME_IN_LIST
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h
index 88ff2c2006..ef9f523c49 100644
--- a/firmware/export/config-recorder.h
+++ b/firmware/export/config-recorder.h
@@ -48,6 +48,9 @@
/* define this if you have the Recorder's 10-key keyboard */
#define CONFIG_KEYPAD RECORDER_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* define this if you have a real-time clock */
#define CONFIG_RTC RTC_M41ST84W
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h
index 6a5564487e..c530fa5815 100644
--- a/firmware/export/config-recorderv2.h
+++ b/firmware/export/config-recorderv2.h
@@ -48,6 +48,9 @@
/* define this if you have a Recorder style 10-key keyboard */
#define CONFIG_KEYPAD RECORDER_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* define this if you have a real-time clock */
#define CONFIG_RTC RTC_M41ST84W
diff --git a/firmware/export/config-sa9200.h b/firmware/export/config-sa9200.h
index ce233184cb..d9b9462880 100644
--- a/firmware/export/config-sa9200.h
+++ b/firmware/export/config-sa9200.h
@@ -62,6 +62,9 @@
#define CONFIG_KEYPAD PHILIPS_SA9200_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* define this if the target has volume keys which can be used in the lists */
#define HAVE_VOLUME_IN_LIST
diff --git a/firmware/export/config-view.h b/firmware/export/config-view.h
index 7b13bf74ba..4111b8380a 100644
--- a/firmware/export/config-view.h
+++ b/firmware/export/config-view.h
@@ -74,6 +74,9 @@
/* The only difference is that the power/hold is on the left instead of right on Fuze */
#define CONFIG_KEYPAD SANSA_FUZE_PAD
+/* Define this to enable morse code input */
+#define HAVE_MORSE_INPUT
+
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
/* There is no hardware tone control */