Commit df731062 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

renamed TransformAction enum values to something more descriptive.


2006-06-18  Sven Neumann  <sven@gimp.org>

	* app/tools/tools-enums.h: renamed TransformAction enum values
to
	something more descriptive.

	* app/tools/gimpperspectivetool.c
	* app/tools/gimpscaletool.c
	* app/tools/gimpsheartool.c
	* app/tools/gimptransformtool.c: changed accordingly.
parent b1187817
2006-06-18 Sven Neumann <sven@gimp.org>
* app/tools/tools-enums.h: renamed TransformAction enum values to
something more descriptive.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* app/tools/gimptransformtool.c: changed accordingly.
2006-06-18 Michael Natterer <mitch@gimp.org> 2006-06-18 Michael Natterer <mitch@gimp.org>
   
* plug-ins/common/screenshot.c: apply the delay before selecting, * plug-ins/common/screenshot.c: apply the delay before selecting,
......
...@@ -177,19 +177,19 @@ gimp_perspective_tool_motion (GimpTransformTool *transform_tool, ...@@ -177,19 +177,19 @@ gimp_perspective_tool_motion (GimpTransformTool *transform_tool,
switch (transform_tool->function) switch (transform_tool->function)
{ {
case TRANSFORM_HANDLE_1: case TRANSFORM_HANDLE_NW:
transform_tool->trans_info[X0] += diff_x; transform_tool->trans_info[X0] += diff_x;
transform_tool->trans_info[Y0] += diff_y; transform_tool->trans_info[Y0] += diff_y;
break; break;
case TRANSFORM_HANDLE_2: case TRANSFORM_HANDLE_NE:
transform_tool->trans_info[X1] += diff_x; transform_tool->trans_info[X1] += diff_x;
transform_tool->trans_info[Y1] += diff_y; transform_tool->trans_info[Y1] += diff_y;
break; break;
case TRANSFORM_HANDLE_3: case TRANSFORM_HANDLE_SW:
transform_tool->trans_info[X2] += diff_x; transform_tool->trans_info[X2] += diff_x;
transform_tool->trans_info[Y2] += diff_y; transform_tool->trans_info[Y2] += diff_y;
break; break;
case TRANSFORM_HANDLE_4: case TRANSFORM_HANDLE_SE:
transform_tool->trans_info[X3] += diff_x; transform_tool->trans_info[X3] += diff_x;
transform_tool->trans_info[Y3] += diff_y; transform_tool->trans_info[Y3] += diff_y;
break; break;
......
...@@ -186,19 +186,20 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool, ...@@ -186,19 +186,20 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool,
gdouble *y1; gdouble *y1;
gdouble *x2; gdouble *x2;
gdouble *y2; gdouble *y2;
gdouble mag;
gdouble dot;
gint dir_x, dir_y; gint dir_x, dir_y;
gdouble diff_x, diff_y; gdouble diff_x, diff_y;
options = GIMP_TRANSFORM_OPTIONS (GIMP_TOOL (tr_tool)->tool_info->tool_options); options =
GIMP_TRANSFORM_OPTIONS (GIMP_TOOL (tr_tool)->tool_info->tool_options);
diff_x = tr_tool->curx - tr_tool->lastx; diff_x = tr_tool->curx - tr_tool->lastx;
diff_y = tr_tool->cury - tr_tool->lasty; diff_y = tr_tool->cury - tr_tool->lasty;
g_printerr ("%d\n", tr_tool->function);
switch (tr_tool->function) switch (tr_tool->function)
{ {
case TRANSFORM_HANDLE_1: case TRANSFORM_HANDLE_NW:
x1 = &tr_tool->trans_info[X0]; x1 = &tr_tool->trans_info[X0];
y1 = &tr_tool->trans_info[Y0]; y1 = &tr_tool->trans_info[Y0];
x2 = &tr_tool->trans_info[X1]; x2 = &tr_tool->trans_info[X1];
...@@ -206,7 +207,7 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool, ...@@ -206,7 +207,7 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool,
dir_x = dir_y = 1; dir_x = dir_y = 1;
break; break;
case TRANSFORM_HANDLE_2: case TRANSFORM_HANDLE_NE:
x1 = &tr_tool->trans_info[X1]; x1 = &tr_tool->trans_info[X1];
y1 = &tr_tool->trans_info[Y0]; y1 = &tr_tool->trans_info[Y0];
x2 = &tr_tool->trans_info[X0]; x2 = &tr_tool->trans_info[X0];
...@@ -215,7 +216,7 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool, ...@@ -215,7 +216,7 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool,
dir_y = 1; dir_y = 1;
break; break;
case TRANSFORM_HANDLE_3: case TRANSFORM_HANDLE_SW:
x1 = &tr_tool->trans_info[X0]; x1 = &tr_tool->trans_info[X0];
y1 = &tr_tool->trans_info[Y1]; y1 = &tr_tool->trans_info[Y1];
x2 = &tr_tool->trans_info[X1]; x2 = &tr_tool->trans_info[X1];
...@@ -224,7 +225,7 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool, ...@@ -224,7 +225,7 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool,
dir_y = -1; dir_y = -1;
break; break;
case TRANSFORM_HANDLE_4: case TRANSFORM_HANDLE_SE:
x1 = &tr_tool->trans_info[X1]; x1 = &tr_tool->trans_info[X1];
y1 = &tr_tool->trans_info[Y1]; y1 = &tr_tool->trans_info[Y1];
x2 = &tr_tool->trans_info[X0]; x2 = &tr_tool->trans_info[X0];
...@@ -241,7 +242,6 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool, ...@@ -241,7 +242,6 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool,
tr_tool->trans_info[Y2] += diff_y; tr_tool->trans_info[Y2] += diff_y;
tr_tool->trans_info[X3] += diff_x; tr_tool->trans_info[X3] += diff_x;
tr_tool->trans_info[Y3] += diff_y; tr_tool->trans_info[Y3] += diff_y;
return; return;
default: default:
...@@ -251,6 +251,9 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool, ...@@ -251,6 +251,9 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool,
/* if control is being held, constrain the aspect ratio */ /* if control is being held, constrain the aspect ratio */
if (options->constrain) if (options->constrain)
{ {
gdouble mag;
gdouble dot;
mag = hypot ((gdouble) (tr_tool->x2 - tr_tool->x1), mag = hypot ((gdouble) (tr_tool->x2 - tr_tool->x1),
(gdouble) (tr_tool->y2 - tr_tool->y1)); (gdouble) (tr_tool->y2 - tr_tool->y1));
...@@ -273,20 +276,24 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool, ...@@ -273,20 +276,24 @@ gimp_scale_tool_motion (GimpTransformTool *tr_tool,
if (dir_x > 0) if (dir_x > 0)
{ {
if (*x1 >= *x2) *x1 = *x2 - 1; if (*x1 >= *x2)
*x1 = *x2 - 1;
} }
else else
{ {
if (*x1 <= *x2) *x1 = *x2 + 1; if (*x1 <= *x2)
*x1 = *x2 + 1;
} }
if (dir_y > 0) if (dir_y > 0)
{ {
if (*y1 >= *y2) *y1 = *y2 - 1; if (*y1 >= *y2)
*y1 = *y2 - 1;
} }
else else
{ {
if (*y1 <= *y2) *y1 = *y2 + 1; if (*y1 <= *y2)
*y1 = *y2 + 1;
} }
} }
......
...@@ -217,28 +217,28 @@ gimp_shear_tool_motion (GimpTransformTool *tr_tool, ...@@ -217,28 +217,28 @@ gimp_shear_tool_motion (GimpTransformTool *tr_tool,
switch (tr_tool->function) switch (tr_tool->function)
{ {
case TRANSFORM_HANDLE_1: case TRANSFORM_HANDLE_NW:
if (dir == GIMP_ORIENTATION_HORIZONTAL) if (dir == GIMP_ORIENTATION_HORIZONTAL)
tr_tool->trans_info[XSHEAR] -= diffx; tr_tool->trans_info[XSHEAR] -= diffx;
else else
tr_tool->trans_info[YSHEAR] -= diffy; tr_tool->trans_info[YSHEAR] -= diffy;
break; break;
case TRANSFORM_HANDLE_2: case TRANSFORM_HANDLE_NE:
if (dir == GIMP_ORIENTATION_HORIZONTAL) if (dir == GIMP_ORIENTATION_HORIZONTAL)
tr_tool->trans_info[XSHEAR] -= diffx; tr_tool->trans_info[XSHEAR] -= diffx;
else else
tr_tool->trans_info[YSHEAR] += diffy; tr_tool->trans_info[YSHEAR] += diffy;
break; break;
case TRANSFORM_HANDLE_3: case TRANSFORM_HANDLE_SW:
if (dir == GIMP_ORIENTATION_HORIZONTAL) if (dir == GIMP_ORIENTATION_HORIZONTAL)
tr_tool->trans_info[XSHEAR] += diffx; tr_tool->trans_info[XSHEAR] += diffx;
else else
tr_tool->trans_info[YSHEAR] -= diffy; tr_tool->trans_info[YSHEAR] -= diffy;
break; break;
case TRANSFORM_HANDLE_4: case TRANSFORM_HANDLE_SE:
if (dir == GIMP_ORIENTATION_HORIZONTAL) if (dir == GIMP_ORIENTATION_HORIZONTAL)
tr_tool->trans_info[XSHEAR] += diffx; tr_tool->trans_info[XSHEAR] += diffx;
else else
......
...@@ -560,7 +560,7 @@ gimp_transform_tool_oper_update (GimpTool *tool, ...@@ -560,7 +560,7 @@ gimp_transform_tool_oper_update (GimpTool *tool,
closest_dist = gimp_draw_tool_calc_distance (draw_tool, display, closest_dist = gimp_draw_tool_calc_distance (draw_tool, display,
coords->x, coords->y, coords->x, coords->y,
tr_tool->tx1, tr_tool->ty1); tr_tool->tx1, tr_tool->ty1);
tr_tool->function = TRANSFORM_HANDLE_1; tr_tool->function = TRANSFORM_HANDLE_NW;
dist = gimp_draw_tool_calc_distance (draw_tool, display, dist = gimp_draw_tool_calc_distance (draw_tool, display,
coords->x, coords->y, coords->x, coords->y,
...@@ -568,7 +568,7 @@ gimp_transform_tool_oper_update (GimpTool *tool, ...@@ -568,7 +568,7 @@ gimp_transform_tool_oper_update (GimpTool *tool,
if (dist < closest_dist) if (dist < closest_dist)
{ {
closest_dist = dist; closest_dist = dist;
tr_tool->function = TRANSFORM_HANDLE_2; tr_tool->function = TRANSFORM_HANDLE_NE;
} }
dist = gimp_draw_tool_calc_distance (draw_tool, display, dist = gimp_draw_tool_calc_distance (draw_tool, display,
...@@ -577,7 +577,7 @@ gimp_transform_tool_oper_update (GimpTool *tool, ...@@ -577,7 +577,7 @@ gimp_transform_tool_oper_update (GimpTool *tool,
if (dist < closest_dist) if (dist < closest_dist)
{ {
closest_dist = dist; closest_dist = dist;
tr_tool->function = TRANSFORM_HANDLE_3; tr_tool->function = TRANSFORM_HANDLE_SW;
} }
dist = gimp_draw_tool_calc_distance (draw_tool, display, dist = gimp_draw_tool_calc_distance (draw_tool, display,
...@@ -586,7 +586,7 @@ gimp_transform_tool_oper_update (GimpTool *tool, ...@@ -586,7 +586,7 @@ gimp_transform_tool_oper_update (GimpTool *tool,
if (dist < closest_dist) if (dist < closest_dist)
{ {
closest_dist = dist; closest_dist = dist;
tr_tool->function = TRANSFORM_HANDLE_4; tr_tool->function = TRANSFORM_HANDLE_SE;
} }
if (gimp_draw_tool_on_handle (draw_tool, display, if (gimp_draw_tool_on_handle (draw_tool, display,
......
...@@ -169,10 +169,10 @@ typedef enum /*< skip >*/ ...@@ -169,10 +169,10 @@ typedef enum /*< skip >*/
typedef enum /*< skip >*/ typedef enum /*< skip >*/
{ {
TRANSFORM_CREATING, TRANSFORM_CREATING,
TRANSFORM_HANDLE_1, TRANSFORM_HANDLE_NW, /* north west */
TRANSFORM_HANDLE_2, TRANSFORM_HANDLE_NE, /* north east */
TRANSFORM_HANDLE_3, TRANSFORM_HANDLE_SW, /* south west */
TRANSFORM_HANDLE_4, TRANSFORM_HANDLE_SE, /* south east */
TRANSFORM_HANDLE_CENTER TRANSFORM_HANDLE_CENTER
} TransformAction; } TransformAction;
......
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