[gimp] app: separate fallback cursor from primary indicator cursor



commit 59364ea76dc8b3d8dd4171ff4a1bdeecf5ecffe2
Author: Alexia Death <alexiadeath gmail com>
Date:   Tue Nov 18 23:41:09 2014 +0200

    app: separate fallback cursor from primary indicator cursor
    
    Separate fallback use of a cursor from using a plain size
    indicator cursor. Ink tool uses a plain circle as primary
    drawing indicator instead of outline, totally different
    use than a fallback, when brush is too small to be drawn.
    
    Conflicts:
        app/tools/gimppainttool.c

 app/tools/gimpbrushtool.c |    4 ++--
 app/tools/gimppainttool.c |   41 ++++++++++++++++++++++++++++++++++-------
 app/tools/gimppainttool.h |   12 ++++++++----
 3 files changed, 44 insertions(+), 13 deletions(-)
---
diff --git a/app/tools/gimpbrushtool.c b/app/tools/gimpbrushtool.c
index 7c97c23..2fe8810 100644
--- a/app/tools/gimpbrushtool.c
+++ b/app/tools/gimpbrushtool.c
@@ -239,8 +239,8 @@ gimp_brush_tool_get_outline (GimpPaintTool *paint_tool,
 
           options = GIMP_PAINT_TOOL_GET_OPTIONS (brush_tool);
 
-          gimp_paint_tool_set_draw_circle (paint_tool,
-                                           TRUE, options->brush_size);
+          gimp_paint_tool_set_draw_fallback (paint_tool,
+                                             TRUE, options->brush_size);
         }
     }
 
diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c
index f3dabc7..deac74e 100644
--- a/app/tools/gimppainttool.c
+++ b/app/tools/gimppainttool.c
@@ -148,8 +148,10 @@ gimp_paint_tool_init (GimpPaintTool *paint_tool)
 
   paint_tool->show_cursor   = TRUE;
   paint_tool->draw_brush    = TRUE;
+  paint_tool->draw_fallback = FALSE;
+  paint_tool->fallback_size = 0.0;
   paint_tool->draw_circle   = FALSE;
-  paint_tool->circle_radius = 0.0;
+  paint_tool->circle_size   = 0.0;
 
   paint_tool->status      = _("Click to paint");
   paint_tool->status_line = _("Click to draw the line");
@@ -781,7 +783,7 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
           line_drawn = TRUE;
         }
 
-      gimp_paint_tool_set_draw_circle (paint_tool, FALSE, 0.0);
+      gimp_paint_tool_set_draw_fallback (paint_tool, FALSE, 0.0);
 
       if (paint_tool->draw_brush)
         outline = gimp_paint_tool_get_outline (paint_tool,
@@ -793,7 +795,7 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
           gimp_draw_tool_add_item (draw_tool, outline);
           g_object_unref (outline);
         }
-      else if (paint_tool->draw_circle)
+      else if (paint_tool->draw_fallback)
         {
           /* Lets make a sensible fallback cursor
            *
@@ -802,7 +804,7 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
            *  * reactive to options alterations
            *  * not a full circle that would be in the way
            */
-          gint size = (gint) paint_tool->circle_radius;
+          gint size = (gint) paint_tool->fallback_size;
 
           /* Cross to mark the spot */
           gimp_draw_tool_add_handle (draw_tool,
@@ -850,6 +852,20 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
 
 
         }
+      else if (paint_tool->draw_circle)
+        {
+
+          gint size = (gint) paint_tool->circle_size;
+
+          /* draw an indicatory circle */
+          gimp_draw_tool_add_arc (draw_tool,
+                                  FALSE,
+                                  cur_x - (size / 2.0),
+                                  cur_y - (size / 2.0),
+                                  size, size,
+                                  0.0, (2.0 * G_PI));
+
+        }
       else if (! paint_tool->show_cursor)
         {
           /*  don't leave the user without any indication and draw
@@ -927,12 +943,23 @@ gimp_paint_tool_enable_color_picker (GimpPaintTool     *tool,
 }
 
 void
+gimp_paint_tool_set_draw_fallback (GimpPaintTool *tool,
+                                   gboolean       draw_fallback,
+                                   gint           fallback_size)
+{
+  g_return_if_fail (GIMP_IS_PAINT_TOOL (tool));
+
+  tool->draw_fallback = draw_fallback;
+  tool->fallback_size= fallback_size;
+}
+
+void
 gimp_paint_tool_set_draw_circle (GimpPaintTool *tool,
                                  gboolean       draw_circle,
-                                 gint           circle_radius)
+                                 gint           circle_size)
 {
   g_return_if_fail (GIMP_IS_PAINT_TOOL (tool));
 
-  tool->draw_circle   = draw_circle;
-  tool->circle_radius = circle_radius;
+  tool->draw_circle = draw_circle;
+  tool->circle_size = circle_size;
 }
diff --git a/app/tools/gimppainttool.h b/app/tools/gimppainttool.h
index c7514d3..01d0068 100644
--- a/app/tools/gimppainttool.h
+++ b/app/tools/gimppainttool.h
@@ -43,8 +43,10 @@ struct _GimpPaintTool
 
   gboolean       show_cursor;
   gboolean       draw_brush;
+  gboolean       draw_fallback;
+  gint           fallback_size;
   gboolean       draw_circle;
-  gint           circle_radius;
+  gint           circle_size;
 
   const gchar   *status;       /* status message */
   const gchar   *status_line;  /* status message when drawing a line */
@@ -69,9 +71,11 @@ GType   gimp_paint_tool_get_type            (void) G_GNUC_CONST;
 void    gimp_paint_tool_enable_color_picker (GimpPaintTool     *tool,
                                              GimpColorPickMode  mode);
 
+void    gimp_paint_tool_set_draw_fallback   (GimpPaintTool     *tool,
+                                             gboolean           draw_fallback,
+                                             gint               fallback_size);
+
 void    gimp_paint_tool_set_draw_circle     (GimpPaintTool     *tool,
                                              gboolean           draw_circle,
-                                             gint               circle_radius);
-
-
+                                             gint               circle_size);
 #endif  /*  __GIMP_PAINT_TOOL_H__  */


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