From 25abe47a3b3ba1e518e96d9c4cbccadeff1bc480 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 16 Mar 2002 14:08:12 +0100 Subject: [PATCH] The 'Left' and 'Right' keys are now used to page up and down in text displays --- HISTORY | 3 +++ menu.c | 22 +++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/HISTORY b/HISTORY index 8a1c9544..41bea83c 100644 --- a/HISTORY +++ b/HISTORY @@ -1103,3 +1103,6 @@ Video Disk Recorder Revision History - Fixed displaying a system message while the replay mode is being shown. - Physically removing a deleted recording if one with the same name shall be deleted again. +- The "Left" and "Right" keys are now used to page up and down in text displays + (like the EPG descriptions or the results of commands executed from the + "Commands" menu). diff --git a/menu.c b/menu.c index 2ffd62ed..a6d51dc8 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.167 2002/03/16 11:29:58 kls Exp $ + * $Id: menu.c 1.168 2002/03/16 14:03:38 kls Exp $ */ #include "menu.h" @@ -933,8 +933,8 @@ public: virtual void Display(int Offset = -1, eDvbColor FgColor = clrWhite, eDvbColor BgColor = clrBackground); bool CanScrollUp(void) { return offset > 0; } bool CanScrollDown(void) { return h + offset < lines; } - void ScrollUp(void); - void ScrollDown(void); + void ScrollUp(bool Page); + void ScrollDown(bool Page); virtual eOSState ProcessKey(eKeys Key); }; @@ -993,20 +993,20 @@ void cMenuTextItem::Display(int Offset, eDvbColor FgColor, eDvbColor BgColor) if (CanScrollDown()) Interface->Write(x + w - 1, y + h - 1, "v", bgColor, fgColor); } -void cMenuTextItem::ScrollUp(void) +void cMenuTextItem::ScrollUp(bool Page) { if (CanScrollUp()) { Clear(); - offset--; + offset = max(offset - (Page ? h : 1), 0); Display(); } } -void cMenuTextItem::ScrollDown(void) +void cMenuTextItem::ScrollDown(bool Page) { if (CanScrollDown()) { Clear(); - offset++; + offset = min(offset + (Page ? h : 1), lines - h); Display(); } } @@ -1014,10 +1014,14 @@ void cMenuTextItem::ScrollDown(void) eOSState cMenuTextItem::ProcessKey(eKeys Key) { switch (Key) { + case kLeft|k_Repeat: + case kLeft: case kUp|k_Repeat: - case kUp: ScrollUp(); break; + case kUp: ScrollUp(NORMALKEY(Key) == kLeft); break; + case kRight|k_Repeat: + case kRight: case kDown|k_Repeat: - case kDown: ScrollDown(); break; + case kDown: ScrollDown(NORMALKEY(Key) == kRight); break; default: return osUnknown; } return osContinue;