summaryrefslogtreecommitdiff
path: root/displaytracks.c
diff options
context:
space:
mode:
Diffstat (limited to 'displaytracks.c')
-rw-r--r--displaytracks.c56
1 files changed, 50 insertions, 6 deletions
diff --git a/displaytracks.c b/displaytracks.c
index e53e0142..655ef148 100644
--- a/displaytracks.c
+++ b/displaytracks.c
@@ -6,13 +6,26 @@ cFlatDisplayTracks::cFlatDisplayTracks(const char *Title, int NumTracks, const c
CreateFullOsd();
TopBarCreate();
+ img_ac3 = imgLoader.LoadIcon("tracks_ac3", 999, fontHeight);
+ img_stereo = imgLoader.LoadIcon("tracks_stereo", 999, fontHeight);
+
+ ac3Width = stereoWidth = 0;
+ if( img_ac3 )
+ ac3Width = img_ac3->Width();
+ if( img_stereo )
+ stereoWidth = img_stereo->Width();
+
+ int imgWidthMax = max(ac3Width, stereoWidth);
itemHeight = fontHeight + Config.MenuItemPadding + Config.decorBorderTrackSize*2;
currentIndex = -1;
maxItemWidth = font->Width(Title) + marginItem*2;
for (int i = 0; i < NumTracks; i++)
maxItemWidth = max(maxItemWidth, font->Width(Tracks[i]) + marginItem*2);
-
- itemsHeight = NumTracks * itemHeight;
+
+ int headerWidth = font->Width(tr("Audio Tracks")) + font->Width(" ") + imgWidthMax;
+ maxItemWidth = max(maxItemWidth, headerWidth);
+
+ itemsHeight = (NumTracks+1) * itemHeight;
int left = osdWidth - maxItemWidth;
left /= 2;
TopBarSetTitle(Title);
@@ -20,16 +33,22 @@ cFlatDisplayTracks::cFlatDisplayTracks(const char *Title, int NumTracks, const c
tracksPixmap = osd->CreatePixmap(1, cRect(left, osdHeight - itemsHeight - marginItem, maxItemWidth, itemsHeight));
tracksPixmap->Fill(clrTransparent);
+ tracksLogoPixmap = osd->CreatePixmap(1, cRect(left, osdHeight - itemsHeight - marginItem, maxItemWidth, itemsHeight));
+ tracksLogoPixmap->Fill(clrTransparent);
+
+ SetItem(tr("Audio Tracks"), -1, false);
+
for (int i = 0; i < NumTracks; i++)
SetItem(Tracks[i], i, false);
}
cFlatDisplayTracks::~cFlatDisplayTracks() {
osd->DestroyPixmap(tracksPixmap);
+ osd->DestroyPixmap(tracksLogoPixmap);
}
void cFlatDisplayTracks::SetItem(const char *Text, int Index, bool Current) {
- int y = Index * itemHeight;
+ int y = (Index+1) * itemHeight;
tColor ColorFg, ColorBg;
if (Current) {
ColorFg = Theme.Color(clrTrackItemCurrentFont);
@@ -37,10 +56,19 @@ void cFlatDisplayTracks::SetItem(const char *Text, int Index, bool Current) {
currentIndex = Index;
}
else {
- ColorFg = Theme.Color(clrTrackItemFont);
- ColorBg = Theme.Color(clrTrackItemBg);
+ if( Index >= 0 ) {
+ ColorFg = Theme.Color(clrTrackItemSelableFont);
+ ColorBg = Theme.Color(clrTrackItemSelableBg);
+ } else {
+ ColorFg = Theme.Color(clrTrackItemFont);
+ ColorBg = Theme.Color(clrTrackItemBg);
+ }
}
- tracksPixmap->DrawText(cPoint(0, y), Text, ColorFg, ColorBg, font, maxItemWidth, itemHeight - Config.MenuItemPadding - Config.decorBorderTrackSize*2, taCenter);
+
+ if( Index == -1 )
+ tracksPixmap->DrawText(cPoint(0, y), Text, ColorFg, ColorBg, font, maxItemWidth, itemHeight - Config.MenuItemPadding - Config.decorBorderTrackSize*2, taLeft);
+ else
+ tracksPixmap->DrawText(cPoint(0, y), Text, ColorFg, ColorBg, font, maxItemWidth, itemHeight - Config.MenuItemPadding - Config.decorBorderTrackSize*2, taCenter);
int left = osdWidth - maxItemWidth;
left /= 2;
@@ -50,9 +78,13 @@ void cFlatDisplayTracks::SetItem(const char *Text, int Index, bool Current) {
if( Current )
DecorBorderDraw(left, top, maxItemWidth, fontHeight,
Config.decorBorderTrackSize, Config.decorBorderTrackType, Config.decorBorderTrackCurFg, Config.decorBorderTrackCurBg);
+ else if( Index >= 0 )
+ DecorBorderDraw(left, top, maxItemWidth, fontHeight,
+ Config.decorBorderTrackSize, Config.decorBorderTrackType, Config.decorBorderTrackSelFg, Config.decorBorderTrackSelBg);
else
DecorBorderDraw(left, top, maxItemWidth, fontHeight,
Config.decorBorderTrackSize, Config.decorBorderTrackType, Config.decorBorderTrackFg, Config.decorBorderTrackBg);
+
}
void cFlatDisplayTracks::SetTrack(int Index, const char * const *Tracks) {
@@ -62,6 +94,18 @@ void cFlatDisplayTracks::SetTrack(int Index, const char * const *Tracks) {
}
void cFlatDisplayTracks::SetAudioChannel(int AudioChannel) {
+ // from vdr 0=stereo, 1=left, 2=right, -1=don't display the audio channel indicator.
+ // from skinnopacity -1 ac3, else stero
+ tracksLogoPixmap->Fill(clrTransparent);
+ if( AudioChannel == -1 && img_ac3 ) {
+ int IconLeft = maxItemWidth - img_ac3->Width() - marginItem;
+ int IconTop = (fontHeight - img_ac3->Height()) / 2;
+ tracksLogoPixmap->DrawImage( cPoint(IconLeft, IconTop), *img_ac3 );
+ } else if( img_stereo ){
+ int IconLeft = maxItemWidth - img_stereo->Width() - marginItem;
+ int IconTop = (fontHeight - img_stereo->Height()) / 2;
+ tracksLogoPixmap->DrawImage( cPoint(IconLeft, IconTop), *img_stereo );
+ }
return;
}