mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Added OnUpdateAction to measures, meters and the [Rainmeter] section.
This commit is contained in:
parent
24e080dfc0
commit
9800692f19
@ -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);
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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 =
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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<CMeasure*>::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);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user