[gimp] app: add a protected gimp_tool_transform_grid_get_handle() function



commit 4ddf1afb442fe93c9879c4292ae213ec687d89b1
Author: Ell <ell_se yahoo com>
Date:   Mon Jan 6 16:37:12 2020 +0200

    app: add a protected gimp_tool_transform_grid_get_handle() function
    
    ... which can be used by subclasses to retrieve the currently-
    active handle.

 app/display/gimptooltransformgrid.c | 23 ++++++++++++++++++-----
 app/display/gimptooltransformgrid.h | 20 ++++++++++++--------
 2 files changed, 30 insertions(+), 13 deletions(-)
---
diff --git a/app/display/gimptooltransformgrid.c b/app/display/gimptooltransformgrid.c
index 8070924b21..ffbd66b84d 100644
--- a/app/display/gimptooltransformgrid.c
+++ b/app/display/gimptooltransformgrid.c
@@ -196,7 +196,8 @@ static gboolean gimp_tool_transform_grid_get_cursor     (GimpToolWidget        *
                                                          GimpCursorModifier    *modifier);
 
 static GimpTransformHandle
-                gimp_tool_transform_grid_get_handle     (GimpToolTransformGrid *grid,
+                gimp_tool_transform_grid_get_handle_for_coords
+                                                        (GimpToolTransformGrid *grid,
                                                          const GimpCoords      *coords);
 static void     gimp_tool_transform_grid_update_hilight (GimpToolTransformGrid *grid);
 static void     gimp_tool_transform_grid_update_box     (GimpToolTransformGrid *grid);
@@ -1983,7 +1984,7 @@ gimp_tool_transform_grid_hit (GimpToolWidget   *widget,
   GimpToolTransformGrid *grid = GIMP_TOOL_TRANSFORM_GRID (widget);
   GimpTransformHandle    handle;
 
-  handle = gimp_tool_transform_grid_get_handle (grid, coords);
+  handle = gimp_tool_transform_grid_get_handle_for_coords (grid, coords);
 
   if (handle != GIMP_TRANSFORM_HANDLE_NONE)
     return GIMP_HIT_DIRECT;
@@ -2001,7 +2002,7 @@ gimp_tool_transform_grid_hover (GimpToolWidget   *widget,
   GimpToolTransformGridPrivate *private = grid->private;
   GimpTransformHandle           handle;
 
-  handle = gimp_tool_transform_grid_get_handle (grid, coords);
+  handle = gimp_tool_transform_grid_get_handle_for_coords (grid, coords);
 
   if (handle == GIMP_TRANSFORM_HANDLE_NONE)
     {
@@ -2303,8 +2304,8 @@ gimp_tool_transform_grid_get_cursor (GimpToolWidget     *widget,
 }
 
 static GimpTransformHandle
-gimp_tool_transform_grid_get_handle (GimpToolTransformGrid *grid,
-                                     const GimpCoords      *coords)
+gimp_tool_transform_grid_get_handle_for_coords (GimpToolTransformGrid *grid,
+                                                const GimpCoords      *coords)
 {
   GimpToolTransformGridPrivate *private = grid->private;
   GimpTransformHandle           i;
@@ -2478,3 +2479,15 @@ gimp_tool_transform_grid_new (GimpDisplayShell  *shell,
                        "y2",         y2,
                        NULL);
 }
+
+
+/*  protected functions  */
+
+GimpTransformHandle
+gimp_tool_transform_grid_get_handle (GimpToolTransformGrid *grid)
+{
+  g_return_val_if_fail (GIMP_IS_TOOL_TRANSFORM_GRID (grid),
+                        GIMP_TRANSFORM_HANDLE_NONE);
+
+  return grid->private->handle;
+}
diff --git a/app/display/gimptooltransformgrid.h b/app/display/gimptooltransformgrid.h
index e42b9ed4ed..949beb2a95 100644
--- a/app/display/gimptooltransformgrid.h
+++ b/app/display/gimptooltransformgrid.h
@@ -82,14 +82,18 @@ struct _GimpToolTransformGridClass
 };
 
 
-GType            gimp_tool_transform_grid_get_type (void) G_GNUC_CONST;
-
-GimpToolWidget * gimp_tool_transform_grid_new      (GimpDisplayShell  *shell,
-                                                    const GimpMatrix3 *transform,
-                                                    gdouble            x1,
-                                                    gdouble            y1,
-                                                    gdouble            x2,
-                                                    gdouble            y2);
+GType                 gimp_tool_transform_grid_get_type   (void) G_GNUC_CONST;
+
+GimpToolWidget      * gimp_tool_transform_grid_new        (GimpDisplayShell      *shell,
+                                                           const GimpMatrix3     *transform,
+                                                           gdouble                x1,
+                                                           gdouble                y1,
+                                                           gdouble                x2,
+                                                           gdouble                y2);
+
+/*  protected functions  */
+
+GimpTransformHandle   gimp_tool_transform_grid_get_handle (GimpToolTransformGrid *grid);
 
 
 #endif /* __GIMP_TOOL_TRANSFORM_GRID_H__ */


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