From f499363cd29756e73d4d212240a7821e5e088f24 Mon Sep 17 00:00:00 2001 From: Kevin Reed Date: Wed, 8 May 2013 20:07:40 -0500 Subject: [PATCH] Modify how the event log is displayed on the screen for Windows. Make sure that the event log window will fit on the screen and will be shown entirely on screen. --- clientgui/DlgEventLog.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/clientgui/DlgEventLog.cpp b/clientgui/DlgEventLog.cpp index 0b84755b4b..436c510804 100644 --- a/clientgui/DlgEventLog.cpp +++ b/clientgui/DlgEventLog.cpp @@ -36,7 +36,7 @@ #include "DlgEventLogListCtrl.h" #include "DlgEventLog.h" #include "AdvancedFrame.h" - +#include ////@begin includes @@ -166,10 +166,21 @@ bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& capt GetWindowDimensions( oTempPoint, oTempSize ); #ifdef __WXMSW__ - // Windows does some crazy things if the initial position is a negative - // value. - oTempPoint.x = wxDefaultCoord; - oTempPoint.y = wxDefaultCoord; + // Make sure that it fits within displayable area + wxDisplay *display = new wxDisplay(); + wxRect rDisplay = display->GetClientArea(); + if ( oTempSize.GetWidth() > rDisplay.width ) oTempSize.SetWidth(rDisplay.width); + if ( oTempSize.GetHeight() > rDisplay.height ) oTempSize.SetHeight(rDisplay.height); + + // Check if part of the display was going to be off the screen, if so, center the + // display on that axis + if ( oTempPoint.x < 0 || oTempPoint.x + oTempSize.GetWidth() > rDisplay.width ) { + oTempPoint.x = (rDisplay.width - oTempSize.GetWidth())/2; + } + if ( oTempPoint.y < 0 || oTempPoint.y + oTempSize.GetHeight() > rDisplay.height ) { + oTempPoint.y = (rDisplay.height - oTempSize.GetHeight())/2; + } + delete display; #endif #ifdef __WXMAC__