diff --git a/HISTORY b/HISTORY index 189fd7b3..a0fc6285 100644 --- a/HISTORY +++ b/HISTORY @@ -265,3 +265,7 @@ Video Disk Recorder Revision History - Problematic characters in recording names (which can come from timers that are programmed via the "Schedules" menu) are now replaced by suitable substitutes. + +2000-11-05: Version 0.68 + +- Date and time in the title of an event info page are now always right adjusted. diff --git a/dvbapi.c b/dvbapi.c index cc246d2f..a2fa9dcb 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.c 1.34 2000/11/01 09:19:27 kls Exp $ + * $Id: dvbapi.c 1.35 2000/11/05 13:04:23 kls Exp $ */ #include "dvbapi.h" @@ -1616,6 +1616,15 @@ int cDvbApi::Width(unsigned char c) #endif } +int cDvbApi::WidthInCells(const char *s) +{ +#ifdef DEBUG_OSD + return strlen(s); +#else + return (osd->Width(s) + charWidth - 1) / charWidth; +#endif +} + void cDvbApi::Text(int x, int y, const char *s, eDvbColor colorFg, eDvbColor colorBg) { if (x < 0) x = cols + x; diff --git a/dvbapi.h b/dvbapi.h index 16a2b7a7..6c0b50e7 100644 --- a/dvbapi.h +++ b/dvbapi.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.h 1.20 2000/11/01 09:18:50 kls Exp $ + * $Id: dvbapi.h 1.21 2000/11/05 12:40:07 kls Exp $ */ #ifndef __DVBAPI_H @@ -124,6 +124,7 @@ public: void ClrEol(int x, int y, eDvbColor color = clrBackground); int CellWidth(void); int Width(unsigned char c); + int WidthInCells(const char *s); void Text(int x, int y, const char *s, eDvbColor colorFg = clrWhite, eDvbColor colorBg = clrBackground); void Flush(void); diff --git a/dvbosd.c b/dvbosd.c index c0150e26..e9a7467c 100644 --- a/dvbosd.c +++ b/dvbosd.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbosd.c 1.4 2000/11/01 09:13:32 kls Exp $ + * $Id: dvbosd.c 1.5 2000/11/05 12:53:09 kls Exp $ */ #include "dvbosd.h" @@ -81,6 +81,11 @@ int cBitmap::Width(unsigned char c) return font ? font->Width(c) : -1; } +int cBitmap::Width(const char *s) +{ + return font ? font->Width(s) : -1; +} + void cBitmap::Text(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor ColorBg) { if (bitmap) { diff --git a/dvbosd.h b/dvbosd.h index 149dc6cb..214f08f7 100644 --- a/dvbosd.h +++ b/dvbosd.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbosd.h 1.2 2000/11/01 09:13:44 kls Exp $ + * $Id: dvbosd.h 1.3 2000/11/05 12:53:31 kls Exp $ */ #ifndef __DVBOSD_H @@ -57,6 +57,7 @@ public: bool Dirty(void); void SetPixel(int x, int y, eDvbColor Color); int Width(unsigned char c); + int Width(const char *s); void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground); void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); void Clear(void); diff --git a/interface.c b/interface.c index 810270fe..ee8a78cb 100644 --- a/interface.c +++ b/interface.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: interface.c 1.28 2000/11/01 15:27:52 kls Exp $ + * $Id: interface.c 1.29 2000/11/05 12:50:44 kls Exp $ */ #include "interface.h" @@ -238,11 +238,24 @@ void cInterface::WriteText(int x, int y, const char *s, eDvbColor FgColor, eDvbC void cInterface::Title(const char *s) { - int x = (Width() - strlen(s)) / 2; - if (x < 0) - x = 0; ClearEol(0, 0, clrCyan); - Write(x, 0, s, clrBlack, clrCyan); + const char *t = strchr(s, '\t'); + if (t) { + char buffer[Width() + 1]; + unsigned int n = t - s; + if (n >= sizeof(buffer)) + n = sizeof(buffer) - 1; + strn0cpy(buffer, s, n); + Write(1, 0, buffer, clrBlack, clrCyan); + t++; + Write(-(cDvbApi::PrimaryDvbApi->WidthInCells(t) + 1), 0, t, clrBlack, clrCyan); + } + else { + int x = (Width() - strlen(s)) / 2; + if (x < 0) + x = 0; + Write(x, 0, s, clrBlack, clrCyan); + } } void cInterface::Status(const char *s, eDvbColor FgColor, eDvbColor BgColor) diff --git a/menu.c b/menu.c index a3701e38..45d0a442 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.40 2000/11/01 15:50:00 kls Exp $ + * $Id: menu.c 1.41 2000/11/05 12:47:44 kls Exp $ */ #include "menu.h" @@ -1072,7 +1072,7 @@ cMenuEvent::cMenuEvent(const cEventInfo *EventInfo, bool CanSwitch) if (channel) { const char *p; char *buffer; - asprintf(&buffer, "%-17.*s %.*s %s - %s", 17, channel->name, 5, eventInfo->GetDate(), eventInfo->GetTimeString(), eventInfo->GetEndTimeString()); + 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;