mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
implemented Skin Repositories
This commit is contained in:
@@ -70,6 +70,8 @@ bool cTemplate::ReadFromXML(string xmlfile) {
|
||||
templateName << "plug-" << plugName << "-" << it->second.c_str();
|
||||
if (parser.ReadPluginView(plugName, templateNumber, templateName.str())) {
|
||||
ok = parser.ParsePluginView(plugName, templateNumber);
|
||||
} else {
|
||||
dsyslog("skindesigner: template %s for plugin %s not available", templateName.str().c_str(), plugName.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,7 +548,7 @@ int cTemplateFunction::GetWidth(bool cutted) {
|
||||
return funcWidth;
|
||||
}
|
||||
|
||||
int cTemplateFunction::GetHeight(void) {
|
||||
int cTemplateFunction::GetHeight(map < string, vector< map< string, string > > > *loopTokens) {
|
||||
int funcHeight = 0;
|
||||
switch (type) {
|
||||
case ftDrawText:
|
||||
@@ -578,9 +578,12 @@ int cTemplateFunction::GetHeight(void) {
|
||||
textboxHeight = funcHeight;
|
||||
}
|
||||
break; }
|
||||
case ftLoop:
|
||||
//TODO: to be implemented
|
||||
break;
|
||||
case ftLoop: {
|
||||
cTemplateLoopFunction *loopFunc = dynamic_cast<cTemplateLoopFunction*>(this);
|
||||
if (loopFunc) {
|
||||
funcHeight = loopFunc->CalculateHeight(loopTokens);
|
||||
}
|
||||
break; }
|
||||
default:
|
||||
esyslog("skindesigner: GetHeight not implemented for funcType %d", type);
|
||||
break;
|
||||
|
||||
@@ -246,7 +246,7 @@ public:
|
||||
string GetParamName(eParamType pt);
|
||||
//Dynamic width or height parameter
|
||||
int GetWidth(bool cutted = true);
|
||||
int GetHeight(void);
|
||||
int GetHeight(map < string, vector< map< string, string > > > *loopTokens = NULL);
|
||||
int GetContainerWidth(void) { return containerWidth; };
|
||||
int GetContainerHeight(void) { return containerHeight; };
|
||||
void GetNeededWidths(multimap<eParamType,string> *widths);
|
||||
|
||||
@@ -21,8 +21,8 @@ void cTemplateLoopFunction::AddFunction(string name, vector<pair<string, string>
|
||||
if (!name.compare("drawtext")) {
|
||||
type = ftDrawText;
|
||||
} else if (!name.compare("drawtextbox")) {
|
||||
type = ftDrawTextBox;
|
||||
} else if (!name.compare("drawimage")) {
|
||||
type = ftDrawTextBox;
|
||||
} else if (!name.compare("drawimage")) {
|
||||
type = ftDrawImage;
|
||||
} else if (!name.compare("drawrectangle")) {
|
||||
type = ftDrawRectangle;
|
||||
@@ -149,6 +149,21 @@ int cTemplateLoopFunction::GetLoopElementsHeight(void) {
|
||||
return maxHeight;
|
||||
}
|
||||
|
||||
int cTemplateLoopFunction::CalculateHeight(map < string, vector< map< string, string > > > *loopTokens) {
|
||||
if (!loopTokens) {
|
||||
return 0;
|
||||
}
|
||||
int rowHeight = GetLoopElementsHeight();
|
||||
string loopName = GetParameter(ptName);
|
||||
map < string, vector< map< string, string > > >::iterator hit = loopTokens->find(loopName);
|
||||
if (hit == loopTokens->end())
|
||||
return 0;
|
||||
vector< map< string, string > > toks = hit->second;
|
||||
int numElements = toks.size();
|
||||
|
||||
return numElements * rowHeight;
|
||||
}
|
||||
|
||||
bool cTemplateLoopFunction::ReplaceWidthFunctions(void) {
|
||||
bool replaced = false;
|
||||
InitIterator();
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
int GetLoopElementsHeight(void);
|
||||
int GetContainerWidth(void) { return containerWidth; };
|
||||
int GetContainerHeight(void) { return containerHeight; };
|
||||
int CalculateHeight(map < string, vector< map< string, string > > > *loopTokens);
|
||||
bool Ready(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
@@ -187,7 +187,7 @@ void cTemplatePixmap::ClearDynamicFunctionParameters(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void cTemplatePixmap::ParseDynamicFunctionParameters(map <string,string> *stringTokens, map <string,int> *intTokens) {
|
||||
void cTemplatePixmap::ParseDynamicFunctionParameters(map <string,string> *stringTokens, map <string,int> *intTokens, map < string, vector< map< string, string > > > *loopTokens) {
|
||||
InitIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
bool completelyParsed = true;
|
||||
@@ -208,7 +208,7 @@ void cTemplatePixmap::ParseDynamicFunctionParameters(map <string,string> *string
|
||||
}
|
||||
|
||||
bool replacedWidth = ReplaceWidthFunctions();
|
||||
bool replacedHeight = ReplaceHeightFunctions();
|
||||
bool replacedHeight = ReplaceHeightFunctions(loopTokens);
|
||||
bool replacedPosX = ReplacePosXFunctions();
|
||||
bool replacedPosY = ReplacePosYFunctions();
|
||||
|
||||
@@ -425,7 +425,7 @@ bool cTemplatePixmap::ReplaceWidthFunctions(void) {
|
||||
return replaced;
|
||||
}
|
||||
|
||||
bool cTemplatePixmap::ReplaceHeightFunctions(void) {
|
||||
bool cTemplatePixmap::ReplaceHeightFunctions(map < string, vector< map< string, string > > > *loopTokens) {
|
||||
bool replaced = false;
|
||||
InitIterator();
|
||||
cTemplateFunction *func = NULL;
|
||||
@@ -443,7 +443,7 @@ bool cTemplatePixmap::ReplaceHeightFunctions(void) {
|
||||
cTemplateFunction *myFunc = *it;
|
||||
string myFuncName = myFunc->GetParameter(ptName);
|
||||
if (!myFuncName.compare(label)) {
|
||||
funcHeight = myFunc->GetHeight();
|
||||
funcHeight = myFunc->GetHeight(loopTokens);
|
||||
func->SetHeight(type, label, funcHeight);
|
||||
if (func->Updated()) {
|
||||
func->CompleteParameters();
|
||||
|
||||
@@ -32,7 +32,7 @@ protected:
|
||||
cGlobals *globals;
|
||||
//functions replacing {width(label)} and {height(label)} tokens
|
||||
bool ReplaceWidthFunctions(void);
|
||||
bool ReplaceHeightFunctions(void);
|
||||
bool ReplaceHeightFunctions(map < string, vector< map< string, string > > > *loopTokens);
|
||||
//functions replacing {posx(label)} and {posy(label)} tokens
|
||||
bool ReplacePosXFunctions(void);
|
||||
bool ReplacePosYFunctions(void);
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
//Parse pixmap parameters with dynamically set Tokens
|
||||
void ParseDynamicParameters(map <string,string> *stringTokens, map <string,int> *intTokens, bool initFuncs);
|
||||
//Parse all function parameters with dynamically set Tokens
|
||||
void ParseDynamicFunctionParameters(map <string,string> *stringTokens, map <string,int> *intTokens);
|
||||
void ParseDynamicFunctionParameters(map <string,string> *stringTokens, map <string,int> *intTokens, map < string, vector< map< string, string > > > *loopTokens);
|
||||
//Calculate size of drawport in case area scrolls
|
||||
bool CalculateDrawPortSize(cSize &size, map < string, vector< map< string, string > > > *loopTokens = NULL);
|
||||
//Set max width for text in scrollarea
|
||||
|
||||
@@ -320,13 +320,13 @@ string cXmlParser::GetPath(string xmlFile) {
|
||||
string activeTheme = Setup.OSDTheme;
|
||||
string path = "";
|
||||
if (!xmlFile.compare("globals.xml")) {
|
||||
path = *cString::sprintf("%s%s/%s", *config.skinPath, activeSkin.c_str(), xmlFile.c_str());
|
||||
path = *cString::sprintf("%s%s/%s", *config.GetSkinPath(activeSkin), activeSkin.c_str(), xmlFile.c_str());
|
||||
} else if (!xmlFile.compare("theme.xml")) {
|
||||
path = *cString::sprintf("%s%s/themes/%s/%s", *config.skinPath, activeSkin.c_str(), activeTheme.c_str(), xmlFile.c_str());
|
||||
path = *cString::sprintf("%s%s/themes/%s/%s", *config.GetSkinPath(activeSkin), activeSkin.c_str(), activeTheme.c_str(), xmlFile.c_str());
|
||||
} else if (!xmlFile.compare("setup.xml")) {
|
||||
path = *cString::sprintf("%s%s/%s", *config.skinPath, activeSkin.c_str(), xmlFile.c_str());
|
||||
path = *cString::sprintf("%s%s/%s", *config.GetSkinPath(activeSkin), activeSkin.c_str(), xmlFile.c_str());
|
||||
} else {
|
||||
path = *cString::sprintf("%s%s/xmlfiles/%s", *config.skinPath, activeSkin.c_str(), xmlFile.c_str());
|
||||
path = *cString::sprintf("%s%s/xmlfiles/%s", *config.GetSkinPath(activeSkin), activeSkin.c_str(), xmlFile.c_str());
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user