; 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.


(define (script-fu-sg-float-layer image layer)
  (gimp-image-undo-group-start image)
  (gimp-selection-none image)
  (when (zero? (car (gimp-drawable-has-alpha layer)))
    (gimp-layer-add-alpha layer) )
  (let ((buffer (car (gimp-edit-named-copy layer "dynamic layer"))))
    (gimp-edit-clear layer)
    (gimp-edit-named-paste layer buffer FALSE)
    (gimp-buffer-delete buffer) )
  (gimp-image-undo-group-end image) )
  
  
(script-fu-register "script-fu-sg-float-layer"
 "Float Layer"
 "Float entire layer ignoring selection"
 "Saul Goode"
 "Saul Goode"
 "December 2014"
 "*"
 SF-IMAGE    "Image"    0
 SF-DRAWABLE "Drawable" 0
 )
 
(script-fu-menu-register "script-fu-sg-floatlayer"
 "<Image>/Layer"
 )

(script-fu-menu-register "script-fu-sg-float-layer"
 "<Layers>"
 )
