mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-23 04:51:44 +00:00
02d2b990f5
2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
231 lines
7.2 KiB
C
231 lines
7.2 KiB
C
/* The GIMP -- an image manipulation program
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include <glib-object.h>
|
|
|
|
#include "core-types.h"
|
|
|
|
#include "gimpcontext.h"
|
|
#include "gimpimage.h"
|
|
#include "gimpitem.h"
|
|
#include "gimpitem-linked.h"
|
|
#include "gimplist.h"
|
|
#include "gimpprogress.h"
|
|
|
|
|
|
/* public functions */
|
|
|
|
void
|
|
gimp_item_linked_translate (GimpItem *item,
|
|
gint offset_x,
|
|
gint offset_y,
|
|
gboolean push_undo)
|
|
{
|
|
GimpImage *gimage;
|
|
GList *linked_list;
|
|
GList *list;
|
|
|
|
g_return_if_fail (GIMP_IS_ITEM (item));
|
|
g_return_if_fail (gimp_item_get_linked (item) == TRUE);
|
|
|
|
gimage = gimp_item_get_image (item);
|
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
|
|
|
linked_list = gimp_item_linked_get_list (gimage, item, GIMP_ITEM_LINKED_ALL);
|
|
|
|
for (list = linked_list; list; list = g_list_next (list))
|
|
gimp_item_translate (GIMP_ITEM (list->data),
|
|
offset_x, offset_y, push_undo);
|
|
|
|
g_list_free (linked_list);
|
|
}
|
|
|
|
void
|
|
gimp_item_linked_flip (GimpItem *item,
|
|
GimpContext *context,
|
|
GimpOrientationType flip_type,
|
|
gdouble axis,
|
|
gboolean clip_result)
|
|
{
|
|
GimpImage *gimage;
|
|
GList *linked_list;
|
|
GList *list;
|
|
|
|
g_return_if_fail (GIMP_IS_ITEM (item));
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
g_return_if_fail (gimp_item_get_linked (item) == TRUE);
|
|
|
|
gimage = gimp_item_get_image (item);
|
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
|
|
|
linked_list = gimp_item_linked_get_list (gimage, item, GIMP_ITEM_LINKED_ALL);
|
|
|
|
for (list = linked_list; list; list = g_list_next (list))
|
|
gimp_item_flip (GIMP_ITEM (list->data), context,
|
|
flip_type, axis, clip_result);
|
|
|
|
g_list_free (linked_list);
|
|
}
|
|
|
|
void
|
|
gimp_item_linked_rotate (GimpItem *item,
|
|
GimpContext *context,
|
|
GimpRotationType rotate_type,
|
|
gdouble center_x,
|
|
gdouble center_y,
|
|
gboolean clip_result)
|
|
{
|
|
GimpImage *gimage;
|
|
GList *linked_list;
|
|
GList *list;
|
|
|
|
g_return_if_fail (GIMP_IS_ITEM (item));
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
g_return_if_fail (gimp_item_get_linked (item) == TRUE);
|
|
|
|
gimage = gimp_item_get_image (item);
|
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
|
|
|
linked_list = gimp_item_linked_get_list (gimage, item,
|
|
GIMP_ITEM_LINKED_LAYERS |
|
|
GIMP_ITEM_LINKED_VECTORS);
|
|
|
|
for (list = linked_list; list; list = g_list_next (list))
|
|
gimp_item_rotate (GIMP_ITEM (list->data), context,
|
|
rotate_type, center_x, center_y, clip_result);
|
|
|
|
g_list_free (linked_list);
|
|
|
|
linked_list = gimp_item_linked_get_list (gimage, item,
|
|
GIMP_ITEM_LINKED_CHANNELS);
|
|
|
|
for (list = linked_list; list; list = g_list_next (list))
|
|
gimp_item_rotate (GIMP_ITEM (list->data), context,
|
|
rotate_type, center_x, center_y, TRUE);
|
|
|
|
g_list_free (linked_list);
|
|
}
|
|
|
|
void
|
|
gimp_item_linked_transform (GimpItem *item,
|
|
GimpContext *context,
|
|
const GimpMatrix3 *matrix,
|
|
GimpTransformDirection direction,
|
|
GimpInterpolationType interpolation_type,
|
|
gboolean supersample,
|
|
gint recursion_level,
|
|
gboolean clip_result,
|
|
GimpProgress *progress)
|
|
{
|
|
GimpImage *gimage;
|
|
GList *linked_list;
|
|
GList *list;
|
|
|
|
g_return_if_fail (GIMP_IS_ITEM (item));
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
g_return_if_fail (gimp_item_get_linked (item) == TRUE);
|
|
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
|
|
|
|
gimage = gimp_item_get_image (item);
|
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
|
|
|
linked_list = gimp_item_linked_get_list (gimage, item, GIMP_ITEM_LINKED_ALL);
|
|
|
|
for (list = linked_list; list; list = g_list_next (list))
|
|
gimp_item_transform (GIMP_ITEM (list->data), context,
|
|
matrix, direction,
|
|
interpolation_type,
|
|
supersample, recursion_level,
|
|
clip_result, progress);
|
|
|
|
g_list_free (linked_list);
|
|
}
|
|
|
|
/**
|
|
* gimp_item_linked_get_list:
|
|
* @gimage: The image @item is part of.
|
|
* @item: An @item to skip in the returned list.
|
|
* @which: Which items to return.
|
|
*
|
|
* This function returns a #GList og #GimpItem's for which the
|
|
* "linked" property is #TRUE. Note that the passed in @item
|
|
* must be linked too.
|
|
*
|
|
* Return value: The list of linked items, excluding the passed @item.
|
|
**/
|
|
GList *
|
|
gimp_item_linked_get_list (GimpImage *gimage,
|
|
GimpItem *item,
|
|
GimpItemLinkedMask which)
|
|
{
|
|
GimpItem *linked_item;
|
|
GList *list;
|
|
GList *linked_list = NULL;
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
g_return_val_if_fail (gimp_item_get_linked (item) == TRUE, NULL);
|
|
|
|
if (which & GIMP_ITEM_LINKED_LAYERS)
|
|
{
|
|
for (list = GIMP_LIST (gimage->layers)->list;
|
|
list;
|
|
list = g_list_next (list))
|
|
{
|
|
linked_item = (GimpItem *) list->data;
|
|
|
|
if (linked_item != item && gimp_item_get_linked (linked_item))
|
|
linked_list = g_list_prepend (linked_list, linked_item);
|
|
}
|
|
}
|
|
|
|
if (which & GIMP_ITEM_LINKED_CHANNELS)
|
|
{
|
|
for (list = GIMP_LIST (gimage->channels)->list;
|
|
list;
|
|
list = g_list_next (list))
|
|
{
|
|
linked_item = (GimpItem *) list->data;
|
|
|
|
if (linked_item != item && gimp_item_get_linked (linked_item))
|
|
linked_list = g_list_prepend (linked_list, linked_item);
|
|
}
|
|
}
|
|
|
|
if (which & GIMP_ITEM_LINKED_VECTORS)
|
|
{
|
|
for (list = GIMP_LIST (gimage->vectors)->list;
|
|
list;
|
|
list = g_list_next (list))
|
|
{
|
|
linked_item = (GimpItem *) list->data;
|
|
|
|
if (linked_item != item && gimp_item_get_linked (linked_item))
|
|
linked_list = g_list_prepend (linked_list, linked_item);
|
|
}
|
|
}
|
|
|
|
return g_list_reverse (linked_list);
|
|
}
|