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>
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 <mts280@gmx.de>
for his "Easy Input" patch

View File

@@ -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).

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
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:

60
i18n.c
View File

@@ -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<EFBFBD>rS<EFBFBD>n",
},
// The allowed characters in strings:
{ " abcdefghijklmnopqrstuvwxyz0123456789-.#~",
" a<>bcdefghijklmno<6E>pqrstu<74>vwxyz0123456789-.#~",
" abc<62>defghijklmnopqrs<72>tuvwxyz<79>0123456789-.#~",
" a<>bcde<64><65>fghi<68>jklmnopqrstu<74>vwxyz0123456789-.#~",
" abcdefghijklmnopqrstuvwxyz0123456789-.#~<7E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
{ " abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@",
" a<>bcdefghijklmno<6E>pqrstu<74>vwxyz0123456789-.#~,/_@",
" abc<62>defghijklmnopqrs<72>tuvwxyz<79>0123456789-.#~,/_@",
" a<>bcde<64><65>fghi<68>jklmnopqrstu<74>vwxyz0123456789-.#~,/_@",
" abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
"",// TODO
" a<>bc<62>de<64><65><EFBFBD>fghi<68>jklmno<6E>pqrstu<74><75>vwxyz0123456789-.#~",
" a<>bc<62>de<64><65><EFBFBD>fghi<68>jklmno<6E>pqrstu<74><75>vwxyz0123456789-.#~,/_@",
"",// TODO
" abcdefghijklmnopqrstuvwxyz<79><7A><EFBFBD>0123456789-.#~",
" abcdefghijklmnopqrstuvwxyz0123456789-.#~",
" a<>bcde<64>fghi<68>jklmn<6D>o<EFBFBD>pqrstu<74>vwxyz0123456789-.#~",
" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0123456789-.#~abcdefghijklmnopqrstuvwxyz",
" abcdefghijklmnopqrstuvwxyz<79><7A><EFBFBD>0123456789-.#~",
" a<><61>bcdefghi<68>jklmnopqrs<72>t<EFBFBD>uvwxyz0123456789-.#~",
" a<>bcde<64>fghi<68>jklmno<6E><6F>pqrstu<74><75>vwxyz0123456789-.,#~",
" a<>bc<62>de<64><65>fghi<68>jklmno<6E>pqrstu<74>vwxyz0123456789-.,#~_<EFBFBD>",
" abcdefghijklmnopqrstuvwxyz<79><7A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0123456789-.#~",
" abc<62><63>d<EFBFBD>efghijklmnopqrs<72>tuvwxyz<79>0123456789-.#~", // hrv
" abcdefghijklmnopqrs<72>z<EFBFBD>tuvw<76><77><EFBFBD><EFBFBD>xy<78>0123456789-.#~",
" abcdefghijklmnopqrstuvwxyz<79><7A><EFBFBD>0123456789-.#~",
" abcdefghijklmnopqrstuvwxyz<79><7A><EFBFBD>0123456789-.#~,/_@",
" abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@",
" a<>bcde<64>fghi<68>jklmn<6D>o<EFBFBD>pqrstu<74>vwxyz0123456789-.#~,/_@",
" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0123456789-.#~,/_@abcdefghijklmnopqrstuvwxyz",
" abcdefghijklmnopqrstuvwxyz<79><7A><EFBFBD>0123456789-.#~,/_@",
" a<><61>bcdefghi<68>jklmnopqrs<72>t<EFBFBD>uvwxyz0123456789-.#~,/_@",
" a<>bcde<64>fghi<68>jklmno<6E><6F>pqrstu<74><75>vwxyz0123456789-.,#~,/_@",
" a<>bc<62>de<64><65>fghi<68>jklmno<6E>pqrstu<74>vwxyz0123456789-.,#~,/_@<EFBFBD>",
" abcdefghijklmnopqrstuvwxyz<79><7A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0123456789-.#~,/_@",
" abc<62><63>d<EFBFBD>efghijklmnopqrs<72>tuvwxyz<79>0123456789-.#~,/_@", // hrv
" abcdefghijklmnopqrs<72>z<EFBFBD>tuvw<76><77><EFBFBD><EFBFBD>xy<78>0123456789-.#~,/_@",
" abcdefghijklmnopqrstuvwxyz<79><7A><EFBFBD>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<EFBFBD>2\tdef3\tghi4\tjkl5\tmno<EFBFBD>6\tpqrs7\ttuv<EFBFBD>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",

View File

@@ -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;

View File

@@ -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);