- Implemented two lookup tables for the sample fonts. The first, "CHARSET_ORDER", is for converting codepage to ordinal charset num, and the second, "SAMPLE_LANG_TEXT", is for giving the actual sample text. - Removed all references to changing the font directly in stc5. - Modified the "InvalidateRect" calls to invalidate the rect where stc5 is, rather than stc5 itself. - Added handling of WM_PAINT that draws the sample text, properly truncated. - Removed handling of WM_CTLCOLOR - no longer neccessary.
diff --git a/dlls/commdlg/cdlg.h b/dlls/commdlg/cdlg.h index 5c7f67f..fcf52f5 100644 --- a/dlls/commdlg/cdlg.h +++ b/dlls/commdlg/cdlg.h
@@ -109,19 +109,29 @@ #define IDS_CHARSET_ANSI 200 #define IDS_CHARSET_SYMBOL 201 -#define IDS_CHARSET_SHIFTJIS 202 +#define IDS_CHARSET_JIS 202 #define IDS_CHARSET_HANGUL 203 -#define IDS_CHARSET_GREEK 204 -#define IDS_CHARSET_TURKISH 205 -#define IDS_CHARSET_HEBREW 206 -#define IDS_CHARSET_ARABIC 207 -#define IDS_CHARSET_BALTIC 208 -#define IDS_CHARSET_VIETNAMESE 209 -#define IDS_CHARSET_RUSSIAN 210 -#define IDS_CHARSET_EE 211 -#define IDS_CHARSET_THAI 212 -#define IDS_CHARSET_JOHAB 213 -#define IDS_CHARSET_OEM 214 +#define IDS_CHARSET_GB2312 204 +#define IDS_CHARSET_BIG5 205 +#define IDS_CHARSET_GREEK 206 +#define IDS_CHARSET_TURKISH 207 +#define IDS_CHARSET_HEBREW 208 +#define IDS_CHARSET_ARABIC 209 +#define IDS_CHARSET_BALTIC 210 +#define IDS_CHARSET_VIETNAMESE 211 +#define IDS_CHARSET_RUSSIAN 212 +#define IDS_CHARSET_EE 213 +#define IDS_CHARSET_THAI 214 +#define IDS_CHARSET_JOHAB 215 +#define IDS_CHARSET_MAC 216 +#define IDS_CHARSET_OEM 217 +#define IDS_CHARSET_VISCII 218 +#define IDS_CHARSET_TCVN 219 +#define IDS_CHARSET_KOI8 220 +#define IDS_CHARSET_ISO3 221 +#define IDS_CHARSET_ISO4 222 +#define IDS_CHARSET_ISO10 223 +#define IDS_CHARSET_CELTIC 224 /* Color names string IDs */
diff --git a/dlls/commdlg/cdlg_Ca.rc b/dlls/commdlg/cdlg_Ca.rc index db9ce30..8bfe85d 100644 --- a/dlls/commdlg/cdlg_Ca.rc +++ b/dlls/commdlg/cdlg_Ca.rc
@@ -136,7 +136,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Exemple",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_Da.rc b/dlls/commdlg/cdlg_Da.rc index baceea3..4f00e73 100644 --- a/dlls/commdlg/cdlg_Da.rc +++ b/dlls/commdlg/cdlg_Da.rc
@@ -136,7 +136,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Eksempel",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_De.rc b/dlls/commdlg/cdlg_De.rc index 0a805ee..5557034 100644 --- a/dlls/commdlg/cdlg_De.rc +++ b/dlls/commdlg/cdlg_De.rc
@@ -166,7 +166,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Muster",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_En.rc b/dlls/commdlg/cdlg_En.rc index 79e3639..974bb65 100644 --- a/dlls/commdlg/cdlg_En.rc +++ b/dlls/commdlg/cdlg_En.rc
@@ -136,7 +136,7 @@ COMBOBOX cmb4,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Sample",grp2,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_Es.rc b/dlls/commdlg/cdlg_Es.rc index f1971f5..9188cb9 100644 --- a/dlls/commdlg/cdlg_Es.rc +++ b/dlls/commdlg/cdlg_Es.rc
@@ -136,7 +136,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Ejemplo",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZzÑñ",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZzÑñ",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_Fi.rc b/dlls/commdlg/cdlg_Fi.rc index 9e3df51..6ad7d8c 100644 --- a/dlls/commdlg/cdlg_Fi.rc +++ b/dlls/commdlg/cdlg_Fi.rc
@@ -136,7 +136,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Näyte",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_Fr.rc b/dlls/commdlg/cdlg_Fr.rc index e1f4cd1..10e12c4 100644 --- a/dlls/commdlg/cdlg_Fr.rc +++ b/dlls/commdlg/cdlg_Fr.rc
@@ -136,7 +136,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Exemple",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_Hu.rc b/dlls/commdlg/cdlg_Hu.rc index 17f010e..2e74fb8 100644 --- a/dlls/commdlg/cdlg_Hu.rc +++ b/dlls/commdlg/cdlg_Hu.rc
@@ -135,7 +135,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Minta",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZzÁáÕõÉé",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZzÁáÕõÉé",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_It.rc b/dlls/commdlg/cdlg_It.rc index 75e112c..cbc84c8 100644 --- a/dlls/commdlg/cdlg_It.rc +++ b/dlls/commdlg/cdlg_It.rc
@@ -135,7 +135,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Esempio",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE } CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
diff --git a/dlls/commdlg/cdlg_Ja.rc b/dlls/commdlg/cdlg_Ja.rc index 463c0ce..154d4b1 100644 --- a/dlls/commdlg/cdlg_Ja.rc +++ b/dlls/commdlg/cdlg_Ja.rc
@@ -136,7 +136,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Tv",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_Nl.rc b/dlls/commdlg/cdlg_Nl.rc index 37e8695..42185e0 100644 --- a/dlls/commdlg/cdlg_Nl.rc +++ b/dlls/commdlg/cdlg_Nl.rc
@@ -136,7 +136,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Voorbeeld",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_Pl.rc b/dlls/commdlg/cdlg_Pl.rc index acb8ed1..c179dff 100644 --- a/dlls/commdlg/cdlg_Pl.rc +++ b/dlls/commdlg/cdlg_Pl.rc
@@ -133,7 +133,7 @@ CONTROL "", 1139, "COMBOBOX", CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 6,120,84,100 CONTROL "Przyk³ad", 1073, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 98,72,160,49 - CONTROL "AaBbYyZz\xB3", stc5, "STATIC", SS_NOPREFIX | WS_VISIBLE, 104,81,149,37 + CONTROL "AaBbYyZz\xB3", stc5, "STATIC", SS_NOPREFIX | NOT WS_VISIBLE, 104,81,149,37 END /* PUSHBUTTON "&Replace", 1024, 174, 21, 50, 14, WS_GROUP | WS_TABSTOP * PUSHBUTTON "Replace &All", 1025, 174, 38, 50, 14, WS_GROUP | WS_TABSTOP
diff --git a/dlls/commdlg/cdlg_Pt.rc b/dlls/commdlg/cdlg_Pt.rc index 06b2a1d..232a843 100644 --- a/dlls/commdlg/cdlg_Pt.rc +++ b/dlls/commdlg/cdlg_Pt.rc
@@ -136,7 +136,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Amostra",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_Ru.rc b/dlls/commdlg/cdlg_Ru.rc index bf12e78..72007b3 100644 --- a/dlls/commdlg/cdlg_Ru.rc +++ b/dlls/commdlg/cdlg_Ru.rc
@@ -136,7 +136,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Îáðàçåö",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_Si.rc b/dlls/commdlg/cdlg_Si.rc index bf6f9ab..c4e86e3 100644 --- a/dlls/commdlg/cdlg_Si.rc +++ b/dlls/commdlg/cdlg_Si.rc
@@ -136,7 +136,7 @@ COMBOBOX cmb4,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Vzorec",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_Sk.rc b/dlls/commdlg/cdlg_Sk.rc index c9d7036..5a4fdc5 100644 --- a/dlls/commdlg/cdlg_Sk.rc +++ b/dlls/commdlg/cdlg_Sk.rc
@@ -138,7 +138,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Vzorka",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE } CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
diff --git a/dlls/commdlg/cdlg_Sv.rc b/dlls/commdlg/cdlg_Sv.rc index 4e7eb73..3cbe506 100644 --- a/dlls/commdlg/cdlg_Sv.rc +++ b/dlls/commdlg/cdlg_Sv.rc
@@ -134,7 +134,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Test",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_Wa.rc b/dlls/commdlg/cdlg_Wa.rc index 451bd84..aae4229 100644 --- a/dlls/commdlg/cdlg_Wa.rc +++ b/dlls/commdlg/cdlg_Wa.rc
@@ -141,7 +141,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Egzimpe",1073,98,72,160,49,WS_GROUP - CTEXT "AaBbYyZzÅåÇçÛû",stc5,104,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZzÅåÇçÛû",stc5,104,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/cdlg_Zh.rc b/dlls/commdlg/cdlg_Zh.rc index 88a8b82..55c351b 100644 --- a/dlls/commdlg/cdlg_Zh.rc +++ b/dlls/commdlg/cdlg_Zh.rc
@@ -87,7 +87,7 @@ COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "¹ Àý",1073,128,72,160,49,WS_GROUP - CTEXT "AaBbYyZz",stc5,134,81,149,37,SS_NOPREFIX | WS_VISIBLE + CTEXT "AaBbYyZz",stc5,134,81,149,37,SS_NOPREFIX | NOT WS_VISIBLE }
diff --git a/dlls/commdlg/fontdlg.c b/dlls/commdlg/fontdlg.c index a3d07b2..5e1381f 100644 --- a/dlls/commdlg/fontdlg.c +++ b/dlls/commdlg/fontdlg.c
@@ -49,6 +49,61 @@ BOOL16 CALLBACK FormatCharDlgProc16(HWND16 hDlg, UINT16 message, WPARAM16 wParam, LPARAM lParam); +/* There is a table here of all charsets, and the sample text for each. + * There is a second table that translates a charset into an index into + * the first table. + */ + +#define CI(cs) ((IDS_CHARSET_##cs)-IDS_CHARSET_ANSI) +#define SAMPLE_EXTLEN 10 + +static const WCHAR SAMPLE_LANG_TEXT[][SAMPLE_EXTLEN]={ + {'Y','y','Z','z',0}, /* Western and default */ + {0}, /* Symbol */ + {0}, /* Shift JIS */ + {0}, /* Hangul */ + {0}, /* GB2312 */ + {0}, /* BIG5 */ + {0}, /* Greek */ + {0}, /* Turkish */ + {0x05e0, 0x05e1, 0x05e9, 0x05ea, 0}, /* Hebrew */ + {0}, /* Arabic */ + {0}, /* Baltic */ + {0}, /* Vietnamese */ + {0}, /* Russian */ + {0}, /* East European */ + {0}, /* Thai */ + {0}, /* Johab */ + {0}, /* Mac */ + {0}, /* OEM */ + {0}, /* VISCII */ + {0}, /* TCVN */ + {0}, /* KOI-8 */ + {0}, /* ISO-8859-3 */ + {0}, /* ISO-8859-4 */ + {0}, /* ISO-8859-10 */ + {0} /* Celtic */ +}; + +static const int CHARSET_ORDER[256]={ + CI(ANSI), 0, CI(SYMBOL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(MAC), 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + CI(JIS), CI(HANGUL), CI(JOHAB), 0, 0, 0, CI(GB2312), 0, CI(BIG5), 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, CI(GREEK), CI(TURKISH), CI(VIETNAMESE), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, CI(HEBREW), CI(ARABIC), 0, 0, 0, 0, 0, 0, 0, CI(BALTIC), 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(RUSSIAN), 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(THAI), 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(EE), 0, + CI(VISCII), CI(TCVN), CI(KOI8), CI(ISO3), CI(ISO4), CI(ISO10), CI(CELTIC), 0, 0, 0, 0, 0, 0, 0, 0, CI(OEM), +}; + static void FONT_LogFont16To32A( const LPLOGFONT16 font16, LPLOGFONTA font32 ) { font32->lfHeight = font16->lfHeight; @@ -740,10 +795,6 @@ if (!hBitmapTT) hBitmapTT = LoadBitmapA(0, MAKEINTRESOURCEA(OBM_TRTYPE)); - /* This font will be deleted by WM_COMMAND */ - SendDlgItemMessageA(hDlg,stc5,WM_SETFONT, - (WPARAM)CreateFontA(0, 0, 1, 1, 400, 0, 0, 0, 0, 0, 0, 0, 0, NULL),FALSE); - if (!(lpcf->Flags & CF_SHOWHELP) || !IsWindow(lpcf->hwndOwner)) ShowWindow(GetDlgItem(hDlg,pshHelp),SW_HIDE); if (!(lpcf->Flags & CF_APPLY)) @@ -978,27 +1029,11 @@ } /*********************************************************************** - * CFn_WMCtlColor [internal] - */ -static LRESULT CFn_WMCtlColorStatic(HWND hDlg, WPARAM wParam, LPARAM lParam, - LPCHOOSEFONTA lpcf) -{ - if (lpcf->Flags & CF_EFFECTS) - if (GetDlgCtrlID(HWND_32(LOWORD(lParam)))==stc5) - { - SetTextColor((HDC)wParam, lpcf->rgbColors); - return (LRESULT)GetStockObject(WHITE_BRUSH); - } - return 0; -} - -/*********************************************************************** * CFn_WMCommand [internal] */ static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam, LPCHOOSEFONTA lpcf) { - HFONT hFont; int i,j; long l; HDC hdc; @@ -1047,6 +1082,8 @@ case cmb3:if (HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)== BN_CLICKED ) { char str[256]; + WINDOWINFO wininfo; + TRACE("WM_COMMAND/cmb2,3 =%08lX\n", lParam); i=SendDlgItemMessageA(hDlg,cmb1,CB_GETCURSEL,0,0); if (i==CB_ERR) @@ -1087,22 +1124,28 @@ lpxx->lfQuality=DEFAULT_QUALITY; lpcf->iPointSize= -10*lpxx->lfHeight; - hFont=CreateFontIndirectA(lpxx); - if (hFont) + wininfo.cbSize=sizeof(wininfo); + + if( GetWindowInfo( GetDlgItem( hDlg, stc5), &wininfo ) ) { - HFONT oldFont=(HFONT)SendDlgItemMessageA(hDlg, stc5, - WM_GETFONT, 0, 0); - SendDlgItemMessageA(hDlg,stc5,WM_SETFONT,(WPARAM)hFont,TRUE); - DeleteObject(oldFont); + InvalidateRect( hDlg, &wininfo.rcWindow, TRUE ); } } break; - case cmb4:i=SendDlgItemMessageA(hDlg, cmb4, CB_GETCURSEL, 0, 0); + case cmb4: + i=SendDlgItemMessageA(hDlg, cmb4, CB_GETCURSEL, 0, 0); if (i!=CB_ERR) { + WINDOWINFO wininfo; + lpcf->rgbColors=textcolors[i]; - InvalidateRect( GetDlgItem(hDlg,stc5), NULL, 0 ); + wininfo.cbSize=sizeof(wininfo); + + if( GetWindowInfo( GetDlgItem( hDlg, stc5), &wininfo ) ) + { + InvalidateRect( hDlg, &wininfo.rcWindow, TRUE ); + } } break; @@ -1134,10 +1177,57 @@ static LRESULT CFn_WMDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam) { - DeleteObject((HFONT)SendDlgItemMessageA(hwnd, stc5, WM_GETFONT, 0, 0)); return TRUE; } +static LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam, + LPCHOOSEFONTA lpcf ) +{ + WINDOWINFO info; + + info.cbSize=sizeof(info); + + if( GetWindowInfo( GetDlgItem( hDlg, stc5), &info ) ) + { + PAINTSTRUCT ps; + HDC hdc; + HPEN hOrigPen; + HFONT hOrigFont; + COLORREF rgbPrev; + WCHAR sample[SAMPLE_EXTLEN+5]={'A','a','B','b'}; + /* Always start with this basic sample */ + + hdc=BeginPaint( hDlg, &ps ); + + /* Paint frame */ + MoveToEx( hdc, info.rcWindow.left, info.rcWindow.bottom, NULL ); + hOrigPen=SelectObject( hdc, CreatePen( PS_SOLID, 2, + GetSysColor( COLOR_3DSHADOW ) )); + LineTo( hdc, info.rcWindow.left, info.rcWindow.top ); + LineTo( hdc, info.rcWindow.right, info.rcWindow.top ); + DeleteObject(SelectObject( hdc, CreatePen( PS_SOLID, 2, + GetSysColor( COLOR_3DLIGHT ) ))); + LineTo( hdc, info.rcWindow.right, info.rcWindow.bottom ); + LineTo( hdc, info.rcWindow.left, info.rcWindow.bottom ); + DeleteObject(SelectObject( hdc, hOrigPen )); + + /* Draw the sample text itself */ + lstrcatW(sample, SAMPLE_LANG_TEXT[CHARSET_ORDER[lpcf->lpLogFont->lfCharSet]] ); + + info.rcWindow.right--; + info.rcWindow.bottom--; + info.rcWindow.top++; + info.rcWindow.left++; + hOrigFont=SelectObject( hdc, CreateFontIndirectA( lpcf->lpLogFont ) ); + rgbPrev=SetTextColor( hdc, lpcf->rgbColors ); + + DrawTextW( hdc, sample, -1, &info.rcWindow, DT_CENTER|DT_VCENTER|DT_SINGLELINE ); + + EndPaint( hDlg, &ps ); + } + + return FALSE; +} /*********************************************************************** * FormatCharDlgProc (COMMDLG.16) @@ -1208,10 +1298,6 @@ res = CFn_WMDrawItem(hDlg, wParam, (LPARAM)&dis); } break; - case WM_CTLCOLOR: - if (HIWORD(lParam) == CTLCOLOR_STATIC) - res=CFn_WMCtlColorStatic(hDlg, wParam, LOWORD(lParam), lpcf32a); - break; case WM_COMMAND: res=CFn_WMCommand(hDlg, MAKEWPARAM( wParam, HIWORD(lParam) ), LOWORD(lParam), lpcf32a); break; @@ -1261,8 +1347,6 @@ return CFn_WMMeasureItem(hDlg, wParam, lParam); case WM_DRAWITEM: return CFn_WMDrawItem(hDlg, wParam, lParam); - case WM_CTLCOLORSTATIC: - return CFn_WMCtlColorStatic(hDlg, wParam, lParam, lpcf); case WM_COMMAND: return CFn_WMCommand(hDlg, wParam, lParam, lpcf); case WM_DESTROY: @@ -1272,6 +1356,8 @@ lParam); FIXME("current logfont back to caller\n"); break; + case WM_PAINT: + return CFn_WMPaint(hDlg, wParam, lParam, lpcf); } return res; } @@ -1314,8 +1400,6 @@ return CFn_WMMeasureItem(hDlg, wParam, lParam); case WM_DRAWITEM: return CFn_WMDrawItem(hDlg, wParam, lParam); - case WM_CTLCOLORSTATIC: - return CFn_WMCtlColorStatic(hDlg, wParam, lParam, lpcf32a); case WM_COMMAND: return CFn_WMCommand(hDlg, wParam, lParam, lpcf32a); case WM_DESTROY: