(FILECREATED " 6-Jul-86 15:22:31" {QV}<NOTECARDS>1.3K>RHTPATCH052.;7 89660 changes to: (VARS RHTPATCH052COMS) (FNS NC.CheckForNotReadOnly NC.CheckpointDatabase NC.CardSaveFn NC.DeleteNoteCards NC.AssignTitle NC.AddParents NC.FileBoxCollectChildren NC.MakeLink NC.LinkIconWhenDeletedFn NC.NoteFileOperations NC.SetUpNoteFileInterface NC.NoteFileMenuWhenSelectedFn NC.AttachNoteFileName NC.MakeNoteFileNameIndicator NC.LinkIconWhenCopiedFn NC.LinkIconWhenMovedFn NC.QuitWithoutSaving NC.QuitCard NC.DoNoteFileOp) previous date: " 4-Jul-86 23:26:28" {QV}<NOTECARDS>1.3K>RHTPATCH052.;2) (* Copyright (c) 1986 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT RHTPATCH052COMS) (RPAQQ RHTPATCH052COMS ((COMS (* * Please don't integrate this stuff. Just for people loading this patch file.) (GLOBALVARS NC.NoteFileOpsItems) (VARS (NC.NoteFileOpsItems NIL))) (* * Stuff to handle read-only notefiles.) (* * New functions for NCDATABASE) (FNS NC.ReadOnlyNoteFileP NC.CheckForNotReadOnly NC.CheckpointDatabase NC.CloseDatabaseFile) (* * New functions for NCCARDS) (FNS NC.ReadOnlyCardP NC.CardSomehowDirtyP) (* * Changes to NCCARDS) (FNS NC.QuitCard NC.CardSaveFn NC.MakeNoteCard NC.DeleteNoteCards NC.AssignTitle NC.AddParents) (* * Changes to NCFILEBOXCARD) (FNS NC.FileBoxCollectChildren) (* * Changes to NCLINKS) (FNS NC.MakeLink NC.LinkIconWhenCopiedFn NC.LinkIconWhenMovedFn NC.LinkIconWhenDeletedFn) (* * Changes to NCINTERFACE) (FNS NC.FileBrowserOpen NC.DoNoteFileOp NC.NoteFileOperations NC.SetUpNoteFileInterface NC.NoteFileMenuWhenSelectedFn NC.AttachNoteFileName NC.MakeNoteFileNameIndicator) (* * Take out all occurrences of the 1.2 relic NC.UnclassifiedID from NCINTERFACE) (* * Change the INITVARS of NC.FileBrowserMenuItems in NCINTERFACE to a VARS.) (* * Change NC.NoteFileOpsItems ADDVARS in NCINTERFACE as follows) (ADDVARS (NC.NoteFileOpsItems (Open% NoteFile (NC.DoNoteFileOp (QUOTE Open% NoteFile)) "Opens a notefile." (SUBITEMS (Read-only% Open (NC.DoNoteFileOp (QUOTE Read-only% Open)) "Open a notefile for read-only."))) (Checkpoint% NoteFile (NC.DoNoteFileOp (QUOTE Checkpoint% NoteFile)) "Checkpoint a NoteFile") (Close% NoteFile (NC.DoNoteFileOp (QUOTE Close% NoteFile))) (Abort% NoteFile (NC.DoNoteFileOp (QUOTE Abort% NoteFile)) "Close NF, deleting changes since last checkpoint.") (Compact% NoteFile (NC.DoNoteFileOp (QUOTE Compact% NoteFile)) "Compact a NoteFile." (SUBITEMS (Compact% To% New% File (NC.DoNoteFileOp (QUOTE Compact% NoteFile) "Compact a NoteFile copying to a new file.")) (Compact% In% Place (NC.DoNoteFileOp (QUOTE Compact% In% Place) "Compact a NoteFile w/o copying to a new file.")))) (Inspect&Repair% NF (NC.DoNoteFileOp (QUOTE Inspect&Repair% NoteFile)) "Do an Inspect & Repair on a NoteFile." (SUBITEMS (Read% Substances (NC.DoNoteFileOp (QUOTE Read% Substances)) "Inspects and optionally repairs a Notefile, but reads every substance. This slows it WAY down."))) (Copy% NoteFile (NC.DoNoteFileOp (QUOTE Copy% NoteFile)) "Copy a NoteFile.") (Rename% NoteFile (NC.DoNoteFileOp (QUOTE Rename% NoteFile)) "Rename a NoteFile") (Delete% NoteFile (NC.DoNoteFileOp (QUOTE Delete% NoteFile)) "Delete a NoteFile") (Create% NoteFile (NC.DoNoteFileOp (QUOTE Create% NoteFile)) "Create a new NoteFile w/o opening it."))) (* * Change NC.FileBrowserMenuItemsToAdd VARS in NCINTERFACE as follows) (VARS (NC.FileBrowserMenuItemsToAdd (QUOTE ((Open NC.FileBrowserOpen "Open selected Notefiles." (SUBITEMS (Read-only% Open (NC.FileBrowserOpen INPUT) "Open selected Notefiles for read-only."))) (Checkpoint NC.FileBrowserCheckpoint "Checkpoint the selected Notefiles, saving dirty cards.") (Close NC.FileBrowserClose "Close selected Notefiles.") (Abort NC.FileBrowserAbort "Aborts the selected Notefiles losing work since last checkpoint.") (Compact NC.FileBrowserCompact "Compacts selected Notefiles to target files." (SUBITEMS (Compact% To% Target% File NC.FileBrowserCompact "Compacts selected Notefiles to target files.") (Compact% In% Place ( NC.FileBrowserCompact (QUOTE InPlace)) "Compacts selected Notefiles in place."))) (Inspect&Repair NC.FileBrowserInspect&Repair "Inspects and optionally repairs selected Notefiles." (SUBITEMS (Read% Substances (NC.FileBrowserInspect&Repair (QUOTE ReadSubstances)) "Inspects and optionally repairs selected Notefiles, but reads every substance. This slows things WAY down." ))) (Copy FB.COPYCOMMAND "Copies given notefile(s) to target file (or directory).") (Rename FB.RENAMECOMMAND "Moves given notefile(s) to target file (or directory)."))))) (COMS (* * Please don't integrate this stuff. Just for people loading this patch file.) (GLOBALVARS NC.FileBrowserMenuItems NC.FileBrowserMenuItemsToAdd NC.FileBrowserMenuItemsToKeep NC.FileBrowserRecomputeMenuItem NC.FileBrowserExpungeMenuItem NC.FileBrowserMenuItemsToRemove) (VARS (NC.FileBrowserMenuItems (APPEND NC.FileBrowserMenuItemsToAdd (for MenuItem in FB.MENU.ITEMS when (FMEMB (CAR MenuItem) NC.FileBrowserMenuItemsToKeep) collect (if (EQ (CAR MenuItem) (QUOTE Recompute)) then NC.FileBrowserRecomputeMenuItem else MenuItem)) (LIST NC.FileBrowserExpungeMenuItem) (for MenuItem in FB.MENU.ITEMS unless (OR (FMEMB (CAR MenuItem) NC.FileBrowserMenuItemsToRemove) (FMEMB (CAR MenuItem) NC.FileBrowserMenuItemsToKeep)) collect MenuItem))))))) (* * Please don't integrate this stuff. Just for people loading this patch file.) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NC.NoteFileOpsItems) ) (RPAQQ NC.NoteFileOpsItems NIL) (* * Stuff to handle read-only notefiles.) (* * New functions for NCDATABASE) (DEFINEQ (NC.ReadOnlyNoteFileP (LAMBDA (NoteFile) (* rht: " 4-Jul-86 18:53") (* * Return non-nil if notefile is open for read only.) (EQ (GETFILEINFO (fetch (NoteFile Stream) of NoteFile) (QUOTE ACCESS)) (QUOTE INPUT)))) (NC.CheckForNotReadOnly (LAMBDA (CardOrNoteFile InterestedWindow OperationMsg) (* rht: " 4-Jul-86 22:56") (* * If card or Notefile is read-only then print a message and return nil. Otherwise, return the card or notefile.) (if (COND ((NC.CardP CardOrNoteFile) (OR InterestedWindow (SETQ InterestedWindow (NC.FetchWindow CardOrNoteFile))) (NC.ReadOnlyCardP CardOrNoteFile)) ((type? NoteFile CardOrNoteFile) (OR InterestedWindow (SETQ InterestedWindow (WFROMMENU (fetch (NoteFile Menu) of CardOrNoteFile)))) (NC.ReadOnlyNoteFileP CardOrNoteFile))) then (NC.PrintMsg InterestedWindow T OperationMsg "a notefile open for read-only." (CHARACTER 13)) (DISMISS 1500) (NC.ClearMsg InterestedWindow T) NIL else CardOrNoteFile))) (NC.CheckpointDatabase (LAMBDA (NoteFile QuietFlg Don'tSaveDirtyCardsFlg Don'tCheckOperationInProgressFlg Don'tCheckCardOperationsInProgressFlg InterestedWindow OperationMsg) (* rht: " 6-Jul-86 15:14") (* * First save to the database any cards currently dirty. Copy the index array back into the file and set the LastChkptPtr to the end of the file.) (* * rht 11/12/85: Now calls NC.PutHashArray to do the hard work.) (* * fgh 6/4/86 Added Don'tSaveDirtyCardsFlg to prevent double passes through active cards at close time) (* * fgh 6/13/86 Changed printouts to NF menu. Added check for operations in progress.) (* * fgh 6/25/86 Put in contention lock and NC.ProtectedNoteFileOperation Added Don'tCheckOperationInProgressFlg Don'tCheckCardOperationsInProgressFlg & InterestedWindow args.) (* * rht 7/4/86: Added check for readonly notefile.) (OR InterestedWindow (SETQ InterestedWindow (WFROMMENU (fetch (NoteFile Menu) of NoteFile)))) (if (NC.CheckForNotReadOnly NoteFile InterestedWindow "Can't checkpoint ") then (LET ((Stream (fetch (NoteFile Stream) of NoteFile)) (FullFileName (fetch (NoteFile FullFileName) of NoteFile))) (OR InterestedWindow (SETQ InterestedWindow (WFROMMENU (fetch (NoteFile Menu) of NoteFile)))) (SETQ OperationMsg (OR OperationMsg (CONCAT "Checkpointing Notefile " FullFileName (CHARACTER 13)))) (if (AND (NULL Don'tCheckOperationInProgressFlg) (PROCESSP (NC.NoteFileProp NoteFile (QUOTE ProcessInProgress))) ) then (* * Another operation is in progress on this NF.) (NC.PrintOperationInProgressMsg InterestedWindow (QUOTE Checkpoint% NoteFile) (NC.NoteFileProp NoteFile (QUOTE OperationInProgress))) elseif (NULL (NC.NoteFileOpenP NoteFile)) then (* * This NF is not open.) (NC.PrintMsg InterestedWindow T FullFileName " is not an open NoteFile!!!" (CHARACTER 13)) else (* * Okay checkpoint under a contention lock.) (NC.ProtectedNoteFileOperation NoteFile Checkpoint% NoteFile (OR QuietFlg (RESETSAVE NIL (BQUOTE (NC.ClearMsg , InterestedWindow T))) ) (if (OR Don'tCheckCardOperationsInProgressFlg (PROGN (OR QuietFlg (NC.PrintMsg InterestedWindow T OperationMsg "Checking for card operations in progress." (CHARACTER 13))) (NULL (SETQ OpsInProgress ( NC.CardOperationsInProgress NoteFile)))) (NC.AskYesOrNo (CONCAT "There are card operations in progress." (CHARACTER 13) "Do you want to terminate them?" (CHARACTER 13)) "-->" (QUOTE Yes) T InterestedWindow)) then (OR QuietFlg (NC.PrintMsg InterestedWindow T OperationMsg " ...")) (if (NULL Don'tSaveDirtyCardsFlg) then (NC.SaveDirtyCards NoteFile T InterestedWindow OperationMsg)) (* Put out the new ChkptPtr to the file.) (NC.PutHashArray NoteFile QuietFlg OperationMsg NIL InterestedWindow) (replace (NoteFile CheckptPtr) of NoteFile with (GETEOFPTR Stream)) (NC.PutNoteFileHeader NoteFile) (OR QuietFlg (PROGN (NC.PrintMsg InterestedWindow T OperationMsg "Done." (CHARACTER 13)) (DISMISS 250) (NC.ClearMsg InterestedWindow T))) ))))))) (NC.CloseDatabaseFile (LAMBDA (NoteFile InterestedWindow Don'tCheckOperationInProgressFlg) (* rht: " 4-Jul-86 20:12") (* Close the currently open database file.) (* * rht 10/23/84: Now gives user option of closing and saving all open cards on the screen.) (* * rht 11/8/84: Put RESETLST around NC.CacheTitles call.) (* * rht 1/9/85: Clear the NC.UncachingNotCompleted variable when close successfully completes.) (* * rht 1/31/85: Added call to checkpoint database. That in turn dumps the next nodeID and next linkID.) (* * rht 7/14/85: Replaced the call to reset the main menu with call to NC.ResetMainMenu. Also took out redundant reset of PSA.Database, since NC.ForceDatabaseClose is doing that.) (* * fgh 10/16/85 removed call to CacheTypesAndTitles because uncacheing now done automatically by cache mechanism.) (* * fkr 10/29/85: Now kills caching process from database streamprop.) (* * fkr 11/8/85 Updated to handle new NoteFile object and new CardID scheme.) (* * kirk 23Jan86 Changed to use NC.AskYesOrNo) (* * rht 3/26/86: Now searches for active cards over whole notefile not just among cards up on screen. Uses NC.MapCards.) (* * kirk 28Apr86 Now returns NoteFile if successful.) (* * fgh 5/2/86 Cleaned up. Ask user to confirm only if there are cards on the screen, not if there are active, but not displayed ones. Added calls to the NC.CloseNoteFileFns before and after the closeing.) (* * fgh 6/4/86 Added extra args to call to NC.CheckpointDatabase to prevent double saving of cards.) (* * fgh 6/4/86 Fixed so that shrunken cards are counted as open when asking for confirmation when there are open cards on screen.) (* * fgh 6/13/86 Now checks for card operations in progress and kills them if necessary.) (* * fgh 6/25/86 Added NC.ProtectedNoteFileOperation macro call. Added Don'tCheckOperationInProgressFlg args.) (* * rht 7/4/86: Added check for readonly notefile.) (if (NC.ReadOnlyNoteFileP NoteFile) then (NC.AbortSession NoteFile InterestedWindow) else (ALLOW.BUTTON.EVENTS) (PROG ((Stream (fetch (NoteFile Stream) of NoteFile)) (OperationMsg (CONCAT "Closing NoteFile " (fetch (NoteFile FullFileName) of NoteFile) (CHARACTER 13))) ActiveCards MenuWindow CardTotal) (* * Check to see if this NoteFile is busy doing something else) (if (AND (NULL Don'tCheckOperationInProgressFlg) (PROCESSP (NC.NoteFileProp NoteFile (QUOTE ProcessInProgress)))) then (NC.PrintOperationInProgressMsg InterestedWindow (QUOTE Close% NoteFile) (NC.NoteFileProp NoteFile (QUOTE OperationInProgress)) ) (RETURN NIL)) (* * Make sure NF is open) (if (NULL (NC.NoteFileOpenP NoteFile)) then (NC.PrintMsg InterestedWindow T (fetch (NoteFile FullFileName) of NoteFile) " is not an open NoteFile!!!" (CHARACTER 13)) (RETURN NIL)) (* * Do the rest under an operation in progress lock.) (RETURN (NC.ProtectedNoteFileOperation NoteFile Close% NoteFile (PROG NIL (* * Delete the types and titles caching process if still alive.) (DEL.PROCESS (fetch (NoteFile CachingProcess) of NoteFile)) (* * Notify the user that closing is in progress.) (OR InterestedWindow (SETQ InterestedWindow (WFROMMENU (fetch (NoteFile Menu) of NoteFile)))) (RESETSAVE NIL (BQUOTE (NC.ClearMsg , InterestedWindow T))) (* * See if any cards have operations in progress. If so, kill them after confirming with user.) (NC.PrintMsg InterestedWindow T OperationMsg "Checking for card operations in progress ..." (CHARACTER 13)) (if (EQ (QUOTE ABORT) (NC.CardOperationsInProgress NoteFile T)) then (RETURN NIL)) (NC.ClearMsg InterestedWindow NIL) (* * Look for cards on the screen. If there are active cards ask the user if they still want to close.) (if (AND (for Window in (OPENWINDOWS) thereis (LET (Card) (AND (SETQ Card (OR (NC.CardFromWindow Window) (AND (WINDOWP (WINDOWPROP Window (QUOTE ICONFOR))) (NC.CardFromWindow (WINDOWPROP Window (QUOTE ICONFOR))) ))) (NC.SameNoteFileP NoteFile (fetch (Card NoteFile) of Card))))) (NULL (NC.AskYesOrNo (CONCAT "There are still cards on the screen from NoteFile " (fetch (NoteFile FullFileName) of NoteFile) "." (CHARACTER 13) "Want to close and save them? ") " -- " (QUOTE Yes) NIL InterestedWindow NIL NIL))) then (RETURN NIL)) (* * Run through CloseNoteFileFns with param of BEFORE. Exit if any returns DON'T) (if (for Function in NC.CloseNoteFileFns thereis (OR (EQ Function (QUOTE DON'T)) (EQ (QUOTE DON'T) (APPLY* Function NoteFile (QUOTE BEFORE) )))) then (RETURN NIL)) (* * Close all the active cards) (NC.PrintMsg InterestedWindow T OperationMsg "Checking for active cards ..." (CHARACTER 13)) (if (SETQ ActiveCards (NC.MapCards NoteFile (FUNCTION (LAMBDA ( Card) Card)) (FUNCTION NC.ActiveCardP))) then (NC.PrintMsg InterestedWindow T OperationMsg "Closing and saving active cards ... ") (RESETLST (RESETSAVE NC.ForceSourcesFlg NIL) (RESETSAVE NC.ForceFilingFlg NIL) (RESETSAVE NC.ForceTitlesFlg NIL) (for Card in ActiveCards bind Window do (NC.QuitCard Card T NIL T T InterestedWindow OperationMsg) (if (SETQ Window (NC.FetchWindow Card)) then (bind (Process ←(WINDOWPROP Window (QUOTE PROCESS))) until (OR (NULL Process) (PROCESS.FINISHEDP Process)) do (BLOCK))))) (NC.PrintMsg InterestedWindow NIL "Done." (CHARACTER 13))) (* * Checkpoint, then close the file) (NC.PrintMsg InterestedWindow T OperationMsg) (NC.CheckpointDatabase NoteFile NIL T T T InterestedWindow OperationMsg) (NC.ResetNoteFileInterface NoteFile) (NC.ForceDatabaseClose NoteFile) (NC.ClearMsg InterestedWindow T) (* * Run through CloseNoteFileFns with param of AFTER. Stop if any returns DON'T) (for Function in NC.CloseNoteFileFns thereis (EQ (QUOTE DON'T) (APPLY* Function NoteFile (QUOTE AFTER)))) (* * Return the NF) (RETURN NoteFile)))))))) ) (* * New functions for NCCARDS) (DEFINEQ (NC.ReadOnlyCardP (LAMBDA (Card) (* rht: " 4-Jul-86 18:53") (* * Return non-nil if card's notefile is open for read only. Someday it will get smarter.) (NC.ReadOnlyNoteFileP (fetch (Card NoteFile) of Card)))) (NC.CardSomehowDirtyP (LAMBDA (Card) (* rht: " 2-Jul-86 23:31") (* * Return non-nil if substance, title, props, or links of card is dirty.) (OR (NC.FetchNewCardFlg Card) (NC.CardDirtyP Card) (NC.FetchTitleDirtyFlg Card) (NC.FetchPropListDirtyFlg Card) (NC.FetchLinksDirtyFlg Card)))) ) (* * Changes to NCCARDS) (DEFINEQ (NC.QuitCard (LAMBDA (CardIdentifier CallCloseWFlg DontSaveFlg DontRecacheFlg DontCheckOpInProgressFlg InterestedWindow OperationMsg) (* rht: " 5-Jul-86 13:32") (* * Force note card specified by ID to quit or stop) (* * rht 2/9/85: New arg DontSaveFlg prevents NC.CardSaveFn from being called. Used when aborting a card. This is NOT equivalent to NC.QuitWithoutSaving.) (* * rht 6/25/85: Now moves card off screen before saving if NC.CloseCardsOffScreenFlg is non-nil.) (* * rht 6/25/85: Brought the insure proper filing check back here from NC.CardSaveFn. Bails out if user cancelled operation inside of NC.InsureProperFiling) (* * fgh 11/11/85: Updated to handle CardID and CardInfo objects.) (* * fgh 1/16/86 Put in code to insure that if one of the TopLevelCards is quit then it is reactivated immedialtely to make sure it stays cached for fast access.) (* * fgh 2/5/86 Added call to NC.ApplyFn) (* * fgh 5/2/86 Added DontRecacheFlg arg) (* * fgh 6/9/86 Added code to check to make sure other operations are not in progress. And DontCheckOpInProgressFlg arg to match) (* * fgh 6/26/86 Added InterestedWindow & OperationMsg arg.) (* * rht 7/2/86: Now bails out if notefile is readonly, user confirms, but we're supposed to write down changes.) (PROG ((Card (NC.CoerceToCard CardIdentifier)) Window OperationInProgress ReadOnlyCardFlg) (SETQ Window (NC.FetchWindow Card)) (OR InterestedWindow (SETQ InterestedWindow Window)) (SETQ ReadOnlyCardFlg (NC.ReadOnlyCardP Card)) (* The window not being open should mean that it's shrunken. If so, expand it.) (COND ((AND Window (NOT (OPENWP Window))) (EXPANDW Window))) (* * if in the middle of some other operation, get out of here.) (if (AND (NULL DontCheckOpInProgressFlg) (SETQ OperationInProgress (NC.OperationInProgress Card))) then (NC.PrintOperationInProgressMsg Window "Close Card" OperationInProgress) (RETURN NIL)) (* * if proper filing says don't quit then get out) (OR DontSaveFlg ReadOnlyCardFlg (COND ((EQ (NC.InsureProperFiling Card) (QUOTE CANCELLED)) (RETURN (QUOTE DON'T))))) (* * If card is readonly but we've made changes that we're supposed to save, then get user confirmation and bail out.) (if (AND (NOT DontSaveFlg) ReadOnlyCardFlg (NC.CardSomehowDirtyP Card) (NOT (PROGN (NC.PrintMsg InterestedWindow T "Card has been changed, but notefile is readonly." (CHARACTER 13)) (NC.AskYesOrNo "Want to quit anyway, flushing changes? " NIL (QUOTE Yes) NIL InterestedWindow)))) then (RETURN (QUOTE DON'T))) (* * Otherwise go ahead an quit) (RETURN (NC.ProtectedCardOperation Card Close% Card (COND ((AND Window NC.CloseCardsOffScreenFlg) (COND ((NOT (NC.FetchSavedRegion Card)) (NC.SetSavedRegion Card (WINDOWPROP Window (QUOTE REGION))))) (MOVEW Window 1500 1500))) (OR DontSaveFlg (if ReadOnlyCardFlg then (NC.TurnOffDirtyFlgs Card) else (NC.CardSaveFn Card NC.CloseCardsOffScreenFlg NIL InterestedWindow OperationMsg))) (AND Window (WINDOWDELPROP Window (QUOTE CLOSEFN) (FUNCTION NC.QuitCard))) (PROG1 (NC.ApplyFn QuitFn Card) (AND CallCloseWFlg Window (CLOSEW Window)) (* * if this is one of the top level cards, then make sure it stays cached) (if (AND (NC.TopLevelCardP Card) (NULL DontRecacheFlg)) then (NCP.ActivateCards Card)))))))) (NC.CardSaveFn (LAMBDA (WindowOrID QuietFlg DontCheckForOpsInProgressFlg InterestedWindow OperationMsg) (* rht: " 6-Jul-86 15:14") (* * rht 2/1/85: New function for saving ANY kind of card. All strangenesses are handled in NC.CardDirtyP and NC.MarkCardDirty. Added print statements to show what is being saved. Lets NC.CardDirtyP take care of proper dirty checks.) (* * rht 2/8/85: Added InsureFilingFlg) (* * rht 6/25/85: Pulled out InsureFilingFlg. That check now done upstairs in NC.QuitCard.) (* * rht 9/20/85: Added QuietFlg.) (* * fgh 11/12/85 Updated to handle Card objects. Removed DatabaseStream object.) (* * kirk 29Jan86 replaced call on undefined NC.UpdateRegionData with NC.PutRegion) (* * fgh 6/13/86 Added operations in progress code and DontCheckForOpsInProgressFlg arg.) (* * fgh 6/26/86 Added InterestedWindow & OperationMsg arg.) (* * rht 7/4/86: Added check for readonly notefile.) (LET ((Card (NC.CoerceToCard WindowOrID)) Window OldRegion NewRegion DoneAPutP OperationInProgress) (SETQ Window (NC.FetchWindow Card)) (SETQ InterestedWindow (OR Window InterestedWindow)) (if (NC.CheckForNotReadOnly Card Window "Can't save cards in ") then (if (AND (NULL DontCheckForOpsInProgressFlg) (SETQ OperationInProgress (NC.OperationInProgress Card)) (NEQ OperationInProgress (QUOTE Close% Card))) then (NC.PrintOperationInProgressMsg Window "Save Card" OperationInProgress) else (NC.ProtectedCardOperation Card Save% Card (OR QuietFlg (NC.PrintMsg InterestedWindow T (OR OperationMsg "") (NC.FetchTitle Card) ": Checking ... ")) (COND ((OR (NC.CardDirtyP Card) (NC.FetchNewCardFlg Card)) (OR QuietFlg (NC.PrintMsg InterestedWindow NIL "Saving ")) (OR QuietFlg (NC.PrintMsg InterestedWindow NIL "substance, ")) (NC.PutMainCardData Card T) (SETQ DoneAPutP T) (NC.MarkCardDirty Card (QUOTE RESET))) ((AND (NOT (NC.FetchBeingDeletedFlg Card)) Window (OR (NOT (EQUAL (fetch (REGION WIDTH) of (SETQ OldRegion (NC.FetchRegion Card))) (fetch (REGION WIDTH) of (SETQ NewRegion (WINDOWPROP Window (QUOTE REGION)))))) (NOT (EQUAL (fetch (REGION HEIGHT) of OldRegion) (fetch (REGION HEIGHT) of NewRegion))))) (OR DoneAPutP QuietFlg (NC.PrintMsg InterestedWindow NIL "Saving ")) (OR QuietFlg (NC.PrintMsg InterestedWindow NIL "region, ")) (NC.PutRegion Card) (SETQ DoneAPutP T))) (COND ((NC.FetchTitleDirtyFlg Card) (OR DoneAPutP QuietFlg (NC.PrintMsg InterestedWindow NIL "Saving ")) (OR QuietFlg (NC.PrintMsg InterestedWindow NIL "title, ")) (NC.PutTitle Card) (SETQ DoneAPutP T))) (COND ((NC.FetchPropListDirtyFlg Card) (OR DoneAPutP QuietFlg (NC.PrintMsg InterestedWindow NIL "Saving ")) (OR QuietFlg (NC.PrintMsg InterestedWindow NIL "proplist, ")) (NC.PutPropList Card) (SETQ DoneAPutP T))) (COND ((NC.FetchLinksDirtyFlg Card) (OR DoneAPutP QuietFlg (NC.PrintMsg InterestedWindow NIL "Saving ")) (OR QuietFlg (NC.PrintMsg InterestedWindow NIL "links, ")) (NC.PutLinks Card) (SETQ DoneAPutP T))) (OR DoneAPutP QuietFlg (NC.PrintMsg InterestedWindow NIL (CHARACTER 13) "Nothing changed. ")) (* It's not a new card anymore.) (NC.SetNewCardFlg Card NIL) (OR QuietFlg (PROGN (NC.PrintMsg InterestedWindow NIL "Done." (CHARACTER 13)) (if Window then (NC.ClearMsg Window T)))))))))) (NC.MakeNoteCard (LAMBDA (NoteCardType NoteFile Title NoDisplayFlg TypeSpecificArgs Card) (* rht: " 4-Jul-86 19:11") (* Make a new note card of type NoteCardType. If type note specified, ask the user.) (* * rht 2/1/85: Added call to NC.MarkCardDirty.) (* * fgh 10/15/85 Added extra DatabaseStream argument for use by caching mechanism) (* * 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/4/86: Now checks for read-only notefile before proceeding.) (if (NC.ReadOnlyNoteFileP NoteFile) then NIL else (LET (ReturnValue Window) (COND ((SETQ NoteCardType (OR NoteCardType (NC.AskNoteCardType (fetch (NoteFile Menu) of NoteFile)))) (SETQ Card (OR (PROGN (type? Card Card) Card) (NC.GetNewCard NoteFile))) (NC.SetNewCardFlg Card T) (NC.ActivateCard Card) (NC.SetType Card NoteCardType) (COND ((OR (NULL (ERSETQ (SETQ ReturnValue (NC.ApplyFn MakeFn Card Title NoDisplayFlg TypeSpecificArgs)))) (NULL ReturnValue)) (NC.SetStatus Card (QUOTE DELETED)) (NC.DeactivateCard Card T)) (T (SETQ Window (WINDOWP ReturnValue)) (COND ((NULL (NC.RetrieveTitle Card)) (SETQ Title (NC.SetTitle Card (SETQ Title (COND ((STRINGP Title) Title) ((AND Title (OR (LITATOM Title) (NUMBERP Title)) ) (MKSTRING Title)) (T "Untitled"))))) (AND Window (WINDOWPROP Window (QUOTE TITLE) Title))) (T (NC.SetTitle Card (MKSTRING (NC.RetrieveTitle Card))))) (COND (Window (WINDOWADDPROP Window (QUOTE CLOSEFN) (FUNCTION NC.QuitCard) (QUOTE FIRST)) (WINDOWPROP Window (QUOTE NoteCardObject) Card) (WINDOWPROP Window (QUOTE OldCopyButtonEventFn) (WINDOWPROP Window (QUOTE COPYBUTTONEVENTFN) (FUNCTION NC.CopyButtonEventFn))))) (NC.SetTitleDirtyFlg Card T) (* Reset the type in case of recursive calls change the type. Always want the highest level type in a recursive descent) (NC.SetType Card NoteCardType) (* Insure that a link ptr is set up during the first save) (NC.SetLinksDirtyFlg Card T) (NC.SetPropListDirtyFlg Card T) (* Mark that substance is dirty.) (NC.MarkCardDirty Card T) (if NC.ShowNoteFileOnCards then (NC.AttachNoteFileName Window)))) ReturnValue)))))) (NC.DeleteNoteCards (LAMBDA (CardIdentifiers NoCheckFlg DontClearFlg InterestedWindow) (* rht: " 6-Jul-86 15:16") (* Delete note cards. If no card specified then get a list of note cards to be deleted. Then delete these cards.) (* * fgh 11/11/85: Updated to handle new Card objects. Also split off main work of deleteing a single note card into NC.DeleteNoteCard function.) (* * kirk 21Feb86 Added InterestedWindow) (* * kirk 29Apr86 Now returns CardIdentifiers) (* * fgh 6/9/86 Added checks to see if other operations are in progress) (* * rht 7/4/86: Now checks that card is not read-only.) (OR CardIdentifiers (SETQ CardIdentifiers (NC.SelectNoteCards NIL NIL NC.DeleteSelectingMenu InterestedWindow NIL "Please select the Note Cards to be deleted."))) (bind Card OperationInProgress for CardIdentifier in (MKLIST CardIdentifiers) do (SETQ Card (NC.CoerceToCard CardIdentifier)) (COND ((NULL Card)) ((NC.TopLevelCardP Card) (NC.PrintMsg (NC.FetchWindow Card) T "You cannot delete this FileBox." (CHARACTER 13)) (DISMISS 1000) (NC.ClearMsg (NC.FetchWindow Card) T)) ((NOT (NC.CheckForNotReadOnly Card (NC.FetchWindow Card) "Can't delete cards from a "))) (T (if (SETQ OperationInProgress (NC.OperationInProgress Card)) then (NC.PrintOperationInProgressMsg (NC.FetchWindow Card) "Delete Card(s)" OperationInProgress) else (NC.ProtectedCardOperation Card Delete% Card%(s%) (AND (OR NoCheckFlg (PROG1 (NC.AskYesOrNo "Are you sure you want to delete this?" " -- " "Yes" (NULL DontClearFlg) (NC.FetchWindow Card) NIL NIL) (NC.ClearMsg))) (NC.DeleteNoteCard Card))))))) CardIdentifiers)) (NC.AssignTitle (LAMBDA (CardIdentifier NoClearMsgFlg NewTitle) (* rht: " 6-Jul-86 15:13") (* * Change the title of the card specified by the WindowOrTextStreamOrID) (* * rht 2/1/85: Changed from NC.PutTitle to NC.SetTitleDirtyFlg, unless card is not active. We shouldn't be writing to the notefile until save time.) (* * fgh 11/11/85: Added support for CardID, CardInfo and noteFile objects. Also entered call to Nc.StoreTitle.) (* * fgh 6/9/86 Added code to check to make sure that another operation is not in progress on this card when this fn is called.) (* * fgh 6/13/86 Now spawns mouse in case called under MOUSE process.) (* * fgh 6/27/86 returns T if completed okay.) (* * rht 7/4/86: Added check for readonly card.) (ALLOW.BUTTON.EVENTS) (LET ((Card (NC.CoerceToCard CardIdentifier)) ContainingCard OldTitle Window OperationInProgress) (SETQ Window (NC.FetchWindow Card)) (if (NC.CheckForNotReadOnly Card Window "Can't change titles for cards in ") then (if (AND (NULL NewTitle) (SETQ OperationInProgress (NC.OperationInProgress Card))) then (* * Another interaction operation is in progress on this card and we have to interact with the user. Can't do.) (NC.PrintOperationInProgressMsg Window "Assign Title" OperationInProgress) else (NC.ProtectedCardOperation Card AssignTitle (COND ((SETQ NewTitle (OR (STRINGP NewTitle) (AND NewTitle (OR (LITATOM NewTitle) (NUMBERP NewTitle)) (MKSTRING NewTitle)) (NC.AskUser (CONCAT "Enter the title for this card" (CHARACTER 13)) "--> " (COND ((AND (STREQUAL (SETQ OldTitle (NC.RetrieveTitle Card)) "Untitled") (NC.FetchNewCardFlg Card)) NIL) (T OldTitle)) (NULL NoClearMsgFlg) Window))) (NC.SetTitle Card NewTitle) (COND ((NC.ActiveCardP Card) (NC.SetTitleDirtyFlg Card T)) (T (NC.PutTitle Card) (NC.SetTitleDirtyFlg Card NIL))) (AND (WINDOWP Window) (WINDOWPROP Window (QUOTE TITLE) NewTitle)) (for FromLink in (NC.RetrieveFromLinks Card) do (AND (NC.ActiveCardP (SETQ ContainingCard (fetch (Link SourceCard) of FromLink))) (WINDOWP (NC.FetchWindow ContainingCard)) (NC.UpdateLinkImages ContainingCard Card))))))) T else NIL)))) (NC.AddParents (LAMBDA (WindowOrTextStream) (* rht: " 6-Jul-86 15:13") (* Add a subtopic link from a contents card specified by the user to the contents card specified by WindowOrTextStream. But first check to make sure that this would not introduce any circularities in the contents lattice.) (* * rht 12/8/84: Massive shaving. Now calls NC.MakeChildLink to do the tough work.) (* * rht 10/3/85: No longer prints final, annoying, slow-to-disappear message in prompt window if nothing selected.) (* * fgh 11/13/85 Updated to handle Card object.) (* * fgh 6/9/86 Added code to check to make sure that another operation is not in progress on this card when this fn is called.) (* * rht 7/5/86: Now checks for readonly cards.) (LET (Card NewParents (Window (WINDOW.FROM.TEDIT.THING WindowOrTextStream)) OperationInProgress) (SETQ Card (NC.CoerceToCard Window)) (if (NC.CheckForNotReadOnly Card Window "Can't do filing in ") then (if (SETQ OperationInProgress (NC.OperationInProgress Card)) then (* * Another interaction operation is in progress on this card and we have to interact with the user. Can't do.) (NC.PrintOperationInProgressMsg Window "Designate FileBoxes" OperationInProgress) else (NC.ProtectedCardOperation Card Designate% FileBoxes (SETQ NewParents (NC.SelectNoteCards NIL (FUNCTION NC.FileBoxP) NC.SelectingParentsMenu Card NIL " Please select the new parent FileBox(es).")) (AND NewParents Card (for ParentCard in NewParents bind OneHook when (NC.MakeChildLink Card ParentCard Window) do (SETQ OneHook T) finally (RETURN OneHook))))))))) ) (* * Changes to NCFILEBOXCARD) (DEFINEQ (NC.FileBoxCollectChildren (LAMBDA (WindowOrTextStream Card NewChildren NoDisplayFlg) (* rht: " 6-Jul-86 15:13") (* * Ask user for new children (either cards or fileboxes) for this filebox. Check to make sure that no circularities are introduced. This code is sort of the inverse of the NC.AddParents code and thus looks quite similar.) (* * rht 10/29/84: Added NoDisplayFlg to prevent error message when no appropriate elements exist. Also now returns ID if at least one child was added, NIL otherwise.) (* * fgh 11/13/85 Updated to handle Card object.) (* * rht 7/5/86: Now checks for readonly cards.) (LET (Window ReturnVal) (COND (WindowOrTextStream (SETQ Window (WINDOW.FROM.TEDIT.THING WindowOrTextStream)))) (OR Card (SETQ Card (NC.CoerceToCard Window))) (if (NC.CheckForNotReadOnly Card Window "Can't do filing in ") then (OR NewChildren (SETQ NewChildren (NC.SelectNoteCards NIL NIL NC.SelectingFileBoxChildrenMenu Card NIL " Please select new children."))) (COND ((NULL (AND NewChildren Card (for NewChild in NewChildren bind OneHook when (NC.MakeChildLink NewChild Card Window) do (SETQ OneHook T) finally (RETURN OneHook)))) (OR NoDisplayFlg (NC.PrintMsg Window NIL "No appropriate NoteCards or FileBoxes chosen." (CHARACTER 13) "Hence no children added." (CHARACTER 13))) (SETQ ReturnVal NIL)) (T (SETQ ReturnVal Card))) (AND Window (GETPROMPTWINDOW Window NIL NIL T) (PROG1 (DISMISS 1000) (NC.ClearMsg Window T)))) ReturnVal))) ) (* * Changes to NCLINKS) (DEFINEQ (NC.MakeLink (LAMBDA (Window LinkLabel DestinationCard SourceCard DisplayMode AnchorMode Message NoDisplayFlg LinkToInsertAfter) (* rht: " 6-Jul-86 15:13") (* * Make a link from (OR Window SourceCard) to DestinationCard with linklabel of LinkLabel) (* * rht 1/12/85: If need to create a new card, then now shows card type menu near window of SourceID.) (* * rht 1/13/85: Added extra args Message and NoDisplayFlg.) (* * rht 3/26/85: Added LinkToInsertAfter arg which should be NIL or a link to insert the new To link after. If NIL, then insert at front of ToLinks.) (* * kirk 9/23/85: took out GETPROMPTWINDOW call for asknotecardtype) (* * kirk: 14Nov85: changed NC.CoerceToID to to NC.CoerceToCard) (* * fgh 11/16/85 Changed from PROG to LET and used COND to contyrol returnmed value.) (* * fgh 2/5/86 Changed call DefaultLinkDisplayMode to FetchLinkDisplayMode) (* * fgh 6/5/86 Now calls AskLinkLabel if LinkLabel arg is NIL) (* * rht 7/4/86: Added check for readonly card.) (OR SourceCard (SETQ SourceCard (NC.CoerceToCard Window))) (if (NC.CheckForNotReadOnly SourceCard Window "Can't make links in ") then (LET (Link Type) (OR Window (SETQ Window (NC.FetchWindow SourceCard))) (OR Message (SETQ Message "Please select the Card or Box to be linked to.")) (OR LinkLabel (SETQ LinkLabel (NC.AskLinkLabel Window NIL NIL T NIL))) (OR DestinationCard (SETQ DestinationCard (NC.SelectNoteCards T (FUNCTION (LAMBDA (Card) (COND ((NOT (NC.SameCardP Card SourceCard)) T) (T (NC.PrintMsg Window T "A Card/Box cannot link to itself. " (CHARACTER 13) "Selection ignored." (CHARACTER 13)) NIL)))) NC.SelectingSingleCardMenu SourceCard NIL Message))) (COND ((EQ DestinationCard (QUOTE *New% Card*)) (SETQ DestinationCard (AND (SETQ Type (NC.AskNoteCardType (WINDOWREGION Window))) (NC.CoerceToCard (NC.MakeNoteCard Type (fetch (Card NoteFile) of SourceCard) NIL NoDisplayFlg)))))) (COND (DestinationCard (SETQ Link (create Link UID ←(NC.MakeUID) SourceCard ← SourceCard DestinationCard ← DestinationCard AnchorMode ← AnchorMode Label ← LinkLabel DisplayMode ←(OR DisplayMode ( NC.FetchLinkDisplayMode SourceCard)))) (NC.AddToLink Link LinkToInsertAfter) (NC.AddFromLink Link) Link) (T NIL)))))) (NC.LinkIconWhenCopiedFn (LAMBDA (ImageObject ToWindowStream FromTextStream ToTextStream) (* fgh: "30-Jun-86 23:27") (* * Called when copying a link icon from FromTextStream to ToWindowStream. Sets the necessary link information up for card corresponding to ToWindowStream.) (* * rht 11/18/84: Major hacking. Now checks for all sorts of illegal cases. Either goes ahead with copy, converts link type to "Unspecified", or deletes the new "invisible" link. The latter will change when imageobj fns can return DON'T.) (* * rht 12/12/84: now does RETFROM instead of adding processes to delete imageobj's. This is cleaner, but still ugly.) (* * rht 3/25/85: Fixed to handle copies within a sketch card. That is indicated by nullity of the two textstream args.) (* * rht 3/24/86: Changed call to NC.CoerceToID to NC.CoerceToCard) (* * fgh 6/30/86 Now ERROR! out of attempt to copy between NoteFiles) (PROG (Label (Link (NC.FetchLinkFromLinkIcon ImageObject)) SourceCard DestinationCard NewSourceCard NewLabel NewDisplayMode OldDisplayMode (ImageObjectCopy (IMAGEOBJPROP ImageObject (QUOTE ImageObjectCopy))) (Window (AND ToWindowStream (WFROMDS ToWindowStream T))) (InTEditCopyFlg (COND ((STKPOS (QUOTE TEDIT.COPY)) T))) InsertPos) (SETQ Label (fetch (Link Label) of Link)) (SETQ SourceCard (fetch (Link SourceCard) of Link)) (SETQ DestinationCard (fetch (Link DestinationCard) of Link)) (SETQ OldDisplayMode (fetch (Link DisplayMode) of Link)) (SETQ NewSourceCard (COND ((WINDOWP Window) (NC.CoerceToCard Window)) ((TEXTSTREAMP ToTextStream) (NC.CoerceToCard ToTextStream)))) (COND ((AND (NULL FromTextStream) (NULL ToTextStream)) (* We must be moving within a sketch.) (SETQ NewSourceCard SourceCard)) ((TEXTSTREAMP ToTextStream) (* If it's a text copy, then compute position to insert link at.) (SETQ InsertPos (NC.CharPosFromTextObject (TEXTOBJ ToTextStream))))) (* * If we are copying across NoteFiles, then its an error) (if (AND NewSourceCard (NOT (NC.SameNoteFileP (fetch (Card NoteFile) of SourceCard) (fetch (Card NoteFile) of NewSourceCard)))) then (NC.PrintMsg Window T "Cannot copy links between cards from different NoteFiles." (CHARACTER 13) "Copy aborted." (CHARACTER 13)) (ERROR!)) (COND ((NULL NewSourceCard) (* Trying to copy to a non NoteCard stream) (NC.PrintMsg Window NIL (CONCAT "Tried to copy a NoteCards link icon" " to a non-NoteCards stream." (CHARACTER 13))) (NC.CoerceToExternalPutLinkIcon ImageObjectCopy SourceCard DestinationCard Label) (RETURN NIL)) ((NULL (NC.LinksSupportedP NewSourceCard (QUOTE (Local)))) (NC.PrintMsg Window NIL (CONCAT "Tried to copy a NoteCards link icon" " to a NoteCard that" " does not support links!!." (CHARACTER 13) "Tsk. Tsk." (CHARACTER 13))) (COND (InTEditCopyFlg (RETFROM (QUOTE TEDIT.COPY) NIL T)) (T (RETURN (QUOTE DON'T))))) ((AND (FMEMB Label (QUOTE (FiledCard SubBox))) (NEQ (NC.RetrieveType NewSourceCard) (QUOTE FileBox))) (* Copy from filebox to non-filebox.) (NC.PrintMsg NIL NIL (CONCAT "Tried to copy filedcard or subbox link to a non-filebox." (CHARACTER 13) "Link type of copy set to 'Unspecified'." (CHARACTER 13))) (SETQ NewLabel NC.UnspecifiedLinkLabel) (SETQ NewDisplayMode (create LINKDISPLAYMODE copying OldDisplayMode SHOWTITLEFLG ← T SHOWLINKTYPEFLG ← T))) ((AND (NEQ (NC.RetrieveType SourceCard) (QUOTE FileBox)) (EQ (NC.RetrieveType NewSourceCard) (QUOTE FileBox))) (* Copy from non-filebox to filebox.) (NC.PrintMsg NIL NIL (CONCAT "Can't copy links from non-filebox to filebox." (CHARACTER 13) "Try using 'PutCardsHere'." (CHARACTER 13))) (COND (InTEditCopyFlg (RETFROM (QUOTE TEDIT.COPY) NIL T)) (T (RETURN (QUOTE DON'T))))) ((AND (FMEMB Label (QUOTE (FiledCard SubBox))) (EQ NewSourceCard SourceCard)) (* Copy within same filebox.) (NC.PrintMsg NIL NIL (CONCAT "Can't copy links within a FileBox. Try move instead." (CHARACTER 13))) (COND (InTEditCopyFlg (RETFROM (QUOTE TEDIT.COPY) NIL T)) (T (RETURN (QUOTE DON'T))))) ((AND (EQ (NC.RetrieveType NewSourceCard) (QUOTE FileBox)) (for Link1 in (NC.FetchToLinks NewSourceCard) thereis (AND (NC.ChildLinkP Link1) (EQ DestinationCard (fetch (Link DestinationCard) of Link1))))) (* Copy to a filebox already containing this child.) (NC.PrintMsg NIL NIL (CONCAT (NC.RetrieveTitle DestinationCard) " not copied: already appears as a child of " (NC.RetrieveTitle NewSourceCard) (CHARACTER 13))) (COND (InTEditCopyFlg (RETFROM (QUOTE TEDIT.COPY) NIL T)) (T (RETURN (QUOTE DON'T))))) ((AND (EQ Label (QUOTE SubBox)) (OR (EQ NewSourceCard DestinationCard) (NOT (NC.NotDaughterP DestinationCard NewSourceCard (FUNCTION NC.ChildLinkP))))) (* Copy to a filebox causes a cycle.) (NC.PrintMsg NIL NIL (CONCAT "Couldn't copy " Link " because of subbox cycle." (CHARACTER 13))) (COND (InTEditCopyFlg (RETFROM (QUOTE TEDIT.COPY) NIL T)) (T (RETURN (QUOTE DON'T))))) ((AND (FMEMB Label NC.SystemLinkLabels) (NOT (FMEMB Label (QUOTE (FiledCard SubBox)))) (NEQ NewSourceCard SourceCard)) (* Copy of system link outside of own card.) (NC.PrintMsg NIL NIL (CONCAT "Tried to copy system link." (CHARACTER 13) "Link type of copy set to 'Unspecified'." (CHARACTER 13))) (SETQ NewLabel NC.UnspecifiedLinkLabel) (SETQ NewDisplayMode (create LINKDISPLAYMODE copying OldDisplayMode SHOWTITLEFLG ← T SHOWLINKTYPEFLG ← T)))) (NC.FillInLinkIcon ImageObjectCopy (OR NewLabel Label) DestinationCard NewSourceCard (OR NewDisplayMode OldDisplayMode) (NC.LinkAtCharPos InsertPos ToTextStream))))) (NC.LinkIconWhenMovedFn (LAMBDA (ImageObject ToWindowStream FromTextStream ToTextStream) (* fgh: "30-Jun-86 23:27") (* * Called when moving a link icon from FromTextStream to ToWindowStream. Sets the necessary link information up for card corresponding to ToWindowStream.) (* * rht 11/18/84: Major hacking. Now checks for all sorts of illegal cases. Either goes ahead with move, converts link type to "Unspecified", or deletes the new "invisible" link. The code is very similar to NC.LinkIconWhenCopiedFn except that within-filebox moves are allowed. Also when aborting a move, we must insert a copy of the link back to take the place of the deleted original. This will all change when imageobj fns can return DON'T.) (* * rht 12/12/84: Now just RETFROM's rather than doing the addprocess stuff. Should be cleaner, but still ugly.) (* * kirk 15Nov85: deleted use of PSA.Database) (* * rht 3/24/86: Changed call to NC.CoerceToID to NC.CoerceToCard) (* * kirk 24Mar86: added Dave Newman patch to avoid duplicate links in sketch cards) (LET (Label (Link (NC.FetchLinkFromLinkIcon ImageObject)) SourceCard DestinationCard NewSourceCard NewLabel NewDisplayMode OldDisplayMode (Window (AND ToWindowStream (WFROMDS ToWindowStream T))) InsertPos) (SETQ Label (fetch (Link Label) of Link)) (SETQ NewSourceCard (COND ((WINDOWP Window) (NC.CoerceToCard Window)) ((TEXTSTREAMP ToTextStream) (NC.CoerceToCard ToTextStream)))) (SETQ SourceCard (fetch (Link SourceCard) of Link)) (SETQ DestinationCard (fetch (Link DestinationCard) of Link)) (SETQ OldDisplayMode (fetch (Link DisplayMode) of Link)) (* * If we are copying across NoteFiles, then its an error) (if (AND NewSourceCard (NOT (NC.SameNoteFileP (fetch (Card NoteFile) of SourceCard) (fetch (Card NoteFile) of NewSourceCard)))) then (NC.PrintMsg Window T "Cannot move links between cards from different NoteFiles." (CHARACTER 13) "Move aborted." (CHARACTER 13)) (ERROR!)) (COND ((AND (NULL FromTextStream) (NULL ToTextStream)) (* We must be moving within a sketch.) (SETQ NewSourceCard SourceCard)) ((TEXTSTREAMP ToTextStream) (* If it's a text copy, then compute position to insert link at.) (SETQ InsertPos (NC.CharPosFromTextObject (TEXTOBJ ToTextStream))))) (COND ((NULL NewSourceCard) (* Trying to copy to a non NoteCard stream) (NC.PrintMsg Window NIL (CONCAT "Tried to move a NoteCards link icon" " to a non-NoteCards stream!!." (CHARACTER 13) "Tsk. Tsk." (CHARACTER 13))) (RETFROM (QUOTE TEDIT.MOVE) NIL T)) ((NULL (NC.LinksSupportedP NewSourceCard (QUOTE (Local)))) (NC.PrintMsg Window NIL (CONCAT "Tried to move a NoteCards link icon" " to a NoteCard that" " does not support links!!." (CHARACTER 13) "Tsk. Tsk." (CHARACTER 13))) (RETFROM (QUOTE TEDIT.MOVE) NIL T)) ((AND (FMEMB Label (QUOTE (FiledCard SubBox))) (NEQ (NC.RetrieveType NewSourceCard) (QUOTE FileBox))) (* Move from filebox to non-filebox.) (NC.PrintMsg NIL NIL (CONCAT "Tried to move filedcard or subbox link to a non-filebox." (CHARACTER 13) "Link type of copy set to 'Unspecified'." (CHARACTER 13))) (SETQ NewLabel NC.UnspecifiedLinkLabel) (SETQ NewDisplayMode (create LINKDISPLAYMODE copying OldDisplayMode SHOWTITLEFLG ← T SHOWLINKTYPEFLG ← T)) ) ((AND (NEQ (NC.RetrieveType SourceCard) (QUOTE FileBox)) (EQ (NC.RetrieveType NewSourceCard) (QUOTE FileBox))) (* Move from non-filebox to filebox.) (NC.PrintMsg NIL NIL (CONCAT "Can't move links from non-filebox to filebox." (CHARACTER 13) "Try using PutCardsHere." (CHARACTER 13))) (RETFROM (QUOTE TEDIT.MOVE) NIL T)) ((AND (EQ (NC.RetrieveType NewSourceCard) (QUOTE FileBox)) (NEQ NewSourceCard SourceCard) (for Link1 in (NC.FetchToLinks NewSourceCard) thereis (AND (NC.ChildLinkP Link1) (EQ DestinationCard (fetch (Link DestinationCard) of Link1))))) (* Move to a filebox already containing this child.) (NC.PrintMsg NIL NIL (CONCAT (NC.RetrieveTitle DestinationCard) " not moved: already appears as a child of " (NC.RetrieveTitle NewSourceCard) (CHARACTER 13))) (RETFROM (QUOTE TEDIT.MOVE) NIL T)) ((AND (EQ Label (QUOTE SubBox)) (NEQ NewSourceCard SourceCard) (OR (EQ NewSourceCard DestinationCard) (NOT (NC.NotDaughterP DestinationCard NewSourceCard (FUNCTION NC.ChildLinkP))))) (* Move to a filebox causes a cycle.) (NC.PrintMsg NIL NIL (CONCAT "Couldn't move " Link " because of subbox cycle." (CHARACTER 13))) (RETFROM (QUOTE TEDIT.MOVE) NIL T)) ((AND (FMEMB Label NC.SystemLinkLabels) (NOT (FMEMB Label (QUOTE (FiledCard SubBox)))) (NEQ NewSourceCard SourceCard)) (* Move of system link outside of own card.) (NC.PrintMsg NIL NIL (CONCAT "Tried to copy system link." (CHARACTER 13) "Link type of copy set to 'Unspecified'." (CHARACTER 13))) (SETQ NewLabel NC.UnspecifiedLinkLabel) (SETQ NewDisplayMode (create LINKDISPLAYMODE copying OldDisplayMode SHOWTITLEFLG ← T SHOWLINKTYPEFLG ← T)) )) (IMAGEOBJPROP ImageObject (QUOTE LinkBeingMoved) Link) (if (NEQ (QUOTE Sketch) (fetch (Card Type) of SourceCard)) then (NC.FillInLinkIcon ImageObject (OR NewLabel Label) DestinationCard NewSourceCard (OR NewDisplayMode OldDisplayMode) (NC.LinkAtCharPos InsertPos ToTextStream)))))) (NC.LinkIconWhenDeletedFn (LAMBDA (ImageObject Stream) (* rht: " 6-Jul-86 15:13") (* * When deleting a link icon image object from a card, make sure the link information on the source and destinmation cards get updated. When deleting a link image object from a prop list editor, just inform the user that this is a useless operation.) (* * rht 11/19/84: Now handles the case when a move is in progress. True if the old link is cached on the ImageObj. Also changed so that SourceID is computed from ImageObject rather than from Stream. Similarly for the window.) (* * kirk 14Nov85: deleted use of PSA.Database) (* * fgh 5/2/86 Added code to handle deleting of links from ShowLinks editors.) (* * fgh 6/4/86 Added KLUDGE to take care of case when this is called under TEDIT.UNDO.MOVE) (* * rht 7/4/86: Now checks for readonly cards. Also passes checks for deleting from orphan card when calling NC.DeleteLink.) (LET ((Link (NC.FetchLinkFromLinkIcon ImageObject)) LinkType OldLink StkPtr SourceCard) (if (NC.CheckForNotReadOnly (fetch (Link SourceCard) of Link) NIL "Can't delete links in ") then (COND ((SETQ OldLink (IMAGEOBJPROP ImageObject (QUOTE LinkBeingMoved))) (NC.DelFromLink OldLink) (NC.DelToLink OldLink) (replace (Link UID) of OldLink with -1) (IMAGEOBJPROP ImageObject (QUOTE LinkBeingMoved) NIL)) ((SETQ StkPtr (STKPOS (QUOTE TEDIT.UNDO.MOVE))) (* * Called from TEDIT.UNDO.MOVE, don't relly want to delete the links. KLUDGE because TEDIT will not call the LinkIconInsertFn later on.) (RELSTK StkPtr) NIL) (T (* * if this is reversed source/dest {i.e., a From link} inside the show links editor, then return it to its original direction) (if (AND (IMAGEOBJPROP ImageObject (QUOTE InsidePropListEditor)) (LISTGET (fetch (Link UserData) of Link) (QUOTE Reversed))) then (SETQ Link (create Link using Link SourceCard ←(fetch (Link DestinationCard) of Link) DestinationCard ←(fetch (Link SourceCard) of Link)))) (* * Then just delete the link) (NC.CheckForOrphanDelete (SETQ SourceCard (fetch (Link SourceCard) of Link)) (fetch (Link DestinationCard) of Link)) (NC.DeleteLink Link (NC.SameCardP SourceCard (fetch (NoteFile OrphansCard) of (fetch (Card NoteFile) of SourceCard)))) (replace (Link UID) of Link with -1))) else (ERROR!))))) ) (* * Changes to NCINTERFACE) (DEFINEQ (NC.FileBrowserOpen (LAMBDA (Browser Key Item Menu Access) (* rht: " 4-Jul-86 19:15") (* * Function called from file browser menu for notefile open.) (* * rht 7/4/86: Added Access arg.) (for FileObject in (FB.SELECTEDFILES Browser) do (NC.OpenDatabaseFile (MKATOM (FB.FETCHFILENAME FileObject)) Access NIL NIL NIL NIL NIL NIL NIL NIL (fetch (FILEBROWSER PROMPTWINDOW) of Browser))))) (NC.DoNoteFileOp (LAMBDA (Op) (* rht: " 5-Jul-86 14:24") (* * Do a NoteFile op chosen from NC icon menu) (* * rht 7/2/86: Now calls NC.AbortSession with NC.NoteCardsIconWindow arg.) (* * rht 7/5/86: Added Read-only% Open entry.) (SELECTQ Op (Open% NoteFile (LET ((NoteFile (NC.ListOfNoteFilesMenu T NIL NC.NoteCardsIconWindow (QUOTE Open% NoteFile)))) (if (NULL NoteFile) then NIL else (if (EQ NoteFile (QUOTE NEW)) then (SETQ NoteFile NIL)) (NC.OpenDatabaseFile NoteFile NIL NIL NIL NIL NIL NIL NIL NIL NIL NC.NoteCardsIconWindow)))) (Read-only% Open (LET ((NoteFile (NC.ListOfNoteFilesMenu T NIL NC.NoteCardsIconWindow (QUOTE Open% NoteFile)))) (if (NULL NoteFile) then NIL else (if (EQ NoteFile (QUOTE NEW)) then (SETQ NoteFile NIL)) (NC.OpenDatabaseFile NoteFile (QUOTE INPUT) NIL NIL NIL NIL NIL NIL NIL NIL NC.NoteCardsIconWindow)))) (Checkpoint% NoteFile (LET ((NoteFile (NC.ListOfNoteFilesMenu NIL T NC.NoteCardsIconWindow (QUOTE Checkpoint% NoteFile)))) (if NoteFile then (NC.CheckpointDatabase NoteFile NIL NIL NIL NIL NC.NoteCardsIconWindow)))) (Close% NoteFile (LET ((NoteFile (NC.ListOfNoteFilesMenu NIL T NC.NoteCardsIconWindow (QUOTE Close% NoteFile)))) (if NoteFile then (NC.CloseDatabaseFile NoteFile NC.NoteCardsIconWindow)))) (Abort% NoteFile (LET ((NoteFile (NC.ListOfNoteFilesMenu NIL T NC.NoteCardsIconWindow (QUOTE Abort% NoteFile)))) (if NoteFile then (NC.AbortSession NoteFile NC.NoteCardsIconWindow)))) (Compact% NoteFile (LET ((NoteFile (NC.ListOfNoteFilesMenu T NIL NC.NoteCardsIconWindow (QUOTE Compact% NoteFile)))) (if (NULL NoteFile) then NIL else (if (EQ NoteFile (QUOTE NEW)) then (SETQ NoteFile NIL)) (NC.CompactNoteFile NoteFile NIL NIL NC.NoteCardsIconWindow)))) (Compact% In% Place (LET ((NoteFile (NC.ListOfNoteFilesMenu T NIL NC.NoteCardsIconWindow (QUOTE Compact% NoteFile)))) (if (NULL NoteFile) then NIL else (if (EQ NoteFile (QUOTE NEW)) then (SETQ NoteFile NIL)) (NC.CompactNoteFile NoteFile NIL T NC.NoteCardsIconWindow)))) (Inspect&Repair% NoteFile (LET ((NoteFile (NC.ListOfNoteFilesMenu T NIL NC.NoteCardsIconWindow (QUOTE Inspect&Repair% NoteFile)))) (if (NULL NoteFile) then NIL else (if (EQ NoteFile (QUOTE NEW)) then (SETQ NoteFile NIL)) (NC.ScavengerPhase1 NoteFile)))) (Read% Substances (LET ((NoteFile (NC.ListOfNoteFilesMenu T NIL NC.NoteCardsIconWindow (QUOTE Inspect&Repair% NoteFile)))) (if (NULL NoteFile) then NIL else (if (EQ NoteFile (QUOTE NEW)) then (SETQ NoteFile NIL)) (NC.ScavengerPhase1 NoteFile T)))) (Copy% NoteFile (LET ((NoteFile (NC.ListOfNoteFilesMenu T (QUOTE CLOSED) NC.NoteCardsIconWindow (QUOTE Copy% NoteFile)))) (if (NULL NoteFile) then NIL else (if (EQ NoteFile (QUOTE NEW)) then (SETQ NoteFile NIL)) (NC.CopyNoteFile NoteFile NIL NC.NoteCardsIconWindow))) ) (Rename% NoteFile (LET ((NoteFile (NC.ListOfNoteFilesMenu T (QUOTE CLOSED) (QUOTE Rename% NoteFile)) )) (if (NULL NoteFile) then NIL else (if (EQ NoteFile (QUOTE NEW)) then (SETQ NoteFile NIL)) (NC.RenameNoteFile NoteFile NIL NC.NoteCardsIconWindow) ))) (Delete% NoteFile (LET ((NoteFile (NC.ListOfNoteFilesMenu T (QUOTE CLOSED) (QUOTE Delete% NoteFile)) )) (if (NULL NoteFile) then NIL else (if (EQ NoteFile (QUOTE NEW)) then (SETQ NoteFile NIL)) (NC.DeleteDatabaseFile NoteFile NC.NoteCardsIconWindow)))) (Create% NoteFile (NC.CreateDatabaseFile NIL NIL NIL NIL NIL NIL NC.NoteCardsIconWindow)) NIL))) (NC.NoteFileOperations (LAMBDA (NoteFile) (* rht: " 5-Jul-86 16:49") (* Ask usere to choose which database operation. Called from main menu whenselected fn.) (* * fgh 11/14/85 Updated to handle NoteFile object and per NoteFile menus.) (* * kirk 14Jan86 Added Close/Delete cards and changed the format) (* * fgh 6/13/86 Now sets BusyOperation of NF menu to something interesting.) (* * kirk 3Jul86 passed NoteFileMenuWindow to NC.CompactNoteFile) (* * fgh 7/5/86 Fixed above fix and put NoteFileMenuWindow is all calls.) (* * rht 7/5/86: Added read-only open to notefileops menu.) (LET ((NoteFileMenu (fetch (NoteFile Menu) of NoteFile)) (Font NC.MenuFont) (FullFileName (fetch (NoteFile FullFileName) of NoteFile)) NoteFileMenuWindow Menu) (SPAWN.MOUSE) (SETQ NoteFileMenuWindow (WFROMMENU NoteFileMenu)) (OR (SETQ Menu (WINDOWPROP NoteFileMenuWindow (QUOTE DatabaseOperationsMenu))) (WINDOWPROP NoteFileMenuWindow (QUOTE DatabaseOperationsMenu) (SETQ Menu (create MENU ITEMS ←(BQUOTE ((Open (NC.OpenDatabaseFile , NoteFile NIL NIL NIL NIL NIL NIL NIL NIL NIL , NoteFileMenuWindow) "Opens this NoteFile." (SUBITEMS (Read-only% Open (NC.OpenDatabaseFile , NoteFile (QUOTE INPUT) NIL NIL NIL NIL NIL NIL NIL NIL , NoteFileMenuWindow) "Opens this NoteFile for read-only."))) (Checkpoint (NC.CheckpointDatabase , NoteFile NIL NIL NIL NIL , NoteFileMenuWindow) "Checkpoint this NoteFile, saving changed cards.") (Close (NC.CloseDatabaseFile , NoteFile , NoteFileMenuWindow) "Closes this NoteFile.") (Abort (NC.AbortSession , NoteFile) "Close NF, deleteing changes since last checkpoint.") (Compact (NC.CompactNoteFile , NoteFile NIL NIL , NoteFileMenuWindow) "Compacts a NoteFile to a target file." (SUBITEMS ( Compact% To% Target% File (NC.CompactNoteFile , NoteFile NIL NIL , NoteFileMenuWindow) "Compacts this NoteFile to a target file.") (Compact% In% Place (NC.CompactNoteFile , NoteFile NIL T , NoteFileMenuWindow) "Compacts this NoteFile in place."))) (Inspect&Repair (NC.InspectAndRepairNoteFile , NoteFile) "Inspects and optionally repairs this NoteFile." (SUBITEMS (Read% Substances ( NC.InspectAndRepairNoteFile , NoteFile T) "Inspects and optionally repairs a Notefile, but reads every substance. This slows it WAY down."))) (Copy (NC.CopyNoteFile , NoteFile NIL , NoteFileMenuWindow) "Copies this notefile to a target file.") (Rename (NC.RenameNoteFile , NoteFile) "Rename this NoteFile") (Delete (NC.DeleteDatabaseFile , FullFileName , NoteFileMenuWindow) "Deletes this NoteFile."))) CHANGEOFFSETFLG ←(QUOTE Y) MENUOFFSET ←(CONS -1 0) CENTERFLG ← NIL TITLE ← "NoteFile Ops" MENUTITLEFONT ← Font MENUFONT ← Font ITEMHEIGHT ←(IPLUS (FONTPROP Font (QUOTE HEIGHT)) 1) WHENSELECTEDFN ←(FUNCTION (LAMBDA (Item Menu Button) (WINDOWPROP (WFROMMENU (fetch (NoteFile Menu) of (GETMENUPROP Menu (QUOTE NoteFile))) ) (QUOTE BusyOperation) (CAR Item)) (DEFAULTWHENSELECTEDFN Item Menu Button))))))) (PUTMENUPROP Menu (QUOTE NoteFile) NoteFile) (MENU Menu)))) (NC.SetUpNoteFileInterface (LAMBDA (NoteFile Position) (* rht: " 5-Jul-86 16:18") (* * Create the NoteCards control menu for a NoteFile) (* * kirk 13Jan85 Decreased the size of the NoteFile Menu) (* * fgh 1/22/86 Fixed the ghost box size when position menu.) (* * rht 5/6/86: Now restores the menu's WhenSelectedFn and ungrays its items if already existed.) (* * fgh 6/27/86 Added position argument) (* * rht 7/5/86: Now shades NewCards if readonly notefile.) (LET ((Font (FONTCREATE (QUOTE HELVETICA) 10 (QUOTE BOLD))) (TitleFont (FONTCREATE (QUOTE HELVETICA) 12 (QUOTE BOLD))) NoteFileMenuWindow NoteFileMenu FullFileName) (* Main Menu) (SETQ FullFileName (fetch (NoteFile FullFileName) of NoteFile)) (if (SETQ NoteFileMenu (fetch (NoteFile Menu) of NoteFile)) then (for Item in (fetch (MENU ITEMS) of NoteFileMenu) do (SHADEITEM Item NoteFileMenu WHITESHADE)) (replace (MENU WHENSELECTEDFN) of NoteFileMenu with (FUNCTION NC.NoteFileMenuWhenSelectedFn)) (replace (MENU TITLE) of NoteFileMenu with (CONCAT (if ( NC.ReadOnlyNoteFileP NoteFile) then "RO: " else "") (FILENAMEFIELD FullFileName (QUOTE NAME)) ";" (FILENAMEFIELD FullFileName (QUOTE VERSION))) ) (replace (MENU IMAGE) of NoteFileMenu with NIL) (* KLUDGE. Fetching the image height forces the menu package to recompute the menu image.) (fetch (MENU IMAGEHEIGHT) of NoteFileMenu) (AND (WFROMMENU NoteFileMenu) (REDISPLAYW (WFROMMENU NoteFileMenu))) else (SETQ NoteFileMenu (create MENU ITEMS ←(QUOTE ((NewCards NIL "Create a new Text card (left button) or other card type (middle button).") (Show% Box NIL "Bring up one of the standard FileBoxes."))) WHENSELECTEDFN ←(FUNCTION NC.NoteFileMenuWhenSelectedFn) CENTERFLG ← T MENUBORDERSIZE ← 1 MENUOUTLINESIZE ← 2 MENUCOLUMNS ← 2 MENUFONT ← Font TITLE ←(CONCAT (if (NC.ReadOnlyNoteFileP NoteFile) then "RO: " else "") (FILENAMEFIELD FullFileName (QUOTE NAME)) ";" (FILENAMEFIELD FullFileName (QUOTE VERSION))) ITEMHEIGHT ←(IPLUS 6 (FONTPROP Font (QUOTE HEIGHT))) ITEMWIDTH ←(IPLUS (STRINGWIDTH (QUOTE NewCards) Font) 10) MENUTITLEFONT ← TitleFont))) (* Shade NewCards if readonly notefile.) (if (NC.ReadOnlyNoteFileP NoteFile) then (for Item in (fetch (MENU ITEMS) of NoteFileMenu) when (EQ (CAR Item) (QUOTE NewCards)) do (SHADEITEM Item NoteFileMenu GRAYSHADE))) (if (WINDOWP (SETQ NoteFileMenuWindow (WFROMMENU NoteFileMenu))) then (FLASHWINDOW NoteFileMenuWindow) else (SETQ NoteFileMenuWindow (ADDMENU NoteFileMenu NIL (GETMENUPROP NoteFileMenu (QUOTE OldPosition) )))) (WINDOWPROP NoteFileMenuWindow (QUOTE NoteFile) NoteFile) (replace (NoteFile Menu) of NoteFile with NoteFileMenu) (WINDOWPROP NoteFileMenuWindow (QUOTE RESHAPEFN) (QUOTE DON'T)) (WINDOWPROP NoteFileMenuWindow (QUOTE BUTTONEVENTFN) (FUNCTION NC.NoteFileIconButtonEventFn)) (WINDOWPROP NoteFileMenuWindow (QUOTE SHRINKFN) (QUOTE DON'T)) (WINDOWADDPROP NoteFileMenuWindow (QUOTE CLOSEFN) (FUNCTION (LAMBDA (Window) (PUTMENUPROP (CAR (WINDOWPROP Window (QUOTE MENU))) (QUOTE OldPosition) (WINDOWPOSITION Window))))) (NC.MoveWindowOntoScreen NoteFileMenuWindow)))) (NC.NoteFileMenuWhenSelectedFn (LAMBDA (Item Menu Button) (* rht: " 5-Jul-86 15:52") (* Function called when one of the items in the top level menu is chosen.) (* * fgh 11/14/85 Updated to handle NoteFile object and per NoteFile menus.) (* * kirk 18Jun86 Adopted to new smaller NoteFile icon) (* * fgh 6/26/86 Added lock to prevent conflicting operations.) (* * rht 7/5/86: Now greys NewCards menu item if readonly notefile.) (LET ((Window (WFROMMENU Menu)) NoteFile) (SETQ NoteFile (WINDOWPROP Window (QUOTE NoteFile))) (RESETLST (RESETSAVE (SHADEITEM Item Menu GRAYSHADE) (LIST (QUOTE SHADEITEM) Item Menu (if (AND (EQ (CAR Item) (QUOTE NewCards)) (NC.ReadOnlyNoteFileP NoteFile)) then GRAYSHADE else WHITESHADE))) (if (NULL (NC.NoteFileOpenP NoteFile)) then (NC.PrintMsg Window T "Can't." (CHARACTER 13) (fetch (NoteFile FullFileName) of NoteFile) " is not open." (CHARACTER 13)) elseif (PROCESSP (NC.NoteFileProp NoteFile (QUOTE ProcessInProgress))) then (NC.PrintOperationInProgressMsg Window (CAR Item) (NC.NoteFileProp NoteFile (QUOTE OperationInProgress))) NIL else (SELECTQ (CAR Item) (NewCards (COND ((EQ Button (QUOTE LEFT)) (NC.MakeNoteCard NC.DefaultCardType NoteFile) ) (T (NC.MakeNoteCard NIL NoteFile)))) (Show% Box (COND ((EQ Button (QUOTE LEFT)) (NC.EditNoteCard (fetch (NoteFile TableOfContentsCard) of NoteFile))) (T (NC.ChooseTopLevelCard NoteFile)))) NIL)))))) (NC.AttachNoteFileName (LAMBDA (CardWindow OffFlg) (* rht: " 5-Jul-86 16:27") (* * Attach an indicator of the NoteFile for this Card to the Card) (* * fgh 5/29/86 Changed collection of old attached windows to prevent NILs in collection result.) (* * fgh 6/13/86 Put detachment and reattachment of previous attached windows into a RESETLST. Added FREEATTACHEDWINDOW as the CLOSEFN of the indicator window. Added code to reset PASSTOMAINWINDOW COMS of the previously attachwed windows. Changed MINSIZE of indicator window to allow small fonts. Added a REPAINTFN to the indicator window.) (* * fgh 7/2/86 Replaced the CLEARW call in the indicator window REPAINTFN with a DSPRESET for two reasons: reset the X coor befre printining and CLEARW is not allowed in REPAINTFNS.) (* * fgh&rht 7/5/86: Changed the name "FileName" to "NameToPrint".) (LET ((Card (NC.CardFromWindow CardWindow)) AttachedWindows FileName Window) (if (NC.CardP Card) then (SETQ AttachedWindows (ATTACHEDWINDOWS CardWindow)) (if OffFlg then (CLOSEW (for window in AttachedWindows thereis (WINDOWPROP window (QUOTE NoteFileIndicator)))) (REPOSITIONATTACHEDWINDOWS CardWindow) else (TOTOPW CardWindow) (if (SETQ Window (for window in AttachedWindows thereis (WINDOWPROP window (QUOTE NoteFileIndicator)))) then (* * There already is an indicator window, open and redisplay it.) (OR (OPENWP Window) (OPENW Window)) (REDISPLAYW Window) else (* * No existing indicator window, make one.) (RESETLST (* * First arrange to have other attached windows removed and then replaced after the indicator window is made.) (RESETSAVE NIL (BQUOTE (, (FUNCTION (LAMBDA (DescriptionList) (* Reattach windows according to information in a description list.) (for windowDescription in DescriptionList do (ATTACHWINDOW (CAR windowDescription) CardWindow (CAADR windowDescription) (CADADR windowDescription)) (WINDOWPROP (CAR windowDescription) (QUOTE PASSTOMAINCOMS) (CADDR windowDescription))))) , (bind WA for window in AttachedWindows when (EQ (QUOTE TOP) (CAR (SETQ WA (WINDOWPROP window (QUOTE WHEREATTACHED))))) collect (* Detach attached windows at the top of the main window and retuirn a list describing their attachment.) (PROG1 (LIST window WA (WINDOWPROP window (QUOTE PASSTOMAINCOMS))) (DETACHWINDOW window)))))) (* * Make the indicator window.) (LET (NoteFile NameToPrint YSize IndicatorWindow) (SETQ NoteFile (fetch (Card NoteFile) of Card)) (SETQ NameToPrint (NC.MakeNoteFileNameIndicator NoteFile)) (SETQ YSize (HEIGHTIFWINDOW (OR (FONTPROP NC.NoteFileIndicatorFont (QUOTE HEIGHT)) 20))) (SETQ IndicatorWindow (CREATEW (CREATEREGION 0 0 100 YSize) NIL T)) (WINDOWPROP IndicatorWindow (QUOTE MAXSIZE) (CONS 1000 YSize)) (WINDOWPROP IndicatorWindow (QUOTE MINSIZE) (CONS 20 YSize)) (ATTACHWINDOW IndicatorWindow CardWindow (QUOTE TOP) (QUOTE JUSTIFY) (QUOTE LOCALCLOSE)) (WINDOWPROP IndicatorWindow (QUOTE BUTTONEVENTFN) (FUNCTION (LAMBDA (window) (INVERTW window) (NC.SetUpNoteFileInterface (fetch (Card NoteFile) of (NC.CardFromWindow (MAINWINDOW window)))) (INVERTW window)))) (WINDOWPROP IndicatorWindow (QUOTE NameToPrint) NameToPrint) (WINDOWADDPROP IndicatorWindow (QUOTE CLOSEFN) (FUNCTION FREEATTACHEDWINDOW) T) (WINDOWPROP IndicatorWindow (QUOTE REPAINTFN) (FUNCTION (LAMBDA (Window Region) (DSPRESET Window) (PRIN1 (WINDOWPROP Window (QUOTE NameToPrint) ) Window)))) (DSPFONT NC.NoteFileIndicatorFont IndicatorWindow) (PRIN1 NameToPrint IndicatorWindow) (OPENW IndicatorWindow) (WINDOWPROP IndicatorWindow (QUOTE NoteFileIndicator) (QUOTE Showing)))))))))) (NC.MakeNoteFileNameIndicator (LAMBDA (NoteFile) (* rht: " 5-Jul-86 16:25") (* * fgh&rht 7/5/86: Cleaned up and added check for readonly notefile.) (LET ((FullFileName (fetch (NoteFile FullFileName) of NoteFile))) (CONCAT (if (NC.ReadOnlyNoteFileP NoteFile) then "RO: " else "") (FILENAMEFIELD FullFileName (QUOTE NAME)) ";" (FILENAMEFIELD FullFileName (QUOTE VERSION)) " " FullFileName)))) ) (* * Take out all occurrences of the 1.2 relic NC.UnclassifiedID from NCINTERFACE) (* * Change the INITVARS of NC.FileBrowserMenuItems in NCINTERFACE to a VARS.) (* * Change NC.NoteFileOpsItems ADDVARS in NCINTERFACE as follows) (ADDTOVAR NC.NoteFileOpsItems (Open% NoteFile (NC.DoNoteFileOp (QUOTE Open% NoteFile)) "Opens a notefile." (SUBITEMS (Read-only% Open (NC.DoNoteFileOp (QUOTE Read-only% Open)) "Open a notefile for read-only."))) (Checkpoint% NoteFile (NC.DoNoteFileOp (QUOTE Checkpoint% NoteFile)) "Checkpoint a NoteFile") (Close% NoteFile (NC.DoNoteFileOp (QUOTE Close% NoteFile))) (Abort% NoteFile (NC.DoNoteFileOp (QUOTE Abort% NoteFile)) "Close NF, deleting changes since last checkpoint.") (Compact% NoteFile (NC.DoNoteFileOp (QUOTE Compact% NoteFile)) "Compact a NoteFile." (SUBITEMS (Compact% To% New% File (NC.DoNoteFileOp (QUOTE Compact% NoteFile) "Compact a NoteFile copying to a new file.")) (Compact% In% Place (NC.DoNoteFileOp (QUOTE Compact% In% Place) "Compact a NoteFile w/o copying to a new file.")))) (Inspect&Repair% NF (NC.DoNoteFileOp (QUOTE Inspect&Repair% NoteFile)) "Do an Inspect & Repair on a NoteFile." (SUBITEMS (Read% Substances (NC.DoNoteFileOp (QUOTE Read% Substances)) "Inspects and optionally repairs a Notefile, but reads every substance. This slows it WAY down."))) (Copy% NoteFile (NC.DoNoteFileOp (QUOTE Copy% NoteFile)) "Copy a NoteFile.") (Rename% NoteFile (NC.DoNoteFileOp (QUOTE Rename% NoteFile)) "Rename a NoteFile") (Delete% NoteFile (NC.DoNoteFileOp (QUOTE Delete% NoteFile)) "Delete a NoteFile") (Create% NoteFile (NC.DoNoteFileOp (QUOTE Create% NoteFile)) "Create a new NoteFile w/o opening it.")) (* * Change NC.FileBrowserMenuItemsToAdd VARS in NCINTERFACE as follows) (RPAQQ NC.FileBrowserMenuItemsToAdd ((Open NC.FileBrowserOpen "Open selected Notefiles." (SUBITEMS (Read-only% Open (NC.FileBrowserOpen INPUT) "Open selected Notefiles for read-only."))) (Checkpoint NC.FileBrowserCheckpoint "Checkpoint the selected Notefiles, saving dirty cards.") (Close NC.FileBrowserClose "Close selected Notefiles.") (Abort NC.FileBrowserAbort "Aborts the selected Notefiles losing work since last checkpoint.") (Compact NC.FileBrowserCompact "Compacts selected Notefiles to target files." (SUBITEMS (Compact% To% Target% File NC.FileBrowserCompact "Compacts selected Notefiles to target files.") (Compact% In% Place (NC.FileBrowserCompact (QUOTE InPlace)) "Compacts selected Notefiles in place."))) (Inspect&Repair NC.FileBrowserInspect&Repair "Inspects and optionally repairs selected Notefiles." (SUBITEMS (Read% Substances (NC.FileBrowserInspect&Repair (QUOTE ReadSubstances)) "Inspects and optionally repairs selected Notefiles, but reads every substance. This slows things WAY down." ))) (Copy FB.COPYCOMMAND "Copies given notefile(s) to target file (or directory).") (Rename FB.RENAMECOMMAND "Moves given notefile(s) to target file (or directory)."))) (* * Please don't integrate this stuff. Just for people loading this patch file.) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NC.FileBrowserMenuItems NC.FileBrowserMenuItemsToAdd NC.FileBrowserMenuItemsToKeep NC.FileBrowserRecomputeMenuItem NC.FileBrowserExpungeMenuItem NC.FileBrowserMenuItemsToRemove) ) (RPAQ NC.FileBrowserMenuItems (APPEND NC.FileBrowserMenuItemsToAdd (for MenuItem in FB.MENU.ITEMS when (FMEMB (CAR MenuItem) NC.FileBrowserMenuItemsToKeep) collect (if (EQ (CAR MenuItem) (QUOTE Recompute)) then NC.FileBrowserRecomputeMenuItem else MenuItem)) (LIST NC.FileBrowserExpungeMenuItem) (for MenuItem in FB.MENU.ITEMS unless (OR (FMEMB (CAR MenuItem) NC.FileBrowserMenuItemsToRemove) (FMEMB (CAR MenuItem) NC.FileBrowserMenuItemsToKeep)) collect MenuItem))) (PUTPROPS RHTPATCH052 COPYRIGHT ("Xerox Corporation" 1986)) (DECLARE: DONTCOPY (FILEMAP (NIL (6826 20208 (NC.ReadOnlyNoteFileP 6836 . 7149) (NC.CheckForNotReadOnly 7151 . 8077) ( NC.CheckpointDatabase 8079 . 12236) (NC.CloseDatabaseFile 12238 . 20206)) (20247 20950 ( NC.ReadOnlyCardP 20257 . 20552) (NC.CardSomehowDirtyP 20554 . 20948)) (20982 40309 (NC.QuitCard 20992 . 25295) (NC.CardSaveFn 25297 . 29800) (NC.MakeNoteCard 29802 . 33067) (NC.DeleteNoteCards 33069 . 35326) (NC.AssignTitle 35328 . 38232) (NC.AddParents 38234 . 40307)) (40347 42323 ( NC.FileBoxCollectChildren 40357 . 42321)) (42355 62585 (NC.MakeLink 42365 . 45348) ( NC.LinkIconWhenCopiedFn 45350 . 52671) (NC.LinkIconWhenMovedFn 52673 . 59590) ( NC.LinkIconWhenDeletedFn 59592 . 62583)) (62621 85108 (NC.FileBrowserOpen 62631 . 63192) ( NC.DoNoteFileOp 63194 . 68209) (NC.NoteFileOperations 68211 . 72525) (NC.SetUpNoteFileInterface 72527 . 77101) (NC.NoteFileMenuWhenSelectedFn 77103 . 79200) (NC.AttachNoteFileName 79202 . 84554) ( NC.MakeNoteFileNameIndicator 84556 . 85106))))) STOP