The "Back" key now restores the original string when pressed while editing a string item

This commit is contained in:
Klaus Schmidinger 2006-02-12 10:35:10 +01:00
parent 5820beed02
commit c9b5fd6588
4 changed files with 18 additions and 3 deletions

View File

@ -1718,6 +1718,8 @@ Malte Schr
Markus Hahn <mhahn@reel-multimedia.com>
for suggesting to only start recordings if there is at least 300MB free disk space
for suggesting that the "Back" key should restore the original string when pressed
while editing a string item
Jaroslaw Swierczynski <swiergot@gmail.com>
for updating the Polish OSD texts and the fontosd-iso8859-2.c file

View File

@ -4321,3 +4321,5 @@ Video Disk Recorder Revision History
- Removed an unnecessary toFile->SetReadAhead() from cutter.c (thanks to Artur
Skawina).
- The "Back" key now restores the original string when pressed while editing a
string item (suggested by Markus Hahn).

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.31 2006/02/04 12:47:08 kls Exp $
* $Id: menuitems.c 1.32 2006/02/12 10:31:08 kls Exp $
*/
#include "menuitems.h"
@ -239,6 +239,7 @@ eOSState cMenuEditChrItem::ProcessKey(eKeys Key)
cMenuEditStrItem::cMenuEditStrItem(const char *Name, char *Value, int Length, const char *Allowed)
:cMenuEditItem(Name)
{
orgValue = NULL;
value = Value;
length = Length;
allowed = strdup(Allowed);
@ -253,6 +254,7 @@ cMenuEditStrItem::cMenuEditStrItem(const char *Name, char *Value, int Length, co
cMenuEditStrItem::~cMenuEditStrItem()
{
free(orgValue);
free(allowed);
}
@ -409,8 +411,10 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
break;
case kRight|k_Repeat:
case kRight: AdvancePos();
if (pos == 0)
if (pos == 0) {
orgValue = strdup(value);
SetHelpKeys();
}
break;
case kUp|k_Repeat:
case kUp:
@ -469,7 +473,13 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
return cMenuEditItem::ProcessKey(Key);
}
break;
case kBack:
case kOk: if (InEditMode()) {
if (Key == kBack && orgValue) {
strcpy(value, orgValue);
free(orgValue);
orgValue = NULL;
}
pos = -1;
newchar = true;
stripspace(value);

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.16 2006/01/21 10:45:55 kls Exp $
* $Id: menuitems.h 1.17 2006/02/12 10:22:03 kls Exp $
*/
#ifndef __MENUITEMS_H
@ -77,6 +77,7 @@ public:
class cMenuEditStrItem : public cMenuEditItem {
private:
char *orgValue;
char *value;
int length;
char *allowed;