mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
version 0.3.0
This commit is contained in:
@@ -1,17 +1,26 @@
|
||||
#define __STL_CONFIG_H
|
||||
#include "displaypluginview.h"
|
||||
|
||||
cDisplayPluginView::cDisplayPluginView(cTemplateView *tmplView) : cView(tmplView) {
|
||||
cDisplayPluginView::cDisplayPluginView(cTemplateView *tmplView, bool isRootView) : cView(tmplView) {
|
||||
init = true;
|
||||
tabInit = true;
|
||||
tabScrolled = true;
|
||||
hidden = false;
|
||||
intTokens = NULL;
|
||||
stringTokens = NULL;
|
||||
loopTokens = NULL;
|
||||
DeleteOsdOnExit();
|
||||
currentTmplTab = NULL;
|
||||
tabView = NULL;
|
||||
if (isRootView)
|
||||
DeleteOsdOnExit();
|
||||
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
|
||||
}
|
||||
|
||||
cDisplayPluginView::~cDisplayPluginView() {
|
||||
CancelSave();
|
||||
FadeOut();
|
||||
if (tabView)
|
||||
delete tabView;
|
||||
}
|
||||
|
||||
bool cDisplayPluginView::createOsd(void) {
|
||||
@@ -23,10 +32,49 @@ bool cDisplayPluginView::createOsd(void) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
void cDisplayPluginView::Deactivate(bool hide) {
|
||||
Stop();
|
||||
if (!hide)
|
||||
return;
|
||||
HidePixmaps();
|
||||
for (map< int, cViewGrid* >::iterator it = viewGrids.begin(); it != viewGrids.end(); it++) {
|
||||
cViewGrid *viewGrid = it->second;
|
||||
viewGrid->Hide();
|
||||
}
|
||||
hidden = true;
|
||||
}
|
||||
|
||||
void cDisplayPluginView::Activate(void) {
|
||||
if (tvScaled) {
|
||||
cDevice::PrimaryDevice()->ScaleVideo(scalingWindow);
|
||||
}
|
||||
if (hidden) {
|
||||
ShowPixmaps();
|
||||
for (map< int, cViewGrid* >::iterator it = viewGrids.begin(); it != viewGrids.end(); it++) {
|
||||
cViewGrid *viewGrid = it->second;
|
||||
viewGrid->Show();
|
||||
}
|
||||
}
|
||||
Start();
|
||||
}
|
||||
|
||||
void cDisplayPluginView::CleanViewElement(int id) {
|
||||
if (ViewElementScrolls((eViewElement)id)) {
|
||||
currentlyScrolling = false;
|
||||
if (Running())
|
||||
Stop();
|
||||
DestroyViewElement((eViewElement)id);
|
||||
} else {
|
||||
ClearViewElement((eViewElement)id);
|
||||
}
|
||||
}
|
||||
|
||||
void cDisplayPluginView::DisplayViewElement(int id) {
|
||||
if (!intTokens || !stringTokens || !loopTokens)
|
||||
return;
|
||||
DrawViewElement((eViewElement)id, stringTokens, intTokens, loopTokens);
|
||||
if (!init && ViewElementScrolls((eViewElement)id))
|
||||
Start();
|
||||
}
|
||||
|
||||
void cDisplayPluginView::InitGrids(int viewGridID) {
|
||||
@@ -75,9 +123,162 @@ void cDisplayPluginView::ClearGrids(int viewGridID) {
|
||||
(hit->second)->Clear();
|
||||
}
|
||||
|
||||
void cDisplayPluginView::SetTabIntTokens(map<string,int> *intTokens) {
|
||||
tabIntTokens = *intTokens;
|
||||
}
|
||||
|
||||
void cDisplayPluginView::SetTabStringTokens(map<string,string> *stringTokens) {
|
||||
tabStringTokens = *stringTokens;
|
||||
}
|
||||
|
||||
void cDisplayPluginView::SetTabLoopTokens(map<string,vector<map<string,string> > > *loopTokens) {
|
||||
tabLoopTokens = *loopTokens;
|
||||
}
|
||||
|
||||
void cDisplayPluginView::SetTabs(void) {
|
||||
tmplView->InitViewTabIterator();
|
||||
cTemplateViewTab *tmplTab = NULL;
|
||||
while(tmplTab = tmplView->GetNextViewTab()) {
|
||||
tmplTab->ParseDynamicParameters(&tabIntTokens, true);
|
||||
tmplTab->ClearDynamicFunctionParameters();
|
||||
tmplTab->ParseDynamicFunctionParameters(&tabStringTokens, &tabIntTokens);
|
||||
if (tmplTab->DoExecute()) {
|
||||
activeTabs.push_back(tmplTab);
|
||||
}
|
||||
}
|
||||
atIt = activeTabs.begin();
|
||||
}
|
||||
|
||||
void cDisplayPluginView::TabLeft(void) {
|
||||
if (activeTabs.size() > 1) {
|
||||
currentTmplTab = GetPrevTab();
|
||||
delete tabView;
|
||||
tabView = NULL;
|
||||
tabScrolled = true;
|
||||
} else {
|
||||
tabScrolled = tabView->KeyLeft();
|
||||
}
|
||||
}
|
||||
|
||||
void cDisplayPluginView::TabRight(void) {
|
||||
if (activeTabs.size() > 1) {
|
||||
currentTmplTab = GetNextTab();
|
||||
delete tabView;
|
||||
tabView = NULL;
|
||||
tabScrolled = true;
|
||||
} else {
|
||||
tabScrolled = tabView->KeyRight();
|
||||
}
|
||||
}
|
||||
|
||||
void cDisplayPluginView::TabUp(void) {
|
||||
tabScrolled = tabView->KeyUp();
|
||||
}
|
||||
|
||||
void cDisplayPluginView::TabDown(void) {
|
||||
tabScrolled = tabView->KeyDown();
|
||||
}
|
||||
|
||||
void cDisplayPluginView::DisplayTab(void) {
|
||||
if (tabInit) {
|
||||
currentTmplTab = *atIt;
|
||||
tabInit = false;
|
||||
}
|
||||
if (!tabView) {
|
||||
tabView = new cDisplayMenuTabView(currentTmplTab);
|
||||
tabView->SetTokens(&tabIntTokens, &tabStringTokens, &tabLoopTokens);
|
||||
tabView->CreateTab();
|
||||
tabView->Start();
|
||||
DrawTabLabels();
|
||||
}
|
||||
if (tabScrolled) {
|
||||
DrawScrollbar();
|
||||
}
|
||||
}
|
||||
|
||||
cTemplateViewTab *cDisplayPluginView::GetPrevTab(void) {
|
||||
if (atIt == activeTabs.begin()) {
|
||||
atIt = activeTabs.end();
|
||||
}
|
||||
atIt--;
|
||||
return *atIt;
|
||||
}
|
||||
|
||||
cTemplateViewTab *cDisplayPluginView::GetNextTab(void) {
|
||||
atIt++;
|
||||
if (atIt == activeTabs.end()) {
|
||||
atIt = activeTabs.begin();
|
||||
}
|
||||
return *atIt;
|
||||
}
|
||||
|
||||
void cDisplayPluginView::DrawScrollbar(void) {
|
||||
map < string, string > scrollbarStringTokens;
|
||||
map < string, int > scrollbarIntTokens;
|
||||
|
||||
int barTop = 0;
|
||||
int barHeight = 0;
|
||||
tabView->GetScrollbarPosition(barTop, barHeight);
|
||||
|
||||
scrollbarIntTokens.insert(pair<string,int>("height", barHeight));
|
||||
scrollbarIntTokens.insert(pair<string,int>("offset", barTop));
|
||||
ClearViewElement((eViewElement)pveScrollbar);
|
||||
DrawViewElement((eViewElement)pveScrollbar, &scrollbarStringTokens, &scrollbarIntTokens);
|
||||
}
|
||||
|
||||
void cDisplayPluginView::DrawTabLabels(void) {
|
||||
if (!ViewElementImplemented((eViewElement)pveTablabels)) {
|
||||
return;
|
||||
}
|
||||
map < string, string > labelStringTokens;
|
||||
map < string, int > labelIntTokens;
|
||||
map < string, vector< map< string, string > > > labelLoopTokens;
|
||||
|
||||
string labelPrev = "";
|
||||
string labelPrevTemp = "";
|
||||
string labelCurrent = "";
|
||||
string labelNext = "";
|
||||
bool wasCurrent = false;
|
||||
vector< map< string, string > > tabLabels;
|
||||
for (list<cTemplateViewTab*>::iterator it = activeTabs.begin(); it != activeTabs.end(); it++) {
|
||||
cTemplateViewTab *tab = *it;
|
||||
map< string, string > tabLabel;
|
||||
tabLabel.insert(pair< string, string >("tabs[title]", tab->GetName()));
|
||||
if (wasCurrent) {
|
||||
labelNext = tab->GetName();
|
||||
}
|
||||
if (tab == currentTmplTab) {
|
||||
wasCurrent = true;
|
||||
labelCurrent = tab->GetName();
|
||||
labelPrev = labelPrevTemp;
|
||||
tabLabel.insert(pair< string, string >("tabs[current]", "1"));
|
||||
} else {
|
||||
wasCurrent = false;
|
||||
tabLabel.insert(pair< string, string >("tabs[current]", "0"));
|
||||
}
|
||||
labelPrevTemp = tab->GetName();
|
||||
tabLabels.push_back(tabLabel);
|
||||
}
|
||||
if (labelNext.size() == 0 && activeTabs.size() > 0) {
|
||||
cTemplateViewTab *firstTab = activeTabs.front();
|
||||
labelNext = firstTab->GetName();
|
||||
}
|
||||
if (labelPrev.size() == 0 && activeTabs.size() > 0) {
|
||||
cTemplateViewTab *lastTab = activeTabs.back();
|
||||
labelPrev = lastTab->GetName();
|
||||
}
|
||||
labelStringTokens.insert(pair< string, string >("currenttab", labelCurrent));
|
||||
labelStringTokens.insert(pair< string, string >("nexttab", labelNext));
|
||||
labelStringTokens.insert(pair< string, string >("prevtab", labelPrev));
|
||||
labelLoopTokens.insert(pair< string, vector< map< string, string > > >("tabs", tabLabels));
|
||||
|
||||
ClearViewElement((eViewElement)pveTablabels);
|
||||
DrawViewElement((eViewElement)pveTablabels, &labelStringTokens, &labelIntTokens, &labelLoopTokens);
|
||||
}
|
||||
|
||||
void cDisplayPluginView::Action(void) {
|
||||
SetInitFinished();
|
||||
FadeIn();
|
||||
DoFlush();
|
||||
cView::Action();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user