From 9bbd68f357f3cab1be0031bd6f72e52143b2a918 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 6 Jan 2006 16:57:41 +0100 Subject: Implemented letter input via numeric keys (Easy --- CONTRIBUTORS | 3 +++ HISTORY | 3 +++ MANUAL | 4 ++++ i18n.c | 64 ++++++++++++++++++++++++++++++++++++++++-------------------- menuitems.c | 42 +++++++++++++++++++++++++++++++++++++-- menuitems.h | 5 ++++- 6 files changed, 97 insertions(+), 24 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 4dcc7be9..31a0222c 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1616,3 +1616,6 @@ Gavin Hamill Petri Hintukainen for suggesting to disable the use of "fadvise" in cUnbufferedFile because there have been several reports that it causes more problems than it solves + +Marcel Schaeben + for his "Easy Input" patch diff --git a/HISTORY b/HISTORY index 45bb17cd..240f8425 100644 --- a/HISTORY +++ b/HISTORY @@ -4118,3 +4118,6 @@ Video Disk Recorder Revision History Fischer). - The "flags" of a timer are now handled as an unsigned integer value. In order to do this, the interface of cMenuEditBitItem also had to be changed. +- In string entry fields (like, e.g., the file name of a recording) the characters + can now be entered by pressing the numeric keys, the same way as on a + telephone keypad (based on the "Easy Input" patch from Marcel Schaeben). diff --git a/MANUAL b/MANUAL index a823679a..d725a487 100644 --- a/MANUAL +++ b/MANUAL @@ -30,6 +30,10 @@ Version 1.2 are used to enter the data, and the Left key can be used to delete the last entered digit. + In a text input field (like, e.g., the file name of a recording) the characters + can be entered by pressing the numeric keys, the same way as on a telephone + keypad. + If your remote control provides additional keys, they can be used for the following functions: diff --git a/i18n.c b/i18n.c index b6601d8b..f114f25e 100644 --- a/i18n.c +++ b/i18n.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.226 2006/01/05 15:39:56 kls Exp $ + * $Id: i18n.c 1.227 2006/01/06 16:03:41 kls Exp $ * * Translations provided by: * @@ -4083,26 +4083,48 @@ const tI18nPhrase Phrases[] = { "ManTirOnsTorFreLørSøn", }, // The allowed characters in strings: - { " abcdefghijklmnopqrstuvwxyz0123456789-.#~", - " aäbcdefghijklmnoöpqrstuüvwxyz0123456789-.#~", - " abcèdefghijklmnopqrs¹tuvwxyz¾0123456789-.#~", - " aàbcdeéèfghiîjklmnopqrstuùvwxyz0123456789-.#~", - " abcdefghijklmnopqrstuvwxyz0123456789-.#~áäàïóöòúüù", - "",// TODO - " aàbcçdeéèêfghiîjklmnoôpqrstuùûvwxyz0123456789-.#~", - "",// TODO - " abcdefghijklmnopqrstuvwxyzåäö0123456789-.#~", - " abcdefghijklmnopqrstuvwxyz0123456789-.#~", - " aábcdeéfghiíjklmnñoópqrstuúvwxyz0123456789-.#~", - " áÜâãäåÝæçÞèéßêëìíîïüðñóòôõýö÷øùþ0123456789-.#~abcdefghijklmnopqrstuvwxyz", - " abcdefghijklmnopqrstuvwxyzåäö0123456789-.#~", - " aãâbcdefghiîjklmnopqrsºtþuvwxyz0123456789-.#~", - " aábcdeéfghiíjklmnoóöpqrstuúüvwxyz0123456789-.,#~", - " aàbcçdeéèfghiíjklmnoòpqrstuúvwxyz0123456789-.,#~_·", - " abcdefghijklmnopqrstuvwxyzÐÑÒÓÔÕñÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìîï0123456789-.#~", - " abcèædðefghijklmnopqrs¹tuvwxyz¾0123456789-.#~", // hrv - " abcdefghijklmnopqrsðzþtuvwõäöüxyå0123456789-.#~", - " abcdefghijklmnopqrstuvwxyzæøå0123456789-.#~", + { " abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@", + " aäbcdefghijklmnoöpqrstuüvwxyz0123456789-.#~,/_@", + " abcèdefghijklmnopqrs¹tuvwxyz¾0123456789-.#~,/_@", + " aàbcdeéèfghiîjklmnopqrstuùvwxyz0123456789-.#~,/_@", + " abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@áäàïóöòúüù", + "",// TODO + " aàbcçdeéèêfghiîjklmnoôpqrstuùûvwxyz0123456789-.#~,/_@", + "",// TODO + " abcdefghijklmnopqrstuvwxyzåäö0123456789-.#~,/_@", + " abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@", + " aábcdeéfghiíjklmnñoópqrstuúvwxyz0123456789-.#~,/_@", + " áÜâãäåÝæçÞèéßêëìíîïüðñóòôõýö÷øùþ0123456789-.#~,/_@abcdefghijklmnopqrstuvwxyz", + " abcdefghijklmnopqrstuvwxyzåäö0123456789-.#~,/_@", + " aãâbcdefghiîjklmnopqrsºtþuvwxyz0123456789-.#~,/_@", + " aábcdeéfghiíjklmnoóöpqrstuúüvwxyz0123456789-.,#~,/_@", + " aàbcçdeéèfghiíjklmnoòpqrstuúvwxyz0123456789-.,#~,/_@·", + " abcdefghijklmnopqrstuvwxyzÐÑÒÓÔÕñÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìîï0123456789-.#~,/_@", + " abcèædðefghijklmnopqrs¹tuvwxyz¾0123456789-.#~,/_@", // hrv + " abcdefghijklmnopqrsðzþtuvwõäöüxyå0123456789-.#~,/_@", + " abcdefghijklmnopqrstuvwxyzæøå0123456789-.#~,/_@", + }, + // The character maps for entering letters via the numeric keys: + { " 0\t-.#~,/_@1\tabc2\tdef3\tghi4\tjkl5\tmno6\tpqrs7\ttuv8\twxyz9", + " 0\t-.#~,/_@1\tabcä2\tdef3\tghi4\tjkl5\tmnoö6\tpqrs7\ttuvü8\twxyz9", + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO }, // Learning keys: { "Learning Remote Control Keys", diff --git a/menuitems.c b/menuitems.c index 04b25d58..c19ae6f2 100644 --- a/menuitems.c +++ b/menuitems.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menuitems.c 1.26 2006/01/06 14:19:06 kls Exp $ + * $Id: menuitems.c 1.27 2006/01/06 16:26:05 kls Exp $ */ #include "menuitems.h" @@ -15,7 +15,7 @@ #include "skins.h" #include "status.h" -const char *FileNameChars = " abcdefghijklmnopqrstuvwxyz0123456789-.#~"; +const char *FileNameChars = " abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@"; // --- cMenuEditItem --------------------------------------------------------- @@ -243,6 +243,9 @@ cMenuEditStrItem::cMenuEditStrItem(const char *Name, char *Value, int Length, co pos = -1; insert = uppercase = false; newchar = true; + charMap = tr(" 0\t-.#~,/_@1\tabc2\tdef3\tghi4\tjkl5\tmno6\tpqrs7\ttuv8\twxyz9"); + currentChar = NULL; + lastKey = kNone; Set(); } @@ -320,6 +323,9 @@ char cMenuEditStrItem::Inc(char c, bool Up) eOSState cMenuEditStrItem::ProcessKey(eKeys Key) { + bool SameKey = Key == lastKey; + if (Key != kNone) + lastKey = Key; switch (Key) { case kRed: // Switch between upper- and lowercase characters if (InEditMode()) { @@ -412,6 +418,38 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key) else return cMenuEditItem::ProcessKey(Key); break; + case k0 ... k9: { + if (!SameKey) + currentChar = NULL; + if (InEditMode()) { + if (insert && newchar) { + // create a new character in insert mode + if (int(strlen(value)) < length - 1) { + memmove(value + pos + 1, value + pos, strlen(value) - pos + 1); + value[pos] = ' '; + } + } + if (!currentChar || !*currentChar || *currentChar == '\t') { + // find the beginning of the character map entry for Key + int n = Key - k0; + currentChar = charMap; + while (n > 0 && *currentChar) { + if (*currentChar++ == '\t') + n--; + } + } + if (*currentChar && *currentChar != '\t') { + value[pos] = *currentChar; + if (uppercase) + value[pos] = toupper(value[pos]); + currentChar++; + } + newchar = false; + } + else + return cMenuEditItem::ProcessKey(Key); + } + break; case kOk: if (InEditMode()) { pos = -1; newchar = true; diff --git a/menuitems.h b/menuitems.h index ce252b1e..bfaf4362 100644 --- a/menuitems.h +++ b/menuitems.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menuitems.h 1.14 2006/01/06 14:19:12 kls Exp $ + * $Id: menuitems.h 1.15 2006/01/06 15:16:25 kls Exp $ */ #ifndef __MENUITEMS_H @@ -82,6 +82,9 @@ private: char *allowed; int pos; bool insert, newchar, uppercase; + const char *charMap; + const char *currentChar; + eKeys lastKey; void SetHelpKeys(void); virtual void Set(void); char Inc(char c, bool Up); -- cgit v1.2.3