summaryrefslogtreecommitdiff
path: root/apps/recorder/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/keyboard.c')
-rw-r--r--apps/recorder/keyboard.c106
1 files changed, 27 insertions, 79 deletions
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index f2f5d28508..e6a3c927e3 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -771,16 +771,23 @@ int kbd_input(char* text, int buflen)
771 pm = &param[button_screen]; 771 pm = &param[button_screen];
772 sc = &screens[button_screen]; 772 sc = &screens[button_screen];
773 773
774#if defined KBD_MORSE_INPUT && !defined KBD_MODES 774#if defined(KBD_MODES) || defined(KBD_MORSE_INPUT)
775 /* Remap some buttons to allow to move
776 * cursor in line edit mode and morse mode. */
777#if defined(KBD_MODES) && defined(KBD_MORSE_INPUT)
778 if (pm->line_edit || morse_mode)
779#elif defined(KBD_MODES)
780 if (pm->line_edit)
781#else /* defined(KBD_MORSE_INPUT) */
775 if (morse_mode) 782 if (morse_mode)
783#endif
776 { 784 {
777 /* Remap some buttons for morse mode. */
778 if (button == ACTION_KBD_LEFT) 785 if (button == ACTION_KBD_LEFT)
779 button = ACTION_KBD_CURSOR_LEFT; 786 button = ACTION_KBD_CURSOR_LEFT;
780 if (button == ACTION_KBD_RIGHT) 787 if (button == ACTION_KBD_RIGHT)
781 button = ACTION_KBD_CURSOR_RIGHT; 788 button = ACTION_KBD_CURSOR_RIGHT;
782 } 789 }
783#endif 790#endif /* defined(KBD_MODES) || defined(KBD_MORSE_INPUT) */
784 791
785 switch ( button ) 792 switch ( button )
786 { 793 {
@@ -827,91 +834,33 @@ int kbd_input(char* text, int buflen)
827#endif /* KBD_MORSE_INPUT */ 834#endif /* KBD_MORSE_INPUT */
828 835
829 case ACTION_KBD_RIGHT: 836 case ACTION_KBD_RIGHT:
830#ifdef KBD_MODES 837 if (++pm->x >= pm->max_chars)
831#ifdef KBD_MORSE_INPUT
832 /* allow cursor change in non line edit morse mode */
833 if (pm->line_edit || morse_mode)
834#else
835 /* right doubles as cursor_right in line_edit */
836 if (pm->line_edit)
837#endif
838 { 838 {
839 pm->hangul = false;
840
841 if (editpos < len_utf8)
842 {
843 int c = utf8seek(text, ++editpos);
844 kbd_spellchar(text[c]);
845 }
846#if CONFIG_CODEC == SWCODEC
847 else if (global_settings.talk_menu)
848 pcmbuf_beep(1000, 150, 1500);
849#endif
850 }
851 else
852#endif /* KBD_MODES */
853 {
854#ifdef KBD_MORSE_INPUT
855 if (morse_mode)
856 break;
857#endif
858 if (++pm->x >= pm->max_chars)
859 {
860#ifndef KBD_PAGE_FLIP 839#ifndef KBD_PAGE_FLIP
861 /* no dedicated flip key - flip page on wrap */ 840 /* no dedicated flip key - flip page on wrap */
862 if (++pm->page >= pm->pages) 841 if (++pm->page >= pm->pages)
863 pm->page = 0; 842 pm->page = 0;
864#endif 843#endif
865 pm->x = 0; 844 pm->x = 0;
866 }
867
868 ch = get_kbd_ch(pm);
869 kbd_spellchar(ch);
870 } 845 }
846
847 ch = get_kbd_ch(pm);
848 kbd_spellchar(ch);
871 break; 849 break;
872 850
873 case ACTION_KBD_LEFT: 851 case ACTION_KBD_LEFT:
874#ifdef KBD_MODES 852 if (--pm->x < 0)
875#ifdef KBD_MORSE_INPUT
876 /* allow cursor change in non line edit morse mode */
877 if (pm->line_edit || morse_mode)
878#else
879 /* left doubles as cursor_left in line_edit */
880 if (pm->line_edit)
881#endif
882 {
883 pm->hangul = false;
884
885 if (editpos > 0)
886 {
887 int c = utf8seek(text, --editpos);
888 kbd_spellchar(text[c]);
889 }
890#if CONFIG_CODEC == SWCODEC
891 else if (global_settings.talk_menu)
892 pcmbuf_beep(1000, 150, 1500);
893#endif
894 }
895 else
896#endif /* KBD_MODES */
897 { 853 {
898#ifdef KBD_MORSE_INPUT
899 if (morse_mode)
900 break;
901#endif
902 if (--pm->x < 0)
903 {
904#ifndef KBD_PAGE_FLIP 854#ifndef KBD_PAGE_FLIP
905 /* no dedicated flip key - flip page on wrap */ 855 /* no dedicated flip key - flip page on wrap */
906 if (--pm->page < 0) 856 if (--pm->page < 0)
907 pm->page = pm->pages - 1; 857 pm->page = pm->pages - 1;
908#endif 858#endif
909 pm->x = pm->max_chars - 1; 859 pm->x = pm->max_chars - 1;
910 }
911
912 ch = get_kbd_ch(pm);
913 kbd_spellchar(ch);
914 } 860 }
861
862 ch = get_kbd_ch(pm);
863 kbd_spellchar(ch);
915 break; 864 break;
916 865
917 case ACTION_KBD_DOWN: 866 case ACTION_KBD_DOWN:
@@ -1019,7 +968,6 @@ int kbd_input(char* text, int buflen)
1019#endif /* KBD_MORSE_INPUT */ 968#endif /* KBD_MORSE_INPUT */
1020 969
1021 case ACTION_KBD_SELECT: 970 case ACTION_KBD_SELECT:
1022 case ACTION_KBD_SELECT_REM:
1023#ifdef KBD_MORSE_INPUT 971#ifdef KBD_MORSE_INPUT
1024#ifdef KBD_MODES 972#ifdef KBD_MODES
1025 if (morse_mode && !pm->line_edit) 973 if (morse_mode && !pm->line_edit)
@@ -1166,6 +1114,7 @@ int kbd_input(char* text, int buflen)
1166 if (global_settings.talk_menu) /* voice UI? */ 1114 if (global_settings.talk_menu) /* voice UI? */
1167 talk_spell(text, false); /* speak revised text */ 1115 talk_spell(text, false); /* speak revised text */
1168 break; 1116 break;
1117#endif /* !defined (KBD_MODES) || defined (KBD_CURSOR_KEYS) */
1169 1118
1170 case ACTION_KBD_CURSOR_RIGHT: 1119 case ACTION_KBD_CURSOR_RIGHT:
1171 pm->hangul = false; 1120 pm->hangul = false;
@@ -1194,7 +1143,6 @@ int kbd_input(char* text, int buflen)
1194 pcmbuf_beep(1000, 150, 1500); 1143 pcmbuf_beep(1000, 150, 1500);
1195#endif 1144#endif
1196 break; 1145 break;
1197#endif /* !defined (KBD_MODES) || defined (KBD_CURSOR_KEYS) */
1198 1146
1199 case BUTTON_NONE: 1147 case BUTTON_NONE:
1200#ifdef KBD_MORSE_INPUT 1148#ifdef KBD_MORSE_INPUT