Commit eef9e1ab authored by Lei Zhang's avatar Lei Zhang Committed by Alexandre Julliard

comdlg32: Move file dialog resizing code into its own function.

parent 7dd98bb9
......@@ -181,6 +181,7 @@ static const char LookInInfosStr[] = "LookInInfos"; /* LOOKIN combo box property
*/
/* Internal functions used by the dialog */
static LRESULT FILEDLG95_ResizeControls(HWND hwnd, WPARAM wParam, LPARAM lParam);
static LRESULT FILEDLG95_FillControls(HWND hwnd, WPARAM wParam, LPARAM lParam);
static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam, LPARAM lParam);
static LRESULT FILEDLG95_OnWMGetIShellBrowser(HWND hwnd);
......@@ -1042,30 +1043,7 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
fodInfos->DlgInfos.hwndCustomDlg =
CreateTemplateDialog((FileOpenDlgInfos *)lParam, hwnd);
if (fodInfos->DlgInfos.hwndCustomDlg)
{
RECT rc;
UINT flags = SWP_NOACTIVATE;
ArrangeCtrlPositions(fodInfos->DlgInfos.hwndCustomDlg, hwnd,
(fodInfos->ofnInfos->Flags & (OFN_HIDEREADONLY | OFN_SHOWHELP)) == OFN_HIDEREADONLY);
/* resize the custom dialog to the parent size */
if (fodInfos->ofnInfos->Flags & (OFN_ENABLETEMPLATE | OFN_ENABLETEMPLATEHANDLE))
GetClientRect(hwnd, &rc);
else
{
/* our own fake template is zero sized and doesn't have
* children, so there is no need to resize it.
* Picasa depends on it.
*/
flags |= SWP_NOSIZE;
SetRectEmpty(&rc);
}
SetWindowPos(fodInfos->DlgInfos.hwndCustomDlg, HWND_BOTTOM,
0, 0, rc.right, rc.bottom, flags);
}
FILEDLG95_ResizeControls(hwnd, wParam, lParam);
FILEDLG95_FillControls(hwnd, wParam, lParam);
SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE);
......@@ -1440,24 +1418,6 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
EnableWindow(GetDlgItem(hwnd, pshHelp), FALSE);
}
/* Resize the height, if open as read only checkbox ad help button
are hidden and we are not using a custom template nor a customDialog
*/
if ( (fodInfos->ofnInfos->Flags & OFN_HIDEREADONLY) &&
(!(fodInfos->ofnInfos->Flags &
(OFN_SHOWHELP|OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE))) &&
(!fodInfos->DlgInfos.hwndCustomDlg ))
{
RECT rectDlg, rectHelp, rectCancel;
GetWindowRect(hwnd, &rectDlg);
GetWindowRect(GetDlgItem(hwnd, pshHelp), &rectHelp);
GetWindowRect(GetDlgItem(hwnd, IDCANCEL), &rectCancel);
/* subtract the height of the help button plus the space between
the help button and the cancel button to the height of the dialog */
SetWindowPos(hwnd, 0, 0, 0, rectDlg.right-rectDlg.left,
(rectDlg.bottom-rectDlg.top) - (rectHelp.bottom - rectCancel.bottom),
SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
}
/* change Open to Save */
if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
{
......@@ -1471,6 +1431,61 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
}
/***********************************************************************
* FILEDLG95_ResizeControls
*
* WM_INITDIALOG message handler (after hook notification)
*/
static LRESULT FILEDLG95_ResizeControls(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam;
if (fodInfos->DlgInfos.hwndCustomDlg)
{
RECT rc;
UINT flags = SWP_NOACTIVATE;
ArrangeCtrlPositions(fodInfos->DlgInfos.hwndCustomDlg, hwnd,
(fodInfos->ofnInfos->Flags & (OFN_HIDEREADONLY | OFN_SHOWHELP)) == OFN_HIDEREADONLY);
/* resize the custom dialog to the parent size */
if (fodInfos->ofnInfos->Flags & (OFN_ENABLETEMPLATE | OFN_ENABLETEMPLATEHANDLE))
GetClientRect(hwnd, &rc);
else
{
/* our own fake template is zero sized and doesn't have children, so
* there is no need to resize it. Picasa depends on it.
*/
flags |= SWP_NOSIZE;
SetRectEmpty(&rc);
}
SetWindowPos(fodInfos->DlgInfos.hwndCustomDlg, HWND_BOTTOM,
0, 0, rc.right, rc.bottom, flags);
}
else
{
/* Resize the height, if open as read only checkbox ad help button are
* hidden and we are not using a custom template nor a customDialog
*/
if ( (fodInfos->ofnInfos->Flags & OFN_HIDEREADONLY) &&
(!(fodInfos->ofnInfos->Flags &
(OFN_SHOWHELP|OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE))))
{
RECT rectDlg, rectHelp, rectCancel;
GetWindowRect(hwnd, &rectDlg);
GetWindowRect(GetDlgItem(hwnd, pshHelp), &rectHelp);
GetWindowRect(GetDlgItem(hwnd, IDCANCEL), &rectCancel);
/* subtract the height of the help button plus the space between the help
* button and the cancel button to the height of the dialog
*/
SetWindowPos(hwnd, 0, 0, 0, rectDlg.right-rectDlg.left,
(rectDlg.bottom-rectDlg.top) - (rectHelp.bottom - rectCancel.bottom),
SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
}
}
return TRUE;
}
/***********************************************************************
* FILEDLG95_FillControls
*
* WM_INITDIALOG message handler (after hook notification)
......
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