From 1a5ca67f57beb7c97de1bbdced2c8733a3c29830 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 18 Nov 2000 14:13:26 +0100 Subject: Shifting 'Subtitle' info into 'ExtendedDescription' if necessary --- menu.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'menu.c') diff --git a/menu.c b/menu.c index 3d4b241e..49d0ddeb 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.49 2000/11/18 13:42:52 kls Exp $ + * $Id: menu.c 1.50 2000/11/18 14:10:10 kls Exp $ */ #include "menu.h" @@ -1103,22 +1103,35 @@ cMenuEvent::cMenuEvent(const cEventInfo *EventInfo, bool CanSwitch) if (eventInfo) { cChannel *channel = Channels.GetByServiceID(eventInfo->GetServiceID()); if (channel) { - const char *p; char *buffer; asprintf(&buffer, "%-17.*s\t%.*s %s - %s", 17, channel->name, 5, eventInfo->GetDate(), eventInfo->GetTimeString(), eventInfo->GetEndTimeString()); SetTitle(buffer, false); int Line = 2; cMenuTextItem *item; - if (!isempty(p = eventInfo->GetTitle())) { - Add(item = new cMenuTextItem(p, 1, Line, MenuColumns - 2, -1, clrCyan)); + const char *Title = eventInfo->GetTitle(); + const char *Subtitle = eventInfo->GetSubtitle(); + const char *ExtendedDescription = eventInfo->GetExtendedDescription(); + // Some channels send a 'Subtitle' that should actually be the 'ExtendedDescription' + // (their 'ExtendedDescription' is then empty). In order to handle this correctly + // we silently shift that text to where it belongs. + // The German TV station 'VOX' is notorious for this - why can't they do it correctly + // like all the others? Well, at least like those who actually send the full range + // of information (like, e.g., 'Sat.1'). Some stations (like 'RTL') don't even + // bother sending anything but the 'Title'... + if (isempty(ExtendedDescription) && !isempty(Subtitle) && strlen(Subtitle) > 2 * MenuColumns) { + ExtendedDescription = Subtitle; + Subtitle = NULL; + } + if (!isempty(Title)) { + Add(item = new cMenuTextItem(Title, 1, Line, MenuColumns - 2, -1, clrCyan)); Line += item->Height() + 1; } - if (!isempty(p = eventInfo->GetSubtitle())) { - Add(item = new cMenuTextItem(p, 1, Line, MenuColumns - 2, -1, clrYellow)); + if (!isempty(Subtitle)) { + Add(item = new cMenuTextItem(Subtitle, 1, Line, MenuColumns - 2, -1, clrYellow)); Line += item->Height() + 1; } - if (!isempty(p = eventInfo->GetExtendedDescription())) - Add(new cMenuTextItem(p, 1, Line, MenuColumns - 2, Height() - Line - 2, clrCyan), true); + if (!isempty(ExtendedDescription)) + Add(new cMenuTextItem(ExtendedDescription, 1, Line, MenuColumns - 2, Height() - Line - 2, clrCyan), true); SetHelp(tr("Record"), NULL, NULL, CanSwitch ? tr("Switch") : NULL); } } -- cgit v1.2.3