]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkfontsel.c
Update gcc build instructions. Mention gettext is GPL.
[~andy/gtk] / gtk / gtkfontsel.c
index b505704afc8e6c81dcd40524a9ea2d4fc2faf01a..36eaf9b4d087cd3125028bf4bfcbea523ee98e91 100644 (file)
 #include <ctype.h>
 
 #include "gdk/gdk.h"
-#include "gdk/gdkx.h"
+/* Protect against the CHARSET struct in Win32 */
+#if GDK_WINDOWING == GDK_WINDOWING_WIN32
+# define CHARSET CHARSETstruct
+#endif
+#include "gdkx.h"
+#if GDK_WINDOWING == GDK_WINDOWING_WIN32
+# undef CHARSET
+#endif
 #include "gdk/gdkkeysyms.h"
 
 #include "gtkbutton.h"
@@ -893,16 +900,16 @@ gtk_font_selection_init(GtkFontSelection *fontsel)
       /* Insert the property names, expanded, and in sorted order.
         But we make sure that the wildcard '*' is first. */
       gtk_clist_freeze (GTK_CLIST(clist));
-      property = "*";
+      property = N_("*");
       gtk_clist_append(GTK_CLIST(clist), &property);
       
       for (i = 1; i < fontsel_info->nproperties[prop]; i++) {
-       property = fontsel_info->properties[prop][i];
+       property = _(fontsel_info->properties[prop][i]);
        if (prop == SLANT)
          property = gtk_font_selection_expand_slant_code(property);
        else if (prop == SPACING)
          property = gtk_font_selection_expand_spacing_code(property);
-       
+
        inserted = FALSE;
        for (row = 1; row < GTK_CLIST(clist)->rows; row++)
          {
@@ -1218,42 +1225,42 @@ gtk_font_selection_show_available_styles (GtkFontSelection *fontsel)
          spacing   = fontsel_info->properties[SPACING]  [spacing_index];
          
          /* Convert '(nil)' weights to 'regular', since it looks nicer. */
-         if      (!g_strcasecmp(weight, "(nil)"))      weight = _("regular");
+         if      (!g_strcasecmp(weight, N_("(nil)")))  weight = N_("regular");
          
          /* We don't show default values or (nil) in the other properties. */
          if      (!g_strcasecmp(slant, "r"))        slant = NULL;
          else if (!g_strcasecmp(slant, "(nil)"))    slant = NULL;
-         else if (!g_strcasecmp(slant, "i"))        slant = _("italic");
-         else if (!g_strcasecmp(slant, "o"))        slant = _("oblique");
-         else if (!g_strcasecmp(slant, "ri"))       slant = _("reverse italic");
-         else if (!g_strcasecmp(slant, "ro"))       slant = _("reverse oblique");
-         else if (!g_strcasecmp(slant, "ot"))       slant = _("other");
+         else if (!g_strcasecmp(slant, "i"))        slant = N_("italic");
+         else if (!g_strcasecmp(slant, "o"))        slant = N_("oblique");
+         else if (!g_strcasecmp(slant, "ri"))       slant = N_("reverse italic");
+         else if (!g_strcasecmp(slant, "ro"))       slant = N_("reverse oblique");
+         else if (!g_strcasecmp(slant, "ot"))       slant = N_("other");
          
          if      (!g_strcasecmp(set_width, "normal")) set_width = NULL;
          else if (!g_strcasecmp(set_width, "(nil)"))  set_width = NULL;
          
          if      (!g_strcasecmp(spacing, "p"))        spacing = NULL;
          else if (!g_strcasecmp(spacing, "(nil)"))    spacing = NULL;
-         else if (!g_strcasecmp(spacing, "m"))        spacing = _("[M]");
-         else if (!g_strcasecmp(spacing, "c"))        spacing = _("[C]");
+         else if (!g_strcasecmp(spacing, "m"))        spacing = N_("[M]");
+         else if (!g_strcasecmp(spacing, "c"))        spacing = N_("[C]");
          
          /* Add the strings together, making sure there is 1 space between
             them */
-         strcpy(buffer, weight);
+         strcpy(buffer, _(weight));
          if (slant)
            {
              strcat(buffer, " ");
-             strcat(buffer, slant);
+             strcat(buffer, _(slant));
            }
          if (set_width)
            {
              strcat(buffer, " ");
-             strcat(buffer, set_width);
+             strcat(buffer, _(set_width));
            }
          if (spacing)
            {
              strcat(buffer, " ");
-             strcat(buffer, spacing);
+             strcat(buffer, _(spacing));
            }
          
          new_item = buffer;
@@ -2482,7 +2489,7 @@ gtk_font_selection_set_filter     (GtkFontSelection *fontsel,
              filter_string = filter_strings[prop][i];
              for (j = 0; j < fontsel_info->nproperties[prop]; j++)
                {
-                 property = fontsel_info->properties[prop][j];
+                 property = _(fontsel_info->properties[prop][j]);
                  property_alt = NULL;
                  if (prop == SLANT)
                    property_alt = gtk_font_selection_expand_slant_code(property);
@@ -2668,26 +2675,29 @@ logfont_to_xlfd (const LOGFONT *lfp,
       ReleaseDC (NULL, hdc);
     }
 
+  /* Don't use _() here, only N_(), the actual translation is done elsewhere */   
   if (lfp->lfWeight >= FW_HEAVY)
-    weight = "heavy";
+    weight = N_("heavy");
   else if (lfp->lfWeight >= FW_EXTRABOLD)
-    weight = "extrabold";
+    weight = N_("extrabold");
   else if (lfp->lfWeight >= FW_BOLD)
-    weight = "bold";
+    weight = N_("bold");
+#ifdef FW_DEMIBOLD
   else if (lfp->lfWeight >= FW_DEMIBOLD)
-    weight = "demibold";
+    weight = N_("demibold");
+#endif
   else if (lfp->lfWeight >= FW_MEDIUM)
-    weight = "medium";
+    weight = N_("medium");
   else if (lfp->lfWeight >= FW_NORMAL)
-    weight = "normal";
+    weight = N_("normal");
   else if (lfp->lfWeight >= FW_LIGHT)
-    weight = "light";
+    weight = N_("light");
   else if (lfp->lfWeight >= FW_EXTRALIGHT)
-    weight = "extralight";
+    weight = N_("extralight");
   else if (lfp->lfWeight >= FW_THIN)
-    weight = "thin";
+    weight = N_("thin");
   else
-    weight = "regular";
+    weight = N_("regular");
 
   if (lfp->lfCharSet == ANSI_CHARSET)
     {
@@ -2711,8 +2721,10 @@ logfont_to_xlfd (const LOGFONT *lfp,
        encoding = "chinesebig5";
       else if (lfp->lfCharSet == OEM_CHARSET)
        encoding = "oem";
+#ifdef JOHAB_CHARSET
       else if (lfp->lfCharSet == JOHAB_CHARSET)
        encoding = "johab";
+#endif
       else if (lfp->lfCharSet == HEBREW_CHARSET)
        encoding = "hebrew";
       else if (lfp->lfCharSet == ARABIC_CHARSET)
@@ -2832,6 +2844,9 @@ gtk_font_selection_get_fonts (void)
   gint num_fonts;
 #elif GDK_WINDOWING == GDK_WINDOWING_WIN32
   LOGFONT logfont;
+#else
+  gint num_fonts = 0;
+  gchar **xfontnames = NULL;
 #endif
   GSList **fontnames;
   gchar *fontname;