diff --git a/Library/Measure.cpp b/Library/Measure.cpp index 94532724..fbe9caf6 100644 --- a/Library/Measure.cpp +++ b/Library/Measure.cpp @@ -144,6 +144,8 @@ void CMeasure::ReadOptions(CConfigParser& parser, const WCHAR* section) m_IfEqualValue = (int64_t)parser.ReadFloat(section, L"IfEqualValue", 0.0); m_IfEqualAction = parser.ReadString(section, L"IfEqualAction", L"", false); + m_OnUpdateAction = parser.ReadString(section, L"OnUpdateAction", L"", false); + m_AverageSize = parser.ReadUInt(section, L"AverageSize", 0); m_DynamicVariables = 0!=parser.ReadInt(section, L"DynamicVariables", 0); diff --git a/Library/Measure.h b/Library/Measure.h index db6edc86..ca2cedbe 100644 --- a/Library/Measure.h +++ b/Library/Measure.h @@ -67,6 +67,8 @@ public: static void GetScaledValue(AUTOSCALE autoScale, int decimals, double theValue, WCHAR* buffer, size_t sizeInWords); static void RemoveTrailingZero(WCHAR* str, int strLen); + std::wstring GetOnUpdateAction() { return m_OnUpdateAction; } + CMeterWindow* GetMeterWindow() { return m_MeterWindow; } static CMeasure* Create(const WCHAR* measure, CMeterWindow* meterWindow, const WCHAR* name); @@ -110,6 +112,8 @@ protected: bool m_Disabled; // Status of the measure bool m_Initialized; + std::wstring m_OnUpdateAction; + CMeterWindow* m_MeterWindow; }; diff --git a/Library/Meter.cpp b/Library/Meter.cpp index fb5fa4d8..217ecc6a 100644 --- a/Library/Meter.cpp +++ b/Library/Meter.cpp @@ -320,6 +320,8 @@ void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section) m_SolidColor2 = parser.ReadColor(section, L"SolidColor2", m_SolidColor.GetValue()); m_SolidAngle = (Gdiplus::REAL)parser.ReadFloat(section, L"GradientAngle", 0.0); + m_OnUpdateAction = parser.ReadString(section, L"OnUpdateAction", L"", false); + m_Mouse.ReadOptions(parser, section, m_MeterWindow); m_HasMouseAction = diff --git a/Library/Meter.h b/Library/Meter.h index 97657ca2..ad788a51 100644 --- a/Library/Meter.h +++ b/Library/Meter.h @@ -76,6 +76,8 @@ public: void SetMouseOver(bool over) { m_MouseOver = over; } bool IsMouseOver() { return m_MouseOver; } + std::wstring GetOnUpdateAction() { return m_OnUpdateAction; } + CMeterWindow* GetMeterWindow() { return m_MeterWindow; } static CMeter* Create(const WCHAR* meter, CMeterWindow* meterWindow, const WCHAR* name); @@ -151,6 +153,8 @@ protected: bool m_AntiAlias; bool m_Initialized; + std::wstring m_OnUpdateAction; + CMeterWindow* m_MeterWindow; }; diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 511dce00..a2549e27 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2040,6 +2040,7 @@ bool CMeterWindow::ReadSkin() m_OnCloseAction = m_Parser.ReadString(L"Rainmeter", L"OnCloseAction", L"", false); m_OnFocusAction = m_Parser.ReadString(L"Rainmeter", L"OnFocusAction", L"", false); m_OnUnfocusAction = m_Parser.ReadString(L"Rainmeter", L"OnUnfocusAction", L"", false); + m_OnUpdateAction = m_Parser.ReadString(L"Rainmeter", L"OnUpdateAction", L"", false); m_WindowUpdate = m_Parser.ReadInt(L"Rainmeter", L"Update", INTERVAL_METER); m_TransitionUpdate = m_Parser.ReadInt(L"Rainmeter", L"TransitionUpdate", INTERVAL_TRANSITION); @@ -2681,7 +2682,14 @@ void CMeterWindow::Update(bool refresh) std::vector::const_iterator i = m_Measures.begin(); for ( ; i != m_Measures.end(); ++i) { - UpdateMeasure((*i), refresh); + if (UpdateMeasure((*i), refresh)) + { + std::wstring updateAction = (*i)->GetOnUpdateAction(); + if (!updateAction.empty()) + { + Rainmeter->ExecuteCommand(updateAction.c_str(), this); + } + } } } @@ -2696,6 +2704,12 @@ void CMeterWindow::Update(bool refresh) if (UpdateMeter((*j), bActiveTransition, refresh)) { bUpdate = true; + + std::wstring updateAction = (*j)->GetOnUpdateAction(); + if (!updateAction.empty()) + { + Rainmeter->ExecuteCommand(updateAction.c_str(), this); + } } } @@ -2718,6 +2732,11 @@ void CMeterWindow::Update(bool refresh) // Post-updates PostUpdate(bActiveTransition); + + if (!m_OnUpdateAction.empty()) + { + Rainmeter->ExecuteCommand(m_OnUpdateAction.c_str(), this); + } } /* diff --git a/Library/MeterWindow.h b/Library/MeterWindow.h index 8039629e..cf242f38 100644 --- a/Library/MeterWindow.h +++ b/Library/MeterWindow.h @@ -371,6 +371,7 @@ private: std::wstring m_OnCloseAction; std::wstring m_OnFocusAction; std::wstring m_OnUnfocusAction; + std::wstring m_OnUpdateAction; std::wstring m_BackgroundName; RECT m_BackgroundMargins;