Commit 25ebadcd authored by Martin Nordholts's avatar Martin Nordholts Committed by Martin Nordholts
Browse files

Avoid GimpRectangleTool internals to make use of its public own interface

2007-11-13  Martin Nordholts  <martinn@svn.gnome.org>

	Avoid GimpRectangleTool internals to make use of its public own
	interface by making gimp_rectangle_tool_get_other_side() work on
	pointers to members instead of GObject property names.

	* app/tools/gimprectangletool.c
	(gimp_rectangle_tool_set_other_side_coord)
	(gimp_rectangle_tool_get_other_side_coord): Use
	gimp_rectangle_tool_get_other_side() in the new way.

svn path=/trunk/; revision=24152
parent f211ed5b
2007-11-13 Martin Nordholts <martinn@svn.gnome.org>
Avoid GimpRectangleTool internals to make use of its public own
interface by making gimp_rectangle_tool_get_other_side() work on
pointers to members instead of GObject property names.
* app/tools/gimprectangletool.c
(gimp_rectangle_tool_set_other_side_coord)
(gimp_rectangle_tool_get_other_side_coord): Use
gimp_rectangle_tool_get_other_side() in the new way.
2007-11-13 Martin Nordholts <martinn@svn.gnome.org> 2007-11-13 Martin Nordholts <martinn@svn.gnome.org>
Fixed warnings about negative rectangle widths/heights when Fixed warnings about negative rectangle widths/heights when
......
...@@ -214,8 +214,8 @@ static void gimp_rectangle_tool_update_handle_sizes (GimpRectangleTool ...@@ -214,8 +214,8 @@ static void gimp_rectangle_tool_update_handle_sizes (GimpRectangleTool
static gboolean gimp_rectangle_tool_scale_has_changed (GimpRectangleTool *rect_tool); static gboolean gimp_rectangle_tool_scale_has_changed (GimpRectangleTool *rect_tool);
static void gimp_rectangle_tool_get_other_side (GimpRectangleTool *rect_tool, static void gimp_rectangle_tool_get_other_side (GimpRectangleTool *rect_tool,
const gchar **other_x, gint **other_x,
const gchar **other_y); gint **other_y);
static void gimp_rectangle_tool_get_other_side_coord (GimpRectangleTool *rect_tool, static void gimp_rectangle_tool_get_other_side_coord (GimpRectangleTool *rect_tool,
gint *other_side_x, gint *other_side_x,
gint *other_side_y); gint *other_side_y);
...@@ -2703,18 +2703,19 @@ gimp_rectangle_tool_rect_adjusting_func (GimpRectangleTool *rect_tool) ...@@ -2703,18 +2703,19 @@ gimp_rectangle_tool_rect_adjusting_func (GimpRectangleTool *rect_tool)
/** /**
* gimp_rectangle_tool_get_other_side: * gimp_rectangle_tool_get_other_side:
* @rect_tool: A #GimpRectangleTool. * @rect_tool: A #GimpRectangleTool.
* @other_x: Pointer to where to set the other-x string. * @other_x: Pointer to double of the other-x double.
* @other_y: Pointer to where to set the other-y string. * @other_y: Pointer to double of the other-y double.
* *
* Calculates what property variables that hold the coordinates of the opposite * Calculates pointers to member variables that hold the coordinates
* side (either the opposite corner or literally the opposite side), based on * of the opposite side (either the opposite corner or literally the
* the current function. The opposite of a corner needs two coordinates, the * opposite side), based on the current function. The opposite of a
* opposite of a side only needs one. * corner needs two coordinates, the opposite of a side only needs
* one.
*/ */
static void static void
gimp_rectangle_tool_get_other_side (GimpRectangleTool *rect_tool, gimp_rectangle_tool_get_other_side (GimpRectangleTool *rect_tool,
const gchar **other_x, gint **other_x,
const gchar **other_y) gint **other_y)
{ {
GimpRectangleToolPrivate *private; GimpRectangleToolPrivate *private;
...@@ -2725,13 +2726,13 @@ gimp_rectangle_tool_get_other_side (GimpRectangleTool *rect_tool, ...@@ -2725,13 +2726,13 @@ gimp_rectangle_tool_get_other_side (GimpRectangleTool *rect_tool,
case RECT_RESIZING_UPPER_RIGHT: case RECT_RESIZING_UPPER_RIGHT:
case RECT_RESIZING_LOWER_RIGHT: case RECT_RESIZING_LOWER_RIGHT:
case RECT_RESIZING_RIGHT: case RECT_RESIZING_RIGHT:
*other_x = "x1"; *other_x = &private->x1;
break; break;
case RECT_RESIZING_UPPER_LEFT: case RECT_RESIZING_UPPER_LEFT:
case RECT_RESIZING_LOWER_LEFT: case RECT_RESIZING_LOWER_LEFT:
case RECT_RESIZING_LEFT: case RECT_RESIZING_LEFT:
*other_x = "x2"; *other_x = &private->x2;
break; break;
case RECT_RESIZING_TOP: case RECT_RESIZING_TOP:
...@@ -2746,13 +2747,13 @@ gimp_rectangle_tool_get_other_side (GimpRectangleTool *rect_tool, ...@@ -2746,13 +2747,13 @@ gimp_rectangle_tool_get_other_side (GimpRectangleTool *rect_tool,
case RECT_RESIZING_LOWER_RIGHT: case RECT_RESIZING_LOWER_RIGHT:
case RECT_RESIZING_LOWER_LEFT: case RECT_RESIZING_LOWER_LEFT:
case RECT_RESIZING_BOTTOM: case RECT_RESIZING_BOTTOM:
*other_y = "y1"; *other_y = &private->y1;
break; break;
case RECT_RESIZING_UPPER_RIGHT: case RECT_RESIZING_UPPER_RIGHT:
case RECT_RESIZING_UPPER_LEFT: case RECT_RESIZING_UPPER_LEFT:
case RECT_RESIZING_TOP: case RECT_RESIZING_TOP:
*other_y = "y2"; *other_y = &private->y2;
break; break;
case RECT_RESIZING_LEFT: case RECT_RESIZING_LEFT:
...@@ -2768,20 +2769,22 @@ gimp_rectangle_tool_get_other_side_coord (GimpRectangleTool *rect_tool, ...@@ -2768,20 +2769,22 @@ gimp_rectangle_tool_get_other_side_coord (GimpRectangleTool *rect_tool,
gint *other_side_x, gint *other_side_x,
gint *other_side_y) gint *other_side_y)
{ {
const gchar *other_x = NULL; GimpRectangleToolPrivate *private;
const gchar *other_y = NULL; gint *other_x;
gint *other_y;
private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (rect_tool);
other_x = NULL;
other_y = NULL;
gimp_rectangle_tool_get_other_side (rect_tool, gimp_rectangle_tool_get_other_side (rect_tool,
&other_x, &other_x,
&other_y); &other_y);
if (other_x) if (other_x)
g_object_get (rect_tool, *other_side_x = *other_x;
other_x, other_side_x,
NULL);
if (other_y) if (other_y)
g_object_get (rect_tool, *other_side_y = *other_y;
other_y, other_side_y,
NULL);
} }
static void static void
...@@ -2789,20 +2792,22 @@ gimp_rectangle_tool_set_other_side_coord (GimpRectangleTool *rect_tool, ...@@ -2789,20 +2792,22 @@ gimp_rectangle_tool_set_other_side_coord (GimpRectangleTool *rect_tool,
gint other_side_x, gint other_side_x,
gint other_side_y) gint other_side_y)
{ {
const gchar *other_x = NULL; GimpRectangleToolPrivate *private;
const gchar *other_y = NULL; gint *other_x;
gint *other_y;
private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (rect_tool);
other_x = NULL;
other_y = NULL;
gimp_rectangle_tool_get_other_side (rect_tool, gimp_rectangle_tool_get_other_side (rect_tool,
&other_x, &other_x,
&other_y); &other_y);
if (other_x) if (other_x)
g_object_set (rect_tool, *other_x = other_side_x;
other_x, other_side_x,
NULL);
if (other_y) if (other_y)
g_object_set (rect_tool, *other_y = other_side_y;
other_y, other_side_y,
NULL);
gimp_rectangle_tool_check_function (rect_tool); gimp_rectangle_tool_check_function (rect_tool);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment