mirror of
				https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
				synced 2023-10-19 15:58:31 +00:00 
			
		
		
		
	optimized performance when creating a menu list
This commit is contained in:
		
							
								
								
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -50,5 +50,6 @@ Version 0.0.3 | ||||
| - added {channelname}, {channelid}, {channellogoexists} for all schedules list and current views | ||||
| - added printf function for <drawtext>, see Wiki for documentation | ||||
| - removed code for displaying bitrates in displaychannel again because of incompatibility with dvbapi Plugin | ||||
| - optimized performance when creating a menu list | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -272,6 +272,36 @@ bool cTemplateFunction::CalculateParameters(void) { | ||||
|     return paramsValid; | ||||
| }     | ||||
|  | ||||
| bool cTemplateFunction::ReCalculateParameters(void) { | ||||
|     bool paramValid = true; | ||||
|     bool paramsValid = true; | ||||
|     for (map< eParamType, string >::iterator param = nativeParameters.begin(); param != nativeParameters.end(); param++) {  | ||||
|         paramValid = true; | ||||
|         eParamType type = param->first; | ||||
|         string value = param->second; | ||||
|         switch (type) { | ||||
|             case ptX: | ||||
|             case ptY: | ||||
|             case ptWidth: | ||||
|             case ptHeight: | ||||
|             case ptMenuItemWidth: | ||||
|             case ptFontSize: | ||||
|             case ptFloatWidth: | ||||
|             case ptFloatHeight: | ||||
|             case ptMaxLines: | ||||
|             case ptColumnWidth: | ||||
|             case ptRowHeight: | ||||
|                 SetNumericParameter(type, value); | ||||
|                 break; | ||||
|         } | ||||
|         if (!paramValid) { | ||||
|             paramsValid = false; | ||||
|             esyslog("skindesigner: %s: invalid parameter %d, value %s", GetFuncName().c_str(), type, value.c_str()); | ||||
|         } | ||||
|     } | ||||
|     return paramsValid; | ||||
| }     | ||||
|  | ||||
| void cTemplateFunction::CompleteParameters(void) { | ||||
|     switch (type) { | ||||
|         case ftDrawImage: { | ||||
| @@ -733,8 +763,11 @@ bool cTemplateFunction::SetNumericParameter(eParamType type, string value) { | ||||
|         if (this->type < ftLoop && type == ptY) { | ||||
|             val += containerY; | ||||
|         } | ||||
|         numericParameters.erase(type); | ||||
|         numericDynamicParameters.erase(type); | ||||
|         numericParameters.insert(pair<eParamType, int>(type, val)); | ||||
|     } else { | ||||
|         numericDynamicParameters.erase(type); | ||||
|         numericDynamicParameters.insert(pair<eParamType, string>(type, parsedValue)); | ||||
|     } | ||||
|     return param.Valid(); | ||||
|   | ||||
| @@ -172,6 +172,8 @@ public: | ||||
|     void SetTranslatedText(string translation); | ||||
|     //PreCache Parameters  | ||||
|     bool CalculateParameters(void); | ||||
|     //Complete Parameters  | ||||
|     bool ReCalculateParameters(void); | ||||
|     void CompleteParameters(void); | ||||
|     //Set and Unset Dynamic Tokens from view | ||||
|     void SetStringTokens(map < string, string > *tok) { stringTokens = tok; }; | ||||
|   | ||||
| @@ -78,11 +78,12 @@ void cTemplatePixmap::ParseDynamicParameters(map <string,int> *intTokens, bool i | ||||
|  | ||||
|     for (vector<cTemplateFunction*>::iterator func = functions.begin(); func != functions.end(); func++) { | ||||
|         (*func)->SetContainer(x, y, width, height); | ||||
|         (*func)->CalculateParameters(); | ||||
|         (*func)->ReCalculateParameters(); | ||||
|         (*func)->CompleteParameters(); | ||||
|         if ((*func)->GetType() == ftLoop) { | ||||
|             cTemplateLoopFunction *loopFunc = dynamic_cast<cTemplateLoopFunction*>(*func); | ||||
|             if (!loopFunc->Ready()) { | ||||
|                 loopFunc->CalculateParameters(); | ||||
|                 loopFunc->SetIntTokens(intTokens); | ||||
|                 loopFunc->ParseParameters(); | ||||
|                 loopFunc->UnsetIntTokens(); | ||||
| @@ -137,8 +138,6 @@ bool cTemplatePixmap::CalculateParameters(void) { | ||||
|  | ||||
|     for (vector<cTemplateFunction*>::iterator func = functions.begin(); func != functions.end(); func++) { | ||||
|         (*func)->SetGlobals(globals); | ||||
|         if (!Ready()) | ||||
|             continue; | ||||
|         (*func)->SetContainer(0, 0, pixWidth, pixHeight); | ||||
|         paramsValid = (*func)->CalculateParameters(); | ||||
|         (*func)->CompleteParameters(); | ||||
|   | ||||
| @@ -362,6 +362,7 @@ void cTemplateView::PreCache(bool isSubview) { | ||||
|         pixOffset += viewElement->GetNumPixmaps(); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     //Cache ViewLists | ||||
|     for (map < eViewList, cTemplateViewList* >::iterator it = viewLists.begin(); it != viewLists.end(); it++) { | ||||
|         cTemplateViewList *viewList = it->second; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user