font dialog multicharset support - part 1

Shachar Shemesh wine-patches at sun.consumer.org.il
Thu Jan 30 15:54:08 CST 2003


This patch gives the infrastructure used to implement charset selection 
in the font dialog. As a first stage, a const data structure was used to 
give the sample text that will be used when each codepage is selected 
(currently only filled in "Western" and "Hebrew", others will follow).

Changelog:
Shachar Shemesh <winecode at sun.consumer.org.il>

dlls/commdlg/*.rc

    * Marked all "stc5" controls in the font dialog as "NOT VISIBLE", as
      the code currently draws the sample text manually (yes, this is
      how Windows does it. No, I don't know why, I have only a vague idea).

dlls/commdlg/fontdlg.c

    * 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.


-------------- next part --------------
Index: dlls/commdlg/cdlg.h
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg.h,v
retrieving revision 1.26
diff -u -r1.26 cdlg.h
--- dlls/commdlg/cdlg.h	28 Jan 2003 00:18:31 -0000	1.26
+++ dlls/commdlg/cdlg.h	29 Jan 2003 19:25:11 -0000
@@ -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 */
 
Index: dlls/commdlg/cdlg_Ca.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Ca.rc,v
retrieving revision 1.7
diff -u -r1.7 cdlg_Ca.rc
--- dlls/commdlg/cdlg_Ca.rc	8 Nov 2002 18:56:46 -0000	1.7
+++ dlls/commdlg/cdlg_Ca.rc	30 Jan 2003 21:31:24 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_Da.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Da.rc,v
retrieving revision 1.8
diff -u -r1.8 cdlg_Da.rc
--- dlls/commdlg/cdlg_Da.rc	8 Nov 2002 18:56:46 -0000	1.8
+++ dlls/commdlg/cdlg_Da.rc	30 Jan 2003 21:31:48 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_De.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_De.rc,v
retrieving revision 1.11
diff -u -r1.11 cdlg_De.rc
--- dlls/commdlg/cdlg_De.rc	15 Jan 2003 03:33:08 -0000	1.11
+++ dlls/commdlg/cdlg_De.rc	30 Jan 2003 21:32:05 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_En.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_En.rc,v
retrieving revision 1.24
diff -u -r1.24 cdlg_En.rc
--- dlls/commdlg/cdlg_En.rc	28 Jan 2003 00:18:31 -0000	1.24
+++ dlls/commdlg/cdlg_En.rc	30 Jan 2003 21:32:12 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_Es.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Es.rc,v
retrieving revision 1.6
diff -u -r1.6 cdlg_Es.rc
--- dlls/commdlg/cdlg_Es.rc	8 Nov 2002 18:56:46 -0000	1.6
+++ dlls/commdlg/cdlg_Es.rc	30 Jan 2003 21:32:19 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_Fi.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Fi.rc,v
retrieving revision 1.7
diff -u -r1.7 cdlg_Fi.rc
--- dlls/commdlg/cdlg_Fi.rc	8 Nov 2002 18:56:46 -0000	1.7
+++ dlls/commdlg/cdlg_Fi.rc	30 Jan 2003 21:32:26 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_Fr.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Fr.rc,v
retrieving revision 1.9
diff -u -r1.9 cdlg_Fr.rc
--- dlls/commdlg/cdlg_Fr.rc	8 Nov 2002 18:56:46 -0000	1.9
+++ dlls/commdlg/cdlg_Fr.rc	30 Jan 2003 21:32:35 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_Hu.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Hu.rc,v
retrieving revision 1.6
diff -u -r1.6 cdlg_Hu.rc
--- dlls/commdlg/cdlg_Hu.rc	8 Nov 2002 18:56:46 -0000	1.6
+++ dlls/commdlg/cdlg_Hu.rc	30 Jan 2003 21:32:44 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_It.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_It.rc,v
retrieving revision 1.7
diff -u -r1.7 cdlg_It.rc
--- dlls/commdlg/cdlg_It.rc	8 Nov 2002 18:56:46 -0000	1.7
+++ dlls/commdlg/cdlg_It.rc	30 Jan 2003 21:32:53 -0000
@@ -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
Index: dlls/commdlg/cdlg_Ja.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Ja.rc,v
retrieving revision 1.7
diff -u -r1.7 cdlg_Ja.rc
--- dlls/commdlg/cdlg_Ja.rc	8 Nov 2002 18:56:46 -0000	1.7
+++ dlls/commdlg/cdlg_Ja.rc	30 Jan 2003 21:33:02 -0000
@@ -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        "ƒTƒ“ƒvƒ‹",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
 }
 
 
Index: dlls/commdlg/cdlg_Nl.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Nl.rc,v
retrieving revision 1.8
diff -u -r1.8 cdlg_Nl.rc
--- dlls/commdlg/cdlg_Nl.rc	8 Nov 2002 18:56:46 -0000	1.8
+++ dlls/commdlg/cdlg_Nl.rc	30 Jan 2003 21:33:14 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_Pl.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Pl.rc,v
retrieving revision 1.7
diff -u -r1.7 cdlg_Pl.rc
--- dlls/commdlg/cdlg_Pl.rc	8 Nov 2002 18:56:46 -0000	1.7
+++ dlls/commdlg/cdlg_Pl.rc	30 Jan 2003 21:33:23 -0000
@@ -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
Index: dlls/commdlg/cdlg_Pt.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Pt.rc,v
retrieving revision 1.8
diff -u -r1.8 cdlg_Pt.rc
--- dlls/commdlg/cdlg_Pt.rc	8 Nov 2002 18:56:46 -0000	1.8
+++ dlls/commdlg/cdlg_Pt.rc	30 Jan 2003 21:33:30 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_Ru.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Ru.rc,v
retrieving revision 1.9
diff -u -r1.9 cdlg_Ru.rc
--- dlls/commdlg/cdlg_Ru.rc	8 Nov 2002 18:56:46 -0000	1.9
+++ dlls/commdlg/cdlg_Ru.rc	30 Jan 2003 21:33:37 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_Si.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Si.rc,v
retrieving revision 1.3
diff -u -r1.3 cdlg_Si.rc
--- dlls/commdlg/cdlg_Si.rc	11 Dec 2002 01:29:10 -0000	1.3
+++ dlls/commdlg/cdlg_Si.rc	30 Jan 2003 21:33:45 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_Sk.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Sk.rc,v
retrieving revision 1.7
diff -u -r1.7 cdlg_Sk.rc
--- dlls/commdlg/cdlg_Sk.rc	8 Nov 2002 18:56:46 -0000	1.7
+++ dlls/commdlg/cdlg_Sk.rc	30 Jan 2003 21:33:50 -0000
@@ -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
Index: dlls/commdlg/cdlg_Sv.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Sv.rc,v
retrieving revision 1.8
diff -u -r1.8 cdlg_Sv.rc
--- dlls/commdlg/cdlg_Sv.rc	8 Nov 2002 18:56:46 -0000	1.8
+++ dlls/commdlg/cdlg_Sv.rc	30 Jan 2003 21:33:57 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_Wa.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Wa.rc,v
retrieving revision 1.8
diff -u -r1.8 cdlg_Wa.rc
--- dlls/commdlg/cdlg_Wa.rc	8 Nov 2002 18:56:46 -0000	1.8
+++ dlls/commdlg/cdlg_Wa.rc	30 Jan 2003 21:34:03 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/cdlg_Zh.rc
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/cdlg_Zh.rc,v
retrieving revision 1.5
diff -u -r1.5 cdlg_Zh.rc
--- dlls/commdlg/cdlg_Zh.rc	8 Nov 2002 18:56:46 -0000	1.5
+++ dlls/commdlg/cdlg_Zh.rc	30 Jan 2003 21:34:10 -0000
@@ -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
 }
 
 
Index: dlls/commdlg/fontdlg.c
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/commdlg/fontdlg.c,v
retrieving revision 1.47
diff -u -r1.47 fontdlg.c
--- dlls/commdlg/fontdlg.c	28 Jan 2003 00:18:31 -0000	1.47
+++ dlls/commdlg/fontdlg.c	30 Jan 2003 21:36:46 -0000
@@ -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:


More information about the wine-patches mailing list