mirror of https://github.com/GNOME/gimp.git
app, devel-docs, libgimp, pdb: get rid of gimp_item_linked_translate().
Similarly to the previous commit, we get rid of "item link" code for translating items.
This commit is contained in:
parent
26d696ce9d
commit
6f901dfe3e
|
@ -444,6 +444,18 @@ gimp_image_item_list_remove_children (GList *list,
|
|||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_image_item_list_filter:
|
||||
* @image:
|
||||
* @items: the original list of #GimpItem-s.
|
||||
*
|
||||
* Filter @list by modifying it directly (so the original list should
|
||||
* not be used anymore, only its result), removing all children items
|
||||
* with ancestors also in @list.
|
||||
*
|
||||
* Returns: the modified @list where all items which have an ancestor in
|
||||
* @list have been removed.
|
||||
*/
|
||||
GList *
|
||||
gimp_image_item_list_filter (GList *list)
|
||||
{
|
||||
|
|
|
@ -69,33 +69,6 @@ gimp_item_linked_is_locked (GimpItem *item)
|
|||
return locked;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_linked_translate (GimpItem *item,
|
||||
gint offset_x,
|
||||
gint offset_y,
|
||||
gboolean push_undo)
|
||||
{
|
||||
GimpImage *image;
|
||||
GList *items;
|
||||
|
||||
g_return_if_fail (GIMP_IS_ITEM (item));
|
||||
g_return_if_fail (gimp_item_get_linked (item) == TRUE);
|
||||
g_return_if_fail (gimp_item_is_attached (item));
|
||||
|
||||
image = gimp_item_get_image (item);
|
||||
|
||||
items = gimp_image_item_list_get_list (image,
|
||||
GIMP_ITEM_TYPE_ALL,
|
||||
GIMP_ITEM_SET_LINKED);
|
||||
|
||||
items = gimp_image_item_list_filter (items);
|
||||
|
||||
gimp_image_item_list_translate (gimp_item_get_image (item), items,
|
||||
offset_x, offset_y, push_undo);
|
||||
|
||||
g_list_free (items);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_linked_rotate (GimpItem *item,
|
||||
GimpContext *context,
|
||||
|
|
|
@ -21,10 +21,6 @@
|
|||
|
||||
gboolean gimp_item_linked_is_locked (GimpItem *item);
|
||||
|
||||
void gimp_item_linked_translate (GimpItem *item,
|
||||
gint offset_x,
|
||||
gint offset_y,
|
||||
gboolean push_undo);
|
||||
void gimp_item_linked_rotate (GimpItem *item,
|
||||
GimpContext *context,
|
||||
GimpRotationType rotate_type,
|
||||
|
|
|
@ -402,7 +402,6 @@ EXPORTS
|
|||
gimp_item_is_text_layer
|
||||
gimp_item_linked_rotate
|
||||
gimp_item_linked_transform
|
||||
gimp_item_linked_translate
|
||||
gimp_item_offsets
|
||||
gimp_item_rename
|
||||
gimp_item_resize
|
||||
|
|
|
@ -70,16 +70,7 @@ item_transform_translate_invoker (GimpProcedure *procedure,
|
|||
{
|
||||
if (gimp_pdb_item_is_modifiable (item,
|
||||
GIMP_PDB_ITEM_POSITION, error))
|
||||
{
|
||||
if (gimp_item_get_linked (item) && gimp_item_is_attached (item))
|
||||
{
|
||||
gimp_item_linked_translate (item, off_x, off_y, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_item_translate (item, off_x, off_y, TRUE);
|
||||
}
|
||||
}
|
||||
gimp_item_translate (item, off_x, off_y, TRUE);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -1024,9 +1015,7 @@ register_item_transform_procs (GimpPDB *pdb)
|
|||
"gimp-item-transform-translate");
|
||||
gimp_procedure_set_static_help (procedure,
|
||||
"Translate the item by the specified offsets.",
|
||||
"This procedure translates the item by the amounts specified in the off_x and off_y arguments. These can be negative, and are considered offsets from the current position. The offsets will be rounded to the nearest pixel unless the item is a path.\n"
|
||||
"\n"
|
||||
"If the item is attached to an image and has its linked flag set to TRUE, all additional items contained in the image which have the linked flag set to TRUE will also be translated by the specified offsets.",
|
||||
"This procedure translates the item by the amounts specified in the off_x and off_y arguments. These can be negative, and are considered offsets from the current position. The offsets will be rounded to the nearest pixel unless the item is a path.",
|
||||
NULL);
|
||||
gimp_procedure_set_static_attribution (procedure,
|
||||
"Michael Natterer <mitch@gimp.org>",
|
||||
|
|
|
@ -518,14 +518,7 @@ layer_set_offsets_invoker (GimpProcedure *procedure,
|
|||
offx -= offset_x;
|
||||
offy -= offset_y;
|
||||
|
||||
if (gimp_item_get_linked (GIMP_ITEM (layer)))
|
||||
{
|
||||
gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
|
||||
}
|
||||
gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "core/gimpimage-guides.h"
|
||||
#include "core/gimpimage-item-list.h"
|
||||
#include "core/gimpimage-undo.h"
|
||||
#include "core/gimpitem-linked.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplayermask.h"
|
||||
#include "core/gimpprojection.h"
|
||||
|
@ -329,7 +328,7 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
|
|||
case GIMP_TRANSLATE_MODE_CHANNEL:
|
||||
case GIMP_TRANSLATE_MODE_MASK:
|
||||
case GIMP_TRANSLATE_MODE_LAYER_MASK:
|
||||
edit_select->delayed_items = gimp_image_item_list_linked (image, selected_items);
|
||||
edit_select->delayed_items = gimp_image_item_list_filter (g_list_copy (selected_items));
|
||||
gimp_image_item_list_bounds (image, edit_select->delayed_items, &x, &y, &w, &h);
|
||||
x += off_x;
|
||||
y += off_y;
|
||||
|
@ -348,7 +347,7 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
|
|||
case GIMP_TRANSLATE_MODE_LAYER:
|
||||
case GIMP_TRANSLATE_MODE_FLOATING_SEL:
|
||||
case GIMP_TRANSLATE_MODE_VECTORS:
|
||||
edit_select->live_items = gimp_image_item_list_linked (image, selected_items);
|
||||
edit_select->live_items = gimp_image_item_list_filter (g_list_copy (selected_items));
|
||||
gimp_image_item_list_bounds (image, edit_select->live_items, &x, &y, &w, &h);
|
||||
break;
|
||||
}
|
||||
|
@ -710,7 +709,7 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
|
|||
GList *translate_items;
|
||||
gint x, y, w, h;
|
||||
|
||||
translate_items = gimp_image_item_list_linked (image, selected_items);
|
||||
translate_items = gimp_image_item_list_filter (g_list_copy (selected_items));
|
||||
gimp_image_item_list_bounds (image, translate_items, &x, &y, &w, &h);
|
||||
g_list_free (translate_items);
|
||||
|
||||
|
@ -1227,34 +1226,8 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
|
|||
}
|
||||
}
|
||||
|
||||
switch (edit_mode)
|
||||
{
|
||||
case GIMP_TRANSLATE_MODE_LAYER_MASK:
|
||||
case GIMP_TRANSLATE_MODE_MASK:
|
||||
for (iter = selected_items; iter; iter = iter->next)
|
||||
gimp_item_translate (iter->data, inc_x, inc_y, push_undo);
|
||||
break;
|
||||
|
||||
case GIMP_TRANSLATE_MODE_MASK_TO_LAYER:
|
||||
case GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER:
|
||||
/* this won't happen */
|
||||
break;
|
||||
|
||||
case GIMP_TRANSLATE_MODE_VECTORS:
|
||||
case GIMP_TRANSLATE_MODE_CHANNEL:
|
||||
case GIMP_TRANSLATE_MODE_LAYER:
|
||||
for (iter = selected_items; iter; iter = iter->next)
|
||||
if (gimp_item_get_linked (iter->data))
|
||||
gimp_item_linked_translate (iter->data, inc_x, inc_y, push_undo);
|
||||
else
|
||||
gimp_item_translate (iter->data, inc_x, inc_y, push_undo);
|
||||
break;
|
||||
|
||||
case GIMP_TRANSLATE_MODE_FLOATING_SEL:
|
||||
for (iter = selected_items; iter; iter = iter->next)
|
||||
gimp_item_translate (iter->data, inc_x, inc_y, push_undo);
|
||||
break;
|
||||
}
|
||||
gimp_image_item_list_translate (gimp_item_get_image (selected_items->data),
|
||||
selected_items, inc_x, inc_y, push_undo);
|
||||
|
||||
if (push_undo)
|
||||
gimp_image_undo_group_end (image);
|
||||
|
|
|
@ -11422,7 +11422,6 @@ gimp_item_toggle_exclusive_visible
|
|||
<SECTION>
|
||||
<FILE>gimpitem-linked</FILE>
|
||||
<TITLE>GimpItem-linked</TITLE>
|
||||
gimp_item_linked_translate
|
||||
gimp_item_linked_rotate
|
||||
gimp_item_linked_transform
|
||||
</SECTION>
|
||||
|
|
|
@ -47,11 +47,6 @@
|
|||
* offsets from the current position. The offsets will be rounded to
|
||||
* the nearest pixel unless the item is a path.
|
||||
*
|
||||
* If the item is attached to an image and has its linked flag set to
|
||||
* TRUE, all additional items contained in the image which have the
|
||||
* linked flag set to TRUE will also be translated by the specified
|
||||
* offsets.
|
||||
*
|
||||
* Returns: (transfer none): The translated item.
|
||||
*
|
||||
* Since: 2.10
|
||||
|
|
|
@ -118,12 +118,6 @@ This procedure translates the item by the amounts specified in the
|
|||
off_x and off_y arguments. These can be negative, and are considered
|
||||
offsets from the current position. The offsets will be rounded to the
|
||||
nearest pixel unless the item is a path.
|
||||
|
||||
|
||||
If the item is attached to an image and has its linked flag set to
|
||||
TRUE, all additional items contained in the image which have the
|
||||
linked flag set to TRUE will also be translated by the specified
|
||||
offsets.
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2018', '2.10');
|
||||
|
@ -147,16 +141,7 @@ HELP
|
|||
{
|
||||
if (gimp_pdb_item_is_modifiable (item,
|
||||
GIMP_PDB_ITEM_POSITION, error))
|
||||
{
|
||||
if (gimp_item_get_linked (item) && gimp_item_is_attached (item))
|
||||
{
|
||||
gimp_item_linked_translate (item, off_x, off_y, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_item_translate (item, off_x, off_y, TRUE);
|
||||
}
|
||||
}
|
||||
gimp_item_translate (item, off_x, off_y, TRUE);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
|
@ -678,14 +678,7 @@ HELP
|
|||
offx -= offset_x;
|
||||
offy -= offset_y;
|
||||
|
||||
if (gimp_item_get_linked (GIMP_ITEM (layer)))
|
||||
{
|
||||
gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
|
||||
}
|
||||
gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
|
Loading…
Reference in New Issue