Mikołaj Zalewski : comdlg32: Move font style names to resources.

Alexandre Julliard julliard at winehq.org
Tue Mar 11 10:51:42 CDT 2008


Module: wine
Branch: master
Commit: 89c86dd99485b4031bcbb9d995f4990fe38890ce
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=89c86dd99485b4031bcbb9d995f4990fe38890ce

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date:   Mon Mar 10 21:36:35 2008 +0100

comdlg32: Move font style names to resources.

---

 dlls/comdlg32/cdlg.h     |    7 +++++++
 dlls/comdlg32/cdlg_En.rc |    8 ++++++++
 dlls/comdlg32/cdlg_Pl.rc |    8 ++++++++
 dlls/comdlg32/fontdlg.c  |   18 ++++++++----------
 4 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/dlls/comdlg32/cdlg.h b/dlls/comdlg32/cdlg.h
index 22cd5a2..f88e2d4 100644
--- a/dlls/comdlg32/cdlg.h
+++ b/dlls/comdlg32/cdlg.h
@@ -126,6 +126,13 @@ typedef struct {
 #define IDS_CHARSET_ISO10       223
 #define IDS_CHARSET_CELTIC      224
 
+/* Font styles */
+
+#define IDS_FONT_REGULAR        256
+#define IDS_FONT_BOLD           257
+#define IDS_FONT_ITALIC         258
+#define IDS_FONT_BOLD_ITALIC    259
+
 /* Color names string IDs */
 
 #define IDS_COLOR_BLACK                 1040
diff --git a/dlls/comdlg32/cdlg_En.rc b/dlls/comdlg32/cdlg_En.rc
index a9be1a9..2021448 100644
--- a/dlls/comdlg32/cdlg_En.rc
+++ b/dlls/comdlg32/cdlg_En.rc
@@ -443,6 +443,14 @@ Please install one and retry."
     PD32_PRINTER_STATUS_POWER_SAVE        "Power save mode; "
 }
 
+STRINGTABLE DISCARDABLE /* Font styles */
+{
+    IDS_FONT_REGULAR       "Regular"
+    IDS_FONT_BOLD          "Bold"
+    IDS_FONT_ITALIC        "Italic"
+    IDS_FONT_BOLD_ITALIC   "Bold Italic"
+}
+
 STRINGTABLE DISCARDABLE /* Color names */
 {
     IDS_COLOR_BLACK     "Black"
diff --git a/dlls/comdlg32/cdlg_Pl.rc b/dlls/comdlg32/cdlg_Pl.rc
index 7376fb7..f28b00e 100644
--- a/dlls/comdlg32/cdlg_Pl.rc
+++ b/dlls/comdlg32/cdlg_Pl.rc
@@ -449,6 +449,14 @@ STRINGTABLE DISCARDABLE
     IDS_OPEN_FILE   "Otwórz plik"
 }
 
+STRINGTABLE DISCARDABLE /* Font styles */
+{
+    IDS_FONT_REGULAR       "Regularny"
+    IDS_FONT_BOLD          "Pogrubiony"
+    IDS_FONT_ITALIC        "Kusywa"
+    IDS_FONT_BOLD_ITALIC   "Pogrubiona kursywa"
+}
+
 STRINGTABLE DISCARDABLE /* Color names */
 {
     IDS_COLOR_BLACK     "Czarny"
diff --git a/dlls/comdlg32/fontdlg.c b/dlls/comdlg32/fontdlg.c
index 899cfe4..2532f2f 100644
--- a/dlls/comdlg32/fontdlg.c
+++ b/dlls/comdlg32/fontdlg.c
@@ -357,17 +357,13 @@ static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTW *lplf)
     {
         int italic;
         int weight;
-        const WCHAR *stname;
+        UINT resId;
     };
-    static const WCHAR strRegular[]    = {'R','e','g','u','l','a','r',0};
-    static const WCHAR strItalic[]     = {'I','t','a','l','i','c',0};
-    static const WCHAR strBold[]       = {'B','o','l','d',0};
-    static const WCHAR strBoldItalic[] = {'B','o','l','d',' ','I','t','a','l','i','c',0};
     static const struct FONTSTYLE fontstyles[FSTYLES]={
-        { 0, FW_NORMAL, strRegular },
-        { 1, FW_NORMAL, strItalic },
-        { 0, FW_BOLD,   strBold },
-        { 1, FW_BOLD,   strBoldItalic }
+        { 0, FW_NORMAL, IDS_FONT_REGULAR },
+        { 1, FW_NORMAL, IDS_FONT_ITALIC },
+        { 0, FW_BOLD,   IDS_FONT_BOLD },
+        { 1, FW_BOLD,   IDS_FONT_BOLD_ITALIC }
     };
     HFONT hf;
     TEXTMETRICW tm;
@@ -390,7 +386,9 @@ static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTW *lplf)
              (fontstyles[i].weight == FW_BOLD && tm.tmWeight > FW_MEDIUM)) &&
             ((tm.tmItalic != 0)==fontstyles[i].italic))
         {
-            j=SendMessageW(hwnd,CB_ADDSTRING,0,(LPARAM)fontstyles[i].stname );
+            WCHAR name[64];
+            LoadStringW(COMDLG32_hInstance, fontstyles[i].resId, name, 64);
+            j=SendMessageW(hwnd,CB_ADDSTRING,0,(LPARAM)name );
             if (j==CB_ERR) return 1;
             j=SendMessageW(hwnd, CB_SETITEMDATA, j,
                            MAKELONG(tm.tmWeight,fontstyles[i].italic));




More information about the wine-cvs mailing list