Commit 202539a4 authored by Karine Delvare's avatar Karine Delvare Committed by Karine Delvare

app/tools/gimpcroptool.c app/tools/gimpnewrectselecttool.c

2006-01-21  Karine Delvare  <kdelvare@nerim.net>

	* app/tools/gimpcroptool.c
	* app/tools/gimpnewrectselecttool.c
	* app/tools/gimprectangleoptions.c
	* app/tools/gimprectangletool.c: indentation fixes.
parent c0eb0d78
2006-01-21 Karine Delvare <kdelvare@nerim.net>
* app/tools/gimpcroptool.c
* app/tools/gimpnewrectselecttool.c
* app/tools/gimprectangleoptions.c
* app/tools/gimprectangletool.c: indentation fixes.
2006-01-20 Michael Natterer <mitch@gimp.org> 2006-01-20 Michael Natterer <mitch@gimp.org>
* configure.in: applied modified patch from Henrik Brix Andersen * configure.in: applied modified patch from Henrik Brix Andersen
......
...@@ -41,37 +41,38 @@ ...@@ -41,37 +41,38 @@
#include "gimp-intl.h" #include "gimp-intl.h"
static void gimp_crop_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface); static void gimp_crop_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface);
static GObject * gimp_crop_tool_constructor (GType type, static GObject *
guint n_params, gimp_crop_tool_constructor (GType type,
GObjectConstructParam *params); guint n_params,
static void gimp_crop_tool_finalize (GObject *object); GObjectConstructParam *params);
static void gimp_crop_tool_finalize (GObject *object);
static void gimp_crop_tool_control (GimpTool *tool,
GimpToolAction action, static void gimp_crop_tool_control (GimpTool *tool,
GimpDisplay *gdisp); GimpToolAction action,
GimpDisplay *gdisp);
static void gimp_crop_tool_button_press (GimpTool *tool,
GimpCoords *coords, static void gimp_crop_tool_button_press (GimpTool *tool,
guint32 time, GimpCoords *coords,
GdkModifierType state, guint32 time,
GimpDisplay *gdisp); GdkModifierType state,
static void gimp_crop_tool_button_release (GimpTool *tool, GimpDisplay *gdisp);
GimpCoords *coords, static void gimp_crop_tool_button_release (GimpTool *tool,
guint32 time, GimpCoords *coords,
GdkModifierType state, guint32 time,
GimpDisplay *gdisp); GdkModifierType state,
static void gimp_crop_tool_cursor_update (GimpTool *tool, GimpDisplay *gdisp);
GimpCoords *coords, static void gimp_crop_tool_cursor_update (GimpTool *tool,
GdkModifierType state, GimpCoords *coords,
GimpDisplay *gdisp); GdkModifierType state,
GimpDisplay *gdisp);
static gboolean gimp_crop_tool_execute (GimpRectangleTool *rectangle,
gint x, static gboolean gimp_crop_tool_execute (GimpRectangleTool *rectangle,
gint y, gint x,
gint w, gint y,
gint h); gint w,
gint h);
G_DEFINE_TYPE_WITH_CODE (GimpCropTool, gimp_crop_tool, GIMP_TYPE_DRAW_TOOL, G_DEFINE_TYPE_WITH_CODE (GimpCropTool, gimp_crop_tool, GIMP_TYPE_DRAW_TOOL,
......
...@@ -55,34 +55,35 @@ ...@@ -55,34 +55,35 @@
#include "gimp-intl.h" #include "gimp-intl.h"
static void gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface); static void gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface);
static GObject * gimp_new_rect_select_tool_constructor (GType type, static GObject *
guint n_params, gimp_new_rect_select_tool_constructor (GType type,
GObjectConstructParam *params); guint n_params,
static void gimp_new_rect_select_tool_finalize (GObject *object); GObjectConstructParam *params);
static void gimp_new_rect_select_tool_control (GimpTool *tool, static void gimp_new_rect_select_tool_finalize (GObject *object);
GimpToolAction action, static void gimp_new_rect_select_tool_control (GimpTool *tool,
GimpDisplay *gdisp); GimpToolAction action,
static void gimp_new_rect_select_tool_button_press (GimpTool *tool, GimpDisplay *gdisp);
GimpCoords *coords, static void gimp_new_rect_select_tool_button_press (GimpTool *tool,
guint32 time, GimpCoords *coords,
GdkModifierType state, guint32 time,
GimpDisplay *gdisp); GdkModifierType state,
static void gimp_new_rect_select_tool_button_release (GimpTool *tool, GimpDisplay *gdisp);
GimpCoords *coords, static void gimp_new_rect_select_tool_button_release (GimpTool *tool,
guint32 time, GimpCoords *coords,
GdkModifierType state, guint32 time,
GimpDisplay *gdisp); GdkModifierType state,
static void gimp_new_rect_select_tool_oper_update (GimpTool *tool, GimpDisplay *gdisp);
GimpCoords *coords, static void gimp_new_rect_select_tool_oper_update (GimpTool *tool,
GdkModifierType state, GimpCoords *coords,
GimpDisplay *gdisp); GdkModifierType state,
static gboolean gimp_new_rect_select_tool_execute (GimpRectangleTool *rect_tool, GimpDisplay *gdisp);
gint x, static gboolean gimp_new_rect_select_tool_execute (GimpRectangleTool *rect_tool,
gint y, gint x,
gint w, gint y,
gint h); gint w,
gint h);
G_DEFINE_TYPE_WITH_CODE (GimpNewRectSelectTool, gimp_new_rect_select_tool, G_DEFINE_TYPE_WITH_CODE (GimpNewRectSelectTool, gimp_new_rect_select_tool,
......
...@@ -38,22 +38,22 @@ typedef struct _GimpRectangleOptionsPrivate GimpRectangleOptionsPrivate; ...@@ -38,22 +38,22 @@ typedef struct _GimpRectangleOptionsPrivate GimpRectangleOptionsPrivate;
struct _GimpRectangleOptionsPrivate struct _GimpRectangleOptionsPrivate
{ {
gboolean highlight; gboolean highlight;
gboolean fixed_width; gboolean fixed_width;
gdouble width; gdouble width;
gboolean fixed_height; gboolean fixed_height;
gdouble height; gdouble height;
gboolean fixed_aspect; gboolean fixed_aspect;
gdouble aspect; gdouble aspect;
gboolean fixed_center; gboolean fixed_center;
gdouble center_x; gdouble center_x;
gdouble center_y; gdouble center_y;
GimpUnit unit; GimpUnit unit;
}; };
static void gimp_rectangle_options_iface_base_init (GimpRectangleOptionsInterface *rectangle_options_iface); static void gimp_rectangle_options_iface_base_init (GimpRectangleOptionsInterface *rectangle_options_iface);
......
...@@ -55,34 +55,35 @@ ...@@ -55,34 +55,35 @@
#include "gimp-intl.h" #include "gimp-intl.h"
static void gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface); static void gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface);
static GObject * gimp_new_rect_select_tool_constructor (GType type, static GObject *
guint n_params, gimp_new_rect_select_tool_constructor (GType type,
GObjectConstructParam *params); guint n_params,
static void gimp_new_rect_select_tool_finalize (GObject *object); GObjectConstructParam *params);
static void gimp_new_rect_select_tool_control (GimpTool *tool, static void gimp_new_rect_select_tool_finalize (GObject *object);
GimpToolAction action, static void gimp_new_rect_select_tool_control (GimpTool *tool,
GimpDisplay *gdisp); GimpToolAction action,
static void gimp_new_rect_select_tool_button_press (GimpTool *tool, GimpDisplay *gdisp);
GimpCoords *coords, static void gimp_new_rect_select_tool_button_press (GimpTool *tool,
guint32 time, GimpCoords *coords,
GdkModifierType state, guint32 time,
GimpDisplay *gdisp); GdkModifierType state,
static void gimp_new_rect_select_tool_button_release (GimpTool *tool, GimpDisplay *gdisp);
GimpCoords *coords, static void gimp_new_rect_select_tool_button_release (GimpTool *tool,
guint32 time, GimpCoords *coords,
GdkModifierType state, guint32 time,
GimpDisplay *gdisp); GdkModifierType state,
static void gimp_new_rect_select_tool_oper_update (GimpTool *tool, GimpDisplay *gdisp);
GimpCoords *coords, static void gimp_new_rect_select_tool_oper_update (GimpTool *tool,
GdkModifierType state, GimpCoords *coords,
GimpDisplay *gdisp); GdkModifierType state,
static gboolean gimp_new_rect_select_tool_execute (GimpRectangleTool *rect_tool, GimpDisplay *gdisp);
gint x, static gboolean gimp_new_rect_select_tool_execute (GimpRectangleTool *rect_tool,
gint y, gint x,
gint w, gint y,
gint h); gint w,
gint h);
G_DEFINE_TYPE_WITH_CODE (GimpNewRectSelectTool, gimp_new_rect_select_tool, G_DEFINE_TYPE_WITH_CODE (GimpNewRectSelectTool, gimp_new_rect_select_tool,
......
...@@ -82,39 +82,40 @@ struct _GimpRectangleToolPrivate ...@@ -82,39 +82,40 @@ struct _GimpRectangleToolPrivate
}; };
static void gimp_rectangle_tool_iface_base_init (GimpRectangleToolInterface *rectangle_tool_iface); static void gimp_rectangle_tool_iface_base_init (GimpRectangleToolInterface *rectangle_tool_iface);
static GimpRectangleToolPrivate * static GimpRectangleToolPrivate *
gimp_rectangle_tool_get_private (GimpRectangleTool *tool); gimp_rectangle_tool_get_private (GimpRectangleTool *tool);
/* Rectangle helper functions */ /* Rectangle helper functions */
static void rectangle_tool_start (GimpRectangleTool *rectangle); static void rectangle_tool_start (GimpRectangleTool *rectangle);
/* Rectangle dialog functions */ /* Rectangle dialog functions */
static void rectangle_info_update (GimpRectangleTool *rectangle); static void rectangle_info_update (GimpRectangleTool *rectangle);
static void rectangle_selection_callback (GtkWidget *widget, static void rectangle_selection_callback (GtkWidget *widget,
GimpRectangleTool *rectangle); GimpRectangleTool *rectangle);
static void rectangle_automatic_callback (GtkWidget *widget, static void rectangle_automatic_callback (GtkWidget *widget,
GimpRectangleTool *rectangle); GimpRectangleTool *rectangle);
static void rectangle_dimensions_changed (GtkWidget *widget, static void rectangle_dimensions_changed (GtkWidget *widget,
GimpRectangleTool *rectangle); GimpRectangleTool *rectangle);
static void gimp_rectangle_tool_update_options (GimpRectangleTool *rectangle, static void gimp_rectangle_tool_update_options (GimpRectangleTool *rectangle,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static GtkWidget * gimp_rectangle_controls (GimpRectangleTool *rectangle); static GtkWidget *
static void gimp_rectangle_tool_zero_controls (GimpRectangleTool *rectangle); gimp_rectangle_controls (GimpRectangleTool *rectangle);
static void gimp_rectangle_tool_notify_width (GimpRectangleOptions *options, static void gimp_rectangle_tool_zero_controls (GimpRectangleTool *rectangle);
GParamSpec *pspec, static void gimp_rectangle_tool_notify_width (GimpRectangleOptions *options,
GimpRectangleTool *rectangle); GParamSpec *pspec,
static void gimp_rectangle_tool_notify_height (GimpRectangleOptions *options, GimpRectangleTool *rectangle);
GParamSpec *pspec, static void gimp_rectangle_tool_notify_height (GimpRectangleOptions *options,
GimpRectangleTool *rectangle); GParamSpec *pspec,
static void gimp_rectangle_tool_notify_aspect (GimpRectangleOptions *options, GimpRectangleTool *rectangle);
GParamSpec *pspec, static void gimp_rectangle_tool_notify_aspect (GimpRectangleOptions *options,
GimpRectangleTool *rectangle); GParamSpec *pspec,
GimpRectangleTool *rectangle);
GType GType
...@@ -1343,23 +1344,23 @@ gimp_rectangle_tool_button_press (GimpTool *tool, ...@@ -1343,23 +1344,23 @@ gimp_rectangle_tool_button_press (GimpTool *tool,
tool->gdisp = gdisp; tool->gdisp = gdisp;
g_object_set (rectangle, g_object_set (rectangle,
"x1", ROUND (coords->x), "x1", ROUND (coords->x),
"y1", ROUND (coords->y), "y1", ROUND (coords->y),
"x2", ROUND (coords->x), "x2", ROUND (coords->x),
"y2", ROUND (coords->y), "y2", ROUND (coords->y),
NULL); NULL);
rectangle_tool_start (rectangle); rectangle_tool_start (rectangle);
} }
g_object_set (rectangle, g_object_set (rectangle,
"pressx", ROUND (coords->x), "pressx", ROUND (coords->x),
"pressy", ROUND (coords->y), "pressy", ROUND (coords->y),
"lastx", ROUND (coords->x), "lastx", ROUND (coords->x),
"lasty", ROUND (coords->y), "lasty", ROUND (coords->y),
"startx", ROUND (coords->x), "startx", ROUND (coords->x),
"starty", ROUND (coords->y), "starty", ROUND (coords->y),
NULL); NULL);
gimp_tool_control_activate (tool->control); gimp_tool_control_activate (tool->control);
} }
...@@ -1387,11 +1388,11 @@ gimp_rectangle_tool_button_release (GimpTool *tool, ...@@ -1387,11 +1388,11 @@ gimp_rectangle_tool_button_release (GimpTool *tool,
if (! (state & GDK_BUTTON3_MASK)) if (! (state & GDK_BUTTON3_MASK))
{ {
g_object_get (rectangle, g_object_get (rectangle,
"lastx", &lastx, "lastx", &lastx,
"lasty", &lasty, "lasty", &lasty,
"pressx", &pressx, "pressx", &pressx,
"pressy", &pressy, "pressy", &pressy,
NULL); NULL);
if (lastx == pressx && lasty == pressy) if (lastx == pressx && lasty == pressy)
{ {
gimp_rectangle_tool_response (NULL, GIMP_RECTANGLE_MODE_EXECUTE, gimp_rectangle_tool_response (NULL, GIMP_RECTANGLE_MODE_EXECUTE,
...@@ -1437,9 +1438,9 @@ gimp_rectangle_tool_motion (GimpTool *tool, ...@@ -1437,9 +1438,9 @@ gimp_rectangle_tool_motion (GimpTool *tool,
cury = ROUND (coords->y); cury = ROUND (coords->y);
g_object_get (rectangle, g_object_get (rectangle,
"startx", &x1, "startx", &x1,
"starty", &y1, "starty", &y1,
NULL); NULL);
x2 = curx; x2 = curx;
y2 = cury; y2 = cury;
...@@ -1448,20 +1449,20 @@ gimp_rectangle_tool_motion (GimpTool *tool, ...@@ -1448,20 +1449,20 @@ gimp_rectangle_tool_motion (GimpTool *tool,
/* If there have been no changes... return */ /* If there have been no changes... return */
g_object_get (rectangle, g_object_get (rectangle,
"lastx", &lastx, "lastx", &lastx,
"lasty", &lasty, "lasty", &lasty,
NULL); NULL);
if (lastx == x2 && lasty == y2) if (lastx == x2 && lasty == y2)
return; return;
options = GIMP_RECTANGLE_OPTIONS (tool->tool_info->tool_options); options = GIMP_RECTANGLE_OPTIONS (tool->tool_info->tool_options);
g_object_get (options, g_object_get (options,
"new-fixed-width", &fixed_width, "new-fixed-width", &fixed_width,
"new-fixed-height", &fixed_height, "new-fixed-height", &fixed_height,
"fixed-aspect", &fixed_aspect, "fixed-aspect", &fixed_aspect,
"fixed-center", &fixed_center, "fixed-center", &fixed_center,
NULL); NULL);
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool)); gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
...@@ -1470,18 +1471,18 @@ gimp_rectangle_tool_motion (GimpTool *tool, ...@@ -1470,18 +1471,18 @@ gimp_rectangle_tool_motion (GimpTool *tool,
max_y = gdisp->gimage->height; max_y = gdisp->gimage->height;
g_object_get (options, g_object_get (options,
"width", &width, "width", &width,
"height", &height, "height", &height,
"center-x", &center_x, "center-x", &center_x,
"center-y", &center_y, "center-y", &center_y,
NULL); NULL);
g_object_get (rectangle, g_object_get (rectangle,
"x1", &rx1, "x1", &rx1,
"y1", &ry1, "y1", &ry1,
"x2", &rx2, "x2", &rx2,
"y2", &ry2, "y2", &ry2,
NULL); NULL);
switch (function) switch (function)
{ {
...@@ -1680,9 +1681,7 @@ gimp_rectangle_tool_motion (GimpTool *tool, ...@@ -1680,9 +1681,7 @@ gimp_rectangle_tool_motion (GimpTool *tool,
if (fixed_aspect) if (fixed_aspect)
{ {
gdouble aspect; gdouble aspect;
g_object_get (options, g_object_get (options, "aspect", &aspect, NULL);
"aspect", &aspect,
NULL);
if (aspect > max_y) if (aspect > max_y)
aspect = max_y; aspect = max_y;
...@@ -1730,23 +1729,23 @@ gimp_rectangle_tool_motion (GimpTool *tool, ...@@ -1730,23 +1729,23 @@ gimp_rectangle_tool_motion (GimpTool *tool,
/* make sure that the coords are in bounds */ /* make sure that the coords are in bounds */
g_object_set (rectangle, g_object_set (rectangle,
"x1", MIN (x1, x2), "x1", MIN (x1, x2),
"y1", MIN (y1, y2), "y1", MIN (y1, y2),
"x2", MAX (x1, x2), "x2", MAX (x1, x2),
"y2", MAX (y1, y2), "y2", MAX (y1, y2),
"lastx", curx, "lastx", curx,
"lasty", cury, "lasty", cury,
NULL); NULL);
/* recalculate the coordinates for rectangle_draw based on the new values */ /* recalculate the coordinates for rectangle_draw based on the new values */
gimp_rectangle_tool_configure (rectangle); gimp_rectangle_tool_configure (rectangle);
g_object_get (rectangle, g_object_get (rectangle,
"x1", &rx1, "x1", &rx1,
"y1", &ry1, "y1", &ry1,
"x2", &rx2, "x2", &rx2,
"y2", &ry2, "y2", &ry2,
NULL); NULL);
switch (function) switch (function)
{ {
...@@ -1901,18 +1900,18 @@ gimp_rectangle_tool_key_press (GimpTool *tool, ...@@ -1901,18 +1900,18 @@ gimp_rectangle_tool_key_press (GimpTool *tool,
max_y = gdisp->gimage->height; max_y = gdisp->gimage->height;
g_object_get (rectangle, g_object_get (rectangle,
"x1", &x1, "x1", &x1,
"y1", &y1, "y1", &y1,
"x2", &x2, "x2", &x2,
"y2", &y2, "y2", &y2,
NULL); NULL);
g_object_set (rectangle, g_object_set (rectangle,
"x1", x1 + inc_x, "x1", x1 + inc_x,
"y1", y1 + inc_y, "y1", y1 + inc_y,
"x2", x2 + inc_x, "x2", x2 + inc_x,
"y2", y2 + inc_y, "y2", y2 + inc_y,
NULL); NULL);
gimp_rectangle_tool_configure (rectangle); gimp_rectangle_tool_configure (rectangle);
...@@ -1946,18 +1945,16 @@ gimp_rectangle_tool_oper_update (GimpTool *tool, ...@@ -1946,18 +1945,16 @@ gimp_rectangle_tool_oper_update (GimpTool *tool,
g_return_if_fail (GIMP_IS_RECTANGLE_TOOL (tool)); g_return_if_fail (GIMP_IS_RECTANGLE_TOOL (tool));
if (tool->gdisp != gdisp) if (tool->gdisp != gdisp)
{ return;
return;
}
g_object_get (rectangle, g_object_get (rectangle,
"x1", &x1, "x1", &x1,
"y1", &y1, "y1", &y1,
"x2", &x2, "x2", &x2,
"y2", &y2, "y2", &y2,
"dcw", &dcw, "dcw", &dcw,
"dch", &dch, "dch", &dch,
NULL); NULL);
inside_x = coords->x > x1 && coords->x < x2; inside_x = coords->x > x1 && coords->x < x2;
inside_y = coords->y > y1 && coords->y < y2; inside_y = coords->y > y1 && coords->y < y2;
...@@ -2149,11 +2146,11 @@ gimp_rectangle_tool_draw (GimpDrawTool *draw) ...@@ -2149,11 +2146,11 @@ gimp_rectangle_tool_draw (GimpDrawTool *draw)
g_return_if_fail (GIMP_IS_RECTANGLE_TOOL (tool)); g_return_if_fail (GIMP_IS_RECTANGLE_TOOL (tool));
g_object_get (rectangle, g_object_get (rectangle,
"dx1", &dx1, "dx1", &dx1,
"dy1", &dy1, "dy1", &dy1,
"dx2", &dx2, "dx2", &dx2,
"dy2", &dy2, "dy2", &dy2,
NULL); NULL);
gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_XOR, gimp_canvas_draw_line (canvas, GIMP_CANVAS_STYLE_XOR,
dx1, dy1, dx1, dy1,
...@@ -2189,11 +2186,11 @@ gimp_rectangle_tool_configure (GimpRectangleTool *rectangle) ...@@ -2189,11 +2186,11 @@ gimp_rectangle_tool_configure (GimpRectangleTool *rectangle)
g_object_get (options, "highlight", &highlight, NULL); g_object_get (options, "highlight", &highlight, NULL);
g_object_get (rectangle, g_object_get (rectangle,
"x1", &x1, "x1", &x1,
"y1", &y1, "y1", &y1,
"x2", &x2, "x2", &x2,
"y2", &y2, "y2", &y2,
NULL); NULL);