mirror of https://github.com/GNOME/gimp.git
Issue #10153: introducing new floating data actions.
Though we mostly removed floating layers/masks (formerly floating selections) in many interactions, at least for default behaviors for basic pastes, there are still advanced usage attached to this concept and some advanced users are willing to have easier access to such items. For this reason, this commit: - adds edit-paste-float and edit-paste-float-in-place for pasting the contents of the clipboard as floating data with default positionning algorithm or in-place respectively; - renames select-float to select-cut-float which does a cut and paste as float in one action; - adds select-copy-float which does a copy and paste as float in one action; - reorganize a bit the `Edit > Paste as` submenu with sections for the floating data variants; - add a "Float" submenu in "Select" root menu, containing the 2 variant actions select-cut-float and select-copy-float.
This commit is contained in:
parent
f97e718e7a
commit
05b2f93876
|
@ -180,19 +180,31 @@ static const GimpEnumActionEntry edit_paste_actions[] =
|
|||
GIMP_HELP_EDIT_PASTE_IN_PLACE },
|
||||
|
||||
{ "edit-paste-into", GIMP_ICON_EDIT_PASTE_INTO,
|
||||
NC_("edit-action", "Paste _Into Selection"), NULL, { NULL },
|
||||
NC_("edit-action", "Paste as Floating Data _Into Selection"), NULL, { NULL },
|
||||
NC_("edit-action",
|
||||
"Paste the content of the clipboard into the current selection"),
|
||||
GIMP_PASTE_TYPE_FLOATING_INTO, FALSE,
|
||||
GIMP_HELP_EDIT_PASTE_INTO },
|
||||
|
||||
{ "edit-paste-into-in-place", GIMP_ICON_EDIT_PASTE_INTO,
|
||||
NC_("edit-action", "Paste Int_o Selection In Place"), NULL, { NULL },
|
||||
NC_("edit-action", "Paste as Floating Data Int_o Selection In Place"), NULL, { NULL },
|
||||
NC_("edit-action",
|
||||
"Paste the content of the clipboard into the current selection "
|
||||
"at its original position"),
|
||||
GIMP_PASTE_TYPE_FLOATING_INTO_IN_PLACE, FALSE,
|
||||
GIMP_HELP_EDIT_PASTE_INTO_IN_PLACE }
|
||||
GIMP_HELP_EDIT_PASTE_INTO_IN_PLACE },
|
||||
|
||||
{ "edit-paste-float", GIMP_ICON_EDIT_PASTE,
|
||||
NC_("edit-action", "Paste as _Floating Data"), NULL, { NULL },
|
||||
NC_("edit-action", "Paste the content of the clipboard as Floating Data"),
|
||||
GIMP_PASTE_TYPE_FLOATING, FALSE,
|
||||
GIMP_HELP_EDIT_PASTE },
|
||||
|
||||
{ "edit-paste-float-in-place", GIMP_ICON_EDIT_PASTE,
|
||||
NC_("edit-action", "Paste as Floa_ting Data In Place"), NULL, { NULL },
|
||||
NC_("edit-action", "Paste the content of the clipboard as Floating Data at its original position"),
|
||||
GIMP_PASTE_TYPE_FLOATING_IN_PLACE, FALSE,
|
||||
GIMP_HELP_EDIT_PASTE }
|
||||
};
|
||||
|
||||
static const GimpEnumActionEntry edit_fill_actions[] =
|
||||
|
|
|
@ -58,10 +58,16 @@ static const GimpActionEntry select_actions[] =
|
|||
select_invert_cmd_callback,
|
||||
GIMP_HELP_SELECTION_INVERT },
|
||||
|
||||
{ "select-float", GIMP_ICON_LAYER_FLOATING_SELECTION,
|
||||
NC_("select-action", "_Float"), NULL, { "<primary><shift>L", NULL },
|
||||
NC_("select-action", "Create a floating selection"),
|
||||
select_float_cmd_callback,
|
||||
{ "select-cut-float", GIMP_ICON_LAYER_FLOATING_SELECTION,
|
||||
NC_("select-action", "Cu_t and Float"), NULL, { "<primary><shift>L", NULL },
|
||||
NC_("select-action", "Cut the selection directly into a floating selection"),
|
||||
select_cut_float_cmd_callback,
|
||||
GIMP_HELP_SELECTION_FLOAT },
|
||||
|
||||
{ "select-copy-float", GIMP_ICON_LAYER_FLOATING_SELECTION,
|
||||
NC_("select-action", "_Copy and Float"), NULL, { NULL },
|
||||
NC_("select-action", "Copy the selection directly into a floating selection"),
|
||||
select_copy_float_cmd_callback,
|
||||
GIMP_HELP_SELECTION_FLOAT },
|
||||
|
||||
{ "select-feather", NULL,
|
||||
|
@ -182,9 +188,13 @@ select_actions_update (GimpActionGroup *group,
|
|||
SET_SENSITIVE ("select-all", image && ! sel_all);
|
||||
SET_SENSITIVE ("select-none", image && sel);
|
||||
SET_SENSITIVE ("select-invert", image);
|
||||
SET_SENSITIVE ("select-float", g_list_length (drawables) == 1 && sel &&
|
||||
! gimp_item_is_content_locked (drawables->data, NULL) &&
|
||||
! gimp_viewable_get_children (drawables->data));
|
||||
|
||||
SET_SENSITIVE ("select-cut-float", g_list_length (drawables) == 1 && sel &&
|
||||
! gimp_item_is_content_locked (drawables->data, NULL) &&
|
||||
! gimp_viewable_get_children (drawables->data));
|
||||
SET_SENSITIVE ("select-copy-float", g_list_length (drawables) == 1 && sel &&
|
||||
! gimp_item_is_content_locked (drawables->data, NULL) &&
|
||||
! gimp_viewable_get_children (drawables->data));
|
||||
|
||||
SET_SENSITIVE ("select-feather", image && sel);
|
||||
SET_SENSITIVE ("select-sharpen", image && sel);
|
||||
|
|
|
@ -67,6 +67,10 @@ static void select_shrink_callback (GtkWidget *widget,
|
|||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data);
|
||||
static void select_float (GimpAction *action,
|
||||
GVariant *value,
|
||||
gboolean cut,
|
||||
gpointer data);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
@ -108,33 +112,19 @@ select_invert_cmd_callback (GimpAction *action,
|
|||
}
|
||||
|
||||
void
|
||||
select_float_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
select_cut_float_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GtkWidget *widget;
|
||||
GList *drawables;
|
||||
GError *error = NULL;
|
||||
return_if_no_image (image, data);
|
||||
return_if_no_widget (widget, data);
|
||||
select_float (action, value, TRUE, data);
|
||||
}
|
||||
|
||||
drawables = gimp_image_get_selected_drawables (image);
|
||||
if (gimp_selection_float (GIMP_SELECTION (gimp_image_get_mask (image)),
|
||||
drawables,
|
||||
action_data_get_context (data),
|
||||
TRUE, 0, 0, &error))
|
||||
{
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_message_literal (image->gimp,
|
||||
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
g_list_free (drawables);
|
||||
void
|
||||
select_copy_float_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data)
|
||||
{
|
||||
select_float (action, value, FALSE, data);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -692,3 +682,34 @@ select_shrink_callback (GtkWidget *widget,
|
|||
TRUE);
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
static void
|
||||
select_float (GimpAction *action,
|
||||
GVariant *value,
|
||||
gboolean cut,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GtkWidget *widget;
|
||||
GList *drawables;
|
||||
GError *error = NULL;
|
||||
return_if_no_image (image, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
drawables = gimp_image_get_selected_drawables (image);
|
||||
if (gimp_selection_float (GIMP_SELECTION (gimp_image_get_mask (image)),
|
||||
drawables,
|
||||
action_data_get_context (data),
|
||||
cut, 0, 0, &error))
|
||||
{
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_message_literal (image->gimp,
|
||||
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
g_list_free (drawables);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,10 @@ void select_none_cmd_callback (GimpAction *action,
|
|||
void select_invert_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void select_float_cmd_callback (GimpAction *action,
|
||||
void select_cut_float_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void select_copy_float_cmd_callback (GimpAction *action,
|
||||
GVariant *value,
|
||||
gpointer data);
|
||||
void select_feather_cmd_callback (GimpAction *action,
|
||||
|
|
|
@ -90,10 +90,16 @@
|
|||
<item><attribute name="action">app.edit-paste-in-place</attribute></item>
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes" context="edit-action">Paste _as</attribute>
|
||||
<item><attribute name="action">app.edit-paste-merged</attribute></item>
|
||||
<item><attribute name="action">app.edit-paste-merged-in-place</attribute></item>
|
||||
<item><attribute name="action">app.edit-paste-into</attribute></item>
|
||||
<item><attribute name="action">app.edit-paste-into-in-place</attribute></item>
|
||||
<section>
|
||||
<item><attribute name="action">app.edit-paste-merged</attribute></item>
|
||||
<item><attribute name="action">app.edit-paste-merged-in-place</attribute></item>
|
||||
</section>
|
||||
<section>
|
||||
<item><attribute name="action">app.edit-paste-float</attribute></item>
|
||||
<item><attribute name="action">app.edit-paste-float-in-place</attribute></item>
|
||||
<item><attribute name="action">app.edit-paste-into</attribute></item>
|
||||
<item><attribute name="action">app.edit-paste-into-in-place</attribute></item>
|
||||
</section>
|
||||
<item><attribute name="action">app.edit-paste-as-new-image</attribute><attribute name="label-variant">long</attribute></item>
|
||||
</submenu>
|
||||
<submenu>
|
||||
|
@ -143,7 +149,11 @@
|
|||
<item><attribute name="action">app.select-all</attribute></item>
|
||||
<item><attribute name="action">app.select-none</attribute></item>
|
||||
<item><attribute name="action">app.select-invert</attribute></item>
|
||||
<item><attribute name="action">app.select-float</attribute></item>
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes" context="view-action">_Float</attribute>
|
||||
<item><attribute name="action">app.select-cut-float</attribute></item>
|
||||
<item><attribute name="action">app.select-copy-float</attribute></item>
|
||||
</submenu>
|
||||
<item><attribute name="action">app.tools-by-color-select-short</attribute></item>
|
||||
<item><attribute name="action">app.vectors-selection-from-vectors</attribute></item>
|
||||
<item><attribute name="action">app.dialogs-selection-editor</attribute></item>
|
||||
|
|
|
@ -10,7 +10,10 @@
|
|||
<item><attribute name="action">app.select-none</attribute></item>
|
||||
<item><attribute name="action">app.select-invert</attribute></item>
|
||||
<item><attribute name="action">app.vectors-selection-from-vectors</attribute></item>
|
||||
<item><attribute name="action">app.select-float</attribute></item>
|
||||
<section>
|
||||
<item><attribute name="action">app.select-cut-float</attribute></item>
|
||||
<item><attribute name="action">app.select-copy-float</attribute></item>
|
||||
</section>
|
||||
<section>
|
||||
<item><attribute name="action">app.select-feather</attribute></item>
|
||||
<item><attribute name="action">app.select-sharpen</attribute></item>
|
||||
|
|
Loading…
Reference in New Issue