mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	Changed Calc errors to be reported only once (not on each update)
This commit is contained in:
		| @@ -28,6 +28,7 @@ bool CMeasureCalc::c_RandSeeded = false; | |||||||
| ** | ** | ||||||
| */ | */ | ||||||
| CMeasureCalc::CMeasureCalc(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name), | CMeasureCalc::CMeasureCalc(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name), | ||||||
|  | 	m_ValidFormula(false), | ||||||
| 	m_LowBound(), | 	m_LowBound(), | ||||||
| 	m_HighBound(100), | 	m_HighBound(100), | ||||||
| 	m_UpdateRandom(false) | 	m_UpdateRandom(false) | ||||||
| @@ -57,10 +58,14 @@ bool CMeasureCalc::Update() | |||||||
| { | { | ||||||
| 	if (!CMeasure::PreUpdate()) return false; | 	if (!CMeasure::PreUpdate()) return false; | ||||||
|  |  | ||||||
|  | 	if (m_ValidFormula) | ||||||
|  | 	{ | ||||||
| 		const WCHAR* errMsg = MathParser::Parse(m_Formula.c_str(), this, &m_Value); | 		const WCHAR* errMsg = MathParser::Parse(m_Formula.c_str(), this, &m_Value); | ||||||
| 		if (errMsg != NULL) | 		if (errMsg != NULL) | ||||||
| 		{ | 		{ | ||||||
| 			LogWithArgs(LOG_ERROR, L"Calc: %s in [%s]", errMsg, m_Name.c_str()); | 			LogWithArgs(LOG_ERROR, L"Calc: %s in [%s]", errMsg, m_Name.c_str()); | ||||||
|  | 			m_ValidFormula = false; | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return PostUpdate(); | 	return PostUpdate(); | ||||||
| @@ -101,7 +106,11 @@ void CMeasureCalc::ReadConfig(CConfigParser& parser, const WCHAR* section) | |||||||
| 		if (errMsg != NULL) | 		if (errMsg != NULL) | ||||||
| 		{ | 		{ | ||||||
| 			LogWithArgs(LOG_ERROR, L"Calc: %s in [%s]", errMsg, m_Name.c_str()); | 			LogWithArgs(LOG_ERROR, L"Calc: %s in [%s]", errMsg, m_Name.c_str()); | ||||||
| 			m_Formula.clear(); | 			m_ValidFormula = false; | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			m_ValidFormula = true; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Birunthan Mohanathas
					Birunthan Mohanathas