mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
- Added !RainmeterUpdate/!RainmeterUpdateMeter(Group)/!RainmeterUpdateMeasure(Group).
- Changed Update= and UpdateDivider= behaviors. If you specify < 0 to them, measures/meters are not updated automatically.
This commit is contained in:
parent
c9c477868f
commit
2fafb5dcdc
@ -122,7 +122,7 @@ void CMeasure::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
||||
}
|
||||
}
|
||||
|
||||
UINT updateDivider = parser.ReadInt(section, L"UpdateDivider", 1);
|
||||
int updateDivider = parser.ReadInt(section, L"UpdateDivider", 1);
|
||||
if (updateDivider != m_UpdateDivider)
|
||||
{
|
||||
m_UpdateCounter = m_UpdateDivider = updateDivider;
|
||||
|
@ -55,8 +55,9 @@ public:
|
||||
double GetMinValue() { return m_MinValue; }
|
||||
double GetMaxValue() { return m_MaxValue; }
|
||||
|
||||
UINT GetUpdateCounter() { return m_UpdateCounter; }
|
||||
UINT GetUpdateDivider() { return m_UpdateDivider; }
|
||||
void ResetUpdateCounter() { m_UpdateCounter = m_UpdateDivider; }
|
||||
int GetUpdateCounter() { return m_UpdateCounter; }
|
||||
int GetUpdateDivider() { return m_UpdateDivider; }
|
||||
|
||||
virtual const WCHAR* GetStringValue(bool autoScale, double scale, int decimals, bool percentual);
|
||||
static void GetScaledValue(int decimals, double theValue, WCHAR* buffer, size_t sizeInWords);
|
||||
@ -100,8 +101,8 @@ protected:
|
||||
bool m_IfAboveCommited; // True when the IfAbove action is executed.
|
||||
bool m_IfBelowCommited; // True when the IfBelow action is executed.
|
||||
bool m_Disabled; // Status of the measure
|
||||
UINT m_UpdateDivider; // Divider for the update
|
||||
UINT m_UpdateCounter; // Current update counter
|
||||
int m_UpdateDivider; // Divider for the update
|
||||
int m_UpdateCounter; // Current update counter
|
||||
bool m_Initialized;
|
||||
|
||||
CMeterWindow* m_MeterWindow;
|
||||
|
@ -412,7 +412,7 @@ void CMeter::ReadConfig(const WCHAR* section)
|
||||
m_ToolTipType = 0!=parser.ReadInt(section, L"ToolTipType", 0);
|
||||
m_ToolTipHidden = 0!=parser.ReadInt(section, L"ToolTipHidden", m_ToolTipHidden);
|
||||
|
||||
UINT updateDivider = parser.ReadInt(section, L"UpdateDivider", 1);
|
||||
int updateDivider = parser.ReadInt(section, L"UpdateDivider", 1);
|
||||
if (updateDivider != m_UpdateDivider)
|
||||
{
|
||||
m_UpdateCounter = m_UpdateDivider = updateDivider;
|
||||
|
@ -91,8 +91,9 @@ public:
|
||||
void SetName(const WCHAR* name) { m_Name = name; }
|
||||
const WCHAR* GetName() { return m_Name.c_str(); }
|
||||
|
||||
UINT GetUpdateCounter() { return m_UpdateCounter; }
|
||||
UINT GetUpdateDivider() { return m_UpdateDivider; }
|
||||
void ResetUpdateCounter() { m_UpdateCounter = m_UpdateDivider; }
|
||||
int GetUpdateCounter() { return m_UpdateCounter; }
|
||||
int GetUpdateDivider() { return m_UpdateDivider; }
|
||||
|
||||
static CMeter* Create(const WCHAR* meter, CMeterWindow* meterWindow);
|
||||
|
||||
@ -167,8 +168,8 @@ protected:
|
||||
METER_POSITION m_RelativeX;
|
||||
METER_POSITION m_RelativeY;
|
||||
|
||||
UINT m_UpdateDivider; // Divider for the update
|
||||
UINT m_UpdateCounter; // Current update counter
|
||||
int m_UpdateDivider; // Divider for the update
|
||||
int m_UpdateCounter; // Current update counter
|
||||
|
||||
BEVELTYPE m_SolidBevel;
|
||||
Gdiplus::Color m_SolidColor;
|
||||
|
@ -389,10 +389,13 @@ void CMeterWindow::Refresh(bool init, bool all)
|
||||
ScreenToWindow();
|
||||
|
||||
// Start the timers
|
||||
if (m_WindowUpdate >= 0)
|
||||
{
|
||||
if(0 == SetTimer(m_Window, METERTIMER, m_WindowUpdate, NULL))
|
||||
{
|
||||
throw CError(L"Unable to create a timer!", __LINE__, __FILE__);
|
||||
}
|
||||
}
|
||||
|
||||
if(0 == SetTimer(m_Window, MOUSETIMER, 500, NULL)) // Mouse position is checked twice per sec
|
||||
{
|
||||
@ -655,6 +658,16 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
||||
Redraw();
|
||||
break;
|
||||
|
||||
case BANG_UPDATE:
|
||||
KillTimer(m_Window, METERTIMER); // Kill timer temporarily
|
||||
Update(false);
|
||||
UpdateAboutStatistics(m_SkinName.c_str());
|
||||
if (m_WindowUpdate >= 0)
|
||||
{
|
||||
SetTimer(m_Window, METERTIMER, m_WindowUpdate, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case BANG_TOGGLEMETER:
|
||||
ToggleMeter(arg);
|
||||
break;
|
||||
@ -667,6 +680,10 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
||||
HideMeter(arg);
|
||||
break;
|
||||
|
||||
case BANG_UPDATEMETER:
|
||||
UpdateMeter(arg);
|
||||
break;
|
||||
|
||||
case BANG_TOGGLEMETERGROUP:
|
||||
ToggleMeter(arg, true);
|
||||
break;
|
||||
@ -679,6 +696,10 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
||||
HideMeter(arg, true);
|
||||
break;
|
||||
|
||||
case BANG_UPDATEMETERGROUP:
|
||||
UpdateMeter(arg, true);
|
||||
break;
|
||||
|
||||
case BANG_TOGGLEMEASURE:
|
||||
ToggleMeasure(arg);
|
||||
break;
|
||||
@ -687,6 +708,15 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
||||
EnableMeasure(arg);
|
||||
break;
|
||||
|
||||
case BANG_DISABLEMEASURE:
|
||||
DisableMeasure(arg);
|
||||
break;
|
||||
|
||||
case BANG_UPDATEMEASURE:
|
||||
UpdateMeasure(arg);
|
||||
UpdateAboutStatistics(m_SkinName.c_str());
|
||||
break;
|
||||
|
||||
case BANG_DISABLEMEASUREGROUP:
|
||||
DisableMeasure(arg, true);
|
||||
break;
|
||||
@ -699,8 +729,9 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
||||
EnableMeasure(arg, true);
|
||||
break;
|
||||
|
||||
case BANG_DISABLEMEASURE:
|
||||
DisableMeasure(arg);
|
||||
case BANG_UPDATEMEASUREGROUP:
|
||||
UpdateMeasure(arg, true);
|
||||
UpdateAboutStatistics(m_SkinName.c_str());
|
||||
break;
|
||||
|
||||
case BANG_SHOW:
|
||||
@ -961,6 +992,18 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** CompareName
|
||||
**
|
||||
** This is a helper template that compares the given name to measure/meter's name.
|
||||
**
|
||||
*/
|
||||
template <class T>
|
||||
bool CompareName(T* m, const WCHAR* name, bool group)
|
||||
{
|
||||
return (group) ? m->BelongsToGroup(name) : (_wcsicmp(m->GetName(), name) == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
** ShowMeter
|
||||
**
|
||||
@ -974,19 +1017,13 @@ void CMeterWindow::ShowMeter(const WCHAR* name, bool group)
|
||||
std::list<CMeter*>::const_iterator j = m_Meters.begin();
|
||||
for( ; j != m_Meters.end(); ++j)
|
||||
{
|
||||
if (group)
|
||||
if (CompareName((*j), name, group))
|
||||
{
|
||||
if (!(*j)->BelongsToGroup(name)) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_wcsicmp((*j)->GetName(), name) != 0) continue;
|
||||
}
|
||||
|
||||
(*j)->Show();
|
||||
m_ResetRegion = true; // Need to recalculate the window region
|
||||
if (!group) return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to show the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
@ -1004,19 +1041,13 @@ void CMeterWindow::HideMeter(const WCHAR* name, bool group)
|
||||
std::list<CMeter*>::const_iterator j = m_Meters.begin();
|
||||
for( ; j != m_Meters.end(); ++j)
|
||||
{
|
||||
if (group)
|
||||
if (CompareName((*j), name, group))
|
||||
{
|
||||
if (!(*j)->BelongsToGroup(name)) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_wcsicmp((*j)->GetName(), name) != 0) continue;
|
||||
}
|
||||
|
||||
(*j)->Hide();
|
||||
m_ResetRegion = true; // Need to recalculate the windowregion
|
||||
if (!group) return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to hide the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
@ -1034,15 +1065,8 @@ void CMeterWindow::ToggleMeter(const WCHAR* name, bool group)
|
||||
std::list<CMeter*>::const_iterator j = m_Meters.begin();
|
||||
for( ; j != m_Meters.end(); ++j)
|
||||
{
|
||||
if (group)
|
||||
if (CompareName((*j), name, group))
|
||||
{
|
||||
if (!(*j)->BelongsToGroup(name)) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_wcsicmp((*j)->GetName(), name) != 0) continue;
|
||||
}
|
||||
|
||||
if ((*j)->IsHidden())
|
||||
{
|
||||
(*j)->Show();
|
||||
@ -1054,6 +1078,7 @@ void CMeterWindow::ToggleMeter(const WCHAR* name, bool group)
|
||||
m_ResetRegion = true; // Need to recalculate the window region
|
||||
if (!group) return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to toggle the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
@ -1071,11 +1096,11 @@ void CMeterWindow::MoveMeter(int x, int y, const WCHAR* name)
|
||||
std::list<CMeter*>::const_iterator j = m_Meters.begin();
|
||||
for( ; j != m_Meters.end(); ++j)
|
||||
{
|
||||
if (_wcsicmp((*j)->GetName(), name) == 0)
|
||||
if (CompareName((*j), name, false))
|
||||
{
|
||||
(*j)->SetX(x);
|
||||
(*j)->SetY(y);
|
||||
m_ResetRegion = true;
|
||||
m_ResetRegion = true; // Need to recalculate the window region
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1083,6 +1108,48 @@ void CMeterWindow::MoveMeter(int x, int y, const WCHAR* name)
|
||||
LogWithArgs(LOG_NOTICE, L"Unable to move the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
** UpdateMeter
|
||||
**
|
||||
** Updates the given meter
|
||||
**
|
||||
*/
|
||||
void CMeterWindow::UpdateMeter(const WCHAR* name, bool group)
|
||||
{
|
||||
if (name == NULL || *name == 0) return;
|
||||
|
||||
bool bActiveTransition = false;
|
||||
bool bContinue = true;
|
||||
std::list<CMeter*>::const_iterator j = m_Meters.begin();
|
||||
for( ; j != m_Meters.end(); ++j)
|
||||
{
|
||||
if (bContinue && CompareName((*j), name, group))
|
||||
{
|
||||
UpdateMeter((*j), bActiveTransition, true);
|
||||
m_ResetRegion = true; // Need to recalculate the windowregion
|
||||
if (!group)
|
||||
{
|
||||
bContinue = false;
|
||||
if (bActiveTransition) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check for transitions
|
||||
if (!bActiveTransition && (*j)->HasActiveTransition())
|
||||
{
|
||||
bActiveTransition = true;
|
||||
if (!group && !bContinue) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Post-updates
|
||||
PostUpdate(bActiveTransition);
|
||||
|
||||
if (!group && bContinue) LogWithArgs(LOG_NOTICE, L"Unable to update the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
** EnableMeasure
|
||||
**
|
||||
@ -1096,23 +1163,16 @@ void CMeterWindow::EnableMeasure(const WCHAR* name, bool group)
|
||||
std::list<CMeasure*>::const_iterator i = m_Measures.begin();
|
||||
for( ; i != m_Measures.end(); ++i)
|
||||
{
|
||||
if (group)
|
||||
if (CompareName((*i), name, group))
|
||||
{
|
||||
if (!(*i)->BelongsToGroup(name)) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_wcsicmp((*i)->GetName(), name) != 0) continue;
|
||||
}
|
||||
|
||||
(*i)->Enable();
|
||||
if (!group) return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to enable the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** DisableMeasure
|
||||
**
|
||||
@ -1126,23 +1186,16 @@ void CMeterWindow::DisableMeasure(const WCHAR* name, bool group)
|
||||
std::list<CMeasure*>::const_iterator i = m_Measures.begin();
|
||||
for( ; i != m_Measures.end(); ++i)
|
||||
{
|
||||
if (group)
|
||||
if (CompareName((*i), name, group))
|
||||
{
|
||||
if (!(*i)->BelongsToGroup(name)) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_wcsicmp((*i)->GetName(), name) != 0) continue;
|
||||
}
|
||||
|
||||
(*i)->Disable();
|
||||
if (!group) return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to disable the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** ToggleMeasure
|
||||
**
|
||||
@ -1156,15 +1209,8 @@ void CMeterWindow::ToggleMeasure(const WCHAR* name, bool group)
|
||||
std::list<CMeasure*>::const_iterator i = m_Measures.begin();
|
||||
for( ; i != m_Measures.end(); ++i)
|
||||
{
|
||||
if (group)
|
||||
if (CompareName((*i), name, group))
|
||||
{
|
||||
if (!(*i)->BelongsToGroup(name)) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_wcsicmp((*i)->GetName(), name) != 0) continue;
|
||||
}
|
||||
|
||||
if ((*i)->IsDisabled())
|
||||
{
|
||||
(*i)->Enable();
|
||||
@ -1175,10 +1221,47 @@ void CMeterWindow::ToggleMeasure(const WCHAR* name, bool group)
|
||||
}
|
||||
if (!group) return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to toggle the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
** UpdateMeasure
|
||||
**
|
||||
** Updates the given measure
|
||||
**
|
||||
*/
|
||||
void CMeterWindow::UpdateMeasure(const WCHAR* name, bool group)
|
||||
{
|
||||
if (name == NULL || *name == 0) return;
|
||||
|
||||
// Pre-updates
|
||||
if (!m_Measures.empty())
|
||||
{
|
||||
CMeasureCalc::UpdateVariableMap(*this);
|
||||
}
|
||||
|
||||
bool bNetStats = m_HasNetMeasures;
|
||||
std::list<CMeasure*>::const_iterator i = m_Measures.begin();
|
||||
for( ; i != m_Measures.end(); ++i)
|
||||
{
|
||||
if (CompareName((*i), name, group))
|
||||
{
|
||||
if (bNetStats && dynamic_cast<CMeasureNet*>(*i) != NULL)
|
||||
{
|
||||
CMeasureNet::UpdateIFTable();
|
||||
bNetStats = false;
|
||||
}
|
||||
|
||||
UpdateMeasure((*i), true);
|
||||
if (!group) return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to update the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
|
||||
/* WindowToScreen
|
||||
**
|
||||
** Calculates the screen cordinates from the WindowX/Y config
|
||||
@ -2429,6 +2512,127 @@ void CMeterWindow::Redraw()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** PostUpdate
|
||||
**
|
||||
** Updates the transition state
|
||||
**
|
||||
*/
|
||||
void CMeterWindow::PostUpdate(bool bActiveTransition)
|
||||
{
|
||||
// Start/stop the transition timer if necessary
|
||||
if (bActiveTransition && !m_ActiveTransition)
|
||||
{
|
||||
SetTimer(m_Window, TRANSITIONTIMER, m_TransitionUpdate, NULL);
|
||||
m_ActiveTransition = true;
|
||||
}
|
||||
else if (m_ActiveTransition && !bActiveTransition)
|
||||
{
|
||||
KillTimer(m_Window, TRANSITIONTIMER);
|
||||
m_ActiveTransition = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** UpdateMeasure
|
||||
**
|
||||
** Updates the given measure
|
||||
**
|
||||
*/
|
||||
bool CMeterWindow::UpdateMeasure(CMeasure* measure, bool force)
|
||||
{
|
||||
bool bUpdate = false;
|
||||
|
||||
if (force)
|
||||
{
|
||||
measure->ResetUpdateCounter();
|
||||
}
|
||||
|
||||
int updateDivider = measure->GetUpdateDivider();
|
||||
if (updateDivider >= 0 || force || m_Refreshing)
|
||||
{
|
||||
if (measure->HasDynamicVariables() &&
|
||||
(measure->GetUpdateCounter() + 1) >= updateDivider)
|
||||
{
|
||||
try
|
||||
{
|
||||
measure->ReadConfig(m_Parser, measure->GetName());
|
||||
}
|
||||
catch (CError& error)
|
||||
{
|
||||
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||
}
|
||||
}
|
||||
|
||||
if (measure->Update())
|
||||
{
|
||||
bUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
return bUpdate;
|
||||
}
|
||||
|
||||
/*
|
||||
** UpdateMeter
|
||||
**
|
||||
** Updates the given meter
|
||||
**
|
||||
*/
|
||||
bool CMeterWindow::UpdateMeter(CMeter* meter, bool& bActiveTransition, bool force)
|
||||
{
|
||||
bool bUpdate = false;
|
||||
|
||||
if (force)
|
||||
{
|
||||
meter->ResetUpdateCounter();
|
||||
}
|
||||
|
||||
int updateDivider = meter->GetUpdateDivider();
|
||||
if (updateDivider >= 0 || force || m_Refreshing)
|
||||
{
|
||||
if (meter->HasDynamicVariables() &&
|
||||
(meter->GetUpdateCounter() + 1) >= updateDivider)
|
||||
{
|
||||
try
|
||||
{
|
||||
meter->ReadConfig(meter->GetName());
|
||||
m_Parser.ClearStyleTemplate();
|
||||
}
|
||||
catch (CError& error)
|
||||
{
|
||||
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||
}
|
||||
}
|
||||
|
||||
if (meter->Update())
|
||||
{
|
||||
bUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Update tooltips
|
||||
if (!meter->HasToolTip())
|
||||
{
|
||||
if (!meter->GetToolTipText().empty())
|
||||
{
|
||||
meter->CreateToolTip(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
meter->UpdateToolTip();
|
||||
}
|
||||
|
||||
// Check for transitions
|
||||
if (!bActiveTransition && meter->HasActiveTransition())
|
||||
{
|
||||
bActiveTransition = true;
|
||||
}
|
||||
|
||||
return bUpdate;
|
||||
}
|
||||
|
||||
/*
|
||||
** Update
|
||||
**
|
||||
@ -2440,73 +2644,32 @@ void CMeterWindow::Update(bool nodraw)
|
||||
++m_UpdateCounter;
|
||||
|
||||
// Pre-updates
|
||||
if (!m_Measures.empty())
|
||||
{
|
||||
if (m_HasNetMeasures) CMeasureNet::UpdateIFTable();
|
||||
CMeasureCalc::UpdateVariableMap(*this);
|
||||
}
|
||||
|
||||
// Update all measures
|
||||
std::list<CMeasure*>::const_iterator i = m_Measures.begin();
|
||||
for( ; i != m_Measures.end(); ++i)
|
||||
{
|
||||
if ((*i)->HasDynamicVariables() &&
|
||||
((*i)->GetUpdateCounter() + 1) >= (*i)->GetUpdateDivider())
|
||||
{
|
||||
try
|
||||
{
|
||||
(*i)->ReadConfig(m_Parser, (*i)->GetName());
|
||||
}
|
||||
catch (CError& error)
|
||||
{
|
||||
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||
}
|
||||
}
|
||||
(*i)->Update();
|
||||
UpdateMeasure((*i), false);
|
||||
}
|
||||
|
||||
// Update the meters
|
||||
// Update all meters
|
||||
bool bActiveTransition = false;
|
||||
bool bUpdate = false;
|
||||
std::list<CMeter*>::const_iterator j = m_Meters.begin();
|
||||
for( ; j != m_Meters.end(); ++j)
|
||||
{
|
||||
if ((*j)->HasDynamicVariables() &&
|
||||
((*j)->GetUpdateCounter() + 1) >= (*j)->GetUpdateDivider())
|
||||
{
|
||||
try
|
||||
{
|
||||
(*j)->ReadConfig((*j)->GetName());
|
||||
m_Parser.ClearStyleTemplate();
|
||||
}
|
||||
catch (CError& error)
|
||||
{
|
||||
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||
}
|
||||
}
|
||||
|
||||
if ((*j)->Update())
|
||||
if (UpdateMeter((*j), bActiveTransition, false))
|
||||
{
|
||||
bUpdate = true;
|
||||
}
|
||||
|
||||
// Update tooltips
|
||||
if (!(*j)->HasToolTip())
|
||||
{
|
||||
if (!(*j)->GetToolTipText().empty())
|
||||
{
|
||||
(*j)->CreateToolTip(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
(*j)->UpdateToolTip();
|
||||
}
|
||||
|
||||
// Check for transitions and start the timer if necessary
|
||||
if (!bActiveTransition && (*j)->HasActiveTransition())
|
||||
{
|
||||
bActiveTransition = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Redraw all meters
|
||||
if (!nodraw && (bUpdate || m_ResetRegion || m_Refreshing))
|
||||
{
|
||||
if (m_DynamicWindowSize)
|
||||
@ -2523,16 +2686,8 @@ void CMeterWindow::Update(bool nodraw)
|
||||
}
|
||||
}
|
||||
|
||||
// Start/stop the transition timer if necessary
|
||||
if (!m_ActiveTransition && bActiveTransition)
|
||||
{
|
||||
SetTimer(m_Window, TRANSITIONTIMER, m_TransitionUpdate, NULL);
|
||||
m_ActiveTransition = true;
|
||||
}
|
||||
else if (m_ActiveTransition && !bActiveTransition)
|
||||
{
|
||||
KillTimer(m_Window, TRANSITIONTIMER);
|
||||
}
|
||||
// Post-updates
|
||||
PostUpdate(bActiveTransition);
|
||||
|
||||
// if (m_MeasuresToVariables) // BUG: LSSetVariable doens't seem to work for some reason.
|
||||
// {
|
||||
@ -2671,6 +2826,12 @@ LRESULT CMeterWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Stop the transition timer
|
||||
KillTimer(m_Window, TRANSITIONTIMER);
|
||||
m_ActiveTransition = false;
|
||||
}
|
||||
}
|
||||
else if(wParam == MOUSETIMER)
|
||||
{
|
||||
|
@ -100,13 +100,16 @@ enum BANGCOMMAND
|
||||
{
|
||||
BANG_REFRESH,
|
||||
BANG_REDRAW,
|
||||
BANG_UPDATE,
|
||||
BANG_TOGGLEMETER,
|
||||
BANG_SHOWMETER,
|
||||
BANG_HIDEMETER,
|
||||
BANG_MOVEMETER,
|
||||
BANG_UPDATEMETER,
|
||||
BANG_TOGGLEMEASURE,
|
||||
BANG_ENABLEMEASURE,
|
||||
BANG_DISABLEMEASURE,
|
||||
BANG_UPDATEMEASURE,
|
||||
BANG_SHOW,
|
||||
BANG_HIDE,
|
||||
BANG_TOGGLE,
|
||||
@ -124,9 +127,11 @@ enum BANGCOMMAND
|
||||
BANG_TOGGLEMETERGROUP,
|
||||
BANG_SHOWMETERGROUP,
|
||||
BANG_HIDEMETERGROUP,
|
||||
BANG_UPDATEMETERGROUP,
|
||||
BANG_TOGGLEMEASUREGROUP,
|
||||
BANG_ENABLEMEASUREGROUP,
|
||||
BANG_DISABLEMEASUREGROUP,
|
||||
BANG_UPDATEMEASUREGROUP,
|
||||
|
||||
BANG_LSHOOK,
|
||||
BANG_PLUGIN,
|
||||
@ -154,9 +159,11 @@ public:
|
||||
void HideMeter(const WCHAR* name, bool group = false);
|
||||
void ShowMeter(const WCHAR* name, bool group = false);
|
||||
void ToggleMeter(const WCHAR* name, bool group = false);
|
||||
void UpdateMeter(const WCHAR* name, bool group = false);
|
||||
void DisableMeasure(const WCHAR* name, bool group = false);
|
||||
void EnableMeasure(const WCHAR* name, bool group = false);
|
||||
void ToggleMeasure(const WCHAR* name, bool group = false);
|
||||
void UpdateMeasure(const WCHAR* name, bool group = false);
|
||||
void Refresh(bool init, bool all = false);
|
||||
void Redraw();
|
||||
|
||||
@ -261,6 +268,9 @@ private:
|
||||
void MapCoordsToScreen(int& x, int& y, int w, int h);
|
||||
void WindowToScreen();
|
||||
void ScreenToWindow();
|
||||
void PostUpdate(bool bActiveTransition);
|
||||
bool UpdateMeasure(CMeasure* measure, bool force);
|
||||
bool UpdateMeter(CMeter* meter, bool& bActiveTransition, bool force);
|
||||
void Update(bool nodraw);
|
||||
void UpdateTransparency(int alpha, bool reset);
|
||||
void ReadConfig();
|
||||
|
@ -581,6 +581,17 @@ void RainmeterMoveMeter(HWND, const char* arg)
|
||||
BangWithArgs(BANG_MOVEMETER, ConvertToWide(arg).c_str(), 3);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterUpdateMeter
|
||||
**
|
||||
** Callback for the !RainmeterUpdateMeter bang
|
||||
**
|
||||
*/
|
||||
void RainmeterUpdateMeter(HWND, const char* arg)
|
||||
{
|
||||
BangWithArgs(BANG_UPDATEMETER, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterDisableMeasure
|
||||
**
|
||||
@ -614,6 +625,17 @@ void RainmeterToggleMeasure(HWND, const char* arg)
|
||||
BangWithArgs(BANG_TOGGLEMEASURE, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterUpdateMeasure
|
||||
**
|
||||
** Callback for the !RainmeterUpdateMeasure bang
|
||||
**
|
||||
*/
|
||||
void RainmeterUpdateMeasure(HWND, const char* arg)
|
||||
{
|
||||
BangWithArgs(BANG_UPDATEMEASURE, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterRefresh
|
||||
**
|
||||
@ -647,6 +669,17 @@ void RainmeterRedraw(HWND, const char* arg)
|
||||
BangWithArgs(BANG_REDRAW, ConvertToWide(arg).c_str(), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterUpdate
|
||||
**
|
||||
** Callback for the !RainmeterUpdate bang
|
||||
**
|
||||
*/
|
||||
void RainmeterUpdate(HWND, const char* arg)
|
||||
{
|
||||
BangWithArgs(BANG_UPDATE, ConvertToWide(arg).c_str(), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterActivateConfig
|
||||
**
|
||||
@ -867,6 +900,17 @@ void RainmeterToggleMeterGroup(HWND, const char* arg)
|
||||
BangWithArgs(BANG_TOGGLEMETERGROUP, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterUpdateMeterGroup
|
||||
**
|
||||
** Callback for the !RainmeterUpdateMeterGroup bang
|
||||
**
|
||||
*/
|
||||
void RainmeterUpdateMeterGroup(HWND, const char* arg)
|
||||
{
|
||||
BangWithArgs(BANG_UPDATEMETERGROUP, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterDisableMeasureGroup
|
||||
**
|
||||
@ -900,6 +944,17 @@ void RainmeterToggleMeasureGroup(HWND, const char* arg)
|
||||
BangWithArgs(BANG_TOGGLEMEASUREGROUP, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterUpdateMeasureGroup
|
||||
**
|
||||
** Callback for the !RainmeterUpdateMeasureGroup bang
|
||||
**
|
||||
*/
|
||||
void RainmeterUpdateMeasureGroup(HWND, const char* arg)
|
||||
{
|
||||
BangWithArgs(BANG_UPDATEMEASUREGROUP, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterRefreshGroup
|
||||
**
|
||||
@ -922,6 +977,17 @@ void RainmeterRedrawGroup(HWND, const char* arg)
|
||||
BangGroupWithArgs(BANG_REDRAW, ConvertToWide(arg).c_str(), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterUpdateGroup
|
||||
**
|
||||
** Callback for the !RainmeterUpdateGroup bang
|
||||
**
|
||||
*/
|
||||
void RainmeterUpdateGroup(HWND, const char* arg)
|
||||
{
|
||||
BangGroupWithArgs(BANG_UPDATE, ConvertToWide(arg).c_str(), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterDeactivateConfigGroup
|
||||
**
|
||||
@ -1859,6 +1925,7 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
||||
|
||||
AddBangCommand("!RainmeterRefresh", RainmeterRefresh);
|
||||
AddBangCommand("!RainmeterRedraw", RainmeterRedraw);
|
||||
AddBangCommand("!RainmeterUpdate", RainmeterUpdate);
|
||||
AddBangCommand("!RainmeterHide", RainmeterHide);
|
||||
AddBangCommand("!RainmeterShow", RainmeterShow);
|
||||
AddBangCommand("!RainmeterToggle", RainmeterToggle);
|
||||
@ -1869,9 +1936,11 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
||||
AddBangCommand("!RainmeterShowMeter", RainmeterShowMeter);
|
||||
AddBangCommand("!RainmeterToggleMeter", RainmeterToggleMeter);
|
||||
AddBangCommand("!RainmeterMoveMeter", RainmeterMoveMeter);
|
||||
AddBangCommand("!RainmeterUpdateMeter", RainmeterUpdateMeter);
|
||||
AddBangCommand("!RainmeterDisableMeasure", RainmeterDisableMeasure);
|
||||
AddBangCommand("!RainmeterEnableMeasure", RainmeterEnableMeasure);
|
||||
AddBangCommand("!RainmeterToggleMeasure", RainmeterToggleMeasure);
|
||||
AddBangCommand("!RainmeterUpdateMeasure", RainmeterUpdateMeasure);
|
||||
AddBangCommand("!RainmeterActivateConfig", RainmeterActivateConfig);
|
||||
AddBangCommand("!RainmeterDeactivateConfig", RainmeterDeactivateConfig);
|
||||
AddBangCommand("!RainmeterToggleConfig", RainmeterToggleConfig);
|
||||
@ -1886,6 +1955,7 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
||||
|
||||
AddBangCommand("!RainmeterRefreshGroup", RainmeterRefreshGroup);
|
||||
AddBangCommand("!RainmeterRedrawGroup", RainmeterRedrawGroup);
|
||||
AddBangCommand("!RainmeterUpdateGroup", RainmeterUpdateGroup);
|
||||
AddBangCommand("!RainmeterHideGroup", RainmeterHideGroup);
|
||||
AddBangCommand("!RainmeterShowGroup", RainmeterShowGroup);
|
||||
AddBangCommand("!RainmeterToggleGroup", RainmeterToggleGroup);
|
||||
@ -1895,9 +1965,11 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
||||
AddBangCommand("!RainmeterHideMeterGroup", RainmeterHideMeterGroup);
|
||||
AddBangCommand("!RainmeterShowMeterGroup", RainmeterShowMeterGroup);
|
||||
AddBangCommand("!RainmeterToggleMeterGroup", RainmeterToggleMeterGroup);
|
||||
AddBangCommand("!RainmeterUpdateMeterGroup", RainmeterUpdateMeterGroup);
|
||||
AddBangCommand("!RainmeterDisableMeasureGroup", RainmeterDisableMeasureGroup);
|
||||
AddBangCommand("!RainmeterEnableMeasureGroup", RainmeterEnableMeasureGroup);
|
||||
AddBangCommand("!RainmeterToggleMeasureGroup", RainmeterToggleMeasureGroup);
|
||||
AddBangCommand("!RainmeterUpdateMeasureGroup", RainmeterUpdateMeasureGroup);
|
||||
AddBangCommand("!RainmeterDeactivateConfigGroup", RainmeterDeactivateConfigGroup);
|
||||
AddBangCommand("!RainmeterZPosGroup", RainmeterZPosGroup);
|
||||
AddBangCommand("!RainmeterClickThroughGroup", RainmeterClickThroughGroup);
|
||||
@ -2454,6 +2526,7 @@ void CRainmeter::Quit(HINSTANCE dllInst)
|
||||
|
||||
RemoveBangCommand("!RainmeterRefresh");
|
||||
RemoveBangCommand("!RainmeterRedraw");
|
||||
RemoveBangCommand("!RainmeterUpdate");
|
||||
RemoveBangCommand("!RainmeterHide");
|
||||
RemoveBangCommand("!RainmeterShow");
|
||||
RemoveBangCommand("!RainmeterToggle");
|
||||
@ -2464,9 +2537,11 @@ void CRainmeter::Quit(HINSTANCE dllInst)
|
||||
RemoveBangCommand("!RainmeterShowMeter");
|
||||
RemoveBangCommand("!RainmeterToggleMeter");
|
||||
RemoveBangCommand("!RainmeterMoveMeter");
|
||||
RemoveBangCommand("!RainmeterUpdateMeter");
|
||||
RemoveBangCommand("!RainmeterHideMeasure");
|
||||
RemoveBangCommand("!RainmeterShowMeasure");
|
||||
RemoveBangCommand("!RainmeterToggleMeasure");
|
||||
RemoveBangCommand("!RainmeterUpdateMeasure");
|
||||
RemoveBangCommand("!RainmeterActivateConfig");
|
||||
RemoveBangCommand("!RainmeterDeactivateConfig");
|
||||
RemoveBangCommand("!RainmeterToggleConfig");
|
||||
@ -2481,6 +2556,7 @@ void CRainmeter::Quit(HINSTANCE dllInst)
|
||||
|
||||
RemoveBangCommand("!RainmeterRefreshGroup");
|
||||
RemoveBangCommand("!RainmeterRedrawGroup");
|
||||
RemoveBangCommand("!RainmeterUpdateGroup");
|
||||
RemoveBangCommand("!RainmeterHideGroup");
|
||||
RemoveBangCommand("!RainmeterShowGroup");
|
||||
RemoveBangCommand("!RainmeterToggleGroup");
|
||||
@ -2490,9 +2566,11 @@ void CRainmeter::Quit(HINSTANCE dllInst)
|
||||
RemoveBangCommand("!RainmeterHideMeterGroup");
|
||||
RemoveBangCommand("!RainmeterShowMeterGroup");
|
||||
RemoveBangCommand("!RainmeterToggleMeterGroup");
|
||||
RemoveBangCommand("!RainmeterUpdateMeterGroup");
|
||||
RemoveBangCommand("!RainmeterHideMeasureGroup");
|
||||
RemoveBangCommand("!RainmeterShowMeasureGroup");
|
||||
RemoveBangCommand("!RainmeterToggleMeasureGroup");
|
||||
RemoveBangCommand("!RainmeterUpdateMeasureGroup");
|
||||
RemoveBangCommand("!RainmeterDeactivateConfigGroup");
|
||||
RemoveBangCommand("!RainmeterZPosGroup");
|
||||
RemoveBangCommand("!RainmeterClickThroughGroup");
|
||||
@ -2664,6 +2742,10 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg,
|
||||
{
|
||||
BangWithArgs(BANG_REDRAW, arg.c_str(), 0);
|
||||
}
|
||||
else if (_wcsicmp(bang.c_str(), L"!RainmeterUpdate") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_UPDATE, arg.c_str(), 0);
|
||||
}
|
||||
else if (_wcsicmp(bang.c_str(), L"!RainmeterHide") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_HIDE, arg.c_str(), 0);
|
||||
@ -2704,6 +2786,10 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg,
|
||||
{
|
||||
BangWithArgs(BANG_MOVEMETER, arg.c_str(), 3);
|
||||
}
|
||||
else if (_wcsicmp(bang.c_str(), L"!RainmeterUpdateMeter") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_UPDATEMETER, arg.c_str(), 1);
|
||||
}
|
||||
else if (_wcsicmp(bang.c_str(), L"!RainmeterDisableMeasure") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_DISABLEMEASURE, arg.c_str(), 1);
|
||||
@ -2716,6 +2802,10 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg,
|
||||
{
|
||||
BangWithArgs(BANG_TOGGLEMEASURE, arg.c_str(), 1);
|
||||
}
|
||||
else if (_wcsicmp(bang.c_str(), L"!RainmeterUpdateMeasure") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_UPDATEMEASURE, arg.c_str(), 1);
|
||||
}
|
||||
else if (_wcsicmp(bang.c_str(), L"!RainmeterActivateConfig") == 0)
|
||||
{
|
||||
RainmeterActivateConfigWide(arg.c_str());
|
||||
@ -2764,6 +2854,10 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg,
|
||||
{
|
||||
BangGroupWithArgs(BANG_REFRESH, arg.c_str(), 0);
|
||||
}
|
||||
else if (_wcsicmp(bang.c_str(), L"!RainmeterUpdateGroup") == 0)
|
||||
{
|
||||
BangGroupWithArgs(BANG_UPDATE, arg.c_str(), 0);
|
||||
}
|
||||
else if (_wcsicmp(bang.c_str(), L"!RainmeterRedrawGroup") == 0)
|
||||
{
|
||||
BangGroupWithArgs(BANG_REDRAW, arg.c_str(), 0);
|
||||
@ -2804,6 +2898,10 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg,
|
||||
{
|
||||
BangWithArgs(BANG_TOGGLEMETERGROUP, arg.c_str(), 1);
|
||||
}
|
||||
else if (_wcsicmp(bang.c_str(), L"!RainmeterUpdateMeterGroup") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_UPDATEMETERGROUP, arg.c_str(), 1);
|
||||
}
|
||||
else if (_wcsicmp(bang.c_str(), L"!RainmeterDisableMeasureGroup") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_DISABLEMEASUREGROUP, arg.c_str(), 1);
|
||||
@ -2816,6 +2914,10 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg,
|
||||
{
|
||||
BangWithArgs(BANG_TOGGLEMEASUREGROUP, arg.c_str(), 1);
|
||||
}
|
||||
else if (_wcsicmp(bang.c_str(), L"!RainmeterUpdateMeasureGroup") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_UPDATEMEASUREGROUP, arg.c_str(), 1);
|
||||
}
|
||||
else if (_wcsicmp(bang.c_str(), L"!RainmeterDeactivateConfigGroup") == 0)
|
||||
{
|
||||
RainmeterDeactivateConfigGroupWide(arg.c_str());
|
||||
|
@ -44,6 +44,7 @@
|
||||
void RainmeterRefresh(HWND, const char* arg);
|
||||
void RainmeterRefreshApp(HWND, const char* arg);
|
||||
void RainmeterRedraw(HWND, const char* arg);
|
||||
void RainmeterUpdate(HWND, const char* arg);
|
||||
void RainmeterShow(HWND, const char* arg);
|
||||
void RainmeterHide(HWND, const char* arg);
|
||||
void RainmeterToggle(HWND, const char* arg);
|
||||
@ -54,9 +55,11 @@ void RainmeterShowMeter(HWND, const char* arg);
|
||||
void RainmeterHideMeter(HWND, const char* arg);
|
||||
void RainmeterToggleMeter(HWND, const char* arg);
|
||||
void RainmeterMoveMeter(HWND, const char* arg);
|
||||
void RainmeterUpdateMeter(HWND, const char* arg);
|
||||
void RainmeterEnableMeasure(HWND, const char* arg);
|
||||
void RainmeterDisableMeasure(HWND, const char* arg);
|
||||
void RainmeterToggleMeasure(HWND, const char* arg);
|
||||
void RainmeterUpdateMeasure(HWND, const char* arg);
|
||||
void RainmeterActivateConfig(HWND, const char* arg);
|
||||
void RainmeterDeactivateConfig(HWND, const char* arg);
|
||||
void RainmeterToggleConfig(HWND, const char* arg);
|
||||
@ -71,6 +74,7 @@ void RainmeterSetVariable(HWND, const char* arg);
|
||||
|
||||
void RainmeterRefreshGroup(HWND, const char* arg);
|
||||
void RainmeterRedrawGroup(HWND, const char* arg);
|
||||
void RainmeterUpdateGroup(HWND, const char* arg);
|
||||
void RainmeterShowGroup(HWND, const char* arg);
|
||||
void RainmeterHideGroup(HWND, const char* arg);
|
||||
void RainmeterToggleGroup(HWND, const char* arg);
|
||||
@ -80,9 +84,11 @@ void RainmeterToggleFadeGroup(HWND, const char* arg);
|
||||
void RainmeterShowMeterGroup(HWND, const char* arg);
|
||||
void RainmeterHideMeterGroup(HWND, const char* arg);
|
||||
void RainmeterToggleMeterGroup(HWND, const char* arg);
|
||||
void RainmeterUpdateMeterGroup(HWND, const char* arg);
|
||||
void RainmeterEnableMeasureGroup(HWND, const char* arg);
|
||||
void RainmeterDisableMeasureGroup(HWND, const char* arg);
|
||||
void RainmeterToggleMeasureGroup(HWND, const char* arg);
|
||||
void RainmeterUpdateMeasureGroup(HWND, const char* arg);
|
||||
void RainmeterDeactivateConfigGroup(HWND, const char* arg);
|
||||
void RainmeterZPosGroup(HWND, const char* arg);
|
||||
void RainmeterClickThroughGroup(HWND, const char* arg);
|
||||
|
Loading…
Reference in New Issue
Block a user