From c9b5fd6588b70f8d675fde40864225c18fc459db Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 12 Feb 2006 10:35:10 +0100 Subject: [PATCH] The "Back" key now restores the original string when pressed while editing a string item --- CONTRIBUTORS | 2 ++ HISTORY | 2 ++ menuitems.c | 14 ++++++++++++-- menuitems.h | 3 ++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 7a65ceea..2a346191 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1718,6 +1718,8 @@ Malte Schr Markus Hahn 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 for updating the Polish OSD texts and the fontosd-iso8859-2.c file diff --git a/HISTORY b/HISTORY index 2a817085..40058bd8 100644 --- a/HISTORY +++ b/HISTORY @@ -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). diff --git a/menuitems.c b/menuitems.c index e2380663..fab13ca4 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.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); diff --git a/menuitems.h b/menuitems.h index ec8e08f1..ac0d7d3c 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.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;