Additional changes to c3982da

This commit is contained in:
spx
2013-01-15 04:30:10 +09:00
parent c3982da712
commit 4e27d71d97
10 changed files with 134 additions and 57 deletions

View File

@ -1228,7 +1228,7 @@ void CMeterWindow::UpdateMeter(const std::wstring& name, bool group)
{
if (UpdateMeter((*j), bActiveTransition, true))
{
DoUpdateAction((*j));
(*j)->DoUpdateAction();
}
SetResizeWindowMode(RESIZEMODE_CHECK); // Need to recalculate the window size
@ -1354,8 +1354,8 @@ void CMeterWindow::UpdateMeasure(const std::wstring& name, bool group)
if (UpdateMeasure((*i), true))
{
DoUpdateAction((*i));
//DoChangeAction((*i), false); // TODO: Check that this is the first update or not
(*i)->DoUpdateAction();
(*i)->DoChangeAction();
}
if (!group) return;
@ -2678,6 +2678,11 @@ void CMeterWindow::Update(bool refresh)
{
++m_UpdateCounter;
#ifdef DEBUG_PERF_UPDATE
_QPC(s1);
__int64 e1;
#endif
if (!m_Measures.empty())
{
// Pre-updates
@ -2687,20 +2692,34 @@ void CMeterWindow::Update(bool refresh)
CMeasureNet::UpdateStats();
}
#ifdef DEBUG_PERF_UPDATE
e1 = QPC();
#endif
// Update all measures
std::vector<CMeasure*>::const_iterator i = m_Measures.begin();
for ( ; i != m_Measures.end(); ++i)
{
if (UpdateMeasure((*i), refresh))
{
DoUpdateAction((*i));
DoChangeAction((*i), refresh);
(*i)->DoUpdateAction();
(*i)->DoChangeAction();
}
}
}
#ifdef DEBUG_PERF_UPDATE
else
{
e1 = QPC();
}
#endif
CDialogAbout::UpdateMeasures(this);
#ifdef DEBUG_PERF_UPDATE
_QPC(e2);
#endif
// Update all meters
bool bActiveTransition = false;
bool bUpdate = false;
@ -2711,10 +2730,16 @@ void CMeterWindow::Update(bool refresh)
{
bUpdate = true;
DoUpdateAction((*j));
(*j)->DoUpdateAction();
}
}
#ifdef DEBUG_PERF_UPDATE
_QPC(e3);
double q1 = QPCms(s1,e1), q2 = QPCms(e1,e2), q3 = QPCms(e2,e3);
DebugString(L"Update: %.5f [ms] (PreUpdate: %.5f / Measure: %.5f / Meter: %.5f) :: %s", q1 + q2 + q3, q1, q2, q3, m_FolderPath.c_str());
#endif
// Redraw all meters
if (bUpdate || m_ResizeWindow || refresh)
{
@ -2741,40 +2766,6 @@ void CMeterWindow::Update(bool refresh)
}
}
void CMeterWindow::DoUpdateAction(CSection* section)
{
const std::wstring& updateAction = section->GetOnUpdateAction();
if (!updateAction.empty())
{
Rainmeter->ExecuteCommand(updateAction.c_str(), this);
}
}
void CMeterWindow::DoChangeAction(CMeasure* measure, bool first)
{
const std::wstring& changeAction = measure->GetOnChangeAction();
if (first)
{
double newValue = measure->GetValue();
const WCHAR* newStringValue = measure->GetStringValue(AUTOSCALE_OFF, 1, -1, false);
measure->SetOldValue(newValue);
measure->SetOldStringValue(newStringValue);
}
else if (!changeAction.empty())
{
double newValue = measure->GetValue();
const WCHAR* newStringValue = measure->GetStringValue(AUTOSCALE_OFF, 1, -1, false);
if (measure->GetOldValue() != newValue || wcscmp(measure->GetOldStringValue().c_str(), newStringValue) != 0)
{
measure->SetOldValue(newValue);
measure->SetOldStringValue(newStringValue);
Rainmeter->ExecuteCommand(changeAction.c_str(), this);
}
}
}
/*
** Updates the window contents
**