mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Added OnChangeAction to measures
This commit is contained in:
parent
9800692f19
commit
90b80a2ca9
@ -86,7 +86,9 @@ CMeasure::CMeasure(CMeterWindow* meterWindow, const WCHAR* name) : CSection(name
|
||||
m_IfAboveCommitted(false),
|
||||
m_IfBelowCommitted(false),
|
||||
m_Disabled(false),
|
||||
m_Initialized(false)
|
||||
m_Initialized(false),
|
||||
m_OldValue(0.0),
|
||||
m_OldStringValue(L"")
|
||||
{
|
||||
}
|
||||
|
||||
@ -145,6 +147,7 @@ void CMeasure::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
||||
m_IfEqualAction = parser.ReadString(section, L"IfEqualAction", L"", false);
|
||||
|
||||
m_OnUpdateAction = parser.ReadString(section, L"OnUpdateAction", L"", false);
|
||||
m_OnChangeAction = parser.ReadString(section, L"OnChangeAction", L"", false);
|
||||
|
||||
m_AverageSize = parser.ReadUInt(section, L"AverageSize", 0);
|
||||
|
||||
|
@ -69,6 +69,12 @@ public:
|
||||
|
||||
std::wstring GetOnUpdateAction() { return m_OnUpdateAction; }
|
||||
|
||||
std::wstring GetOnChangeAction() { return m_OnChangeAction; }
|
||||
void SetOldValue(double value) { m_OldValue = value; }
|
||||
double GetOldValue() { return m_OldValue; }
|
||||
void SetOldStringValue(std::wstring value) { m_OldStringValue = value; }
|
||||
std::wstring GetOldStringValue() { return m_OldStringValue; }
|
||||
|
||||
CMeterWindow* GetMeterWindow() { return m_MeterWindow; }
|
||||
|
||||
static CMeasure* Create(const WCHAR* measure, CMeterWindow* meterWindow, const WCHAR* name);
|
||||
@ -114,6 +120,10 @@ protected:
|
||||
|
||||
std::wstring m_OnUpdateAction;
|
||||
|
||||
std::wstring m_OnChangeAction;
|
||||
double m_OldValue;
|
||||
std::wstring m_OldStringValue;
|
||||
|
||||
CMeterWindow* m_MeterWindow;
|
||||
};
|
||||
|
||||
|
@ -2689,6 +2689,17 @@ void CMeterWindow::Update(bool refresh)
|
||||
{
|
||||
Rainmeter->ExecuteCommand(updateAction.c_str(), this);
|
||||
}
|
||||
|
||||
double newValue = (*i)->GetValue();
|
||||
const WCHAR* newStringValue = (*i)->GetStringValue(AUTOSCALE_OFF, 1, -1, false);
|
||||
std::wstring changeAction = (*i)->GetOnChangeAction();
|
||||
|
||||
if (((*i)->GetOldValue() != newValue || (*i)->GetOldStringValue() != newStringValue) && !changeAction.empty())
|
||||
{
|
||||
(*i)->SetOldValue(newValue);
|
||||
(*i)->SetOldStringValue(newStringValue);
|
||||
Rainmeter->ExecuteCommand(changeAction.c_str(), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user