Fixed unnecessary calls to cStatus::OsdCurrentItem2() when scrolling

This commit is contained in:
Klaus Schmidinger 2025-02-05 22:12:32 +01:00
parent ef4ebeb7ee
commit 03afc4a353
4 changed files with 41 additions and 21 deletions

View File

@ -10034,7 +10034,7 @@ Video Disk Recorder Revision History
(suggested by Stefan Hofmann). (suggested by Stefan Hofmann).
- Added vdrrootdir and incdir to vdr.pc (thanks to Stefan Hofmann). - Added vdrrootdir and incdir to vdr.pc (thanks to Stefan Hofmann).
2025-01-29: 2025-02-05:
- Removed all DEPRECATED_* code. - Removed all DEPRECATED_* code.
- Fixed error checking in case the fps value can't be determined by the frame parser. - Fixed error checking in case the fps value can't be determined by the frame parser.
@ -10072,3 +10072,4 @@ Video Disk Recorder Revision History
current menu item (thanks to Markus Ehrnsperger). Plugins that implemented current menu item (thanks to Markus Ehrnsperger). Plugins that implemented
cStatus::OsdCurrentItem() will still work as before, because the default implementation cStatus::OsdCurrentItem() will still work as before, because the default implementation
of cStatus::OsdCurrentItem2() calls cStatus::OsdCurrentItem(). of cStatus::OsdCurrentItem2() calls cStatus::OsdCurrentItem().
- Fixed unnecessary calls to cStatus::OsdCurrentItem2() when scrolling.

5
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menu.c 5.19 2024/12/02 12:40:56 kls Exp $ * $Id: menu.c 5.20 2025/02/05 22:12:32 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -443,8 +443,9 @@ eOSState cMenuChannels::Number(eKeys Key)
number = number * 10 + Key - k0; number = number * 10 + Key - k0;
for (cMenuChannelItem *ci = (cMenuChannelItem *)First(); ci; ci = (cMenuChannelItem *)ci->Next()) { for (cMenuChannelItem *ci = (cMenuChannelItem *)First(); ci; ci = (cMenuChannelItem *)ci->Next()) {
if (!ci->Channel()->GroupSep() && ci->Channel()->Number() == number) { if (!ci->Channel()->GroupSep() && ci->Channel()->Number() == number) {
DisplayCurrent(false);
SetCurrent(ci); SetCurrent(ci);
Display(); DisplayCurrent(true);
break; break;
} }
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osdbase.c 5.5 2025/01/29 11:15:26 kls Exp $ * $Id: osdbase.c 5.6 2025/02/05 22:12:32 kls Exp $
*/ */
#include "osdbase.h" #include "osdbase.h"
@ -93,6 +93,7 @@ cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4)
SetCols(c0, c1, c2, c3, c4); SetCols(c0, c1, c2, c3, c4);
first = 0; first = 0;
lastOffset = -1; lastOffset = -1;
conveyStatus = true;
current = marked = -1; current = marked = -1;
subMenu = NULL; subMenu = NULL;
helpRed = helpGreen = helpYellow = helpBlue = NULL; helpRed = helpGreen = helpYellow = helpBlue = NULL;
@ -181,7 +182,8 @@ void cOsdMenu::DisplayHelp(bool Force)
{ {
if (!helpDisplayed || Force) { if (!helpDisplayed || Force) {
displayMenu->SetButtons(helpRed, helpGreen, helpYellow, helpBlue); displayMenu->SetButtons(helpRed, helpGreen, helpYellow, helpBlue);
cStatus::MsgOsdHelpKeys(helpRed, helpGreen, helpYellow, helpBlue); if (conveyStatus)
cStatus::MsgOsdHelpKeys(helpRed, helpGreen, helpYellow, helpBlue);
helpDisplayed = true; helpDisplayed = true;
} }
} }
@ -224,6 +226,13 @@ void cOsdMenu::Ins(cOsdItem *Item, bool Current, cOsdItem *Before)
current = Item->Index(); current = Item->Index();
} }
void cOsdMenu::DisplayNoStatus(void)
{
conveyStatus = false;
Display();
conveyStatus = true;
}
void cOsdMenu::Display(void) void cOsdMenu::Display(void)
{ {
if (subMenu) { if (subMenu) {
@ -234,7 +243,8 @@ void cOsdMenu::Display(void)
SetDisplayMenu(); SetDisplayMenu();
displayMenu->SetMessage(mtStatus, NULL); displayMenu->SetMessage(mtStatus, NULL);
displayMenu->Clear(); displayMenu->Clear();
cStatus::MsgOsdClear(); if (conveyStatus)
cStatus::MsgOsdClear();
if (menuCategory != displayMenu->MenuCategory()) if (menuCategory != displayMenu->MenuCategory())
displayMenu->SetMenuCategory(menuCategory); displayMenu->SetMenuCategory(menuCategory);
displayMenu->SetMenuSortMode(menuSortMode); displayMenu->SetMenuSortMode(menuSortMode);
@ -242,13 +252,15 @@ void cOsdMenu::Display(void)
displayMenuItems = displayMenu->MaxItems(); displayMenuItems = displayMenu->MaxItems();
displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX
displayMenu->SetTitle(title); displayMenu->SetTitle(title);
cStatus::MsgOsdTitle(title); if (conveyStatus)
cStatus::MsgOsdTitle(title);
DisplayHelp(true); DisplayHelp(true);
int count = Count(); int count = Count();
if (count > 0) { if (count > 0) {
int ni = 0; int ni = 0;
for (cOsdItem *item = First(); item; item = Next(item)) { for (cOsdItem *item = First(); item; item = Next(item)) {
cStatus::MsgOsdItem(item->Text(), ni++, item->Selectable()); if (conveyStatus)
cStatus::MsgOsdItem(item->Text(), ni++, item->Selectable());
if (current < 0 && item->Selectable()) if (current < 0 && item->Selectable())
current = item->Index(); current = item->Index();
} }
@ -267,7 +279,7 @@ void cOsdMenu::Display(void)
for (cOsdItem *item = Get(first); item; item = Next(item)) { for (cOsdItem *item = Get(first); item; item = Next(item)) {
bool CurrentSelectable = (i == current) && item->Selectable(); bool CurrentSelectable = (i == current) && item->Selectable();
item->SetMenuItem(displayMenu, i - first, CurrentSelectable, item->Selectable()); item->SetMenuItem(displayMenu, i - first, CurrentSelectable, item->Selectable());
if (CurrentSelectable) if (CurrentSelectable) // not checking conveyStatus here!
cStatus::MsgOsdCurrentItem(item->Text(), i); cStatus::MsgOsdCurrentItem(item->Text(), i);
if (++n == displayMenuItems) if (++n == displayMenuItems)
break; break;
@ -299,9 +311,13 @@ void cOsdMenu::DisplayCurrent(bool Current)
cOsdItem *item = Get(current); cOsdItem *item = Get(current);
if (item) { if (item) {
item->SetMenuItem(displayMenu, current - first, Current && item->Selectable(), item->Selectable()); item->SetMenuItem(displayMenu, current - first, Current && item->Selectable(), item->Selectable());
if (Current && item->Selectable()) if (Current) {
cStatus::MsgOsdCurrentItem(item->Text(), current); if (current - first >= displayMenuItems || current < first)
if (!Current) DisplayNoStatus();
else if (item->Selectable())
cStatus::MsgOsdCurrentItem(item->Text(), current);
}
else
item->SetFresh(true); // leaving the current item resets 'fresh' item->SetFresh(true); // leaving the current item resets 'fresh'
if (cMenuEditItem *MenuEditItem = dynamic_cast<cMenuEditItem *>(item)) { if (cMenuEditItem *MenuEditItem = dynamic_cast<cMenuEditItem *>(item)) {
if (!MenuEditItem->DisplayHelp(Current)) if (!MenuEditItem->DisplayHelp(Current))
@ -355,7 +371,7 @@ void cOsdMenu::CursorUp(void)
if (first > 0) { if (first > 0) {
// make non-selectable items at the beginning visible: // make non-selectable items at the beginning visible:
first = 0; first = 0;
Display(); DisplayNoStatus();
return; return;
} }
if (Setup.MenuScrollWrap) if (Setup.MenuScrollWrap)
@ -371,11 +387,11 @@ void cOsdMenu::CursorUp(void)
current = tmpCurrent; current = tmpCurrent;
if (current < first) { if (current < first) {
first = Setup.MenuScrollPage ? max(0, current - displayMenuItems + 1) : current; first = Setup.MenuScrollPage ? max(0, current - displayMenuItems + 1) : current;
Display(); DisplayNoStatus();
} }
else if (current > lastOnScreen) { else if (current > lastOnScreen) {
first = max(0, current - displayMenuItems + 1); first = max(0, current - displayMenuItems + 1);
Display(); DisplayNoStatus();
} }
else else
DisplayCurrent(true); DisplayCurrent(true);
@ -393,7 +409,7 @@ void cOsdMenu::CursorDown(void)
if (first < last - displayMenuItems) { if (first < last - displayMenuItems) {
// make non-selectable items at the end visible: // make non-selectable items at the end visible:
first = last - displayMenuItems + 1; first = last - displayMenuItems + 1;
Display(); DisplayNoStatus();
return; return;
} }
if (Setup.MenuScrollWrap) if (Setup.MenuScrollWrap)
@ -411,11 +427,11 @@ void cOsdMenu::CursorDown(void)
first = Setup.MenuScrollPage ? current : max(0, current - displayMenuItems + 1); first = Setup.MenuScrollPage ? current : max(0, current - displayMenuItems + 1);
if (first + displayMenuItems > last) if (first + displayMenuItems > last)
first = max(0, last - displayMenuItems + 1); first = max(0, last - displayMenuItems + 1);
Display(); DisplayNoStatus();
} }
else if (current < first) { else if (current < first) {
first = current; first = current;
Display(); DisplayNoStatus();
} }
else else
DisplayCurrent(true); DisplayCurrent(true);
@ -448,7 +464,7 @@ void cOsdMenu::PageUp(void)
first = current - displayMenuItems + 1; first = current - displayMenuItems + 1;
} }
if (current != oldCurrent || first != oldFirst) if (current != oldCurrent || first != oldFirst)
Display(); DisplayNoStatus();
else if (Setup.MenuScrollWrap) else if (Setup.MenuScrollWrap)
CursorUp(); CursorUp();
} }
@ -480,7 +496,7 @@ void cOsdMenu::PageDown(void)
first = current - displayMenuItems + 1; first = current - displayMenuItems + 1;
} }
if (current != oldCurrent || first != oldFirst) if (current != oldCurrent || first != oldFirst)
Display(); DisplayNoStatus();
else if (Setup.MenuScrollWrap) else if (Setup.MenuScrollWrap)
CursorDown(); CursorDown();
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osdbase.h 4.5 2018/01/25 15:09:23 kls Exp $ * $Id: osdbase.h 5.1 2025/02/05 22:12:32 kls Exp $
*/ */
#ifndef __OSDBASE_H #ifndef __OSDBASE_H
@ -92,6 +92,7 @@ private:
int cols[cSkinDisplayMenu::MaxTabs]; int cols[cSkinDisplayMenu::MaxTabs];
int first, current, marked; int first, current, marked;
int lastOffset; int lastOffset;
bool conveyStatus;
eMenuCategory menuCategory; eMenuCategory menuCategory;
eMenuSortMode menuSortMode; eMenuSortMode menuSortMode;
eMenuOrientation menuOrientation; eMenuOrientation menuOrientation;
@ -102,6 +103,7 @@ private:
int digit; int digit;
bool hasHotkeys; bool hasHotkeys;
void DisplayHelp(bool Force = false); void DisplayHelp(bool Force = false);
void DisplayNoStatus(void);
protected: protected:
void SetDisplayMenu(void); void SetDisplayMenu(void);
cSkinDisplayMenu *DisplayMenu(void) { return displayMenu; } cSkinDisplayMenu *DisplayMenu(void) { return displayMenu; }