mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
When entering text via the numeric keys, the cursor now automatically advances
This commit is contained in:
parent
d1668d768c
commit
b2989899c0
@ -937,6 +937,8 @@ Rolf Ahrenberg <rahrenbe@cc.hut.fi>
|
|||||||
for adding compiler options "-fPIC -g" to all plugins
|
for adding compiler options "-fPIC -g" to all plugins
|
||||||
for adding a leading '0' to the day in the DayDateTime() function
|
for adding a leading '0' to the day in the DayDateTime() function
|
||||||
for reporting a crash in the Schedule menu with events that have no title
|
for reporting a crash in the Schedule menu with events that have no title
|
||||||
|
for a patch that was used to implement automatic cursor advance when entering text
|
||||||
|
via the numeric keys
|
||||||
|
|
||||||
Ralf Klueber <ralf.klueber@vodafone.com>
|
Ralf Klueber <ralf.klueber@vodafone.com>
|
||||||
for reporting a bug in cutting a recording if there is only a single editing mark
|
for reporting a bug in cutting a recording if there is only a single editing mark
|
||||||
|
2
HISTORY
2
HISTORY
@ -4208,3 +4208,5 @@ Video Disk Recorder Revision History
|
|||||||
- Updated the Estonian OSD texts (thanks to Arthur Konovalov).
|
- Updated the Estonian OSD texts (thanks to Arthur Konovalov).
|
||||||
- Recordings are now only started if there is at least 300MB free disk space
|
- Recordings are now only started if there is at least 300MB free disk space
|
||||||
(suggested by Markus Hahn).
|
(suggested by Markus Hahn).
|
||||||
|
- When entering text via the numeric keys, the cursor now automatically advances
|
||||||
|
(based on a patch from Rolf Ahrenberg).
|
||||||
|
53
menuitems.c
53
menuitems.c
@ -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.29 2006/01/07 15:37:03 kls Exp $
|
* $Id: menuitems.c 1.30 2006/01/21 12:27:14 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "menuitems.h"
|
#include "menuitems.h"
|
||||||
@ -15,6 +15,8 @@
|
|||||||
#include "skins.h"
|
#include "skins.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
|
|
||||||
|
#define AUTO_ADVANCE_TIMEOUT 1500 // ms before auto advance when entering characters via numeric keys
|
||||||
|
|
||||||
const char *FileNameChars = " abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@";
|
const char *FileNameChars = " abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@";
|
||||||
|
|
||||||
// --- cMenuEditItem ---------------------------------------------------------
|
// --- cMenuEditItem ---------------------------------------------------------
|
||||||
@ -262,6 +264,23 @@ void cMenuEditStrItem::SetHelpKeys(void)
|
|||||||
cSkinDisplay::Current()->SetButtons(NULL);
|
cSkinDisplay::Current()->SetButtons(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cMenuEditStrItem::AdvancePos(void)
|
||||||
|
{
|
||||||
|
if (pos < length - 2 && pos < int(strlen(value)) ) {
|
||||||
|
if (++pos >= int(strlen(value))) {
|
||||||
|
if (pos >= 2 && value[pos - 1] == ' ' && value[pos - 2] == ' ')
|
||||||
|
pos--; // allow only two blanks at the end
|
||||||
|
else {
|
||||||
|
value[pos] = ' ';
|
||||||
|
value[pos + 1] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newchar = true;
|
||||||
|
if (!insert && isalpha(value[pos]))
|
||||||
|
uppercase = isupper(value[pos]);
|
||||||
|
}
|
||||||
|
|
||||||
void cMenuEditStrItem::Set(void)
|
void cMenuEditStrItem::Set(void)
|
||||||
{
|
{
|
||||||
char buf[1000];
|
char buf[1000];
|
||||||
@ -326,6 +345,13 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
|
|||||||
bool SameKey = Key == lastKey;
|
bool SameKey = Key == lastKey;
|
||||||
if (Key != kNone)
|
if (Key != kNone)
|
||||||
lastKey = Key;
|
lastKey = Key;
|
||||||
|
else if (!newchar && autoAdvanceTimeout.TimedOut()) {
|
||||||
|
AdvancePos();
|
||||||
|
newchar = true;
|
||||||
|
currentChar = NULL;
|
||||||
|
Set();
|
||||||
|
return osContinue;
|
||||||
|
}
|
||||||
switch (Key) {
|
switch (Key) {
|
||||||
case kRed: // Switch between upper- and lowercase characters
|
case kRed: // Switch between upper- and lowercase characters
|
||||||
if (InEditMode()) {
|
if (InEditMode()) {
|
||||||
@ -382,19 +408,7 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
|
|||||||
uppercase = isupper(value[pos]);
|
uppercase = isupper(value[pos]);
|
||||||
break;
|
break;
|
||||||
case kRight|k_Repeat:
|
case kRight|k_Repeat:
|
||||||
case kRight: if (pos < length - 2 && pos < int(strlen(value)) ) {
|
case kRight: AdvancePos();
|
||||||
if (++pos >= int(strlen(value))) {
|
|
||||||
if (pos >= 2 && value[pos - 1] == ' ' && value[pos - 2] == ' ')
|
|
||||||
pos--; // allow only two blanks at the end
|
|
||||||
else {
|
|
||||||
value[pos] = ' ';
|
|
||||||
value[pos + 1] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newchar = true;
|
|
||||||
if (!insert && isalpha(value[pos]))
|
|
||||||
uppercase = isupper(value[pos]);
|
|
||||||
if (pos == 0)
|
if (pos == 0)
|
||||||
SetHelpKeys();
|
SetHelpKeys();
|
||||||
break;
|
break;
|
||||||
@ -413,15 +427,19 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
|
|||||||
value[pos] = toupper(Inc(tolower(value[pos]), NORMALKEY(Key) == kUp));
|
value[pos] = toupper(Inc(tolower(value[pos]), NORMALKEY(Key) == kUp));
|
||||||
else
|
else
|
||||||
value[pos] = Inc( value[pos], NORMALKEY(Key) == kUp);
|
value[pos] = Inc( value[pos], NORMALKEY(Key) == kUp);
|
||||||
newchar = false;
|
newchar = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return cMenuEditItem::ProcessKey(Key);
|
return cMenuEditItem::ProcessKey(Key);
|
||||||
break;
|
break;
|
||||||
|
case k0|k_Repeat ... k9|k_Repeat:
|
||||||
case k0 ... k9: {
|
case k0 ... k9: {
|
||||||
if (!SameKey)
|
|
||||||
currentChar = NULL;
|
|
||||||
if (InEditMode()) {
|
if (InEditMode()) {
|
||||||
|
if (!SameKey) {
|
||||||
|
if (!newchar)
|
||||||
|
AdvancePos();
|
||||||
|
currentChar = NULL;
|
||||||
|
}
|
||||||
if (insert && newchar) {
|
if (insert && newchar) {
|
||||||
// create a new character in insert mode
|
// create a new character in insert mode
|
||||||
if (int(strlen(value)) < length - 1) {
|
if (int(strlen(value)) < length - 1) {
|
||||||
@ -445,6 +463,7 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
|
|||||||
currentChar++;
|
currentChar++;
|
||||||
}
|
}
|
||||||
newchar = false;
|
newchar = false;
|
||||||
|
autoAdvanceTimeout.Set(AUTO_ADVANCE_TIMEOUT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return cMenuEditItem::ProcessKey(Key);
|
return cMenuEditItem::ProcessKey(Key);
|
||||||
|
@ -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.15 2006/01/06 15:16:25 kls Exp $
|
* $Id: menuitems.h 1.16 2006/01/21 10:45:55 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __MENUITEMS_H
|
#ifndef __MENUITEMS_H
|
||||||
@ -85,7 +85,9 @@ private:
|
|||||||
const char *charMap;
|
const char *charMap;
|
||||||
const char *currentChar;
|
const char *currentChar;
|
||||||
eKeys lastKey;
|
eKeys lastKey;
|
||||||
|
cTimeMs autoAdvanceTimeout;
|
||||||
void SetHelpKeys(void);
|
void SetHelpKeys(void);
|
||||||
|
void AdvancePos(void);
|
||||||
virtual void Set(void);
|
virtual void Set(void);
|
||||||
char Inc(char c, bool Up);
|
char Inc(char c, bool Up);
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
Reference in New Issue
Block a user