| 1 | /*
|
|---|
| 2 | * COMMDLG - Font Dialog
|
|---|
| 3 | *
|
|---|
| 4 | * Copyright 1994 Martin Ayotte
|
|---|
| 5 | * Copyright 1996 Albrecht Kleine
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include <ctype.h>
|
|---|
| 9 | #include <stdlib.h>
|
|---|
| 10 | #include <stdio.h>
|
|---|
| 11 | #include <string.h>
|
|---|
| 12 |
|
|---|
| 13 | #ifdef __WIN32OS2__
|
|---|
| 14 | #include <windef.h>
|
|---|
| 15 | #include <winbase.h>
|
|---|
| 16 | #include <wingdi.h>
|
|---|
| 17 | #include <winuser.h>
|
|---|
| 18 | #include <heapstring.h>
|
|---|
| 19 | #include <misc.h>
|
|---|
| 20 | #endif
|
|---|
| 21 |
|
|---|
| 22 | #include "windef.h"
|
|---|
| 23 | #include "winbase.h"
|
|---|
| 24 | #include "wingdi.h"
|
|---|
| 25 | #ifndef __WIN32OS2__
|
|---|
| 26 | #include "wine/winbase16.h"
|
|---|
| 27 | #include "wine/winuser16.h"
|
|---|
| 28 | #endif
|
|---|
| 29 | #include "wine/winestring.h"
|
|---|
| 30 | #include "ldt.h"
|
|---|
| 31 | #include "heap.h"
|
|---|
| 32 | #include "commdlg.h"
|
|---|
| 33 | #include "dialog.h"
|
|---|
| 34 | #include "dlgs.h"
|
|---|
| 35 | #include "module.h"
|
|---|
| 36 | #include "debugtools.h"
|
|---|
| 37 | #ifndef __WIN32OS2__
|
|---|
| 38 | #include "font.h"
|
|---|
| 39 | #endif
|
|---|
| 40 | #include "winproc.h"
|
|---|
| 41 | #include "cderr.h"
|
|---|
| 42 |
|
|---|
| 43 | DEFAULT_DEBUG_CHANNEL(commdlg);
|
|---|
| 44 |
|
|---|
| 45 | #include "cdlg.h"
|
|---|
| 46 |
|
|---|
| 47 | #ifdef __WIN32OS2__
|
|---|
| 48 | static HBITMAP hBitmapTT = 0;
|
|---|
| 49 | #else
|
|---|
| 50 | static HBITMAP16 hBitmapTT = 0;
|
|---|
| 51 | #endif
|
|---|
| 52 |
|
|---|
| 53 | LRESULT WINAPI FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
|
|---|
| 54 | LPARAM lParam);
|
|---|
| 55 | LRESULT WINAPI FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
|
|---|
| 56 | LPARAM lParam);
|
|---|
| 57 |
|
|---|
| 58 | #ifndef __WIN32OS2__
|
|---|
| 59 | LRESULT WINAPI FormatCharDlgProc16(HWND16 hDlg, UINT16 message, WPARAM16 wParam,
|
|---|
| 60 | LPARAM lParam);
|
|---|
| 61 |
|
|---|
| 62 | static void CFn_CHOOSEFONT16to32A(LPCHOOSEFONT16 chf16, LPCHOOSEFONTA chf32a)
|
|---|
| 63 | {
|
|---|
| 64 | chf32a->lStructSize=sizeof(CHOOSEFONTA);
|
|---|
| 65 | chf32a->hwndOwner=chf16->hwndOwner;
|
|---|
| 66 | chf32a->hDC=chf16->hDC;
|
|---|
| 67 | chf32a->iPointSize=chf16->iPointSize;
|
|---|
| 68 | chf32a->Flags=chf16->Flags;
|
|---|
| 69 | chf32a->rgbColors=chf16->rgbColors;
|
|---|
| 70 | chf32a->lCustData=chf16->lCustData;
|
|---|
| 71 | chf32a->lpfnHook=NULL;
|
|---|
| 72 | chf32a->lpTemplateName=PTR_SEG_TO_LIN(chf16->lpTemplateName);
|
|---|
| 73 | chf32a->hInstance=chf16->hInstance;
|
|---|
| 74 | chf32a->lpszStyle=PTR_SEG_TO_LIN(chf16->lpszStyle);
|
|---|
| 75 | chf32a->nFontType=chf16->nFontType;
|
|---|
| 76 | chf32a->nSizeMax=chf16->nSizeMax;
|
|---|
| 77 | chf32a->nSizeMin=chf16->nSizeMin;
|
|---|
| 78 | FONT_LogFont16To32A(PTR_SEG_TO_LIN(chf16->lpLogFont), chf32a->lpLogFont);
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | /***********************************************************************
|
|---|
| 82 | * ChooseFont16 (COMMDLG.15)
|
|---|
| 83 | */
|
|---|
| 84 | BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont)
|
|---|
| 85 | {
|
|---|
| 86 | HINSTANCE16 hInst;
|
|---|
| 87 | HANDLE16 hDlgTmpl16 = 0, hResource16 = 0;
|
|---|
| 88 | HGLOBAL16 hGlobal16 = 0;
|
|---|
| 89 | BOOL16 bRet = FALSE;
|
|---|
| 90 | LPCVOID template;
|
|---|
| 91 | FARPROC16 ptr;
|
|---|
| 92 | CHOOSEFONTA cf32a;
|
|---|
| 93 | LOGFONTA lf32a;
|
|---|
| 94 | SEGPTR lpTemplateName;
|
|---|
| 95 |
|
|---|
| 96 | cf32a.lpLogFont=&lf32a;
|
|---|
| 97 | CFn_CHOOSEFONT16to32A(lpChFont, &cf32a);
|
|---|
| 98 |
|
|---|
| 99 | TRACE("ChooseFont\n");
|
|---|
| 100 | if (!lpChFont) return FALSE;
|
|---|
| 101 |
|
|---|
| 102 | if (lpChFont->Flags & CF_ENABLETEMPLATEHANDLE)
|
|---|
| 103 | {
|
|---|
| 104 | if (!(template = LockResource16( lpChFont->hInstance )))
|
|---|
| 105 | {
|
|---|
| 106 | COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
|---|
| 107 | return FALSE;
|
|---|
| 108 | }
|
|---|
| 109 | }
|
|---|
| 110 | else if (lpChFont->Flags & CF_ENABLETEMPLATE)
|
|---|
| 111 | {
|
|---|
| 112 | HANDLE16 hResInfo;
|
|---|
| 113 | if (!(hResInfo = FindResource16( lpChFont->hInstance,
|
|---|
| 114 | lpChFont->lpTemplateName,
|
|---|
| 115 | RT_DIALOG16)))
|
|---|
| 116 | {
|
|---|
| 117 | COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
|
|---|
| 118 | return FALSE;
|
|---|
| 119 | }
|
|---|
| 120 | if (!(hDlgTmpl16 = LoadResource16( lpChFont->hInstance, hResInfo )) ||
|
|---|
| 121 | !(template = LockResource16( hDlgTmpl16 )))
|
|---|
| 122 | {
|
|---|
| 123 | COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
|---|
| 124 | return FALSE;
|
|---|
| 125 | }
|
|---|
| 126 | }
|
|---|
| 127 | else
|
|---|
| 128 | {
|
|---|
| 129 | HANDLE hResInfo, hDlgTmpl32;
|
|---|
| 130 | LPCVOID template32;
|
|---|
| 131 | DWORD size;
|
|---|
| 132 | if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, "CHOOSE_FONT", RT_DIALOGA)))
|
|---|
| 133 | {
|
|---|
| 134 | COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
|
|---|
| 135 | return FALSE;
|
|---|
| 136 | }
|
|---|
| 137 | if (!(hDlgTmpl32 = LoadResource(COMMDLG_hInstance32, hResInfo)) ||
|
|---|
| 138 | !(template32 = LockResource(hDlgTmpl32)))
|
|---|
| 139 | {
|
|---|
| 140 | COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
|---|
| 141 | return FALSE;
|
|---|
| 142 | }
|
|---|
| 143 | size = SizeofResource(GetModuleHandleA("COMDLG32"), hResInfo);
|
|---|
| 144 | hGlobal16 = GlobalAlloc16(0, size);
|
|---|
| 145 | if (!hGlobal16)
|
|---|
| 146 | {
|
|---|
| 147 | COMDLG32_SetCommDlgExtendedError(CDERR_MEMALLOCFAILURE);
|
|---|
| 148 | ERR("alloc failure for %ld bytes\n", size);
|
|---|
| 149 | return FALSE;
|
|---|
| 150 | }
|
|---|
| 151 | template = GlobalLock16(hGlobal16);
|
|---|
| 152 | if (!template)
|
|---|
| 153 | {
|
|---|
| 154 | COMDLG32_SetCommDlgExtendedError(CDERR_MEMLOCKFAILURE);
|
|---|
| 155 | ERR("global lock failure for %x handle\n", hGlobal16);
|
|---|
| 156 | GlobalFree16(hGlobal16);
|
|---|
| 157 | return FALSE;
|
|---|
| 158 | }
|
|---|
| 159 | ConvertDialog32To16((LPVOID)template32, size, (LPVOID)template);
|
|---|
| 160 | hDlgTmpl16 = hGlobal16;
|
|---|
| 161 |
|
|---|
| 162 | }
|
|---|
| 163 |
|
|---|
| 164 | /* lpTemplateName is not used in the dialog */
|
|---|
| 165 | lpTemplateName=lpChFont->lpTemplateName;
|
|---|
| 166 | lpChFont->lpTemplateName=(SEGPTR)&cf32a;
|
|---|
| 167 |
|
|---|
| 168 | ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (SEGPTR) 16);
|
|---|
| 169 | hInst = GetWindowLongA(lpChFont->hwndOwner, GWL_HINSTANCE);
|
|---|
| 170 | bRet = DialogBoxIndirectParam16(hInst, hDlgTmpl16, lpChFont->hwndOwner,
|
|---|
| 171 | (DLGPROC16) ptr, (DWORD)lpChFont);
|
|---|
| 172 | if (hResource16) FreeResource16(hDlgTmpl16);
|
|---|
| 173 | if (hGlobal16)
|
|---|
| 174 | {
|
|---|
| 175 | GlobalUnlock16(hGlobal16);
|
|---|
| 176 | GlobalFree16(hGlobal16);
|
|---|
| 177 | }
|
|---|
| 178 | lpChFont->lpTemplateName=lpTemplateName;
|
|---|
| 179 | FONT_LogFont32ATo16(cf32a.lpLogFont,
|
|---|
| 180 | (LPLOGFONT16)(PTR_SEG_TO_LIN(lpChFont->lpLogFont)));
|
|---|
| 181 | return bRet;
|
|---|
| 182 | }
|
|---|
| 183 | #endif //!__WIN32OS2__
|
|---|
| 184 |
|
|---|
| 185 | /***********************************************************************
|
|---|
| 186 | * ChooseFontA (COMDLG32.3)
|
|---|
| 187 | */
|
|---|
| 188 | BOOL WINAPI ChooseFontA(LPCHOOSEFONTA lpChFont)
|
|---|
| 189 | {
|
|---|
| 190 | LPCVOID template;
|
|---|
| 191 | HANDLE hResInfo, hDlgTmpl;
|
|---|
| 192 |
|
|---|
| 193 | if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, "CHOOSE_FONT", RT_DIALOGA)))
|
|---|
| 194 | {
|
|---|
| 195 | COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
|
|---|
| 196 | return FALSE;
|
|---|
| 197 | }
|
|---|
| 198 | if (!(hDlgTmpl = LoadResource(COMMDLG_hInstance32, hResInfo )) ||
|
|---|
| 199 | !(template = LockResource( hDlgTmpl )))
|
|---|
| 200 | {
|
|---|
| 201 | COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
|---|
| 202 | return FALSE;
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| 205 | if (lpChFont->Flags & (CF_SELECTSCRIPT | CF_NOVERTFONTS | CF_ENABLETEMPLATE |
|
|---|
| 206 | CF_ENABLETEMPLATEHANDLE)) FIXME(": unimplemented flag (ignored)\n");
|
|---|
| 207 | return DialogBoxIndirectParamA(COMMDLG_hInstance32, template,
|
|---|
| 208 | lpChFont->hwndOwner, (DLGPROC)FormatCharDlgProcA, (LPARAM)lpChFont );
|
|---|
| 209 | }
|
|---|
| 210 |
|
|---|
| 211 | /***********************************************************************
|
|---|
| 212 | * ChooseFontW (COMDLG32.4)
|
|---|
| 213 | */
|
|---|
| 214 | BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
|
|---|
| 215 | {
|
|---|
| 216 | BOOL bRet=FALSE;
|
|---|
| 217 | CHOOSEFONTA cf32a;
|
|---|
| 218 | LOGFONTA lf32a;
|
|---|
| 219 | LPCVOID template;
|
|---|
| 220 | HANDLE hResInfo, hDlgTmpl;
|
|---|
| 221 |
|
|---|
| 222 | if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, "CHOOSE_FONT", RT_DIALOGA)))
|
|---|
| 223 | {
|
|---|
| 224 | COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
|
|---|
| 225 | return FALSE;
|
|---|
| 226 | }
|
|---|
| 227 | if (!(hDlgTmpl = LoadResource(COMMDLG_hInstance32, hResInfo )) ||
|
|---|
| 228 | !(template = LockResource( hDlgTmpl )))
|
|---|
| 229 | {
|
|---|
| 230 | COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
|---|
| 231 | return FALSE;
|
|---|
| 232 | }
|
|---|
| 233 |
|
|---|
| 234 | if (lpChFont->Flags & (CF_SELECTSCRIPT | CF_NOVERTFONTS | CF_ENABLETEMPLATE |
|
|---|
| 235 | CF_ENABLETEMPLATEHANDLE)) FIXME(": unimplemented flag (ignored)\n");
|
|---|
| 236 | memcpy(&cf32a, lpChFont, sizeof(cf32a));
|
|---|
| 237 | memcpy(&lf32a, lpChFont->lpLogFont, sizeof(LOGFONTA));
|
|---|
| 238 | lstrcpynWtoA(lf32a.lfFaceName, lpChFont->lpLogFont->lfFaceName, LF_FACESIZE);
|
|---|
| 239 | cf32a.lpLogFont=&lf32a;
|
|---|
| 240 | cf32a.lpszStyle=HEAP_strdupWtoA(GetProcessHeap(), 0, lpChFont->lpszStyle);
|
|---|
| 241 | lpChFont->lpTemplateName=(LPWSTR)&cf32a;
|
|---|
| 242 | bRet = DialogBoxIndirectParamW(COMMDLG_hInstance32, template,
|
|---|
| 243 | lpChFont->hwndOwner, (DLGPROC)FormatCharDlgProcW, (LPARAM)lpChFont );
|
|---|
| 244 | HeapFree(GetProcessHeap(), 0, cf32a.lpszStyle);
|
|---|
| 245 | lpChFont->lpTemplateName=(LPWSTR)cf32a.lpTemplateName;
|
|---|
| 246 | memcpy(lpChFont->lpLogFont, &lf32a, sizeof(CHOOSEFONTA));
|
|---|
| 247 | lstrcpynAtoW(lpChFont->lpLogFont->lfFaceName, lf32a.lfFaceName, LF_FACESIZE);
|
|---|
| 248 | return bRet;
|
|---|
| 249 | }
|
|---|
| 250 |
|
|---|
| 251 |
|
|---|
| 252 | #define TEXT_EXTRAS 4
|
|---|
| 253 | #define TEXT_COLORS 16
|
|---|
| 254 |
|
|---|
| 255 | static const COLORREF textcolors[TEXT_COLORS]=
|
|---|
| 256 | {
|
|---|
| 257 | 0x00000000L,0x00000080L,0x00008000L,0x00008080L,
|
|---|
| 258 | 0x00800000L,0x00800080L,0x00808000L,0x00808080L,
|
|---|
| 259 | 0x00c0c0c0L,0x000000ffL,0x0000ff00L,0x0000ffffL,
|
|---|
| 260 | 0x00ff0000L,0x00ff00ffL,0x00ffff00L,0x00FFFFFFL
|
|---|
| 261 | };
|
|---|
| 262 |
|
|---|
| 263 | /***********************************************************************
|
|---|
| 264 | * CFn_HookCallChk [internal]
|
|---|
| 265 | */
|
|---|
| 266 | static BOOL CFn_HookCallChk(LPCHOOSEFONT16 lpcf)
|
|---|
| 267 | {
|
|---|
| 268 | if (lpcf)
|
|---|
| 269 | if(lpcf->Flags & CF_ENABLEHOOK)
|
|---|
| 270 | if (lpcf->lpfnHook)
|
|---|
| 271 | return TRUE;
|
|---|
| 272 | return FALSE;
|
|---|
| 273 | }
|
|---|
| 274 |
|
|---|
| 275 | /***********************************************************************
|
|---|
| 276 | * CFn_HookCallChk32 [internal]
|
|---|
| 277 | */
|
|---|
| 278 | static BOOL CFn_HookCallChk32(LPCHOOSEFONTA lpcf)
|
|---|
| 279 | {
|
|---|
| 280 | if (lpcf)
|
|---|
| 281 | if(lpcf->Flags & CF_ENABLEHOOK)
|
|---|
| 282 | if (lpcf->lpfnHook)
|
|---|
| 283 | return TRUE;
|
|---|
| 284 | return FALSE;
|
|---|
| 285 | }
|
|---|
| 286 |
|
|---|
| 287 |
|
|---|
| 288 | /*************************************************************************
|
|---|
| 289 | * AddFontFamily [internal]
|
|---|
| 290 | */
|
|---|
| 291 | static INT AddFontFamily(LPLOGFONTA lplf, UINT nFontType,
|
|---|
| 292 | LPCHOOSEFONTA lpcf, HWND hwnd)
|
|---|
| 293 | {
|
|---|
| 294 | int i;
|
|---|
| 295 | WORD w;
|
|---|
| 296 |
|
|---|
| 297 | TRACE("font=%s (nFontType=%d)\n", lplf->lfFaceName,nFontType);
|
|---|
| 298 |
|
|---|
| 299 | if (lpcf->Flags & CF_FIXEDPITCHONLY)
|
|---|
| 300 | if (!(lplf->lfPitchAndFamily & FIXED_PITCH))
|
|---|
| 301 | return 1;
|
|---|
| 302 | if (lpcf->Flags & CF_ANSIONLY)
|
|---|
| 303 | if (lplf->lfCharSet != ANSI_CHARSET)
|
|---|
| 304 | return 1;
|
|---|
| 305 | if (lpcf->Flags & CF_TTONLY)
|
|---|
| 306 | if (!(nFontType & TRUETYPE_FONTTYPE))
|
|---|
| 307 | return 1;
|
|---|
| 308 |
|
|---|
| 309 | i=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)lplf->lfFaceName);
|
|---|
| 310 | if (i!=CB_ERR)
|
|---|
| 311 | {
|
|---|
| 312 | w=(lplf->lfCharSet << 8) | lplf->lfPitchAndFamily;
|
|---|
| 313 | SendMessageA(hwnd, CB_SETITEMDATA, i, MAKELONG(nFontType,w));
|
|---|
| 314 | return 1 ; /* store some important font information */
|
|---|
| 315 | }
|
|---|
| 316 | else
|
|---|
| 317 | return 0;
|
|---|
| 318 | }
|
|---|
| 319 |
|
|---|
| 320 | typedef struct
|
|---|
| 321 | {
|
|---|
| 322 | HWND hWnd1;
|
|---|
| 323 | HWND hWnd2;
|
|---|
| 324 | LPCHOOSEFONTA lpcf32a;
|
|---|
| 325 | } CFn_ENUMSTRUCT, *LPCFn_ENUMSTRUCT;
|
|---|
| 326 |
|
|---|
| 327 | /*************************************************************************
|
|---|
| 328 | * FontFamilyEnumProc32 [internal]
|
|---|
| 329 | */
|
|---|
| 330 | static INT WINAPI FontFamilyEnumProc(LPENUMLOGFONTA lpEnumLogFont,
|
|---|
| 331 | LPNEWTEXTMETRICA metrics, UINT nFontType, LPARAM lParam)
|
|---|
| 332 | {
|
|---|
| 333 | LPCFn_ENUMSTRUCT e;
|
|---|
| 334 | e=(LPCFn_ENUMSTRUCT)lParam;
|
|---|
| 335 | return AddFontFamily(&lpEnumLogFont->elfLogFont, nFontType, e->lpcf32a, e->hWnd1);
|
|---|
| 336 | }
|
|---|
| 337 |
|
|---|
| 338 | #ifndef __WIN32OS2__
|
|---|
| 339 | /***********************************************************************
|
|---|
| 340 | * FontFamilyEnumProc16 (COMMDLG.19)
|
|---|
| 341 | */
|
|---|
| 342 | INT16 WINAPI FontFamilyEnumProc16( SEGPTR logfont, SEGPTR metrics,
|
|---|
| 343 | UINT16 nFontType, LPARAM lParam )
|
|---|
| 344 | {
|
|---|
| 345 | HWND16 hwnd=LOWORD(lParam);
|
|---|
| 346 | HWND hDlg=GetParent(hwnd);
|
|---|
| 347 | LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER);
|
|---|
| 348 | LOGFONT16 *lplf = (LOGFONT16 *)PTR_SEG_TO_LIN( logfont );
|
|---|
| 349 | LOGFONTA lf32a;
|
|---|
| 350 | FONT_LogFont16To32A(lplf, &lf32a);
|
|---|
| 351 | return AddFontFamily(&lf32a, nFontType, (LPCHOOSEFONTA)lpcf->lpTemplateName,
|
|---|
| 352 | hwnd);
|
|---|
| 353 | }
|
|---|
| 354 | #endif //!__WIN32OS2__
|
|---|
| 355 |
|
|---|
| 356 | /*************************************************************************
|
|---|
| 357 | * SetFontStylesToCombo2 [internal]
|
|---|
| 358 | *
|
|---|
| 359 | * Fill font style information into combobox (without using font.c directly)
|
|---|
| 360 | */
|
|---|
| 361 | static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, LPLOGFONTA lplf)
|
|---|
| 362 | {
|
|---|
| 363 | #define FSTYLES 4
|
|---|
| 364 | struct FONTSTYLE
|
|---|
| 365 | { int italic;
|
|---|
| 366 | int weight;
|
|---|
| 367 | char stname[20]; };
|
|---|
| 368 | static struct FONTSTYLE fontstyles[FSTYLES]={
|
|---|
| 369 | { 0,FW_NORMAL,"Regular"},{0,FW_BOLD,"Bold"},
|
|---|
| 370 | { 1,FW_NORMAL,"Italic"}, {1,FW_BOLD,"Bold Italic"}};
|
|---|
| 371 | HFONT hf;
|
|---|
| 372 | TEXTMETRICA tm;
|
|---|
| 373 | int i,j;
|
|---|
| 374 |
|
|---|
| 375 | for (i=0;i<FSTYLES;i++)
|
|---|
| 376 | {
|
|---|
| 377 | lplf->lfItalic=fontstyles[i].italic;
|
|---|
| 378 | lplf->lfWeight=fontstyles[i].weight;
|
|---|
| 379 | hf=CreateFontIndirectA(lplf);
|
|---|
| 380 | hf=SelectObject(hdc,hf);
|
|---|
| 381 | GetTextMetricsA(hdc,&tm);
|
|---|
| 382 | hf=SelectObject(hdc,hf);
|
|---|
| 383 | DeleteObject(hf);
|
|---|
| 384 |
|
|---|
| 385 | if (tm.tmWeight==fontstyles[i].weight &&
|
|---|
| 386 | tm.tmItalic==fontstyles[i].italic) /* font successful created ? */
|
|---|
| 387 | {
|
|---|
| 388 | #ifdef __WIN32OS2__
|
|---|
| 389 | char *str = fontstyles[i].stname;
|
|---|
| 390 | j=SendMessageA(hwnd,CB_ADDSTRING,0,(LPARAM)str );
|
|---|
| 391 | if (j==CB_ERR) return 1;
|
|---|
| 392 | j=SendMessageA(hwnd, CB_SETITEMDATA, j,
|
|---|
| 393 | MAKELONG(fontstyles[i].weight,fontstyles[i].italic));
|
|---|
| 394 | #else
|
|---|
| 395 | char *str = SEGPTR_STRDUP(fontstyles[i].stname);
|
|---|
| 396 | j=SendMessage16(hwnd,CB_ADDSTRING16,0,(LPARAM)SEGPTR_GET(str) );
|
|---|
| 397 | SEGPTR_FREE(str);
|
|---|
| 398 | if (j==CB_ERR) return 1;
|
|---|
| 399 | j=SendMessage16(hwnd, CB_SETITEMDATA16, j,
|
|---|
| 400 | MAKELONG(fontstyles[i].weight,fontstyles[i].italic));
|
|---|
| 401 | #endif
|
|---|
| 402 | if (j==CB_ERR) return 1;
|
|---|
| 403 | }
|
|---|
| 404 | }
|
|---|
| 405 | return 0;
|
|---|
| 406 | }
|
|---|
| 407 |
|
|---|
| 408 | /*************************************************************************
|
|---|
| 409 | * AddFontSizeToCombo3 [internal]
|
|---|
| 410 | */
|
|---|
| 411 | static int AddFontSizeToCombo3(HWND hwnd, UINT h, LPCHOOSEFONTA lpcf)
|
|---|
| 412 | {
|
|---|
| 413 | int j;
|
|---|
| 414 | char buffer[20];
|
|---|
| 415 |
|
|---|
| 416 | if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
|
|---|
| 417 | ((lpcf->Flags & CF_LIMITSIZE) && (h >= lpcf->nSizeMin) && (h <= lpcf->nSizeMax)))
|
|---|
| 418 | {
|
|---|
| 419 | sprintf(buffer, "%2d", h);
|
|---|
| 420 | j=SendMessageA(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer);
|
|---|
| 421 | if (j==CB_ERR)
|
|---|
| 422 | {
|
|---|
| 423 | j=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)buffer);
|
|---|
| 424 | if (j!=CB_ERR) j = SendMessageA(hwnd, CB_SETITEMDATA, j, h);
|
|---|
| 425 | if (j==CB_ERR) return 1;
|
|---|
| 426 | }
|
|---|
| 427 | }
|
|---|
| 428 | return 0;
|
|---|
| 429 | }
|
|---|
| 430 |
|
|---|
| 431 | /*************************************************************************
|
|---|
| 432 | * SetFontSizesToCombo3 [internal]
|
|---|
| 433 | */
|
|---|
| 434 | static int SetFontSizesToCombo3(HWND hwnd, LPCHOOSEFONTA lpcf)
|
|---|
| 435 | {
|
|---|
| 436 | static const int sizes[]={8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72,0};
|
|---|
| 437 | int i;
|
|---|
| 438 |
|
|---|
| 439 | for (i=0; sizes[i]; i++)
|
|---|
| 440 | if (AddFontSizeToCombo3(hwnd, sizes[i], lpcf)) return 1;
|
|---|
| 441 | return 0;
|
|---|
| 442 | }
|
|---|
| 443 |
|
|---|
| 444 | /***********************************************************************
|
|---|
| 445 | * AddFontStyle [internal]
|
|---|
| 446 | */
|
|---|
| 447 | static INT AddFontStyle(LPLOGFONTA lplf, UINT nFontType,
|
|---|
| 448 | LPCHOOSEFONTA lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg)
|
|---|
| 449 | {
|
|---|
| 450 | int i;
|
|---|
| 451 |
|
|---|
| 452 | TRACE("(nFontType=%d)\n",nFontType);
|
|---|
| 453 | TRACE(" %s h=%ld w=%ld e=%ld o=%ld wg=%ld i=%d u=%d s=%d"
|
|---|
| 454 | " ch=%d op=%d cp=%d q=%d pf=%xh\n",
|
|---|
| 455 | lplf->lfFaceName,lplf->lfHeight,lplf->lfWidth,
|
|---|
| 456 | lplf->lfEscapement,lplf->lfOrientation,
|
|---|
| 457 | lplf->lfWeight,lplf->lfItalic,lplf->lfUnderline,
|
|---|
| 458 | lplf->lfStrikeOut,lplf->lfCharSet, lplf->lfOutPrecision,
|
|---|
| 459 | lplf->lfClipPrecision,lplf->lfQuality, lplf->lfPitchAndFamily);
|
|---|
| 460 | if (nFontType & RASTER_FONTTYPE)
|
|---|
| 461 | {
|
|---|
| 462 | if (AddFontSizeToCombo3(hcmb3, lplf->lfHeight, lpcf)) return 0;
|
|---|
| 463 | } else if (SetFontSizesToCombo3(hcmb3, lpcf)) return 0;
|
|---|
| 464 |
|
|---|
| 465 | if (!SendMessageA(hcmb2, CB_GETCOUNT, 0, 0))
|
|---|
| 466 | {
|
|---|
| 467 | HDC hdc= (lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC) ? lpcf->hDC : GetDC(hDlg);
|
|---|
| 468 | i=SetFontStylesToCombo2(hcmb2,hdc,lplf);
|
|---|
| 469 | if (!(lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC))
|
|---|
| 470 | ReleaseDC(hDlg,hdc);
|
|---|
| 471 | if (i)
|
|---|
| 472 | return 0;
|
|---|
| 473 | }
|
|---|
| 474 | return 1 ;
|
|---|
| 475 |
|
|---|
| 476 | }
|
|---|
| 477 |
|
|---|
| 478 | #ifndef __WIN32OS2__
|
|---|
| 479 | /***********************************************************************
|
|---|
| 480 | * FontStyleEnumProc16 (COMMDLG.18)
|
|---|
| 481 | */
|
|---|
| 482 | INT16 WINAPI FontStyleEnumProc16( SEGPTR logfont, SEGPTR metrics,
|
|---|
| 483 | UINT16 nFontType, LPARAM lParam )
|
|---|
| 484 | {
|
|---|
| 485 | HWND16 hcmb2=LOWORD(lParam);
|
|---|
| 486 | HWND16 hcmb3=HIWORD(lParam);
|
|---|
| 487 | HWND hDlg=GetParent(hcmb3);
|
|---|
| 488 | LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER);
|
|---|
| 489 | LOGFONT16 *lplf = (LOGFONT16 *)PTR_SEG_TO_LIN(logfont);
|
|---|
| 490 | LOGFONTA lf32a;
|
|---|
| 491 | FONT_LogFont16To32A(lplf, &lf32a);
|
|---|
| 492 | return AddFontStyle(&lf32a, nFontType, (LPCHOOSEFONTA)lpcf->lpTemplateName,
|
|---|
| 493 | hcmb2, hcmb3, hDlg);
|
|---|
| 494 | }
|
|---|
| 495 | #endif //!__WIN32OS2__
|
|---|
| 496 |
|
|---|
| 497 | /***********************************************************************
|
|---|
| 498 | * FontStyleEnumProc32 [internal]
|
|---|
| 499 | */
|
|---|
| 500 | static INT WINAPI FontStyleEnumProc( LPENUMLOGFONTA lpFont,
|
|---|
| 501 | LPNEWTEXTMETRICA metrics, UINT nFontType, LPARAM lParam )
|
|---|
| 502 | {
|
|---|
| 503 | LPCFn_ENUMSTRUCT s=(LPCFn_ENUMSTRUCT)lParam;
|
|---|
| 504 | HWND hcmb2=s->hWnd1;
|
|---|
| 505 | HWND hcmb3=s->hWnd2;
|
|---|
| 506 | HWND hDlg=GetParent(hcmb3);
|
|---|
| 507 | return AddFontStyle(&lpFont->elfLogFont, nFontType, s->lpcf32a, hcmb2,
|
|---|
| 508 | hcmb3, hDlg);
|
|---|
| 509 | }
|
|---|
| 510 |
|
|---|
| 511 | /***********************************************************************
|
|---|
| 512 | * CFn_WMInitDialog [internal]
|
|---|
| 513 | */
|
|---|
| 514 | static LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
|
|---|
| 515 | LPCHOOSEFONTA lpcf)
|
|---|
| 516 | {
|
|---|
| 517 | HDC hdc;
|
|---|
| 518 | int i,j,res,init=0;
|
|---|
| 519 | long l;
|
|---|
| 520 | LPLOGFONTA lpxx;
|
|---|
| 521 | HCURSOR hcursor=SetCursor(LoadCursorA(0,IDC_WAITA));
|
|---|
| 522 |
|
|---|
| 523 | SetWindowLongA(hDlg, DWL_USER, lParam);
|
|---|
| 524 | lpxx=lpcf->lpLogFont;
|
|---|
| 525 | TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
|
|---|
| 526 |
|
|---|
| 527 | if (lpcf->lStructSize != sizeof(CHOOSEFONTA))
|
|---|
| 528 | {
|
|---|
| 529 | ERR("structure size failure !!!\n");
|
|---|
| 530 | EndDialog (hDlg, 0);
|
|---|
| 531 | return FALSE;
|
|---|
| 532 | }
|
|---|
| 533 | if (!hBitmapTT)
|
|---|
| 534 | hBitmapTT = LoadBitmapA(0, MAKEINTRESOURCEA(OBM_TRTYPE));
|
|---|
| 535 |
|
|---|
| 536 | /* This font will be deleted by WM_COMMAND */
|
|---|
| 537 | SendDlgItemMessageA(hDlg,stc6,WM_SETFONT,
|
|---|
| 538 | CreateFontA(0, 0, 1, 1, 400, 0, 0, 0, 0, 0, 0, 0, 0, NULL),FALSE);
|
|---|
| 539 |
|
|---|
| 540 | if (!(lpcf->Flags & CF_SHOWHELP) || !IsWindow(lpcf->hwndOwner))
|
|---|
| 541 | ShowWindow(GetDlgItem(hDlg,pshHelp),SW_HIDE);
|
|---|
| 542 | if (!(lpcf->Flags & CF_APPLY))
|
|---|
| 543 | ShowWindow(GetDlgItem(hDlg,psh3),SW_HIDE);
|
|---|
| 544 | if (lpcf->Flags & CF_EFFECTS)
|
|---|
| 545 | {
|
|---|
| 546 | for (res=1,i=0;res && i<TEXT_COLORS;i++)
|
|---|
| 547 | {
|
|---|
| 548 | /* FIXME: load color name from resource: res=LoadString(...,i+....,buffer,.....); */
|
|---|
| 549 | char name[20];
|
|---|
| 550 | strcpy( name, "[color name]" );
|
|---|
| 551 | j=SendDlgItemMessageA(hDlg, cmb4, CB_ADDSTRING, 0, (LPARAM)name);
|
|---|
| 552 | #ifdef __WIN32OS2__
|
|---|
| 553 | SendDlgItemMessageA(hDlg, cmb4, CB_SETITEMDATA, j, textcolors[j]);
|
|---|
| 554 | #else
|
|---|
| 555 | SendDlgItemMessageA(hDlg, cmb4, CB_SETITEMDATA16, j, textcolors[j]);
|
|---|
| 556 | #endif
|
|---|
| 557 | /* look for a fitting value in color combobox */
|
|---|
| 558 | if (textcolors[j]==lpcf->rgbColors)
|
|---|
| 559 | SendDlgItemMessageA(hDlg,cmb4, CB_SETCURSEL,j,0);
|
|---|
| 560 | }
|
|---|
| 561 | }
|
|---|
| 562 | else
|
|---|
| 563 | {
|
|---|
| 564 | ShowWindow(GetDlgItem(hDlg,cmb4),SW_HIDE);
|
|---|
| 565 | ShowWindow(GetDlgItem(hDlg,chx1),SW_HIDE);
|
|---|
| 566 | ShowWindow(GetDlgItem(hDlg,chx2),SW_HIDE);
|
|---|
| 567 | ShowWindow(GetDlgItem(hDlg,grp1),SW_HIDE);
|
|---|
| 568 | ShowWindow(GetDlgItem(hDlg,stc4),SW_HIDE);
|
|---|
| 569 | }
|
|---|
| 570 | hdc= (lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC) ? lpcf->hDC : GetDC(hDlg);
|
|---|
| 571 | if (hdc)
|
|---|
| 572 | {
|
|---|
| 573 | CFn_ENUMSTRUCT s;
|
|---|
| 574 | s.hWnd1=GetDlgItem(hDlg,cmb1);
|
|---|
| 575 | s.lpcf32a=lpcf;
|
|---|
| 576 | if (!EnumFontFamiliesA(hdc, NULL, (FONTENUMPROCA)FontFamilyEnumProc, (LPARAM)&s))
|
|---|
| 577 | TRACE("EnumFontFamilies returns 0\n");
|
|---|
| 578 | if (lpcf->Flags & CF_INITTOLOGFONTSTRUCT)
|
|---|
| 579 | {
|
|---|
| 580 | /* look for fitting font name in combobox1 */
|
|---|
| 581 | j=SendDlgItemMessageA(hDlg,cmb1,CB_FINDSTRING,-1,(LONG)lpxx->lfFaceName);
|
|---|
| 582 | if (j!=CB_ERR)
|
|---|
| 583 | {
|
|---|
| 584 | SendDlgItemMessageA(hDlg, cmb1, CB_SETCURSEL, j, 0);
|
|---|
| 585 | SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE),
|
|---|
| 586 | GetDlgItem(hDlg,cmb1));
|
|---|
| 587 | init=1;
|
|---|
| 588 | /* look for fitting font style in combobox2 */
|
|---|
| 589 | l=MAKELONG(lpxx->lfWeight > FW_MEDIUM ? FW_BOLD:FW_NORMAL,lpxx->lfItalic !=0);
|
|---|
| 590 | for (i=0;i<TEXT_EXTRAS;i++)
|
|---|
| 591 | {
|
|---|
| 592 | if (l==SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, i, 0))
|
|---|
| 593 | SendDlgItemMessageA(hDlg, cmb2, CB_SETCURSEL, i, 0);
|
|---|
| 594 | }
|
|---|
| 595 |
|
|---|
| 596 | /* look for fitting font size in combobox3 */
|
|---|
| 597 | j=SendDlgItemMessageA(hDlg, cmb3, CB_GETCOUNT, 0, 0);
|
|---|
| 598 | for (i=0;i<j;i++)
|
|---|
| 599 | {
|
|---|
| 600 | if (lpxx->lfHeight==(int)SendDlgItemMessageA(hDlg,cmb3, CB_GETITEMDATA,i,0))
|
|---|
| 601 | SendDlgItemMessageA(hDlg,cmb3,CB_SETCURSEL,i,0);
|
|---|
| 602 | }
|
|---|
| 603 | }
|
|---|
| 604 | }
|
|---|
| 605 | if (!init)
|
|---|
| 606 | {
|
|---|
| 607 | SendDlgItemMessageA(hDlg,cmb1,CB_SETCURSEL,0,0);
|
|---|
| 608 | SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE),
|
|---|
| 609 | GetDlgItem(hDlg,cmb1));
|
|---|
| 610 | }
|
|---|
| 611 | if (lpcf->Flags & CF_USESTYLE && lpcf->lpszStyle)
|
|---|
| 612 | {
|
|---|
| 613 | j=SendDlgItemMessageA(hDlg,cmb2,CB_FINDSTRING,-1,(LONG)lpcf->lpszStyle);
|
|---|
| 614 | if (j!=CB_ERR)
|
|---|
| 615 | {
|
|---|
| 616 | j=SendDlgItemMessageA(hDlg,cmb2,CB_SETCURSEL,j,0);
|
|---|
| 617 | SendMessageA(hDlg,WM_COMMAND,cmb2,
|
|---|
| 618 | MAKELONG(GetDlgItem(hDlg,cmb2),CBN_SELCHANGE));
|
|---|
| 619 | }
|
|---|
| 620 | }
|
|---|
| 621 | }
|
|---|
| 622 | else
|
|---|
| 623 | {
|
|---|
| 624 | WARN("HDC failure !!!\n");
|
|---|
| 625 | EndDialog (hDlg, 0);
|
|---|
| 626 | return FALSE;
|
|---|
| 627 | }
|
|---|
| 628 |
|
|---|
| 629 | if (!(lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC))
|
|---|
| 630 | ReleaseDC(hDlg,hdc);
|
|---|
| 631 | SetCursor(hcursor);
|
|---|
| 632 | return TRUE;
|
|---|
| 633 | }
|
|---|
| 634 |
|
|---|
| 635 |
|
|---|
| 636 | /***********************************************************************
|
|---|
| 637 | * CFn_WMMeasureItem [internal]
|
|---|
| 638 | */
|
|---|
| 639 | static LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
|
|---|
| 640 | {
|
|---|
| 641 | BITMAP bm;
|
|---|
| 642 | LPMEASUREITEMSTRUCT lpmi=(LPMEASUREITEMSTRUCT)lParam;
|
|---|
| 643 | if (!hBitmapTT)
|
|---|
| 644 | hBitmapTT = LoadBitmapA(0, MAKEINTRESOURCEA(OBM_TRTYPE));
|
|---|
| 645 | GetObjectA( hBitmapTT, sizeof(bm), &bm );
|
|---|
| 646 | lpmi->itemHeight=bm.bmHeight;
|
|---|
| 647 | /* FIXME: use MAX of bm.bmHeight and tm.tmHeight .*/
|
|---|
| 648 | return 0;
|
|---|
| 649 | }
|
|---|
| 650 |
|
|---|
| 651 |
|
|---|
| 652 | /***********************************************************************
|
|---|
| 653 | * CFn_WMDrawItem [internal]
|
|---|
| 654 | */
|
|---|
| 655 | static LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
|
|---|
| 656 | {
|
|---|
| 657 | HBRUSH hBrush;
|
|---|
| 658 | char buffer[40];
|
|---|
| 659 | BITMAP bm;
|
|---|
| 660 | COLORREF cr, oldText=0, oldBk=0;
|
|---|
| 661 | RECT rect;
|
|---|
| 662 | #if 0
|
|---|
| 663 | HDC hMemDC;
|
|---|
| 664 | int nFontType;
|
|---|
| 665 | HBITMAP hBitmap; /* for later TT usage */
|
|---|
| 666 | #endif
|
|---|
| 667 | LPDRAWITEMSTRUCT lpdi = (LPDRAWITEMSTRUCT)lParam;
|
|---|
| 668 |
|
|---|
| 669 | if (lpdi->itemID == 0xFFFF) /* got no items */
|
|---|
| 670 | DrawFocusRect(lpdi->hDC, &lpdi->rcItem);
|
|---|
| 671 | else
|
|---|
| 672 | {
|
|---|
| 673 | if (lpdi->CtlType == ODT_COMBOBOX)
|
|---|
| 674 | {
|
|---|
| 675 | if (lpdi->itemState ==ODS_SELECTED)
|
|---|
| 676 | {
|
|---|
| 677 | hBrush=GetSysColorBrush(COLOR_HIGHLIGHT);
|
|---|
| 678 | oldText=SetTextColor(lpdi->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
|
|---|
| 679 | oldBk=SetBkColor(lpdi->hDC, GetSysColor(COLOR_HIGHLIGHT));
|
|---|
| 680 | } else
|
|---|
| 681 | {
|
|---|
| 682 | hBrush = SelectObject(lpdi->hDC, GetStockObject(LTGRAY_BRUSH));
|
|---|
| 683 | SelectObject(lpdi->hDC, hBrush);
|
|---|
| 684 | }
|
|---|
| 685 | FillRect(lpdi->hDC, &lpdi->rcItem, hBrush);
|
|---|
| 686 | }
|
|---|
| 687 | else
|
|---|
| 688 | return TRUE; /* this should never happen */
|
|---|
| 689 |
|
|---|
| 690 | rect=lpdi->rcItem;
|
|---|
| 691 | switch (lpdi->CtlID)
|
|---|
| 692 | {
|
|---|
| 693 | case cmb1: /* TRACE(commdlg,"WM_Drawitem cmb1\n"); */
|
|---|
| 694 | SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,
|
|---|
| 695 | (LPARAM)buffer);
|
|---|
| 696 | GetObjectA( hBitmapTT, sizeof(bm), &bm );
|
|---|
| 697 | TextOutA(lpdi->hDC, lpdi->rcItem.left + bm.bmWidth + 10,
|
|---|
| 698 | lpdi->rcItem.top, buffer, strlen(buffer));
|
|---|
| 699 | #if 0
|
|---|
| 700 | nFontType = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);
|
|---|
| 701 | /* FIXME: draw bitmap if truetype usage */
|
|---|
| 702 | if (nFontType&TRUETYPE_FONTTYPE)
|
|---|
| 703 | {
|
|---|
| 704 | hMemDC = CreateCompatibleDC(lpdi->hDC);
|
|---|
| 705 | hBitmap = SelectObject(hMemDC, hBitmapTT);
|
|---|
| 706 | BitBlt(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top,
|
|---|
| 707 | bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
|---|
| 708 | SelectObject(hMemDC, hBitmap);
|
|---|
| 709 | DeleteDC(hMemDC);
|
|---|
| 710 | }
|
|---|
| 711 | #endif
|
|---|
| 712 | break;
|
|---|
| 713 | case cmb2:
|
|---|
| 714 | case cmb3: /* TRACE(commdlg,"WM_DRAWITEN cmb2,cmb3\n"); */
|
|---|
| 715 | SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,
|
|---|
| 716 | (LPARAM)buffer);
|
|---|
| 717 | TextOutA(lpdi->hDC, lpdi->rcItem.left,
|
|---|
| 718 | lpdi->rcItem.top, buffer, strlen(buffer));
|
|---|
| 719 | break;
|
|---|
| 720 |
|
|---|
| 721 | case cmb4: /* TRACE(commdlg,"WM_DRAWITEM cmb4 (=COLOR)\n"); */
|
|---|
| 722 | SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,
|
|---|
| 723 | (LPARAM)buffer);
|
|---|
| 724 | TextOutA(lpdi->hDC, lpdi->rcItem.left + 25+5,
|
|---|
| 725 | lpdi->rcItem.top, buffer, strlen(buffer));
|
|---|
| 726 | cr = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);
|
|---|
| 727 | hBrush = CreateSolidBrush(cr);
|
|---|
| 728 | if (hBrush)
|
|---|
| 729 | {
|
|---|
| 730 | hBrush = SelectObject (lpdi->hDC, hBrush) ;
|
|---|
| 731 | rect.right=rect.left+25;
|
|---|
| 732 | rect.top++;
|
|---|
| 733 | rect.left+=5;
|
|---|
| 734 | rect.bottom--;
|
|---|
| 735 | Rectangle( lpdi->hDC, rect.left, rect.top,
|
|---|
| 736 | rect.right, rect.bottom );
|
|---|
| 737 | DeleteObject( SelectObject (lpdi->hDC, hBrush)) ;
|
|---|
| 738 | }
|
|---|
| 739 | rect=lpdi->rcItem;
|
|---|
| 740 | rect.left+=25+5;
|
|---|
| 741 | break;
|
|---|
| 742 |
|
|---|
| 743 | default: return TRUE; /* this should never happen */
|
|---|
| 744 | }
|
|---|
| 745 | if (lpdi->itemState == ODS_SELECTED)
|
|---|
| 746 | {
|
|---|
| 747 | SetTextColor(lpdi->hDC, oldText);
|
|---|
| 748 | SetBkColor(lpdi->hDC, oldBk);
|
|---|
| 749 | }
|
|---|
| 750 | }
|
|---|
| 751 | return TRUE;
|
|---|
| 752 | }
|
|---|
| 753 |
|
|---|
| 754 | /***********************************************************************
|
|---|
| 755 | * CFn_WMCtlColor [internal]
|
|---|
| 756 | */
|
|---|
| 757 | static LRESULT CFn_WMCtlColorStatic(HWND hDlg, WPARAM wParam, LPARAM lParam,
|
|---|
| 758 | LPCHOOSEFONTA lpcf)
|
|---|
| 759 | {
|
|---|
| 760 | if (lpcf->Flags & CF_EFFECTS)
|
|---|
| 761 | if (GetDlgCtrlID(lParam)==stc6)
|
|---|
| 762 | {
|
|---|
| 763 | SetTextColor((HDC)wParam, lpcf->rgbColors);
|
|---|
| 764 | return GetStockObject(WHITE_BRUSH);
|
|---|
| 765 | }
|
|---|
| 766 | return 0;
|
|---|
| 767 | }
|
|---|
| 768 |
|
|---|
| 769 | /***********************************************************************
|
|---|
| 770 | * CFn_WMCommand [internal]
|
|---|
| 771 | */
|
|---|
| 772 | static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
|
|---|
| 773 | LPCHOOSEFONTA lpcf)
|
|---|
| 774 | {
|
|---|
| 775 | HFONT hFont;
|
|---|
| 776 | int i,j;
|
|---|
| 777 | long l;
|
|---|
| 778 | HDC hdc;
|
|---|
| 779 | LPLOGFONTA lpxx=lpcf->lpLogFont;
|
|---|
| 780 |
|
|---|
| 781 | TRACE("WM_COMMAND wParam=%08lX lParam=%08lX\n", (LONG)wParam, lParam);
|
|---|
| 782 | switch (LOWORD(wParam))
|
|---|
| 783 | {
|
|---|
| 784 | case cmb1:if (HIWORD(wParam)==CBN_SELCHANGE)
|
|---|
| 785 | {
|
|---|
| 786 | hdc=(lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC) ? lpcf->hDC : GetDC(hDlg);
|
|---|
| 787 | if (hdc)
|
|---|
| 788 | {
|
|---|
| 789 | #ifdef __WIN32OS2__
|
|---|
| 790 | SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT, 0, 0);
|
|---|
| 791 | SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT, 0, 0);
|
|---|
| 792 | i=SendDlgItemMessageA(hDlg, cmb1, CB_GETCURSEL, 0, 0);
|
|---|
| 793 | #else
|
|---|
| 794 | SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT16, 0, 0);
|
|---|
| 795 | SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT16, 0, 0);
|
|---|
| 796 | i=SendDlgItemMessageA(hDlg, cmb1, CB_GETCURSEL16, 0, 0);
|
|---|
| 797 | #endif
|
|---|
| 798 | if (i!=CB_ERR)
|
|---|
| 799 | {
|
|---|
| 800 | HCURSOR hcursor=SetCursor(LoadCursorA(0,IDC_WAITA));
|
|---|
| 801 | CFn_ENUMSTRUCT s;
|
|---|
| 802 | char str[256];
|
|---|
| 803 | SendDlgItemMessageA(hDlg, cmb1, CB_GETLBTEXT, i,
|
|---|
| 804 | (LPARAM)str);
|
|---|
| 805 | TRACE("WM_COMMAND/cmb1 =>%s\n",str);
|
|---|
| 806 | s.hWnd1=GetDlgItem(hDlg, cmb2);
|
|---|
| 807 | s.hWnd2=GetDlgItem(hDlg, cmb3);
|
|---|
| 808 | s.lpcf32a=lpcf;
|
|---|
| 809 | EnumFontFamiliesA(hdc, str, (FONTENUMPROCW)FontStyleEnumProc, (LPARAM)&s);
|
|---|
| 810 | SetCursor(hcursor);
|
|---|
| 811 | }
|
|---|
| 812 | if (!(lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC))
|
|---|
| 813 | ReleaseDC(hDlg,hdc);
|
|---|
| 814 | }
|
|---|
| 815 | else
|
|---|
| 816 | {
|
|---|
| 817 | WARN("HDC failure !!!\n");
|
|---|
| 818 | EndDialog (hDlg, 0);
|
|---|
| 819 | return TRUE;
|
|---|
| 820 | }
|
|---|
| 821 | }
|
|---|
| 822 | case chx1:
|
|---|
| 823 | case chx2:
|
|---|
| 824 | case cmb2:
|
|---|
| 825 | case cmb3:if (HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)== BN_CLICKED )
|
|---|
| 826 | {
|
|---|
| 827 | char str[256];
|
|---|
| 828 | TRACE("WM_COMMAND/cmb2,3 =%08lX\n", lParam);
|
|---|
| 829 | i=SendDlgItemMessageA(hDlg,cmb1,CB_GETCURSEL,0,0);
|
|---|
| 830 | if (i==CB_ERR)
|
|---|
| 831 | i=GetDlgItemTextA( hDlg, cmb1, str, 256 );
|
|---|
| 832 | else
|
|---|
| 833 | {
|
|---|
| 834 | SendDlgItemMessageA(hDlg,cmb1,CB_GETLBTEXT,i,
|
|---|
| 835 | (LPARAM)str);
|
|---|
| 836 | l=SendDlgItemMessageA(hDlg,cmb1,CB_GETITEMDATA,i,0);
|
|---|
| 837 | j=HIWORD(l);
|
|---|
| 838 | lpcf->nFontType = LOWORD(l);
|
|---|
| 839 | /* FIXME: lpcf->nFontType |= .... SIMULATED_FONTTYPE and so */
|
|---|
| 840 | /* same value reported to the EnumFonts
|
|---|
| 841 | call back with the extra FONTTYPE_... bits added */
|
|---|
| 842 | lpxx->lfPitchAndFamily=j&0xff;
|
|---|
| 843 | lpxx->lfCharSet=j>>8;
|
|---|
| 844 | }
|
|---|
| 845 | strcpy(lpxx->lfFaceName,str);
|
|---|
| 846 | i=SendDlgItemMessageA(hDlg, cmb2, CB_GETCURSEL, 0, 0);
|
|---|
| 847 | if (i!=CB_ERR)
|
|---|
| 848 | {
|
|---|
| 849 | l=SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, i, 0);
|
|---|
| 850 | if (0!=(lpxx->lfItalic=HIWORD(l)))
|
|---|
| 851 | lpcf->nFontType |= ITALIC_FONTTYPE;
|
|---|
| 852 | if ((lpxx->lfWeight=LOWORD(l)) > FW_MEDIUM)
|
|---|
| 853 | lpcf->nFontType |= BOLD_FONTTYPE;
|
|---|
| 854 | }
|
|---|
| 855 | i=SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0);
|
|---|
| 856 | if (i!=CB_ERR)
|
|---|
| 857 | lpxx->lfHeight=-LOWORD(SendDlgItemMessageA(hDlg, cmb3, CB_GETITEMDATA, i, 0));
|
|---|
| 858 | else
|
|---|
| 859 | lpxx->lfHeight=0;
|
|---|
| 860 | lpxx->lfStrikeOut=IsDlgButtonChecked(hDlg,chx1);
|
|---|
| 861 | lpxx->lfUnderline=IsDlgButtonChecked(hDlg,chx2);
|
|---|
| 862 | lpxx->lfWidth=lpxx->lfOrientation=lpxx->lfEscapement=0;
|
|---|
| 863 | lpxx->lfOutPrecision=OUT_DEFAULT_PRECIS;
|
|---|
| 864 | lpxx->lfClipPrecision=CLIP_DEFAULT_PRECIS;
|
|---|
| 865 | lpxx->lfQuality=DEFAULT_QUALITY;
|
|---|
| 866 | lpcf->iPointSize= -10*lpxx->lfHeight;
|
|---|
| 867 |
|
|---|
| 868 | hFont=CreateFontIndirectA(lpxx);
|
|---|
| 869 | if (hFont)
|
|---|
| 870 | {
|
|---|
| 871 | HFONT oldFont=SendDlgItemMessageA(hDlg, stc6,
|
|---|
| 872 | WM_GETFONT, 0, 0);
|
|---|
| 873 | SendDlgItemMessageA(hDlg,stc6,WM_SETFONT,hFont,TRUE);
|
|---|
| 874 | DeleteObject(oldFont);
|
|---|
| 875 | }
|
|---|
| 876 | }
|
|---|
| 877 | break;
|
|---|
| 878 |
|
|---|
| 879 | case cmb4:i=SendDlgItemMessageA(hDlg, cmb4, CB_GETCURSEL, 0, 0);
|
|---|
| 880 | if (i!=CB_ERR)
|
|---|
| 881 | {
|
|---|
| 882 | lpcf->rgbColors=textcolors[i];
|
|---|
| 883 | InvalidateRect( GetDlgItem(hDlg,stc6), NULL, 0 );
|
|---|
| 884 | }
|
|---|
| 885 | break;
|
|---|
| 886 |
|
|---|
| 887 | case psh15:i=RegisterWindowMessageA( HELPMSGSTRINGA );
|
|---|
| 888 | if (lpcf->hwndOwner)
|
|---|
| 889 | SendMessageA(lpcf->hwndOwner, i, 0, (LPARAM)GetWindowLongA(hDlg, DWL_USER));
|
|---|
| 890 | /* if (CFn_HookCallChk(lpcf))
|
|---|
| 891 | CallWindowProc16(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf);*/
|
|---|
| 892 | break;
|
|---|
| 893 |
|
|---|
| 894 | case IDOK:if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
|
|---|
| 895 | ( (lpcf->Flags & CF_LIMITSIZE) &&
|
|---|
| 896 | (-lpxx->lfHeight >= lpcf->nSizeMin) &&
|
|---|
| 897 | (-lpxx->lfHeight <= lpcf->nSizeMax)))
|
|---|
| 898 | EndDialog(hDlg, TRUE);
|
|---|
| 899 | else
|
|---|
| 900 | {
|
|---|
| 901 | char buffer[80];
|
|---|
| 902 | sprintf(buffer,"Select a font size between %d and %d points.",
|
|---|
| 903 | lpcf->nSizeMin,lpcf->nSizeMax);
|
|---|
| 904 | MessageBoxA(hDlg, buffer, NULL, MB_OK);
|
|---|
| 905 | }
|
|---|
| 906 | return(TRUE);
|
|---|
| 907 | case IDCANCEL:EndDialog(hDlg, FALSE);
|
|---|
| 908 | return(TRUE);
|
|---|
| 909 | }
|
|---|
| 910 | return(FALSE);
|
|---|
| 911 | }
|
|---|
| 912 |
|
|---|
| 913 | static LRESULT CFn_WMDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 914 | {
|
|---|
| 915 | DeleteObject(SendDlgItemMessageA(hwnd, stc6, WM_GETFONT, 0, 0));
|
|---|
| 916 | return TRUE;
|
|---|
| 917 | }
|
|---|
| 918 |
|
|---|
| 919 | #ifndef __WIN32OS2__
|
|---|
| 920 | /***********************************************************************
|
|---|
| 921 | * FormatCharDlgProc16 (COMMDLG.16)
|
|---|
| 922 | FIXME: 1. some strings are "hardcoded", but it's better load from sysres
|
|---|
| 923 | 2. some CF_.. flags are not supported
|
|---|
| 924 | 3. some TType extensions
|
|---|
| 925 | */
|
|---|
| 926 | LRESULT WINAPI FormatCharDlgProc16(HWND16 hDlg, UINT16 message, WPARAM16 wParam,
|
|---|
| 927 | LPARAM lParam)
|
|---|
| 928 | {
|
|---|
| 929 | LPCHOOSEFONT16 lpcf;
|
|---|
| 930 | LPCHOOSEFONTA lpcf32a;
|
|---|
| 931 | UINT uMsg32;
|
|---|
| 932 | WPARAM wParam32;
|
|---|
| 933 | LRESULT res=0;
|
|---|
| 934 | if (message!=WM_INITDIALOG)
|
|---|
| 935 | {
|
|---|
| 936 | lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER);
|
|---|
| 937 | if (!lpcf)
|
|---|
| 938 | return FALSE;
|
|---|
| 939 | if (CFn_HookCallChk(lpcf))
|
|---|
| 940 | res=CallWindowProc16((WNDPROC16)lpcf->lpfnHook,hDlg,message,wParam,lParam);
|
|---|
| 941 | if (res)
|
|---|
| 942 | return res;
|
|---|
| 943 | }
|
|---|
| 944 | else
|
|---|
| 945 | {
|
|---|
| 946 | lpcf=(LPCHOOSEFONT16)lParam;
|
|---|
| 947 | lpcf32a=(LPCHOOSEFONTA)lpcf->lpTemplateName;
|
|---|
| 948 | if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32a))
|
|---|
| 949 | {
|
|---|
| 950 | TRACE("CFn_WMInitDialog returned FALSE\n");
|
|---|
| 951 | return FALSE;
|
|---|
| 952 | }
|
|---|
| 953 | if (CFn_HookCallChk(lpcf))
|
|---|
| 954 | return CallWindowProc16((WNDPROC16)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam);
|
|---|
| 955 | }
|
|---|
| 956 | WINPROC_MapMsg16To32A(message, wParam, &uMsg32, &wParam32, &lParam);
|
|---|
| 957 | lpcf32a=(LPCHOOSEFONTA)lpcf->lpTemplateName;
|
|---|
| 958 | switch (uMsg32)
|
|---|
| 959 | {
|
|---|
| 960 | case WM_MEASUREITEM:
|
|---|
| 961 | res=CFn_WMMeasureItem(hDlg, wParam32, lParam);
|
|---|
| 962 | break;
|
|---|
| 963 | case WM_DRAWITEM:
|
|---|
| 964 | res=CFn_WMDrawItem(hDlg, wParam32, lParam);
|
|---|
| 965 | break;
|
|---|
| 966 | case WM_CTLCOLORSTATIC:
|
|---|
| 967 | res=CFn_WMCtlColorStatic(hDlg, wParam32, lParam, lpcf32a);
|
|---|
| 968 | break;
|
|---|
| 969 | case WM_COMMAND:
|
|---|
| 970 | res=CFn_WMCommand(hDlg, wParam32, lParam, lpcf32a);
|
|---|
| 971 | break;
|
|---|
| 972 | case WM_DESTROY:
|
|---|
| 973 | res=CFn_WMDestroy(hDlg, wParam32, lParam);
|
|---|
| 974 | break;
|
|---|
| 975 | case WM_CHOOSEFONT_GETLOGFONT:
|
|---|
| 976 | TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n",
|
|---|
| 977 | lParam);
|
|---|
| 978 | FIXME("current logfont back to caller\n");
|
|---|
| 979 | break;
|
|---|
| 980 | }
|
|---|
| 981 | WINPROC_UnmapMsg16To32A(hDlg,uMsg32, wParam32, lParam, res);
|
|---|
| 982 | return res;
|
|---|
| 983 | }
|
|---|
| 984 | #endif //!__WIN32OS2__
|
|---|
| 985 |
|
|---|
| 986 | /***********************************************************************
|
|---|
| 987 | * FormatCharDlgProcA [internal]
|
|---|
| 988 | */
|
|---|
| 989 | LRESULT WINAPI FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
|
|---|
| 990 | LPARAM lParam)
|
|---|
| 991 | {
|
|---|
| 992 | LPCHOOSEFONTA lpcf;
|
|---|
| 993 | LRESULT res=FALSE;
|
|---|
| 994 | if (uMsg!=WM_INITDIALOG)
|
|---|
| 995 | {
|
|---|
| 996 | lpcf=(LPCHOOSEFONTA)GetWindowLongA(hDlg, DWL_USER);
|
|---|
| 997 | if (!lpcf)
|
|---|
| 998 | return FALSE;
|
|---|
| 999 | if (CFn_HookCallChk32(lpcf))
|
|---|
| 1000 | res=CallWindowProcA((WNDPROC)lpcf->lpfnHook, hDlg, uMsg, wParam, lParam);
|
|---|
| 1001 | if (res)
|
|---|
| 1002 | return res;
|
|---|
| 1003 | }
|
|---|
| 1004 | else
|
|---|
| 1005 | {
|
|---|
| 1006 | lpcf=(LPCHOOSEFONTA)lParam;
|
|---|
| 1007 | if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf))
|
|---|
| 1008 | {
|
|---|
| 1009 | TRACE("CFn_WMInitDialog returned FALSE\n");
|
|---|
| 1010 | return FALSE;
|
|---|
| 1011 | }
|
|---|
| 1012 | if (CFn_HookCallChk32(lpcf))
|
|---|
| 1013 | return CallWindowProcA((WNDPROC)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam);
|
|---|
| 1014 | }
|
|---|
| 1015 | switch (uMsg)
|
|---|
| 1016 | {
|
|---|
| 1017 | case WM_MEASUREITEM:
|
|---|
| 1018 | return CFn_WMMeasureItem(hDlg, wParam, lParam);
|
|---|
| 1019 | case WM_DRAWITEM:
|
|---|
| 1020 | return CFn_WMDrawItem(hDlg, wParam, lParam);
|
|---|
| 1021 | case WM_CTLCOLORSTATIC:
|
|---|
| 1022 | return CFn_WMCtlColorStatic(hDlg, wParam, lParam, lpcf);
|
|---|
| 1023 | case WM_COMMAND:
|
|---|
| 1024 | return CFn_WMCommand(hDlg, wParam, lParam, lpcf);
|
|---|
| 1025 | case WM_DESTROY:
|
|---|
| 1026 | return CFn_WMDestroy(hDlg, wParam, lParam);
|
|---|
| 1027 | case WM_CHOOSEFONT_GETLOGFONT:
|
|---|
| 1028 | TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n",
|
|---|
| 1029 | lParam);
|
|---|
| 1030 | FIXME("current logfont back to caller\n");
|
|---|
| 1031 | break;
|
|---|
| 1032 | }
|
|---|
| 1033 | return res;
|
|---|
| 1034 | }
|
|---|
| 1035 |
|
|---|
| 1036 | /***********************************************************************
|
|---|
| 1037 | * FormatCharDlgProcW [internal]
|
|---|
| 1038 | */
|
|---|
| 1039 | LRESULT WINAPI FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
|
|---|
| 1040 | LPARAM lParam)
|
|---|
| 1041 | {
|
|---|
| 1042 | LPCHOOSEFONTW lpcf32w;
|
|---|
| 1043 | LPCHOOSEFONTA lpcf32a;
|
|---|
| 1044 | LRESULT res=FALSE;
|
|---|
| 1045 | if (uMsg!=WM_INITDIALOG)
|
|---|
| 1046 | {
|
|---|
| 1047 | lpcf32w=(LPCHOOSEFONTW)GetWindowLongA(hDlg, DWL_USER);
|
|---|
| 1048 | if (!lpcf32w)
|
|---|
| 1049 | return FALSE;
|
|---|
| 1050 | if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w))
|
|---|
| 1051 | res=CallWindowProcW((WNDPROC)lpcf32w->lpfnHook, hDlg, uMsg, wParam, lParam);
|
|---|
| 1052 | if (res)
|
|---|
| 1053 | return res;
|
|---|
| 1054 | }
|
|---|
| 1055 | else
|
|---|
| 1056 | {
|
|---|
| 1057 | lpcf32w=(LPCHOOSEFONTW)lParam;
|
|---|
| 1058 | lpcf32a=(LPCHOOSEFONTA)lpcf32w->lpTemplateName;
|
|---|
| 1059 | if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32a))
|
|---|
| 1060 | {
|
|---|
| 1061 | TRACE("CFn_WMInitDialog returned FALSE\n");
|
|---|
| 1062 | return FALSE;
|
|---|
| 1063 | }
|
|---|
| 1064 | if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w))
|
|---|
| 1065 | return CallWindowProcW((WNDPROC)lpcf32w->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam);
|
|---|
| 1066 | }
|
|---|
| 1067 | lpcf32a=(LPCHOOSEFONTA)lpcf32w->lpTemplateName;
|
|---|
| 1068 | switch (uMsg)
|
|---|
| 1069 | {
|
|---|
| 1070 | case WM_MEASUREITEM:
|
|---|
| 1071 | return CFn_WMMeasureItem(hDlg, wParam, lParam);
|
|---|
| 1072 | case WM_DRAWITEM:
|
|---|
| 1073 | return CFn_WMDrawItem(hDlg, wParam, lParam);
|
|---|
| 1074 | case WM_CTLCOLORSTATIC:
|
|---|
| 1075 | return CFn_WMCtlColorStatic(hDlg, wParam, lParam, lpcf32a);
|
|---|
| 1076 | case WM_COMMAND:
|
|---|
| 1077 | return CFn_WMCommand(hDlg, wParam, lParam, lpcf32a);
|
|---|
| 1078 | case WM_DESTROY:
|
|---|
| 1079 | return CFn_WMDestroy(hDlg, wParam, lParam);
|
|---|
| 1080 | case WM_CHOOSEFONT_GETLOGFONT:
|
|---|
| 1081 | TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n",
|
|---|
| 1082 | lParam);
|
|---|
| 1083 | FIXME("current logfont back to caller\n");
|
|---|
| 1084 | break;
|
|---|
| 1085 | }
|
|---|
| 1086 | return res;
|
|---|
| 1087 | }
|
|---|
| 1088 |
|
|---|
| 1089 |
|
|---|