;;; -*- Mode:Lisp; Readtable:ZL; Package:USER; Base:8; Patch-File:T -*-
;;; Patch file for Kermit version 35.6
;;; Reason:
;;;  Interaction pane needs minimum 4 lines, including label, or window system goes nuts
;;;  one end-of-page exceptions.
;;; Reason:
;;;  Add Kermit command to switch window configurations.
;;; Written 19-Jul-88 01:24:02 by keith (Keith Corbett) at site Gigamos Cambridge
;;; while running on Breaking Glass from band 3
;;; with System 125.6, 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 Kermit 35.4, microcode 1761, SDU Boot Tape 3.14, SDU ROM 103.



; From modified file DJ: L.NETWORK.KERMIT; WINDOW.LISP#76 at 19-Jul-88 01:24:12
#8R KERMIT#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "KERMIT")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: NETWORK; KERMIT; WINDOW  "


(defvar kermit-window-configurations '(default long-terminal))

))

; From modified file DJ: L.NETWORK.KERMIT; WINDOW.LISP#76 at 19-Jul-88 01:24:39
#8R KERMIT#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "KERMIT")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: NETWORK; KERMIT; WINDOW  "


(defconst all-commands-requiring-kermit-serial-stream
	  '(make-connection close-connection
	    send-files receive-files send-files-to-server receive-files-from-server
	    finish-server server-bye
	    be-a-kermit-server-only be-a-server
	    set-baud-rate			;may have to add to this list if you add
						;to the one right below!
	    )
  "Commands that require kermit-SERIAL-STREAM to be bound to the apropriate open stream.")

))

; From modified file DJ: L.NETWORK.KERMIT; WINDOW.LISP#76 at 19-Jul-88 01:24:41
#8R KERMIT#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "KERMIT")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: NETWORK; KERMIT; WINDOW  "

			    
(defconst all-kermit-command-pane-items
      '(("Connect" :funcall make-connection
	 :documentation "Establish a virtual terminal or Kermit connection with remote host.")

	("Disconnect" :funcall close-connection
	   :documentation "Interrupt the connection made by Connect.")

	("Send files" :funcall send-files
	   :documentation "Send files to a remote Kermit.")

	("Receive files" :funcall receive-files
	   :documentation "Receive files from a remote Kermit.")

	("Server//send" :funcall send-files
	   :documentation "Send files to a remote Kermit (same as Send Files).")

	("Server//receive" :funcall receive-files-from-server
	   :documentation "Receive files from a remote Kermit that's in Server mode.")

	("Server//finish" :funcall finish-server
	   :documentation "Finish with Kermit that's in Server mode, not logging out.")

	("Server//bye" :funcall bye-server
	   :documentation "Finish and be logged out by remote Kermit that's in Server mode.")

	("Remote Login Server"
	 :funcall be-a-server
	 :documentation "Put Kermit in mode to process remote logins and file transfers.")

	("Remote Kermit Server"
	 :funcall be-a-kermit-server-only
	 :documentation "Put Kermit directly into Kermit SERVER mode (wait for Kermit commands).")

	("Serial Port" :funcall set-baud-rate
	   :documentation "Set parameters for serial port.")

;	("Restart Program" :funcall restart-program
;	   :documentation "Abandon everything  and start Kermit from scratch.")

	("Review Parameters" :funcall review-parameters
	   :documentation "Review, and maybe modify, global Kermit parameters.")


;	("Refresh Windows" :funcall refresh-windows
;	   :documentation "Refresh all the windows in this display.")

;	("List directory" :funcall list-user-directory
;	   :documentation "List the default directory in the interaction pane.")

	("Configuration" :funcall switch-configurations
	 :documentation "Toggle between window configurations.")

	("Help" :funcall kermit-interactive-help
	 :documentation "Interactive Help for Kermit.")


	))


;;;User interaction

))

; From modified file DJ: L.NETWORK.KERMIT; WINDOW.LISP#76 at 19-Jul-88 01:24:44
#8R KERMIT#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "KERMIT")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: NETWORK; KERMIT; WINDOW  "


(defun switch-configurations ()
  "Switch between Kermit frame configurations."
  (with-status ("Switching configurations")
    (let* ((current (send kermit-frame :configuration))
	   (new (first (remove current kermit-window-configurations))))
      (if new
	  (progn
	    (send kermit-frame :set-configuration new)
	    (send kermit-frame :refresh))
	(beep)))))

;;;Server interaction

))

; From modified file DJ: L.NETWORK.KERMIT; WINDOW.LISP#76 at 19-Jul-88 01:25:36
#8R KERMIT#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "KERMIT")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: NETWORK; KERMIT; WINDOW  "

(defconst all-kermit-command-pane-items
      '(("Connect" :funcall make-connection
	 :documentation "Establish a virtual terminal or Kermit connection with remote host.")

	("Disconnect" :funcall close-connection
	   :documentation "Interrupt the connection made by Connect.")

	("Send files" :funcall send-files
	   :documentation "Send files to a remote Kermit.")

	("Receive files" :funcall receive-files
	   :documentation "Receive files from a remote Kermit.")

	("Server//send" :funcall send-files
	   :documentation "Send files to a remote Kermit (same as Send Files).")

	("Server//receive" :funcall receive-files-from-server
	   :documentation "Receive files from a remote Kermit that's in Server mode.")

	("Server//finish" :funcall finish-server
	   :documentation "Finish with Kermit that's in Server mode, not logging out.")

	("Server//bye" :funcall bye-server
	   :documentation "Finish and be logged out by remote Kermit that's in Server mode.")

	("Remote Login Server"
	 :funcall be-a-server
	 :documentation "Put Kermit in mode to process remote logins and file transfers.")

	("Remote Kermit Server"
	 :funcall be-a-kermit-server-only
	 :documentation "Put Kermit directly into Kermit SERVER mode (wait for Kermit commands).")

	("Serial Port" :funcall set-baud-rate
	   :documentation "Set parameters for serial port.")

;	("Restart Program" :funcall restart-program
;	   :documentation "Abandon everything  and start Kermit from scratch.")

	("Review Parameters" :funcall review-parameters
	   :documentation "Review, and maybe modify, global Kermit parameters.")


;	("Refresh Windows" :funcall refresh-windows
;	   :documentation "Refresh all the windows in this display.")

;	("List directory" :funcall list-user-directory
;	   :documentation "List the default directory in the interaction pane.")

	("Size Window" :funcall switch-configurations
	 :documentation "Toggle between window configurations.")

	("Help" :funcall kermit-interactive-help
	 :documentation "Interactive Help for Kermit.")


	))

))

; From modified file DJ: L.NETWORK.KERMIT; WINDOW.LISP#77 at 19-Jul-88 01:36:22
#8R KERMIT#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "KERMIT")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: NETWORK; KERMIT; WINDOW  "

(defflavor kermit-frame
	   
	   ((kermit-ready-for-commands? nil)
	    (kermit-connected-flag nil)
	    (kermit-serial-stream nil)
	    (serial-stream-open-form *default-serial-stream-open-form*)
	    kstate kterm-state
	    )
	   
	   (tv:process-mixin
	    tv:select-mixin			; just to get :set-process handler!
	    tv:inferiors-not-in-select-menu-mixin
	    tv:alias-for-inferiors-mixin
	    tv:margin-choice-mixin tv:essential-mouse	;for asynchronous mouse cmds
	    tv:bordered-constraint-frame-with-shared-io-buffer)

  :SPECIAL-INSTANCE-VARIABLES
  :inittable-instance-variables
  :outside-accessible-instance-variables
  (:accessor-prefix "")
  
  (:documentation
    :special-purpose
    "kermit command and terminal frame for file transfer and remote terminal emulation")
  
  (:default-init-plist

    :margin-choices '((" Abort " nil async-abort 0 0)
		      (" Exit " nil async-exit 0 0)
		      (" Break " nil async-break 0 0)
		      (" Resume " nil async-resume 0 0))

    :borders 3					; 3 on frame + 3 on each pane
    
    :expose-p t					; expose w/o blink on instantiation
    :activate-p t				; activate on instantiation
    :save-bits :delayed			; make save bits array on deexposure
    :process '(run-kermit-process)
 
    :panes
    `((status-pane kermit-status-pane)
      (command-pane kermit-command-pane)
      (interaction-pane kermit-interaction-pane)
      (extra-pane kermit-status-pane)
      . ((terminal-pane kermit-terminal-pane)))
    
    ;;;Window configurations:
    :constraints

    '((default
	. ((top-strip terminal-pane interaction-pane)
	   ((top-strip
	      :horizontal (:ask-window command-pane :pane-size)
	      . ((status-pane command-pane)
		 ((command-pane :ask :pane-size))
		 ((status-pane :even)))))
	   ((terminal-pane 25. :lines))
	   ((interaction-pane :even))))
      (long-terminal
	. ((top-strip terminal-pane interaction-pane)
	   ((top-strip
	      :horizontal (:ask-window command-pane :pane-size)
	      . ((status-pane command-pane)
		 ((command-pane :ask :pane-size))
		 ((status-pane :even)))))
	   ((interaction-pane 4. :lines))
	   ((terminal-pane :even))
	   )))
    ))

))
