gimp r25721 - in trunk: . app/tools



Author: martinn
Date: Tue May 20 17:06:19 2008
New Revision: 25721
URL: http://svn.gnome.org/viewvc/gimp?rev=25721&view=rev

Log:
2008-05-20  Martin Nordholts  <martinn svn gnome org>

	Added statusbar help-messages for the Free Select Tool.

	* app/tools/gimpfreeselecttool.c
	(gimp_free_select_tool_oper_update): Don't bail out if
	tool->display is NULL, instead modify the underlying logic to deal
	with this.


Modified:
   trunk/ChangeLog
   trunk/app/tools/gimpfreeselecttool.c

Modified: trunk/app/tools/gimpfreeselecttool.c
==============================================================================
--- trunk/app/tools/gimpfreeselecttool.c	(original)
+++ trunk/app/tools/gimpfreeselecttool.c	Tue May 20 17:06:19 2008
@@ -221,8 +221,9 @@
 {
   gdouble dist;
 
-  if (fst->polygon_modified ||
-      fst->n_segment_indices <= 1)
+  if (fst->polygon_modified       ||
+      fst->n_segment_indices <= 1 ||
+      GIMP_TOOL (fst)->display == NULL)
     return FALSE;
 
   dist = gimp_draw_tool_calc_distance_square (GIMP_DRAW_TOOL (fst),
@@ -245,23 +246,26 @@
   gint          grabbed_segment_index = INVALID_INDEX;
   gint          i;
 
-  for (i = 0; i < fst->n_segment_indices; i++)
+  if (GIMP_TOOL (fst)->display != NULL)
     {
-      gdouble      dist;
-      GimpVector2 *point;
-
-      point = &fst->points[fst->segment_indices[i]];
+      for (i = 0; i < fst->n_segment_indices; i++)
+        {
+          gdouble      dist;
+          GimpVector2 *point;
 
-      dist = gimp_draw_tool_calc_distance_square (draw_tool,
-                                                  display,
-                                                  coords->x,
-                                                  coords->y,
-                                                  point->x,
-                                                  point->y);
+          point = &fst->points[fst->segment_indices[i]];
 
-      if (dist < shortest_dist)
-        {
-          grabbed_segment_index = i;
+          dist = gimp_draw_tool_calc_distance_square (draw_tool,
+                                                      display,
+                                                      coords->x,
+                                                      coords->y,
+                                                      point->x,
+                                                      point->y);
+
+          if (dist < shortest_dist)
+            {
+              grabbed_segment_index = i;
+            }
         }
     }
 
@@ -733,6 +737,47 @@
 }
 
 static void
+gimp_free_select_tool_status_update (GimpFreeSelectTool *fst,
+                                     GimpDisplay        *display,
+                                     GimpCoords         *coords,
+                                     gboolean            proximity)
+{
+  GimpTool *tool = GIMP_TOOL (fst);
+
+  gimp_tool_pop_status (tool, display);
+
+  if (proximity)
+    {
+      const gchar *status_text = NULL;
+
+      if (gimp_free_select_tool_is_point_grabbed (fst))
+        {
+          if (gimp_free_select_tool_should_close (fst, display, coords))
+            {
+              status_text = _("Click to complete selection");
+            }
+          else
+            {
+              status_text = _("Click-Drag to move segment vertex");
+            }
+        }
+      else if (fst->n_points >= 3)
+        {
+          status_text = _("Return commits, Escape cancels, Backspace removes last segment");
+        }
+      else
+        {
+          status_text = _("Click-Drag creates free segment, Click creates polygonal segment");
+        }
+
+      if (status_text)
+        {
+          gimp_tool_push_status (tool, display, status_text);
+        }
+    }
+}
+
+static void
 gimp_free_select_tool_control (GimpTool       *tool,
                                GimpToolAction  action,
                                GimpDisplay    *display)
@@ -761,9 +806,6 @@
   GimpFreeSelectTool *fst;
   gboolean            hovering_first_point;
 
-  if (tool->display != display)
-    return;
-
   fst = GIMP_FREE_SELECT_TOOL (tool);
 
   gimp_free_select_tool_select_closest_segment_point (fst,
@@ -798,6 +840,8 @@
     }
 
   gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
+
+  gimp_free_select_tool_status_update (fst, display, coords, proximity);
 }
 
 static void



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