(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP")
(FILECREATED " 8-Sep-88 17:41:15" {QV}<NOTECARDS>1.3LNEXT>PMIPATCH110.;2 9275   

      changes to%:  (VARS PMIPATCH110COMS)
                    (FNS NC.LoadFileFromDirectories)

      previous date%: " 8-Sep-88 13:53:05" {QV}<NOTECARDS>1.3LNEXT>PMIPATCH110.;1)


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

(PRETTYCOMPRINT PMIPATCH110COMS)

(RPAQQ PMIPATCH110COMS
       (

(* ;;; "New file")

        (DECLARE%: DONTCOPY (PROPS (PMIPATCH110 MAKEFILE-ENVIRONMENT)
                                   (PMIPATCH110 FILETYPE)))
        
        (* ;; "pmi 9/8/88: Fixes to autoloading card types.")

        
        (* ;; "Changed in NCCARDS")

        (FNS NC.EditNoteCard)
        
        (* ;; "Changed in NOTECARDS")

        (FNS NC.LoadFileFromDirectories)))



(* ;;; "New file")

(DECLARE%: DONTCOPY 

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

(PUTPROPS PMIPATCH110 FILETYPE :BCOMPL)
)



(* ;; "pmi 9/8/88: Fixes to autoloading card types.")




(* ;; "Changed in NCCARDS")

(DEFINEQ

(NC.EditNoteCard
  [LAMBDA (Card ReadOnly RegionOrPosition TypeSpecificArgs)  (* ; "Edited  8-Sep-88 09:09 by pmi")

    (* ;; "Bring the already created NoteCard specified by ID onto the screen at Region or Position specified by RegionOrPosition")

    (* ;; "fgh 11/11/85: Updated to handle new Card object.")

    (* ;; "fgh 2/5/86 Added call to NC.ApplyFn")

    (* ;; "kirk 15May86 Added call to NC.AttachNoteFileName")

    (* ;; "rht 7/13/86: Added TypeSpecificArgs arg.")

    (* ;; "kef 7/16/86: Added NC.ObtainCardEditPermission.")

    (* ;; "kef 8/7/86: Added check to make sure that applying the EditFn worked.  If not, then release those write locks, thus keeping the writelock count consistent.")

    (* ;; "fgh 8/30/86 Converted APPLY* to NC.ApplyFn.")

    (* ;; "rht 10/6/86: Added checks before doing WINDOWPROP calls in case there was a recursive call to NC.EditNoteCard.")

    (* ;; "rg 3/30/87 added NC.ProtectedCardOperation wrapper")

    (* ;; "rht 5/13/87: Added call to new NC.InstallCopyButtonEventFn.")

    (* ;; "dsj 9/22/87: Included check for valid card type of destination card.")

    (* ;; "rg 11/4/87 added ReadOnly arg")

    (* ;; "pmi 12/30/87: Added dsj's change;  see comment above.")

    (* ;; "pmi 2/10/88: Replaced bogus InterestedWindow argument with NIL in call to NCP.PrintMsg if card type definition is missing.")

    (* ;; "rht 5/30/88: Now deletes any links marked as Bad during running of EditFn.")

    (* ;; "pmi 9/8/88: Removed fix by dsj (9/22/87, see above).  This is a case where a fix for IDE (checking for valid card type, which prevented autoloading) hurt the rest of the NoteCards community.")

    (DECLARE (GLOBALVARS NC.ShowNoteFileOnCards))
    (NC.ProtectedCardOperation Card "Edit NoteCard" NIL (RESETSAVE (CURSOR WAITINGCURSOR))
           (LET ((CardWindow (NCP.CardWindow Card)))
                (PROG (Window Substance EditResult)
                      [COND
                         ((AND (NC.ActiveCardP Card)
                               (NC.ObtainEditPermission Card))
                          (SETQ Substance (NC.FetchSubstance Card)))
                         ((NC.ObtainEditPermission Card)
                          (NC.GetNoteCard Card)
                          (SETQ Substance (NC.FetchSubstance Card)))
                         (T (RETURN (NC.CardPartBusy Card '(SUBSTANCE TOLINKS GLOBALTOLINKS PROPLIST]
                      (COND
                         ([AND (SETQ EditResult (ERSETQ (NC.ApplyFn EditFn Card Substance 
                                                               RegionOrPosition TypeSpecificArgs)))
                               (WINDOWP (SETQ Window (CAR EditResult]
                          (WINDOWADDPROP Window 'CLOSEFN (FUNCTION NC.QuitCard)
                                 'FIRST)
                          (OR (NC.CardP (WINDOWPROP Window 'NoteCardObject))
                              (WINDOWPROP Window 'NoteCardObject Card))
                          (NC.InstallCopyButtonEventFn Window)
                          (if NC.ShowNoteFileOnCards
                              then (NC.AttachNoteFileName Window))

                          (* ;; "Remove any bum links found while running the EditFn.")

                          (for BadLink in (NC.FetchUserDataProp Card 'BadLinks)
                             do (NC.DelReferencesToCard Card BadLink))
                          (NC.SetUserDataProp Card 'BadLinks NIL))
                         (T                                  (* ; 
       "At this point, we've obtain the write locks but the edit failed, so we'd better release them")
                            (for CardPart in '(SUBSTANCE TOLINKS GLOBALTOLINKS PROPLIST)
                               do (NC.ApplyFn ReleaseWritePermissionFn Card CardPart))
                            (RETURN)))
                      (if ReadOnly
                          then (NC.ApplyFn MakeReadOnlyFn Card))
                      (RETURN Window])
)



(* ;; "Changed in NOTECARDS")

(DEFINEQ

(NC.LoadFileFromDirectories
  [LAMBDA (FileName Directories QuietFlg TypeName AlwaysFlg) (* ; "Edited  8-Sep-88 17:31 by pmi")

    (* ;; "Try to load FileName from Directories.  The latter can be a list in which case the elements should be directory paths.  It can be an atom in which case it should be a DIRECTORIES var.  Or it can be NIL in which case it defaults to the litatom NOTECARDSDIRECTORIES.")

    (* ;; "rg 9/4/87 now pushes file name onto NC.LoadedFiles for use by NC.PostGreet")

    (* ;; "rg 1/15/88 now checks rootified version of LOADEDFILELST, won't load any file that it finds there.  Net effect is that this fn will NEVER load a file that has been loaded in ANY version previously.  No longer calls NC.FixFileDates.")

    (* ;; "rg 1/22/88: doesn't SYSLOAD if NC.SourceAccessFlg set, returns full file name instead of NC.LoadedFiles.  Trimmed change log.")

    (* ;; "rg 5/2/88: Uses FILEDATES prop instead of checking SIMPLELOADEDFILELST, added AlwaysFlg")

    (* ;; "rg 6/22/88 put search through LOADEDFILELST back in - FILEDATES property check wasn't sufficient for, e.g., stubs.")

    (* ;; "pmi 9/8/88: Changed printout  %"Attempting to autoload ...%" so that it prints either the FileName or the TypeName, in case FileName is NIL.  Also changed to add the name part of FullName instead of FileName to the NC.LoadedFiles list.  ")

    (DECLARE (GLOBALVARS NC.LoadedFiles))
    (RESETLST
        [RESETSAVE NIL (if (OPENWP (WFROMDS (TTYDISPLAYSTREAM)
                                          T))
                           then (SETQ QuietFlg T)
                                '(NILL)
                         else `(CLOSEW ,(WFROMDS (TTYDISPLAYSTREAM]
        [RESETSAVE NIL (if QuietFlg
                           then '(NILL)
                         else `(WINDOWPROP ,(WFROMDS (TTYDISPLAYSTREAM))
                                      'PAGEFULLFN
                                      ,(WINDOWPROP (WFROMDS (TTYDISPLAYSTREAM))
                                              'PAGEFULLFN
                                              'NILL]
        [LET ((Window (WFROMDS (TTYDISPLAYSTREAM)))
              (SimpleName (SIMPLE-FILENAME FileName))
              FullName)
             (if [AND [OR AlwaysFlg (NOT (GETPROP SimpleName 'FILEDATES))
                          (for LoadedFile in LOADEDFILELST never (EQ SimpleName (SIMPLE-FILENAME
                                                                                 LoadedFile]
                      (SETQ FullName (NC.FindFile FileName TypeName TypeName NIL
                                            (OR (GETPROP FileName 'Directories)
                                                Directories]
                 then (if (NOT QuietFlg)
                          then (CLEARW Window)
                               (FLASHWINDOW Window)
                               (if TypeName
                                   then (PRINTOUT Window "Card type " TypeName " not loaded." T))
                               (PRINTOUT Window "Attempting to autoload " (OR FileName TypeName)
                                      T))
                      (PROG1 [if AlwaysFlg
                                 then (LOAD FullName (if (NOT NC.SourceAccessFlg)
                                                         then 'SYSLOAD))
                               else (APPLY* #'FILESLOAD (if NC.SourceAccessFlg
                                                            then `(,FullName)
                                                          else `((SYSLOAD)
                                                                 ,FullName]
                          (pushnew NC.LoadedFiles (FILENAMEFIELD FullName 'NAME)))])])
)
(PUTPROPS PMIPATCH110 COPYRIGHT ("Xerox Corporation" 1988))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL (1177 5294 (NC.EditNoteCard 1187 . 5292)) (5333 9192 (NC.LoadFileFromDirectories 5343 . 
9190)))))
STOP