From 4acbc0fd47b808eb01ec1b71642db44827bf4124 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 3 Oct 2005 11:26:07 +0200 Subject: [PATCH] The 'sub-title' and 'bottom text' in the CAM menu can now consist of several lines --- HISTORY | 1 + menu.c | 21 +++++++++++++++++---- menu.h | 3 ++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/HISTORY b/HISTORY index c182d6a9..a012a044 100644 --- a/HISTORY +++ b/HISTORY @@ -3883,3 +3883,4 @@ Video Disk Recorder Revision History - Speeded up initial opening of the CAM menu. - Fixed handling of menus with no selectable items. - The character 0x8A in CAM menu strings is now mapped to a real newline. +- The 'sub-title' and 'bottom text' in the CAM menu can now consist of several lines. diff --git a/menu.c b/menu.c index ea187084..df61061b 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 1.371 2005/10/02 14:53:48 kls Exp $ + * $Id: menu.c 1.372 2005/10/03 10:41:26 kls Exp $ */ #include "menu.h" @@ -1297,16 +1297,16 @@ cMenuCam::cMenuCam(cCiMenu *CiMenu) SetTitle(*ciMenu->TitleText() ? ciMenu->TitleText() : "CAM"); dsyslog("CAM: '%s'", ciMenu->TitleText()); if (*ciMenu->SubTitleText()) { - Add(new cOsdItem(ciMenu->SubTitleText(), osUnknown, false)); - offset = 1; dsyslog("CAM: '%s'", ciMenu->SubTitleText()); + AddMultiLineItem(ciMenu->SubTitleText()); + offset = Count(); } for (int i = 0; i < ciMenu->NumEntries(); i++) { Add(new cOsdItem(hk(ciMenu->Entry(i)), osUnknown, ciMenu->Selectable())); dsyslog("CAM: '%s'", ciMenu->Entry(i)); } if (*ciMenu->BottomText()) { - Add(new cOsdItem(ciMenu->BottomText(), osUnknown, false)); + AddMultiLineItem(ciMenu->BottomText()); dsyslog("CAM: '%s'", ciMenu->BottomText()); } Display(); @@ -1319,6 +1319,19 @@ cMenuCam::~cMenuCam() delete ciMenu; } +void cMenuCam::AddMultiLineItem(const char *s) +{ + while (s && *s) { + const char *p = strchr(s, '\n'); + int l = p ? p - s : strlen(s); + cOsdItem *item = new cOsdItem; + item->SetSelectable(false); + item->SetText(strndup(s, l), false); + Add(item); + s = p ? p + 1 : p; + } +} + eOSState cMenuCam::Select(void) { if (ciMenu->Selectable()) { diff --git a/menu.h b/menu.h index d217a159..33e05b82 100644 --- a/menu.h +++ b/menu.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.h 1.75 2005/10/02 09:59:30 kls Exp $ + * $Id: menu.h 1.76 2005/10/03 10:39:08 kls Exp $ */ #ifndef __MENU_H @@ -121,6 +121,7 @@ private: cCiMenu *ciMenu; bool selected; int offset; + void AddMultiLineItem(const char *s); eOSState Select(void); public: cMenuCam(cCiMenu *CiMenu);