diff options
Diffstat (limited to 'PLUGINS')
-rw-r--r-- | PLUGINS/src/skincurses/HISTORY | 5 | ||||
-rw-r--r-- | PLUGINS/src/skincurses/skincurses.c | 81 | ||||
-rw-r--r-- | PLUGINS/src/sky/HISTORY | 9 | ||||
-rw-r--r-- | PLUGINS/src/sky/sky.c | 8 |
4 files changed, 93 insertions, 10 deletions
diff --git a/PLUGINS/src/skincurses/HISTORY b/PLUGINS/src/skincurses/HISTORY index df67358..8ba4ae4 100644 --- a/PLUGINS/src/skincurses/HISTORY +++ b/PLUGINS/src/skincurses/HISTORY @@ -8,3 +8,8 @@ VDR Plugin 'skincurses' Revision History 2004-05-31: Version 0.0.2 - Fixed some default parameters. + +2005-01-02: Version 0.0.3 + +- Made several functions threadsafe. +- New audio track display. diff --git a/PLUGINS/src/skincurses/skincurses.c b/PLUGINS/src/skincurses/skincurses.c index e2b218d..a1c5954 100644 --- a/PLUGINS/src/skincurses/skincurses.c +++ b/PLUGINS/src/skincurses/skincurses.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: skincurses.c 1.2 2004/05/31 14:57:40 kls Exp $ + * $Id: skincurses.c 1.5 2005/01/09 11:56:26 kls Exp $ */ #include <ncurses.h> @@ -11,7 +11,7 @@ #include <vdr/plugin.h> #include <vdr/skins.h> -static const char *VERSION = "0.0.2"; +static const char *VERSION = "0.0.3"; static const char *DESCRIPTION = "A text only skin"; static const char *MAINMENUENTRY = NULL; @@ -252,7 +252,7 @@ void cSkinCursesDisplayChannel::SetMessage(eMessageType Type, const char *Text) void cSkinCursesDisplayChannel::Flush(void) { if (!message) { - const char *date = DayDateTime(); + cString date = DayDateTime(); osd->DrawText(OsdWidth - strlen(date), 0, date, clrWhite, clrBackground, &Font); } osd->Flush(); @@ -382,11 +382,11 @@ void cSkinCursesDisplayMenu::SetEvent(const cEvent *Event) int y = 2; cTextScroller ts; char t[32]; - snprintf(t, sizeof(t), "%s %s - %s", Event->GetDateString(), Event->GetTimeString(), Event->GetEndTimeString()); + snprintf(t, sizeof(t), "%s %s - %s", *Event->GetDateString(), *Event->GetTimeString(), *Event->GetEndTimeString()); ts.Set(osd, 0, y, OsdWidth, OsdHeight - y - 2, t, &Font, clrYellow, clrBackground); if (Event->Vps() && Event->Vps() != Event->StartTime()) { char *buffer; - asprintf(&buffer, " VPS: %s", Event->GetVpsString()); + asprintf(&buffer, " VPS: %s", *Event->GetVpsString()); osd->DrawText(OsdWidth - strlen(buffer), y, buffer, clrBlack, clrYellow, &Font); free(buffer); } @@ -418,7 +418,7 @@ void cSkinCursesDisplayMenu::SetText(const char *Text, bool FixedFont) void cSkinCursesDisplayMenu::Flush(void) { - const char *date = DayDateTime(); + cString date = DayDateTime(); osd->DrawText(OsdWidth - strlen(date) - 2, 0, date, clrBlack, clrCyan, &Font); osd->Flush(); } @@ -558,6 +558,69 @@ void cSkinCursesDisplayVolume::Flush(void) osd->Flush(); } +// --- cSkinCursesDisplayTracks ---------------------------------------------- + +class cSkinCursesDisplayTracks : public cSkinDisplayTracks { +private: + cOsd *osd; + int itemsWidth; + int currentIndex; + void SetItem(const char *Text, int Index, bool Current); +public: + cSkinCursesDisplayTracks(const char *Title, int NumTracks, const char * const *Tracks); + virtual ~cSkinCursesDisplayTracks(); + virtual void SetTrack(int Index, const char * const *Tracks); + virtual void SetAudioChannel(int AudioChannel) {} + virtual void Flush(void); + }; + +cSkinCursesDisplayTracks::cSkinCursesDisplayTracks(const char *Title, int NumTracks, const char * const *Tracks) +{ + currentIndex = -1; + itemsWidth = Font.Width(Title); + for (int i = 0; i < NumTracks; i++) + itemsWidth = max(itemsWidth, Font.Width(Tracks[i])); + itemsWidth = min(itemsWidth, OsdWidth); + osd = new cCursesOsd(0, 0); + osd->DrawRectangle(0, 0, OsdWidth - 1, OsdHeight - 1, clrBackground); + osd->DrawText(0, 0, Title, clrBlack, clrCyan, &Font, itemsWidth); + for (int i = 0; i < NumTracks; i++) + SetItem(Tracks[i], i, false); +} + +cSkinCursesDisplayTracks::~cSkinCursesDisplayTracks() +{ + delete osd; +} + +void cSkinCursesDisplayTracks::SetItem(const char *Text, int Index, bool Current) +{ + int y = 1 + Index; + int ColorFg, ColorBg; + if (Current) { + ColorFg = clrBlack; + ColorBg = clrCyan; + currentIndex = Index; + } + else { + ColorFg = clrWhite; + ColorBg = clrBackground; + } + osd->DrawText(0, y, Text, ColorFg, ColorBg, &Font, itemsWidth); +} + +void cSkinCursesDisplayTracks::SetTrack(int Index, const char * const *Tracks) +{ + if (currentIndex >= 0) + SetItem(Tracks[currentIndex], currentIndex, false); + SetItem(Tracks[Index], Index, true); +} + +void cSkinCursesDisplayTracks::Flush(void) +{ + osd->Flush(); +} + // --- cSkinCursesDisplayMessage --------------------------------------------- class cSkinCursesDisplayMessage : public cSkinDisplayMessage { @@ -600,6 +663,7 @@ public: virtual cSkinDisplayMenu *DisplayMenu(void); virtual cSkinDisplayReplay *DisplayReplay(bool ModeOnly); virtual cSkinDisplayVolume *DisplayVolume(void); + virtual cSkinDisplayTracks *DisplayTracks(const char *Title, int NumTracks, const char * const *Tracks); virtual cSkinDisplayMessage *DisplayMessage(void); }; @@ -633,6 +697,11 @@ cSkinDisplayVolume *cSkinCurses::DisplayVolume(void) return new cSkinCursesDisplayVolume; } +cSkinDisplayTracks *cSkinCurses::DisplayTracks(const char *Title, int NumTracks, const char * const *Tracks) +{ + return new cSkinCursesDisplayTracks(Title, NumTracks, Tracks); +} + cSkinDisplayMessage *cSkinCurses::DisplayMessage(void) { return new cSkinCursesDisplayMessage; diff --git a/PLUGINS/src/sky/HISTORY b/PLUGINS/src/sky/HISTORY index 2d15da7..2fed4c3 100644 --- a/PLUGINS/src/sky/HISTORY +++ b/PLUGINS/src/sky/HISTORY @@ -28,3 +28,12 @@ VDR Plugin 'sky' Revision History 2004-10-16: Version 0.3.1 - Improved buffer handling. + +2004-12-12: Version 0.3.2 + +- Changed Apid access in cChannel. + +2004-12-19: Version 0.3.3 + +- Made several functions threadsafe. +- Removed delay_ms(), using cCondWait::SleepMs() instead. diff --git a/PLUGINS/src/sky/sky.c b/PLUGINS/src/sky/sky.c index eea697e..bf4fa42 100644 --- a/PLUGINS/src/sky/sky.c +++ b/PLUGINS/src/sky/sky.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: sky.c 1.7 2004/10/16 09:10:06 kls Exp $ + * $Id: sky.c 1.11 2004/12/26 12:45:22 kls Exp $ */ #include <sys/socket.h> @@ -14,7 +14,7 @@ #include <vdr/plugin.h> #include <vdr/sources.h> -static const char *VERSION = "0.3.1"; +static const char *VERSION = "0.3.3"; static const char *DESCRIPTION = "Sky Digibox interface"; // --- cDigiboxDevice -------------------------------------------------------- @@ -113,7 +113,7 @@ void cDigiboxDevice::LircSend(const char *s) dsyslog(buf);//XXX if (write(fd_lirc, buf, strlen(buf)) < 0) LOG_ERROR;//XXX _STR - delay_ms(200); + cCondWait::SleepMs(200); } void cDigiboxDevice::LircSend(int n) @@ -213,7 +213,7 @@ bool cDigiboxDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) cSkyChannel *SkyChannel = SkyChannels.GetSkyChannel(Channel); if (SkyChannel) { digiboxChannelNumber = SkyChannel->digiboxChannelNumber; - apid = Channel->Apid1(); + apid = Channel->Apid(0); vpid = Channel->Vpid(); //XXX only when recording??? -> faster channel switching! LircSend("SKY"); // makes sure the Digibox is "on" |