mirror of https://github.com/GNOME/gimp.git
app/tools: don't use -1 as invalid guide position
Introduce a define for the invalid guide position that is used when creating a new guide and define it as G_MININT. The value of -1 that used to be used for this caused the moving guide to disappear at position -1.
This commit is contained in:
parent
333dfc7f13
commit
5e0fbc66a0
|
@ -60,6 +60,8 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
#define GUIDE_POSITION_INVALID G_MININT
|
||||
|
||||
#define SWAP_ORIENT(orient) ((orient) == GIMP_ORIENTATION_HORIZONTAL ? \
|
||||
GIMP_ORIENTATION_VERTICAL : \
|
||||
GIMP_ORIENTATION_HORIZONTAL)
|
||||
|
@ -157,7 +159,7 @@ gimp_move_tool_init (GimpMoveTool *move_tool)
|
|||
move_tool->guide = NULL;
|
||||
|
||||
move_tool->moving_guide = FALSE;
|
||||
move_tool->guide_position = -1;
|
||||
move_tool->guide_position = GUIDE_POSITION_INVALID;
|
||||
move_tool->guide_orientation = GIMP_ORIENTATION_UNKNOWN;
|
||||
|
||||
move_tool->saved_type = GIMP_TRANSFORM_TYPE_LAYER;
|
||||
|
@ -216,9 +218,9 @@ gimp_move_tool_button_press (GimpTool *tool,
|
|||
}
|
||||
else if (options->move_type == GIMP_TRANSFORM_TYPE_LAYER)
|
||||
{
|
||||
GimpGuide *guide;
|
||||
GimpLayer *layer;
|
||||
gint snap_distance = display->config->snap_distance;
|
||||
GimpGuide *guide;
|
||||
GimpLayer *layer;
|
||||
const gint snap_distance = display->config->snap_distance;
|
||||
|
||||
if (gimp_display_shell_get_show_guides (shell) &&
|
||||
(guide = gimp_image_find_guide (image,
|
||||
|
@ -347,7 +349,7 @@ gimp_move_tool_button_release (GimpTool *tool,
|
|||
if (release_type == GIMP_BUTTON_RELEASE_CANCEL)
|
||||
{
|
||||
move->moving_guide = FALSE;
|
||||
move->guide_position = -1;
|
||||
move->guide_position = GUIDE_POSITION_INVALID;
|
||||
move->guide_orientation = GIMP_ORIENTATION_UNKNOWN;
|
||||
|
||||
gimp_display_shell_selection_control (shell, GIMP_SELECTION_RESUME);
|
||||
|
@ -415,7 +417,7 @@ gimp_move_tool_button_release (GimpTool *tool,
|
|||
gimp_image_flush (image);
|
||||
|
||||
move->moving_guide = FALSE;
|
||||
move->guide_position = -1;
|
||||
move->guide_position = GUIDE_POSITION_INVALID;
|
||||
move->guide_orientation = GIMP_ORIENTATION_UNKNOWN;
|
||||
|
||||
if (move->guide)
|
||||
|
@ -485,7 +487,7 @@ gimp_move_tool_motion (GimpTool *tool,
|
|||
if (tx < 0 || tx >= shell->disp_width ||
|
||||
ty < 0 || ty >= shell->disp_height)
|
||||
{
|
||||
move->guide_position = -1;
|
||||
move->guide_position = GUIDE_POSITION_INVALID;
|
||||
|
||||
delete_guide = TRUE;
|
||||
}
|
||||
|
@ -627,7 +629,7 @@ gimp_move_tool_oper_update (GimpTool *tool,
|
|||
gimp_display_shell_get_show_guides (shell) &&
|
||||
proximity)
|
||||
{
|
||||
gint snap_distance = display->config->snap_distance;
|
||||
const gint snap_distance = display->config->snap_distance;
|
||||
|
||||
guide = gimp_image_find_guide (image, coords->x, coords->y,
|
||||
FUNSCALEX (shell, snap_distance),
|
||||
|
@ -705,9 +707,9 @@ gimp_move_tool_cursor_update (GimpTool *tool,
|
|||
}
|
||||
else
|
||||
{
|
||||
GimpGuide *guide;
|
||||
GimpLayer *layer;
|
||||
gint snap_distance = display->config->snap_distance;
|
||||
GimpGuide *guide;
|
||||
GimpLayer *layer;
|
||||
const gint snap_distance = display->config->snap_distance;
|
||||
|
||||
if (gimp_display_shell_get_show_guides (shell) &&
|
||||
(guide = gimp_image_find_guide (image, coords->x, coords->y,
|
||||
|
@ -762,7 +764,7 @@ gimp_move_tool_draw (GimpDrawTool *draw_tool)
|
|||
gimp_canvas_item_set_highlight (item, TRUE);
|
||||
}
|
||||
|
||||
if (move->moving_guide && move->guide_position != -1)
|
||||
if (move->moving_guide && move->guide_position != GUIDE_POSITION_INVALID)
|
||||
{
|
||||
gimp_draw_tool_add_guide (draw_tool,
|
||||
move->guide_orientation,
|
||||
|
@ -812,7 +814,7 @@ gimp_move_tool_start_guide (GimpMoveTool *move,
|
|||
|
||||
move->guide = NULL;
|
||||
move->moving_guide = TRUE;
|
||||
move->guide_position = -1;
|
||||
move->guide_position = GUIDE_POSITION_INVALID;
|
||||
move->guide_orientation = orientation;
|
||||
|
||||
gimp_tool_set_cursor (tool, display,
|
||||
|
|
Loading…
Reference in New Issue