(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP")
(FILECREATED "14-Sep-88 18:20:57" {QV}<IDE>1.4>DSJPATCH072.;2 7411   

      changes to%:  (VARS DSJPATCH072COMS)
                    (FNS NC.CreateCrossFileLinkCard NC.CrossFileLinkGetFn NC.GetCrossFileLinkDestCard
                         )

      previous date%: "14-Sep-88 16:15:46" {QV}<IDE>1.4>DSJPATCH072.;1)


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

(PRETTYCOMPRINT DSJPATCH072COMS)

(RPAQQ DSJPATCH072COMS (
                        (* ;; 
                 "dsj.  Change to make display of cross-file links faster.  reference: IDE AR #273. ")

                        (DECLARE%: DONTCOPY (PROPS (DSJPATCH072 MAKEFILE-ENVIRONMENT)
                                                   (DSJPATCH072 FILETYPE)))
                        
                        (* ;; "Changed in NCCROSSFILELINKS")

                        (FNS NC.GetCrossFileLinkDestCard)))



(* ;; "dsj.  Change to make display of cross-file links faster.  reference: IDE AR #273. ")

(DECLARE%: DONTCOPY 

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

(PUTPROPS DSJPATCH072 FILETYPE :TCOMPL)
)



(* ;; "Changed in NCCROSSFILELINKS")

(DEFINEQ

(NC.GetCrossFileLinkDestCard
  [LAMBDA (CrossFileLinkCard InterestedWindow Don'tOpenDestNoteFileFlg)
                                                             (* ; "Edited 14-Sep-88 16:10 by DSJ")

         (* * Find the notefile corresponding to this crossfilelink and try to open it if 
         not already open. Then look for the card in there having the given UID.
         Return NIL if failed for any reason.)

         (* * rht 11/10/86%: Make sure CrossFileLinkCard is cached before fetching 
         substance.)

         (* * rht 11/19/86%: Now rips off version number from destination notefile hint.)

         (* * rht 12/11/86%: Now checks that destination card is not deleted.)

         (* * rht 12/16/86%: Now takes InterestedWindow argument.)

         (* * rht 3/25/87%: Now calls NC.CoerceToInterestedWindow.)

         (* * rht 3/27/87%: Now calls NC.OpenCrossFileLinkDestNoteFile.)

         (* * rht 5/27/87%: New arg Don'tOpenDestNoteFileFlg.
         If non-nil, then destination notefile has to be already open.)

         (* * rht 6/4/87%: Now passes CrossFileLinkCard to 
         NC.OpenCrossFileLinkDestNoteFile.)

         (* * rht 6/8/87%: Now computes WasOpenPromptWindowFlg)

         (* * pmi 8/7/87%: Now gets a filename if it has to loop and ask for another 
         notefile to try.)

         (* * pmi 9/8/87%: Now sets Don'tOpenDestNoteFileFlg to the results of 
         NC.OpenCrossFileLinkDestNoteFile)

         (* * dsj |9/14/88.| For speed, Now no longer updates the 
         CrossFileLinkDestFileHint field of the CrossFileLinkCard substance with the 
         DestNoteFile, thereby avoiding a call to FULLNAME.)

    (LET ((Title (NC.FetchTitle CrossFileLinkCard))
          (SourceNoteFile (fetch (Card NoteFile) of CrossFileLinkCard))
          Substance DestNoteFileUID DestFileHint DestCardUID DestNoteFile DestFileName Card 
          WasOpenPromptWindowFlg)
         (OR InterestedWindow (SETQ InterestedWindow (NC.CoerceToInterestedWindow SourceNoteFile)))
         (SETQ WasOpenPromptWindowFlg (NC.PromptWindowOpenP InterestedWindow))
         (if (NOT (NC.ActiveCardP CrossFileLinkCard))
             then (NC.GetNoteCard CrossFileLinkCard))
         (SETQ Substance (NC.FetchSubstance CrossFileLinkCard))
         (SETQ DestCardUID (fetch (CrossFileLinkSubstance CrossFileLinkDestCardUID) of Substance))
         (SETQ DestNoteFileUID (fetch (CrossFileLinkSubstance CrossFileLinkDestNoteFileUID)
                                  of Substance))
         (SETQ DestFileHint (fetch (CrossFileLinkSubstance CrossFileLinkDestFileHint) of Substance))
         (SETQ DestNoteFile (NC.NoteFileFromNoteFileUID DestNoteFileUID))
         (SETQ DestFileName (OR (AND (type? NoteFile DestNoteFile)
                                     (fetch (NoteFile FullFileName) of DestNoteFile))
                                DestFileHint))
         (for while [if Don'tOpenDestNoteFileFlg
                        then (NCP.OpenNoteFileP DestNoteFile)
                      else [SETQ Don'tOpenDestNoteFileFlg (NULL (SETQ DestNoteFile
                                                                 (NC.OpenCrossFileLinkDestNoteFile
                                                                  DestNoteFile DestFileName 
                                                                  InterestedWindow CrossFileLinkCard]
                           (SETQ DestFileName (OR DestFileName (AND (type? NoteFile DestNoteFile)
                                                                    (fetch (NoteFile FullFileName)
                                                                       of DestNoteFile] bind 
                                                                                          NewFileName
            do (if (NC.ValidCardP (SETQ Card (NC.CardFromUID DestCardUID DestNoteFile)))
                   then 
                        (* ;; "Removed replace of CrossFileLinkDestFileHint field.  dsj. ")
                                                             (* if (NOT (EQUAL (SETQ NewFileName
                                                             (fetch (NoteFile FullFileName) of 
                                                             DestNoteFile)) (FULLNAME
                                                             (fetch (CrossFileLinkSubstance 
                                                             CrossFileLinkDestFileHint) of 
                                                             Substance)))) then (replace
                                                             (CrossFileLinkSubstance 
                                                             CrossFileLinkDestFileHint) of 
                                                             Substance with (PACKFILENAME
                                                             (QUOTE VERSION) NIL (QUOTE BODY) 
                                                             NewFileName)) (NC.MarkCardDirty 
                                                             CrossFileLinkCard))
                        (RETURN Card)
                 else (if Don'tOpenDestNoteFileFlg
                          then (RETURN NIL)
                        else (NC.PrintMsg InterestedWindow T "Couldn't find destination card in " 
                                    DestFileName "." (CHARACTER 13))
                             (if (NOT (NC.AskYesOrNo "Want to try opening a different notefile? " 
                                             " -- " "Yes" NIL InterestedWindow WasOpenPromptWindowFlg
                                             ))
                                 then (RETURN NIL)
                               else (SETQ DestNoteFile (SETQ DestFileName NIL])
)
(PUTPROPS DSJPATCH072 COPYRIGHT ("Xerox Corporation" 1988))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL (1294 7328 (NC.GetCrossFileLinkDestCard 1304 . 7326)))))
STOP