mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	The new virtual function cStatus::OsdCurrentItem2() can be used to get the index of the current menu item
This commit is contained in:
		| @@ -2593,6 +2593,7 @@ Markus Ehrnsperger <markus.ehrnsperger@googlemail.com> | ||||
|  for implementing cStatus::OsdItem2() with the information whether the item is selectable | ||||
|  for reporting an improper call of cStatus::OsdCurrentItem() before cStatus::OsdItem2() | ||||
|  for fixing unnecessary calls to DisplayCurrent() for editable menu items | ||||
|  for implementing cStatus::OsdCurrentItem2() with the index of the current item | ||||
|  | ||||
| Werner F<>rber <w.faerber@gmx.de> | ||||
|  for reporting a bug in handling the cPluginManager::Active() result when pressing | ||||
|   | ||||
							
								
								
									
										4
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -10068,3 +10068,7 @@ Video Disk Recorder Revision History | ||||
| - Fixed an unnecessary redisplay of the menu when pressing a hotkey. | ||||
| - Fixed unnecessary calls to DisplayCurrent() for editable menu items (thanks to Markus | ||||
|   Ehrnsperger). | ||||
| - The new virtual function cStatus::OsdCurrentItem2() can be used to get the index of the | ||||
|   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(). | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * how to reach the author. | ||||
|  * | ||||
|  * $Id: osdbase.c 5.4 2025/01/29 10:35:25 kls Exp $ | ||||
|  * $Id: osdbase.c 5.5 2025/01/29 11:15:26 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "osdbase.h" | ||||
| @@ -268,7 +268,7 @@ void cOsdMenu::Display(void) | ||||
|          bool CurrentSelectable = (i == current) && item->Selectable(); | ||||
|          item->SetMenuItem(displayMenu, i - first, CurrentSelectable, item->Selectable()); | ||||
|          if (CurrentSelectable) | ||||
|             cStatus::MsgOsdCurrentItem(item->Text()); | ||||
|             cStatus::MsgOsdCurrentItem(item->Text(), i); | ||||
|          if (++n == displayMenuItems) | ||||
|             break; | ||||
|          i++; | ||||
| @@ -300,7 +300,7 @@ void cOsdMenu::DisplayCurrent(bool Current) | ||||
|   if (item) { | ||||
|      item->SetMenuItem(displayMenu, current - first, Current && item->Selectable(), item->Selectable()); | ||||
|      if (Current && item->Selectable()) | ||||
|         cStatus::MsgOsdCurrentItem(item->Text()); | ||||
|         cStatus::MsgOsdCurrentItem(item->Text(), current); | ||||
|      if (!Current) | ||||
|         item->SetFresh(true); // leaving the current item resets 'fresh' | ||||
|      if (cMenuEditItem *MenuEditItem = dynamic_cast<cMenuEditItem *>(item)) { | ||||
| @@ -321,7 +321,7 @@ void cOsdMenu::DisplayItem(cOsdItem *Item) | ||||
|         bool Current = Index == current; | ||||
|         Item->SetMenuItem(displayMenu, Offset, Current && Item->Selectable(), Item->Selectable()); | ||||
|         if (Current && Item->Selectable()) | ||||
|            cStatus::MsgOsdCurrentItem(Item->Text()); | ||||
|            cStatus::MsgOsdCurrentItem(Item->Text(), Index); | ||||
|         } | ||||
|      } | ||||
| } | ||||
|   | ||||
							
								
								
									
										6
									
								
								status.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								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 5.1 2025/01/16 09:42:11 kls Exp $ | ||||
|  * $Id: status.c 5.2 2025/01/29 11:15:26 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "status.h" | ||||
| @@ -113,10 +113,10 @@ void cStatus::MsgOsdItem(const char *Text, int Index, bool Selectable) | ||||
|       sm->OsdItem2(Text, Index, Selectable); | ||||
| } | ||||
|  | ||||
| void cStatus::MsgOsdCurrentItem(const char *Text) | ||||
| void cStatus::MsgOsdCurrentItem(const char *Text, int Index) | ||||
| { | ||||
|   for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) | ||||
|       sm->OsdCurrentItem(Text); | ||||
|       sm->OsdCurrentItem2(Text, Index); | ||||
| } | ||||
|  | ||||
| void cStatus::MsgOsdTextItem(const char *Text, bool Scroll) | ||||
|   | ||||
							
								
								
									
										7
									
								
								status.h
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								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 5.1 2025/01/16 09:42:11 kls Exp $ | ||||
|  * $Id: status.h 5.2 2025/01/29 11:15:26 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #ifndef __STATUS_H | ||||
| @@ -92,6 +92,9 @@ protected: | ||||
|                // 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 OsdCurrentItem2(const char *Text, int Index) { OsdCurrentItem(Text); } | ||||
|                // The OSD displays the given single line Text as the current menu item. | ||||
|                // Index is the one that was given in OsdItem[2]() for this item. | ||||
|   virtual void OsdTextItem(const char *Text, bool Scroll) {} | ||||
|                // The OSD displays the given multi line text. If Text points to an | ||||
|                // actual string, that text shall be displayed and Scroll has no | ||||
| @@ -121,7 +124,7 @@ public: | ||||
|   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, bool Selectable = true); | ||||
|   static void MsgOsdCurrentItem(const char *Text); | ||||
|   static void MsgOsdCurrentItem(const char *Text, int Index = -1); | ||||
|   static void MsgOsdTextItem(const char *Text,  bool Scroll = false); | ||||
|   static void MsgOsdChannel(const char *Text); | ||||
|   static void MsgOsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user