app: in the selection tools, blink mode box when the current operation is invalid

In the selection tools, when the selected operation is invalid,
i.e., when trying to subtract-from or intersect-with an empty
selection, blink the selection-mode box widget in the tool options,
in addition to showing an error message in the status bar, to hint
at the source of the error.
This commit is contained in:
Ell 2018-12-10 07:42:52 -05:00
parent 0efa00932b
commit f990e41609
3 changed files with 10 additions and 3 deletions

View File

@ -219,6 +219,8 @@ gimp_selection_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
options->mode_box = hbox;
label = gtk_label_new (_("Mode:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);

View File

@ -43,6 +43,7 @@ struct _GimpSelectionOptions
gdouble feather_radius;
/* options gui */
GtkWidget *mode_box;
GtkWidget *antialias_toggle;
};

View File

@ -470,14 +470,16 @@ gimp_selection_tool_start_edit (GimpSelectionTool *sel_tool,
GimpDisplay *display,
const GimpCoords *coords)
{
GimpTool *tool;
GError *error = NULL;
GimpTool *tool;
GimpSelectionOptions *options;
GError *error = NULL;
g_return_val_if_fail (GIMP_IS_SELECTION_TOOL (sel_tool), FALSE);
g_return_val_if_fail (GIMP_IS_DISPLAY (display), FALSE);
g_return_val_if_fail (coords != NULL, FALSE);
tool = GIMP_TOOL (sel_tool);
tool = GIMP_TOOL (sel_tool);
options = GIMP_SELECTION_TOOL_GET_OPTIONS (sel_tool);
g_return_val_if_fail (gimp_tool_control_is_active (tool->control) == FALSE,
FALSE);
@ -486,6 +488,8 @@ gimp_selection_tool_start_edit (GimpSelectionTool *sel_tool,
{
gimp_tool_message_literal (tool, display, error->message);
gimp_widget_blink (options->mode_box);
g_clear_error (&error);
return TRUE;