diff --git a/HISTORY b/HISTORY index 77f83790..ef3e5e1a 100644 --- a/HISTORY +++ b/HISTORY @@ -10034,7 +10034,7 @@ Video Disk Recorder Revision History (suggested by Stefan Hofmann). - Added vdrrootdir and incdir to vdr.pc (thanks to Stefan Hofmann). -2025-01-29: +2025-02-05: - Removed all DEPRECATED_* code. - 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 cStatus::OsdCurrentItem() will still work as before, because the default implementation of cStatus::OsdCurrentItem2() calls cStatus::OsdCurrentItem(). +- Fixed unnecessary calls to cStatus::OsdCurrentItem2() when scrolling. diff --git a/menu.c b/menu.c index ecf9500e..de13162a 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 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" @@ -443,8 +443,9 @@ eOSState cMenuChannels::Number(eKeys Key) number = number * 10 + Key - k0; for (cMenuChannelItem *ci = (cMenuChannelItem *)First(); ci; ci = (cMenuChannelItem *)ci->Next()) { if (!ci->Channel()->GroupSep() && ci->Channel()->Number() == number) { + DisplayCurrent(false); SetCurrent(ci); - Display(); + DisplayCurrent(true); break; } } diff --git a/osdbase.c b/osdbase.c index a5f91369..294c2ad8 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 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" @@ -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); first = 0; lastOffset = -1; + conveyStatus = true; current = marked = -1; subMenu = NULL; helpRed = helpGreen = helpYellow = helpBlue = NULL; @@ -181,7 +182,8 @@ void cOsdMenu::DisplayHelp(bool Force) { if (!helpDisplayed || Force) { displayMenu->SetButtons(helpRed, helpGreen, helpYellow, helpBlue); - cStatus::MsgOsdHelpKeys(helpRed, helpGreen, helpYellow, helpBlue); + if (conveyStatus) + cStatus::MsgOsdHelpKeys(helpRed, helpGreen, helpYellow, helpBlue); helpDisplayed = true; } } @@ -224,6 +226,13 @@ void cOsdMenu::Ins(cOsdItem *Item, bool Current, cOsdItem *Before) current = Item->Index(); } +void cOsdMenu::DisplayNoStatus(void) +{ + conveyStatus = false; + Display(); + conveyStatus = true; +} + void cOsdMenu::Display(void) { if (subMenu) { @@ -234,7 +243,8 @@ void cOsdMenu::Display(void) SetDisplayMenu(); displayMenu->SetMessage(mtStatus, NULL); displayMenu->Clear(); - cStatus::MsgOsdClear(); + if (conveyStatus) + cStatus::MsgOsdClear(); if (menuCategory != displayMenu->MenuCategory()) displayMenu->SetMenuCategory(menuCategory); displayMenu->SetMenuSortMode(menuSortMode); @@ -242,13 +252,15 @@ void cOsdMenu::Display(void) displayMenuItems = displayMenu->MaxItems(); displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX displayMenu->SetTitle(title); - cStatus::MsgOsdTitle(title); + if (conveyStatus) + cStatus::MsgOsdTitle(title); DisplayHelp(true); int count = Count(); if (count > 0) { int ni = 0; 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()) current = item->Index(); } @@ -267,7 +279,7 @@ void cOsdMenu::Display(void) for (cOsdItem *item = Get(first); item; item = Next(item)) { bool CurrentSelectable = (i == current) && item->Selectable(); item->SetMenuItem(displayMenu, i - first, CurrentSelectable, item->Selectable()); - if (CurrentSelectable) + if (CurrentSelectable) // not checking conveyStatus here! cStatus::MsgOsdCurrentItem(item->Text(), i); if (++n == displayMenuItems) break; @@ -299,9 +311,13 @@ void cOsdMenu::DisplayCurrent(bool Current) cOsdItem *item = Get(current); if (item) { item->SetMenuItem(displayMenu, current - first, Current && item->Selectable(), item->Selectable()); - if (Current && item->Selectable()) - cStatus::MsgOsdCurrentItem(item->Text(), current); - if (!Current) + if (Current) { + if (current - first >= displayMenuItems || current < first) + DisplayNoStatus(); + else if (item->Selectable()) + cStatus::MsgOsdCurrentItem(item->Text(), current); + } + else item->SetFresh(true); // leaving the current item resets 'fresh' if (cMenuEditItem *MenuEditItem = dynamic_cast(item)) { if (!MenuEditItem->DisplayHelp(Current)) @@ -355,7 +371,7 @@ void cOsdMenu::CursorUp(void) if (first > 0) { // make non-selectable items at the beginning visible: first = 0; - Display(); + DisplayNoStatus(); return; } if (Setup.MenuScrollWrap) @@ -371,11 +387,11 @@ void cOsdMenu::CursorUp(void) current = tmpCurrent; if (current < first) { first = Setup.MenuScrollPage ? max(0, current - displayMenuItems + 1) : current; - Display(); + DisplayNoStatus(); } else if (current > lastOnScreen) { first = max(0, current - displayMenuItems + 1); - Display(); + DisplayNoStatus(); } else DisplayCurrent(true); @@ -393,7 +409,7 @@ void cOsdMenu::CursorDown(void) if (first < last - displayMenuItems) { // make non-selectable items at the end visible: first = last - displayMenuItems + 1; - Display(); + DisplayNoStatus(); return; } if (Setup.MenuScrollWrap) @@ -411,11 +427,11 @@ void cOsdMenu::CursorDown(void) first = Setup.MenuScrollPage ? current : max(0, current - displayMenuItems + 1); if (first + displayMenuItems > last) first = max(0, last - displayMenuItems + 1); - Display(); + DisplayNoStatus(); } else if (current < first) { first = current; - Display(); + DisplayNoStatus(); } else DisplayCurrent(true); @@ -448,7 +464,7 @@ void cOsdMenu::PageUp(void) first = current - displayMenuItems + 1; } if (current != oldCurrent || first != oldFirst) - Display(); + DisplayNoStatus(); else if (Setup.MenuScrollWrap) CursorUp(); } @@ -480,7 +496,7 @@ void cOsdMenu::PageDown(void) first = current - displayMenuItems + 1; } if (current != oldCurrent || first != oldFirst) - Display(); + DisplayNoStatus(); else if (Setup.MenuScrollWrap) CursorDown(); } diff --git a/osdbase.h b/osdbase.h index cbb0e87d..6f5d71f2 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.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 @@ -92,6 +92,7 @@ private: int cols[cSkinDisplayMenu::MaxTabs]; int first, current, marked; int lastOffset; + bool conveyStatus; eMenuCategory menuCategory; eMenuSortMode menuSortMode; eMenuOrientation menuOrientation; @@ -102,6 +103,7 @@ private: int digit; bool hasHotkeys; void DisplayHelp(bool Force = false); + void DisplayNoStatus(void); protected: void SetDisplayMenu(void); cSkinDisplayMenu *DisplayMenu(void) { return displayMenu; }