+++ /dev/null
-// TortoiseSVN - a Windows shell extension for easy version control\r
-\r
-// Copyright (C) 2003-2008 - TortoiseSVN\r
-\r
-// This program is free software; you can redistribute it and/or\r
-// modify it under the terms of the GNU General Public License\r
-// as published by the Free Software Foundation; either version 2\r
-// of the License, or (at your option) any later version.\r
-\r
-// This program is distributed in the hope that it will be useful,\r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-// GNU General Public License for more details.\r
-\r
-// You should have received a copy of the GNU General Public License\r
-// along with this program; if not, write to the Free Software Foundation,\r
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
-//\r
-#include "stdafx.h"\r
-#include "Resource.h"\r
-#include "StandAloneDlg.h"\r
-\r
-IMPLEMENT_DYNAMIC(CResizableStandAloneDialog, CStandAloneDialogTmpl<CResizableDialog>)\r
-CResizableStandAloneDialog::CResizableStandAloneDialog(UINT nIDTemplate, CWnd* pParentWnd /*= NULL*/)\r
- : CStandAloneDialogTmpl<CResizableDialog>(nIDTemplate, pParentWnd)\r
- , m_bVertical(false)\r
- , m_bHorizontal(false)\r
-{\r
-}\r
-\r
-BEGIN_MESSAGE_MAP(CResizableStandAloneDialog, CStandAloneDialogTmpl<CResizableDialog>)\r
- ON_WM_SIZING()\r
- ON_WM_MOVING()\r
- ON_WM_NCMBUTTONUP()\r
- ON_WM_NCRBUTTONUP()\r
-END_MESSAGE_MAP()\r
-\r
-void CResizableStandAloneDialog::OnSizing(UINT fwSide, LPRECT pRect)\r
-{\r
- m_bVertical = m_bVertical && (fwSide == WMSZ_LEFT || fwSide == WMSZ_RIGHT);\r
- m_bHorizontal = m_bHorizontal && (fwSide == WMSZ_TOP || fwSide == WMSZ_BOTTOM);\r
- CStandAloneDialogTmpl<CResizableDialog>::OnSizing(fwSide, pRect);\r
-}\r
-\r
-void CResizableStandAloneDialog::OnMoving(UINT fwSide, LPRECT pRect)\r
-{\r
- m_bVertical = m_bHorizontal = false;\r
- CStandAloneDialogTmpl<CResizableDialog>::OnMoving(fwSide, pRect);\r
-}\r
-\r
-void CResizableStandAloneDialog::OnNcMButtonUp(UINT nHitTest, CPoint point) \r
-{\r
- WINDOWPLACEMENT windowPlacement;\r
- if ((nHitTest == HTMAXBUTTON) && GetWindowPlacement(&windowPlacement) && windowPlacement.showCmd == SW_SHOWNORMAL)\r
- {\r
- CRect rcWorkArea, rcWindowRect;\r
- GetWindowRect(&rcWindowRect);\r
- if (m_bVertical)\r
- {\r
- rcWindowRect.top = m_rcOrgWindowRect.top;\r
- rcWindowRect.bottom = m_rcOrgWindowRect.bottom;\r
- }\r
- else if (SystemParametersInfo(SPI_GETWORKAREA, 0U, &rcWorkArea, 0U))\r
- {\r
- m_rcOrgWindowRect.top = rcWindowRect.top;\r
- m_rcOrgWindowRect.bottom = rcWindowRect.bottom;\r
- rcWindowRect.top = rcWorkArea.top;\r
- rcWindowRect.bottom = rcWorkArea.bottom;\r
- }\r
- m_bVertical = !m_bVertical;\r
- m_bHorizontal = m_bHorizontal;\r
- MoveWindow(&rcWindowRect);\r
- }\r
- CStandAloneDialogTmpl<CResizableDialog>::OnNcMButtonUp(nHitTest, point);\r
-}\r
-\r
-void CResizableStandAloneDialog::OnNcRButtonUp(UINT nHitTest, CPoint point) \r
-{\r
- WINDOWPLACEMENT windowPlacement;\r
- if ((nHitTest == HTMAXBUTTON) && GetWindowPlacement(&windowPlacement) && windowPlacement.showCmd == SW_SHOWNORMAL)\r
- {\r
- CRect rcWorkArea, rcWindowRect;\r
- GetWindowRect(&rcWindowRect);\r
- if (m_bHorizontal)\r
- {\r
- rcWindowRect.left = m_rcOrgWindowRect.left;\r
- rcWindowRect.right = m_rcOrgWindowRect.right;\r
- }\r
- else if (SystemParametersInfo(SPI_GETWORKAREA, 0U, &rcWorkArea, 0U))\r
- {\r
- m_rcOrgWindowRect.left = rcWindowRect.left;\r
- m_rcOrgWindowRect.right = rcWindowRect.right;\r
- rcWindowRect.left = rcWorkArea.left;\r
- rcWindowRect.right = rcWorkArea.right;\r
- }\r
- m_bVertical = m_bVertical;\r
- m_bHorizontal = !m_bHorizontal;\r
- MoveWindow(&rcWindowRect);\r
- // WORKAROUND\r
- // for some reasons, when the window is resized horizontally, its menu size is not get adjusted.\r
- // so, we force it to happen.\r
- SetMenu(GetMenu());\r
- }\r
- CStandAloneDialogTmpl<CResizableDialog>::OnNcRButtonUp(nHitTest, point);\r
-}\r