mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Add !PauseMeasure, !UnpauseMeasure, and !TogglePauseMeasure bangs. This is similar to a disabled measure, only it retains its value instead of changing to 0.
Also, group bangs !PauseMeasureGroup, !UnpauseMeasureGroup, and !TogglePauseMeasureGroup bangs have been added.
This commit is contained in:
parent
2507b4fe2c
commit
a883e9d47d
@ -67,6 +67,9 @@ const BangInfo s_Bangs[] =
|
||||
{ Bang::DisableMeasure, L"DisableMeasure", 1 },
|
||||
{ Bang::EnableMeasure, L"EnableMeasure", 1 },
|
||||
{ Bang::ToggleMeasure, L"ToggleMeasure", 1 },
|
||||
{ Bang::PauseMeasure, L"PauseMeasure", 1 },
|
||||
{ Bang::UnpauseMeasure, L"UnpauseMeasure", 1 },
|
||||
{ Bang::TogglePauseMeasure, L"TogglePauseMeasure", 1 },
|
||||
{ Bang::UpdateMeasure, L"UpdateMeasure", 1 },
|
||||
{ Bang::CommandMeasure, L"CommandMeasure", 2 },
|
||||
{ Bang::PluginBang, L"PluginBang", 1 },
|
||||
@ -94,6 +97,9 @@ const BangInfo s_Bangs[] =
|
||||
{ Bang::DisableMeasureGroup, L"DisableMeasureGroup", 1 },
|
||||
{ Bang::EnableMeasureGroup, L"EnableMeasureGroup", 1 },
|
||||
{ Bang::ToggleMeasureGroup, L"ToggleMeasureGroup", 1 },
|
||||
{ Bang::PauseMeasureGroup, L"PauseMeasureGroup", 1 },
|
||||
{ Bang::UnpauseMeasureGroup, L"UnpauseMeasureGroup", 1 },
|
||||
{ Bang::TogglePauseMeasureGroup, L"TogglePauseMeasureGroup", 1 },
|
||||
{ Bang::UpdateMeasureGroup, L"UpdateMeasureGroup", 1 }
|
||||
};
|
||||
|
||||
|
@ -46,6 +46,9 @@ enum class Bang
|
||||
DisableMeasure,
|
||||
EnableMeasure,
|
||||
ToggleMeasure,
|
||||
PauseMeasure,
|
||||
UnpauseMeasure,
|
||||
TogglePauseMeasure,
|
||||
UpdateMeasure,
|
||||
CommandMeasure,
|
||||
PluginBang,
|
||||
@ -83,6 +86,9 @@ enum class Bang
|
||||
DisableMeasureGroup,
|
||||
EnableMeasureGroup,
|
||||
ToggleMeasureGroup,
|
||||
PauseMeasureGroup,
|
||||
UnpauseMeasureGroup,
|
||||
TogglePauseMeasureGroup,
|
||||
UpdateMeasureGroup,
|
||||
DeactivateConfigGroup,
|
||||
ZPosGroup,
|
||||
|
@ -84,6 +84,7 @@ Measure::Measure(MeterWindow* meterWindow, const WCHAR* name) : Section(meterWin
|
||||
m_IfAboveCommitted(false),
|
||||
m_IfBelowCommitted(false),
|
||||
m_Disabled(false),
|
||||
m_Paused(false),
|
||||
m_Initialized(false),
|
||||
m_OldValue(),
|
||||
m_ValueAssigned(false)
|
||||
@ -435,6 +436,9 @@ std::wstring Measure::ExtractWord(std::wstring& buffer)
|
||||
|
||||
bool Measure::Update()
|
||||
{
|
||||
// Don't do anything if paused
|
||||
if (m_Paused) return false;
|
||||
|
||||
if (!m_Disabled)
|
||||
{
|
||||
// Only update the counter if the divider
|
||||
|
@ -66,6 +66,10 @@ public:
|
||||
void Enable();
|
||||
bool IsDisabled() { return m_Disabled; }
|
||||
|
||||
void Pause() { m_Paused = true; }
|
||||
void Unpause() { m_Paused = false; }
|
||||
bool IsPaused() { return m_Paused; }
|
||||
|
||||
virtual void Command(const std::wstring& command);
|
||||
|
||||
double GetValue();
|
||||
@ -123,6 +127,7 @@ protected:
|
||||
bool m_IfAboveCommitted; // True when the IfAbove action is executed
|
||||
bool m_IfBelowCommitted; // True when the IfBelow action is executed
|
||||
bool m_Disabled; // Status of the measure
|
||||
bool m_Paused;
|
||||
bool m_Initialized;
|
||||
|
||||
std::wstring m_OnChangeAction;
|
||||
|
@ -790,6 +790,18 @@ void MeterWindow::DoBang(Bang bang, const std::vector<std::wstring>& args)
|
||||
DisableMeasure(args[0]);
|
||||
break;
|
||||
|
||||
case Bang::PauseMeasure:
|
||||
PauseMeasure(args[0]);
|
||||
break;
|
||||
|
||||
case Bang::UnpauseMeasure:
|
||||
UnpauseMeasure(args[0]);
|
||||
break;
|
||||
|
||||
case Bang::TogglePauseMeasure:
|
||||
TogglePauseMeasure(args[0]);
|
||||
break;
|
||||
|
||||
case Bang::UpdateMeasure:
|
||||
UpdateMeasure(args[0]);
|
||||
DialogAbout::UpdateMeasures(this);
|
||||
@ -807,6 +819,18 @@ void MeterWindow::DoBang(Bang bang, const std::vector<std::wstring>& args)
|
||||
EnableMeasure(args[0], true);
|
||||
break;
|
||||
|
||||
case Bang::PauseMeasureGroup:
|
||||
PauseMeasure(args[0], true);
|
||||
break;
|
||||
|
||||
case Bang::UnpauseMeasureGroup:
|
||||
UnpauseMeasure(args[0], true);
|
||||
break;
|
||||
|
||||
case Bang::TogglePauseMeasureGroup:
|
||||
TogglePauseMeasure(args[0], true);
|
||||
break;
|
||||
|
||||
case Bang::UpdateMeasureGroup:
|
||||
UpdateMeasure(args[0], true);
|
||||
DialogAbout::UpdateMeasures(this);
|
||||
@ -1320,6 +1344,76 @@ void MeterWindow::ToggleMeasure(const std::wstring& name, bool group)
|
||||
if (!group) LogErrorF(this, L"!ToggleMeasure: [%s] not found", measure);
|
||||
}
|
||||
|
||||
/*
|
||||
** Pauses the given measure
|
||||
**
|
||||
*/
|
||||
void MeterWindow::PauseMeasure(const std::wstring& name, bool group)
|
||||
{
|
||||
const WCHAR* measure = name.c_str();
|
||||
|
||||
std::vector<Measure*>::const_iterator i = m_Measures.begin();
|
||||
for ( ; i != m_Measures.end(); ++i)
|
||||
{
|
||||
if (CompareName((*i), measure, group))
|
||||
{
|
||||
(*i)->Pause();
|
||||
if (!group) return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!group) LogErrorF(this, L"!PauseMeasure: [%s] not found", measure);
|
||||
}
|
||||
|
||||
/*
|
||||
** Unpauses the given measure
|
||||
**
|
||||
*/
|
||||
void MeterWindow::UnpauseMeasure(const std::wstring& name, bool group)
|
||||
{
|
||||
const WCHAR* measure = name.c_str();
|
||||
|
||||
std::vector<Measure*>::const_iterator i = m_Measures.begin();
|
||||
for ( ; i != m_Measures.end(); ++i)
|
||||
{
|
||||
if (CompareName((*i), measure, group))
|
||||
{
|
||||
(*i)->Unpause();
|
||||
if (!group) return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!group) LogErrorF(this, L"!UnpauseMeasure: [%s] not found", measure);
|
||||
}
|
||||
|
||||
/*
|
||||
** Toggles the pause state of the given measure
|
||||
**
|
||||
*/
|
||||
void MeterWindow::TogglePauseMeasure(const std::wstring& name, bool group)
|
||||
{
|
||||
const WCHAR* measure = name.c_str();
|
||||
|
||||
std::vector<Measure*>::const_iterator i = m_Measures.begin();
|
||||
for ( ; i != m_Measures.end(); ++i)
|
||||
{
|
||||
if (CompareName((*i), measure, group))
|
||||
{
|
||||
if ((*i)->IsPaused())
|
||||
{
|
||||
(*i)->Unpause();
|
||||
}
|
||||
else
|
||||
{
|
||||
(*i)->Pause();
|
||||
}
|
||||
if (!group) return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!group) LogErrorF(this, L"!TogglePauseMeasure: [%s] not found", measure);
|
||||
}
|
||||
|
||||
/*
|
||||
** Updates the given measure
|
||||
**
|
||||
|
@ -127,6 +127,9 @@ public:
|
||||
void DisableMeasure(const std::wstring& name, bool group = false);
|
||||
void EnableMeasure(const std::wstring& name, bool group = false);
|
||||
void ToggleMeasure(const std::wstring& name, bool group = false);
|
||||
void PauseMeasure(const std::wstring& name, bool group = false);
|
||||
void UnpauseMeasure(const std::wstring& name, bool group = false);
|
||||
void TogglePauseMeasure(const std::wstring& name, bool group = false);
|
||||
void UpdateMeasure(const std::wstring& name, bool group = false);
|
||||
void Deactivate();
|
||||
void Refresh(bool init, bool all = false);
|
||||
|
Loading…
Reference in New Issue
Block a user