MGR: Prevent zero-size window in a rare situation where registry values have accidentally been set to zero

This commit is contained in:
Charlie Fenton 2013-12-10 02:48:49 -08:00
parent 401aa50b04
commit 5c9e012d5b
4 changed files with 14 additions and 0 deletions

View File

@ -984,6 +984,9 @@ bool CBOINCGUIApp::SetActiveGUI(int iGUISelection, bool bShowWindow) {
m_pConfig->Read(wxT("XPos"), &iLeft, 30);
m_pConfig->Read(wxT("Width"), &iWidth, 800);
m_pConfig->Read(wxT("Height"), &iHeight, 600);
// Guard against a rare situation where registry values are zero
if (iWidth < 50) iWidth = 800;
if (iHeight < 50) iHeight = 600;
} else {
m_pConfig->SetPath(wxT("/Simple"));
m_pConfig->Read(wxT("YPos"), &iTop, 30);

View File

@ -763,6 +763,9 @@ void CDlgEventLog::GetWindowDimensions( wxPoint& position, wxSize& size ) {
pConfig->Read(wxT("Width"), &iWidth, 640);
pConfig->Read(wxT("Height"), &iHeight, 480);
// Guard against a rare situation where registry values are zero
if (iWidth < 50) iWidth = 640;
if (iHeight < 50) iHeight = 480;
position.y = iTop;
position.x = iLeft;
size.x = iWidth;

View File

@ -129,6 +129,10 @@ bool CDlgItemProperties::RestoreState() {
pConfig->Read(wxT("Width"), &iWidth, wxDefaultCoord);
pConfig->Read(wxT("Height"), &iHeight, wxDefaultCoord);
// Guard against a rare situation where registry values are zero
if ((iWidth < 50) && (iWidth != wxDefaultCoord)) iWidth = wxDefaultCoord;
if ((iHeight < 50) && (iHeight != wxDefaultCoord)) iHeight = wxDefaultCoord;
#ifndef __WXMAC__
// Set size to saved values or defaults if no saved values
SetSize(iWidth, iHeight);

View File

@ -597,6 +597,10 @@ void CDlgMessages::RestoreWindowDimensions() {
pConfig->Read(wxT("WindowIconized"), &bWindowIconized, false);
pConfig->Read(wxT("WindowMaximized"), &bWindowMaximized, false);
// Guard against a rare situation where registry values are zero
if (iWidth < 50) iWidth = 640;
if (iHeight < 50) iHeight = 480;
#ifndef __WXMAC__
// If either co-ordinate is less then 0 then set it equal to 0 to ensure