It's now possible to use the measures as if they were variables (use [MeasureName] instead #VariableName#). Set DynamicVariables=1 for all meters and measures which refer to other measures.

New bang !RainmeterSetVariable can be used to change the value of a variable (DynamicVariables must be 1 in places where the variable is used).
This commit is contained in:
Kimmo Pekkola
2009-08-26 17:37:15 +00:00
parent 7b22d717a3
commit dc3c767efa
10 changed files with 317 additions and 77 deletions

View File

@ -23,10 +23,12 @@
#include <map>
#include <string>
#include <vector>
#include <hash_map>
#include <gdiplus.h>
#include "ccalc-0.5.1/mparser.h"
class CRainmeter;
class CMeasure;
class CConfigParser
{
@ -35,6 +37,8 @@ public:
~CConfigParser();
void Initialize(LPCTSTR filename, CRainmeter* pRainmeter);
void AddMeasure(CMeasure* pMeasure);
void SetVariable(const std::wstring& strVariable, const std::wstring& strValue);
const std::wstring& ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue);
double ReadFloat(LPCTSTR section, LPCTSTR key, double defValue);
@ -50,10 +54,20 @@ private:
Gdiplus::Color ParseColor(LPCTSTR string);
std::vector<std::wstring> Tokenize(const std::wstring& str, const std::wstring delimiters);
void ReadIniFile(const std::wstring& strFileName);
void SetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strValue);
const std::wstring& GetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strDefault);
std::vector<std::wstring> GetSections();
std::vector<std::wstring> GetKeys(const std::wstring& strSection);
std::map<std::wstring, std::wstring> m_Variables;
std::wstring m_Filename;
hqMathParser* m_Parser;
std::map<std::wstring, CMeasure*> m_Measures;
stdext::hash_map<std::wstring, std::vector<std::wstring> > m_Keys;
stdext::hash_map<std::wstring, std::wstring> m_Values;
};
#endif