mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
immplemented areacontainers to group areas
This commit is contained in:
@@ -18,13 +18,13 @@ bool cGlobals::ReadFromXML(void) {
|
||||
//globals.xml is mandatory
|
||||
string xmlFile = "globals.xml";
|
||||
cXmlParser parser;
|
||||
if (!parser.ReadGlobals(this, xmlFile, true))
|
||||
if (!parser.ReadGlobals(this, xmlFile))
|
||||
return false;
|
||||
if (!parser.ParseGlobals())
|
||||
return false;
|
||||
//theme.xml is optional
|
||||
xmlFile = "theme.xml";
|
||||
if (parser.ReadGlobals(this, xmlFile, false)) {
|
||||
if (parser.ReadGlobals(this, xmlFile)) {
|
||||
parser.ParseGlobals();
|
||||
}
|
||||
return true;
|
||||
|
@@ -190,10 +190,10 @@ void cTemplate::GetUsedFonts(cTemplateView *view, vector< pair<string, int> > &u
|
||||
view->InitViewElementIterator();
|
||||
cTemplateViewElement *viewElement = NULL;
|
||||
while(viewElement = view->GetNextViewElement()) {
|
||||
viewElement->InitIterator();
|
||||
viewElement->InitPixmapIterator();
|
||||
cTemplatePixmap *pix = NULL;
|
||||
while(pix = viewElement->GetNextPixmap()) {
|
||||
pix->InitIterator();
|
||||
pix->InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = pix->GetNextFunction()) {
|
||||
if (func->GetType() == ftDrawText) {
|
||||
@@ -206,10 +206,10 @@ void cTemplate::GetUsedFonts(cTemplateView *view, vector< pair<string, int> > &u
|
||||
view->InitViewListIterator();
|
||||
cTemplateViewList *viewList = NULL;
|
||||
while(viewList = view->GetNextViewList()) {
|
||||
viewList->InitIterator();
|
||||
viewList->InitPixmapIterator();
|
||||
cTemplatePixmap *pix = NULL;
|
||||
while(pix = viewList->GetNextPixmap()) {
|
||||
pix->InitIterator();
|
||||
pix->InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = pix->GetNextFunction()) {
|
||||
if (func->GetType() == ftDrawText) {
|
||||
@@ -218,9 +218,9 @@ void cTemplate::GetUsedFonts(cTemplateView *view, vector< pair<string, int> > &u
|
||||
}
|
||||
}
|
||||
cTemplateViewElement *listElement = viewList->GetListElement();
|
||||
listElement->InitIterator();
|
||||
listElement->InitPixmapIterator();
|
||||
while(pix = listElement->GetNextPixmap()) {
|
||||
pix->InitIterator();
|
||||
pix->InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = pix->GetNextFunction()) {
|
||||
if (func->GetType() == ftDrawText) {
|
||||
@@ -233,7 +233,7 @@ void cTemplate::GetUsedFonts(cTemplateView *view, vector< pair<string, int> > &u
|
||||
view->InitViewTabIterator();
|
||||
cTemplateViewTab *viewTab = NULL;
|
||||
while(viewTab = view->GetNextViewTab()) {
|
||||
viewTab->InitIterator();
|
||||
viewTab->InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = viewTab->GetNextFunction()) {
|
||||
if (func->GetType() == ftDrawText) {
|
||||
@@ -248,7 +248,7 @@ void cTemplate::CacheImages(cTemplateView *view) {
|
||||
view->InitViewElementIterator();
|
||||
cTemplateViewElement *viewElement = NULL;
|
||||
while(viewElement = view->GetNextViewElement()) {
|
||||
viewElement->InitIterator();
|
||||
viewElement->InitPixmapIterator();
|
||||
cTemplatePixmap *pix = NULL;
|
||||
while(pix = viewElement->GetNextPixmap()) {
|
||||
CachePixmapImages(pix);
|
||||
@@ -258,13 +258,13 @@ void cTemplate::CacheImages(cTemplateView *view) {
|
||||
view->InitViewListIterator();
|
||||
cTemplateViewList *viewList = NULL;
|
||||
while(viewList = view->GetNextViewList()) {
|
||||
viewList->InitIterator();
|
||||
viewList->InitPixmapIterator();
|
||||
cTemplatePixmap *pix = NULL;
|
||||
while(pix = viewList->GetNextPixmap()) {
|
||||
CachePixmapImages(pix);
|
||||
}
|
||||
cTemplateViewElement *listElement = viewList->GetListElement();
|
||||
listElement->InitIterator();
|
||||
listElement->InitPixmapIterator();
|
||||
while(pix = listElement->GetNextPixmap()) {
|
||||
CachePixmapImages(pix);
|
||||
}
|
||||
@@ -272,7 +272,7 @@ void cTemplate::CacheImages(cTemplateView *view) {
|
||||
if (!currentElement) {
|
||||
continue;
|
||||
}
|
||||
currentElement->InitIterator();
|
||||
currentElement->InitPixmapIterator();
|
||||
while(pix = currentElement->GetNextPixmap()) {
|
||||
CachePixmapImages(pix);
|
||||
}
|
||||
@@ -286,7 +286,7 @@ void cTemplate::CacheImages(cTemplateView *view) {
|
||||
}
|
||||
|
||||
void cTemplate::CachePixmapImages(cTemplatePixmap *pix) {
|
||||
pix->InitIterator();
|
||||
pix->InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = pix->GetNextFunction()) {
|
||||
if (func->GetType() == ftDrawImage) {
|
||||
|
@@ -1568,6 +1568,9 @@ string cTemplateFunction::GetFuncName(void) {
|
||||
case ftViewElement:
|
||||
name = "View Element Parameters";
|
||||
break;
|
||||
case ftPixmapContainer:
|
||||
name = "Pixmap Container Parameters";
|
||||
break;
|
||||
case ftPixmap:
|
||||
name = "Pixmap Parameters";
|
||||
break;
|
||||
|
@@ -23,6 +23,7 @@ enum eFuncType {
|
||||
ftView,
|
||||
ftViewElement,
|
||||
ftViewList,
|
||||
ftPixmapContainer,
|
||||
ftPixmap,
|
||||
ftPixmapScroll,
|
||||
ftLoop,
|
||||
|
@@ -1,16 +1,40 @@
|
||||
#include "templatepixmap.h"
|
||||
|
||||
using namespace std;
|
||||
// --- cTemplatePixmapNode -------------------------------------------------------------
|
||||
|
||||
// --- cTemplatePixmap -------------------------------------------------------------
|
||||
|
||||
cTemplatePixmap::cTemplatePixmap(void) {
|
||||
cTemplatePixmapNode::cTemplatePixmapNode(void) {
|
||||
parameters = NULL;
|
||||
globals = NULL;
|
||||
containerX = 0;
|
||||
containerY = 0;
|
||||
containerWidth = 0;
|
||||
containerHeight = 0;
|
||||
globals = NULL;
|
||||
}
|
||||
|
||||
cTemplatePixmapNode::~cTemplatePixmapNode() {
|
||||
if (parameters)
|
||||
delete parameters;
|
||||
}
|
||||
|
||||
void cTemplatePixmapNode::SetParameters(vector<stringpair> ¶ms) {
|
||||
parameters = new cTemplateFunction(isContainer?ftPixmapContainer:ftPixmap);
|
||||
parameters->SetGlobals(globals);
|
||||
parameters->SetParameters(params);
|
||||
}
|
||||
|
||||
void cTemplatePixmapNode::SetContainer(int x, int y, int w, int h) {
|
||||
containerX = x;
|
||||
containerY = y;
|
||||
containerWidth = w;
|
||||
containerHeight = h;
|
||||
}
|
||||
|
||||
// --- cTemplatePixmap -------------------------------------------------------------
|
||||
|
||||
cTemplatePixmap::cTemplatePixmap(void) {
|
||||
pixContainer = NULL;
|
||||
isContainer = false;
|
||||
scrolling = false;
|
||||
background = false;
|
||||
}
|
||||
@@ -19,21 +43,6 @@ cTemplatePixmap::~cTemplatePixmap() {
|
||||
for (vector<cTemplateFunction*>::iterator it = functions.begin(); it != functions.end(); it++) {
|
||||
delete (*it);
|
||||
}
|
||||
if (parameters)
|
||||
delete parameters;
|
||||
}
|
||||
|
||||
void cTemplatePixmap::SetParameters(vector<pair<string, string> > ¶ms) {
|
||||
parameters = new cTemplateFunction(ftPixmap);
|
||||
parameters->SetGlobals(globals);
|
||||
parameters->SetParameters(params);
|
||||
}
|
||||
|
||||
void cTemplatePixmap::SetContainer(int x, int y, int w, int h) {
|
||||
containerX = x;
|
||||
containerY = y;
|
||||
containerWidth = w;
|
||||
containerHeight = h;
|
||||
}
|
||||
|
||||
void cTemplatePixmap::SetWidth(int width) {
|
||||
@@ -76,6 +85,11 @@ void cTemplatePixmap::SetYPercent(double y) {
|
||||
parameters->SetYManually(absY);
|
||||
}
|
||||
|
||||
void cTemplatePixmap::SetParameter(eParamType type, string value) {
|
||||
parameters->SetParameter(type, value);
|
||||
}
|
||||
|
||||
|
||||
void cTemplatePixmap::ClearDynamicParameters(void) {
|
||||
parameters->ClearDynamicParameters();
|
||||
}
|
||||
@@ -180,7 +194,7 @@ bool cTemplatePixmap::CalculateParameters(void) {
|
||||
}
|
||||
|
||||
void cTemplatePixmap::ClearDynamicFunctionParameters(void) {
|
||||
InitIterator();
|
||||
InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = GetNextFunction()) {
|
||||
func->ClearDynamicParameters();
|
||||
@@ -188,7 +202,7 @@ void cTemplatePixmap::ClearDynamicFunctionParameters(void) {
|
||||
}
|
||||
|
||||
void cTemplatePixmap::ParseDynamicFunctionParameters(map <string,string> *stringTokens, map <string,int> *intTokens, map < string, vector< map< string, string > > > *loopTokens) {
|
||||
InitIterator();
|
||||
InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
bool completelyParsed = true;
|
||||
while(func = GetNextFunction()) {
|
||||
@@ -215,7 +229,7 @@ void cTemplatePixmap::ParseDynamicFunctionParameters(map <string,string> *string
|
||||
if (!replacedWidth && !replacedHeight && !replacedPosX && !replacedPosY)
|
||||
return;
|
||||
|
||||
InitIterator();
|
||||
InitFunctionIterator();
|
||||
func = NULL;
|
||||
while(func = GetNextFunction()) {
|
||||
if (func->ParsedCompletely())
|
||||
@@ -249,7 +263,7 @@ bool cTemplatePixmap::CalculateDrawPortSize(cSize &size, map < string, vector< m
|
||||
}
|
||||
} else if (orientation == orVertical) {
|
||||
//check "last" element height
|
||||
InitIterator();
|
||||
InitFunctionIterator();
|
||||
cTemplateFunction *f = NULL;
|
||||
int drawportHeight = 1;
|
||||
while (f = GetNextFunction()) {
|
||||
@@ -324,7 +338,7 @@ void cTemplatePixmap::SetScrollingTextWidth(void) {
|
||||
if (orientation != orHorizontal)
|
||||
return;
|
||||
int pixWidth = parameters->GetNumericParameter(ptWidth);
|
||||
InitIterator();
|
||||
InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = GetNextFunction()) {
|
||||
if (func->GetType() == ftDrawText) {
|
||||
@@ -339,7 +353,7 @@ cTemplateFunction *cTemplatePixmap::GetScrollFunction(void) {
|
||||
string scrollElement = parameters->GetParameter(ptScrollElement);
|
||||
if (scrollElement.size() == 0)
|
||||
return NULL;
|
||||
InitIterator();
|
||||
InitFunctionIterator();
|
||||
cTemplateFunction *f = NULL;
|
||||
while (f = GetNextFunction()) {
|
||||
string funcName = f->GetParameter(ptName);
|
||||
@@ -365,7 +379,7 @@ int cTemplatePixmap::GetNumericParameter(eParamType type) {
|
||||
return parameters->GetNumericParameter(type);
|
||||
}
|
||||
|
||||
void cTemplatePixmap::InitIterator(void) {
|
||||
void cTemplatePixmap::InitFunctionIterator(void) {
|
||||
funcIt = functions.begin();
|
||||
}
|
||||
|
||||
@@ -393,9 +407,26 @@ bool cTemplatePixmap::Ready(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cTemplatePixmap::ParameterSet(eParamType type) {
|
||||
string value = parameters->GetParameter(type);
|
||||
if (value.size() > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
cTemplateFunction *cTemplatePixmap::GetFunction(string name) {
|
||||
for (vector<cTemplateFunction*>::iterator it = functions.begin(); it != functions.end(); it++) {
|
||||
string funcName = (*it)->GetParameter(ptName);
|
||||
if (!name.compare(funcName))
|
||||
return *it;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool cTemplatePixmap::ReplaceWidthFunctions(void) {
|
||||
bool replaced = false;
|
||||
InitIterator();
|
||||
bool found = false;
|
||||
InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = GetNextFunction()) {
|
||||
if (func->ParsedCompletely()) {
|
||||
@@ -411,6 +442,7 @@ bool cTemplatePixmap::ReplaceWidthFunctions(void) {
|
||||
cTemplateFunction *myFunc = *it;
|
||||
string myFuncName = myFunc->GetParameter(ptName);
|
||||
if (!myFuncName.compare(label)) {
|
||||
found = true;
|
||||
funcWidth = myFunc->GetWidth();
|
||||
func->SetWidth(type, label, funcWidth);
|
||||
if (func->Updated()) {
|
||||
@@ -418,6 +450,20 @@ bool cTemplatePixmap::ReplaceWidthFunctions(void) {
|
||||
} else {
|
||||
replaced = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found && pixContainer) {
|
||||
cTemplateFunction *myFunc = pixContainer->GetFunction(label);
|
||||
if (myFunc) {
|
||||
funcWidth = myFunc->GetWidth();
|
||||
func->SetWidth(type, label, funcWidth);
|
||||
if (func->Updated()) {
|
||||
func->CompleteParameters();
|
||||
} else {
|
||||
replaced = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -427,7 +473,8 @@ bool cTemplatePixmap::ReplaceWidthFunctions(void) {
|
||||
|
||||
bool cTemplatePixmap::ReplaceHeightFunctions(map < string, vector< map< string, string > > > *loopTokens) {
|
||||
bool replaced = false;
|
||||
InitIterator();
|
||||
bool found = false;
|
||||
InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = GetNextFunction()) {
|
||||
if (func->ParsedCompletely()) {
|
||||
@@ -443,6 +490,7 @@ bool cTemplatePixmap::ReplaceHeightFunctions(map < string, vector< map< string,
|
||||
cTemplateFunction *myFunc = *it;
|
||||
string myFuncName = myFunc->GetParameter(ptName);
|
||||
if (!myFuncName.compare(label)) {
|
||||
found = true;
|
||||
funcHeight = myFunc->GetHeight(loopTokens);
|
||||
func->SetHeight(type, label, funcHeight);
|
||||
if (func->Updated()) {
|
||||
@@ -450,6 +498,20 @@ bool cTemplatePixmap::ReplaceHeightFunctions(map < string, vector< map< string,
|
||||
} else {
|
||||
replaced = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found && pixContainer) {
|
||||
cTemplateFunction *myFunc = pixContainer->GetFunction(label);
|
||||
if (myFunc) {
|
||||
funcHeight = myFunc->GetHeight(loopTokens);
|
||||
func->SetHeight(type, label, funcHeight);
|
||||
if (func->Updated()) {
|
||||
func->CompleteParameters();
|
||||
} else {
|
||||
replaced = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -459,7 +521,8 @@ bool cTemplatePixmap::ReplaceHeightFunctions(map < string, vector< map< string,
|
||||
|
||||
bool cTemplatePixmap::ReplacePosXFunctions(void) {
|
||||
bool replaced = false;
|
||||
InitIterator();
|
||||
bool found = false;
|
||||
InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = GetNextFunction()) {
|
||||
if (func->ParsedCompletely()) {
|
||||
@@ -475,6 +538,7 @@ bool cTemplatePixmap::ReplacePosXFunctions(void) {
|
||||
cTemplateFunction *myFunc = *it;
|
||||
string myFuncName = myFunc->GetParameter(ptName);
|
||||
if (!myFuncName.compare(label)) {
|
||||
found = true;
|
||||
funcX = myFunc->GetNumericParameter(ptX);
|
||||
if (funcX > -1) {
|
||||
func->SetX(type, label, funcX);
|
||||
@@ -484,6 +548,22 @@ bool cTemplatePixmap::ReplacePosXFunctions(void) {
|
||||
replaced = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found && pixContainer) {
|
||||
cTemplateFunction *myFunc = pixContainer->GetFunction(label);
|
||||
if (myFunc) {
|
||||
funcX = myFunc->GetNumericParameter(ptX);
|
||||
if (funcX > -1) {
|
||||
func->SetX(type, label, funcX);
|
||||
if (func->Updated()) {
|
||||
func->CompleteParameters();
|
||||
} else {
|
||||
replaced = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -493,7 +573,8 @@ bool cTemplatePixmap::ReplacePosXFunctions(void) {
|
||||
|
||||
bool cTemplatePixmap::ReplacePosYFunctions(void) {
|
||||
bool replaced = false;
|
||||
InitIterator();
|
||||
bool found = false;
|
||||
InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = GetNextFunction()) {
|
||||
if (func->ParsedCompletely()) {
|
||||
@@ -509,6 +590,7 @@ bool cTemplatePixmap::ReplacePosYFunctions(void) {
|
||||
cTemplateFunction *myFunc = *it;
|
||||
string myFuncName = myFunc->GetParameter(ptName);
|
||||
if (!myFuncName.compare(label)) {
|
||||
found = true;
|
||||
funcY = myFunc->GetNumericParameter(ptY);
|
||||
if (funcY > -1) {
|
||||
func->SetY(type, label, funcY);
|
||||
@@ -518,6 +600,22 @@ bool cTemplatePixmap::ReplacePosYFunctions(void) {
|
||||
replaced = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found && pixContainer) {
|
||||
cTemplateFunction *myFunc = pixContainer->GetFunction(label);
|
||||
if (myFunc) {
|
||||
funcY = myFunc->GetNumericParameter(ptY);
|
||||
if (funcY > -1) {
|
||||
func->SetY(type, label, funcY);
|
||||
if (func->Updated()) {
|
||||
func->CompleteParameters();
|
||||
} else {
|
||||
replaced = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -532,3 +630,110 @@ void cTemplatePixmap::Debug(void) {
|
||||
(*it)->Debug();
|
||||
}
|
||||
}
|
||||
|
||||
// --- cTemplatePixmapContainer -------------------------------------------------------------
|
||||
|
||||
cTemplatePixmapContainer::cTemplatePixmapContainer(void) {
|
||||
isContainer = true;
|
||||
}
|
||||
|
||||
cTemplatePixmapContainer::~cTemplatePixmapContainer() {
|
||||
for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
|
||||
delete (*it);
|
||||
}
|
||||
}
|
||||
|
||||
void cTemplatePixmapContainer::SetGlobals(cGlobals *globals) {
|
||||
this->globals = globals;
|
||||
for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
|
||||
(*it)->SetGlobals(globals);
|
||||
}
|
||||
}
|
||||
|
||||
void cTemplatePixmapContainer::SetWidth(int width) {
|
||||
for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
|
||||
(*it)->SetWidth(width);
|
||||
}
|
||||
}
|
||||
|
||||
void cTemplatePixmapContainer::SetHeight(int height) {
|
||||
for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
|
||||
(*it)->SetHeight(height);
|
||||
}
|
||||
}
|
||||
|
||||
void cTemplatePixmapContainer::AddPixmap(cTemplatePixmap *pix) {
|
||||
//setting default parameters of container if parameter is not set in area
|
||||
string containerDefaultX = parameters->GetParameter(ptX);
|
||||
string containerDefaultY = parameters->GetParameter(ptY);
|
||||
string containerDefaultWidth = parameters->GetParameter(ptWidth);
|
||||
string containerDefaultHeight = parameters->GetParameter(ptHeight);
|
||||
if (containerDefaultX.size() > 0 && !pix->ParameterSet(ptX))
|
||||
pix->SetParameter(ptX, containerDefaultX);
|
||||
if (containerDefaultY.size() > 0 && !pix->ParameterSet(ptY))
|
||||
pix->SetParameter(ptY, containerDefaultY);
|
||||
if (containerDefaultWidth.size() > 0 && !pix->ParameterSet(ptWidth))
|
||||
pix->SetParameter(ptWidth, containerDefaultWidth);
|
||||
if (containerDefaultHeight.size() > 0 && !pix->ParameterSet(ptHeight))
|
||||
pix->SetParameter(ptHeight, containerDefaultHeight);
|
||||
|
||||
pix->SetPixmapContainer(this);
|
||||
pixmaps.push_back(pix);
|
||||
}
|
||||
|
||||
bool cTemplatePixmapContainer::CalculateParameters(void) {
|
||||
bool paramsValid = true;
|
||||
//Calculate Pixmap Size
|
||||
parameters->SetContainer(containerX, containerY, containerWidth, containerHeight);
|
||||
parameters->SetGlobals(globals);
|
||||
paramsValid = parameters->CalculateParameters();
|
||||
|
||||
for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
|
||||
(*it)->SetContainer(containerX, containerY, containerWidth, containerHeight);
|
||||
(*it)->SetGlobals(globals);
|
||||
paramsValid = (*it)->CalculateParameters() && paramsValid;
|
||||
}
|
||||
|
||||
return paramsValid;
|
||||
}
|
||||
|
||||
void cTemplatePixmapContainer::ParseDynamicParameters(map <string,string> *stringTokens, map <string,int> *intTokens) {
|
||||
parameters->ClearDynamicParameters();
|
||||
parameters->SetIntTokens(intTokens);
|
||||
parameters->SetStringTokens(stringTokens);
|
||||
parameters->ParseParameters();
|
||||
parameters->UnsetIntTokens();
|
||||
parameters->UnsetStringTokens();
|
||||
}
|
||||
|
||||
void cTemplatePixmapContainer::InitIterator(void) {
|
||||
pixmapIterator = pixmaps.begin();
|
||||
}
|
||||
|
||||
cTemplatePixmap *cTemplatePixmapContainer::GetNextPixmap(void) {
|
||||
if (pixmapIterator == pixmaps.end())
|
||||
return NULL;
|
||||
cTemplatePixmap *pix = *pixmapIterator;
|
||||
pixmapIterator++;
|
||||
return pix;
|
||||
}
|
||||
|
||||
cTemplateFunction *cTemplatePixmapContainer::GetFunction(string name) {
|
||||
cTemplateFunction *hit = NULL;
|
||||
for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
|
||||
hit = (*it)->GetFunction(name);
|
||||
if (hit)
|
||||
return hit;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void cTemplatePixmapContainer::Debug(void) {
|
||||
esyslog("skindesigner: pixmapcontainer");
|
||||
parameters->Debug();
|
||||
for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
|
||||
(*it)->Debug();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -13,23 +13,46 @@
|
||||
|
||||
#include "globals.h"
|
||||
#include "templateloopfunction.h"
|
||||
#include "../views/viewhelpers.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// --- cTemplatePixmap -------------------------------------------------------------
|
||||
|
||||
class cTemplatePixmap {
|
||||
// --- cTemplatePixmapNode -------------------------------------------------------------
|
||||
class cTemplatePixmapNode {
|
||||
protected:
|
||||
bool scrolling;
|
||||
bool background;
|
||||
bool isContainer;
|
||||
cGlobals *globals;
|
||||
cTemplateFunction *parameters;
|
||||
vector<cTemplateFunction*> functions;
|
||||
vector<cTemplateFunction*>::iterator funcIt;
|
||||
int containerX;
|
||||
int containerY;
|
||||
int containerWidth;
|
||||
int containerHeight;
|
||||
cGlobals *globals;
|
||||
public:
|
||||
cTemplatePixmapNode(void);
|
||||
virtual ~cTemplatePixmapNode(void);
|
||||
void SetParameters(vector<stringpair> ¶ms);
|
||||
void SetContainer(int x, int y, int w, int h);
|
||||
bool IsContainer(void) { return isContainer; };
|
||||
bool DoExecute(void) { return parameters->DoExecute(); };
|
||||
bool DoDebug(void) { return parameters->DoDebug(); };
|
||||
virtual void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
||||
virtual bool CalculateParameters(void) { return false; };
|
||||
virtual void SetWidth(int width) {};
|
||||
virtual void SetHeight(int height) {};
|
||||
virtual int NumPixmaps(void) { return 0; };
|
||||
virtual void Debug(void) {};
|
||||
};
|
||||
|
||||
// --- cTemplatePixmap -------------------------------------------------------------
|
||||
class cTemplatePixmapContainer;
|
||||
|
||||
class cTemplatePixmap : public cTemplatePixmapNode {
|
||||
protected:
|
||||
cTemplatePixmapContainer *pixContainer;
|
||||
bool scrolling;
|
||||
bool background;
|
||||
vector<cTemplateFunction*> functions;
|
||||
vector<cTemplateFunction*>::iterator funcIt;
|
||||
//functions replacing {width(label)} and {height(label)} tokens
|
||||
bool ReplaceWidthFunctions(void);
|
||||
bool ReplaceHeightFunctions(map < string, vector< map< string, string > > > *loopTokens);
|
||||
@@ -42,8 +65,8 @@ public:
|
||||
cTemplatePixmap(void);
|
||||
virtual ~cTemplatePixmap(void);
|
||||
//Setter Functions
|
||||
void SetPixmapContainer(cTemplatePixmapContainer *pixContainer) { this->pixContainer = pixContainer; };
|
||||
void SetScrolling(void) { scrolling = true; };
|
||||
void SetParameters(vector<pair<string, string> > ¶ms);
|
||||
void SetWidth(int width);
|
||||
void SetHeight(int height);
|
||||
void SetX(int x);
|
||||
@@ -52,8 +75,7 @@ public:
|
||||
void SetHeightPercent(double height);
|
||||
void SetXPercent(double x);
|
||||
void SetYPercent(double y);
|
||||
void SetContainer(int x, int y, int w, int h);
|
||||
void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
||||
void SetParameter(eParamType type, string value);
|
||||
void AddFunction(string name, vector<pair<string, string> > ¶ms);
|
||||
void AddLoopFunction(cTemplateLoopFunction *lf);
|
||||
//PreCache Parameters
|
||||
@@ -71,18 +93,40 @@ public:
|
||||
//Set max width for text in scrollarea
|
||||
void SetScrollingTextWidth(void);
|
||||
//Getter Functions
|
||||
int NumPixmaps(void) { return 1; };
|
||||
cRect GetPixmapSize(void);
|
||||
int GetNumericParameter(eParamType type);
|
||||
bool Scrolling(void) { return scrolling; };
|
||||
bool DoExecute(void) { return parameters->DoExecute(); };
|
||||
bool DoDebug(void) { return parameters->DoDebug(); };
|
||||
bool Ready(void);
|
||||
bool BackgroundArea(void) { return background; };
|
||||
bool ParameterSet(eParamType type);
|
||||
cTemplateFunction *GetFunction(string name);
|
||||
//Traverse Functions
|
||||
void InitIterator(void);
|
||||
void InitFunctionIterator(void);
|
||||
cTemplateFunction *GetNextFunction(void);
|
||||
//Debug
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
class cTemplatePixmapContainer : public cTemplatePixmapNode {
|
||||
private:
|
||||
vector<cTemplatePixmap*> pixmaps;
|
||||
vector<cTemplatePixmap*>::iterator pixmapIterator;
|
||||
public:
|
||||
cTemplatePixmapContainer(void);
|
||||
virtual ~cTemplatePixmapContainer(void);
|
||||
void SetGlobals(cGlobals *globals);
|
||||
void SetWidth(int width);
|
||||
void SetHeight(int height);
|
||||
void AddPixmap(cTemplatePixmap *pix);
|
||||
//PreCache Parameters
|
||||
bool CalculateParameters(void);
|
||||
void ParseDynamicParameters(map <string,string> *stringTokens, map <string,int> *intTokens);
|
||||
int NumPixmaps(void) { return pixmaps.size(); };
|
||||
void InitIterator(void);
|
||||
cTemplatePixmap *GetNextPixmap(void);
|
||||
cTemplateFunction *GetFunction(string name);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
#endif //__TEMPLATEPIXMAP_H
|
@@ -349,10 +349,10 @@ void cTemplateView::Translate(void) {
|
||||
InitViewElementIterator();
|
||||
cTemplateViewElement *viewElement = NULL;
|
||||
while(viewElement = GetNextViewElement()) {
|
||||
viewElement->InitIterator();
|
||||
viewElement->InitPixmapIterator();
|
||||
cTemplatePixmap *pix = NULL;
|
||||
while(pix = viewElement->GetNextPixmap()) {
|
||||
pix->InitIterator();
|
||||
pix->InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = pix->GetNextFunction()) {
|
||||
if (func->GetType() == ftDrawText || func->GetType() == ftDrawTextBox || func->GetType() == ftDrawTextVertical) {
|
||||
@@ -385,10 +385,10 @@ void cTemplateView::Translate(void) {
|
||||
InitViewListIterator();
|
||||
cTemplateViewList *viewList = NULL;
|
||||
while(viewList = GetNextViewList()) {
|
||||
viewList->InitIterator();
|
||||
viewList->InitPixmapIterator();
|
||||
cTemplatePixmap *pix = NULL;
|
||||
while(pix = viewList->GetNextPixmap()) {
|
||||
pix->InitIterator();
|
||||
pix->InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = pix->GetNextFunction()) {
|
||||
if (func->GetType() == ftDrawText || func->GetType() == ftDrawTextBox || func->GetType() == ftDrawTextVertical) {
|
||||
@@ -402,9 +402,9 @@ void cTemplateView::Translate(void) {
|
||||
}
|
||||
}
|
||||
cTemplateViewElement *listElement = viewList->GetListElement();
|
||||
listElement->InitIterator();
|
||||
listElement->InitPixmapIterator();
|
||||
while(pix = listElement->GetNextPixmap()) {
|
||||
pix->InitIterator();
|
||||
pix->InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = pix->GetNextFunction()) {
|
||||
if (func->GetType() == ftDrawText || func->GetType() == ftDrawTextBox || func->GetType() == ftDrawTextVertical) {
|
||||
@@ -420,9 +420,9 @@ void cTemplateView::Translate(void) {
|
||||
|
||||
cTemplateViewElement *listElementCurrent = viewList->GetListElementCurrent();
|
||||
if (listElementCurrent) {
|
||||
listElementCurrent->InitIterator();
|
||||
listElementCurrent->InitPixmapIterator();
|
||||
while(pix = listElementCurrent->GetNextPixmap()) {
|
||||
pix->InitIterator();
|
||||
pix->InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = pix->GetNextFunction()) {
|
||||
if (func->GetType() == ftDrawText || func->GetType() == ftDrawTextBox || func->GetType() == ftDrawTextVertical) {
|
||||
@@ -463,7 +463,7 @@ void cTemplateView::Translate(void) {
|
||||
if (translated) {
|
||||
viewTab->SetName(tabTrans);
|
||||
}
|
||||
viewTab->InitIterator();
|
||||
viewTab->InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = viewTab->GetNextFunction()) {
|
||||
if (func->GetType() == ftDrawText || func->GetType() == ftDrawTextBox || func->GetType() == ftDrawTextVertical) {
|
||||
@@ -496,10 +496,10 @@ void cTemplateView::Translate(void) {
|
||||
InitViewGridIterator();
|
||||
cTemplateViewGrid *viewGrid = NULL;
|
||||
while(viewGrid = GetNextViewGrid()) {
|
||||
viewGrid->InitIterator();
|
||||
viewGrid->InitPixmapIterator();
|
||||
cTemplatePixmap *pix = NULL;
|
||||
while(pix = viewGrid->GetNextPixmap()) {
|
||||
pix->InitIterator();
|
||||
pix->InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = pix->GetNextFunction()) {
|
||||
if (func->GetType() == ftDrawText || func->GetType() == ftDrawTextBox || func->GetType() == ftDrawTextVertical) {
|
||||
@@ -696,6 +696,16 @@ void cTemplateView::SetFunctionDefinitions(void) {
|
||||
attributes.insert("debug");
|
||||
funcsAllowed.insert(pair< string, set<string> >(name, attributes));
|
||||
|
||||
name = "areacontainer";
|
||||
attributes.clear();
|
||||
attributes.insert("x");
|
||||
attributes.insert("y");
|
||||
attributes.insert("width");
|
||||
attributes.insert("height");
|
||||
attributes.insert("debug");
|
||||
attributes.insert("condition");
|
||||
funcsAllowed.insert(pair< string, set<string> >(name, attributes));
|
||||
|
||||
name = "area";
|
||||
attributes.clear();
|
||||
attributes.insert("debug");
|
||||
@@ -998,9 +1008,9 @@ string cTemplateViewChannel::GetViewElementName(eViewElement ve) {
|
||||
return name;
|
||||
}
|
||||
|
||||
void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<stringpair> &viewElementattributes) {
|
||||
eViewElement ve = veUndefined;
|
||||
|
||||
|
||||
if (!sViewElement.compare("background")) {
|
||||
ve = veBackground;
|
||||
} else if (!sViewElement.compare("channelinfo")) {
|
||||
@@ -1040,7 +1050,6 @@ void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmap *pix,
|
||||
} else if (!sViewElement.compare("customtokens")) {
|
||||
ve = veCustomTokens;
|
||||
}
|
||||
|
||||
if (ve == veUndefined) {
|
||||
esyslog("skindesigner: unknown ViewElement in displaychannel: %s", sViewElement.c_str());
|
||||
return;
|
||||
@@ -1507,7 +1516,7 @@ void cTemplateViewMenu::AddPluginView(string plugName, int templNo, cTemplateVie
|
||||
}
|
||||
}
|
||||
|
||||
void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
eViewElement ve = veUndefined;
|
||||
|
||||
if (!sViewElement.compare("background")) {
|
||||
@@ -1648,7 +1657,7 @@ string cTemplateViewMessage::GetViewElementName(eViewElement ve) {
|
||||
return name;
|
||||
}
|
||||
|
||||
void cTemplateViewMessage::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
void cTemplateViewMessage::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
eViewElement ve = veUndefined;
|
||||
|
||||
if (!sViewElement.compare("background")) {
|
||||
@@ -1801,7 +1810,7 @@ string cTemplateViewReplay::GetViewElementName(eViewElement ve) {
|
||||
return name;
|
||||
}
|
||||
|
||||
void cTemplateViewReplay::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
void cTemplateViewReplay::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
eViewElement ve = veUndefined;
|
||||
|
||||
if (!sViewElement.compare("background")) {
|
||||
@@ -1916,7 +1925,7 @@ string cTemplateViewVolume::GetViewElementName(eViewElement ve) {
|
||||
return name;
|
||||
}
|
||||
|
||||
void cTemplateViewVolume::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
void cTemplateViewVolume::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
eViewElement ve = veUndefined;
|
||||
|
||||
if (!sViewElement.compare("background")) {
|
||||
@@ -2026,7 +2035,7 @@ string cTemplateViewAudioTracks::GetViewListName(eViewList vl) {
|
||||
return name;
|
||||
}
|
||||
|
||||
void cTemplateViewAudioTracks::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
void cTemplateViewAudioTracks::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
eViewElement ve = veUndefined;
|
||||
|
||||
if (!sViewElement.compare("background")) {
|
||||
@@ -2133,7 +2142,7 @@ void cTemplateViewPlugin::AddSubView(string sSubView, cTemplateView *subView) {
|
||||
subViews.insert(pair< eSubView, cTemplateView* >((eSubView)subViewId, subView));
|
||||
}
|
||||
|
||||
void cTemplateViewPlugin::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
void cTemplateViewPlugin::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
eViewElement ve = veUndefined;
|
||||
string viewElementName = "";
|
||||
int viewElementID = -1;
|
||||
@@ -2177,7 +2186,7 @@ void cTemplateViewPlugin::AddPixmap(string sViewElement, cTemplatePixmap *pix, v
|
||||
}
|
||||
}
|
||||
|
||||
void cTemplateViewPlugin::AddPixmapGrid(cTemplatePixmap *pix, vector<pair<string, string> > &gridAttributes) {
|
||||
void cTemplateViewPlugin::AddPixmapGrid(cTemplatePixmapNode *pix, vector<pair<string, string> > &gridAttributes) {
|
||||
string gridName = "";
|
||||
bool found = false;
|
||||
for (vector<pair<string, string> >::iterator it = gridAttributes.begin(); it != gridAttributes.end(); it++) {
|
||||
|
@@ -76,8 +76,8 @@ public:
|
||||
virtual string GetViewListName(eViewList vl) { return ""; };
|
||||
virtual void AddSubView(string sSubView, cTemplateView *subView) {};
|
||||
virtual void AddPluginView(string plugName, int templNo, cTemplateView *plugView) {};
|
||||
virtual void AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {};
|
||||
virtual void AddPixmapGrid(cTemplatePixmap *pix, vector<pair<string, string> > &gridAttributes) {};
|
||||
virtual void AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<stringpair> &viewElementattributes) {};
|
||||
virtual void AddPixmapGrid(cTemplatePixmapNode *pix, vector<pair<string, string> > &gridAttributes) {};
|
||||
virtual void AddViewList(string sViewList, cTemplateViewList *viewList) {};
|
||||
virtual void AddViewTab(cTemplateViewTab *viewTab) {};
|
||||
//Setter Functions
|
||||
@@ -146,11 +146,12 @@ class cTemplateViewChannel : public cTemplateView {
|
||||
private:
|
||||
void SetViewElements(void);
|
||||
void SetViewLists(void);
|
||||
eViewElement GetViewElementID(string sViewElement);
|
||||
public:
|
||||
cTemplateViewChannel(void);
|
||||
virtual ~cTemplateViewChannel(void);
|
||||
string GetViewElementName(eViewElement ve);
|
||||
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<stringpair> &viewElementattributes);
|
||||
};
|
||||
|
||||
// --- cTemplateViewMenu -------------------------------------------------------------
|
||||
@@ -168,7 +169,7 @@ public:
|
||||
string GetViewListName(eViewList vl);
|
||||
void AddSubView(string sSubView, cTemplateView *subView);
|
||||
void AddPluginView(string plugName, int templNo, cTemplateView *plugView);
|
||||
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
void AddViewList(string sViewList, cTemplateViewList *viewList);
|
||||
void AddViewTab(cTemplateViewTab *viewTab);
|
||||
};
|
||||
@@ -182,7 +183,7 @@ public:
|
||||
cTemplateViewMessage(void);
|
||||
virtual ~cTemplateViewMessage(void);
|
||||
string GetViewElementName(eViewElement ve);
|
||||
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
};
|
||||
|
||||
// --- cTemplateViewReplay -------------------------------------------------------------
|
||||
@@ -194,7 +195,7 @@ public:
|
||||
cTemplateViewReplay(void);
|
||||
virtual ~cTemplateViewReplay(void);
|
||||
string GetViewElementName(eViewElement ve);
|
||||
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
};
|
||||
|
||||
// --- cTemplateViewVolume -------------------------------------------------------------
|
||||
@@ -206,7 +207,7 @@ public:
|
||||
cTemplateViewVolume(void);
|
||||
virtual ~cTemplateViewVolume(void);
|
||||
string GetViewElementName(eViewElement ve);
|
||||
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
};
|
||||
|
||||
// --- cTemplateViewAudioTracks -------------------------------------------------------------
|
||||
@@ -220,7 +221,7 @@ public:
|
||||
virtual ~cTemplateViewAudioTracks(void);
|
||||
string GetViewElementName(eViewElement ve);
|
||||
string GetViewListName(eViewList vl);
|
||||
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
void AddViewList(string sViewList, cTemplateViewList *viewList);
|
||||
};
|
||||
|
||||
@@ -234,8 +235,8 @@ public:
|
||||
cTemplateViewPlugin(string pluginName, int viewID);
|
||||
virtual ~cTemplateViewPlugin(void);
|
||||
void AddSubView(string sSubView, cTemplateView *subView);
|
||||
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
void AddPixmapGrid(cTemplatePixmap *pix, vector<pair<string, string> > &gridAttributes);
|
||||
void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
void AddPixmapGrid(cTemplatePixmapNode *pix, vector<pair<string, string> > &gridAttributes);
|
||||
void AddViewTab(cTemplateViewTab *viewTab);
|
||||
};
|
||||
|
||||
|
@@ -9,12 +9,14 @@ cTemplateViewElement::cTemplateViewElement(void) {
|
||||
containerWidth = 0;
|
||||
containerHeight = 0;
|
||||
pixOffset = -1;
|
||||
pixmapIterator = NULL;
|
||||
currentNode = NULL;
|
||||
}
|
||||
|
||||
cTemplateViewElement::~cTemplateViewElement(void) {
|
||||
if (parameters)
|
||||
delete parameters;
|
||||
for (vector<cTemplatePixmap*>::iterator it = viewPixmaps.begin(); it != viewPixmaps.end(); it++) {
|
||||
for (vector<cTemplatePixmapNode*>::iterator it = viewPixmapNodes.begin(); it != viewPixmapNodes.end(); it++) {
|
||||
delete (*it);
|
||||
}
|
||||
}
|
||||
@@ -28,7 +30,7 @@ void cTemplateViewElement::SetContainer(int x, int y, int width, int height) {
|
||||
|
||||
void cTemplateViewElement::SetGlobals(cGlobals *globals) {
|
||||
this->globals = globals;
|
||||
for (vector<cTemplatePixmap*>::iterator pix = viewPixmaps.begin(); pix != viewPixmaps.end(); pix++) {
|
||||
for (vector<cTemplatePixmapNode*>::iterator pix = viewPixmapNodes.begin(); pix != viewPixmapNodes.end(); pix++) {
|
||||
(*pix)->SetGlobals(globals);
|
||||
}
|
||||
}
|
||||
@@ -52,7 +54,7 @@ bool cTemplateViewElement::CalculateParameters(void) {
|
||||
|
||||
bool cTemplateViewElement::CalculatePixmapParameters(void) {
|
||||
bool paramsValid = true;
|
||||
for (vector<cTemplatePixmap*>::iterator pix = viewPixmaps.begin(); pix != viewPixmaps.end(); pix++) {
|
||||
for (vector<cTemplatePixmapNode*>::iterator pix = viewPixmapNodes.begin(); pix != viewPixmapNodes.end(); pix++) {
|
||||
(*pix)->SetContainer(containerX, containerY, containerWidth, containerHeight);
|
||||
(*pix)->SetGlobals(globals);
|
||||
paramsValid = paramsValid && (*pix)->CalculateParameters();
|
||||
@@ -62,7 +64,7 @@ bool cTemplateViewElement::CalculatePixmapParameters(void) {
|
||||
|
||||
bool cTemplateViewElement::CalculatePixmapParametersList(int orientation, int numElements) {
|
||||
bool paramsValid = true;
|
||||
for (vector<cTemplatePixmap*>::iterator pix = viewPixmaps.begin(); pix != viewPixmaps.end(); pix++) {
|
||||
for (vector<cTemplatePixmapNode*>::iterator pix = viewPixmapNodes.begin(); pix != viewPixmapNodes.end(); pix++) {
|
||||
(*pix)->SetContainer(containerX, containerY, containerWidth, containerHeight);
|
||||
(*pix)->SetGlobals(globals);
|
||||
if (orientation == orHorizontal) {
|
||||
@@ -87,23 +89,91 @@ int cTemplateViewElement::GetNumericParameter(eParamType type) {
|
||||
return parameters->GetNumericParameter(type);
|
||||
}
|
||||
|
||||
void cTemplateViewElement::InitIterator(void) {
|
||||
pixIterator = viewPixmaps.begin();
|
||||
int cTemplateViewElement::GetNumPixmaps(void) {
|
||||
int numPixmaps = 0;
|
||||
for (vector<cTemplatePixmapNode*>::iterator pix = viewPixmapNodes.begin(); pix != viewPixmapNodes.end(); pix++) {
|
||||
numPixmaps += (*pix)->NumPixmaps();
|
||||
}
|
||||
return numPixmaps;
|
||||
};
|
||||
|
||||
void cTemplateViewElement::InitPixmapNodeIterator(void) {
|
||||
pixmapNodeIterator = viewPixmapNodes.begin();
|
||||
}
|
||||
|
||||
cTemplatePixmapNode *cTemplateViewElement::GetNextPixmapNode(void) {
|
||||
if (pixmapNodeIterator == viewPixmapNodes.end())
|
||||
return NULL;
|
||||
cTemplatePixmapNode *pix = *pixmapNodeIterator;
|
||||
pixmapNodeIterator++;
|
||||
return pix;
|
||||
}
|
||||
|
||||
void cTemplateViewElement::InitPixmapIterator(void) {
|
||||
pixmapNodeIterator = viewPixmapNodes.begin();
|
||||
if (pixmapNodeIterator == viewPixmapNodes.end())
|
||||
return;
|
||||
if (!(*pixmapNodeIterator)->IsContainer()) {
|
||||
//first node is a pixmap, use this
|
||||
pixmapIterator = dynamic_cast<cTemplatePixmap*>(*pixmapNodeIterator);
|
||||
return;
|
||||
}
|
||||
//first node is a container, so fetch first pixmap of this container
|
||||
currentNode = dynamic_cast<cTemplatePixmapContainer*>(*pixmapNodeIterator);
|
||||
currentNode->InitIterator();
|
||||
pixmapIterator = currentNode->GetNextPixmap();
|
||||
}
|
||||
|
||||
cTemplatePixmap *cTemplateViewElement::GetNextPixmap(void) {
|
||||
if (pixIterator == viewPixmaps.end())
|
||||
if (!pixmapIterator)
|
||||
return NULL;
|
||||
cTemplatePixmap *pix = *pixIterator;
|
||||
pixIterator++;
|
||||
return pix;
|
||||
cTemplatePixmap *current = pixmapIterator;
|
||||
//set next pixmap
|
||||
if (!currentNode) {
|
||||
//last node was a pixmap
|
||||
pixmapNodeIterator++;
|
||||
if (pixmapNodeIterator == viewPixmapNodes.end()) {
|
||||
pixmapIterator = NULL;
|
||||
return current;
|
||||
}
|
||||
if (!(*pixmapNodeIterator)->IsContainer()) {
|
||||
//node is a pixmap, use this
|
||||
pixmapIterator = dynamic_cast<cTemplatePixmap*>(*pixmapNodeIterator);
|
||||
return current;
|
||||
}
|
||||
//node is a container, so fetch first pixmap of this container
|
||||
currentNode = dynamic_cast<cTemplatePixmapContainer*>(*pixmapNodeIterator);
|
||||
currentNode->InitIterator();
|
||||
pixmapIterator = currentNode->GetNextPixmap();
|
||||
} else {
|
||||
pixmapIterator = currentNode->GetNextPixmap();
|
||||
if (pixmapIterator) {
|
||||
return current;
|
||||
}
|
||||
currentNode = NULL;
|
||||
pixmapNodeIterator++;
|
||||
if (pixmapNodeIterator == viewPixmapNodes.end()) {
|
||||
pixmapIterator = NULL;
|
||||
return current;
|
||||
}
|
||||
if (!(*pixmapNodeIterator)->IsContainer()) {
|
||||
//node is a pixmap, use this
|
||||
pixmapIterator = dynamic_cast<cTemplatePixmap*>(*pixmapNodeIterator);
|
||||
return current;
|
||||
}
|
||||
//node is a container, so fetch first pixmap of this container
|
||||
currentNode = dynamic_cast<cTemplatePixmapContainer*>(*pixmapNodeIterator);
|
||||
currentNode->InitIterator();
|
||||
pixmapIterator = currentNode->GetNextPixmap();
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
cTemplateFunction *cTemplateViewElement::GetFunction(string name) {
|
||||
InitIterator();
|
||||
InitPixmapIterator();
|
||||
cTemplatePixmap *pix = NULL;
|
||||
while (pix = GetNextPixmap()) {
|
||||
pix->InitIterator();
|
||||
pix->InitFunctionIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
while(func = pix->GetNextFunction()) {
|
||||
if (func->GetType() == ftDrawText) {
|
||||
@@ -151,7 +221,7 @@ void cTemplateViewElement::Debug(void) {
|
||||
if (parameters)
|
||||
parameters->Debug();
|
||||
return;
|
||||
for (vector<cTemplatePixmap*>::iterator it = viewPixmaps.begin(); it != viewPixmaps.end(); it++) {
|
||||
for (vector<cTemplatePixmapNode*>::iterator it = viewPixmapNodes.begin(); it != viewPixmapNodes.end(); it++) {
|
||||
(*it)->Debug();
|
||||
}
|
||||
}
|
@@ -91,24 +91,28 @@ protected:
|
||||
int containerY;
|
||||
int containerWidth;
|
||||
int containerHeight;
|
||||
vector<cTemplatePixmap*> viewPixmaps;
|
||||
vector<cTemplatePixmap*>::iterator pixIterator;
|
||||
vector<cTemplatePixmapNode*> viewPixmapNodes;
|
||||
vector<cTemplatePixmapNode*>::iterator pixmapNodeIterator;
|
||||
cTemplatePixmap *pixmapIterator;
|
||||
cTemplatePixmapContainer *currentNode;
|
||||
int pixOffset;
|
||||
public:
|
||||
cTemplateViewElement(void);
|
||||
virtual ~cTemplateViewElement(void);
|
||||
void SetContainer(int x, int y, int width, int height);
|
||||
virtual void SetGlobals(cGlobals *globals);
|
||||
void SetParameters(vector<pair<string, string> > ¶ms);
|
||||
bool CalculateParameters(void);
|
||||
virtual bool CalculatePixmapParameters(void);
|
||||
bool CalculatePixmapParametersList(int orientation, int numElements);
|
||||
void AddPixmap(cTemplatePixmapNode *pix) { viewPixmapNodes.push_back(pix); };
|
||||
int GetNumericParameter(eParamType type);
|
||||
void AddPixmap(cTemplatePixmap *pix) { viewPixmaps.push_back(pix); };
|
||||
virtual void SetGlobals(cGlobals *globals);
|
||||
void SetContainer(int x, int y, int width, int height);
|
||||
void SetPixOffset(int offset) { pixOffset = offset; };
|
||||
int GetPixOffset(void) { return pixOffset; };
|
||||
virtual int GetNumPixmaps(void) { return viewPixmaps.size(); };
|
||||
void InitIterator(void);
|
||||
virtual int GetNumPixmaps(void);
|
||||
void InitPixmapNodeIterator(void);
|
||||
cTemplatePixmapNode *GetNextPixmapNode(void);
|
||||
void InitPixmapIterator(void);
|
||||
cTemplatePixmap *GetNextPixmap(void);
|
||||
cTemplateFunction *GetFunction(string name);
|
||||
bool Execute(void);
|
||||
|
@@ -15,7 +15,7 @@ bool cTemplateViewGrid::CalculatePixmapParameters(void) {
|
||||
int gridWidth = parameters->GetNumericParameter(ptWidth);
|
||||
int gridHeight = parameters->GetNumericParameter(ptHeight);
|
||||
|
||||
for (vector<cTemplatePixmap*>::iterator pix = viewPixmaps.begin(); pix != viewPixmaps.end(); pix++) {
|
||||
for (vector<cTemplatePixmapNode*>::iterator pix = viewPixmapNodes.begin(); pix != viewPixmapNodes.end(); pix++) {
|
||||
(*pix)->SetContainer(gridX, gridY, gridWidth, gridHeight);
|
||||
(*pix)->SetGlobals(globals);
|
||||
paramsValid = paramsValid && (*pix)->CalculateParameters();
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -8,11 +8,8 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <vdr/plugin.h>
|
||||
|
||||
#include "../libcore/libxmlwrapper.h"
|
||||
#include "templateview.h"
|
||||
#include "templateviewlist.h"
|
||||
#include "templateviewgrid.h"
|
||||
@@ -23,45 +20,49 @@ using namespace std;
|
||||
|
||||
// --- cXmlParser -------------------------------------------------------------
|
||||
|
||||
class cXmlParser {
|
||||
class cXmlParser : public cLibXMLWrapper {
|
||||
private:
|
||||
cTemplateView *view;
|
||||
cGlobals *globals;
|
||||
cSkinSetup *skinSetup;
|
||||
xmlParserCtxtPtr ctxt;
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr root;
|
||||
string GetPath(string xmlFile);
|
||||
void ParseSetupMenu(xmlNodePtr node);
|
||||
void ParseSetupParameter(xmlNodePtr node);
|
||||
void ParseGlobalColors(xmlNodePtr node);
|
||||
//parsing views
|
||||
bool ParseSubView(void);
|
||||
void ParseViewElement(cTemplateView *subView = NULL);
|
||||
void ParseViewList(cTemplateView *subView = NULL);
|
||||
void ParseViewTab(cTemplateView *subView);
|
||||
void ParseGrid(void);
|
||||
cTemplatePixmap *ParseArea(void);
|
||||
cTemplatePixmapContainer *ParseAreaContainer(void);
|
||||
void ParseFunctionCalls(cTemplatePixmap *pix);
|
||||
void ParseLoopFunctionCalls(cTemplateLoopFunction *loopFunc);
|
||||
//parsing globals
|
||||
void ParseGlobalColors(void);
|
||||
void InsertColor(string name, string value);
|
||||
void ParseGlobalVariables(xmlNodePtr node);
|
||||
void ParseGlobalVariables(void);
|
||||
void InsertVariable(string name, string type, string value);
|
||||
void ParseGlobalFonts(xmlNodePtr node);
|
||||
void ParseTranslations(xmlNodePtr node);
|
||||
bool ParseSubView(xmlNodePtr node);
|
||||
void ParseViewElement(const xmlChar * viewElement, xmlNodePtr node, vector<pair<string, string> > &attributes, cTemplateView *subView = NULL);
|
||||
void ParseViewList(xmlNodePtr parentNode, cTemplateView *subView = NULL);
|
||||
void ParseViewTab(xmlNodePtr parentNode, cTemplateView *subView);
|
||||
void ParseGrid(xmlNodePtr node, vector<pair<string, string> > &attributes);
|
||||
void ParseFunctionCalls(xmlNodePtr node, cTemplatePixmap *pix);
|
||||
void ParseLoopFunctionCalls(xmlNodePtr node, cTemplateLoopFunction *loopFunc);
|
||||
bool ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector<pair<string, string> > &attribs, bool isViewElement = false);
|
||||
void ParseGlobalFonts(void);
|
||||
void ParseTranslations(void);
|
||||
//parsing skin setup
|
||||
void ParseSetupMenu(void);
|
||||
void ParseSetupParameter(void);
|
||||
//helpers
|
||||
void ValidateAttributes(const char *nodeName, vector<stringpair> &attributes);
|
||||
string GetPath(string xmlFile);
|
||||
public:
|
||||
cXmlParser(void);
|
||||
virtual ~cXmlParser(void);
|
||||
//reading views
|
||||
bool ReadView(cTemplateView *view, string xmlFile);
|
||||
bool ReadPluginView(string plugName, int templateNumber, string templateName);
|
||||
bool ReadGlobals(cGlobals *globals, string xmlFile, bool mandatory);
|
||||
bool ReadSkinSetup(cSkinSetup *skinSetup, string xmlFile);
|
||||
bool ParseView(void);
|
||||
//reading plugin views
|
||||
bool ReadPluginView(string plugName, int templateNumber, string templateName);
|
||||
bool ParsePluginView(string plugName, int templateNumber);
|
||||
//reading globals
|
||||
bool ReadGlobals(cGlobals *globals, string xmlFile);
|
||||
bool ParseGlobals(void);
|
||||
//reading skin setups
|
||||
bool ReadSkinSetup(cSkinSetup *skinSetup, string xmlFile);
|
||||
bool ParseSkinSetup(string skin);
|
||||
void DeleteDocument(void);
|
||||
static void InitLibXML();
|
||||
static void CleanupLibXML();
|
||||
};
|
||||
|
||||
#endif //__XMLPARSER_H
|
||||
|
Reference in New Issue
Block a user