(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP")
(FILECREATED "27-Apr-88 16:44:20" {QV}<NOTECARDS>1.3LNEXT>DICTTOOLPATCHES.;1 4585   

      changes to%:  (VARS DICTTOOLPATCHESCOMS)
                    (FNS DictTool.TEditWrapper))


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

(PRETTYCOMPRINT DICTTOOLPATCHESCOMS)

(RPAQQ DICTTOOLPATCHESCOMS ((DECLARE%: DONTCOPY (PROPS (DICTTOOLPATCHES MAKEFILE-ENVIRONMENT)
                                                       (DICTTOOLPATCHES FILETYPE)))
                            
          
          (* ;; "Fixes bug in DICTOOL whereby MOUSECONFIRM was being called with the PROMPTWINDOW textobj property which can legally be DON'T (and is in the NoteCards case).")

                            (FNS DictTool.TEditWrapper)))
(DECLARE%: DONTCOPY 

(PUTPROPS DICTTOOLPATCHES MAKEFILE-ENVIRONMENT (:PACKAGE "INTERLISP" :READTABLE "INTERLISP"))

(PUTPROPS DICTTOOLPATCHES FILETYPE :TCOMPL)
)



(* ;; 
"Fixes bug in DICTOOL whereby MOUSECONFIRM was being called with the PROMPTWINDOW textobj property which can legally be DON'T (and is in the NoteCards case)."
)

(DEFINEQ

(DictTool.TEditWrapper
  [LAMBDA (dict proc stream selection promptString waitString cachePropName)
                                                             (* ; "Edited 27-Apr-88 16:39 by Trigg")
          
          (* * handles the TEdit user interface)
          
          (* ;; "rht 4/27/88: No longer passes value of PROMPTWINDOW textprop to MOUSECONFIRM since it could be DON'T.  Now looks for promptwindow on the WINDOWPROP of the stream's main window.")

    (PROG (scratchStream textStream startPos startTime textObj)
          
          (* * set things up)

          [COND
             ((NULL stream)
              (SETQ stream (Dict.OutputStream]
          [COND
             ((NULL dict)
              (TEDIT.PROMPTPRINT stream "Please select a dictionary." T)
              (RETURN))
             ((NULL selection)
              (SETQ selection (TEDIT.SEL.AS.STRING stream))
              (COND
                 ((ILEQ (NCHARS selection)
                        1)
                  (SETQ selection NIL)))
              (COND
                 [(AND selection (MOUSECONFIRM (CONCAT "CONFIRM INPUT: " selection)
                                        ""
                                        (LET [(streamWin (CAR (fetch (TEXTOBJ \WINDOW)
                                                                 of (TEXTOBJ stream]
                                             (AND streamWin (CAR (WINDOWPROP streamWin 'PROMPTWINDOW]
                 ([NULL (SETQ selection (TEDIT.GETINPUT stream (OR promptString "input: ")
                                               (AND cachePropName (STREAMPROP stream cachePropName]
                  (TEDIT.PROMPTPRINT stream " Aborted." T)
                  (RETURN]
          
          (* * print the results.)

          (SETQ startTime (CLOCK 0))
          (AND cachePropName (STREAMPROP stream cachePropName selection))
          (TEDIT.PROMPTPRINT stream (CONCAT (OR waitString "processing")
                                           " '" selection "' . . . ")
                 T)
          [RESETSAVE (OUTPUT (CAR (WINDOWPROP Dict.DefWindow 'PROMPTWINDOW]
                                                             (* redirects errors to the 
                                                             promptwindow)
          [SETQ scratchStream (OPENTEXTSTREAM NIL NIL NIL NIL '(LEAVETTY]
          (COND
             [(APPLY* proc dict selection scratchStream)
              (TEDIT.INCLUDESTREAM (Dict.OutputStream)
                     scratchStream)
              (COND
                 (DictTool.TimeOperation (TEDIT.PROMPTPRINT stream (CONCAT "Elapsed Time: "
                                                                          (QUOTIENT
                                                                           (DIFFERENCE (CLOCK 0)
                                                                                  startTime)
                                                                           1000.0)
                                                                          " seconds.")))
                 (T (TEDIT.PROMPTPRINT stream "Done."]
             (T (TEDIT.PROMPTPRINT stream "not found.")
                (TEDIT.PROMPTFLASH stream)))
          (CLOSEF scratchStream])
)
(PUTPROPS DICTTOOLPATCHES COPYRIGHT ("Xerox Corporation" 1988))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL (1171 4498 (DictTool.TEditWrapper 1181 . 4496)))))
STOP