? crop-info.diff
? dos-eps.diff
? fileops.diff
? gap_decode_xanim.diff
? gauss.diff
? gimpressionist-size-description.patch
? gimptool
? gimptool-1.2-patch
? gimptool.1
? gradmap.diff
? imagemap.diff
? jpeg-cmyk.diff
? lut-diff
? paths-segfault.diff
? pdb.diff
? rcm.diff
? resize_scale.diff
? scan_convert.diff
? select.diff
? select2.diff
? smooth_palette.diff
? swap-path.diff
? xbm.diff
? zealous.diff
? app/scan_convert.diff
Index: app/commands.c
===================================================================
RCS file: /cvs/gnome/gimp/app/Attic/commands.c,v
retrieving revision 1.107.2.1
diff -u -p -r1.107.2.1 commands.c
--- app/commands.c	4 Mar 2001 15:33:06 -0000	1.107.2.1
+++ app/commands.c	12 Apr 2002 19:38:40 -0000
@@ -1317,28 +1317,21 @@ image_resize_callback (GtkWidget *widget
 
   gtk_widget_set_sensitive (image_resize->resize->resize_shell, FALSE);
 
-  if ((gimage = image_resize->gimage) != NULL)
+  if ((gimage = image_resize->gimage) != NULL &&
+      resize_check_image_size (image_resize))
     {
       if (image_resize->resize->width > 0 &&
 	  image_resize->resize->height > 0) 
 	{
-	  gimage_resize (gimage,
-			 image_resize->resize->width,
-			 image_resize->resize->height,
-			 image_resize->resize->offset_x,
-			 image_resize->resize->offset_y);
-	  gdisplays_flush ();
-	  lc_dialog_update_image_list ();
+          resize_resize_implement (image_resize);
+          gtk_widget_destroy (image_resize->resize->resize_shell);
 	}
       else 
 	{
 	  g_message (_("Resize Error: Both width and height must be "
 		       "greater than zero."));
-	  return;
 	}
     }
-
-  gtk_widget_destroy (image_resize->resize->resize_shell);
 }
 
 static void
@@ -1352,7 +1345,8 @@ image_scale_callback (GtkWidget *widget,
 
   gtk_widget_set_sensitive (image_scale->resize->resize_shell, FALSE);
 
-  if (resize_check_layer_scaling (image_scale))
+  if (resize_check_image_size (image_scale) &&
+      resize_check_layer_scaling (image_scale))
     {
       resize_scale_implement (image_scale);
       gtk_widget_destroy (image_scale->resize->resize_shell);
Index: app/resize.c
===================================================================
RCS file: /cvs/gnome/gimp/app/Attic/resize.c,v
retrieving revision 1.33.2.1
diff -u -p -r1.33.2.1 resize.c
--- app/resize.c	12 Feb 2002 16:17:44 -0000	1.33.2.1
+++ app/resize.c	12 Apr 2002 19:38:40 -0000
@@ -24,6 +24,7 @@
 
 #include "appenv.h"
 #include "gdisplay.h"
+#include "image_new.h"  /* image_new_get_size_string() */
 #include "resize.h"
 #include "undo.h"
 #include "gimprc.h"
@@ -1328,6 +1329,24 @@ resize_scale_implement (ImageResize *ima
     }
 }
 
+void
+resize_resize_implement (ImageResize *image_resize)
+{
+  GImage *gimage;
+
+  g_assert (image_resize != NULL);
+  gimage = image_resize->gimage;
+  g_assert (gimage != NULL);
+
+  gimage_resize (gimage,
+                 image_resize->resize->width,
+                 image_resize->resize->height,
+                 image_resize->resize->offset_x,
+                 image_resize->resize->offset_y);
+
+  gdisplays_flush ();
+}
+
 static void
 resize_scale_warn_callback (GtkWidget *widget,
 			    gboolean   do_scale,
@@ -1341,9 +1360,17 @@ resize_scale_warn_callback (GtkWidget *w
   gimage      = image_scale->gimage;
   g_assert (gimage != NULL);
 
-  if (do_scale == TRUE) /* User doesn't mind losing layers... */
+  if (do_scale == TRUE)
     {
-      resize_scale_implement (image_scale);
+      switch (image_scale->resize->type)
+        {
+          case ScaleWidget:
+            resize_scale_implement (image_scale);
+            break;
+          case ResizeWidget:
+            resize_resize_implement (image_scale);
+            break;
+        }
       gtk_widget_destroy (image_scale->resize->resize_shell);
     }
   else
@@ -1405,5 +1432,82 @@ resize_check_layer_scaling (ImageResize 
 	  gtk_widget_show (dialog);
 	}
     }
+
+  return success;
+}
+
+gboolean 
+resize_check_image_size (ImageResize *image_resize)
+{
+  gboolean   success = FALSE;
+  GImage    *gimage  = NULL;
+  GtkWidget *dialog  = NULL;
+
+  g_assert (image_resize != NULL);
+
+  if (NULL != (gimage = image_resize->gimage))
+    {
+      gdouble current_size, new_size;
+
+      /* this size calculation is just a stupid heuristic */
+
+      current_size = (gdouble) gimage->width * (gdouble) gimage->height;
+      new_size = ((gdouble) image_resize->resize->width * 
+                  (gdouble) image_resize->resize->height);
+
+      switch (gimp_image_base_type (gimage))
+        {
+        case RGB:
+        case INDEXED:
+          current_size *= 4.0;
+          new_size *= 4.0;
+          break;
+        case GRAY:
+          current_size *= 2.0;
+          new_size *= 2.0;
+          break;
+        }
+
+      if ((new_size <= 2.0 * current_size) || (new_size <= max_new_image_size))
+        success = TRUE;
+      
+      if (success == FALSE)
+        {
+          gchar *max_size = image_new_get_size_string (max_new_image_size);
+          gchar *text;
+  
+          /* xgettext:no-c-format */
+	    
+          text = g_strdup_printf (_("You are trying to scale or resize the\n"
+                                    "image to %d x %d pixels.\n\n"
+                                    "Choose OK to confirm this.\n"
+                                    "Choose Cancel if you didn't mean to\n"
+                                    "enter such large values.\n\n"
+                                    "To prevent this dialog from appearing,\n"
+                                    "increase the \"Maximum Image Size\"\n"
+                                    "setting (currently %s) in the\n"
+                                    "preferences dialog."),
+                                  image_resize->resize->width, 
+                                  image_resize->resize->height,
+                                  max_size);
+
+          dialog = gimp_query_boolean_box (_("Confirm Image Size"),
+                                           gimp_standard_help_func,
+                                           "dialogs/scale_image_warn.html",
+                                           FALSE,
+                                           text,
+                                           _("OK"), _("Cancel"),
+                                           GTK_OBJECT (image_resize->resize->resize_shell),
+                                           "destroy",
+                                           resize_scale_warn_callback,
+                                           image_resize);
+
+          g_free (text);
+          g_free (max_size);
+
+	  gtk_widget_show (dialog);
+	}
+    }
+
   return success;
 }
Index: app/resize.h
===================================================================
RCS file: /cvs/gnome/gimp/app/Attic/resize.h,v
retrieving revision 1.11
diff -u -p -r1.11 resize.h
--- app/resize.h	6 Apr 2000 02:13:17 -0000	1.11
+++ app/resize.h	12 Apr 2002 19:38:40 -0000
@@ -90,6 +90,8 @@ Resize * resize_widget_new    (ResizeTyp
 /* Layer scaling sanity check and warning dialogs */
 
 gboolean resize_check_layer_scaling (ImageResize *image_resize);
+gboolean resize_check_image_size    (ImageResize *image_resize);
 void     resize_scale_implement     (ImageResize *image_resize);
+void     resize_resize_implement    (ImageResize *image_resize);
 
 #endif  /*  __RESIZE_H__  */
