[BUG_FIXED] (Author: Pekka Pöyry) Fix the problem of Window position not saved/restored properly.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1021 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-02-11 23:42:10 +00:00
parent 7c05c2f208
commit f911b63a5c

View File

@ -712,9 +712,14 @@ bool Notepad_plus::saveGUIParams()
nppGUI._userDefineDlgStatus = (b?UDD_DOCKED:0) | (udd->isVisible()?UDD_SHOW:0); nppGUI._userDefineDlgStatus = (b?UDD_DOCKED:0) | (udd->isVisible()?UDD_SHOW:0);
// Save the position // Save the position
/*
WINDOWPLACEMENT posInfo;
nppGUI._isMaximized = IsZoomed(_pPublicInterface->getHSelf()) != 0;
if(nppGUI._isMaximized)
{
// When window is maximized GetWindowPlacement returns window's last non maximized coordinates.
// Save them so that those will be used when window is restored next time.
WINDOWPLACEMENT posInfo;
posInfo.length = sizeof(WINDOWPLACEMENT); posInfo.length = sizeof(WINDOWPLACEMENT);
::GetWindowPlacement(_pPublicInterface->getHSelf(), &posInfo); ::GetWindowPlacement(_pPublicInterface->getHSelf(), &posInfo);
@ -722,8 +727,9 @@ bool Notepad_plus::saveGUIParams()
nppGUI._appPos.top = posInfo.rcNormalPosition.top; nppGUI._appPos.top = posInfo.rcNormalPosition.top;
nppGUI._appPos.right = posInfo.rcNormalPosition.right - posInfo.rcNormalPosition.left; nppGUI._appPos.right = posInfo.rcNormalPosition.right - posInfo.rcNormalPosition.left;
nppGUI._appPos.bottom = posInfo.rcNormalPosition.bottom - posInfo.rcNormalPosition.top; nppGUI._appPos.bottom = posInfo.rcNormalPosition.bottom - posInfo.rcNormalPosition.top;
nppGUI._isMaximized = (IsZoomed(_pPublicInterface->getHSelf()) || (posInfo.flags & WPF_RESTORETOMAXIMIZED)); }
*/ else
{
// There is some discontinuity in position values that are coming from GetWindowPlacement when window // There is some discontinuity in position values that are coming from GetWindowPlacement when window
// is on secondary screen and Windows taskbar is on left side of the screen. Use GetWindowRect instead. // is on secondary screen and Windows taskbar is on left side of the screen. Use GetWindowRect instead.
RECT pos; RECT pos;
@ -733,7 +739,7 @@ bool Notepad_plus::saveGUIParams()
nppGUI._appPos.top = pos.top; nppGUI._appPos.top = pos.top;
nppGUI._appPos.right = pos.right - pos.left; nppGUI._appPos.right = pos.right - pos.left;
nppGUI._appPos.bottom = pos.bottom - pos.top; nppGUI._appPos.bottom = pos.bottom - pos.top;
}
saveDockingParams(); saveDockingParams();
return (NppParameters::getInstance())->writeGUIParams(); return (NppParameters::getInstance())->writeGUIParams();