Implemented letter input via numeric keys (Easy

This commit is contained in:
Klaus Schmidinger 2006-01-06 16:57:41 +01:00
parent 72e93b614b
commit 9bbd68f357
6 changed files with 95 additions and 22 deletions

View File

@ -1616,3 +1616,6 @@ Gavin Hamill <gdh@acentral.co.uk>
Petri Hintukainen <Petri.Hintukainen@hut.fi> Petri Hintukainen <Petri.Hintukainen@hut.fi>
for suggesting to disable the use of "fadvise" in cUnbufferedFile because there for suggesting to disable the use of "fadvise" in cUnbufferedFile because there
have been several reports that it causes more problems than it solves have been several reports that it causes more problems than it solves
Marcel Schaeben <mts280@gmx.de>
for his "Easy Input" patch

View File

@ -4118,3 +4118,6 @@ Video Disk Recorder Revision History
Fischer). Fischer).
- The "flags" of a timer are now handled as an unsigned integer value. In order - 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. 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).

4
MANUAL
View File

@ -30,6 +30,10 @@ Version 1.2
are used to enter the data, and the Left key can be used to delete the last are used to enter the data, and the Left key can be used to delete the last
entered digit. 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 If your remote control provides additional keys, they can be used for the
following functions: following functions:

60
i18n.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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: * Translations provided by:
* *
@ -4083,26 +4083,48 @@ const tI18nPhrase Phrases[] = {
"ManTirOnsTorFreLørSøn", "ManTirOnsTorFreLørSøn",
}, },
// The allowed characters in strings: // The allowed characters in strings:
{ " abcdefghijklmnopqrstuvwxyz0123456789-.#~", { " abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@",
" aäbcdefghijklmnoöpqrstuüvwxyz0123456789-.#~", " aäbcdefghijklmnoöpqrstuüvwxyz0123456789-.#~,/_@",
" abcèdefghijklmnopqrs¹tuvwxyz¾0123456789-.#~", " abcèdefghijklmnopqrs¹tuvwxyz¾0123456789-.#~,/_@",
" aàbcdeéèfghiîjklmnopqrstuùvwxyz0123456789-.#~", " aàbcdeéèfghiîjklmnopqrstuùvwxyz0123456789-.#~,/_@",
" abcdefghijklmnopqrstuvwxyz0123456789-.#~áäàïóöòúüù", " abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@áäàïóöòúüù",
"",// TODO "",// TODO
" aàbcçdeéèêfghiîjklmnoôpqrstuùûvwxyz0123456789-.#~", " aàbcçdeéèêfghiîjklmnoôpqrstuùûvwxyz0123456789-.#~,/_@",
"",// TODO "",// TODO
" abcdefghijklmnopqrstuvwxyzåäö0123456789-.#~", " abcdefghijklmnopqrstuvwxyzåäö0123456789-.#~,/_@",
" abcdefghijklmnopqrstuvwxyz0123456789-.#~", " abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@",
" aábcdeéfghiíjklmnñoópqrstuúvwxyz0123456789-.#~", " aábcdeéfghiíjklmnñoópqrstuúvwxyz0123456789-.#~,/_@",
" áÜâãäåÝæçÞèéßêëìíîïüðñóòôõýö÷øùþ0123456789-.#~abcdefghijklmnopqrstuvwxyz", " áÜâãäåÝæçÞèéßêëìíîïüðñóòôõýö÷øùþ0123456789-.#~,/_@abcdefghijklmnopqrstuvwxyz",
" abcdefghijklmnopqrstuvwxyzåäö0123456789-.#~", " abcdefghijklmnopqrstuvwxyzåäö0123456789-.#~,/_@",
" aãâbcdefghiîjklmnopqrsºtþuvwxyz0123456789-.#~", " aãâbcdefghiîjklmnopqrsºtþuvwxyz0123456789-.#~,/_@",
" aábcdeéfghiíjklmnoóöpqrstuúüvwxyz0123456789-.,#~", " aábcdeéfghiíjklmnoóöpqrstuúüvwxyz0123456789-.,#~,/_@",
" aàbcçdeéèfghiíjklmnoòpqrstuúvwxyz0123456789-.,#~_·", " aàbcçdeéèfghiíjklmnoòpqrstuúvwxyz0123456789-.,#~,/_@·",
" abcdefghijklmnopqrstuvwxyzÐÑÒÓÔÕñÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìîï0123456789-.#~", " abcdefghijklmnopqrstuvwxyzÐÑÒÓÔÕñÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìîï0123456789-.#~,/_@",
" abcèædðefghijklmnopqrs¹tuvwxyz¾0123456789-.#~", // hrv " abcèædðefghijklmnopqrs¹tuvwxyz¾0123456789-.#~,/_@", // hrv
" abcdefghijklmnopqrsðzþtuvwõäöüxyå0123456789-.#~", " abcdefghijklmnopqrsðzþtuvwõäöüxyå0123456789-.#~,/_@",
" abcdefghijklmnopqrstuvwxyzæøå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 keys:
{ "Learning Remote Control Keys", { "Learning Remote Control Keys",

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "menuitems.h"
@ -15,7 +15,7 @@
#include "skins.h" #include "skins.h"
#include "status.h" #include "status.h"
const char *FileNameChars = " abcdefghijklmnopqrstuvwxyz0123456789-.#~"; const char *FileNameChars = " abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@";
// --- cMenuEditItem --------------------------------------------------------- // --- cMenuEditItem ---------------------------------------------------------
@ -243,6 +243,9 @@ cMenuEditStrItem::cMenuEditStrItem(const char *Name, char *Value, int Length, co
pos = -1; pos = -1;
insert = uppercase = false; insert = uppercase = false;
newchar = true; newchar = true;
charMap = tr(" 0\t-.#~,/_@1\tabc2\tdef3\tghi4\tjkl5\tmno6\tpqrs7\ttuv8\twxyz9");
currentChar = NULL;
lastKey = kNone;
Set(); Set();
} }
@ -320,6 +323,9 @@ char cMenuEditStrItem::Inc(char c, bool Up)
eOSState cMenuEditStrItem::ProcessKey(eKeys Key) eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
{ {
bool SameKey = Key == lastKey;
if (Key != kNone)
lastKey = Key;
switch (Key) { switch (Key) {
case kRed: // Switch between upper- and lowercase characters case kRed: // Switch between upper- and lowercase characters
if (InEditMode()) { if (InEditMode()) {
@ -412,6 +418,38 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
else else
return cMenuEditItem::ProcessKey(Key); return cMenuEditItem::ProcessKey(Key);
break; 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()) { case kOk: if (InEditMode()) {
pos = -1; pos = -1;
newchar = true; newchar = true;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __MENUITEMS_H
@ -82,6 +82,9 @@ private:
char *allowed; char *allowed;
int pos; int pos;
bool insert, newchar, uppercase; bool insert, newchar, uppercase;
const char *charMap;
const char *currentChar;
eKeys lastKey;
void SetHelpKeys(void); void SetHelpKeys(void);
virtual void Set(void); virtual void Set(void);
char Inc(char c, bool Up); char Inc(char c, bool Up);