[gimp] app: GimpColorTool and GimpMoveTool: don't start the draw tool twice



commit 7d39d800fcdc2f7f69ff23847de081c7fa993218
Author: Michael Natterer <mitch gimp org>
Date:   Mon Apr 4 19:20:04 2011 +0200

    app: GimpColorTool and GimpMoveTool: don't start the draw tool twice
    
    and some minor coding style cleanup.

 app/tools/gimpcolortool.c |   14 ++++++--------
 app/tools/gimpmovetool.c  |    5 +++--
 2 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/app/tools/gimpcolortool.c b/app/tools/gimpcolortool.c
index fe21ccf..60b0bfb 100644
--- a/app/tools/gimpcolortool.c
+++ b/app/tools/gimpcolortool.c
@@ -221,7 +221,8 @@ gimp_color_tool_button_press (GimpTool            *tool,
 
       gimp_display_shell_selection_pause (shell);
 
-      gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
+      if (! gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tool)))
+        gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
 
       gimp_tool_push_status_coords (tool, display,
                                     gimp_tool_control_get_precision (tool->control),
@@ -432,12 +433,11 @@ gimp_color_tool_oper_update (GimpTool         *tool,
   GimpImage        *image        = gimp_display_get_image (display);
   GimpSamplePoint  *sample_point = NULL;
 
-  if (color_tool->enabled &&
-      gimp_display_shell_get_show_sample_points (shell) && proximity)
+  if (color_tool->enabled                               &&
+      gimp_display_shell_get_show_sample_points (shell) &&
+      proximity)
     {
-      gint snap_distance;
-
-      snap_distance = GIMP_DISPLAY_CONFIG (display->gimp->config)->snap_distance;
+      gint snap_distance = display->config->snap_distance;
 
       sample_point =
         gimp_image_find_sample_point (image,
@@ -566,8 +566,6 @@ gimp_color_tool_draw (GimpDrawTool *draw_tool)
                                         2 * radius + 1);
         }
     }
-
-  GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool);
 }
 
 static gboolean
diff --git a/app/tools/gimpmovetool.c b/app/tools/gimpmovetool.c
index af9abc4..f52e23c 100644
--- a/app/tools/gimpmovetool.c
+++ b/app/tools/gimpmovetool.c
@@ -239,7 +239,8 @@ gimp_move_tool_button_press (GimpTool            *tool,
 
               gimp_display_shell_selection_pause (shell);
 
-              gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
+              if (! gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tool)))
+                gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
 
               gimp_tool_push_status_length (tool, display,
                                             _("Move Guide: "),
@@ -626,7 +627,7 @@ gimp_move_tool_oper_update (GimpTool         *tool,
       gimp_display_shell_get_show_guides (shell)      &&
       proximity)
     {
-      const gint snap_distance = display->config->snap_distance;
+      gint snap_distance = display->config->snap_distance;
 
       guide = gimp_image_find_guide (image, coords->x, coords->y,
                                      FUNSCALEX (shell, snap_distance),



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