Small code optimization.

This commit is contained in:
spx 2010-11-16 22:14:00 +00:00
parent f689bbe6f1
commit b2967b2814
3 changed files with 29 additions and 55 deletions

View File

@ -20,26 +20,6 @@
#include "Group.h" #include "Group.h"
#include "ConfigParser.h" #include "ConfigParser.h"
/*
** CGroup
**
** The constructor
**
*/
CGroup::CGroup()
{
}
/*
** ~CGroup
**
** The destructor
**
*/
CGroup::~CGroup()
{
}
/* /*
** InitializeGroup ** InitializeGroup
** **

View File

@ -32,8 +32,8 @@ public:
const std::set<std::wstring>& GetGroup() { return m_Group; } const std::set<std::wstring>& GetGroup() { return m_Group; }
protected: protected:
CGroup(); CGroup() {}
virtual ~CGroup(); virtual ~CGroup() {}
void InitializeGroup(const std::wstring& group); void InitializeGroup(const std::wstring& group);

View File

@ -2064,16 +2064,16 @@ void CMeterWindow::InitializeMeters()
try try
{ {
(*j)->Initialize(); (*j)->Initialize();
if (!(*j)->GetToolTipText().empty())
{
(*j)->CreateToolTip(this);
}
} }
catch (CError& error) catch (CError& error)
{ {
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
} }
if (!(*j)->GetToolTipText().empty())
{
(*j)->CreateToolTip(this);
}
} }
Update(true); Update(true);
@ -2374,8 +2374,6 @@ void CMeterWindow::Redraw()
// Draw the meters // Draw the meters
std::list<CMeter*>::const_iterator j = m_Meters.begin(); std::list<CMeter*>::const_iterator j = m_Meters.begin();
for( ; j != m_Meters.end(); ++j) for( ; j != m_Meters.end(); ++j)
{
try
{ {
if (!(*j)->GetTransformationMatrix().IsIdentity()) if (!(*j)->GetTransformationMatrix().IsIdentity())
{ {
@ -2392,11 +2390,6 @@ void CMeterWindow::Redraw()
(*j)->Draw(graphics); (*j)->Draw(graphics);
} }
} }
catch (CError& error)
{
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
}
}
if (m_ResetRegion) CreateRegion(false); if (m_ResetRegion) CreateRegion(false);
m_ResetRegion = false; m_ResetRegion = false;
@ -2426,43 +2419,44 @@ void CMeterWindow::Update(bool nodraw)
// Update all measures // Update all measures
std::list<CMeasure*>::const_iterator i = m_Measures.begin(); std::list<CMeasure*>::const_iterator i = m_Measures.begin();
for( ; i != m_Measures.end(); ++i) for( ; i != m_Measures.end(); ++i)
{
try
{ {
if ((*i)->HasDynamicVariables()) if ((*i)->HasDynamicVariables())
{
try
{ {
(*i)->ReadConfig(m_Parser, (*i)->GetName()); (*i)->ReadConfig(m_Parser, (*i)->GetName());
} }
(*i)->Update();
}
catch (CError& error) catch (CError& error)
{ {
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
} }
} }
(*i)->Update();
}
// Update the meters // Update the meters
bool bActiveTransition = false; bool bActiveTransition = false;
bool bUpdate = false; bool bUpdate = false;
std::list<CMeter*>::const_iterator j = m_Meters.begin(); std::list<CMeter*>::const_iterator j = m_Meters.begin();
for( ; j != m_Meters.end(); ++j) for( ; j != m_Meters.end(); ++j)
{
try
{ {
if ((*j)->HasDynamicVariables()) if ((*j)->HasDynamicVariables())
{
try
{ {
(*j)->ReadConfig((*j)->GetName()); (*j)->ReadConfig((*j)->GetName());
m_Parser.ClearStyleTemplate(); m_Parser.ClearStyleTemplate();
} }
if ((*j)->Update())
{
bUpdate = true;
}
}
catch (CError& error) catch (CError& error)
{ {
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
} }
}
if ((*j)->Update())
{
bUpdate = true;
}
// Update tooltips // Update tooltips
if (!(*j)->HasToolTip()) if (!(*j)->HasToolTip())