[gimp] Bug 795950 - Foreground selection tool requires use of the Enter key.



commit a89dc87aec6f9cdd005bb2b98bccb1728029866d
Author: Jehan <jehan girinstud io>
Date:   Sun May 13 19:21:57 2018 +0200

    Bug 795950 - Foreground selection tool requires use of the Enter key.
    
    It is not obvious that you have to hit Enter to validate the first step
    of Foreground Selection tool, i.e. the rough free selection. Adding this
    information in status message.
    
    Since Enter would only work once the free selection is closed or that
    you have at least 3 points (then Enter closes the selection for you), I
    also add gimp_free_select_tool_get_n_points() so that we can know how
    many points were created from the Foreground Select tool, and only
    update the status message when relevant.

 app/tools/gimpforegroundselecttool.c |   20 +++++++++++++++-----
 app/tools/gimpfreeselecttool.c       |   14 ++++++++++++++
 app/tools/gimpfreeselecttool.h       |    1 +
 3 files changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c
index c98a0a4..03b03b2 100644
--- a/app/tools/gimpforegroundselecttool.c
+++ b/app/tools/gimpforegroundselecttool.c
@@ -609,7 +609,17 @@ gimp_foreground_select_tool_oper_update (GimpTool         *tool,
   if (fg_select->state == MATTING_STATE_FREE_SELECT)
     {
       if (GIMP_SELECTION_TOOL (tool)->function == SELECTION_SELECT)
-        status_stage = _("Roughly outline the object to extract");
+        {
+          if (gimp_free_select_tool_get_n_points (GIMP_FREE_SELECT_TOOL (tool)) > 2)
+            {
+              status_mode = _("Roughly outline the object to extract");
+              status_stage = _("press Enter to validate.");
+            }
+          else
+            {
+              status_stage = _("Roughly outline the object to extract");
+            }
+        }
     }
   else
     {
@@ -630,11 +640,11 @@ gimp_foreground_select_tool_oper_update (GimpTool         *tool,
       gimp_draw_tool_resume (draw_tool);
 
       if (options->draw_mode == GIMP_MATTING_DRAW_MODE_FOREGROUND)
-        status_mode = _("Selecting foreground,");
+        status_mode = _("Selecting foreground");
       else if (options->draw_mode == GIMP_MATTING_DRAW_MODE_BACKGROUND)
-        status_mode = _("Selecting background,");
+        status_mode = _("Selecting background");
       else
-        status_mode = _("Selecting unknown,");
+        status_mode = _("Selecting unknown");
 
       if (fg_select->state == MATTING_STATE_PAINT_TRIMAP)
         status_stage = _("press Enter to preview.");
@@ -645,7 +655,7 @@ gimp_foreground_select_tool_oper_update (GimpTool         *tool,
   if (proximity && status_stage)
     {
       if (status_mode)
-        gimp_tool_replace_status (tool, display, "%s %s", status_mode, status_stage);
+        gimp_tool_replace_status (tool, display, "%s, %s", status_mode, status_stage);
       else
         gimp_tool_replace_status (tool, display, "%s", status_stage);
     }
diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c
index 302e19d..3ecfcfb 100644
--- a/app/tools/gimpfreeselecttool.c
+++ b/app/tools/gimpfreeselecttool.c
@@ -134,6 +134,20 @@ gimp_free_select_tool_register (GimpToolRegisterCallback  callback,
                 data);
 }
 
+gint
+gimp_free_select_tool_get_n_points (GimpFreeSelectTool *tool)
+{
+  GimpFreeSelectToolPrivate *private = tool->private;
+  const GimpVector2         *points;
+  gint                       n_points = 0;
+
+  if (private->widget)
+    gimp_tool_polygon_get_points (GIMP_TOOL_POLYGON (private->widget),
+                                  &points, &n_points);
+
+  return n_points;
+}
+
 static void
 gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass)
 {
diff --git a/app/tools/gimpfreeselecttool.h b/app/tools/gimpfreeselecttool.h
index 55a57e6..33d0101 100644
--- a/app/tools/gimpfreeselecttool.h
+++ b/app/tools/gimpfreeselecttool.h
@@ -59,5 +59,6 @@ void    gimp_free_select_tool_register (GimpToolRegisterCallback  callback,
 
 GType   gimp_free_select_tool_get_type (void) G_GNUC_CONST;
 
+gint    gimp_free_select_tool_get_n_points (GimpFreeSelectTool *tool);
 
 #endif  /*  __GIMP_FREE_SELECT_TOOL_H__  */


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