Issue #3514: Free Select tool: Alt-Ctrl|Shift not working unless...

... selection is committed;
Fast copy|cut-paste modifiers in selection tools were not working with
the Free Select tool, even when the polygon was closed. The reason was
that GimpPolygonSelectTool was not properly chaining up with the parent
implementation for oper_update(), and then upon a button press, we need
to check to call gimp_selection_tool_start_edit() to see if the action
should not be handled by GimpSelectionTool.
Of course, since we don't necessarily want all child class of
GimpPolygonSelectTool to support these modifiers (typically we may not
want these in the Foreground select tool), I set allow_move to FALSE,
then set it to TRUE only in the GimpFreeSelectTool subclass.
This commit is contained in:
Jehan 2019-06-16 19:52:07 +02:00
parent 940dbdf6a7
commit c9a91b32bc
2 changed files with 32 additions and 24 deletions

View File

@ -125,7 +125,8 @@ gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass)
static void
gimp_free_select_tool_init (GimpFreeSelectTool *free_sel)
{
GimpTool *tool = GIMP_TOOL (free_sel);
GimpTool *tool = GIMP_TOOL (free_sel);
GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool);
free_sel->priv = gimp_free_select_tool_get_instance_private (free_sel);
@ -136,6 +137,8 @@ gimp_free_select_tool_init (GimpFreeSelectTool *free_sel)
GIMP_TOOL_ACTION_COMMIT);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_FREE_SELECT);
sel_tool->allow_move = TRUE;
}
static void
@ -176,6 +179,13 @@ gimp_free_select_tool_button_press (GimpTool *tool,
GimpPolygonSelectTool *poly_sel = GIMP_POLYGON_SELECT_TOOL (tool);
GimpFreeSelectToolPrivate *priv = free_sel->priv;
if (gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (poly_sel),
display, coords))
{
if (display)
gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, display);
return;
}
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
press_type, display);

View File

@ -145,7 +145,8 @@ gimp_polygon_select_tool_class_init (GimpPolygonSelectToolClass *klass)
static void
gimp_polygon_select_tool_init (GimpPolygonSelectTool *poly_sel)
{
GimpTool *tool = GIMP_TOOL (poly_sel);
GimpTool *tool = GIMP_TOOL (poly_sel);
GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool);
poly_sel->priv = gimp_polygon_select_tool_get_instance_private (poly_sel);
@ -157,6 +158,8 @@ gimp_polygon_select_tool_init (GimpPolygonSelectTool *poly_sel)
GIMP_TOOL_ACTIVE_MODIFIERS_SEPARATE);
gimp_tool_control_set_precision (tool->control,
GIMP_CURSOR_PRECISION_SUBPIXEL);
sel_tool->allow_move = FALSE;
}
static void
@ -204,17 +207,13 @@ gimp_polygon_select_tool_oper_update (GimpTool *tool,
GimpPolygonSelectTool *poly_sel = GIMP_POLYGON_SELECT_TOOL (tool);
GimpPolygonSelectToolPrivate *priv = poly_sel->priv;
if (display != tool->display)
{
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state,
proximity, display);
return;
}
if (priv->widget)
if (priv->widget && display == tool->display)
{
gimp_tool_widget_hover (priv->widget, coords, state, proximity);
}
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
display);
}
static void
@ -227,23 +226,22 @@ gimp_polygon_select_tool_cursor_update (GimpTool *tool,
GimpPolygonSelectToolPrivate *priv = poly_sel->priv;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
if (tool->display == NULL)
if (tool->display)
{
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state,
display);
return;
if (priv->widget && display == tool->display)
{
gimp_tool_widget_get_cursor (priv->widget, coords, state,
NULL, NULL, &modifier);
}
gimp_tool_set_cursor (tool, display,
gimp_tool_control_get_cursor (tool->control),
gimp_tool_control_get_tool_cursor (tool->control),
modifier);
}
if (priv->widget && display == tool->display)
{
gimp_tool_widget_get_cursor (priv->widget, coords, state,
NULL, NULL, &modifier);
}
gimp_tool_set_cursor (tool, display,
gimp_tool_control_get_cursor (tool->control),
gimp_tool_control_get_tool_cursor (tool->control),
modifier);
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state,
display);
}
static void