app: in the warp tool, blink behavior combo when the current behavior is invalid

In the warp tool, when the warp is empty and the current behavior
has no effect as a result (i.e., when it's ERASE or SMOOTH), show
an error message in the status bar, and blink the behavior combo
widget in the tool options, to hint at the source of the error.
This commit is contained in:
Ell 2018-12-12 11:17:49 -05:00
parent 17cc44a7be
commit 7958387d54
3 changed files with 38 additions and 0 deletions

View File

@ -294,6 +294,8 @@ gimp_warp_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0);
gtk_widget_show (combo);
options->behavior_combo = combo;
scale = gimp_prop_spin_scale_new (config, "effect-size", NULL,
0.01, 1.0, 2);
gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 1000.0);

View File

@ -55,6 +55,7 @@ struct _GimpWarpOptions
gint n_animation_frames;
/* options gui */
GtkWidget *behavior_combo;
GtkWidget *stroke_frame;
GtkWidget *animate_button;
};

View File

@ -662,6 +662,41 @@ gimp_warp_tool_can_stroke (GimpWarpTool *wt,
return FALSE;
}
if (! wt->filter || ! gimp_tool_can_undo (tool, display))
{
const gchar *message = NULL;
switch (options->behavior)
{
case GIMP_WARP_BEHAVIOR_MOVE:
case GIMP_WARP_BEHAVIOR_GROW:
case GIMP_WARP_BEHAVIOR_SHRINK:
case GIMP_WARP_BEHAVIOR_SWIRL_CW:
case GIMP_WARP_BEHAVIOR_SWIRL_CCW:
break;
case GIMP_WARP_BEHAVIOR_ERASE:
message = _("No warp to erase.");
break;
case GIMP_WARP_BEHAVIOR_SMOOTH:
message = _("No warp to smooth.");
break;
}
if (message)
{
if (show_message)
{
gimp_tool_message_literal (tool, display, message);
gimp_widget_blink (options->behavior_combo);
}
return FALSE;
}
}
return TRUE;
}