Removed unused codes.

Some small changes on create Measures and Meters.
This commit is contained in:
spx 2010-04-07 19:56:53 +00:00
parent 31c1abef84
commit 54fe29a062
2 changed files with 31 additions and 25 deletions

View File

@ -112,7 +112,6 @@ CMeterWindow::CMeterWindow(std::wstring& path, std::wstring& config, std::wstrin
m_AutoSelectScreen = false; m_AutoSelectScreen = false;
m_Dragging = false; m_Dragging = false;
m_Dragged = false; m_Dragged = false;
m_PreventMoving = false;
m_BackgroundSize.cx = 0; m_BackgroundSize.cx = 0;
m_BackgroundSize.cy = 0; m_BackgroundSize.cy = 0;
@ -1706,35 +1705,45 @@ void CMeterWindow::ReadSkin()
meterName = m_Parser.ReadString(strSection.c_str(), L"Meter", L""); meterName = m_Parser.ReadString(strSection.c_str(), L"Meter", L"");
if (measureName.length() > 0) if (measureName.length() > 0)
{ {
// It's a measure
CMeasure* measure = NULL;
try try
{ {
// It's a measure measure = CMeasure::Create(measureName.c_str(), this);
CMeasure* measure = CMeasure::Create(measureName.c_str(), this);
if (measure) if (measure)
{ {
measure->SetName(strSection.c_str()); measure->SetName(strSection.c_str());
measure->ReadConfig(m_Parser, strSection.c_str()); measure->ReadConfig(m_Parser, strSection.c_str());
m_Measures.push_back(measure);
m_Parser.AddMeasure(measure);
if (!m_HasNetMeasures && dynamic_cast<CMeasureNet*>((measure)))
{
m_HasNetMeasures = true;
}
} }
} }
catch (CError& error) catch (CError& error)
{ {
delete measure;
measure = NULL;
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 (measure)
{
m_Measures.push_back(measure);
m_Parser.AddMeasure(measure);
if (!m_HasNetMeasures && dynamic_cast<CMeasureNet*>((measure)))
{
m_HasNetMeasures = true;
}
}
} }
else if (meterName.length() > 0) else if (meterName.length() > 0)
{ {
// It's a meter
CMeter* meter = NULL;
try try
{ {
// It's a meter meter = CMeter::Create(meterName.c_str(), this);
CMeter* meter = CMeter::Create(meterName.c_str(), this);
if (meter) if (meter)
{ {
meter->SetName(strSection.c_str()); meter->SetName(strSection.c_str());
@ -1745,15 +1754,21 @@ void CMeterWindow::ReadSkin()
} }
meter->ReadConfig(strSection.c_str()); meter->ReadConfig(strSection.c_str());
m_Meters.push_back(meter);
m_Parser.ResetStyleTemplate();
} }
} }
catch (CError& error) catch (CError& error)
{ {
delete meter;
meter = NULL;
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 (meter)
{
m_Meters.push_back(meter);
m_Parser.ResetStyleTemplate();
}
} }
// If it's not a meter or measure it will be ignored // If it's not a meter or measure it will be ignored
} }
@ -3076,14 +3091,6 @@ LRESULT CMeterWindow::OnWindowPosChanging(WPARAM wParam, LPARAM lParam)
if ((wp->flags & SWP_NOMOVE) == 0) if ((wp->flags & SWP_NOMOVE) == 0)
{ {
if (m_PreventMoving)
{
wp->flags |= SWP_NOMOVE;
m_PreventMoving = false;
return DefWindowProc(m_Window, m_Message, wParam, lParam);
}
if (m_SnapEdges && !(GetKeyState(VK_CONTROL) & 0x8000 || GetKeyState(VK_SHIFT) & 0x8000)) if (m_SnapEdges && !(GetKeyState(VK_CONTROL) & 0x8000 || GetKeyState(VK_SHIFT) & 0x8000))
{ {
// only process movement (ignore anything without winpos values) // only process movement (ignore anything without winpos values)

View File

@ -304,7 +304,6 @@ private:
bool m_AutoSelectScreen; // bool m_AutoSelectScreen; //
bool m_Dragging; // bool m_Dragging; //
bool m_Dragged; // bool m_Dragged; //
bool m_PreventMoving; //
BGMODE m_BackgroundMode; // The background mode BGMODE m_BackgroundMode; // The background mode
Gdiplus::Color m_SolidColor; // Color of the solid background Gdiplus::Color m_SolidColor; // Color of the solid background
Gdiplus::Color m_SolidColor2; // Color of the solid background Gdiplus::Color m_SolidColor2; // Color of the solid background