From 0749a34342f62ef35b5fffe40207877f737577dd Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Thu, 16 Jan 2025 09:42:11 +0100 Subject: [PATCH] The new virtual function cStatus::OsdItem2() can be used to get the information whether a menu item is selectable --- CONTRIBUTORS | 1 + HISTORY | 7 ++++++- config.h | 6 +++--- osdbase.c | 4 ++-- status.c | 6 +++--- status.h | 7 +++++-- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index dfe3e7bf..1ea6d6d7 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2590,6 +2590,7 @@ Markus Ehrnsperger for suggesting a fix for expiring of one-time VPS timers in case there is more than one event with the same VPS time for fixing handling margins for timers that are not VPS controlled and not spawned + for implementing cStatus::OsdItem2() with the information whether the item is selectable Werner Färber for reporting a bug in handling the cPluginManager::Active() result when pressing diff --git a/HISTORY b/HISTORY index 5dfa829d..a83adb78 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-15: +2025-01-16: - Removed all DEPRECATED_* code. - Fixed error checking in case the fps value can't be determined by the frame parser. @@ -10056,3 +10056,8 @@ Video Disk Recorder Revision History - Added parameter checks to strn0cpy() (thanks to Stefan Hofmann). Same for Utf8Strn0Cpy(). - The info files of recordings are now only re-read if they have been modified (thanks to Stefan Hofmann). +- The new virtual function cStatus::OsdItem2() can be used to get the information whether + a menu item is selectable (thanks to Markus Ehrnsperger). Plugins that implemented + cStatus::OsdItem() will still work as before, because the default implementation of + cStatus::OsdItem2() calls cStatus::OsdItem(). + APIVERSNUM is now 30006. diff --git a/config.h b/config.h index fc758704..6e3b766b 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 5.24 2024/10/12 13:32:46 kls Exp $ + * $Id: config.h 5.25 2025/01/16 09:42:11 kls Exp $ */ #ifndef __CONFIG_H @@ -27,8 +27,8 @@ // The plugin API's version number: -#define APIVERSION "5" -#define APIVERSNUM 30005 +#define APIVERSION "6" +#define APIVERSNUM 30006 // When loading plugins, VDR searches files by their APIVERSION, which // is different from VDRVERSION. APIVERSION is a plain number, incremented diff --git a/osdbase.c b/osdbase.c index d53ca1c1..f80875f9 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.1 2024/01/19 12:10:47 kls Exp $ + * $Id: osdbase.c 5.2 2025/01/16 09:42:11 kls Exp $ */ #include "osdbase.h" @@ -248,7 +248,7 @@ void cOsdMenu::Display(void) if (count > 0) { int ni = 0; for (cOsdItem *item = First(); item; item = Next(item)) { - cStatus::MsgOsdItem(item->Text(), ni++); + cStatus::MsgOsdItem(item->Text(), ni++, item->Selectable()); if (current < 0 && item->Selectable()) current = item->Index(); } diff --git a/status.c b/status.c index b358878f..afef0b12 100644 --- a/status.c +++ b/status.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: status.c 4.1 2018/01/29 13:36:53 kls Exp $ + * $Id: status.c 5.1 2025/01/16 09:42:11 kls Exp $ */ #include "status.h" @@ -107,10 +107,10 @@ void cStatus::MsgOsdHelpKeys(const char *Red, const char *Green, const char *Yel sm->OsdHelpKeys(Red, Green, Yellow, Blue); } -void cStatus::MsgOsdItem(const char *Text, int Index) +void cStatus::MsgOsdItem(const char *Text, int Index, bool Selectable) { for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) - sm->OsdItem(Text, Index); + sm->OsdItem2(Text, Index, Selectable); } void cStatus::MsgOsdCurrentItem(const char *Text) diff --git a/status.h b/status.h index ee8a1acd..1c40dfd8 100644 --- a/status.h +++ b/status.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: status.h 4.4 2018/01/29 13:42:17 kls Exp $ + * $Id: status.h 5.1 2025/01/16 09:42:11 kls Exp $ */ #ifndef __STATUS_H @@ -87,6 +87,9 @@ protected: // The help keys have been set to the given values (may be NULL). virtual void OsdItem(const char *Text, int Index) {} // The OSD displays the given single line Text as menu item at Index. + virtual void OsdItem2(const char *Text, int Index, bool Selectable) { OsdItem(Text, Index); } + // The OSD displays the given single line Text as menu item at Index. + // Selectable is true if this item can be selected. virtual void OsdCurrentItem(const char *Text) {} // The OSD displays the given single line Text as the current menu item. virtual void OsdTextItem(const char *Text, bool Scroll) {} @@ -117,7 +120,7 @@ public: static void MsgOsdTitle(const char *Title); static void MsgOsdStatusMessage(const char *Message); static void MsgOsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue); - static void MsgOsdItem(const char *Text, int Index); + static void MsgOsdItem(const char *Text, int Index, bool Selectable = true); static void MsgOsdCurrentItem(const char *Text); static void MsgOsdTextItem(const char *Text, bool Scroll = false); static void MsgOsdChannel(const char *Text);