gimp r26405 - in branches/soc-2008-tagging: . app/widgets



Author: aurisj
Date: Wed Aug  6 19:41:08 2008
New Revision: 26405
URL: http://svn.gnome.org/viewvc/gimp?rev=26405&view=rev

Log:
2008-08-06  Aurimas JuÅka  <aurisj svn gnome org>

	* app/widgets/gimpcombotagentry.c
	* app/widgets/gimptagentry.c
	* app/widgets/gimptagpopup.c: implemented RTL text direction support.



Modified:
   branches/soc-2008-tagging/ChangeLog
   branches/soc-2008-tagging/app/widgets/gimpcombotagentry.c
   branches/soc-2008-tagging/app/widgets/gimptagentry.c
   branches/soc-2008-tagging/app/widgets/gimptagpopup.c

Modified: branches/soc-2008-tagging/app/widgets/gimpcombotagentry.c
==============================================================================
--- branches/soc-2008-tagging/app/widgets/gimpcombotagentry.c	(original)
+++ branches/soc-2008-tagging/app/widgets/gimpcombotagentry.c	Wed Aug  6 19:41:08 2008
@@ -137,8 +137,16 @@
   gtk_widget_add_events (GTK_WIDGET (combo_entry),
                          GDK_BUTTON_PRESS_MASK);
 
-  border.left   = 2;
-  border.right  = 8 + 2 * 2 + 2;
+  if (gtk_widget_get_direction (GTK_WIDGET (combo_entry)) == GTK_TEXT_DIR_RTL)
+    {
+      border.left   = 8 + 2 * 2 + 2;
+      border.right  = 2;
+    }
+  else
+    {
+      border.left   = 2;
+      border.right  = 8 + 2 * 2 + 2;
+    }
   border.top    = 2;
   border.bottom = 2;
   gtk_entry_set_inner_border (GTK_ENTRY (combo_entry), &border);
@@ -177,14 +185,22 @@
   tag_count = gimp_filtered_container_get_tag_count (combo_entry->filtered_container);
 
   gdk_drawable_get_size (GDK_DRAWABLE (event->window), &window_width, &window_height);
-  gdk_draw_rectangle (event->window, widget->style->base_gc[widget->state],
-                      TRUE, window_width - 16, 0, 16, window_height);
+  if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+    {
+      gdk_draw_rectangle (event->window, widget->style->base_gc[widget->state],
+                          TRUE, 0, 0, 14, window_height);
+    }
+  else
+    {
+      gdk_draw_rectangle (event->window, widget->style->base_gc[widget->state],
+                          TRUE, window_width - 14, 0, 14, window_height);
+    }
 
   gtk_paint_arrow (widget->style,
                    event->window, tag_count > 0 ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
                    GTK_SHADOW_NONE, NULL, NULL, NULL,
                    GTK_ARROW_DOWN, TRUE,
-                   arrow_rect.x + arrow_rect.width - 14,
+                   arrow_rect.x + arrow_rect.width / 2 - 4,
                    arrow_rect.y + arrow_rect.height / 2 - 4, 8, 8);
 
   return FALSE;
@@ -307,9 +323,16 @@
 {
   GtkWidget    *widget = GTK_WIDGET (combo_entry);
 
-  arrow_rect->x = widget->allocation.width - 16 - widget->style->xthickness;
+  if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+    {
+      arrow_rect->x = widget->style->xthickness;
+    }
+  else
+    {
+      arrow_rect->x = widget->allocation.width - 16 - widget->style->xthickness * 2;
+    }
   arrow_rect->y = 0;
-  arrow_rect->width = 16;
+  arrow_rect->width = 12;
   arrow_rect->height = widget->allocation.height - widget->style->ythickness * 2;
 }
 

Modified: branches/soc-2008-tagging/app/widgets/gimptagentry.c
==============================================================================
--- branches/soc-2008-tagging/app/widgets/gimptagentry.c	(original)
+++ branches/soc-2008-tagging/app/widgets/gimptagentry.c	Wed Aug  6 19:41:08 2008
@@ -1084,7 +1084,9 @@
   PangoAttrList        *attr_list;
   PangoAttribute       *attribute;
   PangoRenderer        *renderer;
+  gint                  layout_width;
   gint                  layout_height;
+  gint                  window_width;
   gint                  window_height;
   gint                  offset;
   const char           *display_text;
@@ -1120,10 +1122,21 @@
   gdk_pango_renderer_set_gc (GDK_PANGO_RENDERER (renderer),
                              widget->style->text_gc[GTK_STATE_INSENSITIVE]);
   pango_layout_set_text (layout, display_text, -1);
-  gdk_drawable_get_size (GDK_DRAWABLE (event->window), NULL, &window_height);
-  pango_layout_get_size (layout, NULL, &layout_height);
+  gdk_drawable_get_size (GDK_DRAWABLE (event->window),
+                         &window_width, &window_height);
+  pango_layout_get_size (layout,
+                         &layout_width, &layout_height);
   offset = (window_height * PANGO_SCALE - layout_height) / 2;
-  pango_renderer_draw_layout (renderer, layout, offset, offset);
+  if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+    {
+      pango_renderer_draw_layout (renderer, layout,
+                                  window_width * PANGO_SCALE - layout_width - offset,
+                                  offset);
+    }
+  else
+    {
+      pango_renderer_draw_layout (renderer, layout, offset, offset);
+    }
   gdk_pango_renderer_set_drawable (GDK_PANGO_RENDERER (renderer), NULL);
   gdk_pango_renderer_set_gc (GDK_PANGO_RENDERER (renderer), NULL);
   g_object_unref (layout);

Modified: branches/soc-2008-tagging/app/widgets/gimptagpopup.c
==============================================================================
--- branches/soc-2008-tagging/app/widgets/gimptagpopup.c	(original)
+++ branches/soc-2008-tagging/app/widgets/gimptagpopup.c	Wed Aug  6 19:41:08 2008
@@ -405,6 +405,24 @@
 
       x += tag_popup->tag_data[i].bounds.width + space_width + 5;
     }
+  if (gtk_widget_get_direction (GTK_WIDGET (tag_popup)) == GTK_TEXT_DIR_RTL)
+    {
+      GList    *iterator;
+
+      for (i = 0; i < tag_popup->tag_count; i++)
+        {
+          PopupTagData *tag_data = &tag_popup->tag_data[i];
+          tag_data->bounds.x = width - tag_data->bounds.x - tag_data->bounds.width;
+        }
+
+      iterator = tag_popup->close_rectangles;
+      while (iterator)
+        {
+          GdkRectangle *rect = (GdkRectangle *) iterator->data;
+          rect->x = width - rect->x - rect->width;
+          iterator = g_list_next (iterator);
+        }
+    }
   height = y + line_height + GIMP_TAG_POPUP_MARGIN;
 
   return height;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]