Date and time in the title of an event info page are now always right adjusted

This commit is contained in:
Klaus Schmidinger 2000-11-05 13:04:23 +01:00
parent 88253cfba7
commit ea0bd668c8
7 changed files with 44 additions and 11 deletions

View File

@ -265,3 +265,7 @@ Video Disk Recorder Revision History
- Problematic characters in recording names (which can come from timers that - Problematic characters in recording names (which can come from timers that
are programmed via the "Schedules" menu) are now replaced by suitable are programmed via the "Schedules" menu) are now replaced by suitable
substitutes. substitutes.
2000-11-05: Version 0.68
- Date and time in the title of an event info page are now always right adjusted.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "dvbapi.h"
@ -1616,6 +1616,15 @@ int cDvbApi::Width(unsigned char c)
#endif #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) void cDvbApi::Text(int x, int y, const char *s, eDvbColor colorFg, eDvbColor colorBg)
{ {
if (x < 0) x = cols + x; if (x < 0) x = cols + x;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __DVBAPI_H
@ -124,6 +124,7 @@ public:
void ClrEol(int x, int y, eDvbColor color = clrBackground); void ClrEol(int x, int y, eDvbColor color = clrBackground);
int CellWidth(void); int CellWidth(void);
int Width(unsigned char c); 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 Text(int x, int y, const char *s, eDvbColor colorFg = clrWhite, eDvbColor colorBg = clrBackground);
void Flush(void); void Flush(void);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "dvbosd.h"
@ -81,6 +81,11 @@ int cBitmap::Width(unsigned char c)
return font ? font->Width(c) : -1; 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) void cBitmap::Text(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor ColorBg)
{ {
if (bitmap) { if (bitmap) {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __DVBOSD_H
@ -57,6 +57,7 @@ public:
bool Dirty(void); bool Dirty(void);
void SetPixel(int x, int y, eDvbColor Color); void SetPixel(int x, int y, eDvbColor Color);
int Width(unsigned char c); 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 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 Fill(int x1, int y1, int x2, int y2, eDvbColor Color);
void Clear(void); void Clear(void);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #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) void cInterface::Title(const char *s)
{ {
int x = (Width() - strlen(s)) / 2;
if (x < 0)
x = 0;
ClearEol(0, 0, clrCyan); 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) void cInterface::Status(const char *s, eDvbColor FgColor, eDvbColor BgColor)

4
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "menu.h"
@ -1072,7 +1072,7 @@ cMenuEvent::cMenuEvent(const cEventInfo *EventInfo, bool CanSwitch)
if (channel) { if (channel) {
const char *p; const char *p;
char *buffer; 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); SetTitle(buffer, false);
int Line = 2; int Line = 2;
cMenuTextItem *item; cMenuTextItem *item;