mirror of https://github.com/GNOME/gimp.git
app/tools/gimpfreeselecttool.[ch] added the possibility to <alt>+drag the
2003-05-27 Michael Natterer <mitch@gimp.org> * app/tools/gimpfreeselecttool.[ch] * app/tools/gimprectselecttool.[ch]: added the possibility to <alt>+drag the whole selection preview line *while* creating the selection. Used a modified version of http://aeropc5.hut.fi/~mjkorhon/gimp-move-selection.patch (found in the mailing list archives). Fixes bug #87688.
This commit is contained in:
parent
5c04f27cd5
commit
8addf4daa6
|
@ -1,3 +1,12 @@
|
|||
2003-05-27 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/gimpfreeselecttool.[ch]
|
||||
* app/tools/gimprectselecttool.[ch]: added the possibility to
|
||||
<alt>+drag the whole selection preview line *while* creating the
|
||||
selection. Used a modified version of
|
||||
http://aeropc5.hut.fi/~mjkorhon/gimp-move-selection.patch (found
|
||||
in the mailing list archives). Fixes bug #87688.
|
||||
|
||||
2003-05-27 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/gui/select-commands.c (select_save_cmd_callback): switch
|
||||
|
|
|
@ -74,6 +74,9 @@ static void gimp_free_select_tool_draw (GimpDrawTool *draw_tool);
|
|||
static void gimp_free_select_tool_add_point (GimpFreeSelectTool *free_sel,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
static void gimp_free_select_tool_move_points (GimpFreeSelectTool *free_sel,
|
||||
gdouble dx,
|
||||
gdouble dy);
|
||||
|
||||
|
||||
static GimpSelectionToolClass *parent_class = NULL;
|
||||
|
@ -162,7 +165,6 @@ gimp_free_select_tool_init (GimpFreeSelectTool *free_select)
|
|||
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
|
||||
gimp_tool_control_set_tool_cursor (tool->control, GIMP_FREE_SELECT_TOOL_CURSOR);
|
||||
|
||||
|
||||
free_select->points = NULL;
|
||||
free_select->num_points = 0;
|
||||
free_select->max_segs = 0;
|
||||
|
@ -213,6 +215,7 @@ gimp_free_select_tool_button_press (GimpTool *tool,
|
|||
break;
|
||||
}
|
||||
|
||||
free_sel->last_coords = *coords;
|
||||
free_sel->num_points = 0;
|
||||
|
||||
gimp_free_select_tool_add_point (free_sel, coords->x, coords->y);
|
||||
|
@ -287,6 +290,18 @@ gimp_free_select_tool_motion (GimpTool *tool,
|
|||
gimp_tool_cursor_update (tool, coords, state, gdisp);
|
||||
}
|
||||
|
||||
if (state & GDK_MOD1_MASK)
|
||||
{
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
gimp_free_select_tool_move_points (free_sel,
|
||||
coords->x - free_sel->last_coords.x,
|
||||
coords->y - free_sel->last_coords.y);
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_free_select_tool_add_point (free_sel, coords->x, coords->y);
|
||||
|
||||
gimp_draw_tool_draw_line (GIMP_DRAW_TOOL (tool),
|
||||
|
@ -297,6 +312,9 @@ gimp_free_select_tool_motion (GimpTool *tool,
|
|||
FALSE);
|
||||
}
|
||||
|
||||
free_sel->last_coords = *coords;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_free_select_tool_draw (GimpDrawTool *draw_tool)
|
||||
{
|
||||
|
@ -334,3 +352,17 @@ gimp_free_select_tool_add_point (GimpFreeSelectTool *free_sel,
|
|||
|
||||
free_sel->num_points++;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_free_select_tool_move_points (GimpFreeSelectTool *free_sel,
|
||||
gdouble dx,
|
||||
gdouble dy)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < free_sel->num_points; i++)
|
||||
{
|
||||
free_sel->points[i].x += dx;
|
||||
free_sel->points[i].y += dy;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ struct _GimpFreeSelectTool
|
|||
{
|
||||
GimpSelectionTool parent_instance;
|
||||
|
||||
GimpCoords last_coords;
|
||||
|
||||
GimpVector2 *points;
|
||||
gint num_points;
|
||||
gint max_segs;
|
||||
|
|
|
@ -48,8 +48,6 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
|
||||
|
||||
static void gimp_rect_select_tool_class_init (GimpRectSelectToolClass *klass);
|
||||
static void gimp_rect_select_tool_init (GimpRectSelectTool *rect_select);
|
||||
|
||||
|
@ -188,6 +186,9 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
|
|||
rect_sel->y = RINT (coords->y);
|
||||
rect_sel->w = 0;
|
||||
rect_sel->h = 0;
|
||||
rect_sel->center = FALSE;
|
||||
|
||||
rect_sel->last_coords = *coords;
|
||||
|
||||
rect_sel->fixed_mode = options->fixed_mode;
|
||||
rect_sel->fixed_width = options->fixed_width;
|
||||
|
@ -216,8 +217,6 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
|
|||
rect_sel->fixed_width = MAX (1, rect_sel->fixed_width);
|
||||
rect_sel->fixed_height = MAX (1, rect_sel->fixed_height);
|
||||
|
||||
rect_sel->center = FALSE;
|
||||
|
||||
gimp_tool_control_activate (tool->control);
|
||||
tool->gdisp = gdisp;
|
||||
|
||||
|
@ -338,6 +337,17 @@ gimp_rect_select_tool_motion (GimpTool *tool,
|
|||
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
if (state & GDK_MOD1_MASK)
|
||||
{
|
||||
/* Just move the selection rectangle around */
|
||||
|
||||
rect_sel->x += RINT (coords->x - rect_sel->last_coords.x);
|
||||
rect_sel->y += RINT (coords->y - rect_sel->last_coords.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Change the selection rectangle's size */
|
||||
|
||||
/* Calculate starting point */
|
||||
|
||||
if (rect_sel->center)
|
||||
|
@ -456,6 +466,9 @@ gimp_rect_select_tool_motion (GimpTool *tool,
|
|||
rect_sel->w = w;
|
||||
rect_sel->h = h;
|
||||
}
|
||||
}
|
||||
|
||||
rect_sel->last_coords = *coords;
|
||||
|
||||
gimp_rect_select_tool_update_options (rect_sel, gdisp);
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ struct _GimpRectSelectTool
|
|||
gint center; /* is the selection being created from the
|
||||
* center out? */
|
||||
|
||||
GimpCoords last_coords; /* last button_press/motion coords */
|
||||
|
||||
GimpRectSelectMode fixed_mode;
|
||||
gdouble fixed_width;
|
||||
gdouble fixed_height;
|
||||
|
|
Loading…
Reference in New Issue