;;; -*- Mode:LISP; Package:WINDOW-MAKER; Readtable:ZL; Base:8; Patch-File:T -*-
;;; Patch file for Window-Maker version 2.1
;;; Reason:
;;;  Considerable winow cleanups.
;;;  
;;;  1. Terminal Clear-Screen now redraws everything instead of a) doing nothing
;;;     or b) going into the cold load.
;;;  2. You can now kill the window maker from the System Menu.
;;;  
;;;  ...And other weather-proofing improvements.
;;; Written 20-Jul-88 23:22:30 by keith (Keith Corbett) at site Gigamos Cambridge
;;; while running on Breaking Glass from band 1
;;; with System 125.7, ZWEI 125.2, ZMail 73.0, Local-File 75.0, File-Server 24.0, Unix-Interface 13.0, Tape 24.0, Lambda-Diag 17.0, Experimental Window-Maker 2.0, Experimental Kermit 36.4, microcode 1761, SDU Boot Tape 3.14, SDU ROM 103, 7/19.


; From modified file DJ: L.WINDOW.WINDOW-MAKER; VARIABLES.LISP#26 at 20-Jul-88 23:23:39
#8R WINDOW-MAKER#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "WINDOW-MAKER")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: WINDOW; WINDOW-MAKER; VARIABLES  "

(defvar *latest-window-maker* nil)

))

; From modified file DJ: L.WINDOW.WINDOW-MAKER; NEW-WINDOW-MAKER.LISP#63 at 20-Jul-88 23:25:40
#8R WINDOW-MAKER#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "WINDOW-MAKER")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: WINDOW; WINDOW-MAKER; NEW-WINDOW-MAKER  "


(defmethod (graphic-window :REDISPLAY) ()
  (when (typep *frame* 'frame)
    (multiple-value-bind (list-of-panes-to-draw list-of-lines)
	(funcall *frame* :get-all-inferiors-and-lines)
      (funcall-self :clear-screen)
      (setq *mouse-sensitive-items-of-window* nil)
      (loop for pane in (cons *frame* list-of-panes-to-draw)
	    do
	    (update-list *mouse-sensitive-items-of-window* (funcall pane :set-mouse-region))
	    (multiple-value-bind (x y z s) (funcall pane :get-slots)
	      (draw-box x y z s)))
      (loop for line in list-of-lines
	    DO
	    (update-list *mouse-sensitive-items-of-window* (funcall line :set-mouse-region)))
      (funcall-self :update-typeout-list))))

))

; From modified file DJ: L.WINDOW.WINDOW-MAKER; NEW-WINDOW-MAKER.LISP#63 at 20-Jul-88 23:25:42
#8R WINDOW-MAKER#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "WINDOW-MAKER")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: WINDOW; WINDOW-MAKER; NEW-WINDOW-MAKER  "


(DEFFLAVOR WINDOW-MAKER-frame
	   ((*frame* nil))
	   (
	    tv:select-mixin
	    tv:inferiors-not-in-select-menu-mixin
	    tv:bordered-constraint-frame-with-shared-io-buffer
	    tv:window tv:process-mixin
	    )
  (:default-init-plist
    :label nil
    :save-bits T
    :panes
    '((title-pane tv:window
		  :label nil :blinker-p nil :save-bits t
		  :reverse-video-p t
		  :deexposed-typeout-action :permit)
      (menu-pane tv:command-menu :item-list ("menu"))
      (instrument-pane tv:window :label nil :blinker-p nil :save-bits t)
      (documentation-pane tv:window :label nil :blinker-p nil :save-bits t)
      (graphics-pane graphic-window :label nil :blinker-p nil
		     :save-bits t :deexposed-typeout-action :permit))
    :constraints
    '((main . ((title-and-instrument-and-menu-pane graphics-pane)
	       ((title-and-instrument-and-menu-pane :horizontal (0.1)
						    (title-pane instrument-pane menu-pane)
						    ((title-pane 65. :characters))
						    ((menu-pane .55))
						    ((instrument-pane :even))))
		((graphics-pane :even))))))

  :INITTABLE-INSTANCE-VARIABLES
  :GETTABLE-INSTANCE-VARIABLES
  :SETTABLE-INSTANCE-VARIABLES
  (:special-instance-variables *frame*))

))

; From modified file DJ: L.WINDOW.WINDOW-MAKER; NEW-WINDOW-MAKER.LISP#63 at 20-Jul-88 23:25:47
#8R WINDOW-MAKER#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "WINDOW-MAKER")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: WINDOW; WINDOW-MAKER; NEW-WINDOW-MAKER  "


(defvar wm-frame-title-font fonts:40vshd)

))

; From modified file DJ: L.WINDOW.WINDOW-MAKER; NEW-WINDOW-MAKER.LISP#63 at 20-Jul-88 23:25:48
#8R WINDOW-MAKER#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "WINDOW-MAKER")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: WINDOW; WINDOW-MAKER; NEW-WINDOW-MAKER  "


(defun draw-wm-title(pane)
  (funcall pane :clear-screen)
  (funcall pane
	   :string-out-centered-explicit
	   "WINDOW MAKER"
	   0 (// (funcall *title-pane* :height) 4)
	   (funcall pane :width) (funcall pane :height)
	   wm-frame-title-font tv:alu-andca))

))

; From modified file DJ: L.WINDOW.WINDOW-MAKER; NEW-WINDOW-MAKER.LISP#63 at 20-Jul-88 23:25:50
#8R WINDOW-MAKER#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "WINDOW-MAKER")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: WINDOW; WINDOW-MAKER; NEW-WINDOW-MAKER  "


(defmethod (window-maker-frame :after :refresh) (&optional type)
  (let* ((*window-maker* self)
	 (*menu-pane* (funcall self :get-pane 'menu-pane))
	 (*graphic-window-area* (funcall self :get-pane 'graphics-pane))
	 (*documentation-pane* (funcall self :get-pane 'documentation-pane))
	 (*instrument-pane* (funcall self :get-pane 'instrument-pane))
	 (*title-pane* (funcall self :get-pane 'title-pane)))
    (draw-wm-title *title-pane*)
    (funcall *graphic-window-area* :redisplay)
    (funcall *menu-pane* :set-item-list *item-list-for-permanent-menu*)
    (funcall *instrument-pane* :refresh type)
    t))

;;;Main loop

))

; From modified file DJ: L.WINDOW.WINDOW-MAKER; NEW-WINDOW-MAKER.LISP#63 at 20-Jul-88 23:26:08
#8R WINDOW-MAKER#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "WINDOW-MAKER")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: WINDOW; WINDOW-MAKER; NEW-WINDOW-MAKER  "


(defun window-editor ()
  (error-restart-loop
    ((sys:abort error) "aborting computation")
    (loop as blip = (funcall *documentation-pane* :list-tyi)
	  as object = (third blip)
	  do
	  (funcall *instrument-pane* :clear-screen)
	  (selectq (car blip)
	    (:menu
	     (eval (list (get (cadr blip) :funcall))))
	    (:typeout-execute
	     (selectq (second blip)
	       (:kill (funcall object ':kill))
	       (:vertical-split	(funcall object :slice :vertical))
	       (:help (tv:menu-choose help-message '(:string "WINDOWMAKER HELP" :font fonts:metsi :centered)))
	       (:horizontal-split (funcall object :slice :horizontal))
	       (:Insert-new-pane (funcall object :insert-new-pane))
	       (:drag ())))))))

))

; From modified file DJ: L.WINDOW.WINDOW-MAKER; NEW-WINDOW-MAKER.LISP#63 at 20-Jul-88 23:26:15
#8R WINDOW-MAKER#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "WINDOW-MAKER")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: WINDOW; WINDOW-MAKER; NEW-WINDOW-MAKER  "

(compile-flavor-methods window-maker-frame)

))
