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

This commit is contained in:
Klaus Schmidinger 2017-11-07 15:42:47 +01:00
parent e02a0a8c88
commit 5c94900026
3 changed files with 12 additions and 4 deletions

View File

@ -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.

View File

@ -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<cOsdItem>::Clear();

View File

@ -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;