changeset 3038:ff886a3a2098

little tweak to handle_special_char()
author Tomasz Mon <desowin@gmail.com>
date Wed, 11 Jul 2007 22:33:43 +0200
parents 06dd5f78c023
children c981df78db8c 067e0186623a
files src/audacious/ui_skinned_textbox.c
diffstat 1 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_skinned_textbox.c	Wed Jul 11 22:29:43 2007 +0200
+++ b/src/audacious/ui_skinned_textbox.c	Wed Jul 11 22:33:43 2007 +0200
@@ -89,7 +89,7 @@
 static void textbox_generate_xfont_pixmap         (UiSkinnedTextbox *textbox, const gchar *pixmaptext);
 static gboolean textbox_scroll                    (gpointer data);
 static void textbox_generate_pixmap               (UiSkinnedTextbox *textbox);
-static void textbox_handle_special_char           (gchar c, gint * x, gint * y);
+static void textbox_handle_special_char           (gchar *c, gint * x, gint * y);
 
 static GtkWidgetClass *parent_class = NULL;
 static guint textbox_signals[LAST_SIGNAL] = { 0 };
@@ -724,7 +724,7 @@
             y = bmp_active_skin->properties.textbox_bitmap_font_height;
         }
         else
-            textbox_handle_special_char(c, &x, &y);
+            textbox_handle_special_char(tmp, &x, &y);
 
         skin_draw_pixmap(bmp_active_skin,
                          priv->pixmap, gc, priv->skin_index,
@@ -764,10 +764,10 @@
     }
 }
 
-static void textbox_handle_special_char(gchar c, gint * x, gint * y) {
+static void textbox_handle_special_char(gchar *c, gint * x, gint * y) {
     gint tx, ty;
 
-    switch (c) {
+    switch (*c) {
     case '"':
         tx = 26;
         ty = 0;
@@ -869,6 +869,28 @@
         break;
     }
 
+    const gchar *change[] = {"Ą", "A", "Ę", "E", "Ć", "C", "Ł", "L", "Ó", "O", "Ś", "S", "Ż", "Z", "Ź", "Z",
+                             "Ü", "U", NULL};
+    int i;
+    for (i = 0; change[i]; i+=2) {
+         if (!strncmp(c, change[i], strlen(change[i]))) {
+             tx = (*change[i+1] - 'A');
+             break;
+         }
+    }
+
+    /* those are commonly included into skins */
+    if (!strncmp(c, "Å", strlen("Å"))) {
+        tx = 0;
+        ty = 2;
+    } else if (!strncmp(c, "Ö", strlen("Ö"))) {
+        tx = 1;
+        ty = 2;
+    } else if (!strncmp(c, "Ä", strlen("Ä"))) {
+        tx = 2;
+        ty = 2;
+    }
+
     *x = tx * bmp_active_skin->properties.textbox_bitmap_font_width;
     *y = ty * bmp_active_skin->properties.textbox_bitmap_font_height;
 }