Added new utility function gimp_rectangle_select_tool_get_operation(), and

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

svn path=/trunk/; revision=27047
This commit is contained in:
Martin Nordholts 2008-09-24 20:55:55 +00:00
parent f590b65400
commit f08e322809
2 changed files with 34 additions and 22 deletions

View File

@ -1,3 +1,8 @@
2008-09-24 Martin Nordholts <martinn@svn.gnome.org>
* app/tools/gimprectangleselecttool.c: Added new utility function
gimp_rectangle_select_tool_get_operation(), and started using it.
2008-09-24 Sven Neumann <sven@gimp.org>
* plug-ins/pygimp/pygimp-image.c: undef GIMP_DISABLE_DEPRECATED

View File

@ -135,6 +135,8 @@ static void gimp_rectangle_select_tool_real_select (GimpRectangleSelectTo
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 @@ gimp_rectangle_select_tool_button_press (GimpTool *tool,
}
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 @@ gimp_rectangle_select_tool_button_press (GimpTool *tool,
/* 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 @@ gimp_rectangle_select_tool_select (GimpRectangleTool *rectangle,
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 @@ gimp_rectangle_select_tool_select (GimpRectangleTool *rectangle,
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 @@ gimp_rectangle_select_tool_real_select (GimpRectangleSelectTool *rect_sel_tool,
}
}
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: