vdr-plugin-skindesigner/displaytracks.c

59 lines
1.6 KiB
C
Raw Normal View History

2014-09-27 09:25:14 +02:00
#include "displaytracks.h"
cSDDisplayTracks::cSDDisplayTracks(cTemplate *audiotracksTemplate, const char *Title, int NumTracks, const char * const *Tracks) {
initial = true;
numTracks = NumTracks;
tracksView = NULL;
2014-09-27 09:25:14 +02:00
doOutput = true;
currentTrack = 0;
menuTitle = Title;
if (!audiotracksTemplate) {
esyslog("skindesigner: displayTracks no valid template - aborting");
doOutput = false;
return;
}
tracksView = new cDisplayAudiotracksView(NumTracks, audiotracksTemplate->GetRootView());
if (!tracksView->createOsd()) {
doOutput = false;
return;
}
tracksView->DrawBackground();
cDisplayMenuListView *list = tracksView->GetListView();
if (list) {
for (int i = 0; i < NumTracks; i++) {
list->AddTracksMenuItem(i, Tracks[i], (i==currentTrack)?true:false, true);
}
}
}
cSDDisplayTracks::~cSDDisplayTracks() {
if (tracksView)
delete tracksView;
2014-09-27 09:25:14 +02:00
}
void cSDDisplayTracks::SetTrack(int Index, const char * const *Tracks) {
cDisplayMenuListView *list = tracksView->GetListView();
if (list) {
list->AddTracksMenuItem(currentTrack, Tracks[currentTrack], false, true);
list->AddTracksMenuItem(Index, Tracks[Index], true, true);
currentTrack = Index;
}
}
void cSDDisplayTracks::SetAudioChannel(int AudioChannel) {
tracksView->DrawHeader(menuTitle, AudioChannel);
}
void cSDDisplayTracks::Flush(void) {
if (!doOutput)
return;
if (initial) {
tracksView->DoFadeIn();
}
initial = false;
tracksView->RenderMenuItems();
tracksView->Flush();
}