From 0688aec488ea2d1b3d668fdbea10b0eec544a5e7 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 4 Jun 2017 01:52:26 +0000 Subject: [PATCH] [COMDLG32] Sync with Wine Staging 2.9. CORE-13362 6d3243c comdlg32: Postpone setting ofn->lpstrFileTitle to work around an application bug. 3c33ebd comdlg32: Use existing symbol for Help button id. 5d9ab56 comdlg32: Select the correct font before querying the extents. e77771c comdlg32: Set the radiobuttons' font if they're part of a visual group. 0099452 comdlg32: Use pixel sizes throughout. 6df0198 comdlg32: Scale the control size limits with dpi. 6891b5a comdlg32: Don't ask for icon information since it's unused. a44a608 comdlg32: Take nMaxFile into account when converting A->W. b47de18 comdlg32: Use GetPropW() to get to file dialog data. c23a91c comdlg32: Consolidate file dialog initialization to avoid duplication. aef8433 comdlg32: Expand initial directory path for file open dialog. svn path=/trunk/; revision=74891 --- reactos/dll/win32/comdlg32/colordlg.c | 4 +- reactos/dll/win32/comdlg32/filedlg.c | 468 +++++++++----------- reactos/dll/win32/comdlg32/filedlgbrowser.c | 16 +- reactos/dll/win32/comdlg32/filedlgbrowser.h | 2 +- reactos/dll/win32/comdlg32/itemdlg.c | 91 ++-- reactos/media/doc/README.WINE | 2 +- 6 files changed, 280 insertions(+), 303 deletions(-) diff --git a/reactos/dll/win32/comdlg32/colordlg.c b/reactos/dll/win32/comdlg32/colordlg.c index 4ad3ca9580c..7a01e47c829 100644 --- a/reactos/dll/win32/comdlg32/colordlg.c +++ b/reactos/dll/win32/comdlg32/colordlg.c @@ -853,7 +853,7 @@ static LRESULT CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam ) SetPropW( hDlg, szColourDialogProp, lpp ); if (!(lpp->lpcc->Flags & CC_SHOWHELP)) - ShowWindow( GetDlgItem(hDlg,0x40e), SW_HIDE); + ShowWindow(GetDlgItem(hDlg, pshHelp), SW_HIDE); lpp->msetrgb = RegisterWindowMessageA(SETRGBSTRINGA); #if 0 @@ -1029,7 +1029,7 @@ static LRESULT CC_WMCommand(CCPRIV *lpp, WPARAM wParam, LPARAM lParam, WORD noti CC_PaintTriangle(lpp); break; - case 0x40e: /* Help! */ /* The Beatles, 1965 ;-) */ + case pshHelp: /* Help! */ /* The Beatles, 1965 ;-) */ i = RegisterWindowMessageA(HELPMSGSTRINGA); if (lpp->lpcc->hwndOwner) SendMessageA(lpp->lpcc->hwndOwner, i, 0, (LPARAM)lpp->lpcc); diff --git a/reactos/dll/win32/comdlg32/filedlg.c b/reactos/dll/win32/comdlg32/filedlg.c index 2b290e307b7..c176eb652be 100644 --- a/reactos/dll/win32/comdlg32/filedlg.c +++ b/reactos/dll/win32/comdlg32/filedlg.c @@ -133,7 +133,6 @@ typedef struct tagLookInInfo #define CBSetExtendedUI(hwnd,flag) \ SendMessageW(hwnd, CB_SETEXTENDEDUI, (WPARAM)(flag), 0) -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 */ @@ -144,6 +143,13 @@ static const WCHAR LastVisitedMRUW[] = 'L','a','s','t','V','i','s','i','t','e','d','M','R','U',0}; static const WCHAR MRUListW[] = {'M','R','U','L','i','s','t',0}; +static const WCHAR filedlg_info_propnameW[] = {'F','i','l','e','O','p','e','n','D','l','g','I','n','f','o','s',0}; + +FileOpenDlgInfos *get_filedlg_infoptr(HWND hwnd) +{ + return GetPropW(hwnd, filedlg_info_propnameW); +} + /*********************************************************************** * Prototypes */ @@ -289,248 +295,187 @@ static BOOL GetFileName95(FileOpenDlgInfos *fodInfos) return lRes; } -/*********************************************************************** - * GetFileDialog95A - * - * Call GetFileName95 with this structure and clean the memory. - * - * IN : The OPENFILENAMEA initialisation structure passed to - * GetOpenFileNameA win api function (see filedlg.c) - */ -static BOOL GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType) +static WCHAR *heap_strdupAtoW(const char *str) { - BOOL ret; - FileOpenDlgInfos fodInfos; - LPSTR lpstrSavDir = NULL; - LPWSTR title = NULL; - LPWSTR defext = NULL; - LPWSTR filter = NULL; - LPWSTR customfilter = NULL; - INITCOMMONCONTROLSEX icc; - - /* Initialize ComboBoxEx32 */ - icc.dwSize = sizeof(icc); - icc.dwICC = ICC_USEREX_CLASSES; - InitCommonControlsEx(&icc); - - /* Initialize CommDlgExtendedError() */ - COMDLG32_SetCommDlgExtendedError(0); - - /* Initialize FileOpenDlgInfos structure */ - ZeroMemory(&fodInfos, sizeof(FileOpenDlgInfos)); - - /* Pass in the original ofn */ - fodInfos.ofnInfos = (LPOPENFILENAMEW)ofn; - - /* save current directory */ - if (ofn->Flags & OFN_NOCHANGEDIR) - { - lpstrSavDir = MemAlloc(MAX_PATH); - GetCurrentDirectoryA(MAX_PATH, lpstrSavDir); - } + WCHAR *ret; + INT len; - fodInfos.unicode = FALSE; + if (!str) + return NULL; - /* convert all the input strings to unicode */ - if(ofn->lpstrInitialDir) - { - DWORD len = MultiByteToWideChar( CP_ACP, 0, ofn->lpstrInitialDir, -1, NULL, 0 ); - fodInfos.initdir = MemAlloc((len+1)*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, ofn->lpstrInitialDir, -1, fodInfos.initdir, len); - } - else - fodInfos.initdir = NULL; + len = MultiByteToWideChar(CP_ACP, 0, str, -1, 0, 0); + ret = MemAlloc(len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); - if(ofn->lpstrFile) - { - fodInfos.filename = MemAlloc(ofn->nMaxFile*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, ofn->lpstrFile, -1, fodInfos.filename, ofn->nMaxFile); - } - else - fodInfos.filename = NULL; + return ret; +} - if(ofn->lpstrDefExt) - { - DWORD len = MultiByteToWideChar( CP_ACP, 0, ofn->lpstrDefExt, -1, NULL, 0 ); - defext = MemAlloc((len+1)*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, ofn->lpstrDefExt, -1, defext, len); - } - fodInfos.defext = defext; +static void init_filedlg_infoW(OPENFILENAMEW *ofn, FileOpenDlgInfos *info) +{ + INITCOMMONCONTROLSEX icc; - if(ofn->lpstrTitle) - { - DWORD len = MultiByteToWideChar( CP_ACP, 0, ofn->lpstrTitle, -1, NULL, 0 ); - title = MemAlloc((len+1)*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, ofn->lpstrTitle, -1, title, len); - } - fodInfos.title = title; + /* Initialize ComboBoxEx32 */ + icc.dwSize = sizeof(icc); + icc.dwICC = ICC_USEREX_CLASSES; + InitCommonControlsEx(&icc); - if (ofn->lpstrFilter) - { - LPCSTR s; - int n, len; - - /* filter is a list... title\0ext\0......\0\0 */ - s = ofn->lpstrFilter; - while (*s) s = s+strlen(s)+1; - s++; - n = s - ofn->lpstrFilter; - len = MultiByteToWideChar( CP_ACP, 0, ofn->lpstrFilter, n, NULL, 0 ); - filter = MemAlloc(len*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, ofn->lpstrFilter, n, filter, len ); - } - fodInfos.filter = filter; + /* Initialize CommDlgExtendedError() */ + COMDLG32_SetCommDlgExtendedError(0); - /* convert lpstrCustomFilter */ - if (ofn->lpstrCustomFilter) - { - LPCSTR s; - int n, len; - - /* customfilter contains a pair of strings... title\0ext\0 */ - s = ofn->lpstrCustomFilter; - if (*s) s = s+strlen(s)+1; - if (*s) s = s+strlen(s)+1; - n = s - ofn->lpstrCustomFilter; - len = MultiByteToWideChar( CP_ACP, 0, ofn->lpstrCustomFilter, n, NULL, 0 ); - customfilter = MemAlloc(len*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, ofn->lpstrCustomFilter, n, customfilter, len ); - } - fodInfos.customfilter = customfilter; + memset(info, 0, sizeof(*info)); - /* Initialize the dialog property */ - fodInfos.DlgInfos.dwDlgProp = 0; - fodInfos.DlgInfos.hwndCustomDlg = NULL; + /* Pass in the original ofn */ + info->ofnInfos = ofn; - switch(iDlgType) - { - case OPEN_DIALOG : - ret = GetFileName95(&fodInfos); - break; - case SAVE_DIALOG : - fodInfos.DlgInfos.dwDlgProp |= FODPROP_SAVEDLG; - ret = GetFileName95(&fodInfos); - break; - default : - ret = FALSE; - } - - /* set the lpstrFileTitle */ - if (ret && ofn->lpstrFile && ofn->lpstrFileTitle) - { - LPSTR lpstrFileTitle = PathFindFileNameA(ofn->lpstrFile); - lstrcpynA(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle); - } + info->title = ofn->lpstrTitle; + info->defext = ofn->lpstrDefExt; + info->filter = ofn->lpstrFilter; + info->customfilter = ofn->lpstrCustomFilter; - if (lpstrSavDir) - { - SetCurrentDirectoryA(lpstrSavDir); - MemFree(lpstrSavDir); - } - - MemFree(title); - MemFree(defext); - MemFree(filter); - MemFree(customfilter); - MemFree(fodInfos.initdir); - MemFree(fodInfos.filename); + if (ofn->lpstrFile) + { + info->filename = MemAlloc(ofn->nMaxFile * sizeof(WCHAR)); + lstrcpynW(info->filename, ofn->lpstrFile, ofn->nMaxFile); + } - TRACE("selected file: %s\n",ofn->lpstrFile); + if (ofn->lpstrInitialDir) + { + DWORD len = ExpandEnvironmentStringsW(ofn->lpstrInitialDir, NULL, 0); + if (len) + { + info->initdir = MemAlloc(len * sizeof(WCHAR)); + ExpandEnvironmentStringsW(ofn->lpstrInitialDir, info->initdir, len); + } + } - return ret; + info->unicode = TRUE; } -/*********************************************************************** - * GetFileDialog95W - * - * Copy the OPENFILENAMEW structure in a FileOpenDlgInfos structure. - * Call GetFileName95 with this structure and clean the memory. - * - */ -static BOOL GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType) +static void init_filedlg_infoA(OPENFILENAMEA *ofn, FileOpenDlgInfos *info) { - BOOL ret; - FileOpenDlgInfos fodInfos; - LPWSTR lpstrSavDir = NULL; - INITCOMMONCONTROLSEX icc; + OPENFILENAMEW ofnW; + int len; - /* Initialize ComboBoxEx32 */ - icc.dwSize = sizeof(icc); - icc.dwICC = ICC_USEREX_CLASSES; - InitCommonControlsEx(&icc); + ofnW = *(OPENFILENAMEW *)ofn; - /* Initialize CommDlgExtendedError() */ - COMDLG32_SetCommDlgExtendedError(0); + ofnW.lpstrInitialDir = heap_strdupAtoW(ofn->lpstrInitialDir); + ofnW.lpstrDefExt = heap_strdupAtoW(ofn->lpstrDefExt); + ofnW.lpstrTitle = heap_strdupAtoW(ofn->lpstrTitle); - /* Initialize FileOpenDlgInfos structure */ - ZeroMemory(&fodInfos, sizeof(FileOpenDlgInfos)); + if (ofn->lpstrFile) + { + len = MultiByteToWideChar(CP_ACP, 0, ofn->lpstrFile, ofn->nMaxFile, NULL, 0); + ofnW.lpstrFile = MemAlloc(len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, ofn->lpstrFile, ofn->nMaxFile, ofnW.lpstrFile, len); + ofnW.nMaxFile = len; + } - /* Pass in the original ofn */ - fodInfos.ofnInfos = ofn; + if (ofn->lpstrFilter) + { + LPCSTR s; + int n; + + /* filter is a list... title\0ext\0......\0\0 */ + s = ofn->lpstrFilter; + while (*s) s = s+strlen(s)+1; + s++; + n = s - ofn->lpstrFilter; + len = MultiByteToWideChar(CP_ACP, 0, ofn->lpstrFilter, n, NULL, 0); + ofnW.lpstrFilter = MemAlloc(len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, ofn->lpstrFilter, n, (WCHAR *)ofnW.lpstrFilter, len); + } - fodInfos.title = ofn->lpstrTitle; - fodInfos.defext = ofn->lpstrDefExt; - fodInfos.filter = ofn->lpstrFilter; - fodInfos.customfilter = ofn->lpstrCustomFilter; + /* convert lpstrCustomFilter */ + if (ofn->lpstrCustomFilter) + { + int n, len; + LPCSTR s; + + /* customfilter contains a pair of strings... title\0ext\0 */ + s = ofn->lpstrCustomFilter; + if (*s) s = s+strlen(s)+1; + if (*s) s = s+strlen(s)+1; + n = s - ofn->lpstrCustomFilter; + len = MultiByteToWideChar(CP_ACP, 0, ofn->lpstrCustomFilter, n, NULL, 0); + ofnW.lpstrCustomFilter = MemAlloc(len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, ofn->lpstrCustomFilter, n, ofnW.lpstrCustomFilter, len); + } - /* convert string arguments, save others */ - if(ofn->lpstrFile) - { - fodInfos.filename = MemAlloc(ofn->nMaxFile*sizeof(WCHAR)); - lstrcpynW(fodInfos.filename,ofn->lpstrFile,ofn->nMaxFile); - } - else - fodInfos.filename = NULL; + init_filedlg_infoW(&ofnW, info); - if(ofn->lpstrInitialDir) - { - /* fodInfos.initdir = strdupW(ofn->lpstrInitialDir); */ - DWORD len = lstrlenW(ofn->lpstrInitialDir)+1; - fodInfos.initdir = MemAlloc(len*sizeof(WCHAR)); - memcpy(fodInfos.initdir,ofn->lpstrInitialDir,len*sizeof(WCHAR)); - } - else - fodInfos.initdir = NULL; + /* fixup A-specific fields */ + info->ofnInfos = (OPENFILENAMEW *)ofn; + info->unicode = FALSE; - /* save current directory */ - if (ofn->Flags & OFN_NOCHANGEDIR) - { - lpstrSavDir = MemAlloc(MAX_PATH*sizeof(WCHAR)); - GetCurrentDirectoryW(MAX_PATH, lpstrSavDir); - } + /* free what was duplicated */ + MemFree((WCHAR *)ofnW.lpstrInitialDir); + MemFree((WCHAR *)ofnW.lpstrFile); +} - fodInfos.unicode = TRUE; +/*********************************************************************** + * GetFileDialog95 + * + * Call GetFileName95 with this structure and clean the memory. + */ +static BOOL GetFileDialog95(FileOpenDlgInfos *info, UINT dlg_type) +{ + WCHAR *current_dir = NULL; + BOOL ret; - switch(iDlgType) - { - case OPEN_DIALOG : - ret = GetFileName95(&fodInfos); - break; - case SAVE_DIALOG : - fodInfos.DlgInfos.dwDlgProp |= FODPROP_SAVEDLG; - ret = GetFileName95(&fodInfos); - break; - default : - ret = FALSE; - } + /* save current directory */ + if (info->ofnInfos->Flags & OFN_NOCHANGEDIR) + { + current_dir = MemAlloc(MAX_PATH * sizeof(WCHAR)); + GetCurrentDirectoryW(MAX_PATH, current_dir); + } - /* set the lpstrFileTitle */ - if (ret && ofn->lpstrFile && ofn->lpstrFileTitle) - { - LPWSTR lpstrFileTitle = PathFindFileNameW(ofn->lpstrFile); - lstrcpynW(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle); - } + switch (dlg_type) + { + case OPEN_DIALOG: + ret = GetFileName95(info); + break; + case SAVE_DIALOG: + info->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG; + ret = GetFileName95(info); + break; + default: + ret = FALSE; + } - if (lpstrSavDir) - { - SetCurrentDirectoryW(lpstrSavDir); - MemFree(lpstrSavDir); - } + /* set the lpstrFileTitle */ + if (ret && info->ofnInfos->lpstrFile && info->ofnInfos->lpstrFileTitle) + { + if (info->unicode) + { + LPOPENFILENAMEW ofn = info->ofnInfos; + WCHAR *file_title = PathFindFileNameW(ofn->lpstrFile); + lstrcpynW(ofn->lpstrFileTitle, file_title, ofn->nMaxFileTitle); + } + else + { + LPOPENFILENAMEA ofn = (LPOPENFILENAMEA)info->ofnInfos; + char *file_title = PathFindFileNameA(ofn->lpstrFile); + lstrcpynA(ofn->lpstrFileTitle, file_title, ofn->nMaxFileTitle); + } + } - /* restore saved IN arguments and convert OUT arguments back */ - MemFree(fodInfos.filename); - MemFree(fodInfos.initdir); - return ret; + if (current_dir) + { + SetCurrentDirectoryW(current_dir); + MemFree(current_dir); + } + + if (!info->unicode) + { + MemFree((WCHAR *)info->defext); + MemFree((WCHAR *)info->title); + MemFree((WCHAR *)info->filter); + MemFree((WCHAR *)info->customfilter); + } + + MemFree(info->filename); + MemFree(info->initdir); + return ret; } /****************************************************************************** @@ -895,8 +840,8 @@ static HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd) LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode) { + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndParentDlg); LRESULT hook_result = 0; - FileOpenDlgInfos *fodInfos = GetPropA(hwndParentDlg,FileOpenDlgInfosStr); TRACE("%p 0x%04x\n",hwndParentDlg, uCode); @@ -935,7 +880,7 @@ static INT_PTR FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID result { UINT len, total; WCHAR *p, *buffer; - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("CDM_GETFILEPATH:\n"); @@ -975,7 +920,7 @@ static INT_PTR FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID result */ static INT_PTR FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); WCHAR lpstrPath[MAX_PATH]; INT_PTR retval; @@ -1058,7 +1003,7 @@ static INT_PTR FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM */ static LRESULT FILEDLG95_OnWMGetMMI( HWND hwnd, LPMINMAXINFO mmiptr) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); if( !(fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)) return FALSE; if( fodInfos->initial_size.x || fodInfos->initial_size.y) { @@ -1086,7 +1031,7 @@ static LRESULT FILEDLG95_OnWMSize(HWND hwnd, WPARAM wParam) FileOpenDlgInfos *fodInfos; if( wParam != SIZE_RESTORED) return FALSE; - fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + fodInfos = get_filedlg_infoptr(hwnd); if( !(fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)) return FALSE; /* get the new dialog rectangle */ GetWindowRect( hwnd, &rc); @@ -1247,9 +1192,7 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l if (SUCCEEDED(OleInitialize(NULL))) fodInfos->ole_initialized = TRUE; - /* Adds the FileOpenDlgInfos in the property list of the dialog - so it will be easily accessible through a GetPropA(...) */ - SetPropA(hwnd, FileOpenDlgInfosStr, fodInfos); + SetPropW(hwnd, filedlg_info_propnameW, fodInfos); FILEDLG95_InitControls(hwnd); @@ -1359,10 +1302,10 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l case WM_DESTROY: { - FileOpenDlgInfos * fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos * fodInfos = get_filedlg_infoptr(hwnd); if (fodInfos && fodInfos->ofnInfos->Flags & OFN_ENABLESIZING) MemDialogSize = fodInfos->sizedlg; - RemovePropA(hwnd, FileOpenDlgInfosStr); + RemovePropW(hwnd, filedlg_info_propnameW); return FALSE; } case WM_NOTIFY: @@ -1452,7 +1395,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) SHFILEINFOA shFileInfo; ITEMIDLIST *desktopPidl; - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("%p\n", fodInfos); @@ -1879,9 +1822,9 @@ void FILEDLG95_Clean(HWND hwnd) */ static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam) { + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); WORD wNotifyCode = HIWORD(wParam); /* notification code */ WORD wID = LOWORD(wParam); /* item, control, or accelerator identifier */ - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); switch(wID) { @@ -1942,7 +1885,7 @@ static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam) */ static LRESULT FILEDLG95_OnWMGetIShellBrowser(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("\n"); @@ -2000,9 +1943,9 @@ static BOOL FILEDLG95_SendFileOK( HWND hwnd, FileOpenDlgInfos *fodInfos ) */ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCount, UINT sizeUsed) { + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); WCHAR lpstrPathSpec[MAX_PATH] = {0}; UINT nCount, nSizePath; - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); TRACE("\n"); @@ -2429,6 +2372,7 @@ int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf, */ BOOL FILEDLG95_OnOpen(HWND hwnd) { + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); LPWSTR lpstrFileList; UINT nFileCount = 0; UINT sizeUsed = 0; @@ -2436,7 +2380,6 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) WCHAR lpstrPathAndFile[MAX_PATH]; LPSHELLFOLDER lpsf = NULL; int nOpenAction; - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); TRACE("hwnd=%p\n", hwnd); @@ -2798,7 +2741,7 @@ ret: */ static LRESULT FILEDLG95_SHELL_Init(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("\n"); @@ -2833,7 +2776,7 @@ static LRESULT FILEDLG95_SHELL_Init(HWND hwnd) */ static BOOL FILEDLG95_SHELL_ExecuteCommand(HWND hwnd, LPCSTR lpVerb) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); IContextMenu * pcm; TRACE("(%p,%p)\n", hwnd, lpVerb); @@ -2864,7 +2807,7 @@ static BOOL FILEDLG95_SHELL_ExecuteCommand(HWND hwnd, LPCSTR lpVerb) */ static BOOL FILEDLG95_SHELL_UpFolder(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("\n"); @@ -2887,7 +2830,7 @@ static BOOL FILEDLG95_SHELL_UpFolder(HWND hwnd) */ static BOOL FILEDLG95_SHELL_BrowseToDesktop(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); LPITEMIDLIST pidl; HRESULT hres; @@ -2907,7 +2850,7 @@ static BOOL FILEDLG95_SHELL_BrowseToDesktop(HWND hwnd) */ static void FILEDLG95_SHELL_Clean(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("\n"); @@ -2933,7 +2876,7 @@ static void FILEDLG95_SHELL_Clean(HWND hwnd) */ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); int nFilters = 0; /* number of filters */ int nFilterIndexCB; @@ -3048,7 +2991,7 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd) */ static BOOL FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); switch(wNotifyCode) { @@ -3115,7 +3058,7 @@ static int FILEDLG95_FILETYPE_SearchExt(HWND hwnd,LPCWSTR lpstrExt) */ static void FILEDLG95_FILETYPE_Clean(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); int iPos; int iCount = CBGetCount(fodInfos->DlgInfos.hwndFileTypeCB); @@ -3341,7 +3284,7 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct) */ static BOOL FILEDLG95_LOOKIN_OnCommand(HWND hwnd, WORD wNotifyCode) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); TRACE("%p\n", fodInfos); @@ -3417,8 +3360,7 @@ static int FILEDLG95_LOOKIN_AddItem(HWND hwnd,LPITEMIDLIST pidl, int iInsertId) 0, &sfi, sizeof(sfi), - SHGFI_DISPLAYNAME | SHGFI_SYSICONINDEX - | SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_ATTRIBUTES | SHGFI_ATTR_SPECIFIED); + SHGFI_DISPLAYNAME | SHGFI_PIDL | SHGFI_ATTRIBUTES | SHGFI_ATTR_SPECIFIED); TRACE("-- Add %s attr=%08x\n", debugstr_w(sfi.szDisplayName), sfi.dwAttributes); @@ -3587,7 +3529,7 @@ static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd,WPARAM searchArg,int iSearchMet */ static void FILEDLG95_LOOKIN_Clean(HWND hwnd) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); LookInInfos *liInfos = GetPropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr); int iPos; int iCount = CBGetCount(fodInfos->DlgInfos.hwndLookInCB); @@ -3637,7 +3579,7 @@ static FORMATETC get_def_format(void) */ void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd) { - FileOpenDlgInfos *fodInfos; + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); LPITEMIDLIST pidl; LPWSTR lpstrAllFiles, lpstrTmp; UINT nFiles = 0, nFileToOpen, nFileSelected, nAllFilesLength = 0, nThisFileLength, nAllFilesMaxLength; @@ -3646,7 +3588,6 @@ void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd) FORMATETC formatetc = get_def_format(); TRACE("\n"); - fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); if (FAILED(IDataObject_GetData(fodInfos->Shell.FOIDataObject, &formatetc, &medium))) return; @@ -3746,7 +3687,7 @@ static HRESULT COMDLG32_StrRetToStrNW (LPWSTR dest, DWORD len, LPSTRRET src, con */ static int FILEDLG95_FILENAME_GetFileNames (HWND hwnd, LPWSTR * lpstrFileList, UINT * sizeUsed) { - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); UINT nFileCount = 0; /* number of files */ UINT nStrLen = 0; /* length of string in edit control */ LPWSTR lpstrEdit; /* buffer for string from edit control */ @@ -3980,8 +3921,8 @@ static BOOL IsPidlFolder (LPSHELLFOLDER psf, LPCITEMIDLIST pidl) */ static BOOL BrowseSelectedFolder(HWND hwnd) { + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwnd); BOOL bBrowseSelFolder = FALSE; - FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr); TRACE("\n"); @@ -4046,8 +3987,7 @@ static inline BOOL is_win16_looks(DWORD flags) * FALSE on cancel, error, close or filename-does-not-fit-in-buffer. * */ -BOOL WINAPI GetOpenFileNameA( - LPOPENFILENAMEA ofn) /* [in/out] address of init structure */ +BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn) { TRACE("flags %08x\n", ofn->Flags); @@ -4064,7 +4004,12 @@ BOOL WINAPI GetOpenFileNameA( if (is_win16_looks(ofn->Flags)) return GetFileName31A(ofn, OPEN_DIALOG); else - return GetFileDialog95A(ofn, OPEN_DIALOG); + { + FileOpenDlgInfos info; + + init_filedlg_infoA(ofn, &info); + return GetFileDialog95(&info, OPEN_DIALOG); + } } /*********************************************************************** @@ -4077,8 +4022,7 @@ BOOL WINAPI GetOpenFileNameA( * FALSE on cancel, error, close or filename-does-not-fit-in-buffer. * */ -BOOL WINAPI GetOpenFileNameW( - LPOPENFILENAMEW ofn) /* [in/out] address of init structure */ +BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn) { TRACE("flags %08x\n", ofn->Flags); @@ -4095,7 +4039,12 @@ BOOL WINAPI GetOpenFileNameW( if (is_win16_looks(ofn->Flags)) return GetFileName31W(ofn, OPEN_DIALOG); else - return GetFileDialog95W(ofn, OPEN_DIALOG); + { + FileOpenDlgInfos info; + + init_filedlg_infoW(ofn, &info); + return GetFileDialog95(&info, OPEN_DIALOG); + } } @@ -4109,8 +4058,7 @@ BOOL WINAPI GetOpenFileNameW( * FALSE on cancel, error, close or filename-does-not-fit-in-buffer. * */ -BOOL WINAPI GetSaveFileNameA( - LPOPENFILENAMEA ofn) /* [in/out] address of init structure */ +BOOL WINAPI GetSaveFileNameA(OPENFILENAMEA *ofn) { if (!valid_struct_size( ofn->lStructSize )) { @@ -4121,7 +4069,12 @@ BOOL WINAPI GetSaveFileNameA( if (is_win16_looks(ofn->Flags)) return GetFileName31A(ofn, SAVE_DIALOG); else - return GetFileDialog95A(ofn, SAVE_DIALOG); + { + FileOpenDlgInfos info; + + init_filedlg_infoA(ofn, &info); + return GetFileDialog95(&info, SAVE_DIALOG); + } } /*********************************************************************** @@ -4146,7 +4099,12 @@ BOOL WINAPI GetSaveFileNameW( if (is_win16_looks(ofn->Flags)) return GetFileName31W(ofn, SAVE_DIALOG); else - return GetFileDialog95W(ofn, SAVE_DIALOG); + { + FileOpenDlgInfos info; + + init_filedlg_infoW(ofn, &info); + return GetFileDialog95(&info, SAVE_DIALOG); + } } /*********************************************************************** diff --git a/reactos/dll/win32/comdlg32/filedlgbrowser.c b/reactos/dll/win32/comdlg32/filedlgbrowser.c index 71cb5105c5e..6f629649f5a 100644 --- a/reactos/dll/win32/comdlg32/filedlgbrowser.c +++ b/reactos/dll/win32/comdlg32/filedlgbrowser.c @@ -169,8 +169,8 @@ static BOOL COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPCITE */ IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner) { + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndOwner); IShellBrowserImpl *sb; - FileOpenDlgInfos *fodInfos = GetPropA(hwndOwner,FileOpenDlgInfosStr); sb = COMDLG32_SHAlloc(sizeof(IShellBrowserImpl)); @@ -330,7 +330,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, TRACE("(%p)(pidl=%p,flags=0x%08x)\n", This, pidl, wFlags); COMDLG32_DumpSBSPFlags(wFlags); - fodInfos = GetPropA(This->hwndOwner,FileOpenDlgInfosStr); + fodInfos = get_filedlg_infoptr(This->hwndOwner); /* Format the pidl according to its parameter's category */ if(wFlags & SBSP_RELATIVE) @@ -539,7 +539,7 @@ static HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *ifac TRACE("(%p)\n", This); - fodInfos = GetPropA(This->hwndOwner,FileOpenDlgInfosStr); + fodInfos = get_filedlg_infoptr(This->hwndOwner); if(!(*ppshv = fodInfos->Shell.FOIShellView)) { @@ -743,7 +743,7 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDl TRACE("(%p)\n", This); - fodInfos = GetPropA(This->hwndOwner,FileOpenDlgInfosStr); + fodInfos = get_filedlg_infoptr(This->hwndOwner); /* If the selected object is not a folder, send an IDOK command to parent window */ if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1))) @@ -781,7 +781,7 @@ static HRESULT IShellBrowserImpl_OnSelChange(IShellBrowserImpl *This, const IShe { FileOpenDlgInfos *fodInfos; - fodInfos = GetPropA(This->hwndOwner,FileOpenDlgInfosStr); + fodInfos = get_filedlg_infoptr(This->hwndOwner); TRACE("(%p do=%p view=%p)\n", This, fodInfos->Shell.FOIDataObject, fodInfos->Shell.FOIShellView); /* release old selections */ @@ -824,7 +824,7 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBr break; case CDBOSC_KILLFOCUS: { - FileOpenDlgInfos *fodInfos = GetPropA(This->hwndOwner,FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(This->hwndOwner); if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) { WCHAR szSave[16]; @@ -850,7 +850,7 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBr static LRESULT send_includeitem_notification(HWND hwndParentDlg, LPCITEMIDLIST pidl) { LRESULT hook_result = 0; - FileOpenDlgInfos *fodInfos = GetPropA(hwndParentDlg, FileOpenDlgInfosStr); + FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndParentDlg); if(!fodInfos) return 0; @@ -900,7 +900,7 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBr TRACE("(%p)\n", This); - fodInfos = GetPropA(This->hwndOwner,FileOpenDlgInfosStr); + fodInfos = get_filedlg_infoptr(This->hwndOwner); ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK; IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); diff --git a/reactos/dll/win32/comdlg32/filedlgbrowser.h b/reactos/dll/win32/comdlg32/filedlgbrowser.h index dec915b63a1..4ac957eb738 100644 --- a/reactos/dll/win32/comdlg32/filedlgbrowser.h +++ b/reactos/dll/win32/comdlg32/filedlgbrowser.h @@ -136,7 +136,7 @@ void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd) DECLSPEC_HIDDEN; /************************************************************************** * External Prototypes */ -extern const char FileOpenDlgInfosStr[] DECLSPEC_HIDDEN; +extern FileOpenDlgInfos *get_filedlg_infoptr(HWND hwnd) DECLSPEC_HIDDEN; extern IShellFolder* GetShellFolderFromPidl(LPITEMIDLIST pidlAbs) DECLSPEC_HIDDEN; extern LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl) DECLSPEC_HIDDEN; diff --git a/reactos/dll/win32/comdlg32/itemdlg.c b/reactos/dll/win32/comdlg32/itemdlg.c index 5fcbf0755ce..6b5f5db6efe 100644 --- a/reactos/dll/win32/comdlg32/itemdlg.c +++ b/reactos/dll/win32/comdlg32/itemdlg.c @@ -138,7 +138,7 @@ typedef struct FileDialogImpl { LPWSTR custom_filenamelabel; UINT cctrl_width, cctrl_def_height, cctrls_cols; - UINT cctrl_indent; + UINT cctrl_indent, dpi_x, dpi_y; HWND cctrls_hwnd; struct list cctrls; UINT_PTR cctrl_next_dlgid; @@ -864,6 +864,7 @@ static void ctrl_resize(HWND hctrl, UINT min_width, UINT max_width, BOOL multili RECT rc; HDC hdc; WCHAR *c; + HFONT font; TRACE("\n"); @@ -873,7 +874,10 @@ static void ctrl_resize(HWND hctrl, UINT min_width, UINT max_width, BOOL multili SendMessageW(hctrl, WM_GETTEXT, len+1, (LPARAM)text); hdc = GetDC(hctrl); + font = (HFONT)SendMessageW(hctrl, WM_GETFONT, 0, 0); + font = SelectObject(hdc, font); GetTextExtentPoint32W(hdc, text, lstrlenW(text), &size); + SelectObject(hdc, font); ReleaseDC(hctrl, hdc); if(len && multiline) @@ -936,7 +940,7 @@ static void customctrl_resize(FileDialogImpl *This, customctrl *ctrl) { RECT rc; UINT total_height; - UINT max_width; + UINT max_width, size; customctrl *sub_ctrl; switch(ctrl->type) @@ -945,7 +949,8 @@ static void customctrl_resize(FileDialogImpl *This, customctrl *ctrl) case IDLG_CCTRL_COMBOBOX: case IDLG_CCTRL_CHECKBUTTON: case IDLG_CCTRL_TEXT: - ctrl_resize(ctrl->hwnd, 160, 160, TRUE); + size = MulDiv(160, This->dpi_x, USER_DEFAULT_SCREEN_DPI); + ctrl_resize(ctrl->hwnd, size, size, TRUE); GetWindowRect(ctrl->hwnd, &rc); SetWindowPos(ctrl->wrapper_hwnd, NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, SWP_NOZORDER|SWP_NOMOVE); @@ -987,7 +992,8 @@ static void customctrl_resize(FileDialogImpl *This, customctrl *ctrl) LIST_FOR_EACH_ENTRY(item, &ctrl->sub_items, cctrl_item, entry) { - ctrl_resize(item->hwnd, 160, 160, TRUE); + size = MulDiv(160, This->dpi_x, USER_DEFAULT_SCREEN_DPI); + ctrl_resize(item->hwnd, size, size, TRUE); SetWindowPos(item->hwnd, NULL, 0, total_height, 0, 0, SWP_NOZORDER|SWP_NOSIZE); @@ -1202,8 +1208,8 @@ static UINT ctrl_container_resize(FileDialogImpl *This, UINT container_width) UINT cur_col_pos, cur_row_pos; customctrl *ctrl; BOOL fits_height; - static const UINT cspacing = 90; /* Columns are spaced with 90px */ - static const UINT rspacing = 4; /* Rows are spaced with 4 px. */ + UINT cspacing = MulDiv(90, This->dpi_x, USER_DEFAULT_SCREEN_DPI); /* Columns are spaced with 90px */ + UINT rspacing = MulDiv(4, This->dpi_y, USER_DEFAULT_SCREEN_DPI); /* Rows are spaced with 4 px. */ /* Given the new width of the container, this function determines the * needed height of the container and places the controls according to @@ -1316,13 +1322,34 @@ static UINT ctrl_container_resize(FileDialogImpl *This, UINT container_width) return container_height; } +static void ctrl_set_font(customctrl *ctrl, HFONT font) +{ + customctrl *sub_ctrl; + cctrl_item* item; + + SendMessageW(ctrl->hwnd, WM_SETFONT, (WPARAM)font, TRUE); + + LIST_FOR_EACH_ENTRY(sub_ctrl, &ctrl->sub_cctrls, customctrl, sub_cctrls_entry) + { + ctrl_set_font(sub_ctrl, font); + } + + if (ctrl->type == IDLG_CCTRL_RADIOBUTTONLIST) + { + LIST_FOR_EACH_ENTRY(item, &ctrl->sub_items, cctrl_item, entry) + { + SendMessageW(item->hwnd, WM_SETFONT, (WPARAM)font, TRUE); + } + } +} + static void ctrl_container_reparent(FileDialogImpl *This, HWND parent) { LONG wndstyle; if(parent) { - customctrl *ctrl, *sub_ctrl; + customctrl *ctrl; HFONT font; wndstyle = GetWindowLongW(This->cctrls_hwnd, GWL_STYLE); @@ -1340,23 +1367,7 @@ static void ctrl_container_reparent(FileDialogImpl *This, HWND parent) LIST_FOR_EACH_ENTRY(ctrl, &This->cctrls, customctrl, entry) { - if(font) SendMessageW(ctrl->hwnd, WM_SETFONT, (WPARAM)font, TRUE); - - /* If this is a VisualGroup */ - LIST_FOR_EACH_ENTRY(sub_ctrl, &ctrl->sub_cctrls, customctrl, sub_cctrls_entry) - { - if(font) SendMessageW(sub_ctrl->hwnd, WM_SETFONT, (WPARAM)font, TRUE); - } - - if (ctrl->type == IDLG_CCTRL_RADIOBUTTONLIST) - { - cctrl_item* item; - LIST_FOR_EACH_ENTRY(item, &ctrl->sub_items, cctrl_item, entry) - { - if (font) SendMessageW(item->hwnd, WM_SETFONT, (WPARAM)font, TRUE); - } - } - + if(font) ctrl_set_font(ctrl, font); customctrl_resize(This, ctrl); } } @@ -1482,20 +1493,12 @@ static LRESULT CALLBACK radiobuttonlist_proc(HWND hwnd, UINT message, WPARAM wpa static HRESULT init_custom_controls(FileDialogImpl *This) { WNDCLASSW wc; + HDC hdc; static const WCHAR ctrl_container_classname[] = {'i','d','l','g','_','c','o','n','t','a','i','n','e','r','_','p','a','n','e',0}; InitCommonControlsEx(NULL); - This->cctrl_width = 160; /* Controls have a fixed width */ - This->cctrl_indent = 100; - This->cctrl_def_height = 23; - This->cctrls_cols = 0; - - This->cctrl_next_dlgid = 0x2000; - list_init(&This->cctrls); - This->cctrl_active_vg = NULL; - if( !GetClassInfoW(COMDLG32_hInstance, ctrl_container_classname, &wc) ) { wc.style = CS_HREDRAW | CS_VREDRAW; @@ -1519,6 +1522,20 @@ static HRESULT init_custom_controls(FileDialogImpl *This) if(!This->cctrls_hwnd) return E_FAIL; + hdc = GetDC(This->cctrls_hwnd); + This->dpi_x = GetDeviceCaps(hdc, LOGPIXELSX); + This->dpi_y = GetDeviceCaps(hdc, LOGPIXELSY); + ReleaseDC(This->cctrls_hwnd, hdc); + + This->cctrl_width = MulDiv(160, This->dpi_x, USER_DEFAULT_SCREEN_DPI); /* Controls have a fixed width */ + This->cctrl_indent = MulDiv(100, This->dpi_x, USER_DEFAULT_SCREEN_DPI); + This->cctrl_def_height = MulDiv(23, This->dpi_y, USER_DEFAULT_SCREEN_DPI); + This->cctrls_cols = 0; + + This->cctrl_next_dlgid = 0x2000; + list_init(&This->cctrls); + This->cctrl_active_vg = NULL; + SetWindowLongW(This->cctrls_hwnd, GWL_STYLE, WS_TABSTOP); /* Register class for */ @@ -1920,6 +1937,8 @@ static void update_control_text(FileDialogImpl *This) HWND hitem; LPCWSTR custom_okbutton; cctrl_item* item; + UINT min_width = MulDiv(50, This->dpi_x, USER_DEFAULT_SCREEN_DPI); + UINT max_width = MulDiv(250, This->dpi_x, USER_DEFAULT_SCREEN_DPI); if(This->custom_title) SetWindowTextW(This->dlg_hwnd, This->custom_title); @@ -1933,21 +1952,21 @@ static void update_control_text(FileDialogImpl *This) (hitem = GetDlgItem(This->dlg_hwnd, IDOK))) { SetWindowTextW(hitem, custom_okbutton); - ctrl_resize(hitem, 50, 250, FALSE); + ctrl_resize(hitem, min_width, max_width, FALSE); } if(This->custom_cancelbutton && (hitem = GetDlgItem(This->dlg_hwnd, IDCANCEL))) { SetWindowTextW(hitem, This->custom_cancelbutton); - ctrl_resize(hitem, 50, 250, FALSE); + ctrl_resize(hitem, min_width, max_width, FALSE); } if(This->custom_filenamelabel && (hitem = GetDlgItem(This->dlg_hwnd, IDC_FILENAMESTATIC))) { SetWindowTextW(hitem, This->custom_filenamelabel); - ctrl_resize(hitem, 50, 250, FALSE); + ctrl_resize(hitem, min_width, max_width, FALSE); } } diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 4e3d4b61654..01d5752a0f8 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -55,7 +55,7 @@ reactos/dll/win32/cabinet # Synced to WineStaging-2.2 reactos/dll/win32/clusapi # Synced to WineStaging-1.9.11 reactos/dll/win32/comcat # Synced to WineStaging-1.9.11 reactos/dll/win32/comctl32 # Synced to WineStaging-2.2 -reactos/dll/win32/comdlg32 # Synced to WineStaging-2.2 +reactos/dll/win32/comdlg32 # Synced to WineStaging-2.9 reactos/dll/win32/compstui # Synced to WineStaging-2.2 reactos/dll/win32/credui # Synced to WineStaging-2.9 reactos/dll/win32/crypt32 # Synced to WineStaging-2.9 -- 2.17.1