anchor.diff:        (handle-repaint viewer (or (pane-viewport-region viewer)
                                    (sheet-region viewer))))))
   
  -(define-spectacle-command (com-zoom :name t)
  +(define-spectacle-command (com-fit-image-to-window :name t)
       ()
     (let ((viewer (find-pane-named *application-frame* 'spectacle-pane)))
  -    (let ((y-scale-slider (find-pane-named *application-frame* 'y-scale))
  -          (x-scale-slider (find-pane-named *application-frame* 'x-scale))
  -          (bounding-rectangle-height (bounding-rectangle-height viewer))
  -          (bounding-rectangle-width (bounding-rectangle-width viewer)))
  -      (with-accessors ((image image)
  -                       (transform-parameters transform-parameters)
  -                       (transform transform))
  -          viewer
  -        (when image
  -          (with-image-bounds (oldy oldx) image
  -            (let ((scale (apply #'min
  -                                (append (list (/ bounding-rectangle-height oldy))
  -                                        (list (/ bounding-rectangle-width oldx))))))
  -              (setf (gadget-value y-scale-slider) scale
  -                    (gadget-value x-scale-slider) scale)
  -              (setf (elt transform-parameters 0) scale
  -                    (elt transform-parameters 1) scale
  -                    transform nil))
  -            (change-space-requirements viewer :height oldy :width oldx))
  -          (handle-repaint viewer (or (pane-viewport-region viewer)
  -                                     (sheet-region viewer))))))))
  +    (when viewer
  +      (let ((y-scale-slider (find-pane-named *application-frame* 'y-scale))
  +            (x-scale-slider (find-pane-named *application-frame* 'x-scale))
  +            (pvr (pane-viewport-region viewer)))
  +        (let ((bounding-rectangle-height (bounding-rectangle-height pvr))
  +              (bounding-rectangle-width (bounding-rectangle-width pvr)))
  +          (with-accessors ((image image)
  +                           (transform-parameters transform-parameters)
  +                           (transform transform))
  +              viewer
  +            (when image
  +              (with-image-bounds (oldy oldx) image
  +                (let ((scale (apply #'min
  +                                    (append (list (/ bounding-rectangle-height oldy))
  +                                            (list (/ bounding-rectangle-width oldx))))))
  +                  (setf (gadget-value y-scale-slider) scale
  +                        (gadget-value x-scale-slider) scale)
  +                  (setf (elt transform-parameters 0) scale
  +                        (elt transform-parameters 1) scale
  +                        transform nil))
  +                (change-space-requirements viewer :height oldy :width oldx))
  +              (handle-repaint viewer (or (pane-viewport-region viewer)
  +                                         (sheet-region viewer))))))))))
   
   (define-spectacle-command (com-redraw :name t) ()
     (let ((viewer (find-pane-named *application-frame* 'spectacle-pane)))
  
positive.code:                :min-height 100))
    (:layouts
     (default (vertically (:height 250)
                (4/5 (horizontally ()
                       (4/5 viewer)
                       (1/5 (vertically ()
                              (labelling ()
                                (vertically ()
                                  lock-scale
  
negative.code: 
  (make-command-table 'image-command-table
  		    :errorp nil
  		    :menu '(("Fit Image to Window" :command com-fit-image-to-window)
                              ("Blur" :command com-blur)
                              ("Sharpen" :command com-sharpen)
                              ("Redraw" :command com-redraw)
  