gimp r24965 - in trunk: . libgimpwidgets



Author: neo
Date: Tue Feb 26 09:47:29 2008
New Revision: 24965
URL: http://svn.gnome.org/viewvc/gimp?rev=24965&view=rev

Log:
2008-02-26  Sven Neumann  <sven gimp org>

	* libgimpwidgets/gimpchainbutton.c: use event boxes without
	visible window instead of drawing areas for the lines besides the
	button. Fixes the background which was drawn wrongly for many
	themes.


Modified:
   trunk/ChangeLog
   trunk/libgimpwidgets/gimpchainbutton.c

Modified: trunk/libgimpwidgets/gimpchainbutton.c
==============================================================================
--- trunk/libgimpwidgets/gimpchainbutton.c	(original)
+++ trunk/libgimpwidgets/gimpchainbutton.c	Tue Feb 26 09:47:29 2008
@@ -118,8 +118,13 @@
   button->position = GIMP_CHAIN_TOP;
   button->active   = FALSE;
 
-  button->line1    = gtk_drawing_area_new ();
-  button->line2    = gtk_drawing_area_new ();
+
+  button->line1    = g_object_new (GTK_TYPE_EVENT_BOX,
+                                   "visible-window", FALSE,
+                                   NULL);
+  button->line2    = g_object_new (GTK_TYPE_EVENT_BOX,
+                                   "visible-window", FALSE,
+                                   NULL);
   button->image    = gtk_image_new ();
 
   button->button   = gtk_button_new ();
@@ -303,7 +308,7 @@
 {
   GdkPoint           points[3];
   GdkPoint           buf;
-  GtkShadowType             shadow;
+  GtkShadowType      shadow;
   GimpChainPosition  position;
   gint               which_line;
 
@@ -313,25 +318,30 @@
 
   g_return_val_if_fail (GIMP_IS_CHAIN_BUTTON (button), FALSE);
 
-  points[0].x = widget->allocation.width / 2;
-  points[0].y = widget->allocation.height / 2;
+  points[0].x = widget->allocation.x + widget->allocation.width  / 2;
+  points[0].y = widget->allocation.y + widget->allocation.height / 2;
 
   which_line = (widget == button->line1) ? 1 : -1;
 
   position = button->position;
 
   if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
-    switch (position)
-      {
-      case GIMP_CHAIN_LEFT:
-        position = GIMP_CHAIN_RIGHT;
-        break;
-      case GIMP_CHAIN_RIGHT:
-        position = GIMP_CHAIN_LEFT;
-        break;
-      default:
-        break;
-      }
+    {
+      switch (position)
+        {
+        case GIMP_CHAIN_TOP:
+        case GIMP_CHAIN_BOTTOM:
+          break;
+
+        case GIMP_CHAIN_LEFT:
+          position = GIMP_CHAIN_RIGHT;
+          break;
+
+        case GIMP_CHAIN_RIGHT:
+          position = GIMP_CHAIN_LEFT;
+          break;
+        }
+    }
 
   switch (position)
     {
@@ -340,33 +350,45 @@
       points[1].x = points[0].x - SHORT_LINE;
       points[1].y = points[0].y;
       points[2].x = points[1].x;
-      points[2].y = (which_line == 1) ? widget->allocation.height - 1 : 0;
+      points[2].y = (which_line == 1 ?
+                     widget->allocation.y + widget->allocation.height - 1 :
+                     widget->allocation.y);
       shadow = GTK_SHADOW_ETCHED_IN;
       break;
+
     case GIMP_CHAIN_RIGHT:
       points[0].x -= SHORT_LINE;
       points[1].x = points[0].x + SHORT_LINE;
       points[1].y = points[0].y;
       points[2].x = points[1].x;
-      points[2].y = (which_line == 1) ? widget->allocation.height - 1 : 0;
+      points[2].y = (which_line == 1 ?
+                     widget->allocation.y + widget->allocation.height - 1 :
+                     widget->allocation.y);
       shadow = GTK_SHADOW_ETCHED_OUT;
       break;
+
     case GIMP_CHAIN_TOP:
       points[0].y += SHORT_LINE;
       points[1].x = points[0].x;
       points[1].y = points[0].y - SHORT_LINE;
-      points[2].x = (which_line == 1) ? widget->allocation.width - 1 : 0;
+      points[2].x = (which_line == 1 ?
+                     widget->allocation.x + widget->allocation.width - 1 :
+                     widget->allocation.x);
       points[2].y = points[1].y;
       shadow = GTK_SHADOW_ETCHED_OUT;
       break;
+
     case GIMP_CHAIN_BOTTOM:
       points[0].y -= SHORT_LINE;
       points[1].x = points[0].x;
       points[1].y = points[0].y + SHORT_LINE;
-      points[2].x = (which_line == 1) ? widget->allocation.width - 1 : 0;
+      points[2].x = (which_line == 1 ?
+                     widget->allocation.x + widget->allocation.width - 1 :
+                     widget->allocation.x);
       points[2].y = points[1].y;
       shadow = GTK_SHADOW_ETCHED_IN;
       break;
+
     default:
       return FALSE;
     }



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