From 5c94900026437ed108f29eb54cfe31f2ce0deba6 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Tue, 7 Nov 2017 15:42:47 +0100 Subject: OSD menus now try to keep the offset of the list cursor at a constant position on the screen, even if the list is modified while being displayed --- HISTORY | 4 +++- osdbase.c | 9 +++++++-- osdbase.h | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/HISTORY b/HISTORY index 0f62427d..ed782f3a 100644 --- a/HISTORY +++ b/HISTORY @@ -9162,7 +9162,7 @@ Video Disk Recorder Revision History a subdirectory. - SVDRP peering can now be limited to the default SVDRP host (see MANUAL for details). -2017-11-02: Version 2.3.9 +2017-11-07: Version 2.3.9 - Updated the Italian OSD texts (thanks to Diego Pierotto). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). @@ -9188,3 +9188,5 @@ Video Disk Recorder Revision History instead. - The timeout for the channel display is now reset whenever the channel or EPG data changes. +- OSD menus now try to keep the offset of the list cursor at a constant position on + the screen, even if the list is modified while being displayed. diff --git a/osdbase.c b/osdbase.c index ac8026ff..dea1d995 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 4.2 2017/04/03 12:30:52 kls Exp $ + * $Id: osdbase.c 4.3 2017/11/07 15:42:47 kls Exp $ */ #include "osdbase.h" @@ -92,6 +92,7 @@ cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4) SetTitle(Title); SetCols(c0, c1, c2, c3, c4); first = 0; + lastOffset = 0; current = marked = -1; subMenu = NULL; helpRed = helpGreen = helpYellow = helpBlue = NULL; @@ -253,7 +254,7 @@ void cOsdMenu::Display(void) } if (current < 0) current = 0; // just for safety - there HAS to be a current item! - first = min(first, max(0, count - displayMenuItems)); // in case the menu size has changed + first = max(0, min(first, max(0, count - displayMenuItems))); // in case the menu size has changed if (current - first >= displayMenuItems || current < first) { first = current - displayMenuItems / 2; if (first + displayMenuItems > count) @@ -281,6 +282,9 @@ void cOsdMenu::Display(void) void cOsdMenu::SetCurrent(cOsdItem *Item) { current = Item ? Item->Index() : -1; + if (current >= 0 && lastOffset > 0) + first = max(0, current - lastOffset); + lastOffset = 0; } void cOsdMenu::RefreshCurrent(void) @@ -326,6 +330,7 @@ void cOsdMenu::Clear(void) { if (marked >= 0) SetStatus(NULL); + lastOffset = (current > first) ? current - first : 0; first = 0; current = marked = -1; cList::Clear(); diff --git a/osdbase.h b/osdbase.h index 91b795d5..8e2a77ad 100644 --- a/osdbase.h +++ b/osdbase.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.h 4.2 2017/04/03 12:02:16 kls Exp $ + * $Id: osdbase.h 4.3 2017/11/07 15:31:24 kls Exp $ */ #ifndef __OSDBASE_H @@ -92,6 +92,7 @@ private: char *title; int cols[cSkinDisplayMenu::MaxTabs]; int first, current, marked; + int lastOffset;; eMenuCategory menuCategory; eMenuSortMode menuSortMode; eMenuOrientation menuOrientation; -- cgit v1.2.3