script-fu: in fuzzy-border, add undo support for the whole procedure

This commit is contained in:
Thomas Manni 2018-05-15 17:02:06 +02:00
parent 9c547e7d71
commit 316adffaae
1 changed files with 14 additions and 11 deletions

View File

@ -46,19 +46,21 @@
(let ( (let (
(theWidth (car (gimp-image-width inImage))) (theWidth (car (gimp-image-width inImage)))
(theHeight (car (gimp-image-height inImage))) (theHeight (car (gimp-image-height inImage)))
(theImage 0) (theImage (if (= inCopy TRUE) (car (gimp-image-duplicate inImage))
inImage))
(theLayer 0) (theLayer 0)
) )
(gimp-context-push) (gimp-context-push)
(gimp-context-set-defaults) (gimp-context-set-defaults)
(gimp-selection-all inImage) (if (= inCopy TRUE)
(set! theImage (if (= inCopy TRUE) (gimp-image-undo-disable theImage)
(car (gimp-image-duplicate inImage)) (gimp-image-undo-group-start theImage)
inImage
)
) )
(gimp-selection-all theImage)
(if (> (car (gimp-drawable-type inLayer)) 1) (if (> (car (gimp-drawable-type inLayer)) 1)
(gimp-image-convert-rgb theImage) (gimp-image-convert-rgb theImage)
) )
@ -97,7 +99,7 @@
(gimp-drawable-edit-clear theLayer) (gimp-drawable-edit-clear theLayer)
(gimp-context-set-background inColor) (gimp-context-set-background inColor)
(gimp-drawable-edit-fill theLayer FILL-BACKGROUND) (gimp-drawable-edit-fill theLayer FILL-BACKGROUND)
(gimp-selection-none inImage) (gimp-selection-none theImage)
(chris-color-edge theImage theLayer inColor 1) (chris-color-edge theImage theLayer inColor 1)
(if (= inBlur TRUE) (if (= inBlur TRUE)
@ -131,10 +133,11 @@
(gimp-image-flatten theImage) (gimp-image-flatten theImage)
) )
(if (= inCopy TRUE) (if (= inCopy TRUE)
(begin (begin (gimp-image-clean-all theImage)
(gimp-image-clean-all theImage) (gimp-display-new theImage)
(gimp-display-new theImage) (gimp-image-undo-enable theImage)
) )
(gimp-image-undo-group-end theImage)
) )
(gimp-displays-flush) (gimp-displays-flush)