Commit 6a40d65b authored by Alexandre Julliard's avatar Alexandre Julliard

comdlg32: Scale the shell folder list in the open dialog with the font size.

parent 60b5ae78
...@@ -110,7 +110,6 @@ typedef struct tagLookInInfo ...@@ -110,7 +110,6 @@ typedef struct tagLookInInfo
*/ */
/* Draw item constant */ /* Draw item constant */
#define ICONWIDTH 18
#define XTEXTOFFSET 3 #define XTEXTOFFSET 3
/* AddItem flags*/ /* AddItem flags*/
...@@ -3182,7 +3181,8 @@ static void FILEDLG95_LOOKIN_Init(HWND hwndCombo) ...@@ -3182,7 +3181,8 @@ static void FILEDLG95_LOOKIN_Init(HWND hwndCombo)
IShellFolder *psfRoot, *psfDrives; IShellFolder *psfRoot, *psfDrives;
IEnumIDList *lpeRoot, *lpeDrives; IEnumIDList *lpeRoot, *lpeDrives;
LPITEMIDLIST pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp; LPITEMIDLIST pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp;
HDC hdc;
TEXTMETRICW tm;
LookInInfos *liInfos = MemAlloc(sizeof(LookInInfos)); LookInInfos *liInfos = MemAlloc(sizeof(LookInInfos));
TRACE("\n"); TRACE("\n");
...@@ -3191,10 +3191,15 @@ static void FILEDLG95_LOOKIN_Init(HWND hwndCombo) ...@@ -3191,10 +3191,15 @@ static void FILEDLG95_LOOKIN_Init(HWND hwndCombo)
SetPropA(hwndCombo, LookInInfosStr, liInfos); SetPropA(hwndCombo, LookInInfosStr, liInfos);
hdc = GetDC( hwndCombo );
SelectObject( hdc, (HFONT)SendMessageW( hwndCombo, WM_GETFONT, 0, 0 ));
GetTextMetricsW( hdc, &tm );
ReleaseDC( hwndCombo, hdc );
/* set item height for both text field and listbox */ /* set item height for both text field and listbox */
CBSetItemHeight(hwndCombo,-1,GetSystemMetrics(SM_CYSMICON)); CBSetItemHeight( hwndCombo, -1, max( tm.tmHeight, GetSystemMetrics(SM_CYSMICON) ));
CBSetItemHeight(hwndCombo,0,GetSystemMetrics(SM_CYSMICON)); CBSetItemHeight( hwndCombo, 0, max( tm.tmHeight, GetSystemMetrics(SM_CYSMICON) ));
/* Turn on the extended UI for the combo box like Windows does */ /* Turn on the extended UI for the combo box like Windows does */
CBSetExtendedUI(hwndCombo, TRUE); CBSetExtendedUI(hwndCombo, TRUE);
...@@ -3269,6 +3274,8 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct) ...@@ -3269,6 +3274,8 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct)
TEXTMETRICW tm; TEXTMETRICW tm;
LPSFOLDER tmpFolder; LPSFOLDER tmpFolder;
LookInInfos *liInfos = GetPropA(pDIStruct->hwndItem,LookInInfosStr); LookInInfos *liInfos = GetPropA(pDIStruct->hwndItem,LookInInfosStr);
UINT shgfi_flags = SHGFI_PIDL | SHGFI_OPENICON | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME;
UINT icon_width, icon_height;
TRACE("\n"); TRACE("\n");
...@@ -3280,25 +3287,24 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct) ...@@ -3280,25 +3287,24 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct)
return 0; return 0;
icon_width = GetSystemMetrics(SM_CXICON);
icon_height = GetSystemMetrics(SM_CYICON);
if (pDIStruct->rcItem.bottom - pDIStruct->rcItem.top < icon_height)
{
icon_width = GetSystemMetrics(SM_CXSMICON);
icon_height = GetSystemMetrics(SM_CYSMICON);
shgfi_flags |= SHGFI_SMALLICON;
}
if(pDIStruct->itemID == liInfos->uSelectedItem) if(pDIStruct->itemID == liInfos->uSelectedItem)
{ {
ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem, ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem,
0, 0, &sfi, sizeof (sfi), shgfi_flags );
&sfi,
sizeof (sfi),
SHGFI_PIDL | SHGFI_SMALLICON |
SHGFI_OPENICON | SHGFI_SYSICONINDEX |
SHGFI_DISPLAYNAME );
} }
else else
{ {
ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem, ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem,
0, 0, &sfi, sizeof (sfi), shgfi_flags );
&sfi,
sizeof (sfi),
SHGFI_PIDL | SHGFI_SMALLICON |
SHGFI_SYSICONINDEX |
SHGFI_DISPLAYNAME);
} }
/* Is this item selected ? */ /* Is this item selected ? */
...@@ -3320,11 +3326,7 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct) ...@@ -3320,11 +3326,7 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct)
{ {
iIndentation = 0; iIndentation = 0;
ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem, ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem,
0, 0, &sfi, sizeof (sfi), shgfi_flags );
&sfi,
sizeof (sfi),
SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_OPENICON
| SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME );
} }
else else
...@@ -3334,17 +3336,17 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct) ...@@ -3334,17 +3336,17 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct)
/* Draw text and icon */ /* Draw text and icon */
/* Initialise the icon display area */ /* Initialise the icon display area */
rectIcon.left = pDIStruct->rcItem.left + ICONWIDTH/2 * iIndentation; rectIcon.left = pDIStruct->rcItem.left + 1 + icon_width/2 * iIndentation;
rectIcon.top = pDIStruct->rcItem.top; rectIcon.top = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - icon_height) / 2;
rectIcon.right = rectIcon.left + ICONWIDTH; rectIcon.right = rectIcon.left + icon_width + XTEXTOFFSET;
rectIcon.bottom = pDIStruct->rcItem.bottom; rectIcon.bottom = (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + icon_height) / 2;
/* Initialise the text display area */ /* Initialise the text display area */
GetTextMetricsW(pDIStruct->hDC, &tm); GetTextMetricsW(pDIStruct->hDC, &tm);
rectText.left = rectIcon.right; rectText.left = rectIcon.right;
rectText.top = rectText.top =
(pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - tm.tmHeight) / 2; (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - tm.tmHeight) / 2;
rectText.right = pDIStruct->rcItem.right + XTEXTOFFSET; rectText.right = pDIStruct->rcItem.right;
rectText.bottom = rectText.bottom =
(pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + tm.tmHeight) / 2; (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + tm.tmHeight) / 2;
......
...@@ -452,6 +452,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, ...@@ -452,6 +452,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
/* Set view window control id to 5002 */ /* Set view window control id to 5002 */
SetWindowLongPtrW(hwndView, GWLP_ID, lst2); SetWindowLongPtrW(hwndView, GWLP_ID, lst2);
SendMessageW( hwndView, WM_SETFONT, SendMessageW( GetParent(hwndView), WM_GETFONT, 0, 0 ), FALSE );
/* Select the new folder in the Look In combo box of the Open file dialog */ /* Select the new folder in the Look In combo box of the Open file dialog */
FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent); FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent);
......
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