[gimp] app: fix cursor precision of various tools



commit 158705e4ef7be28bff83f51df48985b8f4ea6718
Author: Ell <ell_se yahoo com>
Date:   Thu Jan 31 04:37:56 2019 -0500

    app: fix cursor precision of various tools
    
    Fix the cursor precision of the cage-transform, foreground-select,
    n-point deformation, and warp-transform tools.

 app/tools/gimpcagetool.c              |  2 ++
 app/tools/gimpforegroundselecttool.c  | 13 ++++++++++++-
 app/tools/gimpnpointdeformationtool.c |  2 ++
 app/tools/gimpwarptool.c              |  2 ++
 4 files changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/app/tools/gimpcagetool.c b/app/tools/gimpcagetool.c
index 9ebb124663..854490a55c 100644
--- a/app/tools/gimpcagetool.c
+++ b/app/tools/gimpcagetool.c
@@ -196,6 +196,8 @@ gimp_cage_tool_init (GimpCageTool *self)
                                      GIMP_DIRTY_SELECTION       |
                                      GIMP_DIRTY_ACTIVE_DRAWABLE);
   gimp_tool_control_set_wants_click (tool->control, TRUE);
+  gimp_tool_control_set_precision   (tool->control,
+                                     GIMP_CURSOR_PRECISION_SUBPIXEL);
   gimp_tool_control_set_tool_cursor (tool->control,
                                      GIMP_TOOL_CURSOR_PERSPECTIVE);
 
diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c
index 1656782bea..449cb13d19 100644
--- a/app/tools/gimpforegroundselecttool.c
+++ b/app/tools/gimpforegroundselecttool.c
@@ -240,7 +240,7 @@ gimp_foreground_select_tool_init (GimpForegroundSelectTool *fg_select)
                                      GIMP_DIRTY_IMAGE_SIZE |
                                      GIMP_DIRTY_ACTIVE_DRAWABLE);
   gimp_tool_control_set_precision   (tool->control,
-                                     GIMP_CURSOR_PRECISION_PIXEL_CENTER);
+                                     GIMP_CURSOR_PRECISION_SUBPIXEL);
   gimp_tool_control_set_tool_cursor (tool->control,
                                      GIMP_TOOL_CURSOR_FREE_SELECT);
 
@@ -973,6 +973,13 @@ gimp_foreground_select_tool_halt (GimpForegroundSelectTool *fg_select)
 
   gimp_tool_control_set_toggled (tool->control, FALSE);
 
+  /*  set precision to SUBPIXEL, because it may have been changed to
+   *  PIXEL_CENTER if the tool has switched to MATTING_STATE_PAINT_TRIMAP,
+   *  in gimp_foreground_select_tool_set_trimap().
+   */
+  gimp_tool_control_set_precision (tool->control,
+                                   GIMP_CURSOR_PRECISION_SUBPIXEL);
+
   fg_select->state = MATTING_STATE_FREE_SELECT;
 
   /*  update the undo actions / menu items  */
@@ -1040,6 +1047,10 @@ gimp_foreground_select_tool_set_trimap (GimpForegroundSelectTool *fg_select)
   /* disable double click in paint trimap state */
   gimp_tool_control_set_wants_double_click (tool->control, FALSE);
 
+  /* set precision to PIXEL_CENTER in paint trimap state */
+  gimp_tool_control_set_precision (tool->control,
+                                   GIMP_CURSOR_PRECISION_PIXEL_CENTER);
+
   fg_select->state = MATTING_STATE_PAINT_TRIMAP;
 
   gimp_foreground_select_tool_update_gui (fg_select);
diff --git a/app/tools/gimpnpointdeformationtool.c b/app/tools/gimpnpointdeformationtool.c
index c95941ab06..0b653dee34 100644
--- a/app/tools/gimpnpointdeformationtool.c
+++ b/app/tools/gimpnpointdeformationtool.c
@@ -188,6 +188,8 @@ gimp_n_point_deformation_tool_init (GimpNPointDeformationTool *npd_tool)
 {
   GimpTool *tool = GIMP_TOOL (npd_tool);
 
+  gimp_tool_control_set_precision            (tool->control,
+                                              GIMP_CURSOR_PRECISION_SUBPIXEL);
   gimp_tool_control_set_tool_cursor          (tool->control,
                                               GIMP_TOOL_CURSOR_PERSPECTIVE);
   gimp_tool_control_set_preserve             (tool->control, FALSE);
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index bc5f659641..31c7ba77b6 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -201,6 +201,8 @@ gimp_warp_tool_init (GimpWarpTool *self)
   gimp_tool_control_set_dirty_action    (tool->control,
                                          GIMP_TOOL_ACTION_COMMIT);
   gimp_tool_control_set_wants_click     (tool->control, TRUE);
+  gimp_tool_control_set_precision       (tool->control,
+                                         GIMP_CURSOR_PRECISION_SUBPIXEL);
   gimp_tool_control_set_tool_cursor     (tool->control,
                                          GIMP_TOOL_CURSOR_WARP);
   gimp_tool_control_set_action_size     (tool->control,


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