Commit 1a6d8d3c authored by Sven Strickroth's avatar Sven Strickroth

Restore only those parts of the dialog size that are resizable

Based on TortoiseSVN rev. 26922 and 26923.
Signed-off-by: Sven Strickroth's avatarSven Strickroth <email@cs-ware.de>
parent e8e72b57
......@@ -140,7 +140,7 @@ void CResizableDialog::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
// NOTE: this must be called after setting the layout
// to have the dialog and its controls displayed properly
void CResizableDialog::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
void CResizableDialog::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL bHorzResize, BOOL bVertResize)
{
m_sSection = pszSection;
......@@ -148,7 +148,7 @@ void CResizableDialog::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
m_bRectOnly = bRectOnly;
// restore immediately
LoadWindowRect(pszSection, bRectOnly);
LoadWindowRect(pszSection, bRectOnly, bHorzResize, bVertResize);
CMenu* pMenu = GetMenu();
if ( pMenu )
......
......@@ -77,7 +77,7 @@ private:
// callable from derived classes
protected:
// section to use in app's profile
void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE);
void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE, BOOL bHorzResize = TRUE, BOOL bVertResize = TRUE);
virtual CWnd* GetResizableWnd() const
{
......
......@@ -67,7 +67,7 @@ void CResizableFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
// NOTE: this must be called after setting the layout
// to have the view and its controls displayed properly
BOOL CResizableFrame::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
BOOL CResizableFrame::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL bHorzResize, BOOL bVertResize)
{
m_sSection = pszSection;
......@@ -75,7 +75,7 @@ BOOL CResizableFrame::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
m_bRectOnly = bRectOnly;
// restore immediately
return LoadWindowRect(pszSection, bRectOnly);
return LoadWindowRect(pszSection, bRectOnly, bHorzResize, bVertResize);
}
void CResizableFrame::OnDestroy()
......
......@@ -54,7 +54,7 @@ public:
protected:
virtual ~CResizableFrame();
BOOL EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE);
BOOL EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE, BOOL bHorzResize = TRUE, BOOL bVertResize = TRUE);
virtual CWnd* GetResizableWnd() const
{
......
......@@ -87,7 +87,7 @@ void CResizableMDIChild::OnSize(UINT nType, int cx, int cy)
// NOTE: this must be called after setting the layout
// to have the view and its controls displayed properly
BOOL CResizableMDIChild::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
BOOL CResizableMDIChild::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL bHorzResize, BOOL bVertResize)
{
m_sSection = pszSection;
......@@ -95,7 +95,7 @@ BOOL CResizableMDIChild::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
m_bRectOnly = bRectOnly;
// restore immediately
return LoadWindowRect(pszSection, bRectOnly);
return LoadWindowRect(pszSection, bRectOnly, bHorzResize, bVertResize);
}
void CResizableMDIChild::OnDestroy()
......
......@@ -54,7 +54,7 @@ public:
protected:
virtual ~CResizableMDIChild();
BOOL EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE);
BOOL EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE, BOOL bHorzResize = TRUE, BOOL bVertResize = TRUE);
virtual CWnd* GetResizableWnd() const
{
......
......@@ -69,7 +69,7 @@ void CResizableMDIFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
// NOTE: this must be called after setting the layout
// to have the view and its controls displayed properly
BOOL CResizableMDIFrame::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
BOOL CResizableMDIFrame::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL bHorzResize, BOOL bVertResize)
{
m_sSection = pszSection;
......@@ -77,7 +77,7 @@ BOOL CResizableMDIFrame::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
m_bRectOnly = bRectOnly;
// restore immediately
return LoadWindowRect(pszSection, bRectOnly);
return LoadWindowRect(pszSection, bRectOnly, bHorzResize, bVertResize);
}
void CResizableMDIFrame::OnDestroy()
......
......@@ -55,7 +55,7 @@ public:
protected:
virtual ~CResizableMDIFrame();
BOOL EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE);
BOOL EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE, BOOL bHorzResize = TRUE, BOOL bVertResize = TRUE);
virtual CWnd* GetResizableWnd() const
{
......
......@@ -387,7 +387,7 @@ int CResizableSheet::GetMinWidth()
// NOTE: this must be called after all the other settings
// to have the window and its controls displayed properly
void CResizableSheet::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL bWithPage)
void CResizableSheet::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL bWithPage, BOOL bHorzResize, BOOL bVertResize)
{
m_sSection = pszSection;
m_bSavePage = bWithPage;
......@@ -396,7 +396,7 @@ void CResizableSheet::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL
m_bRectOnly = bRectOnly;
// restore immediately
LoadWindowRect(pszSection, bRectOnly);
LoadWindowRect(pszSection, bRectOnly, bHorzResize, bVertResize);
{
LoadPage(pszSection);
ArrangeLayout(); // needs refresh
......
......@@ -91,7 +91,7 @@ protected:
// section to use in app's profile
void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE,
BOOL bWithPage = FALSE);
BOOL bWithPage = FALSE, BOOL bHorzResize = TRUE, BOOL bVertResize = TRUE);
int GetMinWidth(); // minimum width to display all buttons
......
......@@ -493,7 +493,7 @@ int CResizableSheetEx::GetMinWidth()
// NOTE: this must be called after all the other settings
// to have the window and its controls displayed properly
void CResizableSheetEx::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL bWithPage)
void CResizableSheetEx::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL bWithPage, BOOL bHorzResize, BOOL bVertResize)
{
m_sSection = pszSection;
m_bSavePage = bWithPage;
......@@ -502,7 +502,7 @@ void CResizableSheetEx::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BO
m_bRectOnly = bRectOnly;
// restore immediately
LoadWindowRect(pszSection, bRectOnly);
LoadWindowRect(pszSection, bRectOnly, bHorzResize, bVertResize);
if (bWithPage)
{
LoadPage(pszSection);
......
......@@ -98,7 +98,7 @@ protected:
// section to use in app's profile
void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE,
BOOL bWithPage = FALSE);
BOOL bWithPage = FALSE, BOOL bHorzResize = TRUE, BOOL bVertResize = TRUE);
int GetMinWidth(); // minimum width to display all buttons
......
......@@ -99,7 +99,7 @@ BOOL CResizableWndState::SaveWindowRect(LPCTSTR pszName, BOOL bRectOnly)
*
* @return Returns @a TRUE if successful, @a FALSE otherwise
*/
BOOL CResizableWndState::LoadWindowRect(LPCTSTR pszName, BOOL bRectOnly)
BOOL CResizableWndState::LoadWindowRect(LPCTSTR pszName, BOOL bRectOnly, BOOL bHorzResize, BOOL bVertResize)
{
CString data, id;
WINDOWPLACEMENT wp;
......@@ -123,9 +123,9 @@ BOOL CResizableWndState::LoadWindowRect(LPCTSTR pszName, BOOL bRectOnly)
&rc.right, &rc.bottom, &wp.showCmd, &wp.flags,
&wp.ptMinPosition.x, &wp.ptMinPosition.y) == 8)
{
if (rc.bottom - rc.top < min_height)
if ((!bVertResize) || (rc.bottom - rc.top < min_height))
rc.bottom = rc.top + min_height;
if (rc.right - rc.left < min_width)
if ((!bHorzResize) || (rc.right - rc.left < min_width))
rc.right = rc.left + min_width;
if (bRectOnly) // restore size/pos only
{
......
......@@ -45,7 +45,7 @@ class CResizableWndState : public CResizableState
protected:
//! @brief Load and set the window position and size
BOOL LoadWindowRect(LPCTSTR pszName, BOOL bRectOnly);
BOOL LoadWindowRect(LPCTSTR pszName, BOOL bRectOnly, BOOL bHorzResize, BOOL bVertResize);
//! @brief Save the current window position and size
BOOL SaveWindowRect(LPCTSTR pszName, BOOL bRectOnly);
......
......@@ -257,6 +257,13 @@ protected:
m_nResizeBlock = block;
}
void EnableSaveRestore(LPCTSTR pszSection, bool bRectOnly = FALSE)
{
// call the base method with the bHorzResize and bVertResize parameters
// figured out from the resize block flags.
BaseType::EnableSaveRestore(pszSection, bRectOnly, (m_nResizeBlock & DIALOG_BLOCKHORIZONTAL) == 0, (m_nResizeBlock & DIALOG_BLOCKVERTICAL) == 0);
};
protected:
CToolTips m_tooltips;
int m_nResizeBlock;
......@@ -328,16 +335,20 @@ private:
CString m_sSection; // section name (identifies a parent window)
protected:
// section to use in app's profile
void EnableSaveRestore(LPCTSTR pszSection, bool bRectOnly = FALSE)
// overloaded method, but since this dialog class is for non-resizable dialogs,
// the bHorzResize and bVertResize params are ignored and passed as false
// to the base method.
void EnableSaveRestore(LPCTSTR pszSection, bool bRectOnly = FALSE, BOOL bHorzResize = TRUE, BOOL bVertResize = TRUE)
{
UNREFERENCED_PARAMETER(bHorzResize);
UNREFERENCED_PARAMETER(bVertResize);
m_sSection = pszSection;
m_bEnableSaveRestore = true;
m_bRectOnly = bRectOnly;
// restore immediately
LoadWindowRect(pszSection, bRectOnly);
LoadWindowRect(pszSection, bRectOnly, false, false);
};
virtual CWnd* GetResizableWnd() const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment