From 2336b08b88c0ba4d7c519a2f314ca2c57eee8772 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Fri, 1 Jun 2012 17:13:21 +0300 Subject: [PATCH] Reverted 9623766 --- Library/Measure.cpp | 111 ++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 56 deletions(-) diff --git a/Library/Measure.cpp b/Library/Measure.cpp index d35089ab..482ef4ce 100644 --- a/Library/Measure.cpp +++ b/Library/Measure.cpp @@ -426,9 +426,7 @@ std::wstring CMeasure::ExtractWord(std::wstring& buffer) bool CMeasure::Update() { - bool update = !IsDisabled(); - - if (update) + if (!m_Disabled) { // Only update the counter if the divider ++m_UpdateCounter; @@ -487,65 +485,66 @@ bool CMeasure::Update() } m_Value /= (double)averageValuesSize; } + + if (m_MeterWindow) + { + if (!m_IfEqualAction.empty()) + { + if ((int)m_Value == (int)m_IfEqualValue) + { + if (!m_IfEqualCommitted) + { + m_IfEqualCommitted = true; // To avoid infinite loop from !Update + Rainmeter->ExecuteCommand(m_IfEqualAction.c_str(), m_MeterWindow); + } + } + else + { + m_IfEqualCommitted = false; + } + } + + if (!m_IfAboveAction.empty()) + { + if (m_Value > m_IfAboveValue) + { + if (!m_IfAboveCommitted) + { + m_IfAboveCommitted= true; // To avoid infinite loop from !Update + Rainmeter->ExecuteCommand(m_IfAboveAction.c_str(), m_MeterWindow); + } + } + else + { + m_IfAboveCommitted = false; + } + } + + if (!m_IfBelowAction.empty()) + { + if (m_Value < m_IfBelowValue) + { + if (!m_IfBelowCommitted) + { + m_IfBelowCommitted = true; // To avoid infinite loop from !Update + Rainmeter->ExecuteCommand(m_IfBelowAction.c_str(), m_MeterWindow); + } + } + else + { + m_IfBelowCommitted = false; + } + } + } + + return true; } else { // Disabled measures have 0 as value m_Value = 0.0; + return false; } - - if (m_MeterWindow) - { - if (!m_IfEqualAction.empty()) - { - if ((int)m_Value == (int)m_IfEqualValue) - { - if (!m_IfEqualCommitted) - { - m_IfEqualCommitted = true; // To avoid infinite loop from !Update - Rainmeter->ExecuteCommand(m_IfEqualAction.c_str(), m_MeterWindow); - } - } - else - { - m_IfEqualCommitted = false; - } - } - - if (!m_IfAboveAction.empty()) - { - if (m_Value > m_IfAboveValue) - { - if (!m_IfAboveCommitted) - { - m_IfAboveCommitted= true; // To avoid infinite loop from !Update - Rainmeter->ExecuteCommand(m_IfAboveAction.c_str(), m_MeterWindow); - } - } - else - { - m_IfAboveCommitted = false; - } - } - - if (!m_IfBelowAction.empty()) - { - if (m_Value < m_IfBelowValue) - { - if (!m_IfBelowCommitted) - { - m_IfBelowCommitted = true; // To avoid infinite loop from !Update - Rainmeter->ExecuteCommand(m_IfBelowAction.c_str(), m_MeterWindow); - } - } - else - { - m_IfBelowCommitted = false; - } - } - } - - return update; } /*