gimp r27047 - in trunk: . app/tools



Author: martinn
Date: Wed Sep 24 20:55:55 2008
New Revision: 27047
URL: http://svn.gnome.org/viewvc/gimp?rev=27047&view=rev

Log:
* app/tools/gimprectangleselecttool.c: Added new utility function
gimp_rectangle_select_tool_get_operation(), and started using it.


Modified:
   trunk/ChangeLog
   trunk/app/tools/gimprectangleselecttool.c

Modified: trunk/app/tools/gimprectangleselecttool.c
==============================================================================
--- trunk/app/tools/gimprectangleselecttool.c	(original)
+++ trunk/app/tools/gimprectangleselecttool.c	Wed Sep 24 20:55:55 2008
@@ -135,6 +135,8 @@
                                                            gint                   y,
                                                            gint                   w,
                                                            gint                   h);
+static GimpChannelOps
+                gimp_rectangle_select_tool_get_operation  (GimpRectangleSelectTool    *rect_sel_tool);
 static void     gimp_rectangle_select_tool_update_option_defaults
                                                           (GimpRectangleSelectTool    *rect_sel_tool,
                                                            gboolean                    ignore_pending);
@@ -426,15 +428,9 @@
     }
   else
     {
-      GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
-      GimpImage            *image   = tool->display->image;
-      GimpUndo             *undo;
-      GimpChannelOps        operation;
-
-      if (priv->use_saved_op)
-        operation = priv->operation;
-      else
-        operation = options->operation;
+      GimpImage      *image = tool->display->image;
+      GimpUndo       *undo;
+      GimpChannelOps  operation;
 
       undo = gimp_undo_stack_peek (image->undo_stack);
 
@@ -453,6 +449,8 @@
 
       /* if the operation is "Replace", turn off the marching ants,
          because they are confusing */
+      operation = gimp_rectangle_select_tool_get_operation (rect_sel_tool);
+
       if (operation == GIMP_CHANNEL_OP_REPLACE)
         gimp_display_shell_set_show_selection (shell, FALSE);
     }
@@ -582,18 +580,14 @@
                                    gint               w,
                                    gint               h)
 {
-  GimpTool                       *tool;
-  GimpRectangleSelectTool        *rect_sel_tool;
-  GimpSelectionOptions           *options;
-  GimpImage                      *image;
-  GimpRectangleSelectToolPrivate *priv;
-  gboolean                        rectangle_exists;
-  GimpChannelOps                  operation;
+  GimpTool                *tool;
+  GimpRectangleSelectTool *rect_sel_tool;
+  GimpImage               *image;
+  gboolean                 rectangle_exists;
+  GimpChannelOps           operation;
 
   tool          = GIMP_TOOL (rectangle);
   rect_sel_tool = GIMP_RECTANGLE_SELECT_TOOL (rectangle);
-  options       = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
-  priv          = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
 
   image         = tool->display->image;
 
@@ -606,11 +600,9 @@
                       w > 0                              &&
                       h > 0);
 
-  if (priv->use_saved_op)
-    operation = priv->operation;
-  else
-    operation = options->operation;
 
+  operation = gimp_rectangle_select_tool_get_operation (rect_sel_tool);
+  
   /* if rectangle exists, turn it into a selection */
   if (rectangle_exists)
     GIMP_RECTANGLE_SELECT_TOOL_GET_CLASS (rect_sel_tool)->select (rect_sel_tool,
@@ -667,6 +659,21 @@
     }
 }
 
+static GimpChannelOps
+gimp_rectangle_select_tool_get_operation (GimpRectangleSelectTool *rect_sel_tool)
+{
+  GimpRectangleSelectToolPrivate *priv;
+  GimpSelectionOptions           *options;
+
+  priv    = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
+  options = GIMP_SELECTION_TOOL_GET_OPTIONS (rect_sel_tool);
+
+  if (priv->use_saved_op)
+    return priv->operation;
+  else
+    return options->operation;
+}
+
 /**
  * gimp_rectangle_select_tool_update_option_defaults:
  * @crop_tool:



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