Index: apps/keyboard.h
===================================================================
--- apps/keyboard.h (revision 21292)
+++ apps/keyboard.h (working copy)
@@ -21,6 +21,48 @@
#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 == 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 21292)
+++ 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,45 +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 == MROBE100_PAD
-#define KBD_MORSE_INPUT
-#endif
-
struct keyboard_parameters
{
const unsigned char* default_kbd;
@@ -128,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
@@ -522,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
}
@@ -554,7 +514,7 @@
screens[l].clear_display();
#ifdef KBD_MORSE_INPUT
- if (morse_mode)
+ if (global_settings.text_morse)
{
FOR_NB_SCREENS(l)
{
@@ -755,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)
@@ -782,7 +742,7 @@
{
int k;
#ifdef KBD_MORSE_INPUT
- if (morse_mode)
+ if (global_settings.text_morse)
break;
#endif
if (++pm->page >= pm->pages)
@@ -795,7 +755,7 @@
#ifdef KBD_MORSE_INPUT
case ACTION_KBD_MORSE_INPUT:
- morse_mode = !morse_mode;
+ global_settings.text_morse = !global_settings.text_morse;
FOR_NB_SCREENS(l)
{
@@ -804,7 +764,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;
@@ -822,7 +782,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)
@@ -845,7 +805,7 @@
{
int k;
#ifdef KBD_MORSE_INPUT
- if (morse_mode)
+ if (global_settings.text_morse)
break;
#endif
if (++pm->x >= pm->max_chars)
@@ -867,7 +827,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)
@@ -890,7 +850,7 @@
{
int k;
#ifdef KBD_MORSE_INPUT
- if (morse_mode)
+ if (global_settings.text_morse)
break;
#endif
if (--pm->x < 0)
@@ -911,7 +871,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)
@@ -919,7 +879,7 @@
}
else
#else
- if (morse_mode)
+ if (global_settings.text_morse)
break;
#endif
#endif /* KBD_MORSE_INPUT */
@@ -954,7 +914,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)
@@ -962,7 +922,7 @@
}
else
#else
- if (morse_mode)
+ if (global_settings.text_morse)
break;
#endif
#endif /* KBD_MORSE_INPUT */
@@ -1001,7 +961,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)
@@ -1015,9 +975,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 21292)
+++ apps/lang/english.lang (working copy)
@@ -12502,3 +12502,31 @@
swcodec: "Speed"
+
+ id: LANG_TEXT
+ desc: root of text input menu
+ user: core
+
+ *: "Text Input"
+
+
+ *: "Text Input"
+
+
+ *: "Text Input"
+
+
+
+ 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 21292)
+++ 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
@@ -602,6 +603,11 @@
bool talk_filetype; /* say file type */
bool talk_battery_level;
+#ifdef KBD_MORSE_INPUT
+ /* text input method setings */
+ bool text_morse;
+#endif /* KBD_MORSE_INPUT */
+
/* file browser sorting */
bool sort_case; /* dir sort order: 0=case insensitive, 1=sensitive */
int sort_dir; /* 0=alpha, 1=date (old first), 2=date (new first) */
Index: apps/menus/settings_menu.c
===================================================================
--- apps/menus/settings_menu.c (revision 21292)
+++ apps/menus/settings_menu.c (working copy)
@@ -395,8 +395,20 @@
/* VOICE MENU */
/***********************************/
+/***********************************/
+/* TEXT MENU */
+#ifdef KBD_MORSE_INPUT
+MENUITEM_SETTING(text_morse_item, &global_settings.text_morse, NULL);
+MAKE_MENU(text_settings_menu, ID2P(LANG_TEXT), 0, Icon_NOICON,
+ &text_morse_item);
+
+#endif /* KBD_MORSE_INPUT */
+/* TEXT MENU */
/***********************************/
+
+
+/***********************************/
/* SETTINGS MENU */
static int language_browse(void)
{
@@ -412,7 +424,8 @@
&tagcache_menu,
#endif
&display_menu, &system_menu,
- &bookmark_settings_menu, &browse_langs, &voice_settings_menu
+ &bookmark_settings_menu, &browse_langs, &voice_settings_menu,
+ &text_settings_menu
);
/* SETTINGS MENU */
/***********************************/
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (revision 21292)
+++ apps/settings_list.c (working copy)
@@ -906,6 +906,12 @@
OFFON_SETTING(F_TEMPVAR, talk_battery_level, LANG_TALK_BATTERY_LEVEL, false,
"Announce Battery Level", NULL),
+ /* text input */
+#ifdef KBD_MORSE_INPUT
+ OFFON_SETTING(F_TEMPVAR, text_morse, LANG_TEXT_MORSE, false,
+ "use morse code input", NULL),
+#endif
+
#ifdef HAVE_RECORDING
/* recording */
STRINGCHOICE_SETTING(F_RECSETTING, rec_timesplit, LANG_SPLIT_TIME, 0,