1998-06-28 18:39:58 +08:00
|
|
|
/* 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.
|
|
|
|
*/
|
2000-12-11 11:33:25 +08:00
|
|
|
|
2000-04-28 01:27:28 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
#include <glib-object.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "core-types.h"
|
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
#include "gimp.h"
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
#include "gimpchannel.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
#include "gimpimage.h"
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
#include "gimpimage-guides.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "gimpimage-mask.h"
|
2001-11-28 11:08:03 +08:00
|
|
|
#include "gimpimage-projection.h"
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
#include "gimpimage-resize.h"
|
2001-02-02 02:44:22 +08:00
|
|
|
#include "gimplayer.h"
|
2001-02-19 21:06:09 +08:00
|
|
|
#include "gimplist.h"
|
2001-07-05 03:31:35 +08:00
|
|
|
|
|
|
|
#include "floating_sel.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
#include "undo.h"
|
1998-06-28 18:39:58 +08:00
|
|
|
|
2000-12-29 00:19:55 +08:00
|
|
|
|
1998-06-28 18:39:58 +08:00
|
|
|
void
|
1999-07-10 02:15:39 +08:00
|
|
|
gimp_image_resize (GimpImage *gimage,
|
1999-08-22 19:45:31 +08:00
|
|
|
gint new_width,
|
|
|
|
gint new_height,
|
|
|
|
gint offset_x,
|
|
|
|
gint offset_y)
|
1998-06-28 18:39:58 +08:00
|
|
|
{
|
2001-01-29 10:45:02 +08:00
|
|
|
GimpChannel *channel;
|
|
|
|
GimpLayer *layer;
|
|
|
|
GimpLayer *floating_layer;
|
2001-02-19 21:06:09 +08:00
|
|
|
GList *list;
|
2001-01-29 10:45:02 +08:00
|
|
|
GList *guide_list;
|
1998-06-28 18:39:58 +08:00
|
|
|
|
2001-08-11 22:39:19 +08:00
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
|
|
|
g_return_if_fail (new_width > 0 && new_height > 0);
|
1999-01-11 07:36:29 +08:00
|
|
|
|
2001-08-11 22:39:19 +08:00
|
|
|
gimp_set_busy (gimage->gimp);
|
1998-06-28 18:39:58 +08:00
|
|
|
|
|
|
|
/* Get the floating layer if one exists */
|
|
|
|
floating_layer = gimp_image_floating_sel (gimage);
|
|
|
|
|
1999-10-14 07:07:45 +08:00
|
|
|
undo_push_group_start (gimage, IMAGE_RESIZE_UNDO);
|
1998-06-28 18:39:58 +08:00
|
|
|
|
|
|
|
/* Relax the floating selection */
|
|
|
|
if (floating_layer)
|
|
|
|
floating_sel_relax (floating_layer, TRUE);
|
|
|
|
|
|
|
|
/* Push the image size to the stack */
|
|
|
|
undo_push_gimage_mod (gimage);
|
|
|
|
|
|
|
|
/* Set the new width and height */
|
1999-08-22 19:45:31 +08:00
|
|
|
gimage->width = new_width;
|
1998-06-28 18:39:58 +08:00
|
|
|
gimage->height = new_height;
|
|
|
|
|
|
|
|
/* Resize all channels */
|
2001-02-19 21:06:09 +08:00
|
|
|
for (list = GIMP_LIST (gimage->channels)->list;
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
1998-06-28 18:39:58 +08:00
|
|
|
{
|
2001-01-29 10:45:02 +08:00
|
|
|
channel = (GimpChannel *) list->data;
|
1999-07-10 02:15:39 +08:00
|
|
|
|
2001-01-29 10:45:02 +08:00
|
|
|
gimp_channel_resize (channel, new_width, new_height, offset_x, offset_y);
|
1999-07-10 02:15:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Reposition or remove any guides */
|
|
|
|
guide_list = gimage->guides;
|
|
|
|
while (guide_list)
|
|
|
|
{
|
2001-05-16 03:10:57 +08:00
|
|
|
GimpGuide *guide;
|
1999-07-10 02:15:39 +08:00
|
|
|
|
2001-05-16 03:10:57 +08:00
|
|
|
guide = (GimpGuide *) guide_list->data;
|
1999-07-20 03:46:05 +08:00
|
|
|
guide_list = g_list_next (guide_list);
|
1999-07-10 02:15:39 +08:00
|
|
|
|
|
|
|
switch (guide->orientation)
|
|
|
|
{
|
1999-07-29 07:00:08 +08:00
|
|
|
case ORIENTATION_HORIZONTAL:
|
1999-10-14 07:07:45 +08:00
|
|
|
undo_push_guide (gimage, guide);
|
1999-07-10 02:15:39 +08:00
|
|
|
guide->position += offset_y;
|
|
|
|
if (guide->position < 0 || guide->position > new_height)
|
|
|
|
gimp_image_delete_guide (gimage, guide);
|
|
|
|
break;
|
2000-12-28 02:15:37 +08:00
|
|
|
|
1999-07-29 07:00:08 +08:00
|
|
|
case ORIENTATION_VERTICAL:
|
1999-10-14 07:07:45 +08:00
|
|
|
undo_push_guide (gimage, guide);
|
1999-07-10 02:15:39 +08:00
|
|
|
guide->position += offset_x;
|
|
|
|
if (guide->position < 0 || guide->position > new_width)
|
|
|
|
gimp_image_delete_guide (gimage, guide);
|
|
|
|
break;
|
2000-12-28 02:15:37 +08:00
|
|
|
|
1999-07-10 02:15:39 +08:00
|
|
|
default:
|
2000-12-28 02:15:37 +08:00
|
|
|
g_error ("Unknown guide orientation\n");
|
1999-07-10 02:15:39 +08:00
|
|
|
}
|
1998-06-28 18:39:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Don't forget the selection mask! */
|
2001-01-29 10:45:02 +08:00
|
|
|
gimp_channel_resize (gimage->selection_mask,
|
|
|
|
new_width, new_height, offset_x, offset_y);
|
1998-06-28 18:39:58 +08:00
|
|
|
gimage_mask_invalidate (gimage);
|
|
|
|
|
|
|
|
/* Reposition all layers */
|
2001-02-19 21:06:09 +08:00
|
|
|
for (list = GIMP_LIST (gimage->layers)->list;
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
1998-06-28 18:39:58 +08:00
|
|
|
{
|
2001-01-29 07:25:25 +08:00
|
|
|
layer = (GimpLayer *) list->data;
|
2000-12-28 02:15:37 +08:00
|
|
|
|
2001-01-29 07:25:25 +08:00
|
|
|
gimp_layer_translate (layer, offset_x, offset_y);
|
1998-06-28 18:39:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure the projection matches the gimage size */
|
2001-11-28 11:08:03 +08:00
|
|
|
gimp_image_projection_allocate (gimage);
|
1998-06-28 18:39:58 +08:00
|
|
|
|
|
|
|
/* Rigor the floating selection */
|
|
|
|
if (floating_layer)
|
|
|
|
floating_sel_rigor (floating_layer, TRUE);
|
|
|
|
|
2001-05-07 01:56:10 +08:00
|
|
|
undo_push_group_end (gimage);
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
gimp_viewable_size_changed (GIMP_VIEWABLE (gimage));
|
1999-01-11 07:36:29 +08:00
|
|
|
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
gimp_unset_busy (gimage->gimp);
|
1998-06-28 18:39:58 +08:00
|
|
|
}
|