? autocrop-fixes.patch ? changes ? gradient-cache.patch ? quit-dialog-hacks.patch ? rectangle-stroke.patch ? resize-image-to-layers.patch ? app/gui/about-dialog.c-orig ? app/vectors/TODO ? app/vectors/gimprectanglestroke.c ? app/vectors/gimprectanglestroke.h Index: app/actions/image-actions.c =================================================================== RCS file: /cvs/gnome/gimp/app/actions/image-actions.c,v retrieving revision 1.12 diff -u -p -r1.12 image-actions.c --- app/actions/image-actions.c 21 Jul 2004 00:39:45 -0000 1.12 +++ app/actions/image-actions.c 4 Sep 2004 21:38:07 -0000 @@ -72,6 +72,11 @@ static GimpActionEntry image_actions[] = G_CALLBACK (image_resize_cmd_callback), GIMP_HELP_IMAGE_RESIZE }, + { "image-resize-to-layers", NULL, + N_("F_it Canvas to Layers"), NULL, NULL, + G_CALLBACK (image_resize_to_layers_cmd_callback), + GIMP_HELP_IMAGE_RESIZE_TO_LAYERS }, + { "image-scale", GIMP_STOCK_SCALE, N_("_Scale Image..."), NULL, NULL, G_CALLBACK (image_scale_cmd_callback), @@ -233,13 +238,14 @@ image_actions_update (GimpActionGroup *g SET_SENSITIVE ("image-rotate-180", gimage); SET_SENSITIVE ("image-rotate-270", gimage); - SET_SENSITIVE ("image-resize", gimage); - SET_SENSITIVE ("image-scale", gimage); - SET_SENSITIVE ("image-crop", gimage && sel); - SET_SENSITIVE ("image-duplicate", gimage); - SET_SENSITIVE ("image-merge-layers", gimage && !fs && !aux && lp); - SET_SENSITIVE ("image-flatten", gimage && !fs && !aux && lp); - SET_SENSITIVE ("image-configure-grid", gimage); + SET_SENSITIVE ("image-resize", gimage); + SET_SENSITIVE ("image-resize-to-layers", gimage); + SET_SENSITIVE ("image-scale", gimage); + SET_SENSITIVE ("image-crop", gimage && sel); + SET_SENSITIVE ("image-duplicate", gimage); + SET_SENSITIVE ("image-merge-layers", gimage && !fs && !aux && lp); + SET_SENSITIVE ("image-flatten", gimage && !fs && !aux && lp); + SET_SENSITIVE ("image-configure-grid", gimage); #undef SET_SENSITIVE } Index: app/actions/image-commands.c =================================================================== RCS file: /cvs/gnome/gimp/app/actions/image-commands.c,v retrieving revision 1.71 diff -u -p -r1.71 image-commands.c --- app/actions/image-commands.c 31 Aug 2004 22:41:14 -0000 1.71 +++ app/actions/image-commands.c 4 Sep 2004 21:38:07 -0000 @@ -218,6 +218,17 @@ image_resize_cmd_callback (GtkAction *ac } void +image_resize_to_layers_cmd_callback (GtkAction *action, + gpointer data) +{ + GimpImage *gimage; + return_if_no_image (gimage, data); + + gimp_image_resize_to_layers (gimage, action_data_get_context (data), NULL); + gimp_image_flush (gimage); +} + +void image_scale_cmd_callback (GtkAction *action, gpointer data) { Index: app/actions/image-commands.h =================================================================== RCS file: /cvs/gnome/gimp/app/actions/image-commands.h,v retrieving revision 1.12 diff -u -p -r1.12 image-commands.h --- app/actions/image-commands.h 10 Jun 2004 14:25:04 -0000 1.12 +++ app/actions/image-commands.h 4 Sep 2004 21:38:07 -0000 @@ -20,38 +20,40 @@ #define __IMAGE_COMMANDS_H__ -void image_new_cmd_callback (GtkAction *action, - gpointer data); -void image_new_from_image_cmd_callback (GtkAction *action, - gpointer data); - -void image_convert_cmd_callback (GtkAction *action, - gint value, - gpointer data); - -void image_resize_cmd_callback (GtkAction *action, - gpointer data); -void image_scale_cmd_callback (GtkAction *action, - gpointer data); -void image_flip_cmd_callback (GtkAction *action, - gint value, - gpointer data); -void image_rotate_cmd_callback (GtkAction *action, - gint value, - gpointer data); -void image_crop_cmd_callback (GtkAction *action, - gpointer data); - -void image_duplicate_cmd_callback (GtkAction *action, - gpointer data); - -void image_merge_layers_cmd_callback (GtkAction *action, - gpointer data); -void image_flatten_image_cmd_callback (GtkAction *action, - gpointer data); - -void image_configure_grid_cmd_callback (GtkAction *action, - gpointer data); +void image_new_cmd_callback (GtkAction *action, + gpointer data); +void image_new_from_image_cmd_callback (GtkAction *action, + gpointer data); + +void image_convert_cmd_callback (GtkAction *action, + gint value, + gpointer data); + +void image_resize_cmd_callback (GtkAction *action, + gpointer data); +void image_resize_to_layers_cmd_callback (GtkAction *action, + gpointer data); +void image_scale_cmd_callback (GtkAction *action, + gpointer data); +void image_flip_cmd_callback (GtkAction *action, + gint value, + gpointer data); +void image_rotate_cmd_callback (GtkAction *action, + gint value, + gpointer data); +void image_crop_cmd_callback (GtkAction *action, + gpointer data); + +void image_duplicate_cmd_callback (GtkAction *action, + gpointer data); + +void image_merge_layers_cmd_callback (GtkAction *action, + gpointer data); +void image_flatten_image_cmd_callback (GtkAction *action, + gpointer data); + +void image_configure_grid_cmd_callback (GtkAction *action, + gpointer data); #endif /* __IMAGE_COMMANDS_H__ */ Index: app/core/gimpimage-resize.c =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpimage-resize.c,v retrieving revision 1.231 diff -u -p -r1.231 gimpimage-resize.c --- app/core/gimpimage-resize.c 10 Aug 2004 18:46:35 -0000 1.231 +++ app/core/gimpimage-resize.c 4 Sep 2004 21:38:08 -0000 @@ -39,10 +39,10 @@ void gimp_image_resize (GimpImage *gimage, GimpContext *context, - gint new_width, - gint new_height, - gint offset_x, - gint offset_y, + gint new_width, + gint new_height, + gint offset_x, + gint offset_y, GimpProgress *progress) { GList *list; @@ -134,22 +134,22 @@ gimp_image_resize (GimpImage *gimage, list = g_list_next (list); switch (guide->orientation) - { - case GIMP_ORIENTATION_HORIZONTAL: + { + case GIMP_ORIENTATION_HORIZONTAL: new_position += offset_y; - if (new_position < 0 || new_position > new_height) + if (new_position < 0 || new_position > new_height) remove_guide = TRUE; - break; + break; - case GIMP_ORIENTATION_VERTICAL: + case GIMP_ORIENTATION_VERTICAL: new_position += offset_x; - if (new_position < 0 || new_position > new_width) + if (new_position < 0 || new_position > new_width) remove_guide = TRUE; - break; + break; - default: + default: break; - } + } if (remove_guide) gimp_image_remove_guide (gimage, guide, TRUE); @@ -164,3 +164,42 @@ gimp_image_resize (GimpImage *gimage, gimp_unset_busy (gimage->gimp); } + +void +gimp_image_resize_to_layers (GimpImage *gimage, + GimpContext *context, + GimpProgress *progress) +{ + gint min_x, max_x, min_y, max_y; + GList *list = GIMP_LIST (gimage->layers)->list; + GimpItem *item; + + if (!list) + return; + + /* figure out starting values */ + item = list->data; + min_x = item->offset_x; + min_y = item->offset_y; + max_x = item->offset_x + item->width; + max_y = item->offset_y + item->height; + + /* Respect all layers */ + for (list = g_list_next (list); + list; + list = g_list_next (list)) + { + item = list->data; + + min_x = MIN (min_x, item->offset_x); + min_y = MIN (min_y, item->offset_y); + max_x = MAX (max_x, item->offset_x + item->width); + max_y = MAX (max_y, item->offset_y + item->height); + } + + gimp_image_resize (gimage, context, + max_x - min_x, max_y - min_y, + - min_x, - min_y, + progress); +} + Index: app/core/gimpimage-resize.h =================================================================== RCS file: /cvs/gnome/gimp/app/core/gimpimage-resize.h,v retrieving revision 1.107 diff -u -p -r1.107 gimpimage-resize.h --- app/core/gimpimage-resize.h 10 Aug 2004 18:46:36 -0000 1.107 +++ app/core/gimpimage-resize.h 4 Sep 2004 21:38:08 -0000 @@ -20,13 +20,17 @@ #define __GIMP_IMAGE_RESIZE_H__ -void gimp_image_resize (GimpImage *gimage, - GimpContext *context, - gint new_width, - gint new_height, - gint offset_x, - gint offset_y, - GimpProgress *progress); +void gimp_image_resize (GimpImage *gimage, + GimpContext *context, + gint new_width, + gint new_height, + gint offset_x, + gint offset_y, + GimpProgress *progress); + +void gimp_image_resize_to_layers (GimpImage *gimage, + GimpContext *context, + GimpProgress *progress); #endif /* __GIMP_IMAGE_RESIZE_H__ */ Index: app/pdb/image_cmds.c =================================================================== RCS file: /cvs/gnome/gimp/app/pdb/image_cmds.c,v retrieving revision 1.90 diff -u -p -r1.90 image_cmds.c --- app/pdb/image_cmds.c 10 Aug 2004 18:46:37 -0000 1.90 +++ app/pdb/image_cmds.c 4 Sep 2004 21:38:09 -0000 @@ -60,6 +60,7 @@ static ProcRecord image_width_proc; static ProcRecord image_height_proc; static ProcRecord image_free_shadow_proc; static ProcRecord image_resize_proc; +static ProcRecord image_resize_to_layers_proc; static ProcRecord image_scale_proc; static ProcRecord image_crop_proc; static ProcRecord image_flip_proc; @@ -125,6 +126,7 @@ register_image_procs (Gimp *gimp) procedural_db_register (gimp, &image_height_proc); procedural_db_register (gimp, &image_free_shadow_proc); procedural_db_register (gimp, &image_resize_proc); + procedural_db_register (gimp, &image_resize_to_layers_proc); procedural_db_register (gimp, &image_scale_proc); procedural_db_register (gimp, &image_crop_proc); procedural_db_register (gimp, &image_flip_proc); @@ -738,6 +740,52 @@ static ProcRecord image_resize_proc = 0, NULL, { { image_resize_invoker } } +}; + +static Argument * +image_resize_to_layers_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) +{ + gboolean success = TRUE; + GimpImage *gimage; + + gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int); + if (! GIMP_IS_IMAGE (gimage)) + success = FALSE; + + if (success) + { + gimp_image_resize_to_layers (gimage, context, NULL); + } + + return procedural_db_return_args (&image_resize_to_layers_proc, success); +} + +static ProcArg image_resize_to_layers_inargs[] = +{ + { + GIMP_PDB_IMAGE, + "image", + "The image" + } +}; + +static ProcRecord image_resize_to_layers_proc = +{ + "gimp_image_resize_to_layers", + "Resize the image to fit all layers.", + "This procedure resizes the image so that it exactly fits all layers of the image. All channels within the image are resized to the new size; this includes the image selection mask. All layers within the image are repositioned to the new image area.", + "Simon Budig", + "Simon Budig", + "2004", + GIMP_INTERNAL, + 1, + image_resize_to_layers_inargs, + 0, + NULL, + { { image_resize_to_layers_invoker } } }; static Argument * Index: app/pdb/internal_procs.c =================================================================== RCS file: /cvs/gnome/gimp/app/pdb/internal_procs.c,v retrieving revision 1.51 diff -u -p -r1.51 internal_procs.c --- app/pdb/internal_procs.c 29 Aug 2004 18:36:29 -0000 1.51 +++ app/pdb/internal_procs.c 4 Sep 2004 21:38:09 -0000 @@ -70,7 +70,7 @@ void register_transform_tools_procs (Gim void register_undo_procs (Gimp *gimp); void register_unit_procs (Gimp *gimp); -/* 380 procedures registered total */ +/* 381 procedures registered total */ void internal_procs_init (Gimp *gimp, @@ -88,13 +88,13 @@ internal_procs_init (Gimp (* status_callback) (NULL, _("Channel"), 0.037); register_channel_procs (gimp); - (* status_callback) (NULL, _("Color"), 0.061); + (* status_callback) (NULL, _("Color"), 0.06); register_color_procs (gimp); - (* status_callback) (NULL, _("Convert"), 0.095); + (* status_callback) (NULL, _("Convert"), 0.094); register_convert_procs (gimp); - (* status_callback) (NULL, _("Display procedures"), 0.103); + (* status_callback) (NULL, _("Display procedures"), 0.102); register_display_procs (gimp); (* status_callback) (NULL, _("Drawable procedures"), 0.113); @@ -106,79 +106,79 @@ internal_procs_init (Gimp (* status_callback) (NULL, _("File Operations"), 0.218); register_fileops_procs (gimp); - (* status_callback) (NULL, _("Floating selections"), 0.242); + (* status_callback) (NULL, _("Floating selections"), 0.241); register_floating_sel_procs (gimp); - (* status_callback) (NULL, _("Font UI"), 0.258); + (* status_callback) (NULL, _("Font UI"), 0.257); register_font_select_procs (gimp); - (* status_callback) (NULL, _("Fonts"), 0.266); + (* status_callback) (NULL, _("Fonts"), 0.265); register_fonts_procs (gimp); - (* status_callback) (NULL, _("Gimprc procedures"), 0.271); + (* status_callback) (NULL, _("Gimprc procedures"), 0.27); register_gimprc_procs (gimp); - (* status_callback) (NULL, _("Gradient"), 0.287); + (* status_callback) (NULL, _("Gradient"), 0.286); register_gradient_edit_procs (gimp); - (* status_callback) (NULL, _("Gradient UI"), 0.347); + (* status_callback) (NULL, _("Gradient UI"), 0.346); register_gradient_select_procs (gimp); - (* status_callback) (NULL, _("Gradients"), 0.355); + (* status_callback) (NULL, _("Gradients"), 0.354); register_gradients_procs (gimp); - (* status_callback) (NULL, _("Guide procedures"), 0.384); + (* status_callback) (NULL, _("Guide procedures"), 0.383); register_guides_procs (gimp); - (* status_callback) (NULL, _("Help procedures"), 0.4); + (* status_callback) (NULL, _("Help procedures"), 0.399); register_help_procs (gimp); - (* status_callback) (NULL, _("Image"), 0.403); + (* status_callback) (NULL, _("Image"), 0.402); register_image_procs (gimp); - (* status_callback) (NULL, _("Layer"), 0.563); + (* status_callback) (NULL, _("Layer"), 0.564); register_layer_procs (gimp); - (* status_callback) (NULL, _("Message procedures"), 0.632); + (* status_callback) (NULL, _("Message procedures"), 0.633); register_message_procs (gimp); - (* status_callback) (NULL, _("Miscellaneous"), 0.639); + (* status_callback) (NULL, _("Miscellaneous"), 0.64); register_misc_procs (gimp); - (* status_callback) (NULL, _("Paint Tool procedures"), 0.645); + (* status_callback) (NULL, _("Paint Tool procedures"), 0.646); register_paint_tools_procs (gimp); - (* status_callback) (NULL, _("Palette"), 0.684); + (* status_callback) (NULL, _("Palette"), 0.685); register_palette_procs (gimp); - (* status_callback) (NULL, _("Palette UI"), 0.7); + (* status_callback) (NULL, _("Palette UI"), 0.701); register_palette_select_procs (gimp); - (* status_callback) (NULL, _("Palettes"), 0.708); + (* status_callback) (NULL, _("Palettes"), 0.709); register_palettes_procs (gimp); - (* status_callback) (NULL, _("Parasite procedures"), 0.721); + (* status_callback) (NULL, _("Parasite procedures"), 0.722); register_parasite_procs (gimp); (* status_callback) (NULL, _("Paths"), 0.753); register_paths_procs (gimp); - (* status_callback) (NULL, _("Pattern UI"), 0.792); + (* status_callback) (NULL, _("Pattern UI"), 0.793); register_pattern_select_procs (gimp); - (* status_callback) (NULL, _("Patterns"), 0.8); + (* status_callback) (NULL, _("Patterns"), 0.801); register_patterns_procs (gimp); - (* status_callback) (NULL, _("Plug-in"), 0.813); + (* status_callback) (NULL, _("Plug-in"), 0.814); register_plug_in_procs (gimp); - (* status_callback) (NULL, _("Procedural database"), 0.826); + (* status_callback) (NULL, _("Procedural database"), 0.827); register_procedural_db_procs (gimp); (* status_callback) (NULL, _("Progress"), 0.85); register_progress_procs (gimp); - (* status_callback) (NULL, _("Image mask"), 0.863); + (* status_callback) (NULL, _("Image mask"), 0.864); register_selection_procs (gimp); (* status_callback) (NULL, _("Selection Tool procedures"), 0.911); @@ -193,7 +193,7 @@ internal_procs_init (Gimp (* status_callback) (NULL, _("Undo"), 0.95); register_undo_procs (gimp); - (* status_callback) (NULL, _("Units"), 0.968); + (* status_callback) (NULL, _("Units"), 0.969); register_unit_procs (gimp); } Index: app/widgets/gimphelp-ids.h =================================================================== RCS file: /cvs/gnome/gimp/app/widgets/gimphelp-ids.h,v retrieving revision 1.41 diff -u -p -r1.41 gimphelp-ids.h --- app/widgets/gimphelp-ids.h 28 Aug 2004 10:57:24 -0000 1.41 +++ app/widgets/gimphelp-ids.h 4 Sep 2004 21:38:09 -0000 @@ -113,6 +113,7 @@ #define GIMP_HELP_IMAGE_ROTATE_180 "gimp-image-rotate-180" #define GIMP_HELP_IMAGE_ROTATE_270 "gimp-image-rotate-270" #define GIMP_HELP_IMAGE_RESIZE "gimp-image-resize" +#define GIMP_HELP_IMAGE_RESIZE_TO_LAYERS "gimp-image-resize-to-layers" #define GIMP_HELP_IMAGE_SCALE "gimp-image-scale" #define GIMP_HELP_IMAGE_SCALE_WARNING "gimp-image-scale-warning" #define GIMP_HELP_IMAGE_CROP "gimp-image-crop" Index: libgimp/gimpimage_pdb.c =================================================================== RCS file: /cvs/gnome/gimp/libgimp/gimpimage_pdb.c,v retrieving revision 1.64 diff -u -p -r1.64 gimpimage_pdb.c --- libgimp/gimpimage_pdb.c 28 Jul 2004 15:12:45 -0000 1.64 +++ libgimp/gimpimage_pdb.c 4 Sep 2004 21:38:11 -0000 @@ -343,6 +343,38 @@ gimp_image_resize (gint32 image_ID, } /** + * gimp_image_resize_to_layers: + * @image_ID: The image. + * + * Resize the image to fit all layers. + * + * This procedure resizes the image so that it exactly fits all layers + * of the image. All channels within the image are resized to the new + * size; this includes the image selection mask. All layers within the + * image are repositioned to the new image area. + * + * Returns: TRUE on success. + */ +gboolean +gimp_image_resize_to_layers (gint32 image_ID) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp_image_resize_to_layers", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + +/** * gimp_image_scale: * @image_ID: The image. * @new_width: New image width. Index: libgimp/gimpimage_pdb.h =================================================================== RCS file: /cvs/gnome/gimp/libgimp/gimpimage_pdb.h,v retrieving revision 1.21 diff -u -p -r1.21 gimpimage_pdb.h --- libgimp/gimpimage_pdb.h 5 Jan 2004 14:35:14 -0000 1.21 +++ libgimp/gimpimage_pdb.h 4 Sep 2004 21:38:11 -0000 @@ -44,6 +44,7 @@ gboolean gimp_image_resize gint new_height, gint offx, gint offy); +gboolean gimp_image_resize_to_layers (gint32 image_ID); gboolean gimp_image_scale (gint32 image_ID, gint new_width, gint new_height); Index: menus/image-menu.xml.in =================================================================== RCS file: /cvs/gnome/gimp/menus/image-menu.xml.in,v retrieving revision 1.20 diff -u -p -r1.20 image-menu.xml.in --- menus/image-menu.xml.in 5 Aug 2004 10:29:19 -0000 1.20 +++ menus/image-menu.xml.in 4 Sep 2004 21:38:11 -0000 @@ -267,6 +267,7 @@ + Index: tools/pdbgen/pdb/image.pdb =================================================================== RCS file: /cvs/gnome/gimp/tools/pdbgen/pdb/image.pdb,v retrieving revision 1.108 diff -u -p -r1.108 image.pdb --- tools/pdbgen/pdb/image.pdb 10 Aug 2004 18:46:38 -0000 1.108 +++ tools/pdbgen/pdb/image.pdb 4 Sep 2004 21:38:13 -0000 @@ -336,6 +336,31 @@ CODE ); } +sub image_resize_to_layers { + $blurb = 'Resize the image to fit all layers.'; + + $help = <<'HELP'; +This procedure resizes the image so that it exactly fits all layers of the +image. All channels within the image are resized to the new size; this includes +the image selection mask. All layers within the image are repositioned to the +new image area. +HELP + + $author = $copyright = 'Simon Budig'; + $date = '2004'; + + @inargs = ( &std_image_arg ); + + %invoke = ( + headers => [ qw("core/gimpimage-resize.h") ], + code => <<'CODE' +{ + gimp_image_resize_to_layers (gimage, context, NULL); +} +CODE + ); +} + sub image_scale { $blurb = 'Scale the image to the specified extents.'; @@ -1509,7 +1534,8 @@ unshift @procs, qw(image_list image_new image_base_type image_width image_height image_free_shadow - image_resize image_scale image_crop image_flip image_rotate + image_resize image_resize_to_layers image_scale + image_crop image_flip image_rotate image_get_layers image_get_channels image_get_active_drawable image_unset_active_channel @@ -1525,7 +1551,7 @@ unshift @procs, qw(image_list image_new image_get_cmap image_set_cmap image_clean_all image_is_dirty image_thumbnail); -%exports = (app => [@procs], lib => [@procs[0..33,36..60]]); +%exports = (app => [@procs], lib => [@procs[0..34,37..61]]); $desc = 'Image';