moved duplicated code to utility function
2007-02-09 Sven Neumann <sven@gimp.org> * app/tools/gimprectangletool.c: moved duplicated code to utility function gimp_rectangle_tool_set_highlight(). svn path=/trunk/; revision=21878
This commit is contained in:

committed by
Sven Neumann

parent
1da4a19fe7
commit
d1a2697c80
@ -1,3 +1,8 @@
|
||||
2007-02-09 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/tools/gimprectangletool.c: moved duplicated code to
|
||||
utility function gimp_rectangle_tool_set_highlight().
|
||||
|
||||
2007-02-08 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/paint/paint-types.h
|
||||
|
@ -141,6 +141,7 @@ static void gimp_rectangle_tool_auto_shrink (GimpRectangleTool *rectangl
|
||||
static GtkAnchorType gimp_rectangle_tool_get_anchor (GimpRectangleToolPrivate *private,
|
||||
gint *w,
|
||||
gint *h);
|
||||
static void gimp_rectangle_tool_set_highlight (GimpRectangleTool *rectangle);
|
||||
|
||||
|
||||
static guint gimp_rectangle_tool_signals[LAST_SIGNAL] = { 0 };
|
||||
@ -1667,7 +1668,6 @@ gimp_rectangle_tool_configure (GimpRectangleTool *rectangle)
|
||||
GimpDisplayShell *shell;
|
||||
gint dx1, dx2;
|
||||
gint dy1, dy2;
|
||||
gboolean highlight;
|
||||
|
||||
private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (tool);
|
||||
options = GIMP_RECTANGLE_TOOL_GET_OPTIONS (tool);
|
||||
@ -1675,22 +1675,10 @@ gimp_rectangle_tool_configure (GimpRectangleTool *rectangle)
|
||||
if (! tool->display)
|
||||
return;
|
||||
|
||||
gimp_rectangle_tool_set_highlight (rectangle);
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (tool->display->shell);
|
||||
|
||||
g_object_get (options, "highlight", &highlight, NULL);
|
||||
|
||||
if (highlight)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
|
||||
rect.x = private->x1;
|
||||
rect.y = private->y1;
|
||||
rect.width = private->x2 - private->x1;
|
||||
rect.height = private->y2 - private->y1;
|
||||
|
||||
gimp_display_shell_set_highlight (shell, &rect);
|
||||
}
|
||||
|
||||
gimp_display_shell_transform_xy (shell,
|
||||
private->x1, private->y1,
|
||||
&dx1, &dy1,
|
||||
@ -1991,28 +1979,7 @@ gimp_rectangle_tool_options_notify (GimpRectangleOptions *options,
|
||||
}
|
||||
else if (! strcmp (pspec->name, "highlight"))
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
gboolean highlight;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (tool->display->shell);
|
||||
|
||||
g_object_get (options, "highlight", &highlight, NULL);
|
||||
|
||||
if (highlight)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
|
||||
rect.x = private->x1;
|
||||
rect.y = private->y1;
|
||||
rect.width = private->x2 - private->x1;
|
||||
rect.height = private->y2 - private->y1;
|
||||
|
||||
gimp_display_shell_set_highlight (shell, &rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_display_shell_set_highlight (shell, NULL);
|
||||
}
|
||||
gimp_rectangle_tool_set_highlight (rectangle);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2241,3 +2208,33 @@ gimp_rectangle_tool_get_anchor (GimpRectangleToolPrivate *private,
|
||||
return GTK_ANCHOR_CENTER;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_rectangle_tool_set_highlight (GimpRectangleTool *rectangle)
|
||||
{
|
||||
GimpTool *tool = GIMP_TOOL (rectangle);
|
||||
GimpRectangleOptions *options = GIMP_RECTANGLE_TOOL_GET_OPTIONS (tool);
|
||||
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (tool->display->shell);
|
||||
gboolean highlight = FALSE;
|
||||
|
||||
g_object_get (options, "highlight", &highlight, NULL);
|
||||
|
||||
if (highlight)
|
||||
{
|
||||
GimpRectangleToolPrivate *private;
|
||||
GdkRectangle rect;
|
||||
|
||||
private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (tool);
|
||||
|
||||
rect.x = private->x1;
|
||||
rect.y = private->y1;
|
||||
rect.width = private->x2 - private->x1;
|
||||
rect.height = private->y2 - private->y1;
|
||||
|
||||
gimp_display_shell_set_highlight (shell, &rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_display_shell_set_highlight (shell, NULL);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user