Commit 71119d41 authored by Ell's avatar Ell Committed by Michael Natterer

app: Add "Flood" select action

and associated UI entries.

This action applies the "gimp:flood" operation to the selection.
parent 3f04e349
......@@ -101,6 +101,12 @@ static const GimpActionEntry select_actions[] =
G_CALLBACK (select_border_cmd_callback),
GIMP_HELP_SELECTION_BORDER },
{ "select-flood", NULL,
NC_("select-action", "F_lood"), NULL,
NC_("select-action", "Level the selection's interior"),
G_CALLBACK (select_flood_cmd_callback),
GIMP_HELP_SELECTION_FLOOD },
{ "select-save", GIMP_STOCK_SELECTION_TO_CHANNEL,
NC_("select-action", "Save to _Channel"), NULL,
NC_("select-action", "Save the selection to a channel"),
......@@ -169,6 +175,7 @@ select_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("select-shrink", drawable && sel);
SET_SENSITIVE ("select-grow", drawable && sel);
SET_SENSITIVE ("select-border", drawable && sel);
SET_SENSITIVE ("select-flood", drawable && sel);
SET_SENSITIVE ("select-save", drawable && !fs);
SET_SENSITIVE ("select-stroke", writable && !children && sel);
......
......@@ -307,6 +307,17 @@ select_border_cmd_callback (GtkAction *action,
gtk_widget_show (dialog);
}
void
select_flood_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
return_if_no_image (image, data);
gimp_channel_flood (gimp_image_get_mask (image), TRUE);
gimp_image_flush (image);
}
void
select_save_cmd_callback (GtkAction *action,
gpointer data)
......
......@@ -37,6 +37,8 @@ void select_border_cmd_callback (GtkAction *action,
gpointer data);
void select_grow_cmd_callback (GtkAction *action,
gpointer data);
void select_flood_cmd_callback (GtkAction *action,
gpointer data);
void select_save_cmd_callback (GtkAction *action,
gpointer data);
void select_stroke_cmd_callback (GtkAction *action,
......
......@@ -131,6 +131,8 @@ static void gimp_selection_shrink (GimpChannel *channel,
gint radius_y,
gboolean edge_lock,
gboolean push_undo);
static void gimp_selection_flood (GimpChannel *channel,
gboolean push_undo);
G_DEFINE_TYPE (GimpSelection, gimp_selection, GIMP_TYPE_CHANNEL)
......@@ -173,6 +175,7 @@ gimp_selection_class_init (GimpSelectionClass *klass)
channel_class->border = gimp_selection_border;
channel_class->grow = gimp_selection_grow;
channel_class->shrink = gimp_selection_shrink;
channel_class->flood = gimp_selection_flood;
channel_class->feather_desc = C_("undo-type", "Feather Selection");
channel_class->sharpen_desc = C_("undo-type", "Sharpen Selection");
......@@ -182,6 +185,7 @@ gimp_selection_class_init (GimpSelectionClass *klass)
channel_class->border_desc = C_("undo-type", "Border Selection");
channel_class->grow_desc = C_("undo-type", "Grow Selection");
channel_class->shrink_desc = C_("undo-type", "Shrink Selection");
channel_class->flood_desc = C_("undo-type", "Flood Selection");
}
static void
......@@ -533,6 +537,13 @@ gimp_selection_shrink (GimpChannel *channel,
push_undo);
}
static void
gimp_selection_flood (GimpChannel *channel,
gboolean push_undo)
{
GIMP_CHANNEL_CLASS (parent_class)->flood (channel, push_undo);
}
/* public functions */
......
......@@ -74,6 +74,7 @@
#define GIMP_HELP_SELECTION_SHRINK "gimp-selection-shrink"
#define GIMP_HELP_SELECTION_GROW "gimp-selection-grow"
#define GIMP_HELP_SELECTION_BORDER "gimp-selection-border"
#define GIMP_HELP_SELECTION_FLOOD "gimp-selection-flood"
#define GIMP_HELP_SELECTION_STROKE "gimp-selection-stroke"
#define GIMP_HELP_SELECTION_TO_CHANNEL "gimp-selection-to-channel"
#define GIMP_HELP_SELECTION_TO_PATH "gimp-selection-to-path"
......
......@@ -243,6 +243,7 @@
<menuitem action="select-shrink" />
<menuitem action="select-grow" />
<menuitem action="select-border" />
<menuitem action="select-flood" />
</placeholder>
<separator />
<menuitem action="quick-mask-toggle" />
......
......@@ -15,6 +15,7 @@
<menuitem action="select-shrink" />
<menuitem action="select-grow" />
<menuitem action="select-border" />
<menuitem action="select-flood" />
</placeholder>
<separator />
<menuitem action="select-save" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment