mirror of https://github.com/GNOME/gimp.git
renamed init_edit_selection() to gimp_edit_selection_tool_start(). Removed
2004-07-26 Michael Natterer <mitch@gimp.org> * app/tools/gimpeditselectiontool.[ch]: renamed init_edit_selection() to gimp_edit_selection_tool_start(). Removed enum EditType. * app/tools/tools-enums.h: added enum GimpTranslateMode instead. * app/tools/gimpmovetool.c: changed accordingly. * app/tools/gimpselectiontool.[ch]: added protected utility function gimp_selection_tool_start_edit(). * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimprectselecttool.c: use the new function instead of duplicating the same code three times, don't include "gimpeditselectiontool.h". * app/tools/gimpiscissorstool.c: don't include "gimpeditselectiontool.h".
This commit is contained in:
parent
674f80e155
commit
d50a2db779
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
2004-07-26 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/gimpeditselectiontool.[ch]: renamed init_edit_selection()
|
||||
to gimp_edit_selection_tool_start(). Removed enum EditType.
|
||||
|
||||
* app/tools/tools-enums.h: added enum GimpTranslateMode instead.
|
||||
|
||||
* app/tools/gimpmovetool.c: changed accordingly.
|
||||
|
||||
* app/tools/gimpselectiontool.[ch]: added protected utility
|
||||
function gimp_selection_tool_start_edit().
|
||||
|
||||
* app/tools/gimpfreeselecttool.c
|
||||
* app/tools/gimpfuzzyselecttool.c
|
||||
* app/tools/gimprectselecttool.c: use the new function instead of
|
||||
duplicating the same code three times, don't include
|
||||
"gimpeditselectiontool.h".
|
||||
|
||||
* app/tools/gimpiscissorstool.c: don't include
|
||||
"gimpeditselectiontool.h".
|
||||
|
||||
2004-07-26 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/gimpeditselectiontool.c: don't freeze()/thaw() the
|
||||
|
|
|
@ -88,7 +88,7 @@ struct _GimpEditSelectionTool
|
|||
gint x1, y1; /* Bounding box of selection mask */
|
||||
gint x2, y2;
|
||||
|
||||
EditType edit_type; /* Translate the mask or layer? */
|
||||
GimpTranslateMode edit_mode; /* Translate the mask or layer? */
|
||||
|
||||
gboolean first_move; /* Don't push undos after the first */
|
||||
};
|
||||
|
@ -203,10 +203,10 @@ gimp_edit_selection_tool_calc_coords (GimpEditSelectionTool *edit_select,
|
|||
}
|
||||
|
||||
void
|
||||
init_edit_selection (GimpTool *tool,
|
||||
GimpDisplay *gdisp,
|
||||
GimpCoords *coords,
|
||||
EditType edit_type)
|
||||
gimp_edit_selection_tool_start (GimpTool *parent_tool,
|
||||
GimpDisplay *gdisp,
|
||||
GimpCoords *coords,
|
||||
GimpTranslateMode edit_mode)
|
||||
{
|
||||
GimpEditSelectionTool *edit_select;
|
||||
GimpDisplayShell *shell;
|
||||
|
@ -219,37 +219,37 @@ init_edit_selection (GimpTool *tool,
|
|||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
/* Make a check to see if it should be a floating selection translation */
|
||||
if (edit_type == EDIT_MASK_TO_LAYER_TRANSLATE &&
|
||||
if (edit_mode == GIMP_TRANSLATE_MODE_MASK_TO_LAYER &&
|
||||
gimp_image_floating_sel (gdisp->gimage))
|
||||
{
|
||||
edit_type = EDIT_FLOATING_SEL_TRANSLATE;
|
||||
edit_mode = GIMP_TRANSLATE_MODE_FLOATING_SEL;
|
||||
}
|
||||
|
||||
if (edit_type == EDIT_LAYER_TRANSLATE)
|
||||
if (edit_mode == GIMP_TRANSLATE_MODE_LAYER)
|
||||
{
|
||||
GimpLayer *layer = gimp_image_get_active_layer (gdisp->gimage);
|
||||
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
edit_type = EDIT_FLOATING_SEL_TRANSLATE;
|
||||
edit_mode = GIMP_TRANSLATE_MODE_FLOATING_SEL;
|
||||
}
|
||||
|
||||
edit_select->edit_type = edit_type;
|
||||
edit_select->edit_mode = edit_mode;
|
||||
|
||||
if (edit_select->edit_type == EDIT_VECTORS_TRANSLATE)
|
||||
if (edit_select->edit_mode == GIMP_TRANSLATE_MODE_VECTORS)
|
||||
active_item = GIMP_ITEM (gimp_image_get_active_vectors (gdisp->gimage));
|
||||
else
|
||||
active_item = GIMP_ITEM (gimp_image_active_drawable (gdisp->gimage));
|
||||
|
||||
switch (edit_select->edit_type)
|
||||
switch (edit_select->edit_mode)
|
||||
{
|
||||
case EDIT_VECTORS_TRANSLATE:
|
||||
case EDIT_CHANNEL_TRANSLATE:
|
||||
case EDIT_LAYER_MASK_TRANSLATE:
|
||||
case EDIT_LAYER_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_VECTORS:
|
||||
case GIMP_TRANSLATE_MODE_CHANNEL:
|
||||
case GIMP_TRANSLATE_MODE_LAYER_MASK:
|
||||
case GIMP_TRANSLATE_MODE_LAYER:
|
||||
undo_desc = GIMP_ITEM_GET_CLASS (active_item)->translate_desc;
|
||||
break;
|
||||
|
||||
case EDIT_MASK_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_MASK:
|
||||
undo_desc = _("Move Selection");
|
||||
break;
|
||||
|
||||
|
@ -259,7 +259,8 @@ init_edit_selection (GimpTool *tool,
|
|||
}
|
||||
|
||||
gimp_image_undo_group_start (gdisp->gimage,
|
||||
edit_select->edit_type == EDIT_MASK_TRANSLATE ?
|
||||
edit_select->edit_mode ==
|
||||
GIMP_TRANSLATE_MODE_MASK ?
|
||||
GIMP_UNDO_GROUP_MASK :
|
||||
GIMP_UNDO_GROUP_ITEM_DISPLACE,
|
||||
undo_desc);
|
||||
|
@ -269,10 +270,10 @@ init_edit_selection (GimpTool *tool,
|
|||
edit_select->x = edit_select->origx = coords->x - off_x;
|
||||
edit_select->y = edit_select->origy = coords->y - off_y;
|
||||
|
||||
switch (edit_select->edit_type)
|
||||
switch (edit_select->edit_mode)
|
||||
{
|
||||
case EDIT_CHANNEL_TRANSLATE:
|
||||
case EDIT_LAYER_MASK_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_CHANNEL:
|
||||
case GIMP_TRANSLATE_MODE_LAYER_MASK:
|
||||
gimp_channel_boundary (GIMP_CHANNEL (active_item),
|
||||
(const BoundSeg **) &edit_select->segs_in,
|
||||
(const BoundSeg **) &edit_select->segs_out,
|
||||
|
@ -298,7 +299,7 @@ init_edit_selection (GimpTool *tool,
|
|||
edit_select->num_segs_out *
|
||||
sizeof (BoundSeg));
|
||||
|
||||
if (edit_select->edit_type == EDIT_VECTORS_TRANSLATE)
|
||||
if (edit_select->edit_mode == GIMP_TRANSLATE_MODE_VECTORS)
|
||||
{
|
||||
edit_select->x1 = 0;
|
||||
edit_select->y1 = 0;
|
||||
|
@ -308,7 +309,7 @@ init_edit_selection (GimpTool *tool,
|
|||
else
|
||||
{
|
||||
/* find the bounding box of the selection mask -
|
||||
* this is used for the case of a EDIT_MASK_TO_LAYER_TRANSLATE,
|
||||
* this is used for the case of a GIMP_TRANSLATE_MODE_MASK_TO_LAYER,
|
||||
* where the translation will result in floating the selection
|
||||
* mask and translating the resulting layer
|
||||
*/
|
||||
|
@ -324,14 +325,14 @@ init_edit_selection (GimpTool *tool,
|
|||
{
|
||||
gint x1, y1, x2, y2;
|
||||
|
||||
switch (edit_select->edit_type)
|
||||
switch (edit_select->edit_mode)
|
||||
{
|
||||
case EDIT_CHANNEL_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_CHANNEL:
|
||||
gimp_channel_bounds (GIMP_CHANNEL (active_item),
|
||||
&x1, &y1, &x2, &y2);
|
||||
break;
|
||||
|
||||
case EDIT_LAYER_MASK_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_LAYER_MASK:
|
||||
gimp_channel_bounds (GIMP_CHANNEL (active_item),
|
||||
&x1, &y1, &x2, &y2);
|
||||
x1 += off_x;
|
||||
|
@ -340,21 +341,21 @@ init_edit_selection (GimpTool *tool,
|
|||
y2 += off_y;
|
||||
break;
|
||||
|
||||
case EDIT_MASK_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_MASK:
|
||||
gimp_channel_bounds (gimp_image_get_mask (gdisp->gimage),
|
||||
&x1, &y1, &x2, &y2);
|
||||
break;
|
||||
|
||||
case EDIT_MASK_TO_LAYER_TRANSLATE:
|
||||
case EDIT_MASK_COPY_TO_LAYER_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_MASK_TO_LAYER:
|
||||
case GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER:
|
||||
x1 = edit_select->x1 + off_x;
|
||||
y1 = edit_select->y1 + off_y;
|
||||
x2 = edit_select->x2 + off_x;
|
||||
y2 = edit_select->y2 + off_y;
|
||||
break;
|
||||
|
||||
case EDIT_LAYER_TRANSLATE:
|
||||
case EDIT_FLOATING_SEL_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_LAYER:
|
||||
case GIMP_TRANSLATE_MODE_FLOATING_SEL:
|
||||
x1 = off_x;
|
||||
y1 = off_y;
|
||||
x2 = x1 + gimp_item_width (active_item);
|
||||
|
@ -394,7 +395,7 @@ init_edit_selection (GimpTool *tool,
|
|||
}
|
||||
break;
|
||||
|
||||
case EDIT_VECTORS_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_VECTORS:
|
||||
{
|
||||
gdouble xd1, yd1, xd2, yd2;
|
||||
|
||||
|
@ -482,7 +483,7 @@ gimp_edit_selection_tool_button_release (GimpTool *tool,
|
|||
|
||||
tool_manager_pop_tool (gdisp->gimage->gimp);
|
||||
|
||||
if (edit_select->edit_type == EDIT_VECTORS_TRANSLATE)
|
||||
if (edit_select->edit_mode == GIMP_TRANSLATE_MODE_VECTORS)
|
||||
active_item = GIMP_ITEM (gimp_image_get_active_vectors (gdisp->gimage));
|
||||
else
|
||||
active_item = GIMP_ITEM (gimp_image_active_drawable (gdisp->gimage));
|
||||
|
@ -491,10 +492,10 @@ gimp_edit_selection_tool_button_release (GimpTool *tool,
|
|||
coords->x,
|
||||
coords->y);
|
||||
|
||||
/* EDIT_MASK_TRANSLATE is performed here at movement end, not 'live' like
|
||||
/* GIMP_TRANSLATE_MODE_MASK is performed here at movement end, not 'live' like
|
||||
* the other translation types.
|
||||
*/
|
||||
if (edit_select->edit_type == EDIT_MASK_TRANSLATE)
|
||||
if (edit_select->edit_mode == GIMP_TRANSLATE_MODE_MASK)
|
||||
{
|
||||
/* move the selection -- whether there has been movement or not!
|
||||
* (to ensure that there's something on the undo stack)
|
||||
|
@ -505,11 +506,11 @@ gimp_edit_selection_tool_button_release (GimpTool *tool,
|
|||
TRUE);
|
||||
}
|
||||
|
||||
/* EDIT_CHANNEL_TRANSLATE and EDIT_LAYER_MASK_TRANSLATE need to be
|
||||
* preformed after thawing the undo.
|
||||
/* GIMP_TRANSLATE_MODE_CHANNEL and GIMP_TRANSLATE_MODE_LAYER_MASK
|
||||
* need to be preformed after thawing the undo.
|
||||
*/
|
||||
if (edit_select->edit_type == EDIT_CHANNEL_TRANSLATE ||
|
||||
edit_select->edit_type == EDIT_LAYER_MASK_TRANSLATE)
|
||||
if (edit_select->edit_mode == GIMP_TRANSLATE_MODE_CHANNEL ||
|
||||
edit_select->edit_mode == GIMP_TRANSLATE_MODE_LAYER_MASK)
|
||||
{
|
||||
/* move the channel -- whether there has been movement or not!
|
||||
* (to ensure that there's something on the undo stack)
|
||||
|
@ -520,9 +521,9 @@ gimp_edit_selection_tool_button_release (GimpTool *tool,
|
|||
TRUE);
|
||||
}
|
||||
|
||||
if (edit_select->edit_type == EDIT_VECTORS_TRANSLATE ||
|
||||
edit_select->edit_type == EDIT_CHANNEL_TRANSLATE ||
|
||||
edit_select->edit_type == EDIT_LAYER_TRANSLATE)
|
||||
if (edit_select->edit_mode == GIMP_TRANSLATE_MODE_VECTORS ||
|
||||
edit_select->edit_mode == GIMP_TRANSLATE_MODE_CHANNEL ||
|
||||
edit_select->edit_mode == GIMP_TRANSLATE_MODE_LAYER)
|
||||
{
|
||||
if (! (state & GDK_BUTTON3_MASK) &&
|
||||
(edit_select->cumlx != 0 ||
|
||||
|
@ -587,7 +588,7 @@ gimp_edit_selection_tool_motion (GimpTool *tool,
|
|||
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
if (edit_select->edit_type == EDIT_VECTORS_TRANSLATE)
|
||||
if (edit_select->edit_mode == GIMP_TRANSLATE_MODE_VECTORS)
|
||||
active_item = GIMP_ITEM (gimp_image_get_active_vectors (gdisp->gimage));
|
||||
else
|
||||
active_item = GIMP_ITEM (gimp_image_active_drawable (gdisp->gimage));
|
||||
|
@ -622,28 +623,28 @@ gimp_edit_selection_tool_motion (GimpTool *tool,
|
|||
edit_select->cumlx += xoffset;
|
||||
edit_select->cumly += yoffset;
|
||||
|
||||
switch (edit_select->edit_type)
|
||||
switch (edit_select->edit_mode)
|
||||
{
|
||||
case EDIT_LAYER_MASK_TRANSLATE:
|
||||
case EDIT_MASK_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_LAYER_MASK:
|
||||
case GIMP_TRANSLATE_MODE_MASK:
|
||||
/* we don't do the actual edit selection move here. */
|
||||
edit_select->origx = x;
|
||||
edit_select->origy = y;
|
||||
break;
|
||||
|
||||
case EDIT_VECTORS_TRANSLATE:
|
||||
case EDIT_CHANNEL_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_VECTORS:
|
||||
case GIMP_TRANSLATE_MODE_CHANNEL:
|
||||
edit_select->origx = x;
|
||||
edit_select->origy = y;
|
||||
|
||||
/* fallthru */
|
||||
|
||||
case EDIT_LAYER_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_LAYER:
|
||||
/* for CHANNEL_TRANSLATE, only translate the linked layers
|
||||
* and vectors on-the-fly, the channel is translated
|
||||
* on button_release.
|
||||
*/
|
||||
if (edit_select->edit_type != EDIT_CHANNEL_TRANSLATE)
|
||||
if (edit_select->edit_mode != GIMP_TRANSLATE_MODE_CHANNEL)
|
||||
gimp_item_translate (active_item, xoffset, yoffset,
|
||||
edit_select->first_move);
|
||||
|
||||
|
@ -667,13 +668,13 @@ gimp_edit_selection_tool_motion (GimpTool *tool,
|
|||
}
|
||||
break;
|
||||
|
||||
case EDIT_MASK_TO_LAYER_TRANSLATE:
|
||||
case EDIT_MASK_COPY_TO_LAYER_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_MASK_TO_LAYER:
|
||||
case GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER:
|
||||
if (! gimp_selection_float (gimp_image_get_mask (gdisp->gimage),
|
||||
GIMP_DRAWABLE (active_item),
|
||||
gimp_get_user_context (gdisp->gimage->gimp),
|
||||
edit_select->edit_type ==
|
||||
EDIT_MASK_TO_LAYER_TRANSLATE,
|
||||
edit_select->edit_mode ==
|
||||
GIMP_TRANSLATE_MODE_MASK_TO_LAYER,
|
||||
0, 0))
|
||||
{
|
||||
/* no region to float, abort safely */
|
||||
|
@ -689,13 +690,13 @@ gimp_edit_selection_tool_motion (GimpTool *tool,
|
|||
edit_select->x1 = 0;
|
||||
edit_select->y1 = 0;
|
||||
|
||||
edit_select->edit_type = EDIT_FLOATING_SEL_TRANSLATE;
|
||||
edit_select->edit_mode = GIMP_TRANSLATE_MODE_FLOATING_SEL;
|
||||
|
||||
active_item = GIMP_ITEM (gimp_image_active_drawable (gdisp->gimage));
|
||||
|
||||
/* fall through */
|
||||
|
||||
case EDIT_FLOATING_SEL_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_FLOATING_SEL:
|
||||
gimp_item_translate (active_item, xoffset, yoffset,
|
||||
edit_select->first_move);
|
||||
break;
|
||||
|
@ -730,22 +731,22 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
|
|||
GimpDisplay *gdisp = GIMP_TOOL (draw_tool)->gdisp;
|
||||
GimpItem *active_item;
|
||||
|
||||
if (edit_select->edit_type == EDIT_VECTORS_TRANSLATE)
|
||||
if (edit_select->edit_mode == GIMP_TRANSLATE_MODE_VECTORS)
|
||||
active_item = GIMP_ITEM (gimp_image_get_active_vectors (gdisp->gimage));
|
||||
else
|
||||
active_item = GIMP_ITEM (gimp_image_active_drawable (gdisp->gimage));
|
||||
|
||||
switch (edit_select->edit_type)
|
||||
switch (edit_select->edit_mode)
|
||||
{
|
||||
case EDIT_CHANNEL_TRANSLATE:
|
||||
case EDIT_LAYER_MASK_TRANSLATE:
|
||||
case EDIT_MASK_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_CHANNEL:
|
||||
case GIMP_TRANSLATE_MODE_LAYER_MASK:
|
||||
case GIMP_TRANSLATE_MODE_MASK:
|
||||
{
|
||||
gboolean floating_sel = FALSE;
|
||||
gint off_x = 0;
|
||||
gint off_y = 0;
|
||||
|
||||
if (edit_select->edit_type == EDIT_MASK_TRANSLATE)
|
||||
if (edit_select->edit_mode == GIMP_TRANSLATE_MODE_MASK)
|
||||
{
|
||||
GimpLayer *layer = gimp_image_get_active_layer (gdisp->gimage);
|
||||
|
||||
|
@ -774,7 +775,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
|
|||
edit_select->cumly + off_y,
|
||||
FALSE);
|
||||
}
|
||||
else if (edit_select->edit_type != EDIT_MASK_TRANSLATE)
|
||||
else if (edit_select->edit_mode != GIMP_TRANSLATE_MODE_MASK)
|
||||
{
|
||||
gimp_draw_tool_draw_rectangle (draw_tool,
|
||||
FALSE,
|
||||
|
@ -787,8 +788,8 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
|
|||
}
|
||||
break;
|
||||
|
||||
case EDIT_MASK_TO_LAYER_TRANSLATE:
|
||||
case EDIT_MASK_COPY_TO_LAYER_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_MASK_TO_LAYER:
|
||||
case GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER:
|
||||
gimp_draw_tool_draw_rectangle (draw_tool,
|
||||
FALSE,
|
||||
edit_select->x1,
|
||||
|
@ -798,7 +799,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
|
|||
TRUE);
|
||||
break;
|
||||
|
||||
case EDIT_LAYER_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_LAYER:
|
||||
{
|
||||
GimpItem *active_item;
|
||||
gint x1, y1, x2, y2;
|
||||
|
@ -852,7 +853,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
|
|||
}
|
||||
break;
|
||||
|
||||
case EDIT_VECTORS_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_VECTORS:
|
||||
{
|
||||
GimpItem *active_item;
|
||||
gdouble x1, y1, x2, y2;
|
||||
|
@ -900,7 +901,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
|
|||
}
|
||||
break;
|
||||
|
||||
case EDIT_FLOATING_SEL_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_FLOATING_SEL:
|
||||
gimp_draw_tool_draw_boundary (draw_tool,
|
||||
edit_select->segs_in,
|
||||
edit_select->num_segs_in,
|
||||
|
@ -1016,15 +1017,15 @@ gimp_edit_selection_tool_key_press (GimpTool *tool,
|
|||
GdkEventKey *kevent,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
gint inc_x = 0;
|
||||
gint inc_y = 0;
|
||||
GimpUndo *undo;
|
||||
gboolean push_undo = TRUE;
|
||||
GimpItem *item = NULL;
|
||||
EditType edit_type = EDIT_MASK_TRANSLATE;
|
||||
GimpUndoType undo_type = GIMP_UNDO_GROUP_MASK;
|
||||
const gchar *undo_desc = NULL;
|
||||
gint velocity;
|
||||
gint inc_x = 0;
|
||||
gint inc_y = 0;
|
||||
GimpUndo *undo;
|
||||
gboolean push_undo = TRUE;
|
||||
GimpItem *item = NULL;
|
||||
GimpTranslateMode edit_mode = GIMP_TRANSLATE_MODE_MASK;
|
||||
GimpUndoType undo_type = GIMP_UNDO_GROUP_MASK;
|
||||
const gchar *undo_desc = NULL;
|
||||
gint velocity;
|
||||
|
||||
/* bail out early if it is not an arrow key event */
|
||||
|
||||
|
@ -1077,7 +1078,7 @@ gimp_edit_selection_tool_key_press (GimpTool *tool,
|
|||
{
|
||||
item = GIMP_ITEM (gimp_image_get_mask (gdisp->gimage));
|
||||
|
||||
edit_type = EDIT_MASK_TRANSLATE;
|
||||
edit_mode = GIMP_TRANSLATE_MODE_MASK;
|
||||
undo_type = GIMP_UNDO_GROUP_MASK;
|
||||
}
|
||||
else
|
||||
|
@ -1116,7 +1117,7 @@ gimp_edit_selection_tool_key_press (GimpTool *tool,
|
|||
{
|
||||
item = (GimpItem *) gimp_image_get_active_vectors (gdisp->gimage);
|
||||
|
||||
edit_type = EDIT_VECTORS_TRANSLATE;
|
||||
edit_mode = GIMP_TRANSLATE_MODE_VECTORS;
|
||||
undo_type = GIMP_UNDO_GROUP_ITEM_DISPLACE;
|
||||
}
|
||||
else
|
||||
|
@ -1159,19 +1160,19 @@ gimp_edit_selection_tool_key_press (GimpTool *tool,
|
|||
{
|
||||
if (GIMP_IS_LAYER_MASK (item))
|
||||
{
|
||||
edit_type = EDIT_LAYER_MASK_TRANSLATE;
|
||||
edit_mode = GIMP_TRANSLATE_MODE_LAYER_MASK;
|
||||
}
|
||||
else if (GIMP_IS_CHANNEL (item))
|
||||
{
|
||||
edit_type = EDIT_CHANNEL_TRANSLATE;
|
||||
edit_mode = GIMP_TRANSLATE_MODE_CHANNEL;
|
||||
}
|
||||
else if (gimp_layer_is_floating_sel (GIMP_LAYER (item)))
|
||||
{
|
||||
edit_type = EDIT_FLOATING_SEL_TRANSLATE;
|
||||
edit_mode = GIMP_TRANSLATE_MODE_FLOATING_SEL;
|
||||
}
|
||||
else
|
||||
{
|
||||
edit_type = EDIT_LAYER_TRANSLATE;
|
||||
edit_mode = GIMP_TRANSLATE_MODE_LAYER;
|
||||
}
|
||||
|
||||
undo_type = GIMP_UNDO_GROUP_ITEM_DISPLACE;
|
||||
|
@ -1183,9 +1184,9 @@ gimp_edit_selection_tool_key_press (GimpTool *tool,
|
|||
if (! item)
|
||||
return TRUE;
|
||||
|
||||
switch (edit_type)
|
||||
switch (edit_mode)
|
||||
{
|
||||
case EDIT_FLOATING_SEL_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_FLOATING_SEL:
|
||||
undo_desc = _("Move Floating Layer");
|
||||
break;
|
||||
|
||||
|
@ -1205,7 +1206,7 @@ gimp_edit_selection_tool_key_press (GimpTool *tool,
|
|||
g_object_get_data (G_OBJECT (undo), "edit-selection-item") ==
|
||||
(gpointer) item &&
|
||||
g_object_get_data (G_OBJECT (undo), "edit-selection-type") ==
|
||||
GINT_TO_POINTER (edit_type))
|
||||
GINT_TO_POINTER (edit_mode))
|
||||
{
|
||||
push_undo = FALSE;
|
||||
}
|
||||
|
@ -1224,26 +1225,26 @@ gimp_edit_selection_tool_key_press (GimpTool *tool,
|
|||
g_object_set_data (G_OBJECT (undo), "edit-selection-item",
|
||||
item);
|
||||
g_object_set_data (G_OBJECT (undo), "edit-selection-type",
|
||||
GINT_TO_POINTER (edit_type));
|
||||
GINT_TO_POINTER (edit_mode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (edit_type)
|
||||
switch (edit_mode)
|
||||
{
|
||||
case EDIT_LAYER_MASK_TRANSLATE:
|
||||
case EDIT_MASK_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_LAYER_MASK:
|
||||
case GIMP_TRANSLATE_MODE_MASK:
|
||||
gimp_item_translate (item, inc_x, inc_y, push_undo);
|
||||
break;
|
||||
|
||||
case EDIT_MASK_TO_LAYER_TRANSLATE:
|
||||
case EDIT_MASK_COPY_TO_LAYER_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_MASK_TO_LAYER:
|
||||
case GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER:
|
||||
/* this won't happen */
|
||||
break;
|
||||
|
||||
case EDIT_VECTORS_TRANSLATE:
|
||||
case EDIT_CHANNEL_TRANSLATE:
|
||||
case EDIT_LAYER_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_VECTORS:
|
||||
case GIMP_TRANSLATE_MODE_CHANNEL:
|
||||
case GIMP_TRANSLATE_MODE_LAYER:
|
||||
gimp_item_translate (item, inc_x, inc_y, push_undo);
|
||||
|
||||
/* translate all linked items as well */
|
||||
|
@ -1251,7 +1252,7 @@ gimp_edit_selection_tool_key_press (GimpTool *tool,
|
|||
gimp_item_linked_translate (item, inc_x, inc_y, push_undo);
|
||||
break;
|
||||
|
||||
case EDIT_FLOATING_SEL_TRANSLATE:
|
||||
case GIMP_TRANSLATE_MODE_FLOATING_SEL:
|
||||
gimp_item_translate (item, inc_x, inc_y, push_undo);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -20,28 +20,15 @@
|
|||
#define __GIMP_EDIT_SELECTION_TOOL_H__
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EDIT_VECTORS_TRANSLATE,
|
||||
EDIT_CHANNEL_TRANSLATE,
|
||||
EDIT_LAYER_MASK_TRANSLATE,
|
||||
EDIT_MASK_TRANSLATE,
|
||||
EDIT_MASK_TO_LAYER_TRANSLATE,
|
||||
EDIT_MASK_COPY_TO_LAYER_TRANSLATE,
|
||||
EDIT_LAYER_TRANSLATE,
|
||||
EDIT_FLOATING_SEL_TRANSLATE
|
||||
} EditType;
|
||||
void gimp_edit_selection_tool_start (GimpTool *parent_tool,
|
||||
GimpDisplay *gdisp,
|
||||
GimpCoords *coords,
|
||||
GimpTranslateMode edit_mode);
|
||||
|
||||
|
||||
void init_edit_selection (GimpTool *tool,
|
||||
GimpDisplay *gdisp,
|
||||
GimpCoords *coords,
|
||||
EditType edit_type);
|
||||
|
||||
|
||||
gboolean gimp_edit_selection_tool_key_press (GimpTool *tool,
|
||||
GdkEventKey *kevent,
|
||||
GimpDisplay *gdisp);
|
||||
gboolean gimp_edit_selection_tool_key_press (GimpTool *tool,
|
||||
GdkEventKey *kevent,
|
||||
GimpDisplay *gdisp);
|
||||
|
||||
|
||||
#endif /* __GIMP_EDIT_SELECTION_TOOL_H__ */
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "gimpeditselectiontool.h"
|
||||
#include "gimpfreeselecttool.h"
|
||||
#include "gimpselectionoptions.h"
|
||||
#include "gimptoolcontrol.h"
|
||||
|
@ -190,20 +189,8 @@ gimp_free_select_tool_button_press (GimpTool *tool,
|
|||
gimp_tool_control_activate (tool->control);
|
||||
tool->gdisp = gdisp;
|
||||
|
||||
switch (GIMP_SELECTION_TOOL (tool)->op)
|
||||
{
|
||||
case SELECTION_MOVE_MASK:
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_MASK_TRANSLATE);
|
||||
return;
|
||||
case SELECTION_MOVE:
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_MASK_TO_LAYER_TRANSLATE);
|
||||
return;
|
||||
case SELECTION_MOVE_COPY:
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_MASK_COPY_TO_LAYER_TRANSLATE);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (free_sel), coords))
|
||||
return;
|
||||
|
||||
free_sel->last_coords = *coords;
|
||||
free_sel->num_points = 0;
|
||||
|
@ -233,18 +220,18 @@ gimp_free_select_tool_button_release (GimpTool *tool,
|
|||
if (! (state & GDK_BUTTON3_MASK))
|
||||
{
|
||||
if (free_sel->num_points == 1)
|
||||
{
|
||||
/* If there is a floating selection, anchor it */
|
||||
if (gimp_image_floating_sel (gdisp->gimage))
|
||||
floating_sel_anchor (gimp_image_floating_sel (gdisp->gimage));
|
||||
/* Otherwise, clear the selection mask */
|
||||
else
|
||||
gimp_channel_clear (gimp_image_get_mask (gdisp->gimage), NULL,
|
||||
{
|
||||
/* If there is a floating selection, anchor it */
|
||||
if (gimp_image_floating_sel (gdisp->gimage))
|
||||
floating_sel_anchor (gimp_image_floating_sel (gdisp->gimage));
|
||||
/* Otherwise, clear the selection mask */
|
||||
else
|
||||
gimp_channel_clear (gimp_image_get_mask (gdisp->gimage), NULL,
|
||||
TRUE);
|
||||
|
||||
gimp_image_flush (gdisp->gimage);
|
||||
return;
|
||||
}
|
||||
gimp_image_flush (gdisp->gimage);
|
||||
return;
|
||||
}
|
||||
|
||||
gimp_channel_select_polygon (gimp_image_get_mask (gdisp->gimage),
|
||||
tool->tool_info->blurb,
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "display/gimpdisplayshell-cursor.h"
|
||||
#include "display/gimpdisplayshell-transform.h"
|
||||
|
||||
#include "gimpeditselectiontool.h"
|
||||
#include "gimpfuzzyselecttool.h"
|
||||
#include "gimpselectionoptions.h"
|
||||
#include "gimptoolcontrol.h"
|
||||
|
@ -200,7 +199,7 @@ gimp_fuzzy_select_tool_button_press (GimpTool *tool,
|
|||
GimpFuzzySelectTool *fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool);
|
||||
GimpSelectionOptions *options;
|
||||
|
||||
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
|
||||
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
fuzzy_sel->x = coords->x;
|
||||
fuzzy_sel->y = coords->y;
|
||||
|
@ -211,20 +210,8 @@ gimp_fuzzy_select_tool_button_press (GimpTool *tool,
|
|||
gimp_tool_control_activate (tool->control);
|
||||
tool->gdisp = gdisp;
|
||||
|
||||
switch (GIMP_SELECTION_TOOL (tool)->op)
|
||||
{
|
||||
case SELECTION_MOVE_MASK:
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_MASK_TRANSLATE);
|
||||
return;
|
||||
case SELECTION_MOVE:
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_MASK_TO_LAYER_TRANSLATE);
|
||||
return;
|
||||
case SELECTION_MOVE_COPY:
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_MASK_COPY_TO_LAYER_TRANSLATE);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (fuzzy_sel), coords))
|
||||
return;
|
||||
|
||||
/* calculate the region boundary */
|
||||
fuzzy_sel->segs = gimp_fuzzy_select_tool_calculate (fuzzy_sel, gdisp,
|
||||
|
@ -255,18 +242,18 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool,
|
|||
gint off_x, off_y;
|
||||
|
||||
if (GIMP_SELECTION_TOOL (tool)->op == SELECTION_ANCHOR)
|
||||
{
|
||||
/* If there is a floating selection, anchor it */
|
||||
if (gimp_image_floating_sel (gdisp->gimage))
|
||||
floating_sel_anchor (gimp_image_floating_sel (gdisp->gimage));
|
||||
/* Otherwise, clear the selection mask */
|
||||
else
|
||||
gimp_channel_clear (gimp_image_get_mask (gdisp->gimage), NULL,
|
||||
{
|
||||
/* If there is a floating selection, anchor it */
|
||||
if (gimp_image_floating_sel (gdisp->gimage))
|
||||
floating_sel_anchor (gimp_image_floating_sel (gdisp->gimage));
|
||||
/* Otherwise, clear the selection mask */
|
||||
else
|
||||
gimp_channel_clear (gimp_image_get_mask (gdisp->gimage), NULL,
|
||||
TRUE);
|
||||
|
||||
gimp_image_flush (gdisp->gimage);
|
||||
return;
|
||||
}
|
||||
gimp_image_flush (gdisp->gimage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (options->sample_merged)
|
||||
{
|
||||
|
@ -429,10 +416,10 @@ gimp_fuzzy_select_tool_calculate (GimpFuzzySelectTool *fuzzy_sel,
|
|||
*/
|
||||
pixel_region_init (&maskPR,
|
||||
gimp_drawable_data (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask)),
|
||||
0, 0,
|
||||
gimp_item_width (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
|
||||
gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
|
||||
FALSE);
|
||||
0, 0,
|
||||
gimp_item_width (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
|
||||
gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
|
||||
FALSE);
|
||||
|
||||
bsegs =
|
||||
find_mask_boundary (&maskPR, num_segs, WithinBounds,
|
||||
|
|
|
@ -75,7 +75,6 @@
|
|||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "gimpiscissorstool.h"
|
||||
#include "gimpeditselectiontool.h"
|
||||
#include "gimpselectionoptions.h"
|
||||
#include "gimptoolcontrol.h"
|
||||
|
||||
|
|
|
@ -315,12 +315,14 @@ gimp_move_tool_button_press (GimpTool *tool,
|
|||
{
|
||||
case GIMP_TRANSFORM_TYPE_PATH:
|
||||
if (gimp_image_get_active_vectors (gdisp->gimage))
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_VECTORS_TRANSLATE);
|
||||
gimp_edit_selection_tool_start (tool, gdisp, coords,
|
||||
GIMP_TRANSLATE_MODE_VECTORS);
|
||||
break;
|
||||
|
||||
case GIMP_TRANSFORM_TYPE_SELECTION:
|
||||
if (! gimp_channel_is_empty (gimp_image_get_mask (gdisp->gimage)))
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_MASK_TRANSLATE);
|
||||
gimp_edit_selection_tool_start (tool, gdisp, coords,
|
||||
GIMP_TRANSLATE_MODE_MASK);
|
||||
break;
|
||||
|
||||
case GIMP_TRANSFORM_TYPE_LAYER:
|
||||
|
@ -328,11 +330,14 @@ gimp_move_tool_button_press (GimpTool *tool,
|
|||
GimpDrawable *drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
if (GIMP_IS_LAYER_MASK (drawable))
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_LAYER_MASK_TRANSLATE);
|
||||
gimp_edit_selection_tool_start (tool, gdisp, coords,
|
||||
GIMP_TRANSLATE_MODE_LAYER_MASK);
|
||||
else if (GIMP_IS_CHANNEL (drawable))
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_CHANNEL_TRANSLATE);
|
||||
gimp_edit_selection_tool_start (tool, gdisp, coords,
|
||||
GIMP_TRANSLATE_MODE_CHANNEL);
|
||||
else if (GIMP_IS_LAYER (drawable))
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_LAYER_TRANSLATE);
|
||||
gimp_edit_selection_tool_start (tool, gdisp, coords,
|
||||
GIMP_TRANSLATE_MODE_LAYER);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
|
||||
#include "gimpeditselectiontool.h"
|
||||
#include "gimprectselecttool.h"
|
||||
#include "gimpselectionoptions.h"
|
||||
#include "gimptoolcontrol.h"
|
||||
|
@ -216,20 +215,8 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
|
|||
gimp_tool_control_activate (tool->control);
|
||||
tool->gdisp = gdisp;
|
||||
|
||||
switch (sel_tool->op)
|
||||
{
|
||||
case SELECTION_MOVE_MASK:
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_MASK_TRANSLATE);
|
||||
return;
|
||||
case SELECTION_MOVE:
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_MASK_TO_LAYER_TRANSLATE);
|
||||
return;
|
||||
case SELECTION_MOVE_COPY:
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_MASK_COPY_TO_LAYER_TRANSLATE);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (gimp_selection_tool_start_edit (sel_tool, coords))
|
||||
return;
|
||||
|
||||
switch (sel_tool->op)
|
||||
{
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "display/gimpdisplayshell-cursor.h"
|
||||
#include "display/gimpdisplayshell-transform.h"
|
||||
|
||||
#include "gimpeditselectiontool.h"
|
||||
#include "gimpfuzzyselecttool.h"
|
||||
#include "gimpselectionoptions.h"
|
||||
#include "gimptoolcontrol.h"
|
||||
|
@ -200,7 +199,7 @@ gimp_fuzzy_select_tool_button_press (GimpTool *tool,
|
|||
GimpFuzzySelectTool *fuzzy_sel = GIMP_FUZZY_SELECT_TOOL (tool);
|
||||
GimpSelectionOptions *options;
|
||||
|
||||
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
|
||||
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
fuzzy_sel->x = coords->x;
|
||||
fuzzy_sel->y = coords->y;
|
||||
|
@ -211,20 +210,8 @@ gimp_fuzzy_select_tool_button_press (GimpTool *tool,
|
|||
gimp_tool_control_activate (tool->control);
|
||||
tool->gdisp = gdisp;
|
||||
|
||||
switch (GIMP_SELECTION_TOOL (tool)->op)
|
||||
{
|
||||
case SELECTION_MOVE_MASK:
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_MASK_TRANSLATE);
|
||||
return;
|
||||
case SELECTION_MOVE:
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_MASK_TO_LAYER_TRANSLATE);
|
||||
return;
|
||||
case SELECTION_MOVE_COPY:
|
||||
init_edit_selection (tool, gdisp, coords, EDIT_MASK_COPY_TO_LAYER_TRANSLATE);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (fuzzy_sel), coords))
|
||||
return;
|
||||
|
||||
/* calculate the region boundary */
|
||||
fuzzy_sel->segs = gimp_fuzzy_select_tool_calculate (fuzzy_sel, gdisp,
|
||||
|
@ -255,18 +242,18 @@ gimp_fuzzy_select_tool_button_release (GimpTool *tool,
|
|||
gint off_x, off_y;
|
||||
|
||||
if (GIMP_SELECTION_TOOL (tool)->op == SELECTION_ANCHOR)
|
||||
{
|
||||
/* If there is a floating selection, anchor it */
|
||||
if (gimp_image_floating_sel (gdisp->gimage))
|
||||
floating_sel_anchor (gimp_image_floating_sel (gdisp->gimage));
|
||||
/* Otherwise, clear the selection mask */
|
||||
else
|
||||
gimp_channel_clear (gimp_image_get_mask (gdisp->gimage), NULL,
|
||||
{
|
||||
/* If there is a floating selection, anchor it */
|
||||
if (gimp_image_floating_sel (gdisp->gimage))
|
||||
floating_sel_anchor (gimp_image_floating_sel (gdisp->gimage));
|
||||
/* Otherwise, clear the selection mask */
|
||||
else
|
||||
gimp_channel_clear (gimp_image_get_mask (gdisp->gimage), NULL,
|
||||
TRUE);
|
||||
|
||||
gimp_image_flush (gdisp->gimage);
|
||||
return;
|
||||
}
|
||||
gimp_image_flush (gdisp->gimage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (options->sample_merged)
|
||||
{
|
||||
|
@ -429,10 +416,10 @@ gimp_fuzzy_select_tool_calculate (GimpFuzzySelectTool *fuzzy_sel,
|
|||
*/
|
||||
pixel_region_init (&maskPR,
|
||||
gimp_drawable_data (GIMP_DRAWABLE (fuzzy_sel->fuzzy_mask)),
|
||||
0, 0,
|
||||
gimp_item_width (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
|
||||
gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
|
||||
FALSE);
|
||||
0, 0,
|
||||
gimp_item_width (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
|
||||
gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
|
||||
FALSE);
|
||||
|
||||
bsegs =
|
||||
find_mask_boundary (&maskPR, num_segs, WithinBounds,
|
||||
|
|
|
@ -37,22 +37,22 @@
|
|||
#include "gimptoolcontrol.h"
|
||||
|
||||
|
||||
static void gimp_selection_tool_class_init (GimpSelectionToolClass *klass);
|
||||
static void gimp_selection_tool_init (GimpSelectionTool *selection_tool);
|
||||
static void gimp_selection_tool_class_init (GimpSelectionToolClass *klass);
|
||||
static void gimp_selection_tool_init (GimpSelectionTool *sel_tool);
|
||||
|
||||
static void gimp_selection_tool_modifier_key (GimpTool *tool,
|
||||
GdkModifierType key,
|
||||
gboolean press,
|
||||
GdkModifierType state,
|
||||
GimpDisplay *gdisp);
|
||||
static void gimp_selection_tool_oper_update (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
GdkModifierType state,
|
||||
GimpDisplay *gdisp);
|
||||
static void gimp_selection_tool_cursor_update (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
GdkModifierType state,
|
||||
GimpDisplay *gdisp);
|
||||
static void gimp_selection_tool_modifier_key (GimpTool *tool,
|
||||
GdkModifierType key,
|
||||
gboolean press,
|
||||
GdkModifierType state,
|
||||
GimpDisplay *gdisp);
|
||||
static void gimp_selection_tool_oper_update (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
GdkModifierType state,
|
||||
GimpDisplay *gdisp);
|
||||
static void gimp_selection_tool_cursor_update (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
GdkModifierType state,
|
||||
GimpDisplay *gdisp);
|
||||
|
||||
|
||||
static GimpDrawToolClass *parent_class = NULL;
|
||||
|
@ -113,11 +113,10 @@ gimp_selection_tool_modifier_key (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpSelectionTool *selection_tool;
|
||||
GimpSelectionTool *selection_tool = GIMP_SELECTION_TOOL (tool);
|
||||
GimpSelectionOptions *options;
|
||||
|
||||
selection_tool = GIMP_SELECTION_TOOL (tool);
|
||||
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
|
||||
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
if (key == GDK_SHIFT_MASK || key == GDK_CONTROL_MASK)
|
||||
{
|
||||
|
@ -168,7 +167,7 @@ gimp_selection_tool_oper_update (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpSelectionTool *selection_tool;
|
||||
GimpSelectionTool *selection_tool = GIMP_SELECTION_TOOL (tool);
|
||||
GimpSelectionOptions *options;
|
||||
GimpChannel *selection;
|
||||
GimpLayer *layer;
|
||||
|
@ -176,8 +175,7 @@ gimp_selection_tool_oper_update (GimpTool *tool,
|
|||
gboolean move_layer = FALSE;
|
||||
gboolean move_floating_sel = FALSE;
|
||||
|
||||
selection_tool = GIMP_SELECTION_TOOL (tool);
|
||||
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
|
||||
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
selection = gimp_image_get_mask (gdisp->gimage);
|
||||
layer = gimp_image_pick_correlate_layer (gdisp->gimage,
|
||||
|
@ -273,3 +271,44 @@ gimp_selection_tool_cursor_update (GimpTool *tool,
|
|||
gimp_tool_set_cursor (tool, gdisp,
|
||||
GIMP_CURSOR_MOUSE, tool_cursor, cmodifier);
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
gboolean
|
||||
gimp_selection_tool_start_edit (GimpSelectionTool *sel_tool,
|
||||
GimpCoords *coords)
|
||||
{
|
||||
GimpTool *tool;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_SELECTION_TOOL (sel_tool), FALSE);
|
||||
g_return_val_if_fail (coords != NULL, FALSE);
|
||||
|
||||
tool = GIMP_TOOL (sel_tool);
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY (tool->gdisp), FALSE);
|
||||
g_return_val_if_fail (gimp_tool_control_is_active (tool->control), FALSE);
|
||||
|
||||
switch (sel_tool->op)
|
||||
{
|
||||
case SELECTION_MOVE_MASK:
|
||||
gimp_edit_selection_tool_start (tool, tool->gdisp, coords,
|
||||
GIMP_TRANSLATE_MODE_MASK);
|
||||
return TRUE;
|
||||
|
||||
case SELECTION_MOVE:
|
||||
gimp_edit_selection_tool_start (tool, tool->gdisp, coords,
|
||||
GIMP_TRANSLATE_MODE_MASK_TO_LAYER);
|
||||
return TRUE;
|
||||
|
||||
case SELECTION_MOVE_COPY:
|
||||
gimp_edit_selection_tool_start (tool, tool->gdisp, coords,
|
||||
GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER);
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef struct _GimpSelectionToolClass GimpSelectionToolClass;
|
|||
struct _GimpSelectionTool
|
||||
{
|
||||
GimpDrawTool parent_instance;
|
||||
|
||||
|
||||
SelectOps op; /* selection operation (SELECTION_ADD etc.) */
|
||||
SelectOps saved_op; /* saved tool options state */
|
||||
};
|
||||
|
@ -48,7 +48,11 @@ struct _GimpSelectionToolClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_selection_tool_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_selection_tool_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* protected function */
|
||||
gboolean gimp_selection_tool_start_edit (GimpSelectionTool *sel_tool,
|
||||
GimpCoords *coords);
|
||||
|
||||
|
||||
#endif /* __GIMP_SELECTION_TOOL_H__ */
|
||||
|
|
|
@ -130,6 +130,19 @@ typedef enum /*< skip >*/
|
|||
HALT
|
||||
} GimpToolAction;
|
||||
|
||||
/* Modes of GimpEditSelectionTool */
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
GIMP_TRANSLATE_MODE_VECTORS,
|
||||
GIMP_TRANSLATE_MODE_CHANNEL,
|
||||
GIMP_TRANSLATE_MODE_LAYER_MASK,
|
||||
GIMP_TRANSLATE_MODE_MASK,
|
||||
GIMP_TRANSLATE_MODE_MASK_TO_LAYER,
|
||||
GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER,
|
||||
GIMP_TRANSLATE_MODE_LAYER,
|
||||
GIMP_TRANSLATE_MODE_FLOATING_SEL
|
||||
} GimpTranslateMode;
|
||||
|
||||
/* Motion event report modes */
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue