(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP")
(FILECREATED "17-Feb-88 10:57:36" {QV}<NOTECARDS>1.3LNEXT>PMIPATCH083.;10 10917  

      changes to%:  (FNS NC.BringUpTEditCard NC.BringUpGraphCard)
                    (VARS PMIPATCH083COMS)

      previous date%: "11-Feb-88 11:52:13" {QV}<NOTECARDS>1.3LNEXT>PMIPATCH083.;9)


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

(PRETTYCOMPRINT PMIPATCH083COMS)

(RPAQQ PMIPATCH083COMS (
          
          (* ;; " Fixes to make bringing up cards that are already up more intelligent about redisplaying their contents.")

                        (DECLARE%: DONTCOPY (PROPS (PMIPATCH083 MAKEFILE-ENVIRONMENT)
                                                   (PMIPATCH083 FILETYPE)))
                        [DECLARE%: FIRST (P (NC.LoadFileFromDirectories 'NCTEXTCARD)
                                            (NC.LoadFileFromDirectories 'NCGRAPHCARD]
                        
          
          (* ;; "Changed in NCTEXTCARD")

                        (FNS NC.BringUpTEditCard)
                        
          
          (* ;; "Changed in NCGRAPHCARD")

                        (FNS NC.BringUpGraphCard)))



(* ;; 
" Fixes to make bringing up cards that are already up more intelligent about redisplaying their contents."
)

(DECLARE%: DONTCOPY 

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

(PUTPROPS PMIPATCH083 FILETYPE :BCOMPL)
)
(DECLARE%: FIRST 
(NC.LoadFileFromDirectories 'NCTEXTCARD)
(NC.LoadFileFromDirectories 'NCGRAPHCARD)
)



(* ;; "Changed in NCTEXTCARD")

(DEFINEQ

(NC.BringUpTEditCard
  [LAMBDA (Card TextStream RegionOrPosition)                 (* ; "Edited  9-Feb-88 18:29 by pmi")
          
          (* ;; "Bring up a TEdit window for Card ID whose text stream is TextStream in Region specified by RegionOrPosition or by the user.")
          
          (* ;; "rht 9/10/85: Fixed call to NC.MakeTEditPropsList so prompt window gets fixed up before card is brought up.")
          
          (* ;; "fgh 11/13/85 Updated to handle Card objects.")
          
          (* ;; "kirk 2Dec85 Removed illegal RETURN")
          
          (* ;; "rht 4/11/86: Added Type arg to call to NC.MakeTEditMiddleMenu and changed names of menu windowprops.")
          
          (* ;; 
          "rht 5/5/86: Now calls NC.InstallTitleBarLeftMenu and NC.InstallTextTitleBarMiddleMenu.")
          
          (* ;; "rht 8/2/86: Now doesn't throw in any extra tedit props if card is a filebox.")
          
          (* ;; "rht 11/16/86: Now moves window to RegionOrPosition if already up.")
          
          (* ;; "rht&pmi 11/19/86: Now passes NoteFile arg to NC.MakeTEditPropsList.")
          
          (* ;; "rht & pmi 12/16/86: Changed the way we get TEditWindow.")
          
          (* ;; 
 "rht 1/30/87: Now calls RESTART-PROCESS-OF-TEDIT-WINDOW from Bagley's TEDIT-PROCESS-KILLER package.")
          
          (* ;; "rht 4/17/87: Now makes a prompt window before opening the window.")
          
          (* ;; "rg 11/6/87 now waits for TEdit process to get going after TEDIT call")
          
          (* ;; "pmi 2/9/88: Now checks to see if RegionOrPosition is different from current region or position of card before calling SHAPEW, which could needlessly repaint the window otherwise.")

    (LET
     (Region TEditWindow TEditProcess Title TextStreamDirtyFlg Type TEditProcess)
     (if (SETQ TEditWindow (NC.FetchWindow Card))
         then (TOTOPW TEditWindow)
              [if RegionOrPosition
                  then (if (REGIONP RegionOrPosition)
                           then (if [NOT (EQUAL RegionOrPosition (WINDOWPROP TEditWindow 'REGION]
                                    then (SHAPEW TEditWindow (NC.DetermineDisplayRegion Card 
                                                                    RegionOrPosition)))
                         elseif (POSITIONP RegionOrPosition)
                           then (if [NOT (EQUAL RegionOrPosition (create POSITION
                                                                        XCOORD ←
                                                                        (fetch (REGION LEFT)
                                                                           of (WINDOWPROP
                                                                               TEditWindow
                                                                               'REGION))
                                                                        YCOORD ←
                                                                        (fetch (REGION BOTTOM)
                                                                           of (WINDOWPROP
                                                                               TEditWindow
                                                                               'REGION]
                                    then (SHAPEW TEditWindow (NC.DetermineDisplayRegion Card 
                                                                    RegionOrPosition]
              (RPTQ 2 (FLASHW TEditWindow))
              (if (SETQ TEditProcess (WINDOWPROP TEditWindow 'PROCESS))
                  then (TTY.PROCESS TEditProcess)
                else                                         (* ; 
                                                 "Process may have been turned off.  Try to restart.")

                     (SETQ TEditProcess (RESTART-PROCESS-OF-TEDIT-WINDOW TEditWindow)))
              TEditWindow
       else (SETQ Region (NC.DetermineDisplayRegion Card RegionOrPosition))
            (SETQ Title (NC.RetrieveTitle Card))
            (SETQ Type (NC.RetrieveType Card))
            (SETQ TEditWindow (CREATEW Region Title NIL T))  (* ; 
                                             "Make a prompt window 'invisibly' so it gets hooked in.")

            (NC.AttachPromptWindowOffScreen TEditWindow)
            (WINDOWADDPROP TEditWindow 'SHRINKFN (FUNCTION NC.TextCardShrinkFn))
            (NC.InstallTitleBarLeftMenu TEditWindow Type)
            (NC.InstallTextTitleBarMiddleMenu TEditWindow Type)
            (SETQ TextStreamDirtyFlg (NC.CardDirtyP Card))
            [SETQ TEditProcess (TEDIT TextStream TEditWindow NIL (NC.MakeTEditPropsList
                                                                  TEditWindow
                                                                  (NC.FileBoxP Card T)
                                                                  (fetch (Card NoteFile) of Card] 
                                                             (* ; "wait for process to get established.  Otherwise, the TEdit killer, called by MakeReadOnly, may fail")

            (until (TEDIT-PROCESS-P TEditProcess) do (BLOCK))
            (AND TextStreamDirtyFlg (NC.MarkCardDirty Card)))
     TEditWindow])
)



(* ;; "Changed in NCGRAPHCARD")

(DEFINEQ

(NC.BringUpGraphCard
  [LAMBDA (Card Substance RegionOrPosition)                  (* ; "Edited  9-Feb-88 18:29 by pmi")
          
          (* ;; "Given a graph (or browser) Substance, open a grapher (browser) window and set it up to be a NoteCard with ID.")
          
          (* ;; "fgh 11/14/85 Updated to handle Card object.")
          
          (* ;; "rht 5/5/86: Now calls NC.InstallTitleBarButtonEventFn, NC.InstallTitleBarLeftMenu, and NC.InstallTitleBarMiddleMenu instead of NC.SetupTitleBarMenu.")
          
          (* ;; "fgh 6/30/86 Added NC.GRAPHERCOPYBUTTONEVENTFN to SHOWGRAPH call")
          
          (* ;; "rht 11/16/86: Now moves window to RegionOrPosition if already up.")
          
          (* ;; "pmi 2/9/88: Now checks to see if RegionOrPosition is different from current region or position of card before calling SHAPEW, which could needlessly repaint the window otherwise.")

    (LET (Region Title GraphWindow IconWindow CardType)
         (COND
            ((SETQ GraphWindow (NC.FetchWindow Card))
             (AND (WINDOWP (WINDOWPROP GraphWindow 'ICONFOR))
                  (SETQ GraphWindow (EXPANDW GraphWindow)))
             (TOTOPW GraphWindow)
             [if RegionOrPosition
                 then (if (REGIONP RegionOrPosition)
                          then (if [NOT (EQUAL RegionOrPosition (WINDOWPROP GraphWindow 'REGION]
                                   then (SHAPEW GraphWindow (NC.DetermineDisplayRegion Card 
                                                                   RegionOrPosition)))
                        elseif (POSITIONP RegionOrPosition)
                          then (if [NOT (EQUAL RegionOrPosition (create POSITION
                                                                       XCOORD ←
                                                                       (fetch (REGION LEFT)
                                                                          of (WINDOWPROP GraphWindow
                                                                                    'REGION))
                                                                       YCOORD ←
                                                                       (fetch (REGION BOTTOM)
                                                                          of (WINDOWPROP GraphWindow
                                                                                    'REGION]
                                   then (SHAPEW GraphWindow (NC.DetermineDisplayRegion Card 
                                                                   RegionOrPosition]
             (RPTQ 2 (FLASHW GraphWindow)))
            (T (SETQ GraphWindow (SHOWGRAPH Substance (CREATEW (NC.DetermineDisplayRegion Card 
                                                                      RegionOrPosition)
                                                             (NC.RetrieveTitle Card))
                                        (FUNCTION NC.GraphCardLeftButtonFn)
                                        (FUNCTION NC.GraphCardMiddleButtonFn)
                                        NIL T (FUNCTION NC.GRAPHERCOPYBUTTONEVENTFN)))
               (SETQ CardType (NC.RetrieveType Card))
               (WINDOWADDPROP GraphWindow 'SHRINKFN (FUNCTION NC.GraphCardShrinkFn))
               (NC.InstallTitleBarButtonEventFn GraphWindow (FUNCTION NC.TitleBarButtonEventFn))
               (NC.InstallTitleBarLeftMenu GraphWindow CardType)
               (NC.InstallTitleBarMiddleMenu GraphWindow CardType)))
         GraphWindow])
)
(PUTPROPS PMIPATCH083 COPYRIGHT ("Xerox Corporation" 1988))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL (1651 7126 (NC.BringUpTEditCard 1661 . 7124)) (7167 10834 (NC.BringUpGraphCard 7177 . 
10832)))))
STOP