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



Author: aurisj
Date: Wed Jul 30 19:15:43 2008
New Revision: 26340
URL: http://svn.gnome.org/viewvc/gimp?rev=26340&view=rev

Log:
2008-07-30  Aurimas JuÅka  <aurisj svn gnome org>

	* app/widgets/gimptagpopup.[ch]: added support for single tag
	selection in tag popup. User can press mouse button, drag to select a
	tag and release mouse button. Selected tag is toggled
	selected/deselected and popup is closed.



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	Wed Jul 30 19:15:43 2008
@@ -181,7 +181,9 @@
 
   drawing_area = gtk_drawing_area_new ();
   gtk_widget_add_events (GTK_WIDGET (drawing_area),
-                         GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK);
+                         GDK_BUTTON_PRESS_MASK
+                         | GDK_BUTTON_RELEASE_MASK
+                         | GDK_POINTER_MOTION_MASK);
   gtk_container_add (GTK_CONTAINER (alignment), drawing_area);
 
   popup->combo_entry          = combo_entry;
@@ -598,6 +600,8 @@
       GdkRectangle     *bounds;
       GimpTag          *tag;
 
+      tag_popup->single_select_disabled = TRUE;
+
       button_event = (GdkEventButton *) event;
       x = button_event->x;
       y = button_event->y;
@@ -653,6 +657,40 @@
           gtk_widget_queue_draw (widget);
         }
     }
+  else if (event->type == GDK_BUTTON_RELEASE
+           && !tag_popup->single_select_disabled)
+    {
+      GdkEventButton   *button_event;
+      gint              x;
+      gint              y;
+      gint              i;
+      GdkRectangle     *bounds;
+      GimpTag          *tag;
+
+      tag_popup->single_select_disabled = TRUE;
+
+      button_event = (GdkEventButton *) event;
+      x = button_event->x;
+      y = button_event->y;
+
+      y += tag_popup->scroll_y;
+
+      for (i = 0; i < tag_popup->tag_count; i++)
+        {
+          bounds = &tag_popup->tag_data[i].bounds;
+          if (x >= bounds->x
+              && y >= bounds->y
+              && x < bounds->x + bounds->width
+              && y < bounds->y + bounds->height)
+            {
+              tag = tag_popup->tag_data[i].tag;
+              gimp_tag_popup_toggle_tag (tag_popup,
+                                         &tag_popup->tag_data[i]);
+              gtk_widget_destroy (GTK_WIDGET (tag_popup));
+              break;
+            }
+        }
+    }
 
   return FALSE;
 }

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	Wed Jul 30 19:15:43 2008
@@ -60,6 +60,7 @@
   gboolean              ignore_button_release;
   gboolean              upper_arrow_prelight;
   gboolean              lower_arrow_prelight;
+  gboolean              single_select_disabled;
   GtkStateType          upper_arrow_state;
   GtkStateType          lower_arrow_state;
 };



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