Module: wine Branch: master Commit: 1b41bafa07074c338e19e5e95bbcec0ece9f4129 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1b41bafa07074c338e19e5e95b...
Author: Rein Klazes wijn@online.nl Date: Fri Jul 10 10:07:48 2009 +0200
comdlg32: Memorize and restore the size of the file dialog between calls.
Includes some fine tuning to fix a couple of todo's in the tests.
---
dlls/comdlg32/filedlg.c | 25 +++++++++++++++++-------- dlls/comdlg32/tests/filedlg.c | 19 ++++++++++--------- 2 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index faed51a..041d75c 100644 --- a/dlls/comdlg32/filedlg.c +++ b/dlls/comdlg32/filedlg.c @@ -172,6 +172,7 @@ typedef struct tagFD32_PRIVATE
const char FileOpenDlgInfosStr[] = "FileOpenDlgInfos"; /* windows property description string */ static const char LookInInfosStr[] = "LookInInfos"; /* LOOKIN combo box property */ +static SIZE MemDialogSize = { 0, 0}; /* keep size of the (resizable) dialog */
/*********************************************************************** * Prototypes @@ -1197,13 +1198,14 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l if( fodInfos->DlgInfos.hwndCustomDlg) ShowWindow( fodInfos->DlgInfos.hwndCustomDlg, SW_SHOW);
- if(fodInfos->ofnInfos->Flags & OFN_EXPLORER) + if(fodInfos->ofnInfos->Flags & OFN_EXPLORER) { SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE); + SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE); + }
if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING) { GetWindowRect( hwnd, &rc); - /* FIXME: should remember sizes of last invocation */ fodInfos->sizedlg.cx = rc.right - rc.left; fodInfos->sizedlg.cy = rc.bottom - rc.top; fodInfos->initial_size.x = fodInfos->sizedlg.cx; @@ -1212,13 +1214,16 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l SetWindowPos( fodInfos->DlgInfos.hwndGrip, NULL, rc.right - gripx, rc.bottom - gripy, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER); + /* resize the dialog to the previous invocation */ + if( MemDialogSize.cx && MemDialogSize.cy) + SetWindowPos( hwnd, NULL, + 0, 0, MemDialogSize.cx, MemDialogSize.cy, + SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER); }
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER) - { - SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE); SendCustomDlgNotificationMessage(hwnd,CDN_SELCHANGE); - } + return 0; } case WM_SIZE: @@ -1242,9 +1247,13 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l return FILEDLG95_OnWMGetIShellBrowser(hwnd);
case WM_DESTROY: - RemovePropA(hwnd, FileOpenDlgInfosStr); - return FALSE; - + { + FileOpenDlgInfos * fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + if (fodInfos && fodInfos->ofnInfos->Flags & OFN_ENABLESIZING) + MemDialogSize = fodInfos->sizedlg; + RemovePropA(hwnd, FileOpenDlgInfosStr); + return FALSE; + } case WM_NOTIFY: { LPNMHDR lpnmh = (LPNMHDR)lParam; diff --git a/dlls/comdlg32/tests/filedlg.c b/dlls/comdlg32/tests/filedlg.c index e81d054..63375bb 100644 --- a/dlls/comdlg32/tests/filedlg.c +++ b/dlls/comdlg32/tests/filedlg.c @@ -273,8 +273,8 @@ static void test_create_view_template(void) /* test cases for resizing of the file dialog */ struct { DWORD flags; - int resize_init; /* change in CDN_INITDONE handler */ - int resize_folderchg; /* change in CDN_FOLDERCHANGE handler */ + int resize_folderchange; /* change in CDN_FOLDERCHANGE handler */ + int resize_selchange; /* change in CDN_SELCHANGE handler */ int resize_timer1; /* change in first WM_TIMER handler */ int resize_check; /* expected change (in second WM_TIMER handler) */ BOOL todo; /* mark that test todo_wine */ @@ -285,10 +285,11 @@ struct { { OFN_ENABLESIZING , 0, 0, 0, 0,FALSE,FALSE}, { OFN_ENABLESIZING , 0, 0,-10, 0,FALSE,FALSE}, { OFN_ENABLESIZING , 0, 0, 10, 10,FALSE, TRUE}, - { OFN_ENABLESIZING , 0,-10, 0, 10, TRUE,FALSE}, /* 5 */ + { OFN_ENABLESIZING , 0,-10, 0, 0,FALSE,FALSE}, /* 5 */ { OFN_ENABLESIZING , 0, 10, 0, 10,FALSE,FALSE}, - { OFN_ENABLESIZING ,-10, 0, 0, 10, TRUE,FALSE}, + { OFN_ENABLESIZING ,-10, 0, 0, 10,FALSE,FALSE}, { OFN_ENABLESIZING , 10, 0, 0, 10,FALSE,FALSE}, + { OFN_ENABLESIZING , 0, 0, 10, 20,FALSE,FALSE}, /* mark the end */ { 0xffffffff } }; @@ -331,14 +332,14 @@ static LONG_PTR WINAPI resize_template_hook(HWND dlg, UINT msg, WPARAM wParam, L } case WM_NOTIFY: { - if(( (LPNMHDR)lParam)->code == CDN_INITDONE){ + if(( (LPNMHDR)lParam)->code == CDN_FOLDERCHANGE){ GetWindowRect( parent, &initrc); - if( (resize = resize_testcases[index].resize_init)){ + if( (resize = resize_testcases[index].resize_folderchange)){ MoveWindow( parent, initrc.left,initrc.top, initrc.right - initrc.left + resize, initrc.bottom - initrc.top + resize, TRUE); } - } else if(( (LPNMHDR)lParam)->code == CDN_FOLDERCHANGE){ - if( (resize = resize_testcases[index].resize_folderchg)){ + } else if(( (LPNMHDR)lParam)->code == CDN_SELCHANGE){ + if( (resize = resize_testcases[index].resize_selchange)){ GetWindowRect( parent, &rc); MoveWindow( parent, rc.left,rc.top, rc.right - rc.left + resize, rc.bottom - rc.top + resize, TRUE); @@ -619,7 +620,7 @@ static void test_ok(void) int i; DWORD ret;
- if (!GetTempFileNameA(".", "tmp", 0, tmpfilename)) { + if (!GetTempFileNameA(".", "txt", 0, tmpfilename)) { skip("Failed to create a temporary file name\n"); return; }