summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS2
-rw-r--r--HISTORY2
-rw-r--r--menuitems.c53
-rw-r--r--menuitems.h4
4 files changed, 43 insertions, 18 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 5ac68c81..b85938f7 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -937,6 +937,8 @@ Rolf Ahrenberg <rahrenbe@cc.hut.fi>
for adding compiler options "-fPIC -g" to all plugins
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 a patch that was used to implement automatic cursor advance when entering text
+ via the numeric keys
Ralf Klueber <ralf.klueber@vodafone.com>
for reporting a bug in cutting a recording if there is only a single editing mark
diff --git a/HISTORY b/HISTORY
index 3e11c0c5..cf0ff2fa 100644
--- a/HISTORY
+++ b/HISTORY
@@ -4208,3 +4208,5 @@ Video Disk Recorder Revision History
- Updated the Estonian OSD texts (thanks to Arthur Konovalov).
- Recordings are now only started if there is at least 300MB free disk space
(suggested by Markus Hahn).
+- When entering text via the numeric keys, the cursor now automatically advances
+ (based on a patch from Rolf Ahrenberg).
diff --git a/menuitems.c b/menuitems.c
index 88e8a50d..455070d1 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.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"
@@ -15,6 +15,8 @@
#include "skins.h"
#include "status.h"
+#define AUTO_ADVANCE_TIMEOUT 1500 // ms before auto advance when entering characters via numeric keys
+
const char *FileNameChars = " abcdefghijklmnopqrstuvwxyz0123456789-.#~,/_@";
// --- cMenuEditItem ---------------------------------------------------------
@@ -262,6 +264,23 @@ void cMenuEditStrItem::SetHelpKeys(void)
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)
{
char buf[1000];
@@ -326,6 +345,13 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
bool SameKey = Key == lastKey;
if (Key != kNone)
lastKey = Key;
+ else if (!newchar && autoAdvanceTimeout.TimedOut()) {
+ AdvancePos();
+ newchar = true;
+ currentChar = NULL;
+ Set();
+ return osContinue;
+ }
switch (Key) {
case kRed: // Switch between upper- and lowercase characters
if (InEditMode()) {
@@ -382,19 +408,7 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
uppercase = isupper(value[pos]);
break;
case kRight|k_Repeat:
- case kRight: 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]);
+ case kRight: AdvancePos();
if (pos == 0)
SetHelpKeys();
break;
@@ -413,15 +427,19 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
value[pos] = toupper(Inc(tolower(value[pos]), NORMALKEY(Key) == kUp));
else
value[pos] = Inc( value[pos], NORMALKEY(Key) == kUp);
- newchar = false;
+ newchar = true;
}
else
return cMenuEditItem::ProcessKey(Key);
break;
+ case k0|k_Repeat ... k9|k_Repeat:
case k0 ... k9: {
- if (!SameKey)
- currentChar = NULL;
if (InEditMode()) {
+ if (!SameKey) {
+ if (!newchar)
+ AdvancePos();
+ currentChar = NULL;
+ }
if (insert && newchar) {
// create a new character in insert mode
if (int(strlen(value)) < length - 1) {
@@ -445,6 +463,7 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
currentChar++;
}
newchar = false;
+ autoAdvanceTimeout.Set(AUTO_ADVANCE_TIMEOUT);
}
else
return cMenuEditItem::ProcessKey(Key);
diff --git a/menuitems.h b/menuitems.h
index bfaf4362..ec8e08f1 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.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
@@ -85,7 +85,9 @@ private:
const char *charMap;
const char *currentChar;
eKeys lastKey;
+ cTimeMs autoAdvanceTimeout;
void SetHelpKeys(void);
+ void AdvancePos(void);
virtual void Set(void);
char Inc(char c, bool Up);
protected: