diff --git a/Library/Measure.cpp b/Library/Measure.cpp index 29938459..e2e9a670 100644 --- a/Library/Measure.cpp +++ b/Library/Measure.cpp @@ -67,7 +67,7 @@ extern CRainmeter* Rainmeter; ** The constructor ** */ -CMeasure::CMeasure(CMeterWindow* meterWindow) : m_MeterWindow(meterWindow), +CMeasure::CMeasure(CMeterWindow* meterWindow, const WCHAR* name) : m_MeterWindow(meterWindow), m_Name(name), m_ANSIName(ConvertToAscii(name)), m_DynamicVariables(false), m_Invert(false), m_LogMaxValue(false), @@ -651,75 +651,77 @@ const WCHAR* CMeasure::GetStats() ** If new measures are implemented this method needs to be updated. ** */ -CMeasure* CMeasure::Create(const WCHAR* measure, CMeterWindow* meterWindow) +CMeasure* CMeasure::Create(const WCHAR* measure, CMeterWindow* meterWindow, const WCHAR* name) { - // Comparson is caseinsensitive + // Comparison is caseinsensitive - if(_wcsicmp(L"", measure) == 0) + if(*measure == L'\0') { return NULL; } else if(_wcsicmp(L"CPU", measure) == 0) { - return new CMeasureCPU(meterWindow); + return new CMeasureCPU(meterWindow, name); } else if(_wcsicmp(L"Memory", measure) == 0) { - return new CMeasureMemory(meterWindow); + return new CMeasureMemory(meterWindow, name); } else if(_wcsicmp(L"NetIn", measure) == 0) { - return new CMeasureNetIn(meterWindow); + return new CMeasureNetIn(meterWindow, name); } else if(_wcsicmp(L"NetOut", measure) == 0) { - return new CMeasureNetOut(meterWindow); + return new CMeasureNetOut(meterWindow, name); } else if(_wcsicmp(L"NetTotal", measure) == 0) { - return new CMeasureNetTotal(meterWindow); + return new CMeasureNetTotal(meterWindow, name); } else if(_wcsicmp(L"PhysicalMemory", measure) == 0) { - return new CMeasurePhysicalMemory(meterWindow); + return new CMeasurePhysicalMemory(meterWindow, name); } else if(_wcsicmp(L"SwapMemory", measure) == 0) { - return new CMeasureVirtualMemory(meterWindow); + return new CMeasureVirtualMemory(meterWindow, name); } else if(_wcsicmp(L"FreeDiskSpace", measure) == 0) { - return new CMeasureDiskSpace(meterWindow); + return new CMeasureDiskSpace(meterWindow, name); } else if(_wcsicmp(L"Uptime", measure) == 0) { - return new CMeasureUptime(meterWindow); + return new CMeasureUptime(meterWindow, name); } else if(_wcsicmp(L"Time", measure) == 0) { - return new CMeasureTime(meterWindow); + return new CMeasureTime(meterWindow, name); } else if(_wcsicmp(L"Plugin", measure) == 0) { - return new CMeasurePlugin(meterWindow); + return new CMeasurePlugin(meterWindow, name); } else if(_wcsicmp(L"Registry", measure) == 0) { - return new CMeasureRegistry(meterWindow); + return new CMeasureRegistry(meterWindow, name); } else if(_wcsicmp(L"Calc", measure) == 0) { - return new CMeasureCalc(meterWindow); + return new CMeasureCalc(meterWindow, name); } else if(_wcsicmp(L"script", measure) == 0) { - return new CMeasureScript(meterWindow); + return new CMeasureScript(meterWindow, name); } // Error std::wstring error = L"Measure="; error += measure; - error += L" is not valid."; + error += L" is not valid in section ["; + error += name; + error += L"]."; throw CError(error, __LINE__, __FILE__); return NULL; diff --git a/Library/Measure.h b/Library/Measure.h index cace3557..474ff765 100644 --- a/Library/Measure.h +++ b/Library/Measure.h @@ -44,16 +44,17 @@ class CConfigParser; class CMeasure : public CGroup { public: - CMeasure(CMeterWindow* meterWindow); + CMeasure(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasure(); - + + void ReadConfig(CConfigParser& parser) { ReadConfig(parser, GetName()); } + virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); virtual void Initialize(); virtual bool Update() = 0; virtual const WCHAR* GetStats(); - void SetName(const WCHAR* name) { m_Name = name; m_ANSIName = ConvertToAscii(name); } const WCHAR* GetName() { return m_Name.c_str(); } const char* GetANSIName() { return m_ANSIName.c_str(); } @@ -78,7 +79,7 @@ public: virtual const WCHAR* GetStringValue(AUTOSCALE autoScale, double scale, int decimals, bool percentual); static void GetScaledValue(AUTOSCALE autoScale, int decimals, double theValue, WCHAR* buffer, size_t sizeInWords); - static CMeasure* Create(const WCHAR* measure, CMeterWindow* meterWindow); + static CMeasure* Create(const WCHAR* measure, CMeterWindow* meterWindow, const WCHAR* name); protected: virtual bool PreUpdate(); @@ -94,8 +95,8 @@ protected: double m_MinValue; // The minimum value (so far) double m_MaxValue; // The maximum value (so far) double m_Value; // The current value - std::wstring m_Name; // Name of this Measure - std::string m_ANSIName; // Name of this Measure in ANSI + const std::wstring m_Name; // Name of this Measure + const std::string m_ANSIName; // Name of this Measure in ANSI std::vector m_Substitute; // Vec of substitute strings diff --git a/Library/MeasureCPU.cpp b/Library/MeasureCPU.cpp index ae95c16a..944daf7a 100644 --- a/Library/MeasureCPU.cpp +++ b/Library/MeasureCPU.cpp @@ -60,7 +60,7 @@ ULONG CMeasureCPU::c_BufferSize = 0; ** The constructor ** */ -CMeasureCPU::CMeasureCPU(CMeterWindow* meterWindow) : CMeasure(meterWindow), +CMeasureCPU::CMeasureCPU(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name), m_FirstTime(true), m_Processor() { diff --git a/Library/MeasureCPU.h b/Library/MeasureCPU.h index 9eec31da..97ff650e 100644 --- a/Library/MeasureCPU.h +++ b/Library/MeasureCPU.h @@ -35,7 +35,7 @@ typedef BOOL (WINAPI *PROCGST)(LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, L class CMeasureCPU : public CMeasure { public: - CMeasureCPU(CMeterWindow* meterWindow); + CMeasureCPU(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasureCPU(); virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); diff --git a/Library/MeasureCalc.cpp b/Library/MeasureCalc.cpp index cb09d46b..62958aeb 100644 --- a/Library/MeasureCalc.cpp +++ b/Library/MeasureCalc.cpp @@ -31,7 +31,7 @@ bool CMeasureCalc::c_RandSeeded = false; ** The constructor ** */ -CMeasureCalc::CMeasureCalc(CMeterWindow* meterWindow) : CMeasure(meterWindow), +CMeasureCalc::CMeasureCalc(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name), m_Parser(MathParser_Create(NULL)), m_LowBound(), m_HighBound(100), diff --git a/Library/MeasureCalc.h b/Library/MeasureCalc.h index 0a1e5d5f..349b88fb 100644 --- a/Library/MeasureCalc.h +++ b/Library/MeasureCalc.h @@ -25,7 +25,7 @@ class CMeasureCalc : public CMeasure { public: - CMeasureCalc(CMeterWindow* meterWindow); + CMeasureCalc(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasureCalc(); virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); diff --git a/Library/MeasureDiskSpace.cpp b/Library/MeasureDiskSpace.cpp index c9ed2ced..2137ed64 100644 --- a/Library/MeasureDiskSpace.cpp +++ b/Library/MeasureDiskSpace.cpp @@ -26,7 +26,7 @@ ** The constructor ** */ -CMeasureDiskSpace::CMeasureDiskSpace(CMeterWindow* meterWindow) : CMeasure(meterWindow), +CMeasureDiskSpace::CMeasureDiskSpace(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name), m_Total(false), m_Label(false), m_IgnoreRemovable(true), diff --git a/Library/MeasureDiskSpace.h b/Library/MeasureDiskSpace.h index 0ebe1b90..edd7707b 100644 --- a/Library/MeasureDiskSpace.h +++ b/Library/MeasureDiskSpace.h @@ -24,7 +24,7 @@ class CMeasureDiskSpace : public CMeasure { public: - CMeasureDiskSpace(CMeterWindow* meterWindow); + CMeasureDiskSpace(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasureDiskSpace(); virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); diff --git a/Library/MeasureMemory.cpp b/Library/MeasureMemory.cpp index 72ad90bd..244bb8bc 100644 --- a/Library/MeasureMemory.cpp +++ b/Library/MeasureMemory.cpp @@ -26,7 +26,7 @@ ** The constructor ** */ -CMeasureMemory::CMeasureMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow), +CMeasureMemory::CMeasureMemory(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name), m_Total(false) { } diff --git a/Library/MeasureMemory.h b/Library/MeasureMemory.h index 38fec8be..864f0bb3 100644 --- a/Library/MeasureMemory.h +++ b/Library/MeasureMemory.h @@ -24,7 +24,7 @@ class CMeasureMemory : public CMeasure { public: - CMeasureMemory(CMeterWindow* meterWindow); + CMeasureMemory(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasureMemory(); virtual bool Update(); diff --git a/Library/MeasureNet.cpp b/Library/MeasureNet.cpp index 40dc2aff..5cbf9987 100644 --- a/Library/MeasureNet.cpp +++ b/Library/MeasureNet.cpp @@ -38,7 +38,7 @@ extern CRainmeter* Rainmeter; ** The constructor. This is the base class for the net-meters. ** */ -CMeasureNet::CMeasureNet(CMeterWindow* meterWindow) : CMeasure(meterWindow), +CMeasureNet::CMeasureNet(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name), m_CurrentTraffic(), m_TrafficValue(), m_Interface(), diff --git a/Library/MeasureNet.h b/Library/MeasureNet.h index f6b921ee..f2040782 100644 --- a/Library/MeasureNet.h +++ b/Library/MeasureNet.h @@ -167,7 +167,7 @@ public: NET_TOTAL }; - CMeasureNet(CMeterWindow* meterWindow); + CMeasureNet(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasureNet(); virtual bool Update(); diff --git a/Library/MeasureNetIn.cpp b/Library/MeasureNetIn.cpp index d34fa9fa..474aa9a9 100644 --- a/Library/MeasureNetIn.cpp +++ b/Library/MeasureNetIn.cpp @@ -25,7 +25,7 @@ ** The constructor ** */ -CMeasureNetIn::CMeasureNetIn(CMeterWindow* meterWindow) : CMeasureNet(meterWindow), +CMeasureNetIn::CMeasureNetIn(CMeterWindow* meterWindow, const WCHAR* name) : CMeasureNet(meterWindow, name), m_FirstTime(true), m_InOctets() { diff --git a/Library/MeasureNetIn.h b/Library/MeasureNetIn.h index ba996a84..eaefd0cf 100644 --- a/Library/MeasureNetIn.h +++ b/Library/MeasureNetIn.h @@ -24,7 +24,7 @@ class CMeasureNetIn : public CMeasureNet { public: - CMeasureNetIn(CMeterWindow* meterWindow); + CMeasureNetIn(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasureNetIn(); virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); diff --git a/Library/MeasureNetOut.cpp b/Library/MeasureNetOut.cpp index 7be46a45..b75b4385 100644 --- a/Library/MeasureNetOut.cpp +++ b/Library/MeasureNetOut.cpp @@ -25,7 +25,7 @@ ** The constructor ** */ -CMeasureNetOut::CMeasureNetOut(CMeterWindow* meterWindow) : CMeasureNet(meterWindow), +CMeasureNetOut::CMeasureNetOut(CMeterWindow* meterWindow, const WCHAR* name) : CMeasureNet(meterWindow, name), m_FirstTime(true), m_OutOctets() { diff --git a/Library/MeasureNetOut.h b/Library/MeasureNetOut.h index d9f172ee..83de7b67 100644 --- a/Library/MeasureNetOut.h +++ b/Library/MeasureNetOut.h @@ -24,7 +24,7 @@ class CMeasureNetOut : public CMeasureNet { public: - CMeasureNetOut(CMeterWindow* meterWindow); + CMeasureNetOut(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasureNetOut(); virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); diff --git a/Library/MeasureNetTotal.cpp b/Library/MeasureNetTotal.cpp index db9aaca5..41b83a94 100644 --- a/Library/MeasureNetTotal.cpp +++ b/Library/MeasureNetTotal.cpp @@ -25,7 +25,7 @@ ** The constructor ** */ -CMeasureNetTotal::CMeasureNetTotal(CMeterWindow* meterWindow) : CMeasureNet(meterWindow), +CMeasureNetTotal::CMeasureNetTotal(CMeterWindow* meterWindow, const WCHAR* name) : CMeasureNet(meterWindow, name), m_FirstTime(true), m_TotalOctets() { diff --git a/Library/MeasureNetTotal.h b/Library/MeasureNetTotal.h index 12cd3698..10e4aaa9 100644 --- a/Library/MeasureNetTotal.h +++ b/Library/MeasureNetTotal.h @@ -24,7 +24,7 @@ class CMeasureNetTotal : public CMeasureNet { public: - CMeasureNetTotal(CMeterWindow* meterWindow); + CMeasureNetTotal(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasureNetTotal(); virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); diff --git a/Library/MeasurePhysicalMemory.cpp b/Library/MeasurePhysicalMemory.cpp index 79ce279b..5c644444 100644 --- a/Library/MeasurePhysicalMemory.cpp +++ b/Library/MeasurePhysicalMemory.cpp @@ -26,7 +26,7 @@ ** The constructor ** */ -CMeasurePhysicalMemory::CMeasurePhysicalMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow), +CMeasurePhysicalMemory::CMeasurePhysicalMemory(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name), m_Total(false) { } diff --git a/Library/MeasurePhysicalMemory.h b/Library/MeasurePhysicalMemory.h index a129582d..42aa3698 100644 --- a/Library/MeasurePhysicalMemory.h +++ b/Library/MeasurePhysicalMemory.h @@ -24,7 +24,7 @@ class CMeasurePhysicalMemory : public CMeasure { public: - CMeasurePhysicalMemory(CMeterWindow* meterWindow); + CMeasurePhysicalMemory(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasurePhysicalMemory(); virtual bool Update(); diff --git a/Library/MeasurePlugin.cpp b/Library/MeasurePlugin.cpp index 1778367c..952e548b 100644 --- a/Library/MeasurePlugin.cpp +++ b/Library/MeasurePlugin.cpp @@ -30,7 +30,7 @@ extern CRainmeter* Rainmeter; ** The constructor ** */ -CMeasurePlugin::CMeasurePlugin(CMeterWindow* meterWindow) : CMeasure(meterWindow), +CMeasurePlugin::CMeasurePlugin(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name), m_Plugin(), m_ID(), InitializeFunc(), diff --git a/Library/MeasurePlugin.h b/Library/MeasurePlugin.h index fe745e6a..b70e0d52 100644 --- a/Library/MeasurePlugin.h +++ b/Library/MeasurePlugin.h @@ -31,7 +31,7 @@ typedef void (*EXECUTEBANG)(LPCTSTR, UINT); class CMeasurePlugin : public CMeasure { public: - CMeasurePlugin(CMeterWindow* meterWindow); + CMeasurePlugin(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasurePlugin(); virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); diff --git a/Library/MeasureRegistry.cpp b/Library/MeasureRegistry.cpp index 4e14cb36..81ef7e5b 100644 --- a/Library/MeasureRegistry.cpp +++ b/Library/MeasureRegistry.cpp @@ -27,7 +27,7 @@ ** The constructor ** */ -CMeasureRegistry::CMeasureRegistry(CMeterWindow* meterWindow) : CMeasure(meterWindow), +CMeasureRegistry::CMeasureRegistry(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name), m_RegKey(), m_HKey() { diff --git a/Library/MeasureRegistry.h b/Library/MeasureRegistry.h index 73ee3eb5..8671b66d 100644 --- a/Library/MeasureRegistry.h +++ b/Library/MeasureRegistry.h @@ -24,7 +24,7 @@ class CMeasureRegistry : public CMeasure { public: - CMeasureRegistry(CMeterWindow* meterWindow); + CMeasureRegistry(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasureRegistry(); virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); diff --git a/Library/MeasureScript.cpp b/Library/MeasureScript.cpp index 47b26f51..0e93e373 100644 --- a/Library/MeasureScript.cpp +++ b/Library/MeasureScript.cpp @@ -9,7 +9,7 @@ const char* g_strUpdateFunction = "Update"; const char* g_strGetValueFunction = "GetValue"; const char* g_strGetStringValueFunction = "GetStringValue"; -CMeasureScript::CMeasureScript(CMeterWindow* meterWindow) : CMeasure(meterWindow), +CMeasureScript::CMeasureScript(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name), m_pLuaScript(), m_bUpdateDefined(false), m_bGetValueDefined(false), diff --git a/Library/MeasureScript.h b/Library/MeasureScript.h index f1d7befe..1de64638 100644 --- a/Library/MeasureScript.h +++ b/Library/MeasureScript.h @@ -8,7 +8,7 @@ class CMeasureScript : public CMeasure { public: - CMeasureScript(CMeterWindow* meterWindow); + CMeasureScript(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasureScript(); virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); diff --git a/Library/MeasureTime.cpp b/Library/MeasureTime.cpp index 63d2d2ed..4e675d79 100644 --- a/Library/MeasureTime.cpp +++ b/Library/MeasureTime.cpp @@ -46,7 +46,7 @@ int GetYearDay(int year, int month, int day) ** The constructor ** */ -CMeasureTime::CMeasureTime(CMeterWindow* meterWindow) : CMeasure(meterWindow), +CMeasureTime::CMeasureTime(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name), m_DeltaTime(), m_Time() { diff --git a/Library/MeasureTime.h b/Library/MeasureTime.h index acf83f66..a8143594 100644 --- a/Library/MeasureTime.h +++ b/Library/MeasureTime.h @@ -24,7 +24,7 @@ class CMeasureTime : public CMeasure { public: - CMeasureTime(CMeterWindow* meterWindow); + CMeasureTime(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasureTime(); virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); diff --git a/Library/MeasureUptime.cpp b/Library/MeasureUptime.cpp index bcd489c8..b80963d0 100644 --- a/Library/MeasureUptime.cpp +++ b/Library/MeasureUptime.cpp @@ -26,7 +26,7 @@ ** The constructor ** */ -CMeasureUptime::CMeasureUptime(CMeterWindow* meterWindow) : CMeasure(meterWindow) +CMeasureUptime::CMeasureUptime(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name) { } diff --git a/Library/MeasureUptime.h b/Library/MeasureUptime.h index 66938e33..ce9664df 100644 --- a/Library/MeasureUptime.h +++ b/Library/MeasureUptime.h @@ -24,7 +24,7 @@ class CMeasureUptime : public CMeasure { public: - CMeasureUptime(CMeterWindow* meterWindow); + CMeasureUptime(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasureUptime(); virtual bool Update(); diff --git a/Library/MeasureVirtualMemory.cpp b/Library/MeasureVirtualMemory.cpp index d2ef5076..a8585002 100644 --- a/Library/MeasureVirtualMemory.cpp +++ b/Library/MeasureVirtualMemory.cpp @@ -26,7 +26,7 @@ ** The constructor ** */ -CMeasureVirtualMemory::CMeasureVirtualMemory(CMeterWindow* meterWindow) : CMeasure(meterWindow), +CMeasureVirtualMemory::CMeasureVirtualMemory(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name), m_Total(false) { } diff --git a/Library/MeasureVirtualMemory.h b/Library/MeasureVirtualMemory.h index c1951dba..f23d3d05 100644 --- a/Library/MeasureVirtualMemory.h +++ b/Library/MeasureVirtualMemory.h @@ -24,7 +24,7 @@ class CMeasureVirtualMemory : public CMeasure { public: - CMeasureVirtualMemory(CMeterWindow* meterWindow); + CMeasureVirtualMemory(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeasureVirtualMemory(); virtual bool Update(); diff --git a/Library/Meter.cpp b/Library/Meter.cpp index a877d3aa..e4262d6b 100644 --- a/Library/Meter.cpp +++ b/Library/Meter.cpp @@ -39,7 +39,7 @@ using namespace Gdiplus; ** The constructor ** */ -CMeter::CMeter(CMeterWindow* meterWindow) : m_MeterWindow(meterWindow), +CMeter::CMeter(CMeterWindow* meterWindow, const WCHAR* name) : m_MeterWindow(meterWindow), m_Name(name), m_Measure(), m_X(), m_Y(), @@ -266,10 +266,8 @@ void CMeter::Hide() ** the base implementation if they overwrite this method. ** */ -void CMeter::ReadConfig(const WCHAR* section) +void CMeter::ReadConfig(CConfigParser& parser, const WCHAR* section) { - CConfigParser& parser = m_MeterWindow->GetParser(); - // The MeterStyle defines a template where the values are read if the meter doesn't have it itself const std::wstring& style = parser.ReadString(section, L"MeterStyle", L""); if (!style.empty()) @@ -479,49 +477,51 @@ void CMeter::BindMeasure(const std::list& measures) ** If new meters are implemented this method needs to be updated. ** */ -CMeter* CMeter::Create(const WCHAR* meter, CMeterWindow* meterWindow) +CMeter* CMeter::Create(const WCHAR* meter, CMeterWindow* meterWindow, const WCHAR* name) { if(_wcsicmp(L"HISTOGRAM", meter) == 0) { - return new CMeterHistogram(meterWindow); + return new CMeterHistogram(meterWindow, name); } else if(_wcsicmp(L"STRING", meter) == 0) { - return new CMeterString(meterWindow); + return new CMeterString(meterWindow, name); } else if(_wcsicmp(L"BAR", meter) == 0) { - return new CMeterBar(meterWindow); + return new CMeterBar(meterWindow, name); } else if(_wcsicmp(L"BITMAP", meter) == 0) { - return new CMeterBitmap(meterWindow); + return new CMeterBitmap(meterWindow, name); } else if(_wcsicmp(L"IMAGE", meter) == 0) { - return new CMeterImage(meterWindow); + return new CMeterImage(meterWindow, name); } else if(_wcsicmp(L"LINE", meter) == 0) { - return new CMeterLine(meterWindow); + return new CMeterLine(meterWindow, name); } else if(_wcsicmp(L"ROUNDLINE", meter) == 0) { - return new CMeterRoundLine(meterWindow); + return new CMeterRoundLine(meterWindow, name); } else if(_wcsicmp(L"ROTATOR", meter) == 0) { - return new CMeterRotator(meterWindow); + return new CMeterRotator(meterWindow, name); } else if(_wcsicmp(L"BUTTON", meter) == 0) { - return new CMeterButton(meterWindow); + return new CMeterButton(meterWindow, name); } // Error std::wstring error = L"Meter="; error += meter; - error += L" is not valid."; + error += L" is not valid in section ["; + error += name; + error += L"]."; throw CError(error, __LINE__, __FILE__); return NULL; diff --git a/Library/Meter.h b/Library/Meter.h index ead83c85..d279810a 100644 --- a/Library/Meter.h +++ b/Library/Meter.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "Litestep.h" #include "MeterWindow.h" #include "Group.h" @@ -32,10 +33,12 @@ class CConfigParser; class CMeter : public CGroup { public: - CMeter(CMeterWindow* meterWindow); + CMeter(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeter(); - virtual void ReadConfig(const WCHAR* section); + void ReadConfig(CConfigParser& parser) { ReadConfig(parser, GetName()); parser.ClearStyleTemplate(); } + + virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); virtual void Initialize(); virtual bool Update(); virtual bool Draw(Gdiplus::Graphics& graphics); @@ -89,14 +92,13 @@ public: void SetMouseOver(bool over) { m_MouseOver = over; } bool IsMouseOver() { return m_MouseOver; } - void SetName(const WCHAR* name) { m_Name = name; } const WCHAR* GetName() { return m_Name.c_str(); } void ResetUpdateCounter() { m_UpdateCounter = m_UpdateDivider; } int GetUpdateCounter() { return m_UpdateCounter; } int GetUpdateDivider() { return m_UpdateDivider; } - static CMeter* Create(const WCHAR* meter, CMeterWindow* meterWindow); + static CMeter* Create(const WCHAR* meter, CMeterWindow* meterWindow, const WCHAR* name); static void DrawBevel(Gdiplus::Graphics& graphics, const Gdiplus::Rect& rect, const Gdiplus::Pen& light, const Gdiplus::Pen& dark); @@ -124,7 +126,7 @@ protected: static bool ReplaceMeasures(const std::vector& stringValues, std::wstring& str); Gdiplus::Matrix m_Transformation; // The transformation matrix - std::wstring m_Name; // Name of the meter + const std::wstring m_Name; // Name of the meter std::wstring m_MeasureName; // Name of the measure this is bound to CMeasure* m_Measure; // Pointer to the measure this meter is bound to std::vector m_AllMeasures; diff --git a/Library/MeterBar.cpp b/Library/MeterBar.cpp index 20ad5865..3a77ce08 100644 --- a/Library/MeterBar.cpp +++ b/Library/MeterBar.cpp @@ -33,7 +33,7 @@ extern CRainmeter* Rainmeter; ** The constructor ** */ -CMeterBar::CMeterBar(CMeterWindow* meterWindow) : CMeter(meterWindow), +CMeterBar::CMeterBar(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name), m_Image(L"BarImage"), m_NeedsReload(false), m_Color(Color::Green), @@ -90,7 +90,7 @@ void CMeterBar::Initialize() ** Read the meter-specific configs from the ini-file. ** */ -void CMeterBar::ReadConfig(const WCHAR* section) +void CMeterBar::ReadConfig(CConfigParser& parser, const WCHAR* section) { // Store the current values so we know if the image needs to be updated std::wstring oldImageName = m_ImageName; @@ -98,9 +98,7 @@ void CMeterBar::ReadConfig(const WCHAR* section) int oldH = m_H; // Read common configs - CMeter::ReadConfig(section); - - CConfigParser& parser = m_MeterWindow->GetParser(); + CMeter::ReadConfig(parser, section); m_Color = parser.ReadColor(section, L"BarColor", Color::Green); diff --git a/Library/MeterBar.h b/Library/MeterBar.h index 07ed9231..33eb5549 100644 --- a/Library/MeterBar.h +++ b/Library/MeterBar.h @@ -25,10 +25,10 @@ class CMeterBar : public CMeter { public: - CMeterBar(CMeterWindow* meterWindow); + CMeterBar(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeterBar(); - virtual void ReadConfig(const WCHAR* section); + virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); virtual void Initialize(); virtual bool Update(); virtual bool Draw(Gdiplus::Graphics& graphics); diff --git a/Library/MeterBitmap.cpp b/Library/MeterBitmap.cpp index 7d8dc536..281b32f0 100644 --- a/Library/MeterBitmap.cpp +++ b/Library/MeterBitmap.cpp @@ -32,7 +32,7 @@ extern CRainmeter* Rainmeter; ** The constructor ** */ -CMeterBitmap::CMeterBitmap(CMeterWindow* meterWindow) : CMeter(meterWindow), +CMeterBitmap::CMeterBitmap(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name), m_Image(L"BitmapImage", NULL, true), m_NeedsReload(false), m_ZeroFrame(false), @@ -162,7 +162,7 @@ bool CMeterBitmap::HitTest(int x, int y) ** Read the meter-specific configs from the ini-file. ** */ -void CMeterBitmap::ReadConfig(const WCHAR* section) +void CMeterBitmap::ReadConfig(CConfigParser& parser, const WCHAR* section) { // Store the current values so we know if the image needs to be updated std::wstring oldImageName = m_ImageName; @@ -170,9 +170,7 @@ void CMeterBitmap::ReadConfig(const WCHAR* section) int oldH = m_H; // Read common configs - CMeter::ReadConfig(section); - - CConfigParser& parser = m_MeterWindow->GetParser(); + CMeter::ReadConfig(parser, section); m_ImageName = parser.ReadString(section, L"BitmapImage", L""); if (!m_ImageName.empty()) diff --git a/Library/MeterBitmap.h b/Library/MeterBitmap.h index 06f0a906..2541514f 100644 --- a/Library/MeterBitmap.h +++ b/Library/MeterBitmap.h @@ -25,12 +25,12 @@ class CMeterBitmap : public CMeter { public: - CMeterBitmap(CMeterWindow* meterWindow); + CMeterBitmap(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeterBitmap(); virtual bool HitTest(int x, int y); - virtual void ReadConfig(const WCHAR* section); + virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); virtual void Initialize(); virtual bool Update(); virtual bool Draw(Gdiplus::Graphics& graphics); diff --git a/Library/MeterButton.cpp b/Library/MeterButton.cpp index 6eabb37d..adde2e52 100644 --- a/Library/MeterButton.cpp +++ b/Library/MeterButton.cpp @@ -39,7 +39,7 @@ enum BUTTON_STATE ** The constructor ** */ -CMeterButton::CMeterButton(CMeterWindow* meterWindow) : CMeter(meterWindow), +CMeterButton::CMeterButton(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name), m_Image(L"ButtonImage", NULL, true), m_NeedsReload(false), m_Bitmaps(), @@ -136,7 +136,7 @@ void CMeterButton::Initialize() ** Read the meter-specific configs from the ini-file. ** */ -void CMeterButton::ReadConfig(const WCHAR* section) +void CMeterButton::ReadConfig(CConfigParser& parser, const WCHAR* section) { // Store the current values so we know if the image needs to be updated std::wstring oldImageName = m_ImageName; @@ -144,9 +144,7 @@ void CMeterButton::ReadConfig(const WCHAR* section) int oldH = m_H; // Read common configs - CMeter::ReadConfig(section); - - CConfigParser& parser = m_MeterWindow->GetParser(); + CMeter::ReadConfig(parser, section); m_ImageName = parser.ReadString(section, L"ButtonImage", L""); if (!m_ImageName.empty()) diff --git a/Library/MeterButton.h b/Library/MeterButton.h index 611b5c80..504b4156 100644 --- a/Library/MeterButton.h +++ b/Library/MeterButton.h @@ -27,10 +27,10 @@ class CMeterButton : public CMeter { public: - CMeterButton(CMeterWindow* meterWindow); + CMeterButton(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeterButton(); - virtual void ReadConfig(const WCHAR* section); + virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); virtual void Initialize(); virtual bool Update(); virtual bool Draw(Gdiplus::Graphics& graphics); diff --git a/Library/MeterHistogram.cpp b/Library/MeterHistogram.cpp index 1b2d4a01..63f458c2 100644 --- a/Library/MeterHistogram.cpp +++ b/Library/MeterHistogram.cpp @@ -36,7 +36,7 @@ CTintedImageHelper_DefineConfigArray(CMeterHistogram::c_BothConfigArray, L"Both" ** The constructor ** */ -CMeterHistogram::CMeterHistogram(CMeterWindow* meterWindow) : CMeter(meterWindow), +CMeterHistogram::CMeterHistogram(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name), m_SecondaryMeasure(), m_PrimaryColor(Color::Green), m_SecondaryColor(Color::Red), @@ -195,7 +195,7 @@ void CMeterHistogram::Initialize() ** Read the meter-specific configs from the ini-file. ** */ -void CMeterHistogram::ReadConfig(const WCHAR* section) +void CMeterHistogram::ReadConfig(CConfigParser& parser, const WCHAR* section) { // Store the current values so we know if the image needs to be updated std::wstring oldPrimaryImageName = m_PrimaryImageName; @@ -205,9 +205,7 @@ void CMeterHistogram::ReadConfig(const WCHAR* section) int oldH = m_H; // Read common configs - CMeter::ReadConfig(section); - - CConfigParser& parser = m_MeterWindow->GetParser(); + CMeter::ReadConfig(parser, section); m_PrimaryColor = parser.ReadColor(section, L"PrimaryColor", Color::Green); m_SecondaryColor = parser.ReadColor(section, L"SecondaryColor", Color::Red); diff --git a/Library/MeterHistogram.h b/Library/MeterHistogram.h index dea7cf8a..1e8f263f 100644 --- a/Library/MeterHistogram.h +++ b/Library/MeterHistogram.h @@ -25,10 +25,10 @@ class CMeterHistogram : public CMeter { public: - CMeterHistogram(CMeterWindow* meterWindow); + CMeterHistogram(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeterHistogram(); - virtual void ReadConfig(const WCHAR* section); + virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); virtual void Initialize(); virtual bool Update(); virtual bool Draw(Gdiplus::Graphics& graphics); diff --git a/Library/MeterImage.cpp b/Library/MeterImage.cpp index c5cb46e7..2dc63fe3 100644 --- a/Library/MeterImage.cpp +++ b/Library/MeterImage.cpp @@ -32,7 +32,7 @@ using namespace Gdiplus; ** The constructor ** */ -CMeterImage::CMeterImage(CMeterWindow* meterWindow) : CMeter(meterWindow), +CMeterImage::CMeterImage(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name), m_NeedsReload(false), m_WidthDefined(false), m_HeightDefined(false), @@ -117,12 +117,10 @@ void CMeterImage::LoadImage(const std::wstring& imageName, bool bLoadAlways) ** Read the meter-specific configs from the ini-file. ** */ -void CMeterImage::ReadConfig(const WCHAR* section) +void CMeterImage::ReadConfig(CConfigParser& parser, const WCHAR* section) { // Read common configs - CMeter::ReadConfig(section); - - CConfigParser& parser = m_MeterWindow->GetParser(); + CMeter::ReadConfig(parser, section); // Check for extra measures if (!m_Initialized && !m_MeasureName.empty()) diff --git a/Library/MeterImage.h b/Library/MeterImage.h index 3a12e441..81f4c21b 100644 --- a/Library/MeterImage.h +++ b/Library/MeterImage.h @@ -25,10 +25,10 @@ class CMeterImage : public CMeter { public: - CMeterImage(CMeterWindow* meterWindow); + CMeterImage(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeterImage(); - virtual void ReadConfig(const WCHAR* section); + virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); virtual void Initialize(); virtual bool Update(); virtual bool Draw(Gdiplus::Graphics& graphics); diff --git a/Library/MeterLine.cpp b/Library/MeterLine.cpp index 4995f38b..d3dcd7fb 100644 --- a/Library/MeterLine.cpp +++ b/Library/MeterLine.cpp @@ -29,7 +29,7 @@ using namespace Gdiplus; ** The constructor ** */ -CMeterLine::CMeterLine(CMeterWindow* meterWindow) : CMeter(meterWindow), +CMeterLine::CMeterLine(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name), m_Autoscale(false), m_HorizontalLines(false), m_Flip(false), @@ -93,7 +93,7 @@ void CMeterLine::Initialize() ** Read the meter-specific configs from the ini-file. ** */ -void CMeterLine::ReadConfig(const WCHAR* section) +void CMeterLine::ReadConfig(CConfigParser& parser, const WCHAR* section) { WCHAR tmpName[64]; @@ -101,9 +101,7 @@ void CMeterLine::ReadConfig(const WCHAR* section) int oldLineCount = (int)m_Colors.size(); // Read common configs - CMeter::ReadConfig(section); - - CConfigParser& parser = m_MeterWindow->GetParser(); + CMeter::ReadConfig(parser, section); int lineCount = parser.ReadInt(section, L"LineCount", 1); diff --git a/Library/MeterLine.h b/Library/MeterLine.h index bbbd3e7c..cb223570 100644 --- a/Library/MeterLine.h +++ b/Library/MeterLine.h @@ -24,10 +24,10 @@ class CMeterLine : public CMeter { public: - CMeterLine(CMeterWindow* meterWindow); + CMeterLine(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeterLine(); - virtual void ReadConfig(const WCHAR* section); + virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); virtual void Initialize(); virtual bool Update(); virtual bool Draw(Gdiplus::Graphics& graphics); diff --git a/Library/MeterRotator.cpp b/Library/MeterRotator.cpp index ba4d6509..308cfe4b 100644 --- a/Library/MeterRotator.cpp +++ b/Library/MeterRotator.cpp @@ -33,7 +33,7 @@ extern CRainmeter* Rainmeter; ** The constructor ** */ -CMeterRotator::CMeterRotator(CMeterWindow* meterWindow) : CMeter(meterWindow), +CMeterRotator::CMeterRotator(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name), m_NeedsReload(false), m_OffsetX(), m_OffsetY(), @@ -81,15 +81,13 @@ void CMeterRotator::Initialize() ** Read the meter-specific configs from the ini-file. ** */ -void CMeterRotator::ReadConfig(const WCHAR* section) +void CMeterRotator::ReadConfig(CConfigParser& parser, const WCHAR* section) { // Store the current values so we know if the image needs to be updated std::wstring oldImageName = m_ImageName; // Read common configs - CMeter::ReadConfig(section); - - CConfigParser& parser = m_MeterWindow->GetParser(); + CMeter::ReadConfig(parser, section); m_ImageName = parser.ReadString(section, L"ImageName", L""); if (!m_ImageName.empty()) diff --git a/Library/MeterRotator.h b/Library/MeterRotator.h index 3c74f894..841159a8 100644 --- a/Library/MeterRotator.h +++ b/Library/MeterRotator.h @@ -25,10 +25,10 @@ class CMeterRotator : public CMeter { public: - CMeterRotator(CMeterWindow* meterWindow); + CMeterRotator(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeterRotator(); - virtual void ReadConfig(const WCHAR* section); + virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); virtual void Initialize(); virtual bool Update(); virtual bool Draw(Gdiplus::Graphics& graphics); diff --git a/Library/MeterRoundLine.cpp b/Library/MeterRoundLine.cpp index 966405b4..d66c997f 100644 --- a/Library/MeterRoundLine.cpp +++ b/Library/MeterRoundLine.cpp @@ -32,7 +32,7 @@ using namespace Gdiplus; ** The constructor ** */ -CMeterRoundLine::CMeterRoundLine(CMeterWindow* meterWindow) : CMeter(meterWindow), +CMeterRoundLine::CMeterRoundLine(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name), m_Solid(false), m_LineWidth(1.0), m_LineLength(20.0), @@ -66,12 +66,10 @@ CMeterRoundLine::~CMeterRoundLine() ** Read the meter-specific configs from the ini-file. ** */ -void CMeterRoundLine::ReadConfig(const WCHAR* section) +void CMeterRoundLine::ReadConfig(CConfigParser& parser, const WCHAR* section) { // Read common configs - CMeter::ReadConfig(section); - - CConfigParser& parser = m_MeterWindow->GetParser(); + CMeter::ReadConfig(parser, section); m_LineWidth = parser.ReadFloat(section, L"LineWidth", 1.0); m_LineLength = parser.ReadFloat(section, L"LineLength", 20.0); diff --git a/Library/MeterRoundLine.h b/Library/MeterRoundLine.h index 4d9c2a74..144065d9 100644 --- a/Library/MeterRoundLine.h +++ b/Library/MeterRoundLine.h @@ -24,10 +24,10 @@ class CMeterRoundLine : public CMeter { public: - CMeterRoundLine(CMeterWindow* meterWindow); + CMeterRoundLine(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeterRoundLine(); - virtual void ReadConfig(const WCHAR* section); + virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); virtual bool Update(); virtual bool Draw(Gdiplus::Graphics& graphics); diff --git a/Library/MeterString.cpp b/Library/MeterString.cpp index 076a68fc..8c021c79 100644 --- a/Library/MeterString.cpp +++ b/Library/MeterString.cpp @@ -66,7 +66,7 @@ void StringToProper(std::wstring& str) ** The constructor ** */ -CMeterString::CMeterString(CMeterWindow* meterWindow) : CMeter(meterWindow), +CMeterString::CMeterString(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name), m_Color(Color::White), m_EffectColor(Color::Black), m_AutoScale(AUTOSCALE_OFF), @@ -289,7 +289,7 @@ void CMeterString::Initialize() ** Read the meter-specific configs from the ini-file. ** */ -void CMeterString::ReadConfig(const WCHAR* section) +void CMeterString::ReadConfig(CConfigParser& parser, const WCHAR* section) { // Store the current font values so we know if the font needs to be updated std::wstring oldFontFace = m_FontFace; @@ -297,9 +297,7 @@ void CMeterString::ReadConfig(const WCHAR* section) TEXTSTYLE oldStyle = m_Style; // Read common configs - CMeter::ReadConfig(section); - - CConfigParser& parser = m_MeterWindow->GetParser(); + CMeter::ReadConfig(parser, section); // Check for extra measures if (!m_Initialized && !m_MeasureName.empty()) diff --git a/Library/MeterString.h b/Library/MeterString.h index eba32643..a424bb93 100644 --- a/Library/MeterString.h +++ b/Library/MeterString.h @@ -30,12 +30,12 @@ class Font; class CMeterString : public CMeter { public: - CMeterString(CMeterWindow* meterWindow); + CMeterString(CMeterWindow* meterWindow, const WCHAR* name); virtual ~CMeterString(); virtual int GetX(bool abs = false); - virtual void ReadConfig(const WCHAR* section); + virtual void ReadConfig(CConfigParser& parser, const WCHAR* section); virtual void Initialize(); virtual bool Update(); void SetText(const WCHAR* text) { m_Text = text; } diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 4f19c3cb..1f1159f4 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -1908,11 +1908,24 @@ bool CMeterWindow::ReadSkin() try { - measure = CMeasure::Create(measureName.c_str(), this); + measure = CMeasure::Create(measureName.c_str(), this, strSection.c_str()); if (measure) { - measure->SetName(strSection.c_str()); - measure->ReadConfig(m_Parser, strSection.c_str()); + measure->ReadConfig(m_Parser); + + m_Measures.push_back(measure); + m_Parser.AddMeasure(measure); + + if (!m_HasNetMeasures && dynamic_cast(measure)) + { + m_HasNetMeasures = true; + } + + CMeasureScript* measureScript = dynamic_cast(measure); + if(measureScript) + { + m_ScriptMeasures.push_back(measureScript); + } } } catch (CError& error) @@ -1921,24 +1934,6 @@ bool CMeterWindow::ReadSkin() measure = NULL; MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); } - - if (measure) - { - m_Measures.push_back(measure); - - m_Parser.AddMeasure(measure); - - if (!m_HasNetMeasures && dynamic_cast(measure)) - { - m_HasNetMeasures = true; - } - - CMeasureScript* measureScript = dynamic_cast(measure); - if(measureScript) - { - m_ScriptMeasures.push_back(measureScript); - } - } } else if (meterName.length() > 0) { @@ -1947,22 +1942,20 @@ bool CMeterWindow::ReadSkin() try { - meter = CMeter::Create(meterName.c_str(), this); + meter = CMeter::Create(meterName.c_str(), this, strSection.c_str()); if (meter) { - meter->SetName(strSection.c_str()); - - if (m_MouseActionCursor == false) - { - meter->SetMouseActionCursor(false); - } + meter->SetMouseActionCursor(m_MouseActionCursor); + meter->SetToolTipHidden(m_ToolTipHidden); - if (m_ToolTipHidden == true) - { - meter->SetToolTipHidden(true); - } + meter->ReadConfig(m_Parser); - meter->ReadConfig(strSection.c_str()); + m_Meters.push_back(meter); + + if (!m_HasButtons && dynamic_cast(meter)) + { + m_HasButtons = true; + } } } catch (CError& error) @@ -1971,18 +1964,6 @@ bool CMeterWindow::ReadSkin() meter = NULL; MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); } - - if (meter) - { - m_Meters.push_back(meter); - - m_Parser.ClearStyleTemplate(); - - if (!m_HasButtons && dynamic_cast(meter)) - { - m_HasButtons = true; - } - } } // If it's not a meter or measure it will be ignored } @@ -2494,7 +2475,7 @@ bool CMeterWindow::UpdateMeasure(CMeasure* measure, bool force) { try { - measure->ReadConfig(m_Parser, measure->GetName()); + measure->ReadConfig(m_Parser); } catch (CError& error) { @@ -2534,8 +2515,7 @@ bool CMeterWindow::UpdateMeter(CMeter* meter, bool& bActiveTransition, bool forc { try { - meter->ReadConfig(meter->GetName()); - m_Parser.ClearStyleTemplate(); + meter->ReadConfig(m_Parser); } catch (CError& error) { diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 300c5e01..a8be833a 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -4292,7 +4292,7 @@ void CRainmeter::ExpandEnvironmentVariables(std::wstring& strPath) { if (strPath.find(L'%') != std::wstring::npos) { - WCHAR bufSize = 4096; + DWORD bufSize = 4096; WCHAR* buffer = new WCHAR[bufSize]; // lets hope the buffer is large enough... // %APPDATA% is a special case diff --git a/Library/TrayWindow.cpp b/Library/TrayWindow.cpp index aaafaaeb..3b89a76b 100644 --- a/Library/TrayWindow.cpp +++ b/Library/TrayWindow.cpp @@ -289,11 +289,10 @@ void CTrayWindow::ReadConfig(CConfigParser& parser) try { - m_Measure = CMeasure::Create(measureName.c_str(), NULL); + m_Measure = CMeasure::Create(measureName.c_str(), NULL, L"TrayMeasure"); if (m_Measure) { - m_Measure->SetName(L"TrayMeasure"); - m_Measure->ReadConfig(parser, L"TrayMeasure"); + m_Measure->ReadConfig(parser); } } catch (CError& error)