(FILECREATED " 8-Jun-87 18:18:57" {QV}<NOTECARDS>1.3K>NEXT>NCPROGINT.;42 142092 changes to: (FNS NCP.CardRegion NCP.RegisterCardByName NCP.LookupCardByName NCP.UnregisterName NCP.LocalGlobalLink NCP.CoerceToLinkDisplayMode NCP.CardAddProp NCP.GetLinks NCP.OpenNoteFile) (VARS NCPROGINTCOMS) previous date: "23-Apr-87 19:44:04" {QV}<NOTECARDS>1.3K>NEXT>NCPROGINT.;41) (* Copyright (c) 1984, 1985, 1986, 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT NCPROGINTCOMS) (RPAQQ NCPROGINTCOMS [(* * Notefile creation and access) (FNS NCP.CreateNoteFile NCP.OpenNoteFile NCP.OpenNoteFileP NCP.ListOfOpenNoteFiles NCP.CloseNoteFiles NCP.CheckpointNoteFiles NCP.AbortNoteFiles NCP.CompactNoteFile NCP.CompactNoteFileInPlace NCP.RepairNoteFile NCP.DeleteNoteFile NCP.NoteFileFromFileName NCP.FileNameFromNoteFile NCP.NoteFileMenu NCP.CheckInNoteFile NCP.CheckOutNoteFile NCP.LockFileName NCP.NumCardSlotsRemaining NCP.ExpandNoteFileIndex) (* * Creating and accessing NoteCard types and substances.) (FNS NCP.CardTypes NCP.CreateCardType NCP.CreateCardTypeStub NCP.ChangeCardTypeFields NCP.CardTypeSuper NCP.CardTypeLinkDisplayMode NCP.CardTypeFn NCP.CardTypeVar NCP.CardTypeP NCP.CardTypeFnP NCP.CardTypeVarP NCP.CardTypeFns NCP.CardTypeVars NCP.CardTypeDisplayedInMenu NCP.IsSubTypeOfP NCP.TextBasedP NCP.SketchBasedP NCP.GraphBasedP NCP.AutoLoadCardType NCP.AddSpecialCard NCP.RemoveSpecialCard) (MACROS NCP.ApplyCardTypeFn NCP.ApplySuperTypeFn) (* * Creating Notecards and fileboxes) (FNS NCP.CreateCard NCP.CreateTextCard NCP.CreateFileBox NCP.CreateBrowserCard NCP.CreateSketchCard NCP.CreateGraphCard NCP.MakeDocument NCP.MakeLinkIndex) (* * Opening, closing, activating, display, etc.) (FNS NCP.OpenCard NCP.CloseCards NCP.DisplayCard NCP.UndisplayCards NCP.CacheCards NCP.UncacheCards NCP.CardCachedP NCP.CardDisplayedP NCP.CardWindow NCP.WindowFromCard NCP.CardFromWindow NCP.CardFromTextStream) (* * Accessing cards and boxes) (FNS NCP.CardType NCP.ValidCardP NCP.CardTitle NCP.FileCards NCP.UnfileCards NCP.CardParents NCP.FileBoxChildren NCP.CardNeighbors NCP.GetLinks NCP.CardPropList NCP.CardProp NCP.CardAddProp NCP.CardDelProp NCP.CardSubstance NCP.CardRegion NCP.CardAddText NCP.ChangeLoc NCP.DeleteCards NCP.FileBoxP NCP.AllCards NCP.AllBoxes NCP.ContentsFileBox NCP.OrphansFileBox NCP.ToBeFiledFileBox NCP.NoteFileFromCard NCP.CardNoteFile NCP.SameCardP NCP.CoerceToCard NCP.DetermineDisplayRegion NCP.LockListOfCards) (MACROS NCP.MapCards NCP.MapCardsOfType) (MACROS NCP.WithLockedCards) (* * Collecting, copying, moving, deleting, cards) (FNS NCP.CollectCards NCP.CopyCards) (* * Creating and accessing links) (FNS NCP.CreateLink NCP.LocalGlobalLink NCP.GlobalGlobalLink NCP.GlobalLocalLink NCP.LocalLocalLink NCP.LinkDesc NCP.LinkDisplayMode NCP.LinkType NCP.LinkSource NCP.LinkDestination NCP.DeleteLinks NCP.ValidLinkP NCP.AllLinks NCP.SameLinkP NCP.LinkFromLinkIcon NCP.MakeLinkIcon NCP.MarkCardDirty) (MACROS NCP.MapLinks NCP.MapLinksOfType) (* * Creating and accessing link labels.) (FNS NCP.CreateLinkType NCP.DeleteLinkType NCP.RenameLinkType NCP.LinkTypes NCP.ReverseLinkTypes NCP.UserLinkTypes NCP.ValidLinkTypeP) (* * Dealing with card parts dates.) (RECORDS NOTECARDDATES) (FNS NCP.CardDates) (* * Open events card) (FNS NCP.GetOpenEventsCard NCP.GetCloseEventsCard NCP.MarkAsNotNeedingFiling) (* * Miscellaneous) (FNS NCP.TitleSearch NCP.PropSearch NCP.WhichCard NCP.WhichNoteFile NCP.SelectCards NCP.DocumentParameters NCP.NoteCardsParameters NCP.PrintMsg NCP.ClearMsg NCP.AskUser NCP.AskYesOrNo NCP.RegisterCardByName NCP.ListRegisteredCards NCP.LookupCardByName NCP.UnregisterName NCP.DisplayedCards NCP.CardUserDataProp NCP.NoteFileProp NCP.SetUpTitleBar NCP.AddNoteFileIconMiddleButtonItems NCP.NoteFileIconWindow) (P (MOVD (QUOTE NCP.WhichCard) (QUOTE NCP.WC) T) (MOVD (QUOTE NCP.WhichNoteFile) (QUOTE NCP.WNF) T)) (* * Handy internal functions) (FNS NCP.ReportError NCP.ReportWarning NCP.LinkAnchorDesc NCP.GetTypeRecord NCP.AddLeftButtonTitleBarMenuItems NCP.AddMiddleButtonTitleBarMenuItems NCP.CoerceToLinkDisplayMode) (* * Global variables.) (GLOBALVARS NCP.ErrorBrkWhenFlg NCP.LinkDisplayModes NCP.TypeFnsAssocLst NCP.NoteCardTypeFns NCP.NoteCardTypeVars NC.MakeDocParameters NC.CardTypes NC.SubstanceTypes NC.SystemLinkLabels NC.FiledCardLinkLabel NC.SubBoxLinkLabel NC.SelectingCardsMenu NC.SelectingCardMenu NC.UCASESystemLinkLabels NC.SourceLinkLabel NC.NoteCardsParameters) (INITVARS (NCP.ErrorBrkWhenFlg NIL)) [VARS (NCP.LinkDisplayModes (QUOTE (Icon Title Label Both))) (NCP.NoteCardTypeFns (QUOTE (MakeFn EditFn QuitFn GetFn PutFn CopyFn MarkDirtyFn DirtyPFn CollectLinksFn DeleteLinksFn UpdateLinkIconsFn InsertLinkFn TranslateWindowPositionFn))) (NCP.NoteCardTypeVars (QUOTE (SuperType StubFlg FullDefinitionFile LinkDisplayMode DefaultWidth DefaultHeight LinkAnchorModesSupported DisplayedInMenuFlg LinkIconAttachedBitMap LeftButtonMenuItems MiddleButtonMenuItems] (* * Following is for backward compatibility with 1.2) (P (MOVD (QUOTE NCP.OpenCard) (QUOTE NCP.BringUpCard) T) (MOVD (QUOTE NCP.CacheCards) (QUOTE NCP.ActivateCards) T) (MOVD (QUOTE NCP.CardCachedP) (QUOTE NCP.ActiveCardP) T) (MOVD (QUOTE NCP.CardTypeFnP) (QUOTE NCP.ValidCardTypeFn) T) (MOVD (QUOTE NCP.CardTypeP) (QUOTE NCP.ValidCardType) T) (MOVD (QUOTE NCP.CardTypeVarP) (QUOTE NCP.ValidCardTypeVar) T) (MOVD (QUOTE NCP.CloseCards) (QUOTE NCP.DeactivateCards) T) (MOVD (QUOTE NCP.ValidCardP) (QUOTE NCP.ValidCard) T) (MOVD (QUOTE NCP.ContentsFileBox) (QUOTE NCP.GetContentsFileBox) T) (MOVD (QUOTE NCP.OrphansFileBox) (QUOTE NCP.GetOrphansFileBox) T) (MOVD (QUOTE NCP.ToBeFiledFileBox) (QUOTE NCP.GetToBeFiledFileBox) T) (MOVD (QUOTE NCP.LinkSource) (QUOTE NCP.GetLinkSource) T) (MOVD (QUOTE NCP.LinkDestination) (QUOTE NCP.GetLinkDestination) T) (MOVD (QUOTE NCP.CreateLinkType) (QUOTE NCP.CreateLinkLabel) T) (MOVD (QUOTE NCP.DeleteLinkType) (QUOTE NCP.DeleteLinkLabel) T) (MOVD (QUOTE NCP.RenameLinkType) (QUOTE NCP.RenameLinkLabel) T) (MOVD (QUOTE NCP.LinkTypes) (QUOTE NCP.GetLinkLabels) T) (MOVD (QUOTE NCP.UserLinkTypes) (QUOTE NCP.GetUserLinkLabels) T) (MOVD (QUOTE NCP.ReverseLinkTypes) (QUOTE NCP.GetReverseLinkLabels) T) (MOVD (QUOTE NCP.ValidLinkTypeP) (QUOTE NCP.ValidLinkLabel) T) (MOVD (QUOTE NCP.ValidLinkP) (QUOTE NCP.ValidLink) T)) (DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDVARS (NLAMA) (NLAML) (LAMA NCP.NoteFileProp NCP.CardUserDataProp NCP.PrintMsg NCP.PropSearch NCP.LinkType NCP.LinkDisplayMode NCP.CardSubstance NCP.CardProp NCP.CardTitle NCP.CardTypeDisplayedInMenu]) (* * Notefile creation and access) (DEFINEQ (NCP.CreateNoteFile [LAMBDA (FileName QuietFlg) (* rht: " 2-Mar-87 21:58") (* * Prog intface function for creating a notefile.) (* * rht 11/16/86: Changed call to NCP.ReportError) (LET ((FileNameWithExt (NC.DatabaseFileName NIL NIL NIL NIL FileName))) (if (INFILEP FileNameWithExt) then (NCP.ReportError (QUOTE NCP.CreateNoteFile) (CONCAT "NCP.CreateNoteFile" "Filename " FileNameWithExt " already exists.")) NIL else (NC.CreateDatabaseFile FileNameWithExt NIL NIL NIL NIL NIL NIL QuietFlg) FileNameWithExt]) (NCP.OpenNoteFile [LAMBDA (NoteFileOrFileName Don'tCreateFlg Convertw/oConfirmFlg QuietFlg MenuPosition ReadOnlyFlg Don'tCreateInterfaceFlg) (* pmi: "20-May-87 18:35") (* * Prog's intface version of opening a notefile.) (* * rht 7/7/86: Now takes QuietFlg and MenuPosition arg. Takes either NoteFile object or file name.) (* * rht 7/16/86: Added ReadOnlyFlg arg.) (* * rht 7/26/86: Added Don'tCreateInterfaceFlg) (* * Fix to bug %#391: Now calls NC.OpenNoteFile instead of NC.OpenDatabaseFile.) (* * pmi 5/20/87: Removed HashArray argument in calls to NC.OpenNoteFile.) (if (type? NoteFile NoteFileOrFileName) then (NC.OpenNoteFile NoteFileOrFileName NIL NIL Don'tCreateFlg Convertw/oConfirmFlg NIL NIL Don'tCreateInterfaceFlg NIL NIL NIL MenuPosition QuietFlg (AND ReadOnlyFlg (QUOTE INPUT)) NIL) else (LET ((FileNameWithExt (NC.DatabaseFileName "Name of NoteFile to open:" " -- " T NIL NoteFileOrFileName))) (AND FileNameWithExt (NC.OpenNoteFile FileNameWithExt NIL Don'tCreateFlg Convertw/oConfirmFlg NIL NIL Don'tCreateInterfaceFlg NIL NIL NIL MenuPosition QuietFlg (AND ReadOnlyFlg (QUOTE INPUT)) NIL]) (NCP.OpenNoteFileP [LAMBDA (NoteFile) (* Newman "13-Nov-86 17:28") (* * Non-nil if NoteFile is an open notefile.) (* * rht 9/19/86: Fixed to return nil if notefile has no stream.) (* * dvn 11/13/86 Changed to call NC.NoteFileOpenP) (NC.NoteFileOpenP NoteFile]) (NCP.ListOfOpenNoteFiles (LAMBDA NIL (* rht: "19-Sep-86 22:52") (* * Return list of all currently open notefiles.) (* * rht 9/19/86: Fixed to return only notefiles currently open, not all that were ever open.) (for NoteFile in (NC.ListOfNoteFiles) when (NCP.OpenNoteFileP NoteFile) collect NoteFile))) (NCP.CloseNoteFiles [LAMBDA (NoteFilesOrT QuietFlg AutoConfirmFlg) (* Randy.Gobbel " 4-Mar-87 16:16") (* * Prog's intface function for closing a notefile.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 7/7/86: Now takes list of notefiles. If arg is T, then close all open notefiles.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * 11/16/86: Now calls NC.CloseNoteFile instead of NC.CloseDatabaseFile.) (* * rht 2/16/87: Now takes AutoConfirmFlg and passes to NC.CloseNoteFile.) (for NoteFile in (if (EQ NoteFilesOrT T) then (NCP.ListOfOpenNoteFiles) else (MKLIST NoteFilesOrT)) do (if (NOT (NCP.OpenNoteFileP NoteFile)) then (NCP.ReportError (QUOTE NCP.CloseNoteFiles) (CONCAT "Argument " NoteFile " is not a currently open notefile.")) NIL else (NC.CloseNoteFile NoteFile NIL QuietFlg]) (NCP.CheckpointNoteFiles [LAMBDA (NoteFilesOrT QuietFlg) (* rht: " 2-Mar-87 21:58") (* * Checkpoint the given notefiles. If T then checkpoint all open notefiles.) (* * rht 11/16/86: Changed call to NCP.ReportError) (for NoteFile in (if (EQ NoteFilesOrT T) then (NCP.ListOfOpenNoteFiles) else (MKLIST NoteFilesOrT)) do (if (NOT (NCP.OpenNoteFileP NoteFile)) then (NCP.ReportError (QUOTE NCP.CheckpointNoteFiles) (CONCAT "Argument " NoteFile " is not a currently open notefile.")) NIL else (NC.CheckpointDatabase NoteFile QuietFlg]) (NCP.AbortNoteFiles [LAMBDA (NoteFilesOrT Don'tConfirmFlg QuietFlg) (* rht: " 2-Mar-87 21:59") (* * Abort the given notefiles. If T then abort all open notefiles.) (* * rht 11/16/86: Changed call to NCP.ReportError) (for NoteFile in (if (EQ NoteFilesOrT T) then (NCP.ListOfOpenNoteFiles) else (MKLIST NoteFilesOrT)) do (if (NOT (NCP.OpenNoteFileP NoteFile)) then (NCP.ReportError (QUOTE NCP.AbortNotefiles) (CONCAT "Argument " NoteFile " is not a currently open notefile.")) NIL else (NC.AbortSession NoteFile NIL Don'tConfirmFlg QuietFlg]) (NCP.CompactNoteFile (LAMBDA (FromNoteFileOrFileName ToFileName InPlaceFlg) (* rht: " 7-Jul-86 19:23") (* * Prog's intface function for compacting a notefile. FromNoteFile can be either a NoteFile or a file name.) (NC.CompactNoteFile FromNoteFileOrFileName ToFileName InPlaceFlg))) (NCP.CompactNoteFileInPlace (LAMBDA (NoteFileOrFileName) (* rht: " 7-Jul-86 15:45") (* * Prog's intface function for compacting a notefile in place.) (NCP.CompactNoteFile NoteFileOrFileName NIL T))) (NCP.RepairNoteFile [LAMBDA (NoteFileOrFileName ReadSubstancesFlg) (* rht: " 2-Mar-87 22:08") (* * Prog's intface function for running inspect&repair on a notefile.) (* * rht 7/17/86: Now takes and passes ReadSubstancesFlg and calls NC.InspectAndRepairNoteFile instead of NC.ScavengerPhase1.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NCP.OpenNoteFileP NoteFileOrFileName) then (NCP.ReportError (QUOTE NCP.RepairNoteFile) (CONCAT "Can't inspect&repair an open notefile: " NoteFileOrFileName)) else (NC.InspectAndRepairNoteFile NoteFileOrFileName ReadSubstancesFlg]) (NCP.DeleteNoteFile [LAMBDA (NoteFileOrFileName Don'tConfirmFlg QuietFlg) (* pmi: "31-Mar-87 18:31") (* * Prog's intface function for deleting a notefile.) (* * pmi 3/31/97: Changed prompt from "Name of NoteFile to open:" to "Name of NoteFile to delete:") (if (type? NoteFile NoteFileOrFileName) then (NC.DeleteDatabaseFile NoteFileOrFileName NIL Don'tConfirmFlg QuietFlg) else (LET ((FileNameWithExt (NC.DatabaseFileName "Name of NoteFile to delete:" " -- " T NIL NoteFileOrFileName))) (AND FileNameWithExt (NC.DeleteDatabaseFile FileNameWithExt NIL Don'tConfirmFlg QuietFlg]) (NCP.NoteFileFromFileName (LAMBDA (FileName) (* rht: " 7-Jul-86 19:34") (* * Find notefile object for this filename, if any.) (NC.NoteFileFromFileName FileName))) (NCP.FileNameFromNoteFile [LAMBDA (NoteFile) (* rht: " 2-Mar-87 22:08") (* * Grab filename off of this notefile object.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NOT (type? NoteFile NoteFile)) then (NCP.ReportError (QUOTE NCP.FileNameFromNoteFile) (CONCAT "Arg to NCP.FileNameFromNoteFile is not a notefile: " NoteFile)) else (fetch (NoteFile FullFileName) of NoteFile]) (NCP.NoteFileMenu (LAMBDA (NoteFile) (* rht: "14-Jul-86 10:31") (* * Fetch the notefile's menu.) (AND (type? NoteFile NoteFile) (fetch (NoteFile Menu) of NoteFile)))) (NCP.CheckInNoteFile (LAMBDA (FromFile ToFile) (* rht: "19-Dec-84 20:22") (* * Check lock file for ToFile. If none, then just copy FromFile to ToFile. If there is one, then must be owned by us. If date of ToFile is more recent than date of lock file, then ask for user confirmation.) (PROG (LockFile User) (SETQ ToFile (NC.DatabaseFileName "Name of file to check in to: " "--" T T ToFile)) (COND ((SETQ LockFile (INFILEP (NCP.LockFileName ToFile))) (* lock file exists.) (COND ((EQ (GETFILEINFO LockFile (QUOTE LENGTH)) 0) (* Lock file is empty so delete it.) (DELFILE LockFile)) ((NEQ (USERNAME NIL T) (SETQ User (READ (SETQ LockFile (OR (OPENP LockFile (QUOTE INPUT)) (OPENFILE LockFile (QUOTE INPUT) (QUOTE OLD))))))) (* someone else is playing with it.) (PRIN1 (CONCAT "Can't check in because file was locked by " User " at " (GETFILEINFO LockFile (QUOTE WRITEDATE)) (CHARACTER 13) "To override, delete lock file and try again." (CHARACTER 13))) (CLOSEF LockFile) (RETURN NIL)) ((ILESSP (GETFILEINFO LockFile (QUOTE IWRITEDATE)) (GETFILEINFO ToFile (QUOTE IWRITEDATE))) (* Someone wrote the file since we locked it.) (PRIN1 (CONCAT "Can't check in because file was locked by " User " at " (GETFILEINFO LockFile (QUOTE WRITEDATE)) " but written by someone at " (GETFILEINFO ToFile (QUOTE WRITEDATE)) (CHARACTER 13) "To override, delete lock file and try again." (CHARACTER 13))) (RETURN NIL)) (T (* It's the lock file we wrote when checking out so just delete it.) (CLOSEF LockFile) (DELFILE LockFile))))) (SETQ FromFile (NC.DatabaseFileName "Name of file to check in from: " "--" T T FromFile)) (PRIN1 (CONCAT "Copying " FromFile " to " ToFile " ... ")) (COPYFILE FromFile ToFile) (PRIN1 (CONCAT "Done." (CHARACTER 13))) (RETURN (FULLNAME ToFile))))) (NCP.CheckOutNoteFile [LAMBDA (FromFile ToFile) (* Randy.Gobbel "18-Nov-86 15:42") (* * Copy FromFile to ToFile unless FromFile is locked. Create a lock file in FromFile's directory.) (* * rg 11/18/86: Replaced call to obsolete VERSIONNUMBER fn with FILENAMEFIELD) (PROG (LockFile User) (SETQ FromFile (NC.DatabaseFileName "Name of file to check out: " "--" T T FromFile)) LP (SETQ LockFile (NCP.LockFileName FromFile)) (COND [(INFILEP LockFile) (* lock file already exists.) (COND ((EQ (GETFILEINFO LockFile (QUOTE LENGTH)) 0) (* Lock file is empty. Delete and start over.) (DELFILE LockFile) (GO LP)) (T (* someone else already is playing with it.) [SETQ LockFile (OR (OPENP LockFile (QUOTE INPUT)) (OPENFILE LockFile (QUOTE INPUT) (QUOTE OLD] (SETQ User (READ LockFile)) (PRIN1 (CONCAT "File is locked by: " User (CHARACTER 13))) (CLOSEF LockFile) (RETURN NIL] [(SETQ LockFile (OPENFILE LockFile (QUOTE OUTPUT))) (COND ((EQ (FILENAMEFIELD LockFile (QUOTE VERSION)) 1) (PRINT (USERNAME NIL T) LockFile) (CLOSEF LockFile)) (T (* someone else created one before us. Delete this one and try again.) (DELFILE (CLOSEF LockFile)) (GO LP] (T (* something when wrong) (PRIN1 (CONCAT "Trouble in NC.CheckOutNoteFile." (CHARACTER 13))) (RETURN NIL))) (SETQ ToFile (NC.DatabaseFileName "Name of file to check out to: " "--" T T ToFile)) (PRIN1 (CONCAT "Copying " FromFile " to " ToFile " ... ")) (COPYFILE FromFile ToFile) (PRIN1 (CONCAT "Done." (CHARACTER 13))) (RETURN (FULLNAME ToFile]) (NCP.LockFileName (LAMBDA (FileName) (* rht: "19-Dec-84 12:09") (* returns the name of the lock file associated with FileName) (PACKFILENAME (LIST (QUOTE EXTENSION) (PACK* (FILENAMEFIELD FileName (QUOTE EXTENSION)) "LOCKFILE") (QUOTE VERSION) 1 (QUOTE BODY) FileName)))) (NCP.NumCardSlotsRemaining [LAMBDA (NoteFile) (* rht: "24-May-87 00:04") (* * Return the number of card slots remaining in NoteFile. After they run out, it will have to have its index expanded.) (if (NCP.OpenNoteFileP NoteFile) then (DIFFERENCE (fetch (NoteFile HashArraySize) of NoteFile) (NC.TotalCardsInNoteFile NoteFile)) else (NCP.ReportError (QUOTE NCP.NumCardSlotsRemaining) (CONCAT NoteFile " is not an open notefile."]) (NCP.ExpandNoteFileIndex [LAMBDA (NoteFile NumNewSlots QuietFlg) (* rht: "24-May-87 00:37") (* * Expand NoteFile's index in place after first checkpointing. Add room for NumNewSlots new slots.) (LET (WasOpenFlg) (if (SETQ WasOpenFlg (NCP.OpenNoteFileP NoteFile)) then (NCP.CheckpointNoteFiles NoteFile QuietFlg) else (NCP.OpenNoteFile NoteFile T NIL QuietFlg NIL NIL T)) (NC.ExpandIndexInPlace NoteFile (PLUS (fetch (NoteFile HashArraySize) of NoteFile) NumNewSlots) NIL NIL NIL QuietFlg) (OR WasOpenFlg (NCP.CloseNoteFiles NoteFile QuietFlg]) ) (* * Creating and accessing NoteCard types and substances.) (DEFINEQ (NCP.CardTypes (LAMBDA NIL (* rht: "26-Oct-84 17:06") (* * Return list of all known card type names.) (NC.ListOfCardTypes))) (NCP.CreateCardType [LAMBDA (TypeName SuperType FnsAssocList VarsAssocList) (* rht: "16-Nov-86 22:46") (* * Make a new card type. If there is already a card type by that name, then print message and overwrite.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 11/16/86: Changed call to NCP.ReportWarning) (if (FMEMB TypeName (NCP.CardTypes)) then (NCP.ReportWarning "NCP.CreateCardType" (CONCAT "Redefining NoteCard type: " TypeName))) (NC.AddCardType TypeName SuperType FnsAssocList VarsAssocList) TypeName]) (NCP.CreateCardTypeStub [LAMBDA (TypeName SuperType FullDefinitionFileName FnsAssocList VarsAssocList ListOfFILLMEFields) (* Randy.Gobbel "17-Dec-86 14:21") (* * Make a stub for a new card type. If there is already a card type by that name, then print message and overwrite.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rg 12/17/86: Added ListOfFILLMEFields argument.) (if (FMEMB TypeName (NCP.CardTypes)) then (NCP.ReportWarning "NCP.CreateCardTypeStub" (CONCAT "Redefining NoteCard type: " TypeName))) (NC.AddCardTypeStub TypeName SuperType FullDefinitionFileName FnsAssocList VarsAssocList ListOfFILLMEFields) TypeName]) (NCP.ChangeCardTypeFields [LAMBDA (TypeName FnsAssocList VarsAssocList) (* rht: " 2-Mar-87 22:08") (* * Change the given fields of TypeName.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NCP.CardTypeP TypeName) then (NC.RecomputeCardType TypeName FnsAssocList VarsAssocList) else (NCP.ReportError (QUOTE NCP.ChangeCardTypeFields) (CONCAT "Undefined card type: " TypeName]) (NCP.CardTypeSuper [LAMBDA (Type) (* rht: " 2-Mar-87 21:59") (* * Return the super type for this type.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NCP.CardTypeP Type) then (NC.GetCardTypeField SuperType Type) else (NCP.ReportError (QUOTE NCP.CardTypeSuper) (CONCAT Type " is not a loaded NoteCard type.")) NIL]) (NCP.CardTypeLinkDisplayMode [LAMBDA (Type) (* rht: " 2-Mar-87 21:59") (* * Return the link display mode for this type.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NCP.CardTypeP Type) then (NC.GetCardTypeField LinkDisplayMode Type) else (NCP.ReportError (QUOTE NCP.CardTypeLinkDisplayMode) (CONCAT Type " is not a loaded NoteCard type.")) NIL]) (NCP.CardTypeFn [LAMBDA (TypeName Fn) (* rht: " 2-Mar-87 22:09") (* * Return the function stored as the Fn for TypeName's record.) (* * rht 7/7/86: Replaced NIL DEC in RECORDACCESS call with RECLOOK) (* * rht 8/25/86: Changed RECORDACCESS to slightly less scuzzy call to NC.GetCardTypeField, the advantage is that the latter will force autoload if necessary.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NCP.CardTypeP TypeName) then (if (NCP.ValidCardTypeFn Fn) then (EVAL (BQUOTE (NC.GetCardTypeField , Fn TypeName))) else (NCP.ReportError (QUOTE NCP.CardTypeFn) (CONCAT Fn " is not a kind of Fn for NoteCard types."))) else (NCP.ReportError (QUOTE NCP.CardTypeFn) (CONCAT TypeName " is not a loaded NoteCard type.")) NIL]) (NCP.CardTypeVar [LAMBDA (TypeName Var) (* rht: " 2-Mar-87 22:09") (* * Return the variable stored as the Var for TypeName's record.) (* * kirk 26Feb86 Replaced NIL DEC in RECORDACCESS call with RECLOOK) (* * rht 8/25/86: Changed RECORDACCESS to slightly less scuzzy call to NC.GetCardTypeField, the advantage is that the latter will force autoload if necessary.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NCP.CardTypeP TypeName) then (if (NCP.ValidCardTypeVar Var) then (EVAL (BQUOTE (NC.GetCardTypeField , Var TypeName))) else (NCP.ReportError (QUOTE NCP.CardTypeVar) (CONCAT Var " is not a kind of Var for NoteCard types.")) ) else (NCP.ReportError (QUOTE NCP.CardTypeVar) (CONCAT TypeName " is not a loaded NoteCard type.")) NIL]) (NCP.CardTypeP (LAMBDA (TypeName) (* rht: "26-Oct-84 17:48") (* * Returns non-nil if this TypeName is an existing NoteCard type.) (AND (FMEMB TypeName (NC.ListOfCardTypes)) TypeName))) (NCP.CardTypeFnP (LAMBDA (CardTypeFn) (* rht: " 7-Jul-86 21:26") (* * Returns non-nil if CardTypeFn is one of the Fn fields of the NoteCardType record.) (AND (FMEMB CardTypeFn NCP.NoteCardTypeFns) CardTypeFn))) (NCP.CardTypeVarP (LAMBDA (CardTypeVar) (* rht: " 7-Jul-86 21:28") (* * Returns non-nil if CardTypeVar is one of the Var fields of the NoteCardType record.) (AND (FMEMB CardTypeVar NCP.NoteCardTypeVars) CardTypeVar))) (NCP.CardTypeFns (LAMBDA NIL (* rht: " 7-Jul-86 20:58") (* * Returns list of the fns fields of the NoteCardType record.) NCP.NoteCardTypeFns)) (NCP.CardTypeVars (LAMBDA NIL (* rht: " 7-Jul-86 20:59") (* * Returns list of the vars fields of the NoteCardType record.) NCP.NoteCardTypeVars)) (NCP.CardTypeDisplayedInMenu [LAMBDA Args (* rht: " 2-Mar-87 21:59") (* * Expects one or two args: CardType and optional new value for CardDisplayedInMenuFlg. Always returns the old value of CardDisplayedInMenuFlg for given card type.) (* * rht 7/15/86: Changed to call NCP.ChangeCardTypeFields) (* * rht 11/16/86: Changed call to NCP.ReportError) (LET (CardType OldVal) (if (OR (EQ Args 1) (EQ Args 2)) then (if (NCP.CardTypeP (SETQ CardType (ARG Args 1))) then [PROG1 (SETQ OldVal (NCP.CardTypeVar CardType (QUOTE DisplayedInMenuFlg))) (if (AND (EQ Args 2) (NEQ OldVal (EQ Args 2))) then (NCP.ChangeCardTypeFields CardType NIL (BQUOTE ((DisplayedInMenuFlg , (EQ Args 2] else (NCP.ReportError (QUOTE NCP.CardTypeDisplayedInMenu) (CONCAT CardType " is not a loaded NoteCard type.")) NIL) else (NCP.ReportError (QUOTE NCP.CardTypeDisplayedInMenu) "Improper number of args to NCP.CardTypeDisplayedInMenu.") NIL]) (NCP.IsSubTypeOfP [LAMBDA (SubTypeName SupposedSuperTypeName) (* rht: " 2-Mar-87 21:54") (* * Return non-nil if SubTypeName inherits somewhere up the hierarchy from SupposedSuperTypeName) (* * rht 8/19/86: Fixed typo bug.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht 3/2/87: No longer checks for valid card type, thus allowing autoloading if card type not currently loaded.) (NC.IsSubTypeOfP SubTypeName SupposedSuperTypeName]) (NCP.TextBasedP [LAMBDA (CardOrCardType) (* rht: " 2-Mar-87 21:55") (* * This card or card type is a subtype of Text.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht 3/2/87: No longer checks for valid card type, thus allowing autoloading if card type not currently loaded.) (LET ((CardType (if (NC.CardP CardOrCardType) then (NCP.CardType CardOrCardType) else CardOrCardType))) (NC.IsSubTypeOfP CardType (QUOTE Text]) (NCP.SketchBasedP [LAMBDA (CardOrCardType) (* rht: " 2-Mar-87 21:55") (* * This card type is a subtype of Sketch.) (* * rht 10/15/86: Fixed typo.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht 3/2/87: No longer checks for valid card type, thus allowing autoloading if card type not currently loaded.) (LET ((CardType (if (NC.CardP CardOrCardType) then (NCP.CardType CardOrCardType) else CardOrCardType))) (NC.IsSubTypeOfP CardType (QUOTE Sketch]) (NCP.GraphBasedP [LAMBDA (CardOrCardType) (* rht: " 2-Mar-87 21:54") (* * This card type is a subtype of Graph.) (* * rht 10/15/86: Fixed typo.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht 3/2/87: No longer checks for valid card type, thus allowing autoloading if card type not currently loaded.) (LET ((CardType (if (NC.CardP CardOrCardType) then (NCP.CardType CardOrCardType) else CardOrCardType))) (NC.IsSubTypeOfP CardType (QUOTE Graph]) (NCP.AutoLoadCardType (LAMBDA (TypeName) (* rht: "15-Jul-86 18:45") (* * Try to load the file containing TypeName looking in NOTECARDSDIRECTORIES.) (NC.AutoLoadCardType TypeName (QUOTE SuperType)))) (NCP.AddSpecialCard [LAMBDA (Card) (* rht: "23-Nov-86 13:33") (* * Adds this card to list of special cards hung off notefile's "SpecialCards" user data prop unless it's already there.) (LET ((NoteFile (NCP.CardNoteFile Card))) (if (for SpecialCard in (NCP.NoteFileProp NoteFile (QUOTE SpecialCards)) never (NCP.SameCardP Card SpecialCard)) then (NC.NoteFileAddProp NoteFile (QUOTE SpecialCards) Card]) (NCP.RemoveSpecialCard [LAMBDA (Card) (* rht: "20-Nov-86 15:07") (* * Removes this card from list of special cards hung off notefile's "SpecialCards" user data prop.) (NC.NoteFileDelProp (fetch (Card NoteFile) of Card) (QUOTE SpecialCards) Card (FUNCTION NC.SameCardP]) ) (DECLARE: EVAL@COMPILE (DEFMACRO NCP.ApplyCardTypeFn (Fn Card &REST Args) (* * Apply the cardtypefn Fn to Card and the rest of the args.) (BQUOTE (NC.ApplyFn , Fn , Card ,@ Args))) (DEFMACRO NCP.ApplySuperTypeFn (Fn Card &REST Args) (* * Apply the cardtypefn Fn of Card's super type to the given args.) (BQUOTE (NC.ApplySupersFn , Fn , Card ,@ Args))) ) (* * Creating Notecards and fileboxes) (DEFINEQ (NCP.CreateCard [LAMBDA (Type NoteFile Title NoDisplayFlg Props ParentFileBoxes TypeSpecificArgs) (* rht: " 2-Mar-87 22:09") (* * Creates a new notecard with given type, title, props and parents. Any of those args can be nil. Type being NIL will cause user to be asked. Makes a card with initially empty substance.) (* * rht 11/20/84: Had to add a horrible kluge: if creating a document card in which embedded links may be copied, then need to have document card visible on screen. This is because ID is currently unattainable from just the Textstream - need to have a window. Until that is fixed, we temporarily bring up the document card while it's being filled in.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 7/10/86: Ripped out the above described document kludge.) (* * rht 8/21/86: Now sticks (APPEND Props) on the card's proplist, i.e. a top level copy.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NCP.CardTypeP Type) then (LET (Card CardIdentifier) (if (SETQ CardIdentifier (NC.MakeNoteCard Type NoteFile Title NoDisplayFlg TypeSpecificArgs)) then (SETQ Card (if (WINDOWP CardIdentifier) then (NCP.CardFromWindow CardIdentifier) else CardIdentifier)) (if Props then (NC.SetPropList Card (APPEND Props)) (NC.SetPropListDirtyFlg Card T)) [for Box in (MKLIST ParentFileBoxes) do (if (NCP.FileBoxP Box) then (NCP.FileCards Card Box) else (NCP.ReportError (QUOTE NCP.CreateCard) (CONCAT Box " not an existing filebox."] Card)) else (NCP.ReportError (QUOTE NCP.CreateCard) (CONCAT "Unknown card type: " Type)) NIL]) (NCP.CreateTextCard (LAMBDA (NoteFile Title NoDisplayFlg Props ParentFileBoxes) (* rht: "18-Nov-85 01:13") (* * Creates a new TEXT notecard with given title, props and parents. Makes a card with initially empty textstream.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (NCP.CreateCard (QUOTE Text) NoteFile Title NoDisplayFlg Props ParentFileBoxes))) (NCP.CreateFileBox (LAMBDA (NoteFile Title NoDisplayFlg Props ChildCardsBoxes ParentFileBoxes) (* rht: "10-Jul-86 17:43") (* * Creates a new Filebox with given title, props, children and parents. Does not display the card, but does give it an initial textstream) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (LET ((Card (NCP.CreateCard (QUOTE FileBox) NoteFile Title NoDisplayFlg Props ParentFileBoxes))) (NCP.FileCards ChildCardsBoxes Card) Card))) (NCP.CreateBrowserCard [LAMBDA (NoteFile Title ParamList NoDisplayFlg Props ParentFileBoxes) (* rht: " 9-Mar-87 17:27") (* * Creates a new browser notecard with given type, title, props, parents, starting ID and link labels.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 8/21/86: Changed call from NCP.ValidLinkType to NCP.ValidLinkTypeP.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht 3/7/87: Now properly accepts link types with "←" prefixes.) (LET (ValidLinkTypes LinkTypes NewParamList) [SETQ ValidLinkTypes (for LinkType in (SETQ LinkTypes (LISTGET ParamList (QUOTE LINKTYPES)) ) join (COND ((EQ LinkType (QUOTE ALL)) (NCP.LinkTypes NoteFile)) ((EQ LinkType (QUOTE ←ALL)) (NCP.ReverseLinkTypes NoteFile)) ((OR (NCP.ValidLinkTypeP LinkType NoteFile) (AND (STREQUAL (SUBSTRING LinkType 1 1) "←") (NCP.ValidLinkTypeP (SUBATOM LinkType 2) NoteFile))) (LIST LinkType)) (T (NCP.ReportError (QUOTE NCP.CreateBrowserCard) (CONCAT LinkType " not a valid link type.")) NIL] (SETQ ValidLinkTypes (INTERSECTION ValidLinkTypes ValidLinkTypes)) (if (AND LinkTypes (NULL ValidLinkTypes)) then NIL else (* Make a copy of the user's param list since she may not want it to get rplaca'd.) (if ParamList then (SETQ NewParamList (COPY ParamList)) (LISTPUT NewParamList (QUOTE LINKTYPES) ValidLinkTypes) else (SETQ NewParamList (LIST (QUOTE LINKTYPES) ValidLinkTypes))) (NCP.CreateCard (QUOTE Browser) NoteFile Title NoDisplayFlg Props ParentFileBoxes NewParamList]) (NCP.CreateSketchCard (LAMBDA (NoteFile Title NoDisplayFlg Props ParentFileBoxes) (* rht: "18-Nov-85 01:15") (* * Creates a new SKETCH/MAP notecard with given title, props and parents.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (NCP.CreateCard (QUOTE Sketch) NoteFile Title NoDisplayFlg Props ParentFileBoxes))) (NCP.CreateGraphCard (LAMBDA (NoteFile Title NoDisplayFlg Props ParentFileBoxes) (* rht: "18-Nov-85 01:16") (* * Creates a new GRAPH notecard with given title, props and parents.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (NCP.CreateCard (QUOTE Graph) NoteFile Title NoDisplayFlg Props ParentFileBoxes))) (NCP.MakeDocument [LAMBDA (NoteFile RootCard ParamProps NoDisplayFlg Props ParentFileBoxes) (* rht: " 2-Mar-87 22:00") (* * Do a MakeDocument starting from RootCard according to parameters in ParamProps if non-nil. Otherwise use the default parameters. Note that ParamProps are *only* used for the duration of this MakeDocument and do not affect the default parameter values.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 8/25/86: Now passes non-nil QuietFlg to NCP.UncacheCards.) (* * rht 11/16/86: Changed call to NCP.ReportError) (LET (CurParams DocCard WasActive) (if (NC.ValidCardP RootCard) then (AND (NOT (SETQ WasActive (NCP.CardCachedP RootCard))) (NCP.CacheCards RootCard)) (if ParamProps then (SETQ CurParams (NCP.DocumentParameters ParamProps))) (SETQ DocCard (NCP.CreateCard (QUOTE Document) NoteFile NIL NoDisplayFlg Props ParentFileBoxes RootCard)) (if ParamProps then (SETPROPLIST (QUOTE NC.MakeDocParameters) CurParams)) (AND (NOT WasActive) (NCP.UncacheCards RootCard T)) DocCard else (NCP.ReportError (QUOTE NCP.MakeDocument) (CONCAT RootCard " not a valid card or filebox.")) NIL]) (NCP.MakeLinkIndex [LAMBDA (NoteFile LinkTypes BackPointersP NoDisplayFlg Props ParentFileBoxes) (* rht: " 2-Mar-87 22:00") (* * Do a MakeLinkIndex on LinkTypes inserting backpointers according to BackPointersP.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 11/16/86: Changed call to NCP.ReportError) (LET [(ValidLinkTypes (for LinkType in (MKLIST LinkTypes) join (COND ((EQ LinkType (QUOTE ALL)) (NCP.LinkTypes NoteFile)) ((EQ LinkType (QUOTE ←ALL)) (NCP.ReverseLinkTypes NoteFile)) ((NOT (NCP.ValidLinkType LinkType NoteFile)) (NCP.ReportError (QUOTE NCP.MakeLinkIndex) (CONCAT LinkType " not a valid link label.")) NIL) (T (LIST LinkType] (SETQ ValidLinkTypes (INTERSECTION ValidLinkTypes ValidLinkTypes)) (if (AND LinkTypes (NULL ValidLinkTypes)) then NIL else (NCP.CreateCard (QUOTE LinkIndex) NoteFile NIL NoDisplayFlg Props ParentFileBoxes (LIST ValidLinkTypes BackPointersP]) ) (* * Opening, closing, activating, display, etc.) (DEFINEQ (NCP.OpenCard [LAMBDA (Card Region/Position TypeSpecificArgs) (* rht: " 2-Mar-87 22:09") (* * Cache this card, if necessary, and display on the screen.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NC.ValidCardP Card) then [LET ((OldProc (TTY.PROCESS))) (PROG1 (NC.EditNoteCard Card Region/Position TypeSpecificArgs) (AND (PROCESSP OldProc) (TTY.PROCESS OldProc] else (NCP.ReportError (QUOTE NCP.OpenCard) (CONCAT Card " not an existing card or box."]) (NCP.CloseCards [LAMBDA (Cards QuietFlg) (* Randy.Gobbel " 2-Apr-87 16:59") (* * Uncache and undisplay any active cards in Cards) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht 3/9/87: Fixed so that wouldn't try to get PROCESS windowprop from NIL Win.) (* * rg 3/9/87 fixed args to NC.QuitCard ; added NC.ProtectedSessionOperation wrapper) (* * rg 4/2/87 changed NC.ProtectedSessionOperation to NCP.WithLockedCards ; added NC.IfAllCardsFree wrapper) (NCP.WithLockedCards (NC.IfAllCardsFree (NC.LockListOfCards (MKLIST Cards) "Close Cards") (for Card in (MKLIST Cards) bind Win (OldProc ← (TTY.PROCESS) ) do (if (NOT (NC.ValidCardP Card)) then (NCP.ReportError "NCP.CloseCards" (CONCAT Card " not an existing card or filebox.")) elseif (AND (NCP.CardCachedP Card) (NEQ (NC.QuitCard Card T NIL NIL NIL NIL QuietFlg) (QUOTE CANCELLED)) (SETQ Win (NC.FetchWindow Card))) then (bind [Process ← (AND Win (WINDOWPROP Win (QUOTE PROCESS] until (OR (NULL Process) (PROCESS.FINISHEDP Process)) do (BLOCK))) finally (AND (PROCESSP OldProc) (TTY.PROCESS OldProc)) (RETURN Card]) (NCP.DisplayCard [LAMBDA (Card Region/Position TypeSpecificArgs) (* rht: " 2-Mar-87 22:09") (* * display Card on the screen.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NC.ValidCardP Card) then (if (NCP.CardCachedP Card) then [LET ((OldProc (TTY.PROCESS))) (PROG1 (NC.EditNoteCard Card Region/Position TypeSpecificArgs) (AND (PROCESSP OldProc) (TTY.PROCESS OldProc] else (NCP.ReportError (QUOTE NCP.DisplayCard) (CONCAT Card " must be cached before displayed: NCP.DisplayCard."))) else (NCP.ReportError (QUOTE NCP.DisplayCard) (CONCAT Card " not an existing card or box."]) (NCP.UndisplayCards [LAMBDA (Cards QuietFlg WriteChangesFlg) (* Randy.Gobbel " 4-Mar-87 14:42") (* * If card is valid and displayed, then undisplay it but leave it cached. If WriteChangesFlg is non-nil, then save changes to the file, otherwise saving will wait until card is uncached.) (* * rht 11/16/86: Changed call to NCP.ReportError) (for Card in (MKLIST Cards) do [COND ((NOT (NC.ValidCardP Card)) (NCP.ReportError (QUOTE NCP.UndisplayCards) (CONCAT Card " not an existing card or filebox."))) ((NOT (NCP.CardDisplayedP Card)) (NCP.PrintMsg NIL T Card " already undisplayed: NCP.UndisplayCards")) (T (LET ((OldProc (TTY.PROCESS))) (PROG1 (NC.QuitCard Card T (NOT WriteChangesFlg) NIL NIL NIL QuietFlg T) (AND (PROCESSP OldProc) (TTY.PROCESS OldProc] finally (RETURN Card]) (NCP.CacheCards [LAMBDA (Cards) (* rht: " 2-Mar-87 22:01") (* * Cache all the info for any inactive cards in Cards) (* * rht 11/16/86: Changed call to NCP.ReportError) (for Card in (MKLIST Cards) do (COND ((NOT (NC.ValidCardP Card)) (NCP.ReportError (QUOTE NCP.CacheCards) (CONCAT Card " not an existing card or filebox."))) ((NCP.CardCachedP Card) (NCP.PrintMsg NIL T Card " already cached: NCP.CacheCards.")) (T (NC.GetNoteCard Card))) finally (RETURN Card]) (NCP.UncacheCards [LAMBDA (Cards QuietFlg) (* Randy.Gobbel " 4-Mar-87 14:43") (* * Uncache and undisplay any active cards in Cards) (* * rht 11/16/86: Changed call to NCP.ReportError) (for Card in (MKLIST Cards) do (COND ((NOT (NC.ValidCardP Card)) (NCP.ReportError (QUOTE NCP.UncacheCards) (CONCAT Card " not an existing card or filebox."))) ((NOT (NCP.CardCachedP Card)) (NCP.ReportError (QUOTE NCP.UncacheCards) (CONCAT Card " must be cached before can uncache."))) ((NCP.CardDisplayedP Card) (NCP.ReportError (QUOTE NCP.UncacheCards) (CONCAT Card " must be undisplayed before can uncache."))) (T (NC.QuitCard Card NIL NIL NIL NIL NIL QuietFlg]) (NCP.CardCachedP (LAMBDA (Card) (* rht: "10-Jul-86 21:57") (* * Return non-nil if card is cached.) (NC.ActiveCardP Card))) (NCP.CardDisplayedP (LAMBDA (Card) (* rht: "10-Jul-86 22:08") (* * Return non-nil if card is currently displayed on screen.) (AND (NCP.CardCachedP Card) (NCP.WindowFromCard Card)))) (NCP.CardWindow (LAMBDA (Card) (* rht: "18-Nov-85 17:43") (* * Returns T if card corresponding to Card is currently on the screen, i.e. has an active window.) (* * rht 11/18/85: Updated to handle new notefile and card object formats.) (AND (NC.ValidCardP Card) (NC.FetchWindow Card)))) (NCP.WindowFromCard (LAMBDA (Card) (* rht: "11-Jul-86 10:21") (* * Returns T if card corresponding to Card is currently on the screen, i.e. has an active window.) (NCP.CardWindow Card))) (NCP.CardFromWindow (LAMBDA (Win) (* rht: "10-Jul-86 22:10") (* * Return the card corresponding to Win, if Win is a notecard window.) (NC.CoerceToCard Win))) (NCP.CardFromTextStream (LAMBDA (TextStream) (* rht: "12-Jul-86 14:55") (* * Return the card corresponding to TextStream, if TextStream is a text card's textstream.) (NC.CoerceToCard TextStream))) ) (* * Accessing cards and boxes) (DEFINEQ (NCP.CardType (LAMBDA (Card) (* rht: "18-Nov-85 01:23") (* * Return the type of ID or NIL if no such ID.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (AND (NC.ValidCardP Card) (NC.RetrieveType Card)))) (NCP.ValidCardP (LAMBDA (Card) (* rht: "18-Nov-85 01:24") (* * Non-nil if ID corresponds to extant card in current notefile. Returns type of card or nil.) (NCP.CardType Card))) (NCP.CardTitle [LAMBDA Args (* rht: " 2-Mar-87 22:01") (* * Expects one or two args, the Card and an optional new title. If the latter is present then change the title of ID. In any case, return the old title.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 11/16/86: Changed call to NCP.ReportError) (LET (Card) (COND ((AND (NEQ Args 1) (NEQ Args 2)) (NCP.ReportError (QUOTE NCP.CardTitle) "Improper number of arguments to NCP.CardBoxTitle.") NIL) [(NC.ValidCardP (SETQ Card (ARG Args 1))) (PROG1 (NC.RetrieveTitle Card) (if (EQ Args 2) then (NC.AssignTitle Card NIL (ARG Args 2] (T (NCP.ReportError (QUOTE NCP.CardTitle) (CONCAT Card " not an existing card or box.")) NIL]) (NCP.FileCards [LAMBDA (CardBoxList BoxList) (* rht: " 2-Mar-87 22:01") (* * File every card or box in CardBoxList in every box in BoxList. Either arg can be an atom or list. Check for cycles.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 11/16/86: Changed call to NCP.ReportError) (SETQ CardBoxList (for Card in (MKLIST CardBoxList) unless (if (NOT (NC.ValidCardP Card)) then (NCP.ReportError (QUOTE NCP.FileCards) (CONCAT Card " not an existing card or box. Can't file.")) T) collect Card)) (SETQ BoxList (for Card in (MKLIST BoxList) unless (if (NOT (NCP.FileBoxP Card)) then (NCP.ReportError (QUOTE NCP.FileCards) (CONCAT Card " not an existing filebox. Can't be filed into.")) T) collect Card)) (if (AND BoxList CardBoxList) then (for Box in BoxList when (NC.FileBoxCollectChildren NIL Box CardBoxList T) collect Box) else NIL]) (NCP.UnfileCards [LAMBDA (CardBoxList BoxList) (* rht: " 2-Mar-87 22:01") (* * Unfile every card or box in CardBoxList from every box in BoxList. Either arg can be a litatom ID. Either can also be the litatom ALL. If CardBoxList is ALL then clear out all children from every element of BoxList. If BoxList is ALL then unlink all parents of every element of CardBoxList.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NEQ CardBoxList (QUOTE ALL)) then (SETQ CardBoxList (for Card in (MKLIST CardBoxList) unless (if (NOT (NC.ValidCardP Card)) then (NCP.ReportError (QUOTE NCP.UnfileCards) (CONCAT Card " not an existing card or box. Can't unfile.")) T) collect Card))) (if (NEQ BoxList (QUOTE ALL)) then (SETQ BoxList (for Card in (MKLIST BoxList) unless (if (NOT (NCP.FileBoxP Card)) then (NCP.ReportError (QUOTE NCP.UnfileCards) (CONCAT Card " not an existing filebox.")) T) collect Card))) [if (NEQ CardBoxList (QUOTE ALL)) then [if (EQ BoxList (QUOTE ALL)) then (* Unfile every element of CardBoxList from all its parents.) [for Card in CardBoxList do (NCP.DeleteLinks (NCP.GetLinks NIL Card (LIST NC.FiledCardLinkLabel NC.SubBoxLinkLabel] else (* Unfile every element of CardBoxList from a selection of its parents.) (for Card in CardBoxList do (for Box in BoxList do (NCP.DeleteLinks (NCP.GetLinks Box Card (LIST NC.FiledCardLinkLabel NC.SubBoxLinkLabel] else (if (EQ BoxList (QUOTE ALL)) then (SETQ BoxList (NCP.AllBoxes))) (for Box in BoxList do (NCP.DeleteLinks (NCP.GetLinks Box NIL (LIST NC.FiledCardLinkLabel NC.SubBoxLinkLabel] (AND CardBoxList BoxList]) (NCP.CardParents [LAMBDA (Card) (* rht: " 2-Mar-87 22:10") (* * Return the list of fileboxes in which Card has been filed.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NC.ValidCardP Card) then (for Link in (NCP.GetLinks NIL Card (LIST NC.FiledCardLinkLabel NC.SubBoxLinkLabel)) collect (fetch (Link SourceCard) of Link)) else (NCP.ReportError (QUOTE NCP.CardParents) (CONCAT Card " is not an existing card or filebox."]) (NCP.FileBoxChildren [LAMBDA (Box) (* rht: " 2-Mar-87 22:10") (* * Return the list of children of Box in proper order.) (* * rht 11/16/86: Changed call to NCP.ReportError) (COND ((NCP.FileBoxP Box) (for Link in (NCP.GetLinks Box NIL (LIST NC.FiledCardLinkLabel NC.SubBoxLinkLabel)) collect (fetch (Link DestinationCard) of Link))) (T (NCP.ReportError (QUOTE NCP.FileBoxChildren) (CONCAT Box " is not an existing filebox."]) (NCP.CardNeighbors (LAMBDA (Cards LinkTypes) (* rht: "11-Jul-86 14:26") (* * Return a list of cards one link from Card in the forward direction having some link of type in LinkTypes. LinkTypes can contain atoms starting with "←" in which case it's a backward link. LinkTypes can contain either or both of ANY and ←ANY, meaning to include any forward or backward links, respectively.) (if (NULL LinkTypes) then (for Link in (NCP.GetLinks Cards) collect (fetch (Link DestinationCard) of Link)) else (LET (ForwardLinkTypes BackwardLinkTypes) (for LinkType in (MKLIST LinkTypes) do (if (EQ (NTHCHAR LinkType 1) (QUOTE ←)) then (pushnew BackwardLinkTypes (SUBATOM LinkType 2)) else (pushnew ForwardLinkTypes LinkType))) (UNION (AND ForwardLinkTypes (for Link in (NCP.GetLinks Cards NIL (if (FMEMB (QUOTE ANY) ForwardLinkTypes) then NIL else ForwardLinkTypes)) collect (fetch (Link DestinationCard) of Link))) (AND BackwardLinkTypes (for Link in (NCP.GetLinks NIL Cards (if (FMEMB (QUOTE ANY) BackwardLinkTypes) then NIL else BackwardLinkTypes)) collect (fetch (Link SourceCard) of Link)))))))) (NCP.GetLinks [LAMBDA (Cards DestinationCards Labels NoteFile) (* rht: "29-May-87 16:48") (* * Returns a list of all links from Cards to DestinationCards whose link label is one of Labels. Labels can be nil, in which case all such links are returned. Cards and DestinationCards can each be atomic. Each can also be nil. For example, if DestinationCards is nil, then all links pointing from Cards to anywhere with given labels are returned. Note that if both Cards and DestinationCards are nil, then will return all links whose label is one of Labels. If all three args are nil, then return all links in the current notefile.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 8/29/86: Now blocks in loops and checks whether links cached before retrieving.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht&pmi 5/29/87: No longer has to uncache links because of change to NC.RetrieveFromLinks and NC.RetrieveToLinks.) (LET (ValidCards ValidDestinationCards) (SETQ Labels (MKLIST Labels)) (SETQ ValidCards (for Card in (MKLIST Cards) eachtime (BLOCK) unless (COND ((NOT (NC.ValidCardP Card)) (NCP.ReportError (QUOTE NCP.GetLinks) (CONCAT Card " not an existing card or box.")) T)) collect Card)) (SETQ ValidDestinationCards (for Card in (MKLIST DestinationCards) eachtime (BLOCK) unless (COND ((NOT (NC.ValidCardP Card)) (NCP.ReportError (QUOTE NCP.GetLinks) (CONCAT Card " not an existing card or box.")) T)) collect Card)) (COND (Cards (for Card in ValidCards eachtime (BLOCK) join (for Link in (NC.RetrieveToLinks Card) when (COND (DestinationCards (FMEMB (fetch (Link DestinationCard) of Link) ValidDestinationCards)) (T T)) when (COND (Labels (FMEMB (fetch (Link Label) of Link) Labels)) (T T)) collect Link))) (DestinationCards (for Card in ValidDestinationCards eachtime (BLOCK) join (for Link in (NC.RetrieveFromLinks Card) when (COND (Labels (FMEMB (fetch (Link Label) of Link) Labels)) (T T)) collect Link))) (T (NCP.MapLinks NoteFile (FUNCTION PROG1) (FUNCTION (LAMBDA (Link) (if Labels then (FMEMB (fetch (Link Label) of Link) Labels) else T]) (NCP.CardPropList (LAMBDA (Card) (* rht: "18-Nov-85 01:45") (* * Return the ID's property list) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (NC.RetrievePropList Card))) (NCP.CardProp [LAMBDA Args (* rht: " 2-Mar-87 22:02") (* * Expects two or three arguments: ID, Property, and optional new value. Returns the old value. Assigns the new value if given. Semantics are just like WINDOWPROP.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 11/16/86: Changed call to NCP.ReportError) (LET (Card PropList) (COND ((AND (NEQ Args 2) (NEQ Args 3)) (NCP.ReportError (QUOTE NCP.CardProp) (CONCAT "Improper number of args: " Args)) NIL) [(NC.ValidCardP (SETQ Card (ARG Args 1))) (PROG1 (LISTGET (SETQ PropList (NC.RetrievePropList Card)) (ARG Args 2)) (if (EQ Args 3) then [if PropList then (LISTPUT PropList (ARG Args 2) (ARG Args 3)) else (NC.SetPropList Card (LIST (ARG Args 2) (ARG Args 3] (if (NOT (NCP.CardCachedP Card)) then (NC.PutPropList Card) else (NC.SetPropListDirtyFlg Card T] (T (NCP.ReportError (QUOTE NCP.CardProp) (CONCAT Card " not an existing card or box.")) NIL]) (NCP.CardAddProp [LAMBDA (Card Property ItemToAdd) (* rht: "28-May-87 00:27") (* * Adds ItemToAdd to the value of ID's Property property. Returns the old value. Same semantics as WINDOWADDPROP.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht 5/28/87: Fixed bug reported by Mark Frisse. Now works if PropList is NIL, as for a new card.) (if (NC.ValidCardP Card) then (LET* ((PropList (NC.RetrievePropList Card)) (OldPropValue (LISTGET PropList Property))) (if (NOT (FMEMB ItemToAdd (MKLIST OldPropValue))) then [if PropList then (LISTPUT PropList Property (APPEND (MKLIST OldPropValue) (LIST ItemToAdd))) else (NC.SetPropList Card (BQUOTE (, Property (, ItemToAdd] (if (NOT (NCP.CardCachedP Card)) then (NC.PutPropList Card) else (NC.SetPropListDirtyFlg Card T))) OldPropValue) else (NCP.ReportError (QUOTE NCP.CardAddProp) (CONCAT Card " not an existing card or box.")) NIL]) (NCP.CardDelProp [LAMBDA (Card Property ItemToDelete) (* rht: " 2-Mar-87 22:02") (* * Deletes ItemToDelete from the Property prop of Card if it is there, returning the previous list. If it's not there, then return NIL. Same semantics as WINDOWDELPROP.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NC.ValidCardP Card) then (LET* ((PropList (NC.RetrievePropList Card)) (OldPropValue (LISTGET PropList Property))) (COND ((NLISTP OldPropValue) NIL) ((FMEMB ItemToDelete OldPropValue) (LISTPUT PropList Property (for Item in OldPropValue unless (EQ Item ItemToDelete) collect Item)) (if (NOT (NCP.CardCachedP Card)) then (NC.PutPropList Card) else (NC.SetPropListDirtyFlg Card T)) OldPropValue) (T NIL))) else (NCP.ReportError (QUOTE NCP.CardDelProp) (CONCAT Card " not an existing card or box.")) NIL]) (NCP.CardSubstance [LAMBDA Args (* rht: " 2-Mar-87 22:03") (* * Return the substance for this card.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 8/8/86: Now can accept one or two args. Always returns old substance, but will replace substance with second arg if present.) (* * 8/25/86: Now passes non-nil QuietFlg to NCP.CloseCards.) (* * rht 11/16/86: Changed call to NCP.ReportError) (LET (Card) (COND ((AND (NEQ Args 1) (NEQ Args 2)) (NCP.ReportError (QUOTE NCP.CardSubstance) (CONCAT "Improper number of args: " Args)) NIL) [(NCP.ValidCardP (SETQ Card (ARG Args 1))) (LET (WasActive) (OR (SETQ WasActive (NCP.CardCachedP Card)) (NCP.CacheCards Card)) (PROG1 (NC.FetchSubstance Card) (if (EQ Args 2) then (NC.SetSubstance Card (ARG Args 2)) (NCP.MarkCardDirty Card)) (OR WasActive (NCP.CloseCards Card T] (T (NCP.ReportError (QUOTE NCP.CardSubstance) (CONCAT Card " not an existing card.")) NIL]) (NCP.CardRegion [LAMBDA Args (* rht: "23-May-87 22:42") (* * Return the substance for this card.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 8/25/86: Now passes non-nil QuietFlg to NCP.UncacheCards.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht 5/23/87: Now takes optional second argument which should be new region for Card.) (LET (Card) (COND ((AND (NEQ Args 1) (NEQ Args 2)) (NCP.ReportError (QUOTE NCP.CardRegion) (CONCAT "Improper number of args: " Args)) NIL) [(NCP.ValidCardP (SETQ Card (ARG Args 1))) (LET (WasActive Region) (OR (SETQ WasActive (NCP.CardCachedP Card)) (NCP.CacheCards Card)) (PROG1 (NC.FetchRegion Card) [if (EQ Args 2) then (if (REGIONP (SETQ Region (ARG Args 2))) then (NC.SetRegion Card Region) (if (NCP.CardDisplayedP Card) then (SHAPEW (NCP.CardWindow Card) Region) else (NC.PutRegion Card)) else (NCP.ReportError (QUOTE NCP.CardRegion) (CONCAT Region " not a valid REGION."] (OR WasActive (NCP.CloseCards Card T] (T (NCP.ReportError (QUOTE NCP.CardRegion) (CONCAT Card " not an existing card.")) NIL]) (NCP.CardAddText [LAMBDA (Card Text Loc) (* rht: " 2-Mar-87 22:03") (* * Adds the Text to ID's window at the given Loc. Loc defaults to the current cursor position.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 8/25/86: Now passes non-nil QuietFlg to NCP.UncacheCards.) (* * rht 11/16/86: Changed call to NCP.ReportError) (PROG (WasActiveP) (if (NOT (NC.ValidCardP Card)) then (NCP.ReportError (QUOTE NCP.CardAddText) (CONCAT Card " is not an existing card or filebox.")) (RETURN NIL)) (if (NOT (NCP.TextBasedP (NCP.CardType Card))) then (NCP.ReportError (QUOTE NCP.CardAddText) "Can only add text to cards with type Text.") (RETURN NIL)) (if (NOT (SETQ WasActiveP (NCP.CardCachedP Card))) then (NCP.CacheCards Card)) (NCP.ChangeLoc Card Loc) (TEDIT.INSERT (NC.FetchSubstance Card) Text) (NC.MarkCardDirty Card) (if (NOT WasActiveP) then (NCP.UncacheCards Card T)) (RETURN Card]) (NCP.ChangeLoc [LAMBDA (Card Loc) (* rht: " 2-Mar-87 22:03") (* * Changes the location within ID's textstream to the new loc Loc. Loc can be the litatoms START or END, a number, or nil. The latter indicates to use the current cursor position. Note that we don't mark card as dirty just because its selection changed. Note that this leaves card active even if inactive when we were called.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (AND (NC.ValidCardP Card) (NCP.TextBasedP Card)) then (if (NOT (NCP.CardCachedP Card)) then (NCP.CacheCards Card)) (LET ((Stream (NC.FetchSubstance Card))) [SELECTQ Loc ((START 0) (TEDIT.SETSEL Stream 0 0 (QUOTE RIGHT))) (END (TEDIT.SETSEL Stream (ADD1 (fetch (TEXTOBJ TEXTLEN) of (TEXTOBJ Stream))) 0 (QUOTE RIGHT))) (AND (FIXP Loc) (GEQ Loc 0) (TEDIT.SETSEL Stream Loc 0 (QUOTE RIGHT] Card) else (NCP.ReportError (QUOTE NCP.ChangeLoc) (CONCAT Card " not an existing card or not TEdit based.")) NIL]) (NCP.DeleteCards [LAMBDA (Cards) (* rht: " 2-Mar-87 22:04") (* * Delete the given cards and boxes. Or just one, if Cards is atomic.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 11/7/86: Now passes flg args to NC.DeleteNoteCards to prevent confirm messages to user.) (* * rht 11/16/86: Changed call to NCP.ReportError) (SETQ Cards (for Card in (MKLIST Cards) unless (if (NOT (NC.ValidCardP Card)) then (NCP.ReportError (QUOTE NCP.DeleteCards) (CONCAT Card " is not an existing card or box.")) T) collect Card)) (AND Cards (NC.DeleteNoteCards Cards T NIL NIL T T]) (NCP.FileBoxP (LAMBDA (Card) (* rht: "18-Nov-85 01:58") (* * Return T if Card is a Filebox.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (EQ (NCP.CardType Card) (QUOTE FileBox)))) (NCP.AllCards (LAMBDA (NoteFile) (* rht: "18-Nov-85 18:19") (* * Return a list of IDs of all cards and boxes.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (NC.MapCards NoteFile (FUNCTION PROG1) (FUNCTION TRUE)))) (NCP.AllBoxes (LAMBDA (NoteFile) (* rht: "18-Nov-85 18:19") (* * Return a list of all existing fileboxes.) (* * rht 11/18/85: Updated to handle new notefile and card object formats.) (NC.MapCards NoteFile (FUNCTION PROG1) (FUNCTION NCP.FileBoxP)))) (NCP.ContentsFileBox (LAMBDA (NoteFile) (* rht: "18-Nov-85 02:13") (* * Return the top level contents file box.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (fetch (NoteFile TableOfContentsCard) of NoteFile))) (NCP.OrphansFileBox (LAMBDA (NoteFile) (* rht: "18-Nov-85 02:14") (* * Return the orphans contents file box.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (fetch (NoteFile OrphansCard) of NoteFile))) (NCP.ToBeFiledFileBox (LAMBDA (NoteFile) (* rht: "18-Nov-85 02:15") (* * Return the To be filed file box.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (fetch (NoteFile ToBeFiledCard) of NoteFile))) (NCP.NoteFileFromCard (LAMBDA (Card) (* rht: "12-Jul-86 16:22") (* * Get the card's notefile.) (AND (NC.ValidCardP Card) (fetch (Card NoteFile) of Card)))) (NCP.CardNoteFile (LAMBDA (Card) (* rht: "12-Jul-86 16:22") (* * Get the card's notefile.) (AND (NC.ValidCardP Card) (fetch (Card NoteFile) of Card)))) (NCP.SameCardP [LAMBDA (Card1 Card2) (* rht: " 2-Mar-87 22:10") (* * Returns non-nil if two cards are the same.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (AND (NCP.ValidCardP Card1) (NCP.ValidCardP Card2)) then (NC.SameCardP Card1 Card2) else (NCP.ReportError (QUOTE NCP.SameCardP) (CONCAT "Args not valid cards: " Card1 Card2]) (NCP.CoerceToCard (LAMBDA (CardIdentifier) (* rht: " 8-Aug-86 13:50") (* * Return the card object associated with CardIdentifier which can currently be any of a card object, window or text stream.) (NC.CoerceToCard CardIdentifier))) (NCP.DetermineDisplayRegion (LAMBDA (Card Region/Position) (* rht: " 8-Aug-86 12:09") (* * Returns the region that Card would occupy if displayed. If Region/Position not passed in, then checks previous size or default heights and widths for the card type. Also knows about BringUpCardAtPreviousPos.) (NC.DetermineDisplayRegion Card Region/Position))) (NCP.LockListOfCards [LAMBDA (CardIdentifiers Operation) (* Randy.Gobbel "23-Apr-87 14:57") (* * rg 4/23/87 created) (if (NOT (BOUNDP (QUOTE CardListResetVar))) then (NC.ReportError (QUOTE NCP.LockListOfCards) "NCP.LockListOfCards called without RESETLST wrapper")) (NC.LockListOfCards CardIdentifiers Operation]) ) (DECLARE: EVAL@COMPILE [DEFMACRO NCP.MapCards (NoteFile Function &OPTIONAL CollectResultPredicate) (* * Map down all notecards (including fileboxes) in NoteFile performing Function to each. If CollectResultPredicate is non-nil, then collect the results of applying Function to those cards satisfying CollectResultPredicate.) (* * rht 7/13/86: Now only works on non-deleted cards.) (* * rht 7/17/86: rearranged slightly.) (BQUOTE (NC.MapCards , NoteFile , [AND Function (BQUOTE (FUNCTION (LAMBDA (Card) (AND (NCP.ValidCardP Card) (APPLY* , Function Card] , (AND CollectResultPredicate (BQUOTE (FUNCTION (LAMBDA (Card) (AND (NCP.ValidCardP Card) (APPLY* , CollectResultPredicate Card] [DEFMACRO NCP.MapCardsOfType (Types NoteFile Function &OPTIONAL CollectResultPredicate) (* * Map down all fileboxes in the current notefile, performing Function to each. If CollectResultPredicate is non-nil, then collect the results of applying Function to those cards satisfying CollectResultPredicate.) (* * rht 7/12/86: Now takes arbitrary types to map over.) (* * rht 7/17/86: rearranged slightly.) (BQUOTE (NCP.MapCards , NoteFile , [AND Function (BQUOTE (FUNCTION (LAMBDA (Card) (AND (FMEMB (NCP.CardType Card) (MKLIST , Types)) (APPLY* (FUNCTION , Function) Card] , (AND CollectResultPredicate (BQUOTE (FUNCTION (LAMBDA (Card) (AND (FMEMB (NCP.CardType Card) (MKLIST , Types)) (APPLY* (FUNCTION , CollectResultPredicate) Card] ) (DECLARE: EVAL@COMPILE [DEFMACRO NCP.WithLockedCards (&BODY Body) (BQUOTE (LET (CardListResetVar) (NAMED-RESETLST CardListResetVar ,@ Body] ) (* * Collecting, copying, moving, deleting, cards) (DEFINEQ (NCP.CollectCards (LAMBDA (RootCards LinkTypes MaxDepth) (* rht: "29-Aug-86 21:20") (* * Starting from RootCards and following link of types in LinkTypes to a max depth of MaxDepth, collect and return all cards encountered. LinkTypes can contain backward links.) (* * rht 8/29/86: Now handles case of NULL MaxDepth. Also handles case when RootCards is single card instead of list.) (OR MaxDepth (SETQ MaxDepth 65535)) (if (LEQ MaxDepth 0) then RootCards else (for Depth from 1 to MaxDepth eachtime (BLOCK) bind (Fringe ← (MKLIST RootCards)) (Collection ← (APPEND (MKLIST RootCards))) do (SETQ Fringe (LDIFFERENCE (NCP.CardNeighbors Fringe LinkTypes) Collection)) (if (NULL Fringe) then (RETURN Collection) else (SETQ Collection (NCONC Fringe Collection))) finally (RETURN Collection))))) (NCP.CopyCards (LAMBDA (Cards DestNoteFileOrFileBox RootCards QuietFlg) (* rht: "12-Jul-86 17:12") (* * Make copies of Cards and all links among them, not including external links. RootCards should be a subset of Cards or nil. If nil, then all cards in Cards are considered roots. If DestNoteFileOrFileBox is a filebox, then all roots are filed in that box, otherwise, the contents box of the notefile is used.) (* * Note that all cards currently must be in the same notefile.) (NC.CopyCards Cards DestNoteFileOrFileBox RootCards QuietFlg))) ) (* * Creating and accessing links) (DEFINEQ (NCP.CreateLink [LAMBDA (Source Destination LinkType DisplayMode) (* rht: " 2-Mar-87 22:11") (* * Create a link from Source to Destination. Source can be a card or a list of two things; card and location spec. Location spec can be as in NCP.ChangeLoc documentation with the added option of the atom GLOBAL meaning that this should be a global link.) (LET (SourceLoc SourceCard) (COND ((NC.ValidCardP Source) (NCP.LocalGlobalLink LinkType Source Destination NIL DisplayMode)) ((OR [NOT (NC.ValidCardP (SETQ SourceCard (CAR Source] (NLISTP Source) (NULL (CDR Source))) (NCP.ReportError (QUOTE NCP.CreateLink) (CONCAT "'Source' arg is not either a card or a list of card and atom or num: " Source))) ((EQ (SETQ SourceLoc (CADR Source)) (QUOTE GLOBAL)) (NCP.GlobalGlobalLink LinkType SourceCard Destination)) ((OR (FMEMB (CADR Source) (QUOTE (START END NIL))) (FIXP SourceLoc)) (NCP.LocalGlobalLink LinkType SourceCard Destination SourceLoc DisplayMode)) (T (NCP.ReportError (QUOTE NCP.CreateLink) (CONCAT "'Source' arg is not either a card or a list of card and atom or num: " Source]) (NCP.LocalGlobalLink [LAMBDA (LinkType SourceCard DestinationCard FromLoc DisplayMode) (* rht: "27-May-87 11:12") (* * Create a link from within the text of the SourceCard card to the DestinationCard card.) (* * rht 4/1/85: Changed to handle old-style link display modes.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (* * rht 8/25/86: Now passes non-nil QuietFlg to NCP.UncacheCards.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht 5/27/87: Changed call to NCP.CoerceToLinkDisplayMode slightly.) (PROG ((CoercedDisplayMode (NCP.CoerceToLinkDisplayMode (OR DisplayMode SourceCard))) WasActive NoteFile) (if (NULL CoercedDisplayMode) then (NCP.ReportError (QUOTE NCP.LocalGlobalLink) (CONCAT DisplayMode " is invalid link display mode." (CHARACTER 13) "No link created.")) (RETURN NIL)) (if (EQ LinkType NC.FiledCardLinkLabel) then (if (AND (NOT (NCP.FileBoxP DestinationCard)) (NCP.FileBoxP SourceCard)) then (OR (SETQ WasActive (NCP.CardCachedP SourceCard)) (NCP.CacheCards SourceCard)) (NCP.ChangeLoc SourceCard FromLoc) (NCP.FileCards DestinationCard SourceCard) [RETURN (PROG1 (CAR (NCP.GetLinks SourceCard DestinationCard NC.FiledCardLinkLabel)) (OR WasActive (NCP.UncacheCards SourceCard T] else (NCP.ReportError (QUOTE NCP.LocalGlobalLink) (CONCAT "FiledCard link must be from a box to a card." (CHARACTER 13) "No link created.")) (RETURN NIL))) (if (EQ LinkType NC.SubBoxLinkLabel) then (if (AND (NCP.FileBoxP DestinationCard) (NCP.FileBoxP SourceCard)) then (OR (SETQ WasActive (NCP.CardCachedP SourceCard)) (NCP.CacheCards SourceCard)) (NCP.ChangeLoc SourceCard FromLoc) (NCP.FileCards DestinationCard SourceCard) [RETURN (PROG1 (CAR (NCP.GetLinks SourceCard DestinationCard NC.SubBoxLinkLabel)) (OR WasActive (NCP.UncacheCards SourceCard T] else (NCP.ReportError (QUOTE NCP.LocalGlobalLink) (CONCAT "SubBox link must be from a box to a box." (CHARACTER 13) "No link created.")) (RETURN NIL))) (* Inserting non-hierarchical link into a filebox.) (if (NCP.FileBoxP SourceCard) then (NCP.ReportError (QUOTE NCP.LocalGlobalLink) (CONCAT "Local links from fileboxes must be either SubBox or FiledCard." (CHARACTER 13) "No link created.")) (RETURN NIL)) (if [NOT (FMEMB LinkType (NCP.LinkTypes (SETQ NoteFile (fetch (Card NoteFile) of SourceCard] then (if (NC.AskYesOrNo (CONCAT "That link type hasn't been used in NoteFile " (fetch (NoteFile FullFileName) of NoteFile) (CHARACTER 13) "Want to create a new link type: " LinkType "? ") "--" NIL T (NC.AttachPromptWindow (WFROMMENU (fetch (NoteFile Menu) of NoteFile))) NIL NIL) then (NCP.CreateLinkType LinkType NoteFile) else (RETURN NIL))) (OR (SETQ WasActive (NCP.CardCachedP SourceCard)) (NCP.CacheCards SourceCard)) (AND FromLoc (NCP.ChangeLoc SourceCard FromLoc)) (RETURN (PROG1 (NC.InsertLinkInText (NC.FetchSubstance SourceCard) LinkType DestinationCard SourceCard CoercedDisplayMode) (OR WasActive (NCP.UncacheCards SourceCard T]) (NCP.GlobalGlobalLink [LAMBDA (LinkType FromCard ToCard) (* rht: " 2-Mar-87 22:04") (* * This builds a global link of type LinkType between FromCard and ToID. Complains if link type is system-defined with restricted semantics. If LinkType is brand new, then asks if user wants to create a new label by that name.) (* * rht 11/18/85: Updated to handle new notefile and card object formats.) (* * kirk 23Jan86 Changed to use NC.AskYesOrNo) (* * rht 11/16/86: Changed call to NCP.ReportError) (LET ((NoteFile (fetch (Card NoteFile) of FromCard)) LinkTypes) (SETQ LinkTypes (NCP.UserLinkTypes NoteFile)) (COND ((OR (EQ LinkType NC.SourceLinkLabel) (FMEMB LinkType LinkTypes)) (* * LinkType type is okay so create the link.) (NC.MakeGlobalLink NIL LinkType ToCard FromCard)) ((FMEMB (U-CASE LinkType) NC.UCASESystemLinkLabels) (NCP.ReportError (QUOTE NCP.GlobalGlobalLink) (CONCAT "Can't make a global-to-global link of type " LinkType ".")) NIL) ((NC.AskYesOrNo (CONCAT "That link type hasn't been used in this NoteFile." (CHARACTER 13) "Want to create a new link type: " LinkType "? ") "--" NIL T (NC.AttachPromptWindow (WFROMMENU (fetch (NoteFile Menu) of NoteFile))) NIL NIL) (NCP.CreateLinkType LinkType NoteFile) (* * LinkType type is okay so create the link.) (NC.MakeGlobalLink NIL LinkType ToCard FromCard)) (T NIL]) (NCP.GlobalLocalLink [LAMBDA (LinkType FromCard ToCard ToLoc) (* rht: " 2-Mar-87 22:11") (* * Builds a link from the FromID card as a whole to within the text of the ToID card.) (* * rht 11/16/86: Changed call to NCP.ReportError) (NCP.ReportError (QUOTE NCP.GlobalLocalLink) "Sorry, can't make global to local links yet."]) (NCP.LocalLocalLink [LAMBDA (LinkType FromCard ToCard FromLoc ToLoc) (* rht: " 2-Mar-87 22:11") (* * Builds a link from within the text of the FromID card to within the text of the ToID card.) (* * rht 11/16/86: Changed call to NCP.ReportError) (NCP.ReportError (QUOTE NCP.LocalLocalLink) "Sorry, can't make local to local links yet."]) (NCP.LinkDesc [LAMBDA (Link) (* rht: " 2-Mar-87 22:11") (* * Return a list structure which describes Link. It consists of (label <fromdesc> <todesc>) where <fromdesc> and <todesc> describe the anchoring of the link at each end. They each have the form: (<anchormode> <ID> <loc>)) (* * rht 11/16/86: Changed call to NCP.ReportError) (COND ((NCP.ValidLink Link) (LIST (fetch (Link Label) of Link) (NCP.LinkAnchorDesc Link NIL) (NCP.LinkAnchorDesc Link T))) (T (NCP.ReportError (QUOTE NCP.LinkDesc) (CONCAT "No such link: " Link]) (NCP.LinkDisplayMode [LAMBDA Args (* rht: " 2-Mar-87 22:05") (* * Takes either 1 or 2 args. The first is a link, the second an optional new link display mode. Return old display mode in any case; change mode if the second arg is present.) (* * rht 7/12/86: Now takes a list of three elements for new displaymode rather than an instance of the LINKDISPLAYMODE record. Also calls NCP.CoerceToLinkDisplayMode.) (* * rht 8/25/86: Now passes non-nil QuietFlg to NCP.UncacheCards.) (LET (Link NewMode WasActiveFlg SourceCard) (COND ((AND (NEQ Args 1) (NEQ Args 2)) (NCP.ReportError (QUOTE NCP.LinkDisplayMode) (CONCAT "Improper number of args: " Args)) NIL) [(NCP.ValidLink (SETQ Link (ARG Args 1))) (PROG1 (fetch (Link DisplayMode) of Link) (if (EQ Args 2) then (if (SETQ NewMode (NCP.CoerceToLinkDisplayMode (ARG Args 2))) then (OR [SETQ WasActiveFlg (NCP.CardCachedP (SETQ SourceCard (fetch (Link SourceCard) of Link] (NCP.CacheCards SourceCard)) (NC.ChangeLinkDisplayMode Link NIL NewMode) (OR WasActiveFlg (NCP.UncacheCards SourceCard T)) else (NCP.ReportError (QUOTE NCP.LinkDisplayMode) (CONCAT (ARG Args 2) " is invalid link display mode."] (T (NCP.ReportError (QUOTE NCP.LinkDisplayMode) (CONCAT Link " is not a valid link.")) NIL]) (NCP.LinkType [LAMBDA Args (* rht: " 2-Mar-87 22:05") (* * Takes either 1 or 2 args. The first is a link, the second an optional new label. Return old label in any case; change label if the second arg is present.) (* * rht 2/8/85: Now makes sure source card of link is active before calling NC.RelabelLink.) (* * rht 8/25/86: Now passes non-nil QuietFlg to NCP.UncacheCards.) (LET (Link NewLinkType SourceCard NoteFile) (COND ((AND (NEQ Args 1) (NEQ Args 2)) (NCP.ReportError (QUOTE NCP.LinkType) (CONCAT "Improper number of args: " Args)) NIL) [(NCP.ValidLink (SETQ Link (ARG Args 1))) (PROG1 (fetch (Link Label) Link) (if (EQ Args 2) then (COND ((FMEMB (SETQ NewLinkType (ARG Args 2)) NC.SystemLinkLabels) (NCP.ReportError (QUOTE NCP.LinkType) (CONCAT "Can't change label to a system label: " NewLinkType))) ((OR [FMEMB NewLinkType (NCP.LinkTypes (SETQ NoteFile (fetch (Card NoteFile) of (SETQ SourceCard (fetch (Link SourceCard) of Link] (AND (NC.AskYesOrNo (CONCAT "That link type hasn't been used in this NoteFile." (CHARACTER 13) "Want to create a new link type: " NewLinkType "? ") "--" NIL T NIL NIL NIL) (NCP.CreateLinkType NewLinkType NoteFile))) (if (NCP.CardCachedP SourceCard) then (NC.RelabelLink Link NIL NewLinkType T) else (NCP.CacheCards SourceCard) (NC.RelabelLink Link NIL NewLinkType T) (NCP.UncacheCards SourceCard T] (T (NCP.ReportError (QUOTE NCP.LinkType) (CONCAT Link " is not a valid link.")) NIL]) (NCP.LinkSource [LAMBDA (Link) (* rht: " 2-Mar-87 22:11") (* * Return the SOURCEID of Link.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NCP.ValidLink Link) then (fetch (Link SourceCard) of Link) else (NCP.ReportError (QUOTE NCP.LinkSource) (CONCAT Link " not an existing link."]) (NCP.LinkDestination [LAMBDA (Link) (* rht: " 2-Mar-87 22:11") (* * Return the DESTINATIONID of Link.) (* * rht 11/16/86: Changed call to NCP.ReportError) (COND ((NCP.ValidLink Link) (fetch (Link DestinationCard) of Link)) (T (NCP.ReportError (QUOTE NCP.LinkDestination) (CONCAT Link " not an existing link."]) (NCP.DeleteLinks [LAMBDA (Links) (* rht: " 2-Mar-87 22:11") (* * Delete each link in Links. If Links is one link, then just delete that one.) (* * rht 11/18/85: Updated to call new NC.DeleteLink function.) (* * rht 11/16/86: Changed call to NCP.ReportError) (for Link in (COND ((type? Link Links) (LIST Links)) (T Links)) do (if (NCP.ValidLink Link) then (NC.DeleteLink Link) else (NCP.ReportError (QUOTE NCP.DeleteLinks) (CONCAT "No such link: " Link]) (NCP.ValidLinkP (LAMBDA (Link) (* rht: "18-Jul-86 16:49") (* * True if Link is an extant link in current database.) (NC.ValidLinkP Link))) (NCP.AllLinks [LAMBDA (NoteFile) (* rht: "18-Feb-87 12:00") (* * Return a list of all links in the current database.) (* * rht 11/18/85: Updated to handle new notefile and card object formats. Note that it doesn't call NCONC to flatten the lists in case someone else is holding a pointer to the value returned by NC.RetrieveToLinks.) (* * rht 2/18/87: Changed to call MAPCONC instead of APPLY'ing APPEND. Note call to APPEND to prevent flatten'ing of original lists.) (MAPCONC (NC.MapCards NoteFile (FUNCTION NC.RetrieveToLinks) (FUNCTION TRUE)) (FUNCTION (LAMBDA (X) (APPEND X]) (NCP.SameLinkP [LAMBDA (Link1 Link2) (* rht: " 2-Mar-87 22:12") (* * Returns non-nil if two links are the same.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (AND (NCP.ValidLinkP Link1) (NCP.ValidLinkP Link2)) then (NC.SameCardP Link1 Link2) else (NCP.ReportError (QUOTE NCP.SameLinkP) (CONCAT "Args not valid links: " Link1 Link2]) (NCP.LinkFromLinkIcon (LAMBDA (LinkIcon) (* rht: " 8-Aug-86 12:14") (* * If LinkIcon is an image object for a link icon, return the associated link.) (if (NC.LinkIconImageObjP LinkIcon) then (IMAGEOBJPROP LinkIcon (QUOTE OBJECTDATUM))))) (NCP.MakeLinkIcon (LAMBDA (Link) (* rht: " 8-Aug-86 12:18") (* * Return a link icon image object for Link.) (NC.MakeLinkIcon Link))) (NCP.MarkCardDirty (LAMBDA (Card ResetFlg) (* rht: "10-Sep-86 15:39") (* * Mark Card's substance as dirty thus forcing it to be written down at the next save. If ResetFlg is non-nil, then unmark it as dirty.) (* * rht 9/10/86: Fixed typo. Card wasn't being passed to NC.MarkCardDirty.) (NC.MarkCardDirty Card ResetFlg))) ) (DECLARE: EVAL@COMPILE [DEFMACRO NCP.MapLinks (NoteFile Function &OPTIONAL CollectResultPredicate) (* * Map down all links in the current notefile, performing LinkFn to each.) (* * rht 11/18/85: Updated to handle new notefile and card object formats. Now allows collection of links satisfying CollectResultPredicate.) (* * rht 7/17/86: rearranged slightly.) (* * rht 1/26/87: Now uses MAPCONC rather than APPLY'ing NCONC.) (BQUOTE (MAPCONC [NCP.MapCards , NoteFile [FUNCTION (LAMBDA (Card) (if , CollectResultPredicate then (for Link in ( NC.RetrieveToLinks Card) when (APPLY* , CollectResultPredicate Link) collect (APPLY* , Function Link)) else (for Link in ( NC.RetrieveToLinks Card) do (APPLY* , Function Link] , (AND CollectResultPredicate (BQUOTE (FUNCTION TRUE] (FUNCTION (LAMBDA (X) X] [DEFMACRO NCP.MapLinksOfType (Types NoteFile Function &OPTIONAL CollectResultPredicate) (* * Map down all links in the given notefile, having one of the given types.) (* * rht 7/17/86: rearranged slightly.) (* * rht 1/26/87: Now uses MAPCONC rather than APPLY'ing NCONC.) (BQUOTE (MAPCONC [NCP.MapCards , NoteFile [FUNCTION (LAMBDA (Card) (if , CollectResultPredicate then (for Link in (NC.RetrieveToLinks Card) when (AND (FMEMB (NCP.LinkType Link) (MKLIST , Types)) (APPLY* , CollectResultPredicate Link)) collect (APPLY* , Function Link)) else (for Link in (NC.RetrieveToLinks Card) when (FMEMB (NCP.LinkType Link) (MKLIST , Types)) do (APPLY* , Function Link] , (AND CollectResultPredicate (BQUOTE (FUNCTION TRUE] (FUNCTION (LAMBDA (X) X] ) (* * Creating and accessing link labels.) (DEFINEQ (NCP.CreateLinkType [LAMBDA (LinkType NoteFile) (* rht: " 2-Mar-87 22:05") (* * Create a new link label unless already defined.) (* * rht 11/18/85: Updated to handle new notefile and card object formats.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (FMEMB LinkType (NCP.LinkTypes NoteFile)) then (NCP.ReportError (QUOTE NCP.CreateLinkType) (CONCAT "Link type already defined: " LinkType ".")) NIL else (NC.StoreLinkLabels NoteFile (CONS LinkType (NCP.UserLinkTypes NoteFile))) LinkType]) (NCP.DeleteLinkType [LAMBDA (LinkType NoteFile) (* rht: " 2-Mar-87 22:06") (* * Checks for any instance of LinkType in the current database. If can't find any then delete the link label, otherwise error out.) (* * rht 11/18/85: Updated to handle new notefile and card object formats.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht 2/18/87: Fixed call to NCP.AllLinks to take NoteFile arg.) (DECLARE (GLOBALVARS NC.SystemLinkLabels)) (COND ((NOT (FMEMB LinkType (NCP.LinkTypes NoteFile))) (NCP.ReportError (QUOTE NCP.DeleteLinkType) (CONCAT "No such link type: " LinkType ".")) NIL) ((FMEMB LinkType NC.SystemLinkLabels) (NCP.ReportError (QUOTE NCP.DeleteLinkType) (CONCAT "Can't delete system link type: " LinkType ".")) NIL) ((for Link in (NCP.AllLinks NoteFile) thereis (EQ LinkType (fetch (Link Label) of Link))) (NCP.ReportError (QUOTE NCP.DeleteLinkType) (CONCAT "Link type currently in use: " LinkType ". Can't delete.")) NIL) (T (NC.StoreLinkLabels NoteFile (REMOVE LinkType (NCP.UserLinkTypes NoteFile))) LinkType]) (NCP.RenameLinkType [LAMBDA (OldLinkType NewLinkType NoteFile) (* rht: " 2-Mar-87 22:07") (* * Renames all instances of links with OldLinkType to be NewLabel. And deletes the old label OldLabel. If NewLinkType doesn't exist, create it.) (* * rht 11/18/85: Updated to handle new notefile and card object formats.) (* * rht 11/11/86: Took out ENV args to FUNCTION because they seemed to be causing stack overflows.) (* * rht 11/16/86: Changed call to NCP.ReportError) (LET ((LinkTypes (NCP.LinkTypes NoteFile))) (COND ((NOT (FMEMB OldLinkType LinkTypes)) (NCP.ReportError (QUOTE NCP.RenameLinkType) (CONCAT "No such link type: " OldLinkType ".")) NIL) ((FMEMB OldLinkType NC.SystemLinkLabels) (NCP.ReportError (QUOTE NCP.RenameLinkType) (CONCAT "Can't rename system link type: " OldLinkType ".")) NIL) ((FMEMB NewLinkType NC.SystemLinkLabels) (NCP.ReportError (QUOTE NCP.RenameLinkType) (CONCAT "Can't rename with a system link type: " NewLinkType ".")) NIL) (T (COND ((NOT (FMEMB NewLinkType LinkTypes)) (NCP.CreateLinkType NewLinkType NoteFile))) (* Map down all links, relabeling as appropriate.) [NCP.MapLinks NoteFile (FUNCTION (LAMBDA (Link) (COND ((EQ OldLinkType (fetch (Link Label) of Link)) (NCP.LinkType Link NewLinkType] (NC.StoreLinkLabels NoteFile (REMOVE OldLinkType (NCP.UserLinkTypes NoteFile))) NewLinkType]) (NCP.LinkTypes (LAMBDA (NoteFile) (* rht: " 9-Dec-85 15:37") (* * Return all link labels including system ones.) (* * rht 11/17/85: Updated to handle new card and notefile objects.) (NC.RetrieveLinkLabels NoteFile T))) (NCP.ReverseLinkTypes (LAMBDA (NoteFile) (* rht: "18-Nov-85 17:33") (* * Return all reverse link labels including system ones.) (* * rht 11/18/85: Updated to handle new notefile and card object formats.) (for Lab in (NC.RetrieveLinkLabels NoteFile T) collect (PACK* (QUOTE ←) Lab)))) (NCP.UserLinkTypes (LAMBDA (NoteFile) (* rht: "18-Nov-85 17:34") (* * Return list of only the user defined link labels appearing in the current notefile.) (* * rht 11/18/85: Updated to handle new notefile and card object formats.) (NC.RetrieveLinkLabels NoteFile NIL))) (NCP.ValidLinkTypeP (LAMBDA (LinkType NoteFile) (* rht: "12-Jul-86 12:32") (* * True if LinkType is a currently defined user or system link label.) (* * rht 11/18/85: Updated to handle new notefile and card object formats.) (FMEMB LinkType (NCP.LinkTypes NoteFile)))) ) (* * Dealing with card parts dates.) [DECLARE: EVAL@COMPILE (TYPERECORD NOTECARDDATES (SUBSTANCEDATE LINKSDATE TITLEDATE PROPLISTDATE)) ] (DEFINEQ (NCP.CardDates [LAMBDA (Card) (* rht: " 2-Mar-87 22:07") (* * Returns an instance of the NOTECARDDATES record filled in with the current dates of the card parts of Card.) (* * rht 8/25/86: Now passes non-nil QuietFlg to NCP.UncacheCards.) (* * rht 11/16/86: Changed call to NCP.ReportError) (if (NC.ValidCardP Card) then [LET ((WasActive (NCP.CardCachedP Card))) (OR WasActive (NCP.CacheCards Card)) (PROG1 (create NOTECARDDATES SUBSTANCEDATE ← (NC.FetchItemDate Card) LINKSDATE ← (NC.FetchLinksDate Card) TITLEDATE ← (NC.FetchTitleDate Card) PROPLISTDATE ← (NC.FetchPropListDate Card)) (OR WasActive (NCP.UncacheCards Card T] else (NCP.ReportError (QUOTE NCP.CardDates) (CONCAT Card " not an existing card.")) NIL]) ) (* * Open events card) (DEFINEQ (NCP.GetOpenEventsCard [LAMBDA (NoteFile) (* rht: " 8-Dec-86 21:31") (* * Find the open events card for the given notefile, creating a new one if necessary. Mark the card as not needing to be filed.) (LET ((OpenEventsCard (NCP.LookupCardByName (QUOTE OpenEventsCard) NoteFile))) (if (NOT (NCP.ValidCardP OpenEventsCard)) then (SETQ OpenEventsCard (NCP.CreateCard (QUOTE List) NoteFile "Open Events" T)) (NCP.MarkAsNotNeedingFiling OpenEventsCard) (NCP.RegisterCardByName (QUOTE OpenEventsCard) OpenEventsCard)) OpenEventsCard]) (NCP.GetCloseEventsCard [LAMBDA (NoteFile) (* rht: " 8-Dec-86 21:31") (* * Find the close events card for the given notefile, creating a new one if necessary. Mark the card as not needing to be filed.) (LET ((CloseEventsCard (NCP.LookupCardByName (QUOTE CloseEventsCard) NoteFile))) (if (NOT (NCP.ValidCardP CloseEventsCard)) then (SETQ CloseEventsCard (NCP.CreateCard (QUOTE List) NoteFile "Close Events" T)) (NCP.MarkAsNotNeedingFiling CloseEventsCard) (NCP.RegisterCardByName (QUOTE CloseEventsCard) CloseEventsCard)) CloseEventsCard]) (NCP.MarkAsNotNeedingFiling [LAMBDA (Card) (* rht: " 8-Dec-86 21:34") (* * Indicate on the card's prop list that it doesn't have to be filed.) (NCP.CardProp Card (QUOTE Don'tRequireFilingFlg) T]) ) (* * Miscellaneous) (DEFINEQ (NCP.TitleSearch [LAMBDA (NoteFile Keys CaseSensitiveFlg) (* rht: "11-Nov-86 12:38") (* * Return a list of all cards which contain each string of Args within their titles.) (* * rht 11/18/85: Updated to handle new notefile and card object formats. Note that first arg is now expected to be a notefile.) (* * kirk 26Jun86 Added BLOCK) (* * rht 7/12/86: Cleaned up a bit.) (* * rht 7/14/86: Now takes 3 args instead of unlimited number and accepts CaseSensitiveFlg.) (* * rht 11/11/86: Took out ENV args to FUNCTION because they seemed to be causing stack overflows.) (AND (NCP.OpenNoteFileP NoteFile) (NCP.MapCards NoteFile (FUNCTION [LAMBDA (Card) Card]) (if CaseSensitiveFlg then [FUNCTION (LAMBDA (Card) (LET ((Title (NCP.CardTitle Card))) (for Key in (MKLIST Keys) always (STRPOS Key Title] else (FUNCTION (LAMBDA (Card) (LET ((Title (NCP.CardTitle Card))) (for Key in (MKLIST Keys) always (STRPOS (U-CASE Key) (U-CASE Title]) (NCP.PropSearch (LAMBDA Args (* rht: "12-Jul-86 12:45") (* * Return a list of all IDs which contain each property or property pair appearing in Args. For each atomic element in Args, there must be a property by that name with non-nil value. For each pair (list of length 2) in Args, there must be a property and value matching that pair.) (* * rht 11/18/85: Updated to handle new notefile and card object formats. Note that first arg is now expected to be a notefile.) (* * rht 7/12/86: Cleaned up a bit.) (LET ((NoteFile (ARG Args 1))) (AND (type? NoteFile NoteFile) (NCP.MapCards NoteFile (FUNCTION (LAMBDA (Card) Card)) (FUNCTION (LAMBDA (Card) (LET ((PropList (NCP.CardPropList Card)) Prop) (for i from 2 to Args always (if (ATOM (SETQ Prop (ARG Args i))) then (LISTGET PropList Prop) elseif (AND (LISTP Prop) (EQ (LENGTH Prop) 2)) then (EQ (LISTGET PropList (CAR Prop)) (CADR Prop)))))))))))) (NCP.WhichCard (LAMBDA (WindowOrx y) (* rht: "18-Nov-85 17:42") (* * Return the ID of the card at a position determined as follows: If WindowOrx is a position, then use that, if WindowOrx and y are numbers then use (WindowOrx,y), else use cursor position.) (NC.CoerceToCard (OR (WINDOWP WindowOrx) (WHICHW WindowOrx y))))) (NCP.WhichNoteFile (LAMBDA (WindowOrx y) (* rht: "14-Jul-86 10:38") (* * Return the notefile corresponding to the window at a position determined as follows: If WindowOrx is a position, then use that, if WindowOrx and y are numbers then use (WindowOrx,y), else use cursor position. Works if the window is either for a card or for a notefile menu.) (LET ((Window (OR (WINDOWP WindowOrx) (WHICHW WindowOrx y)))) (OR (WINDOWPROP Window (QUOTE NoteFile)) (LET ((Card (WINDOWPROP Window (QUOTE NoteCardObject)))) (AND (NCP.ValidCardP Card) (NCP.NoteFileFromCard Card))))))) (NCP.SelectCards [LAMBDA (InstigatingCardOrWindow SingleCardFlg SelectionPredicate Msg CheckForCancelFlg) (* Randy.Gobbel " 2-Apr-87 15:38") (* * Return a list of cards selected. A menu pops up near the prompt window with "DONE" and "CANCEL" buttons. User selects by clicking in card's title bar.) (* * rht 11/18/85: Updated to handle new notefile and card object formats. Now takes optional extra args and passes to NC.SelectNoteCards.) (* * pmi 12/12/86: Removed obsolete ReturnLinksFlg argument in call to NC.SelectNoteCards.) (* * rht 3/2/87: Fix to bug %#342: Now makes sure instigating card is displayed, else passes NIL to NC.SelectNoteCards.) (* * rg 4/2/87 added NCP.WithLockedCards wrapper) (NCP.WithLockedCards (NC.SelectNoteCards SingleCardFlg SelectionPredicate (if SingleCardFlg then NC.SelectingCardMenu else NC.SelectingCardsMenu) (COND ((OPENWP InstigatingCardOrWindow) InstigatingCardOrWindow) ((AND (NCP.ValidCardP InstigatingCardOrWindow) (NCP.CardDisplayedP InstigatingCardOrWindow)) InstigatingCardOrWindow) (T NIL)) Msg CheckForCancelFlg]) (NCP.DocumentParameters [LAMBDA (NewProps) (* rht: " 2-Mar-87 22:07") (* * Returns the old value of the MakeDocument default parameters. If NewProps is non-nil then it should be a prop list which will be used to change some or all of the current MakeDocument parameters. Only those props whose names are valid MakeDocument parameters and whose values are permissible values for that name are used.) (* * rht 11/6/86: No longer checks for valid link label since that requires a notefile. Also returns just a proplist of the params that user can change.) (* * rht 11/16/86: Changed call to NCP.ReportError) (DECLARE (GLOBALVARS NC.MakeDocParameters)) (LET [(OldParams (for ParamThing in NC.MakeDocParameters unless (EQ (CAR ParamThing) (QUOTE --DONE--)) join (LIST (CAR ParamThing) (GETPROP (QUOTE NC.MakeDocParameters) (CAR ParamThing] [if NewProps then (for Params on NewProps by (CDDR NewProps) bind Param NewValue LegalValues do (SETQ Param (CAR Params)) (COND ([NULL (SETQ LegalValues (CDR (FASSOC Param NC.MakeDocParameters] (NCP.ReportError (QUOTE NCP.DocumentParameters) (CONCAT Param " not a document parameter name.")) ) ((OR (AND (FMEMB (SETQ NewValue (CADR Params)) LegalValues) (NEQ NewValue (QUOTE Select))) (AND (LISTP NewValue) (FMEMB (QUOTE Select) LegalValues))) (PUTPROP (QUOTE NC.MakeDocParameters) Param NewValue)) (T (NCP.ReportError (QUOTE NCP.DocumentParameters) (CONCAT NewValue " is not a permissible value for " Param "."] OldParams]) (NCP.NoteCardsParameters [LAMBDA (NewParams) (* rht: " 2-Mar-87 22:07") (* * Returns the old value of the Notecards parameters. If NewParams is non-nil then it should be a prop list which will be used to change some or all of the current Notecards parameters. Only those props whose names are valid Notecards parameters and whose values are permissible values for that name are used. On NC.NoteCardsParameters's prop list under the parameter name is a list of one or two items. The first is the name of the global var. The second if present, is a function of no args which returns a list of legal values for that parameter. We only do type checking if that function is present.) (* * rht 3/20/85: Changed to use new GLOBALPARAMETER record, especially the CheckFn field.) (* * rht 6/12/86: Now checks first whether there's a PARAMCHECKFN before apply*'ing it.) (* * rht 7/12/86: Cleaned up a bit.) (* * rht 11/16/86: Changed call to NCP.ReportError) (LET (OldParams PropVal ParamCheckFn) [SETQ OldParams (for Param in NC.NoteCardsParameters join (SETQ PropVal (GETPROP (QUOTE NC.NoteCardsParameters) Param)) (LIST Param (EVAL (if (LISTP PropVal) then (fetch (GLOBALPARAMETER PARAMGLOBALVAR) of PropVal) else PropVal] [if NewParams then (for Params on NewParams by (CDDR NewParams) bind Param NewValue GlobalVar PropVal do (if (FMEMB (SETQ Param (CAR Params)) NC.NoteCardsParameters) then (SETQ NewValue (CADR Params)) (SETQ PropVal (GETPROP (QUOTE NC.NoteCardsParameters) Param)) (SETQ GlobalVar (if (LISTP PropVal) then (fetch (GLOBALPARAMETER PARAMGLOBALVAR) of PropVal) else PropVal)) (if (OR (ATOM PropVal) (NULL (SETQ ParamCheckFn (fetch (GLOBALPARAMETER PARAMCHECKFN) of PropVal))) (APPLY* ParamCheckFn NewValue)) then (SET GlobalVar NewValue) else (NCP.ReportError (QUOTE NCP.NoteCardsParameters) (CONCAT NewValue " is not a permissible value for " Param "."))) else (NCP.ReportError (QUOTE NCP.NoteCardsParameters) (CONCAT Param " not a Notecards parameter name."] OldParams]) (NCP.PrintMsg (LAMBDA Args (* rht: "10-Jul-86 23:43") (* * Expects args of form (<window> <clearFirstFlg> <arg1> <arg2> ...) and prints the <arg>s to <window>'s prompt window or to the lisp prompt window if <window> is nil. Will clear first if second arg is non-nil.) (APPLY (QUOTE NC.PrintMsg) (for i from 1 to Args collect (ARG Args i))))) (NCP.ClearMsg (LAMBDA (Window ClosePromptWinFlg) (* rht: "27-Nov-84 17:53") (* * Clears the prompt window for Window. Will close if ClosePromptWinFlg is non-nil.) (NC.ClearMsg Window ClosePromptWinFlg))) (NCP.AskUser (LAMBDA (Msg Prompt FirstTry ClearFirstFlg MainWindow DontCloseAtEndFlg DontClearAtEndFlg PROMPTFORWORDFlg) (* rht: "30-May-85 21:49") (* * Asks a question in the prompt window. Just calls the NC.AskUser function.) (NC.AskUser Msg Prompt FirstTry ClearFirstFlg MainWindow DontCloseAtEndFlg DontClearAtEndFlg PROMPTFORWORDFlg))) (NCP.AskYesOrNo (LAMBDA (Msg Prompt FirstTry ClearFirstFlg MainWindow DontCloseAtEndFlg DontClearAtEndFlg) (* rht: "12-Jul-86 13:15") (* * Asks a yes/no question in the prompt window. Just calls the NC.AskYesOrNo function.) (NC.AskYesOrNo Msg Prompt FirstTry ClearFirstFlg MainWindow DontCloseAtEndFlg DontClearAtEndFlg) )) (NCP.RegisterCardByName [LAMBDA (Name Card RegistryCard) (* rht: "23-May-87 23:21") (* * Hash Card under Name in Card's notefile's system registry card.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht 5/23/87: Added RegistryCard arg which defaults to the notefile registry card.) [OR RegistryCard (SETQ RegistryCard (fetch (NoteFile RegistryCard) of ( NCP.NoteFileFromCard Card] (COND ((NOT (NC.ValidCardP Card)) (NCP.ReportError (QUOTE NCP.RegisterCardByName) (CONCAT Card " is not a valid notecard."))) ([NOT (AND (NC.ValidCardP RegistryCard) (EQ (NCP.CardType RegistryCard) (QUOTE Registry] (NCP.ReportError (QUOTE NCP.RegisterCardByName) (CONCAT RegistryCard " is not a valid registry card."))) (T (NC.RegisterCardByName RegistryCard Name Card]) (NCP.ListRegisteredCards [LAMBDA (NoteFileOrRegistryCard IncludeKeysFlg) (* rht: "23-May-87 23:35") (* * Return the list of cards registered in the RegistryCard or notefile. If IncludeKeysFlg is non-nil, then return dotted pairs of key and card, else just list of cards.) (LET (RegistryCard Result) [COND ((NCP.OpenNoteFileP NoteFileOrRegistryCard) (SETQ RegistryCard (fetch (NoteFile RegistryCard) of NoteFileOrRegistryCard))) ((AND (NC.ValidCardP NoteFileOrRegistryCard) (EQ (NCP.CardType NoteFileOrRegistryCard) (QUOTE Registry))) (SETQ RegistryCard NoteFileOrRegistryCard)) (T (NCP.ReportError (QUOTE NCP.ListRegisteredCards) (CONCAT "Improper arg: " NoteFileOrRegistryCard] [if IncludeKeysFlg then [MAPHASH (NCP.CardSubstance RegistryCard) (FUNCTION (LAMBDA (Val Key) (push Result (CONS Key Val] else (MAPHASH (NCP.CardSubstance RegistryCard) (FUNCTION (LAMBDA (Val Key) (push Result Val] Result]) (NCP.LookupCardByName [LAMBDA (Name NoteFileOrRegistryCard) (* rht: "23-May-87 23:37") (* * Lookup Name in notefile's system registry card.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht 5/23/87: Second arg can now be RegistryCard or NoteFile. If the latter, then grab notefile's RegistryCard.) (LET (RegistryCard) [COND ((NCP.OpenNoteFileP NoteFileOrRegistryCard) (SETQ RegistryCard (fetch (NoteFile RegistryCard) of NoteFileOrRegistryCard))) ((AND (NC.ValidCardP NoteFileOrRegistryCard) (EQ (NCP.CardType NoteFileOrRegistryCard) (QUOTE Registry))) (SETQ RegistryCard NoteFileOrRegistryCard)) (T (NCP.ReportError (QUOTE NCP.LookupCardByName) (CONCAT "Improper arg: " NoteFileOrRegistryCard] (NC.LookupCardByName RegistryCard Name]) (NCP.UnregisterName [LAMBDA (Name NoteFileOrRegistryCard) (* rht: "23-May-87 23:37") (* * Lookup Name in notefile's system registry card.) (* * rht 11/16/86: Changed call to NCP.ReportError) (* * rht 5/23/87: Second arg can now be RegistryCard or NoteFile. If the latter, then grab notefile's RegistryCard.) (LET (RegistryCard) [COND ((NCP.OpenNoteFileP NoteFileOrRegistryCard) (SETQ RegistryCard (fetch (NoteFile RegistryCard) of NoteFileOrRegistryCard))) ((AND (NC.ValidCardP NoteFileOrRegistryCard) (EQ (NCP.CardType NoteFileOrRegistryCard) (QUOTE Registry))) (SETQ RegistryCard NoteFileOrRegistryCard)) (T (NCP.ReportError (QUOTE NCP.UnregisterName) (CONCAT "Improper arg: " NoteFileOrRegistryCard] (NC.UnregisterName RegistryCard Name]) (NCP.DisplayedCards (LAMBDA NIL (* rht: "12-Jul-86 16:36") (* * Return a list of all cards that are currently displayed in a window.) (for Win in (OPENWINDOWS) bind Card when (SETQ Card (NC.CoerceToCard (OR (WINDOWPROP Win (QUOTE ICONFOR)) Win))) collect Card))) (NCP.CardUserDataProp [LAMBDA Args (* rht: " 2-Mar-87 22:08") (* * Expects two or three arguments: Card, Property, and optional new value. Returns the old value. Assigns the new value if given. Semantics are just like WINDOWPROP.) (* * rht 11/16/86: Changed call to NCP.ReportError) (LET (Card PropList) (COND ((AND (NEQ Args 2) (NEQ Args 3)) (NCP.ReportError (QUOTE NCP.CardUserDataProp) (CONCAT "Improper number of args: " Args)) NIL) [(NC.ValidCardP (SETQ Card (ARG Args 1))) (PROG1 (NC.FetchUserDataProp Card (ARG Args 2)) (if (EQ Args 3) then (NC.SetUserDataProp Card (ARG Args 2) (ARG Args 3] (T (NCP.ReportError (QUOTE NCP.CardUserDataProp) (CONCAT Card " not an existing card or box.")) NIL]) (NCP.NoteFileProp [LAMBDA Args (* rht: " 2-Mar-87 22:08") (* * Expects two or three arguments: Notefile, Property, and optional new value. Returns the old value. Assigns the new value if given. Semantics are just like WINDOWPROP.) (* * rht 11/16/86: Changed call to NCP.ReportError) (LET (NoteFile PropList) (COND ((AND (NEQ Args 2) (NEQ Args 3)) (NCP.ReportError (QUOTE NCP.NoteFileProp) (CONCAT "Improper number of args: " Args)) NIL) [(type? NoteFile (SETQ NoteFile (ARG Args 1))) (PROG1 (LISTGET (SETQ PropList (fetch (NoteFile UserProps) of NoteFile)) (ARG Args 2)) (if (EQ Args 3) then (if PropList then (LISTPUT PropList (ARG Args 2) (ARG Args 3)) else (replace (NoteFile UserProps) of NoteFile with (LIST (ARG Args 2) (ARG Args 3] (T (NCP.ReportError (QUOTE NCP.NoteFileProp) (CONCAT NoteFile " not a valid notefile.")) NIL]) (NCP.SetUpTitleBar [LAMBDA (CardWindow CardType) (* rht: " 8-Dec-86 18:00") (* * Set up the left and middle button menus for this card. Also handle installation of button event fn.) (NC.InstallTitleBarLeftMenu CardWindow CardType) (NC.InstallTitleBarMiddleMenu CardWindow CardType) (NC.InstallTitleBarButtonEventFn CardWindow (FUNCTION NC.TitleBarButtonEventFn]) (NCP.AddNoteFileIconMiddleButtonItems [LAMBDA (NoteFile MenuItems) (* rht: "23-Nov-86 15:47") (* * Add the given MenuItems to the given NoteFile.) (NCP.NoteFileProp NoteFile (QUOTE NoteFileIconMiddleButtonItems) (APPEND (NCP.NoteFileProp NoteFile (QUOTE NoteFileIconMiddleButtonItems) ) MenuItems)) (* * Smash stashed menu so as to force recompute.) (LET ((NoteFileIconWindow (NCP.NoteFileIconWindow NoteFile))) (if (OPENWP NoteFileIconWindow) then (WINDOWPROP NoteFileIconWindow (QUOTE NoteFileMiddleButtonMenu) NIL]) (NCP.NoteFileIconWindow [LAMBDA (NoteFile) (* rht: "23-Nov-86 15:48") (* * Return the icon window for given notefile.) (WFROMMENU (fetch (NoteFile Menu) of NoteFile]) ) (MOVD (QUOTE NCP.WhichCard) (QUOTE NCP.WC) T) (MOVD (QUOTE NCP.WhichNoteFile) (QUOTE NCP.WNF) T) (* * Handy internal functions) (DEFINEQ (NCP.ReportError [LAMBDA (FunctionName Msg) (* rht: " 2-Mar-87 23:31") (* * Print out the various elements of Args to the terminal.) (* * rht 11/16/86: Now takes different args and does optional break. Consults NCP.ErrorBrkWhenFlg.) (* * rht 3/2/87: Now coerces FunctionName to atom in case was passed as string.) (DECLARE (GLOBALVARS NCP.ErrorBrkWhenFlg)) (if (EQ NCP.ErrorBrkWhenFlg (QUOTE NEVER)) then (PRIN1 "*** NC-PI error: " T) (PRIN1 Msg T) (TERPRI T) else (APPLY* (QUOTE BREAK1) T T (MKATOM FunctionName) NIL NIL (LIST Msg]) (NCP.ReportWarning [LAMBDA (FunctionName Msg) (* rht: "21-Nov-86 00:34") (* * Print out the various elements of Args to the terminal.) (* * rht 11/16/86: Now takes different args and does optional break. Consults NCP.ErrorBrkWhenFlg.) (DECLARE (GLOBALVARS NCP.ErrorBrkWhenFlg)) (if (NEQ NCP.ErrorBrkWhenFlg (QUOTE ALWAYS)) then (PRIN1 "*** NC-PI warning: " T) (PRIN1 Msg T) (TERPRI T) else (APPLY* (QUOTE BREAK1) T T FunctionName NIL NIL (LIST Msg]) (NCP.LinkAnchorDesc (LAMBDA (Link ToFlg) (* rht: "25-Aug-86 17:00") (* * Return a description of the anchoring of Link at one of its endpoints. The description has the form (<anchormode> <ID> <loc>) If ToFlg is non-nil, then look at the "To" end of the link, otherwise, its "From" end.) (* * rht 8/25/86: Now passes non-nil QuietFlg to NCP.UncacheCards.) (PROG (Card WasActiveP) (SETQ Card (if ToFlg then (fetch (Link DestinationCard) of Link) else (fetch (Link SourceCard) of Link))) (RETURN (COND ((OR (NC.GlobalLinkP Link) ToFlg) (LIST (QUOTE GLOBAL) Card NIL)) (T (COND ((NOT (SETQ WasActiveP (NCP.CardCachedP Card))) (NCP.CacheCards Card))) (for Obj in (CAR (NC.CollectReferences Card NIL NIL T)) when (NC.SameLinkP Link (CAR Obj)) do (COND ((NOT WasActiveP) (NCP.UncacheCards Card T))) (RETURN (LIST (QUOTE LOCAL) Card (CDR Obj)))))))))) (NCP.GetTypeRecord (LAMBDA (TypeName) (* rht: "18-Nov-85 00:40") (* * Return the record corresponding to this type name.) (* * rht 11/17/85: Now calls new NC function.) (NC.CardTypeRecord TypeName))) (NCP.AddLeftButtonTitleBarMenuItems [LAMBDA (Window NewMenuItems) (* rht: "12-Jul-86 14:11") (* * Add the given menu items to the left button menu of Window.) (LET [(Menu (WINDOWPROP Window (QUOTE TitleBarLeftButtonMenu] (if Menu then (PROG1 (replace (MENU ITEMS) of Menu with (APPEND (fetch (MENU ITEMS) of Menu) NewMenuItems)) (replace (MENU IMAGE) of Menu with NIL]) (NCP.AddMiddleButtonTitleBarMenuItems [LAMBDA (Window NewMenuItems) (* rht: "17-Nov-86 00:15") (* * Add the given menu items to the middle button menu of Window.) (LET [(Menu (WINDOWPROP Window (QUOTE TitleBarMiddleButtonMenu] (if Menu then (PROG1 (replace (MENU ITEMS) of Menu with (APPEND (fetch (MENU ITEMS) of Menu) NewMenuItems)) (replace (MENU IMAGE) of Menu with NIL]) (NCP.CoerceToLinkDisplayMode [LAMBDA (Thing) (* rht: "27-May-87 11:28") (* * Thing can be a cardtype, link, atom, list or LINKDISPLAYMODE record.) (* * Fixed so that returns non-nil, if Thing is already a linkdisplaymode.) (* * rht 5/27/87: Now checks for case of card type up front.) (PROG (DisplayMode) (SETQ DisplayMode (COND ((type? LINKDISPLAYMODE Thing) (RETURN Thing)) ((NCP.CardTypeP Thing) (NCP.CardTypeVar Thing (QUOTE LinkDisplayMode))) ((NCP.ValidCardP Thing) (NC.FetchLinkDisplayMode Thing)) ((NCP.ValidLinkP Thing) (NCP.LinkDisplayMode Thing)) (T Thing))) (SETQ DisplayMode (COND ((type? LINKDISPLAYMODE DisplayMode) (RETURN DisplayMode)) ((FMEMB DisplayMode NCP.LinkDisplayModes) (NC.MakeNewDisplayMode DisplayMode)) ((LISTP DisplayMode) (create LINKDISPLAYMODE SHOWTITLEFLG ← (CAR DisplayMode) SHOWLINKTYPEFLG ← (CADR DisplayMode) ATTACHBITMAPFLG ← (CADDR DisplayMode))) (T DisplayMode))) (RETURN (if (type? LINKDISPLAYMODE DisplayMode) then DisplayMode else NIL]) ) (* * Global variables.) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NCP.ErrorBrkWhenFlg NCP.LinkDisplayModes NCP.TypeFnsAssocLst NCP.NoteCardTypeFns NCP.NoteCardTypeVars NC.MakeDocParameters NC.CardTypes NC.SubstanceTypes NC.SystemLinkLabels NC.FiledCardLinkLabel NC.SubBoxLinkLabel NC.SelectingCardsMenu NC.SelectingCardMenu NC.UCASESystemLinkLabels NC.SourceLinkLabel NC.NoteCardsParameters) ) (RPAQ? NCP.ErrorBrkWhenFlg NIL) (RPAQQ NCP.LinkDisplayModes (Icon Title Label Both)) (RPAQQ NCP.NoteCardTypeFns (MakeFn EditFn QuitFn GetFn PutFn CopyFn MarkDirtyFn DirtyPFn CollectLinksFn DeleteLinksFn UpdateLinkIconsFn InsertLinkFn TranslateWindowPositionFn)) (RPAQQ NCP.NoteCardTypeVars (SuperType StubFlg FullDefinitionFile LinkDisplayMode DefaultWidth DefaultHeight LinkAnchorModesSupported DisplayedInMenuFlg LinkIconAttachedBitMap LeftButtonMenuItems MiddleButtonMenuItems)) (* * Following is for backward compatibility with 1.2) (MOVD (QUOTE NCP.OpenCard) (QUOTE NCP.BringUpCard) T) (MOVD (QUOTE NCP.CacheCards) (QUOTE NCP.ActivateCards) T) (MOVD (QUOTE NCP.CardCachedP) (QUOTE NCP.ActiveCardP) T) (MOVD (QUOTE NCP.CardTypeFnP) (QUOTE NCP.ValidCardTypeFn) T) (MOVD (QUOTE NCP.CardTypeP) (QUOTE NCP.ValidCardType) T) (MOVD (QUOTE NCP.CardTypeVarP) (QUOTE NCP.ValidCardTypeVar) T) (MOVD (QUOTE NCP.CloseCards) (QUOTE NCP.DeactivateCards) T) (MOVD (QUOTE NCP.ValidCardP) (QUOTE NCP.ValidCard) T) (MOVD (QUOTE NCP.ContentsFileBox) (QUOTE NCP.GetContentsFileBox) T) (MOVD (QUOTE NCP.OrphansFileBox) (QUOTE NCP.GetOrphansFileBox) T) (MOVD (QUOTE NCP.ToBeFiledFileBox) (QUOTE NCP.GetToBeFiledFileBox) T) (MOVD (QUOTE NCP.LinkSource) (QUOTE NCP.GetLinkSource) T) (MOVD (QUOTE NCP.LinkDestination) (QUOTE NCP.GetLinkDestination) T) (MOVD (QUOTE NCP.CreateLinkType) (QUOTE NCP.CreateLinkLabel) T) (MOVD (QUOTE NCP.DeleteLinkType) (QUOTE NCP.DeleteLinkLabel) T) (MOVD (QUOTE NCP.RenameLinkType) (QUOTE NCP.RenameLinkLabel) T) (MOVD (QUOTE NCP.LinkTypes) (QUOTE NCP.GetLinkLabels) T) (MOVD (QUOTE NCP.UserLinkTypes) (QUOTE NCP.GetUserLinkLabels) T) (MOVD (QUOTE NCP.ReverseLinkTypes) (QUOTE NCP.GetReverseLinkLabels) T) (MOVD (QUOTE NCP.ValidLinkTypeP) (QUOTE NCP.ValidLinkLabel) T) (MOVD (QUOTE NCP.ValidLinkP) (QUOTE NCP.ValidLink) T) (DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDTOVAR NLAMA ) (ADDTOVAR NLAML ) (ADDTOVAR LAMA NCP.NoteFileProp NCP.CardUserDataProp NCP.PrintMsg NCP.PropSearch NCP.LinkType NCP.LinkDisplayMode NCP.CardSubstance NCP.CardProp NCP.CardTitle NCP.CardTypeDisplayedInMenu) ) (PRETTYCOMPRINT NCPROGINTCOMS) (RPAQQ NCPROGINTCOMS [(* * Notefile creation and access) (FNS NCP.CreateNoteFile NCP.OpenNoteFile NCP.OpenNoteFileP NCP.ListOfOpenNoteFiles NCP.CloseNoteFiles NCP.CheckpointNoteFiles NCP.AbortNoteFiles NCP.CompactNoteFile NCP.CompactNoteFileInPlace NCP.RepairNoteFile NCP.DeleteNoteFile NCP.NoteFileFromFileName NCP.FileNameFromNoteFile NCP.NoteFileMenu NCP.CheckInNoteFile NCP.CheckOutNoteFile NCP.LockFileName NCP.NumCardSlotsRemaining NCP.ExpandNoteFileIndex) (* * Creating and accessing NoteCard types and substances.) (FNS NCP.CardTypes NCP.CreateCardType NCP.CreateCardTypeStub NCP.ChangeCardTypeFields NCP.CardTypeSuper NCP.CardTypeLinkDisplayMode NCP.CardTypeFn NCP.CardTypeVar NCP.CardTypeP NCP.CardTypeFnP NCP.CardTypeVarP NCP.CardTypeFns NCP.CardTypeVars NCP.CardTypeDisplayedInMenu NCP.IsSubTypeOfP NCP.TextBasedP NCP.SketchBasedP NCP.GraphBasedP NCP.AutoLoadCardType NCP.AddSpecialCard NCP.RemoveSpecialCard) (MACROS NCP.ApplyCardTypeFn NCP.ApplySuperTypeFn) (* * Creating Notecards and fileboxes) (FNS NCP.CreateCard NCP.CreateTextCard NCP.CreateFileBox NCP.CreateBrowserCard NCP.CreateSketchCard NCP.CreateGraphCard NCP.MakeDocument NCP.MakeLinkIndex) (* * Opening, closing, activating, display, etc.) (FNS NCP.OpenCard NCP.CloseCards NCP.DisplayCard NCP.UndisplayCards NCP.CacheCards NCP.UncacheCards NCP.CardCachedP NCP.CardDisplayedP NCP.CardWindow NCP.WindowFromCard NCP.CardFromWindow NCP.CardFromTextStream) (* * Accessing cards and boxes) (FNS NCP.CardType NCP.ValidCardP NCP.CardTitle NCP.FileCards NCP.UnfileCards NCP.CardParents NCP.FileBoxChildren NCP.CardNeighbors NCP.GetLinks NCP.CardPropList NCP.CardProp NCP.CardAddProp NCP.CardDelProp NCP.CardSubstance NCP.CardRegion NCP.CardAddText NCP.ChangeLoc NCP.DeleteCards NCP.FileBoxP NCP.AllCards NCP.AllBoxes NCP.ContentsFileBox NCP.OrphansFileBox NCP.ToBeFiledFileBox NCP.NoteFileFromCard NCP.CardNoteFile NCP.SameCardP NCP.CoerceToCard NCP.DetermineDisplayRegion NCP.LockListOfCards) (MACROS NCP.MapCards NCP.MapCardsOfType) (MACROS NCP.WithLockedCards) (* * Collecting, copying, moving, deleting, cards) (FNS NCP.CollectCards NCP.CopyCards) (* * Creating and accessing links) (FNS NCP.CreateLink NCP.LocalGlobalLink NCP.GlobalGlobalLink NCP.GlobalLocalLink NCP.LocalLocalLink NCP.LinkDesc NCP.LinkDisplayMode NCP.LinkType NCP.LinkSource NCP.LinkDestination NCP.DeleteLinks NCP.ValidLinkP NCP.AllLinks NCP.SameLinkP NCP.LinkFromLinkIcon NCP.MakeLinkIcon NCP.MarkCardDirty) (MACROS NCP.MapLinks NCP.MapLinksOfType) (* * Creating and accessing link labels.) (FNS NCP.CreateLinkType NCP.DeleteLinkType NCP.RenameLinkType NCP.LinkTypes NCP.ReverseLinkTypes NCP.UserLinkTypes NCP.ValidLinkTypeP) (* * Dealing with card parts dates.) (RECORDS NOTECARDDATES) (FNS NCP.CardDates) (* * Open events card) (FNS NCP.GetOpenEventsCard NCP.GetCloseEventsCard NCP.MarkAsNotNeedingFiling) (* * Miscellaneous) (FNS NCP.TitleSearch NCP.PropSearch NCP.WhichCard NCP.WhichNoteFile NCP.SelectCards NCP.DocumentParameters NCP.NoteCardsParameters NCP.PrintMsg NCP.ClearMsg NCP.AskUser NCP.AskYesOrNo NCP.RegisterCardByName NCP.ListRegisteredCards NCP.LookupCardByName NCP.UnregisterName NCP.DisplayedCards NCP.CardUserDataProp NCP.NoteFileProp NCP.SetUpTitleBar NCP.AddNoteFileIconMiddleButtonItems NCP.NoteFileIconWindow) (P (MOVD (QUOTE NCP.WhichCard) (QUOTE NCP.WC) T) (MOVD (QUOTE NCP.WhichNoteFile) (QUOTE NCP.WNF) T)) (* * Handy internal functions) (FNS NCP.ReportError NCP.ReportWarning NCP.LinkAnchorDesc NCP.GetTypeRecord NCP.AddLeftButtonTitleBarMenuItems NCP.AddMiddleButtonTitleBarMenuItems NCP.CoerceToLinkDisplayMode) (* * Global variables.) (GLOBALVARS NCP.ErrorBrkWhenFlg NCP.LinkDisplayModes NCP.TypeFnsAssocLst NCP.NoteCardTypeFns NCP.NoteCardTypeVars NC.MakeDocParameters NC.CardTypes NC.SubstanceTypes NC.SystemLinkLabels NC.FiledCardLinkLabel NC.SubBoxLinkLabel NC.SelectingCardsMenu NC.SelectingCardMenu NC.UCASESystemLinkLabels NC.SourceLinkLabel NC.NoteCardsParameters) (INITVARS (NCP.ErrorBrkWhenFlg NIL)) [VARS (NCP.LinkDisplayModes (QUOTE (Icon Title Label Both))) (NCP.NoteCardTypeFns (QUOTE (MakeFn EditFn QuitFn GetFn PutFn CopyFn MarkDirtyFn DirtyPFn CollectLinksFn DeleteLinksFn UpdateLinkIconsFn InsertLinkFn TranslateWindowPositionFn))) (NCP.NoteCardTypeVars (QUOTE (SuperType StubFlg FullDefinitionFile LinkDisplayMode DefaultWidth DefaultHeight LinkAnchorModesSupported DisplayedInMenuFlg LinkIconAttachedBitMap LeftButtonMenuItems MiddleButtonMenuItems] (* * Following is for backward compatibility with 1.2) (P (MOVD (QUOTE NCP.OpenCard) (QUOTE NCP.BringUpCard) T) (MOVD (QUOTE NCP.CacheCards) (QUOTE NCP.ActivateCards) T) (MOVD (QUOTE NCP.CardCachedP) (QUOTE NCP.ActiveCardP) T) (MOVD (QUOTE NCP.CardTypeFnP) (QUOTE NCP.ValidCardTypeFn) T) (MOVD (QUOTE NCP.CardTypeP) (QUOTE NCP.ValidCardType) T) (MOVD (QUOTE NCP.CardTypeVarP) (QUOTE NCP.ValidCardTypeVar) T) (MOVD (QUOTE NCP.CloseCards) (QUOTE NCP.DeactivateCards) T) (MOVD (QUOTE NCP.ValidCardP) (QUOTE NCP.ValidCard) T) (MOVD (QUOTE NCP.ContentsFileBox) (QUOTE NCP.GetContentsFileBox) T) (MOVD (QUOTE NCP.OrphansFileBox) (QUOTE NCP.GetOrphansFileBox) T) (MOVD (QUOTE NCP.ToBeFiledFileBox) (QUOTE NCP.GetToBeFiledFileBox) T) (MOVD (QUOTE NCP.LinkSource) (QUOTE NCP.GetLinkSource) T) (MOVD (QUOTE NCP.LinkDestination) (QUOTE NCP.GetLinkDestination) T) (MOVD (QUOTE NCP.CreateLinkType) (QUOTE NCP.CreateLinkLabel) T) (MOVD (QUOTE NCP.DeleteLinkType) (QUOTE NCP.DeleteLinkLabel) T) (MOVD (QUOTE NCP.RenameLinkType) (QUOTE NCP.RenameLinkLabel) T) (MOVD (QUOTE NCP.LinkTypes) (QUOTE NCP.GetLinkLabels) T) (MOVD (QUOTE NCP.UserLinkTypes) (QUOTE NCP.GetUserLinkLabels) T) (MOVD (QUOTE NCP.ReverseLinkTypes) (QUOTE NCP.GetReverseLinkLabels) T) (MOVD (QUOTE NCP.ValidLinkTypeP) (QUOTE NCP.ValidLinkLabel) T) (MOVD (QUOTE NCP.ValidLinkP) (QUOTE NCP.ValidLink) T)) (DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDVARS (NLAMA) (NLAML) (LAMA NCP.NoteFileProp NCP.CardUserDataProp NCP.PrintMsg NCP.PropSearch NCP.LinkType NCP.LinkDisplayMode NCP.CardRegion NCP.CardSubstance NCP.CardProp NCP.CardTitle NCP.CardTypeDisplayedInMenu]) (DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDTOVAR NLAMA ) (ADDTOVAR NLAML ) (ADDTOVAR LAMA NCP.NoteFileProp NCP.CardUserDataProp NCP.PrintMsg NCP.PropSearch NCP.LinkType NCP.LinkDisplayMode NCP.CardRegion NCP.CardSubstance NCP.CardProp NCP.CardTitle NCP.CardTypeDisplayedInMenu) ) (PUTPROPS NCPROGINT COPYRIGHT ("Xerox Corporation" 1984 1985 1986 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (7222 22275 (NCP.CreateNoteFile 7232 . 7903) (NCP.OpenNoteFile 7905 . 9273) ( NCP.OpenNoteFileP 9275 . 9644) (NCP.ListOfOpenNoteFiles 9646 . 10083) (NCP.CloseNoteFiles 10085 . 11171) (NCP.CheckpointNoteFiles 11173 . 11907) (NCP.AbortNoteFiles 11909 . 12637) (NCP.CompactNoteFile 12639 . 12959) (NCP.CompactNoteFileInPlace 12961 . 13224) (NCP.RepairNoteFile 13226 . 13946) ( NCP.DeleteNoteFile 13948 . 14650) (NCP.NoteFileFromFileName 14652 . 14889) (NCP.FileNameFromNoteFile 14891 . 15428) (NCP.NoteFileMenu 15430 . 15687) (NCP.CheckInNoteFile 15689 . 18332) ( NCP.CheckOutNoteFile 18334 . 20518) (NCP.LockFileName 20520 . 21002) (NCP.NumCardSlotsRemaining 21004 . 21574) (NCP.ExpandNoteFileIndex 21576 . 22273)) (22342 33681 (NCP.CardTypes 22352 . 22558) ( NCP.CreateCardType 22560 . 23215) (NCP.CreateCardTypeStub 23217 . 24046) (NCP.ChangeCardTypeFields 24048 . 24536) (NCP.CardTypeSuper 24538 . 25000) (NCP.CardTypeLinkDisplayMode 25002 . 25497) ( NCP.CardTypeFn 25499 . 26460) (NCP.CardTypeVar 26462 . 27441) (NCP.CardTypeP 27443 . 27714) ( NCP.CardTypeFnP 27716 . 28007) (NCP.CardTypeVarP 28009 . 28306) (NCP.CardTypeFns 28308 . 28528) ( NCP.CardTypeVars 28530 . 28753) (NCP.CardTypeDisplayedInMenu 28755 . 30053) (NCP.IsSubTypeOfP 30055 . 30608) (NCP.TextBasedP 30610 . 31196) (NCP.SketchBasedP 31198 . 31831) (NCP.GraphBasedP 31833 . 32463) (NCP.AutoLoadCardType 32465 . 32742) (NCP.AddSpecialCard 32744 . 33298) (NCP.RemoveSpecialCard 33300 . 33679)) (34094 43198 (NCP.CreateCard 34104 . 36159) (NCP.CreateTextCard 36161 . 36668) ( NCP.CreateFileBox 36670 . 37292) (NCP.CreateBrowserCard 37294 . 39454) (NCP.CreateSketchCard 39456 . 39919) (NCP.CreateGraphCard 39921 . 40377) (NCP.MakeDocument 40379 . 41891) (NCP.MakeLinkIndex 41893 . 43196)) (43255 50837 (NCP.OpenCard 43265 . 43873) (NCP.CloseCards 43875 . 45618) (NCP.DisplayCard 45620 . 46411) (NCP.UndisplayCards 46413 . 47515) (NCP.CacheCards 47517 . 48228) (NCP.UncacheCards 48230 . 49186) (NCP.CardCachedP 49188 . 49389) (NCP.CardDisplayedP 49391 . 49663) (NCP.CardWindow 49665 . 50058) (NCP.WindowFromCard 50060 . 50325) (NCP.CardFromWindow 50327 . 50564) ( NCP.CardFromTextStream 50566 . 50835)) (50876 76712 (NCP.CardType 50886 . 51220) (NCP.ValidCardP 51222 . 51477) (NCP.CardTitle 51479 . 52452) (NCP.FileCards 52454 . 53705) (NCP.UnfileCards 53707 . 56200) (NCP.CardParents 56202 . 56894) (NCP.FileBoxChildren 56896 . 57484) (NCP.CardNeighbors 57486 . 59202) (NCP.GetLinks 59204 . 62126) (NCP.CardPropList 62128 . 62417) (NCP.CardProp 62419 . 63762) ( NCP.CardAddProp 63764 . 65056) (NCP.CardDelProp 65058 . 66237) (NCP.CardSubstance 66239 . 67549) ( NCP.CardRegion 67551 . 69126) (NCP.CardAddText 69128 . 70372) (NCP.ChangeLoc 70374 . 71760) ( NCP.DeleteCards 71762 . 72609) (NCP.FileBoxP 72611 . 72922) (NCP.AllCards 72924 . 73260) (NCP.AllBoxes 73262 . 73609) (NCP.ContentsFileBox 73611 . 73941) (NCP.OrphansFileBox 73943 . 74262) ( NCP.ToBeFiledFileBox 74264 . 74582) (NCP.NoteFileFromCard 74584 . 74834) (NCP.CardNoteFile 74836 . 75082) (NCP.SameCardP 75084 . 75566) (NCP.CoerceToCard 75568 . 75877) (NCP.DetermineDisplayRegion 75879 . 76299) (NCP.LockListOfCards 76301 . 76710)) (78747 80417 (NCP.CollectCards 78757 . 79803) ( NCP.CopyCards 79805 . 80415)) (80459 96846 (NCP.CreateLink 80469 . 81829) (NCP.LocalGlobalLink 81831 . 85907) (NCP.GlobalGlobalLink 85909 . 87611) (NCP.GlobalLocalLink 87613 . 88019) (NCP.LocalLocalLink 88021 . 88432) (NCP.LinkDesc 88434 . 89125) (NCP.LinkDisplayMode 89127 . 90821) (NCP.LinkType 90823 . 92890) (NCP.LinkSource 92892 . 93324) (NCP.LinkDestination 93326 . 93776) (NCP.DeleteLinks 93778 . 94438) (NCP.ValidLinkP 94440 . 94657) (NCP.AllLinks 94659 . 95399) (NCP.SameLinkP 95401 . 95883) ( NCP.LinkFromLinkIcon 95885 . 96214) (NCP.MakeLinkIcon 96216 . 96427) (NCP.MarkCardDirty 96429 . 96844) ) (98984 104167 (NCP.CreateLinkType 98994 . 99660) (NCP.DeleteLinkType 99662 . 100994) ( NCP.RenameLinkType 100996 . 102720) (NCP.LinkTypes 102722 . 103032) (NCP.ReverseLinkTypes 103034 . 103446) (NCP.UserLinkTypes 103448 . 103809) (NCP.ValidLinkTypeP 103811 . 104165)) (104318 105308 ( NCP.CardDates 104328 . 105306)) (105338 107085 (NCP.GetOpenEventsCard 105348 . 106065) ( NCP.GetCloseEventsCard 106067 . 106797) (NCP.MarkAsNotNeedingFiling 106799 . 107083)) (107112 126617 ( NCP.TitleSearch 107122 . 108382) (NCP.PropSearch 108384 . 109648) (NCP.WhichCard 109650 . 110072) ( NCP.WhichNoteFile 110074 . 110801) (NCP.SelectCards 110803 . 112194) (NCP.DocumentParameters 112196 . 114220) (NCP.NoteCardsParameters 114222 . 116970) (NCP.PrintMsg 116972 . 117432) (NCP.ClearMsg 117434 . 117696) (NCP.AskUser 117698 . 118115) (NCP.AskYesOrNo 118117 . 118540) (NCP.RegisterCardByName 118542 . 119561) (NCP.ListRegisteredCards 119563 . 120719) (NCP.LookupCardByName 120721 . 121678) ( NCP.UnregisterName 121680 . 122631) (NCP.DisplayedCards 122633 . 123051) (NCP.CardUserDataProp 123053 . 124028) (NCP.NoteFileProp 124030 . 125228) (NCP.SetUpTitleBar 125230 . 125676) ( NCP.AddNoteFileIconMiddleButtonItems 125678 . 126364) (NCP.NoteFileIconWindow 126366 . 126615)) ( 126776 132066 (NCP.ReportError 126786 . 127517) (NCP.ReportWarning 127519 . 128136) ( NCP.LinkAnchorDesc 128138 . 129357) (NCP.GetTypeRecord 129359 . 129650) ( NCP.AddLeftButtonTitleBarMenuItems 129652 . 130208) (NCP.AddMiddleButtonTitleBarMenuItems 130210 . 130772) (NCP.CoerceToLinkDisplayMode 130774 . 132064))))) STOP