Hi all,

Currently for all models, the Morse Code input method can only type
lowercased letters. Here I provide a patch which enables people to switch
between lower cased and upper cased letters, I implemented this for Fuze and
Fuze v2, and further fixes will be provided soon (or someone else want to
add some key mapping options into your keymaps?)

The patch (also attached):

Index: apps/action.h
===================================================================
--- apps/action.h (revision 25886)
+++ apps/action.h (working copy)
@@ -239,6 +239,7 @@
     ACTION_KBD_DOWN,
     ACTION_KBD_MORSE_INPUT,
     ACTION_KBD_MORSE_SELECT,
+    ACTION_KBD_MORSE_CASE_SWITCH,

 #ifdef HAVE_TOUCHSCREEN
     /* the following are helper actions for touchscreen targets,
Index: apps/recorder/keyboard.c
===================================================================
--- apps/recorder/keyboard.c (revision 25886)
+++ apps/recorder/keyboard.c (working copy)
@@ -148,6 +148,7 @@

 #ifdef HAVE_MORSE_INPUT
 /* FIXME: We should put this to a configuration file. */
+static bool morse_uppercase = false;
 static const char *morse_alphabets =
     "abcdefghijklmnopqrstuvwxyz1234567890,.?-@ ";
 static const unsigned char morse_codes[] = {
@@ -573,6 +574,11 @@
                         state.morse_code |= 0x01;
                 }
                 break;
+           case ACTION_KBD_MORSE_CASE_SWITCH:
+     if (state.morse_mode) {
+       morse_uppercase = !morse_uppercase;
+     }
+     break;
 #endif /* HAVE_MORSE_INPUT */

             case ACTION_KBD_SELECT:
@@ -626,7 +632,8 @@

                     /* turn off hangul input */
                     state.hangul = false;
-                    kbd_inschar(&state, morse_alphabets[j]);
+                    kbd_inschar(&state,
+ morse_uppercase ? toupper(morse_alphabets[j]) : morse_alphabets[j]);
                 }
 #endif /* HAVE_MORSE_INPUT */
                 break;
@@ -862,6 +869,10 @@
             int morse_code;

             outline[0] = morse_alphabets[i];
+
+    if (morse_uppercase)
+      outline[0] = toupper(outline[0]);
+
             sc->putsxy(x, y, outline);

             morse_code = morse_codes[i];
Index: apps/keymaps/keymap-fuze.c
===================================================================
--- apps/keymaps/keymap-fuze.c (revision 25886)
+++ apps/keymaps/keymap-fuze.c (working copy)
@@ -269,6 +269,7 @@
     { 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 },
+    { ACTION_KBD_MORSE_CASE_SWITCH, BUTTON_HOME, BUTTON_NONE },

     LAST_ITEM_IN_LIST
 }; /* button_context_keyboard */



-- 
Best Wishes!

Wenyu 'Hearson' Zhang <[email protected] / [email protected]>
Department of Computer Science
College of Science
Purdue University 2012
Index: apps/action.h
===================================================================
--- apps/action.h	(revision 25886)
+++ apps/action.h	(working copy)
@@ -239,6 +239,7 @@
     ACTION_KBD_DOWN,
     ACTION_KBD_MORSE_INPUT,
     ACTION_KBD_MORSE_SELECT,
+    ACTION_KBD_MORSE_CASE_SWITCH,
     
 #ifdef HAVE_TOUCHSCREEN
     /* the following are helper actions for touchscreen targets,
Index: apps/recorder/keyboard.c
===================================================================
--- apps/recorder/keyboard.c	(revision 25886)
+++ apps/recorder/keyboard.c	(working copy)
@@ -148,6 +148,7 @@
 
 #ifdef HAVE_MORSE_INPUT
 /* FIXME: We should put this to a configuration file. */
+static bool morse_uppercase = false;
 static const char *morse_alphabets =
     "abcdefghijklmnopqrstuvwxyz1234567890,.?-@ ";
 static const unsigned char morse_codes[] = {
@@ -573,6 +574,11 @@
                         state.morse_code |= 0x01;
                 }
                 break;
+           case ACTION_KBD_MORSE_CASE_SWITCH:
+	     if (state.morse_mode) {
+	       morse_uppercase = !morse_uppercase;
+	     }
+	     break;
 #endif /* HAVE_MORSE_INPUT */
 
             case ACTION_KBD_SELECT:
@@ -626,7 +632,8 @@
 
                     /* turn off hangul input */
                     state.hangul = false;
-                    kbd_inschar(&state, morse_alphabets[j]);
+                    kbd_inschar(&state,
+				morse_uppercase ? toupper(morse_alphabets[j]) : morse_alphabets[j]);
                 }
 #endif /* HAVE_MORSE_INPUT */
                 break;
@@ -862,6 +869,10 @@
             int morse_code;
 
             outline[0] = morse_alphabets[i];
+	    
+	    if (morse_uppercase)
+	      outline[0] = toupper(outline[0]);
+	    
             sc->putsxy(x, y, outline);
 
             morse_code = morse_codes[i];
Index: apps/keymaps/keymap-fuze.c
===================================================================
--- apps/keymaps/keymap-fuze.c	(revision 25886)
+++ apps/keymaps/keymap-fuze.c	(working copy)
@@ -269,6 +269,7 @@
     { 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 },
+    { ACTION_KBD_MORSE_CASE_SWITCH, BUTTON_HOME, BUTTON_NONE },
 
     LAST_ITEM_IN_LIST
 }; /* button_context_keyboard */

Reply via email to