From 704e17859f633ce54e75b0b06019037751b92b3d Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 2 Oct 2005 09:57:52 +0200 Subject: [PATCH] Fixed setting current menu item if the first one is non-selectable; cOsdItem::cOsdItem() now has a 'Selectable' parameter --- HISTORY | 2 ++ osdbase.c | 11 +++++++---- osdbase.h | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/HISTORY b/HISTORY index c55c3587..5a097c31 100644 --- a/HISTORY +++ b/HISTORY @@ -3866,3 +3866,5 @@ Video Disk Recorder Revision History Schlüßler). - Added a check against MAXOSDAREAS in cOsd::CanHandleAreas() (reported by Udo Richter). +- Fixed setting current menu item if the first one is non-selectable. +- cOsdItem::cOsdItem() now has a 'Selectable' parameter. diff --git a/osdbase.c b/osdbase.c index 98307cd3..637543bd 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 1.20 2005/06/18 10:30:51 kls Exp $ + * $Id: osdbase.c 1.21 2005/10/02 09:23:10 kls Exp $ */ #include "osdbase.h" @@ -25,12 +25,12 @@ cOsdItem::cOsdItem(eOSState State) fresh = true; } -cOsdItem::cOsdItem(const char *Text, eOSState State) +cOsdItem::cOsdItem(const char *Text, eOSState State, bool Selectable) { text = NULL; offset = -1; state = State; - selectable = true; + selectable = Selectable; fresh = true; SetText(Text); } @@ -196,8 +196,11 @@ void cOsdMenu::Display(void) int count = Count(); if (count > 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++); + if (current < 0 && item->Selectable()) + current = item->Index(); + } if (current < 0) current = 0; // just for safety - there HAS to be a current item! if (current - first >= displayMenuItems || current < first) { diff --git a/osdbase.h b/osdbase.h index bcb3c404..ec545ae9 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 1.11 2005/06/12 10:46:34 kls Exp $ + * $Id: osdbase.h 1.12 2005/10/02 09:18:20 kls Exp $ */ #ifndef __OSDBASE_H @@ -56,7 +56,7 @@ protected: bool fresh; public: cOsdItem(eOSState State = osUnknown); - cOsdItem(const char *Text, eOSState State = osUnknown); + cOsdItem(const char *Text, eOSState State = osUnknown, bool Selectable = true); virtual ~cOsdItem(); bool Selectable(void) { return selectable; } void SetText(const char *Text, bool Copy = true);