(FILECREATED "12-Nov-85 19:52:20" {ERIS}<LISPCORE>LIBRARY>KERMITMENU.;12 10999  

      changes to:  (VARS KERMITMENUCOMS)
		   (FNS KERMIT.MENU.OPEN)

      previous date: " 7-Oct-85 09:52:33" {ERIS}<LISPCORE>LIBRARY>KERMITMENU.;10)


(* Copyright (c) 1985 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT KERMITMENUCOMS)

(RPAQQ KERMITMENUCOMS ((COMS (* Interactive menu facility for Kermit)
			       (INITVARS (KERMIT.FMENU.SPEC (QUOTE (((TYPE MOMENTARY LABEL "Send!" 
									   FONT (MODERN 10 BOLD)
									   MESSAGE 
					   "Sends the specified local file to be stored remotely"
									   SELECTEDFN 
									   KERMIT.MENU.STORE)
								     (TYPE MOMENTARY LABEL "Receive!" 
									   FONT (MODERN 10 BOLD)
									   MESSAGE 
					   "Receives a remote file into the specified local file"
									   SELECTEDFN 
									   KERMIT.MENU.RETRIEVE)
								     (TYPE MOMENTARY LABEL "Bye!" 
									   FONT (MODERN 10 BOLD)
									   MESSAGE 
							    "Forces remote Kermit server to exit"
									   SELECTEDFN KERMIT.MENU.BYE)
								     (TYPE MOMENTARY LABEL "Exit!" 
									   FONT (MODERN 10 BOLD)
									   MESSAGE "Closes this menu" 
									   SELECTEDFN 
									   KERMIT.MENU.EXIT))
								    ((TYPE TITLE LABEL 
									   "Transfer mode: "
									   FONT
									   (MODERN 10 BOLD))
								     (TYPE NWAY ID MODE LABEL Kermit 
									   FONT (MODERN 10))
								     (TYPE NWAY ID MODE LABEL Modem 
									   FONT (MODERN 10)))
								    ((TYPE EDITSTART LABEL 
									   "Local file: "
									   FONT
									   (MODERN 10 BOLD)
									   ITEMS
									   (LOCALFILE))
								     (TYPE EDIT ID LOCALFILE LABEL "" 
									   FONT (MODERN 10)))
								    ((TYPE EDITSTART LABEL 
									   "Remote file: "
									   FONT
									   (MODERN 10 BOLD)
									   ITEMS
									   (REMOTEFILE))
								     (TYPE EDIT LABEL "" ID 
									   REMOTEFILE FONT
									   (MODERN 10)))
								    ((TYPE NCHOOSE LABEL 
									   "File type: "
									   ID FILETYPE FONT
									   (MODERN 10 BOLD)
									   ITEMS
									   (Binary Text)
									   ITEMFONT
									   (MODERN 10)
									   STATE Text)
								     (TYPE NCHOOSE LABEL 
								       "End-of-line Convention: "
									   ID EOLCONVENTION FONT
									   (MODERN 10 BOLD)
									   ITEMS
									   (CR LF CRLF)
									   ITEMFONT
									   (MODERN 10)
									   STATE CRLF))
								    (WINDOWPROPS TITLE 
									  "Kermit/Modem settings")))))
			       (GLOBALVARS KERMIT.FMENU.SPEC)
			       (FNS KERMIT.MENU.ABORT KERMIT.MENU.BYE KERMIT.MENU.EXIT 
				    KERMIT.MENU.OPEN KERMIT.MENU.RETRIEVE KERMIT.MENU.STORE)
			       (FILES (SYSLOAD FROM VALUEOF LISPUSERSDIRECTORIES)
				      FREEMENU KERMIT)
			       (P (COND ((NOT (FASSOC (QUOTE Kermit)
						      CHATMENUITEMS))
					 (push CHATMENUITEMS (QUOTE (Kermit (FUNCTION 
										 KERMIT.MENU.OPEN)
									    
								    "Opens a kermit command menu")))
					 (SETQ CHATMENU NIL)))
				  (COND ((AND (BOUNDP (QUOTE TEDITCHAT.MENUITEMS))
					      (NOT (FASSOC (QUOTE Kermit)
							   TEDITCHAT.MENUITEMS)))
					 (push TEDITCHAT.MENUITEMS
					       (QUOTE (Kermit (FUNCTION KERMIT.MENU.OPEN)
							      "Opens a kermit command menu")))
					 (SETQ TEDITCHAT.MENU NIL)))))))



(* Interactive menu facility for Kermit)


(RPAQ? KERMIT.FMENU.SPEC (QUOTE (((TYPE MOMENTARY LABEL "Send!" FONT (MODERN 10 BOLD)
					  MESSAGE 
					  "Sends the specified local file to be stored remotely"
					  SELECTEDFN KERMIT.MENU.STORE)
				    (TYPE MOMENTARY LABEL "Receive!" FONT (MODERN 10 BOLD)
					  MESSAGE 
					  "Receives a remote file into the specified local file"
					  SELECTEDFN KERMIT.MENU.RETRIEVE)
				    (TYPE MOMENTARY LABEL "Bye!" FONT (MODERN 10 BOLD)
					  MESSAGE "Forces remote Kermit server to exit" SELECTEDFN 
					  KERMIT.MENU.BYE)
				    (TYPE MOMENTARY LABEL "Exit!" FONT (MODERN 10 BOLD)
					  MESSAGE "Closes this menu" SELECTEDFN KERMIT.MENU.EXIT))
				   ((TYPE TITLE LABEL "Transfer mode: " FONT (MODERN 10 BOLD))
				    (TYPE NWAY ID MODE LABEL Kermit FONT (MODERN 10))
				    (TYPE NWAY ID MODE LABEL Modem FONT (MODERN 10)))
				   ((TYPE EDITSTART LABEL "Local file: " FONT (MODERN 10 BOLD)
					  ITEMS
					  (LOCALFILE))
				    (TYPE EDIT ID LOCALFILE LABEL "" FONT (MODERN 10)))
				   ((TYPE EDITSTART LABEL "Remote file: " FONT (MODERN 10 BOLD)
					  ITEMS
					  (REMOTEFILE))
				    (TYPE EDIT LABEL "" ID REMOTEFILE FONT (MODERN 10)))
				   ((TYPE NCHOOSE LABEL "File type: " ID FILETYPE FONT
					  (MODERN 10 BOLD)
					  ITEMS
					  (Binary Text)
					  ITEMFONT
					  (MODERN 10)
					  STATE Text)
				    (TYPE NCHOOSE LABEL "End-of-line Convention: " ID EOLCONVENTION 
					  FONT (MODERN 10 BOLD)
					  ITEMS
					  (CR LF CRLF)
					  ITEMFONT
					  (MODERN 10)
					  STATE CRLF))
				   (WINDOWPROPS TITLE "Kermit/Modem settings"))))
(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS KERMIT.FMENU.SPEC)
)
(DEFINEQ

(KERMIT.MENU.ABORT
  (LAMBDA (BUTTON WINDOW ITEM)                               (* ejs: " 7-Oct-85 09:42")

          (* * Called to kill the active Kermit/Modem process)


    (LET ((PROC (WINDOWPROP (MAINWINDOW WINDOW)
				(QUOTE KERMITPROC))))
           (COND
	     ((AND (PROCESSP PROC)
		     (NOT (RELPROCESSP PROC))
		     (MOUSECONFIRM "Are you sure?"))
	       (PROCESS.EVAL PROC (QUOTE (ERROR!))))))))

(KERMIT.MENU.BYE
  (LAMBDA (ITEM WINDOW BUTTON)                               (* ejs: " 4-Oct-85 18:48")
    (LET ((STATE (FM.READSTATE WINDOW)))
         (SELECTQ (LISTGET STATE (QUOTE MODE))
		    (Kermit (KERMIT.SERVER.COMMAND KERMIT.GENERIC.SERVER.COMMAND (QUOTE F)
						     (MAINWINDOW WINDOW)))
		    (Modem (printout (GETPROMPTWINDOW (MAINWINDOW WINDOW))
				     T "This command only works in Kermit mode."))
		    (printout (GETPROMPTWINDOW (MAINWINDOW WINDOW))
			      T "Please choose either Kermit or Modem mode ")))))

(KERMIT.MENU.EXIT
  (LAMBDA (ITEM WINDOW BUTTON)                               (* ejs: "15-Sep-85 18:39")
    (REMOVEWINDOW WINDOW)
    (CLOSEW WINDOW)))

(KERMIT.MENU.OPEN
  (LAMBDA (CHAT.STATE)                                       (* ejs: "12-Nov-85 19:06")
    (LET* ((MAINWINDOW (fetch (CHAT.STATE WINDOW) of CHAT.STATE))
	   (FMENU (FM.FORMATMENU KERMIT.FMENU.SPEC))
	   (REGION (WINDOWPROP FMENU (QUOTE REGION))))
          (WINDOWPROP FMENU (QUOTE PROMPTWINDOW)
			(GETPROMPTWINDOW MAINWINDOW))
          (WINDOWPROP FMENU (QUOTE MINSIZE)
			(CONS (fetch (REGION WIDTH) of REGION)
				(fetch (REGION HEIGHT) of REGION)))
          (WINDOWPROP FMENU (QUOTE MAXSIZE)
			(CONS NIL (fetch (REGION HEIGHT) of REGION)))
          (ATTACHWINDOW FMENU MAINWINDOW (QUOTE TOP)
			  (QUOTE JUSTIFY)))))

(KERMIT.MENU.RETRIEVE
  (LAMBDA (ITEM WINDOW BUTTON)                               (* ejs: " 7-Oct-85 09:45")
    (LET ((STATE (FM.READSTATE WINDOW))
	    ABORTWINDOW)
           (WINDOWPROP (MAINWINDOW WINDOW)
			 (QUOTE KERMITPROC)
			 (THIS.PROCESS))
           (DSPFILL NIL HIGHLIGHTSHADE (QUOTE INVERT)
		      WINDOW)
           (ATTACHWINDOW (SETQ ABORTWINDOW (FM.FORMATMENU (QUOTE (((TYPE MOMENTARY LABEL 
							     "Button here to abort file transfer"
										 FONT
										 (MODERN 10 BOLD)
										 SELECTEDFN 
										KERMIT.MENU.ABORT)))))
			     )
			   (MAINWINDOW WINDOW)
			   (QUOTE TOP)
			   (QUOTE JUSTIFY))
           (RESETLST (RESETSAVE NIL (LIST (FUNCTION (LAMBDA NIL
						    (WINDOWPROP (MAINWINDOW WINDOW)
								  (QUOTE KERMITPROC)
								  NIL)
						    (REMOVEWINDOW ABORTWINDOW)
						    (DSPFILL NIL HIGHLIGHTSHADE (QUOTE INVERT)
							       WINDOW)))))
		       (SELECTQ (LISTGET STATE (QUOTE MODE))
				  (Kermit (KERMIT.RECEIVE (LISTGET STATE (QUOTE REMOTEFILE))
							    (LISTGET STATE (QUOTE LOCALFILE))
							    (MAINWINDOW WINDOW)
							    (U-CASE (LISTGET STATE (QUOTE
										   FILETYPE)))))
				  (Modem (MODEM.RECEIVE (LISTGET STATE (QUOTE LOCALFILE))
							  (MAINWINDOW WINDOW)
							  (U-CASE (LISTGET STATE (QUOTE 
											 FILETYPE)))
							  (LISTGET STATE (QUOTE EOLCONVENTION))))
				  (printout (GETPROMPTWINDOW (MAINWINDOW WINDOW))
					    T "Please choose either Kermit or Modem mode"))))))

(KERMIT.MENU.STORE
  (LAMBDA (ITEM WINDOW BUTTON)                               (* ejs: " 7-Oct-85 09:45")
    (LET ((STATE (FM.READSTATE WINDOW))
	    ABORTWINDOW)
           (WINDOWPROP (MAINWINDOW WINDOW)
			 (QUOTE KERMITPROC)
			 (THIS.PROCESS))
           (DSPFILL NIL HIGHLIGHTSHADE (QUOTE INVERT)
		      WINDOW)
           (ATTACHWINDOW (SETQ ABORTWINDOW (FM.FORMATMENU (QUOTE (((TYPE MOMENTARY LABEL 
							     "Button here to abort file transfer"
										 FONT
										 (MODERN 10 BOLD)
										 SELECTEDFN 
										KERMIT.MENU.ABORT)))))
			     )
			   (MAINWINDOW WINDOW)
			   (QUOTE TOP)
			   (QUOTE JUSTIFY))
           (RESETLST (RESETSAVE NIL (LIST (FUNCTION (LAMBDA NIL
						    (WINDOWPROP (MAINWINDOW WINDOW)
								  (QUOTE KERMITPROC)
								  NIL)
						    (REMOVEWINDOW ABORTWINDOW)
						    (DSPFILL NIL HIGHLIGHTSHADE (QUOTE INVERT)
							       WINDOW)))))
		       (SELECTQ (LISTGET STATE (QUOTE MODE))
				  (Kermit (KERMIT.SEND (LISTGET STATE (QUOTE LOCALFILE))
							 (LISTGET STATE (QUOTE REMOTEFILE))
							 (MAINWINDOW WINDOW)
							 (U-CASE (LISTGET STATE (QUOTE FILETYPE)
									      ))))
				  (Modem (MODEM.SEND (LISTGET STATE (QUOTE LOCALFILE))
						       (MAINWINDOW WINDOW)
						       (U-CASE (LISTGET STATE (QUOTE FILETYPE)))
						       (LISTGET STATE (QUOTE EOLCONVENTION))))
				  (printout (GETPROMPTWINDOW (MAINWINDOW WINDOW))
					    T "Please choose either Kermit or Modem mode "))))))
)
(FILESLOAD (SYSLOAD FROM VALUEOF LISPUSERSDIRECTORIES)
	   FREEMENU KERMIT)
(COND ((NOT (FASSOC (QUOTE Kermit)
		    CHATMENUITEMS))
       (push CHATMENUITEMS (QUOTE (Kermit (FUNCTION KERMIT.MENU.OPEN)
					  "Opens a kermit command menu")))
       (SETQ CHATMENU NIL)))
(COND ((AND (BOUNDP (QUOTE TEDITCHAT.MENUITEMS))
	    (NOT (FASSOC (QUOTE Kermit)
			 TEDITCHAT.MENUITEMS)))
       (push TEDITCHAT.MENUITEMS (QUOTE (Kermit (FUNCTION KERMIT.MENU.OPEN)
						"Opens a kermit command menu")))
       (SETQ TEDITCHAT.MENU NIL)))
(PUTPROPS KERMITMENU COPYRIGHT ("Xerox Corporation" 1985))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (5042 10387 (KERMIT.MENU.ABORT 5052 . 5528) (KERMIT.MENU.BYE 5530 . 6115) (
KERMIT.MENU.EXIT 6117 . 6286) (KERMIT.MENU.OPEN 6288 . 7036) (KERMIT.MENU.RETRIEVE 7038 . 8718) (
KERMIT.MENU.STORE 8720 . 10385)))))
STOP