summaryrefslogtreecommitdiff
path: root/PLUGINS/src
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-01-02 15:11:44 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2005-01-02 15:11:44 +0100
commit0b3a801ab463186519e9e1c14ea891924c64dff5 (patch)
tree9795fd31fa77a909b5a9cd19ee89a7062d381685 /PLUGINS/src
parent286af66cfb787b76ee7289c920a75a3dd21ce795 (diff)
downloadvdr-0b3a801ab463186519e9e1c14ea891924c64dff5.tar.gz
vdr-0b3a801ab463186519e9e1c14ea891924c64dff5.tar.bz2
Implemented audio track menu
Diffstat (limited to 'PLUGINS/src')
-rw-r--r--PLUGINS/src/skincurses/HISTORY3
-rw-r--r--PLUGINS/src/skincurses/skincurses.c70
2 files changed, 71 insertions, 2 deletions
diff --git a/PLUGINS/src/skincurses/HISTORY b/PLUGINS/src/skincurses/HISTORY
index 057fb6f8..8ba4ae4e 100644
--- a/PLUGINS/src/skincurses/HISTORY
+++ b/PLUGINS/src/skincurses/HISTORY
@@ -9,6 +9,7 @@ VDR Plugin 'skincurses' Revision History
- Fixed some default parameters.
-2004-12-26: Version 0.0.3
+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 eeae1ef0..ee1df052 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.3 2004/12/26 11:36:35 kls Exp $
+ * $Id: skincurses.c 1.4 2005/01/02 15:11:29 kls Exp $
*/
#include <ncurses.h>
@@ -558,6 +558,68 @@ 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 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 +662,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 +696,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;