1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-16 08:10:25 +02:00

Allow the user to make the FileDialog smaller after enlarging it.

See http://bugzilla.audacityteam.org/show_bug.cgi?id=1110#c6 for
a bit more info.
This commit is contained in:
Leland Lucius 2015-08-24 23:46:04 -05:00
parent 6944ae9dff
commit 75ee0becd1
2 changed files with 36 additions and 0 deletions

View File

@ -170,6 +170,11 @@ UINT_PTR FileDialog::MSWParentHook(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM l
MSWOnSize(mParentDlg, pOfn); MSWOnSize(mParentDlg, pOfn);
} }
if (iMsg == WM_GETMINMAXINFO)
{
MSWOnGetMinMaxInfo(mParentDlg, pOfn, reinterpret_cast<LPMINMAXINFO>(lParam));
}
return ret; return ret;
} }
@ -198,6 +203,35 @@ void FileDialog::MSWOnSize(HWND hDlg, LPOPENFILENAME pOfn)
SetHWND(NULL); SetHWND(NULL);
} }
// Capture the minimum dialog size by saving the first non-zero size.
//
// We get called multiple times:
//
// The first, ptMinTrackSize will be {0, 0}.
//
// The second, ptMinTrackSize will be the absolute minimum to contain all controls. This is
// the POINT we will use to override the subsequent calls.
//
// Additional calls are made when the user resizes the dialog and for some unknown reason the
// the common dialog control doesn't let the user resize the dialog smaller than it was the
// last time the dialog was used. This information is kept in:
//
// HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\CIDSizeMRU
//
// So, we override the minimum size supplied by the common dialog control with the captured
// size from the second call.
void FileDialog::MSWOnGetMinMaxInfo(HWND hwnd, LPOPENFILENAME pOfn, LPMINMAXINFO pMmi)
{
if (mMinSize.x > 0 && mMinSize.y > 0)
{
pMmi->ptMinTrackSize = mMinSize;
}
else
{
mMinSize = pMmi->ptMinTrackSize;
}
}
UINT_PTR APIENTRY FileDialog::DialogHook(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam) UINT_PTR APIENTRY FileDialog::DialogHook(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
{ {
OPENFILENAME *pOfn; OPENFILENAME *pOfn;

View File

@ -64,6 +64,7 @@ private:
// Message handlers for the parent dialog // Message handlers for the parent dialog
virtual void MSWOnSize(HWND hwnd, LPOPENFILENAME pOfn); virtual void MSWOnSize(HWND hwnd, LPOPENFILENAME pOfn);
virtual void MSWOnGetMinMaxInfo(HWND hwnd, LPOPENFILENAME pOfn, LPMINMAXINFO pMmi);
// Child dialog hook // Child dialog hook
static UINT_PTR APIENTRY DialogHook(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam); static UINT_PTR APIENTRY DialogHook(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam);
@ -93,6 +94,7 @@ private:
HWND mParentDlg; HWND mParentDlg;
HWND mChildDlg; HWND mChildDlg;
WNDPROC mParentProc; WNDPROC mParentProc;
POINT mMinSize;
wxPanel *mRoot; wxPanel *mRoot;