From 6b60a35f8da342b5853f6e0cb09458d955005814 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 29 May 2004 13:21:02 +0200 Subject: [PATCH] Added SetMessage() functions to the Replay and Channel skin functions --- CONTRIBUTORS | 1 + HISTORY | 6 +++++- skinclassic.c | 42 +++++++++++++++++++++++++++++++++++++--- skins.h | 12 +++++++++++- skinsttng.c | 53 +++++++++++++++++++++++++++++++++++++++++++++------ 5 files changed, 103 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 62b7c3a9..578e0f5b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -526,6 +526,7 @@ Oliver Endriss for adding a missing cStatus::MsgOsdClear() to cDisplayChannel::~cDisplayChannel() for reporting that the "Classic VDR" skin wrongly displayed unused color buttons for reporting some missing cStatus::MsgOsdTextItem() calls + for reporting a missing "Editing process finished" message with skins Reinhard Walter Buchner for adding some satellites to 'sources.conf' diff --git a/HISTORY b/HISTORY index ddbc4be9..44bef6b1 100644 --- a/HISTORY +++ b/HISTORY @@ -2838,7 +2838,7 @@ Video Disk Recorder Revision History - Added some missing cStatus::MsgOsdTextItem() calls (thanks to Oliver Endriss for reporting this one). -2004-05-28: Version 1.3.9 +2004-05-29: Version 1.3.9 - Completed Croatian language texts (thanks to Drazen Dupor). - New iso8859-2 font to fix the problem with program freezes (thanks to Drazen Dupor). @@ -2855,3 +2855,7 @@ Video Disk Recorder Revision History use more independent clrMenu* colors. - Fixed removing the "scanning recordings..." message in case the video directory is empty (thanks to Andreas Regel for reporting this one). +- Added SetMessage() functions to the Replay and Channel skin functions. Plugins + that implement skins will need to implement these functions. This fixes a missing + "Editing process finished" message (thanks to Oliver Endriss for reporting this + one). diff --git a/skinclassic.c b/skinclassic.c index f7c06cc6..25d0ef50 100644 --- a/skinclassic.c +++ b/skinclassic.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skinclassic.c 1.4 2004/05/29 09:18:21 kls Exp $ + * $Id: skinclassic.c 1.5 2004/05/29 13:13:50 kls Exp $ */ #include "skinclassic.h" @@ -76,11 +76,13 @@ private: cOsd *osd; int lineHeight; int timeWidth; + bool message; public: cSkinClassicDisplayChannel(bool WithInfo); virtual ~cSkinClassicDisplayChannel(); virtual void SetChannel(const cChannel *Channel, int Number); virtual void SetEvents(const cEvent *Present, const cEvent *Following); + virtual void SetMessage(eMessageType Type, const char *Text); virtual void Flush(void); }; @@ -89,6 +91,7 @@ cSkinClassicDisplayChannel::cSkinClassicDisplayChannel(bool WithInfo) int Lines = WithInfo ? 5 : 1; const cFont *font = cFont::GetFont(fontOsd); lineHeight = font->Height(); + message = false; osd = cOsdProvider::NewOsd(Setup.OSDLeft, Setup.OSDTop + (Setup.ChannelInfoPos ? 0 : Setup.OSDHeight - Lines * lineHeight)); timeWidth = font->Width("00:00") + 4; tArea Areas[] = { { 0, 0, Setup.OSDWidth - 1, Lines * lineHeight, 4 } }; @@ -121,10 +124,26 @@ void cSkinClassicDisplayChannel::SetEvents(const cEvent *Present, const cEvent * } } +void cSkinClassicDisplayChannel::SetMessage(eMessageType Type, const char *Text) +{ + const cFont *font = cFont::GetFont(fontOsd); + if (Text) { + osd->SaveRegion(0, 0, osd->Width() - 1, lineHeight - 1); + osd->DrawText(0, 0, Text, Theme.Color(clrMessageStatusFg + 2 * Type), Theme.Color(clrMessageStatusBg + 2 * Type), font, osd->Width(), 0, taCenter); + message = true; + } + else { + osd->RestoreRegion(); + message = false; + } +} + void cSkinClassicDisplayChannel::Flush(void) { - const char *date = DayDateTime(); - osd->DrawText(osd->Width() - cFont::GetFont(fontSml)->Width(date) - 2, 0, date, Theme.Color(clrChannelDate), Theme.Color(clrBackground), cFont::GetFont(fontSml)); + if (!message) { + const char *date = DayDateTime(); + osd->DrawText(osd->Width() - cFont::GetFont(fontSml)->Width(date) - 2, 0, date, Theme.Color(clrChannelDate), Theme.Color(clrBackground), cFont::GetFont(fontSml)); + } osd->Flush(); } @@ -333,6 +352,7 @@ private: int x0, x1; int y0, y1, y2, y3; int lastCurrentWidth; + bool message; public: cSkinClassicDisplayReplay(bool ModeOnly); virtual ~cSkinClassicDisplayReplay(); @@ -342,6 +362,7 @@ public: virtual void SetCurrent(const char *Current); virtual void SetTotal(const char *Total); virtual void SetJump(const char *Jump); + virtual void SetMessage(eMessageType Type, const char *Text); virtual void Flush(void); }; @@ -350,6 +371,7 @@ cSkinClassicDisplayReplay::cSkinClassicDisplayReplay(bool ModeOnly) const cFont *font = cFont::GetFont(fontOsd); int lineHeight = font->Height(); lastCurrentWidth = 0; + message = false; x0 = 0; x1 = Setup.OSDWidth; y0 = 0; @@ -413,6 +435,20 @@ void cSkinClassicDisplayReplay::SetJump(const char *Jump) osd->DrawText(x0 + (x1 - x0) / 4, y2, Jump, Theme.Color(clrReplayModeJump), Theme.Color(clrBackground), cFont::GetFont(fontOsd), (x1 - x0) / 2, 0, taCenter); } +void cSkinClassicDisplayReplay::SetMessage(eMessageType Type, const char *Text) +{ + const cFont *font = cFont::GetFont(fontOsd); + if (Text) { + osd->SaveRegion(x0, y2, x1 - 1, y3 - 1); + osd->DrawText(x0, y2, Text, Theme.Color(clrMessageStatusFg + 2 * Type), Theme.Color(clrMessageStatusBg + 2 * Type), font, x1 - x0, y3 - y2, taCenter); + message = true; + } + else { + osd->RestoreRegion(); + message = false; + } +} + void cSkinClassicDisplayReplay::Flush(void) { osd->Flush(); diff --git a/skins.h b/skins.h index 03c8a4a0..814780c1 100644 --- a/skins.h +++ b/skins.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skins.h 1.2 2004/05/16 20:16:57 kls Exp $ + * $Id: skins.h 1.3 2004/05/29 13:13:21 kls Exp $ */ #ifndef __SKINS_H @@ -56,6 +56,11 @@ public: virtual void SetEvents(const cEvent *Present, const cEvent *Following) = 0; ///< Sets the Present and Following EPG events. It either of these ///< is not available, NULL will be given. + virtual void SetMessage(eMessageType Type, const char *Text) = 0; + ///< Sets a one line message Text, with the given Type. Type can be used + ///< to determine, e.g., the colors for displaying the Text. + ///< If Text is NULL, any previously displayed message must be removed, and + ///< any previous contents overwritten by the message must be restored. /*TODO SetButtons Red = Video options @@ -202,6 +207,11 @@ public: ///< needs to be able to handle variations in the length of this ///< string, which will occur when the user enters an actual value. ///< If Jump is NULL, the jump prompt shall be removed from the display. + virtual void SetMessage(eMessageType Type, const char *Text) = 0; + ///< Sets a one line message Text, with the given Type. Type can be used + ///< to determine, e.g., the colors for displaying the Text. + ///< If Text is NULL, any previously displayed message must be removed, and + ///< any previous contents overwritten by the message must be restored. }; class cSkinDisplayVolume : public cSkinDisplay { diff --git a/skinsttng.c b/skinsttng.c index 86ed2b8b..b1027cb3 100644 --- a/skinsttng.c +++ b/skinsttng.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skinsttng.c 1.3 2004/05/29 09:56:22 kls Exp $ + * $Id: skinsttng.c 1.4 2004/05/29 13:14:09 kls Exp $ */ // Star Trek: The Next Generation® is a registered trademark of Paramount Pictures @@ -124,6 +124,7 @@ private: bool withInfo; int lineHeight; tColor frameColor; + bool message; const cEvent *present; int lastSeen; static cBitmap bmTeletext, bmRadio, bmAudio, bmDolbyDigital, bmEncrypted, bmRecording; @@ -132,6 +133,7 @@ public: virtual ~cSkinSTTNGDisplayChannel(); virtual void SetChannel(const cChannel *Channel, int Number); virtual void SetEvents(const cEvent *Present, const cEvent *Following); + virtual void SetMessage(eMessageType Type, const char *Text); virtual void Flush(void); }; @@ -150,6 +152,7 @@ cSkinSTTNGDisplayChannel::cSkinSTTNGDisplayChannel(bool WithInfo) withInfo = WithInfo; lineHeight = font->Height(); frameColor = Theme.Color(clrChannelFrame); + message = false; if (withInfo) { x0 = 0; x1 = x0 + font->Width("00:00") + 4; @@ -251,7 +254,7 @@ void cSkinSTTNGDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Fo return; if (present != Present) lastSeen = -1; - present = Present; + present = Present; osd->DrawRectangle(x0, y3, x1 - 1, y4 - 1, frameColor); osd->DrawRectangle(x3, y3, x7 - 1, y4 - 1, Theme.Color(clrBackground)); for (int i = 0; i < 2; i++) { @@ -264,13 +267,33 @@ void cSkinSTTNGDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Fo } } +void cSkinSTTNGDisplayChannel::SetMessage(eMessageType Type, const char *Text) +{ + const cFont *font = cFont::GetFont(withInfo ? fontSml : fontOsd); + if (Text) { + int yt = withInfo ? y6 : y0; + int yb = withInfo ? y7 : y1; + osd->SaveRegion(x2, yt, x4 - 1, yb - 1); + if (withInfo) + osd->DrawRectangle(x2, yt, x3 - 1, yb - 1, Theme.Color(clrBackground)); + osd->DrawText(x3, yt, Text, Theme.Color(clrMessageStatusFg + 2 * Type), Theme.Color(clrMessageStatusBg + 2 * Type), font, x4 - x3, 0, taCenter); + message = true; + } + else { + osd->RestoreRegion(); + message = false; + } +} + void cSkinSTTNGDisplayChannel::Flush(void) { if (withInfo) { - const char *date = DayDateTime(); - const cFont *font = cFont::GetFont(fontSml); - osd->DrawText(x4 - font->Width(date) - 2, y7 - font->Height(date), date, Theme.Color(clrChannelDate), frameColor, font); - + if (!message) { + const char *date = DayDateTime(); + const cFont *font = cFont::GetFont(fontSml); + osd->DrawText(x4 - font->Width(date) - 2, y7 - font->Height(date), date, Theme.Color(clrChannelDate), frameColor, font); + } + int seen = 0; if (present) { time_t t = time(NULL); @@ -576,6 +599,7 @@ private: int y0, y1, y2, y3, y4, y5, y6, y7; tColor frameColor; int lastCurrentWidth; + bool message; public: cSkinSTTNGDisplayReplay(bool ModeOnly); virtual ~cSkinSTTNGDisplayReplay(); @@ -585,6 +609,7 @@ public: virtual void SetCurrent(const char *Current); virtual void SetTotal(const char *Total); virtual void SetJump(const char *Jump); + virtual void SetMessage(eMessageType Type, const char *Text); virtual void Flush(void); }; @@ -597,6 +622,7 @@ cSkinSTTNGDisplayReplay::cSkinSTTNGDisplayReplay(bool ModeOnly) int lineHeight = font->Height(); frameColor = Theme.Color(clrReplayFrame); lastCurrentWidth = 0; + message = false; cBitmap bm(play_xpm); x0 = 0; x1 = max(SymbolWidth, bm.Width()); @@ -695,6 +721,21 @@ void cSkinSTTNGDisplayReplay::SetJump(const char *Jump) osd->DrawText(x0 + (x4 - x0) / 4, y6, Jump, Theme.Color(clrReplayJump), frameColor, cFont::GetFont(fontSml), (x4 - x3) / 2, 0, taCenter); } +void cSkinSTTNGDisplayReplay::SetMessage(eMessageType Type, const char *Text) +{ + const cFont *font = cFont::GetFont(fontSml); + if (Text) { + osd->SaveRegion(x2, y6, x4 - 1, y7 - 1); + osd->DrawRectangle(x2, y6, x3 - 1, y7 - 1, Theme.Color(clrBackground)); + osd->DrawText(x3, y6, Text, Theme.Color(clrMessageStatusFg + 2 * Type), Theme.Color(clrMessageStatusBg + 2 * Type), font, x4 - x3, 0, taCenter); + message = true; + } + else { + osd->RestoreRegion(); + message = false; + } +} + void cSkinSTTNGDisplayReplay::Flush(void) { osd->Flush();