From 806aeb3c07dafdc92a2028d3600d2a0f2a298ef0 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 18 Jun 2005 10:44:30 +0200 Subject: [PATCH] Implemented wrapping around in menu lists --- CONTRIBUTORS | 1 + HISTORY | 4 ++- MANUAL | 7 +++++ config.c | 6 ++-- config.h | 3 +- i18n.c | 23 +++++++++++++- menu.c | 3 +- osdbase.c | 86 +++++++++++++++++++++++++++++++++------------------- 8 files changed, 95 insertions(+), 38 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 38488403..b1edf4d7 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1298,6 +1298,7 @@ Laurence Abbott Patrick Gleichmann for fixing the default quality value when grabbing a JPEG image for suggestiong a modified page scrolling behaviour + for suggesting wrapping around in menu lists Achim Tuffentsammer for reporting a crash in case a plugin needs to issue an error message before the diff --git a/HISTORY b/HISTORY index 5ddc6a73..f76eff9f 100644 --- a/HISTORY +++ b/HISTORY @@ -3613,8 +3613,10 @@ Video Disk Recorder Revision History - Modified cEITScanner::Process() so that it works on systems with only budget cards or a mix of DVB-S, DVB-C or DVB-T cards. -2005-06-17: Version 1.3.27 +2005-06-18: Version 1.3.27 - Fixed handling 'page down', which was broken in version 1.3.26 (thanks to Udo Richter). - Modified page scrolling behaviour (based on a suggestion by Patrick Gleichmann). +- The new setup option "OSD/Scroll wraps" can be used to activate wrapping around + in menu lists (based on a suggestion by Patrick Gleichmann). diff --git a/MANUAL b/MANUAL index d2bb8e4e..532e954e 100644 --- a/MANUAL +++ b/MANUAL @@ -501,6 +501,13 @@ Version 1.2 will be at the top (bottom) of that page (this mode allows for faster scrolling through long lists). + Scroll wraps = no no = when the end (beginning) of a list is reached while + moving the cursor through it, the cursor stays at the + last (first) line of the list + yes = the cursor "wraps around" and moves from the last + (first) line of the list directly to the first (last) + one. + Sort timers = yes Turns sorting the timers in the "Timers" menu on/off. Timers are sorted by ascending start times, with the first one being the next timer that will start. diff --git a/config.c b/config.c index 971f1671..88457779 100644 --- a/config.c +++ b/config.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.c 1.133 2005/02/20 12:52:59 kls Exp $ + * $Id: config.c 1.134 2005/06/18 10:30:02 kls Exp $ */ #include "config.h" @@ -250,6 +250,7 @@ cSetup::cSetup(void) PrimaryDVB = 1; ShowInfoOnChSwitch = 1; MenuScrollPage = 1; + MenuScrollWrap = 0; MarkInstantRecord = 1; strcpy(NameInstantRecord, "TITLE EPISODE"); InstantRecordTime = 180; @@ -407,6 +408,7 @@ bool cSetup::Parse(const char *Name, const char *Value) else if (!strcasecmp(Name, "PrimaryDVB")) PrimaryDVB = atoi(Value); else if (!strcasecmp(Name, "ShowInfoOnChSwitch")) ShowInfoOnChSwitch = atoi(Value); else if (!strcasecmp(Name, "MenuScrollPage")) MenuScrollPage = atoi(Value); + else if (!strcasecmp(Name, "MenuScrollWrap")) MenuScrollWrap = atoi(Value); else if (!strcasecmp(Name, "MarkInstantRecord")) MarkInstantRecord = atoi(Value); else if (!strcasecmp(Name, "NameInstantRecord")) strn0cpy(NameInstantRecord, Value, MaxFileName); else if (!strcasecmp(Name, "InstantRecordTime")) InstantRecordTime = atoi(Value); @@ -470,7 +472,7 @@ bool cSetup::Save(void) Store("OSDTheme", OSDTheme); Store("PrimaryDVB", PrimaryDVB); Store("ShowInfoOnChSwitch", ShowInfoOnChSwitch); - Store("MenuScrollPage", MenuScrollPage); + Store("MenuScrollWrap", MenuScrollWrap); Store("MarkInstantRecord", MarkInstantRecord); Store("NameInstantRecord", NameInstantRecord); Store("InstantRecordTime", InstantRecordTime); diff --git a/config.h b/config.h index b23a6921..439e8f03 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.220 2005/06/12 15:06:19 kls Exp $ + * $Id: config.h 1.221 2005/06/18 10:29:25 kls Exp $ */ #ifndef __CONFIG_H @@ -211,6 +211,7 @@ public: int PrimaryDVB; int ShowInfoOnChSwitch; int MenuScrollPage; + int MenuScrollWrap; int MarkInstantRecord; char NameInstantRecord[MaxFileName]; int InstantRecordTime; diff --git a/i18n.c b/i18n.c index e5358d24..1bc798b0 100644 --- a/i18n.c +++ b/i18n.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.194 2005/06/05 11:59:09 kls Exp $ + * $Id: i18n.c 1.195 2005/06/18 10:42:31 kls Exp $ * * Translations provided by: * @@ -2905,6 +2905,27 @@ const tI18nPhrase Phrases[] = { "Lehekülje kerimine", "Rul sider", }, + { "Setup.OSD$Scroll wraps", + "Rundum scrollen", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + }, { "Setup.OSD$Sort timers", "Timer sortieren", "Sortiraj termine", diff --git a/menu.c b/menu.c index 0ca55f50..d9b92b79 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.350 2005/06/05 14:11:54 kls Exp $ + * $Id: menu.c 1.351 2005/06/18 10:31:52 kls Exp $ */ #include "menu.h" @@ -1845,6 +1845,7 @@ void cMenuSetupOSD::Set(void) Add(new cMenuEditIntItem( tr("Setup.OSD$Channel info time (s)"), &data.ChannelInfoTime, 1, 60)); Add(new cMenuEditBoolItem(tr("Setup.OSD$Info on channel switch"), &data.ShowInfoOnChSwitch)); Add(new cMenuEditBoolItem(tr("Setup.OSD$Scroll pages"), &data.MenuScrollPage)); + Add(new cMenuEditBoolItem(tr("Setup.OSD$Scroll wraps"), &data.MenuScrollWrap)); Add(new cMenuEditBoolItem(tr("Setup.OSD$Sort timers"), &data.SortTimers)); Add(new cMenuEditBoolItem(tr("Setup.OSD$Recording directories"), &data.RecordingDirs)); SetCurrent(Get(current)); diff --git a/osdbase.c b/osdbase.c index 711bd4cd..98307cd3 100644 --- a/osdbase.c +++ b/osdbase.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.c 1.19 2005/06/17 15:35:27 kls Exp $ + * $Id: osdbase.c 1.20 2005/06/18 10:30:51 kls Exp $ */ #include "osdbase.h" @@ -261,46 +261,64 @@ bool cOsdMenu::SelectableItem(int idx) void cOsdMenu::CursorUp(void) { - if (current > 0) { - int tmpCurrent = current; - while (--tmpCurrent >= 0 && !SelectableItem(tmpCurrent)) - ; - if (tmpCurrent < 0) - return; - if (tmpCurrent >= first) - DisplayCurrent(false); - current = tmpCurrent; - if (current < first) { - first = Setup.MenuScrollPage ? max(0, current - displayMenuItems + 1) : current; - Display(); + int tmpCurrent = current; + int lastOnScreen = first + displayMenuItems - 1; + int last = Count() - 1; + while (--tmpCurrent != current) { + if (tmpCurrent < 0) { + if (Setup.MenuScrollWrap) + tmpCurrent = last; + else + return; + } + if (SelectableItem(tmpCurrent)) + break; } - else - DisplayCurrent(true); + if (first <= tmpCurrent && tmpCurrent <= lastOnScreen) + DisplayCurrent(false); + current = tmpCurrent; + if (current < first) { + first = Setup.MenuScrollPage ? max(0, current - displayMenuItems + 1) : current; + Display(); } + else if (current > lastOnScreen) { + first = max(0, current - displayMenuItems + 1); + Display(); + } + else + DisplayCurrent(true); } void cOsdMenu::CursorDown(void) { + int tmpCurrent = current; + int lastOnScreen = first + displayMenuItems - 1; int last = Count() - 1; - if (current < last) { - int lastOnScreen = first + displayMenuItems - 1; - int tmpCurrent = current; - while (++tmpCurrent <= last && !SelectableItem(tmpCurrent)) - ; - if (tmpCurrent > last) - return; - if (tmpCurrent <= lastOnScreen) - DisplayCurrent(false); - current = tmpCurrent; - if (current > lastOnScreen) { - first = Setup.MenuScrollPage ? current : max(0, current - displayMenuItems + 1); - if (first + displayMenuItems > last) - first = max(0, last - displayMenuItems + 1); - Display(); + while (++tmpCurrent != current) { + if (tmpCurrent > last) { + if (Setup.MenuScrollWrap) + tmpCurrent = 0; + else + return; + } + if (SelectableItem(tmpCurrent)) + break; } - else - DisplayCurrent(true); + if (first <= tmpCurrent && tmpCurrent <= lastOnScreen) + DisplayCurrent(false); + current = tmpCurrent; + if (current > lastOnScreen) { + first = Setup.MenuScrollPage ? current : max(0, current - displayMenuItems + 1); + if (first + displayMenuItems > last) + first = max(0, last - displayMenuItems + 1); + Display(); } + else if (current < first) { + first = current; + Display(); + } + else + DisplayCurrent(true); } void cOsdMenu::PageUp(void) @@ -333,6 +351,8 @@ void cOsdMenu::PageUp(void) Display(); DisplayCurrent(true); } + else if (Setup.MenuScrollWrap) + CursorUp(); } void cOsdMenu::PageDown(void) @@ -365,6 +385,8 @@ void cOsdMenu::PageDown(void) Display(); DisplayCurrent(true); } + else if (Setup.MenuScrollWrap) + CursorDown(); } void cOsdMenu::Mark(void)