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



Author: aurisj
Date: Tue Aug  5 17:34:08 2008
New Revision: 26393
URL: http://svn.gnome.org/viewvc/gimp?rev=26393&view=rev

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

	* app/widgets/gimptagpopup.[ch]: horizontal space at the end of each
	line can be used to close tag popup.



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

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	Tue Aug  5 17:34:08 2008
@@ -133,12 +133,20 @@
       g_object_unref (tag_popup->layout);
       tag_popup->layout = NULL;
     }
+
   if (tag_popup->context)
     {
       g_object_unref (tag_popup->context);
       tag_popup->context = NULL;
     }
 
+  if (tag_popup->close_rectangles)
+    {
+      g_list_foreach (tag_popup->close_rectangles, (GFunc) g_free, NULL);
+      g_list_free (tag_popup->close_rectangles);
+      tag_popup->close_rectangles = NULL;
+    }
+
   g_free (tag_popup->tag_data);
   tag_popup->tag_data = NULL;
 
@@ -376,6 +384,16 @@
       tag_popup->tag_data[i].bounds.height     /= PANGO_SCALE;
       if (tag_popup->tag_data[i].bounds.width + x + 3 +GIMP_TAG_POPUP_MARGIN > width)
         {
+          if (tag_popup->tag_data[i].bounds.width + line_height + GIMP_TAG_POPUP_MARGIN < width)
+            {
+              GdkRectangle     *close_rect = g_malloc (sizeof (GdkRectangle));
+              close_rect->x = x;
+              close_rect->y = y;
+              close_rect->width = width - (tag_popup->tag_data[i].bounds.width + line_height + GIMP_TAG_POPUP_MARGIN);
+              close_rect->height = line_height + 2;
+              tag_popup->close_rectangles = g_list_append (tag_popup->close_rectangles,
+                                                           close_rect);
+            }
           x = GIMP_TAG_POPUP_MARGIN;
           y += line_height + 2;
         }
@@ -682,6 +700,26 @@
               break;
             }
         }
+
+      if (i == tag_popup->tag_count)
+        {
+          GList            *iterator = tag_popup->close_rectangles;
+
+          while (iterator)
+            {
+              bounds = (GdkRectangle *) iterator->data;
+              if (x >= bounds->x
+                  && y >= bounds->y
+                  && x < bounds->x + bounds->width
+                  && y < bounds->y + bounds->height)
+                {
+                  gtk_widget_destroy (GTK_WIDGET (tag_popup));
+                  break;
+                }
+
+              iterator = g_list_next (iterator);
+            }
+        }
     }
   else if (event->type == GDK_MOTION_NOTIFY)
     {

Modified: branches/soc-2008-tagging/app/widgets/gimptagpopup.h
==============================================================================
--- branches/soc-2008-tagging/app/widgets/gimptagpopup.h	(original)
+++ branches/soc-2008-tagging/app/widgets/gimptagpopup.h	Tue Aug  5 17:34:08 2008
@@ -50,6 +50,7 @@
   PopupTagData         *tag_data;
   PopupTagData         *prelight;
   gint                  tag_count;
+  GList                *close_rectangles;
   guint                 timeout_id;
   gint                  scroll_height;
   gint                  scroll_y;



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