--- E:\MyWorks\Frosty\frosty-logo-revision-25472.scm	2008-06-09 10:47:20.359375000 +0300
+++ E:\MyWorks\Frosty\frosty-logo-fix.scm	2008-02-26 21:39:36.745048700 +0200
@@ -1,6 +1,7 @@
 ;  FROZEN-TEXT effect
 ;  Thanks to Ed Mackey for this one
 ;   Written by Spencer Kimball
+;   Bug Fix update for GIMP 2.4 was made by LightningIsMyName (LIMN)
 
 (define (apply-frosty-logo-effect img
                                   logo-layer
@@ -10,8 +11,7 @@
         (border (/ size 5))
         (width (+ (car (gimp-drawable-width logo-layer)) border))
         (height (+ (car (gimp-drawable-height logo-layer)) border))
-        (logo-layer-mask (car (gimp-layer-create-mask logo-layer
-                                                      ADD-BLACK-MASK)))
+        (logo-layer-mask (car (gimp-layer-create-mask logo-layer ADD-BLACK-MASK)))
         (sparkle-layer (car (gimp-layer-new img width height RGBA-IMAGE
                                             "Sparkle" 100 NORMAL-MODE)))
         (matte-layer (car (gimp-layer-new img width height RGBA-IMAGE
@@ -27,7 +27,11 @@
 
     (gimp-layer-add-mask logo-layer logo-layer-mask)
     (script-fu-util-image-resize-from-layer img shadow-layer)
-    (script-fu-util-image-add-layers img sparkle-layer matte-layer shadow-layer bg-layer)
+    (gimp-image-add-layer img sparkle-layer 2)
+    (gimp-image-add-layer img matte-layer 3)
+    (gimp-image-add-layer img shadow-layer 4)
+    (gimp-image-add-layer img bg-layer 5)
+    ;(gimp-layer-translate logo-layer border border)
     (gimp-selection-none img)
     (gimp-edit-clear sparkle-layer)
     (gimp-edit-clear matte-layer)
@@ -56,6 +60,7 @@
     (gimp-edit-fill bg-layer BACKGROUND-FILL)
     (gimp-context-set-background '(0 0 0))
     (gimp-edit-fill logo-layer BACKGROUND-FILL)
+;    (gimp-layer-add-mask logo-layer logo-layer-mask)
     (gimp-selection-load selection)
     (gimp-context-set-background '(255 255 255))
     (gimp-edit-fill logo-layer-mask BACKGROUND-FILL)
@@ -74,6 +79,7 @@
     (for-each (lambda (the-layer)
               (gimp-layer-resize the-layer (- width border) (- height border)
                                            (- border) (- border))
+              ; (gimp-layer-translate the-layer border border)
               )
               (list sparkle-layer matte-layer bg-layer)
     )
@@ -94,48 +100,62 @@
                                      size
                                      bg-color)
 
-  (let* (
-        (position (- (car(gimp-image-get-layer-position img logo-layer)) 1))
-        (duplicate (car (gimp-layer-new-from-drawable logo-layer img)))
-        (name (car (gimp-layer-get-name logo-layer)))
-        (select (cons-array 4 'byte))
-        (crop 0)
-        (temp 0)
-        )
-
+(let* (
+	(duplicate 0)
+	(position 0)
+	(name(car(gimp-layer-get-name logo-layer)))
+	(crop 0)
+	(temp 0)
+	(select (cons-array 4 'byte))
+)
+    (begin
     (gimp-image-undo-group-start img)
 
+    ;Checking if the effect size is to big or not
+    (gimp-selection-layer-alpha logo-layer)
+    (gimp-selection-feather img (/ size 5))
+    (gimp-selection-sharpen img)
+
+    (if (= 1 (car(gimp-selection-is-empty img)))
+    (begin
+    (gimp-image-undo-group-end img)
+    (gimp-selection-none img)
+    (gimp-message "Your effect size is to big for the specified layer! Please reduce the effect size and try again!") ))
+
+    (if (= 0 (car(gimp-selection-is-empty img)))
+    (begin
+
+    (gimp-selection-none img)
+
+    (set! position (car(gimp-image-get-layer-position img logo-layer)))
+    (set! position (- position 1))
+
+    (set! duplicate (car(gimp-layer-new-from-drawable logo-layer img)))
     (gimp-selection-layer-alpha logo-layer)
     (gimp-image-add-layer img duplicate -1)
     (gimp-layer-resize-to-image-size duplicate)
     (gimp-selection-none img)
     (apply-frosty-logo-effect img duplicate size bg-color)
-    (set! crop (aref (cadr (gimp-image-get-layers img)) (+ position 6)))
-    (set! temp (aref (cadr (gimp-image-get-layers img)) (+ position 3)))
+    (set! crop (aref (cadr(gimp-image-get-layers img)) (+ position 6)))
+    (set! temp (aref (cadr(gimp-image-get-layers img)) (+ position 3)))
     (gimp-selection-layer-alpha temp)
-    (aset select 0 (cadr (gimp-selection-bounds img)))
-    (aset select 1 (caddr (gimp-selection-bounds img)))
-    (aset select 2 (cadddr (gimp-selection-bounds img)))
-    (aset select 3 (cadddr (cdr(gimp-selection-bounds img))))
-
-    (gimp-layer-resize crop
-           (+ 20 (- (aref select 2) (aref select 0)))
-           (+ 20 (- (aref select 3) (aref select 1)))
-           (- 0 (+ 0 (aref select 0)))
-           (- 0 (+ 0 (aref select 1))))
-    (gimp-layer-resize duplicate
-           (car (gimp-drawable-width logo-layer))
-           (car (gimp-drawable-height logo-layer))
-           (- 0 (car (gimp-drawable-offsets logo-layer)))
-           (- 0 (cadr (gimp-drawable-offsets logo-layer))))
+    (aset select 0 (cadr(gimp-selection-bounds img)))
+    (aset select 1 (caddr(gimp-selection-bounds img)))
+    (aset select 2 (cadddr(gimp-selection-bounds img)))
+    (aset select 3 (cadddr(cdr(gimp-selection-bounds img))))
+
+    (gimp-layer-resize crop (+ 20 (- (aref select 2) (aref select 0))) (+ 20 (- (aref select 3) (aref select 1))) (- 0 (+ 0 (aref select 0))) (- 0 (+ 0 (aref select 1))))
+    (gimp-layer-resize duplicate (car(gimp-drawable-width logo-layer)) (car(gimp-drawable-height logo-layer)) (- 0 (car(gimp-drawable-offsets logo-layer))) (- 0 (cadr(gimp-drawable-offsets logo-layer))))
     (gimp-image-remove-layer img logo-layer)
     (gimp-layer-set-name duplicate name)
-
     (gimp-selection-none img)
     (gimp-image-undo-group-end img)
     (gimp-displays-flush)
+
+    )) ;End of if and begin
   )
 )
+)
 
 (script-fu-register "script-fu-frosty-logo-alpha"
   _"_Frosty..."
@@ -184,4 +204,4 @@
 )
 
 (script-fu-menu-register "script-fu-frosty-logo"
-                         "<Image>/File/New/Logos")
+                         "<Toolbox>/Xtns/Logos")
