vdr-plugin-skindesigner/coreengine/viewdisplaytracks.c

122 lines
3.2 KiB
C
Raw Normal View History

2016-02-06 09:55:15 +01:00
#include "viewdisplaytracks.h"
#include "../config.h"
/************************************************************************************
* cViewTracks
************************************************************************************/
cViewTracks::cViewTracks(void) {
ClearVariables();
viewId = eViewType::DisplayTracks;
viewName = strdup("displayaudiotracks");
numViewElements = (int)eVeDisplayTracks::count;
viewElements = new cViewElement*[numViewElements];
for (int i=0; i < numViewElements; i++) {
viewElements[i] = NULL;
}
viewList = NULL;
veBackground = NULL;
veHeader = NULL;
SetViewElements();
}
cViewTracks::~cViewTracks() {
}
void cViewTracks::SetViewElements(void) {
viewElementNames.insert(pair<string, int>("background", (int)eVeDisplayTracks::background));
viewElementNames.insert(pair<string, int>("header", (int)eVeDisplayTracks::header));
}
void cViewTracks::SetViewElementObjects(void) {
if (viewElements[(int)eVeDisplayTracks::background])
veBackground = dynamic_cast<cVeDtBackground*>(viewElements[(int)eVeDisplayTracks::background]);
if (viewElements[(int)eVeDisplayTracks::header])
veHeader = dynamic_cast<cVeDtHeader*>(viewElements[(int)eVeDisplayTracks::header]);
}
void cViewTracks::ClearVariables(void) {
init = true;
change = true;
}
void cViewTracks::Close(void) {
2016-07-22 15:21:09 +02:00
animator->Stop();
animator->Finish();
delete animator;
animator = NULL;
2016-02-06 09:55:15 +01:00
for (int i=0; i < numViewElements; i++) {
if (viewElements[i]) {
viewElements[i]->Close();
}
}
if (viewList) {
viewList->Close();
}
ClearVariables();
sdOsd.DeleteOsd();
}
void cViewTracks::AddViewList(cViewList *viewList) {
this->viewList = dynamic_cast<cViewListAudioTracks*>(viewList);
}
void cViewTracks::PreCache(void) {
cView::PreCache();
if (viewList) {
viewList->SetContainer(0, 0, attribs->Width(), attribs->Height());
viewList->SetGlobals(globals);
viewList->PreCache();
}
}
void cViewTracks::SetTitle(const char *title) {
if (veHeader)
veHeader->SetTitle(title);
change = true;
}
void cViewTracks::SetNumtracks(int numTracks) {
if (veBackground)
veBackground->Set(numTracks);
if (veHeader)
veHeader->SetNumtracks(numTracks);
if (viewList)
viewList->SetNumtracks(numTracks);
}
void cViewTracks::SetAudiochannel(int audioChannel) {
if (veHeader)
veHeader->SetAudiochannel(audioChannel);
change = true;
}
void cViewTracks::SetTracks(const char * const *tracks) {
if (viewList)
viewList->SetTracks(tracks);
change = true;
}
void cViewTracks::SetCurrentTrack(int index) {
if (viewList)
viewList->SetCurrentTrack(index);
change = true;
}
2016-07-22 15:21:09 +02:00
void cViewTracks::Flush(void) {
2016-02-06 09:55:15 +01:00
if (init) {
2016-07-22 15:21:09 +02:00
Render((int)eVeDisplayTracks::background);
if (viewList) {
viewList->Draw();
2016-07-22 15:21:09 +02:00
viewList->StartAnimation(true);
}
2016-02-06 09:55:15 +01:00
}
if (change) {
Render((int)eVeDisplayTracks::header);
if (viewList && !init)
2016-02-06 09:55:15 +01:00
viewList->Draw();
change = false;
}
2016-07-22 15:21:09 +02:00
cView::Flush();
2016-02-06 09:55:15 +01:00
}