(FILECREATED "16-Jan-85 16:05:10" {PHYLUM}<NOTECARDS>RELEASE1.1>NCLINKS.;12 89242 changes to: (FNS NC.LinkIconImageBoxFn) previous date: " 4-Jan-85 01:10:05" {PHYLUM}<NOTECARDS>RELEASE1.1>NCLINKS.;11) (* Copyright (c) 1984, 1985 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT NCLINKSCOMS) (RPAQQ NCLINKSCOMS ((* * Internal variables) (GLOBALVARS NC.NoDeleteImageFns NC.SystemLinkLabels NC.InitialLinkLabels NC.SubBoxLinkLabel NC.FiledCardLinkLabel NC.BrowserContentsLinkLabel NC.ListContentsLinkLabel NC.SourceLinkLabel NC.UnspecifiedLinkLabel NC.UCASESystemLinkLabels NC.DocBackPtrLinkLabel NC.LinkIndexBackPtrLinkLabel NC.LinkIconImageFns NC.LinkIconMiddleButtonMenu NC.LinkDisplayModesMenu) (VARS (NC.SubBoxLinkLabel (QUOTE SubBox)) (NC.FiledCardLinkLabel (QUOTE FiledCard)) (NC.BrowserContentsLinkLabel (QUOTE BrowserContents)) (NC.ListContentsLinkLabel (QUOTE ListContents)) (NC.SourceLinkLabel (QUOTE Source)) (NC.UnspecifiedLinkLabel (QUOTE Unspecified)) (NC.DocBackPtrLinkLabel (QUOTE DocBackPtr)) (NC.LinkIndexBackPtrLinkLabel (QUOTE LinkIndexBackPtr)) (NC.SystemLinkLabels (LIST NC.SourceLinkLabel NC.ListContentsLinkLabel NC.BrowserContentsLinkLabel NC.FiledCardLinkLabel NC.SubBoxLinkLabel NC.DocBackPtrLinkLabel NC.LinkIndexBackPtrLinkLabel)) (NC.UCASESystemLinkLabels (FOR Label in NC.SystemLinkLabels collect (U-CASE Label))) (NC.InitialLinkLabels (APPEND (QUOTE (Comment Remark Question Rebuttal Argument Unspecified)) NC.SystemLinkLabels))) (* * Links mechanism) (RECORDS BrowserSpecs NOTECARDLINK) (FNS NC.GlobalLinkP NC.ChildLinkP NC.ReverseLinkLabelP NC.GetNewLinkID NC.SaveNextLinkID NC.MakeGlobalLink NC.AddFromLink NC.AddLinkToGraphCard NC.AddLinkToSketchCard NC.InsertLinkInSketch NC.AddLinkToTextCard NC.AddLinksToTextCard NC.InsertLinkInText NC.InsertLinksInText NC.AddSourceLink NC.AddToLink NC.DelFromLink NC.DelToLink NC.DelReferencesToCard NC.DelReferencesToCardFromGlobalList NC.DelReferencesToCardFromGraph NC.DelReferencesToCardFromSketch NC.DelReferencesToCardFromText NC.DeletedLinkDisplayFn NC.DeletedLinkGetFn NC.DeletedLinkImageBoxFn NC.DeletedLinkPutFn NC.CheckForOrphanDelete NC.HookToOrphanCard NC.InsertLinkBeforeMarker NC.LinkLabelP NC.MakeAContentsHook NC.MakeLink NC.MakeContentsHooks NC.RelabelLink NC.SystemLinkLabelP NC.ValidLinkP NC.MakeChildLink) (* * Link display icons) (FNS NC.SetLinkInLinkIcon NC.FetchLinkIconForLink NC.MakeLinkIcon NC.LinkIconButtonEventInFn NC.LinkIconDisplayFn NC.LinkIconImageBoxFn NC.LinkIconImageObjP NC.LinkIconPutFn NC.LinkIconGetFn NC.LinkIconMiddleButtonFn NC.LinkIconWhenCopiedFn NC.LinkIconWhenDeletedFn NC.LinkIconWhenInsertedFn NC.LinkIconWhenMovedFn NC.FetchLinkFromLinkIcon NC.ChangeLinkDisplayMode NC.DefaultLinkDisplayMode NC.UpdateLinkImages NC.UpdateLinkImagesInGraph NC.UpdateLinkImagesInSketch NC.UpdateLinkImagesInText NC.LinkIconCopyFn NC.GetTypeIcon) (FNS NC.FillInLinkIcon NC.InvisibleLinkImageBoxFn NC.InvisibleLinkPutFn NC.InvisibleLinkGetFn) (BITMAPS NC.FileBoxIcon NC.GraphCardIcon NC.SketchCardIcon NC.TextCardIcon) (GLOBALVARS NC.FileBoxIcon NC.GraphCardIcon NC.SketchCardIcon NC.TextCardIcon))) (* * Internal variables) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NC.NoDeleteImageFns NC.SystemLinkLabels NC.InitialLinkLabels NC.SubBoxLinkLabel NC.FiledCardLinkLabel NC.BrowserContentsLinkLabel NC.ListContentsLinkLabel NC.SourceLinkLabel NC.UnspecifiedLinkLabel NC.UCASESystemLinkLabels NC.DocBackPtrLinkLabel NC.LinkIndexBackPtrLinkLabel NC.LinkIconImageFns NC.LinkIconMiddleButtonMenu NC.LinkDisplayModesMenu) ) (RPAQQ NC.SubBoxLinkLabel SubBox) (RPAQQ NC.FiledCardLinkLabel FiledCard) (RPAQQ NC.BrowserContentsLinkLabel BrowserContents) (RPAQQ NC.ListContentsLinkLabel ListContents) (RPAQQ NC.SourceLinkLabel Source) (RPAQQ NC.UnspecifiedLinkLabel Unspecified) (RPAQQ NC.DocBackPtrLinkLabel DocBackPtr) (RPAQQ NC.LinkIndexBackPtrLinkLabel LinkIndexBackPtr) (RPAQ NC.SystemLinkLabels (LIST NC.SourceLinkLabel NC.ListContentsLinkLabel NC.BrowserContentsLinkLabel NC.FiledCardLinkLabel NC.SubBoxLinkLabel NC.DocBackPtrLinkLabel NC.LinkIndexBackPtrLinkLabel)) (RPAQ NC.UCASESystemLinkLabels (FOR Label in NC.SystemLinkLabels collect (U-CASE Label))) (RPAQ NC.InitialLinkLabels (APPEND (QUOTE (Comment Remark Question Rebuttal Argument Unspecified)) NC.SystemLinkLabels)) (* * Links mechanism) [DECLARE: EVAL@COMPILE (RECORD BrowserSpecs (Format Font MotherD PersonalD FamilyD) Format ←(LIST (QUOTE LATTICE)) PersonalD ← 10) (RECORD NOTECARDLINK (LINKID SOURCEID DESTINATIONID ANCHORMODE LINKLABEL DISPLAYMODE) (TYPE? (AND (LISTP DATUM) (EQ (LENGTH DATUM) 6) (NC.IDP (CADR DATUM)) (NC.IDP (CADDR DATUM))))) ] (DEFINEQ (NC.GlobalLinkP (LAMBDA (Link) (* fgh: "16-Oct-84 12:55") (* * Return T if Link is a Global to Global link) (EQ (QUOTE GlobalGlobal) (fetch (NOTECARDLINK ANCHORMODE) of Link)))) (NC.ChildLinkP (LAMBDA (Link) (* rht: " 1-Aug-84 09:34") (* * Is link either to a filed card or sub filebox?) (OR (NC.ContentsLinkP Link) (NC.SubContentsLinkP Link)))) (NC.ReverseLinkLabelP (LAMBDA (Link ListOfLabels) (* rht: " 4-Sep-84 20:49") (* Is the reverse of Link, i.e. with "←" prefix attached, present on ListOfLabels?) (* * rht 9/4/84: Modified so as to return the linklabel found or nil.) (PROG ((Label (fetch (NOTECARDLINK LINKLABEL) of Link))) (RETURN (COND ((FMEMB (PACK* (QUOTE ←) Label) (OR (LISTP ListOfLabels) (LIST ListOfLabels))) Label)))))) (NC.GetNewLinkID (LAMBDA (DatabaseStream NoUpdateFlg) (* fgh: " 5-Oct-84 18:05") (* * Get a new link id for DatabaseStream) (PROG ((NewID NC.NextLinkID)) (RETURN (COND (NoUpdateFlg NewID) (T (* * Every 100 new ids update the info on the database) (SETQ NC.NextLinkID (ADD1 NC.NextLinkID)) (COND ((ZEROP (IREMAINDER NC.NextLinkID 100)) (NC.SaveNextLinkID DatabaseStream))) NewID)))))) (NC.SaveNextLinkID (LAMBDA (DatabaseStream ClosingDatabaseFlg) (* fgh: "31-Oct-84 00:24") (* * Save the next link id info for DatabaseStream on the database) (WITH.MONITOR (NC.FetchMonitor DatabaseStream) (COND (ClosingDatabaseFlg (* * Rule is never save a next id divisible by 100.0 That way, a system crash will be marked by an id divisible by 100, i.e., an id written during system operation rather than by system close operation.) (COND ((ZEROP (IREMAINDER NC.NextLinkID 100)) (SETQ NC.NextLinkID (ADD1 NC.NextLinkID)))))) (SETFILEPTR DatabaseStream 4) (NC.PutPtr DatabaseStream NC.NextLinkID) NC.NextLinkID))) (NC.MakeGlobalLink (LAMBDA (Window LinkLabel DestinationID SourceID DisplayMode) (* rht: " 9-Nov-84 11:59") (* * Make a new global link from DestinationID to SourceID with label LinkLabel and display mode DisplayMode. Window is optional if SourceID is specified, otherwise it is required.) (* * rht 11/9/84: Now checks result of NC.MakeLink before building link.) (PROG ((Link (NC.MakeLink Window LinkLabel DestinationID SourceID DisplayMode (QUOTE GlobalGlobal) ))) (AND Link (NC.SetGlobalLinks SourceID (CONS Link (NC.FetchGlobalLinks SourceID)))) (RETURN Link)))) (NC.AddFromLink (LAMBDA (Link DatabaseStream) (* fgh: " 5-Oct-84 18:43") (* * Add Link to the FromLinks of the appropraite card on DatbaseStream) (PROG ((ID (fetch (NOTECARDLINK DESTINATIONID) of Link))) (COND ((NC.ActiveCardP ID) (NC.SetFromLinks ID (CONS Link (NC.FetchFromLinks ID))) (NC.SetLinksDirtyFlg ID T)) (T (WITH.MONITOR (NC.FetchMonitor DatabaseStream "NC.AddFromLink") (NC.GetLinks ID DatabaseStream) (NC.SetFromLinks ID (CONS Link (NC.FetchFromLinks ID))) (NC.SetLinksDirtyFlg ID T) (NC.PutLinks ID DatabaseStream)) (NC.SetFromLinks ID NIL) (NC.SetToLinks ID NIL))) (RETURN Link)))) (NC.AddLinkToGraphCard (LAMBDA (Window) (* fgh: "25-Oct-84 00:06") (* Add a NOTECARD link to a graph card. Pass the fact that this is a link-add to NC.GraphAddNodeFn via the NoteCardInsertingLink window property) (WINDOWPROP Window (QUOTE NoteCardInsertingLink) T) (EDITADDNODE Window))) (NC.AddLinkToSketchCard (LAMBDA (SketchWindow) (* rht: "20-Dec-84 14:13") (* Called from a SKETCH window to add a new NoteCard Link Icon to the sketch) (* * rht 11/9/84: Now checks result of NC.MakeLink before building link.) (PROG ((Label (NC.AskLinkLabel SketchWindow NIL NIL T T)) Link) (RETURN (AND Label (SETQ Link (NC.MakeLink SketchWindow Label NIL NIL NIL)) (NC.InsertLinkInSketch Link SketchWindow)))))) (NC.InsertLinkInSketch (LAMBDA (Link SketchWindow) (* fgh: " 4-Oct-84 19:43") (* * Insert an icon for Link into the sketch contained in SketchWindow) (PROG ((LinkIcon (NC.MakeLinkIcon Link)) (Scale (SKETCHW.SCALE SketchWindow)) SketchIcon Size Region Position) (SETQ Size (IMAGEBOXSIZE LinkIcon)) (SETQ Position (GETBOXPOSITION (fetch (IMAGEBOX XSIZE) of Size) (fetch (IMAGEBOX YSIZE) of Size) NIL NIL SketchWindow)) (SETQ Region (CREATEREGION (fetch (POSITION XCOORD) of Position) (fetch (POSITION YCOORD) of Position) (fetch (IMAGEBOX XSIZE) of Size) (fetch (IMAGEBOX YSIZE) of Size))) (SETQ SketchIcon (create GLOBALPART INDIVIDUALGLOBALPART ←(create SKIMAGEOBJ SKIMAGEOBJ ← LinkIcon SKIMOBJ.GLOBALREGION ←( UNSCALE.REGION.FROM.SKETCHW Region SketchWindow) SKIMOBJ.ORIGSCALE ← Scale SKIMOBJ.OFFSETPOS ←(create POSITION XCOORD ←(fetch (IMAGEBOX XKERN) of Size) YCOORD ←(fetch (IMAGEBOX YDESC) of Size))) COMMONGLOBALPART ←(create COMMONGLOBALPART MAXSCALE ←(ITIMES Scale MINIMUM.VISIBLE.SCALE.FACTOR) MINSCALE ←(QUOTIENT Scale DEFAULT.VISIBLE.SCALE.FACTOR)))) (SKETCH.ADD.AND.DISPLAY SketchIcon SketchWindow) (RETURN SketchIcon)))) (NC.AddLinkToTextCard (LAMBDA (TextStream) (* fgh: "28-Sep-84 18:54") (* Called from a TEXT TEdit window to add a new link to the text.) (PROG ((Label (NC.AskLinkLabel (WINDOW.FROM.TEDIT.THING TextStream) NIL NIL T T))) (AND Label (RETURN (NC.InsertLinkInText TextStream Label NIL NIL NIL)))))) (NC.AddLinksToTextCard (LAMBDA (TextStream) (* rht: "21-Nov-84 15:20") (* * Called from a TEXT TEdit window to add multiple links to the text.) (PROG ((Label (NC.AskLinkLabel (WINDOW.FROM.TEDIT.THING TextStream) NIL NIL T T))) (AND Label (RETURN (NC.InsertLinksInText TextStream Label)))))) (NC.InsertLinkInText (LAMBDA (TextStream LinkLabel DestinationID SourceID DisplayMode) (* rht: " 9-Nov-84 12:04") (* * Add a link image object (and hence a link) to the text specified by TextStream. Link has LinkLabel, goes to DestinationID and has DisplayMode. Returns the Link inserted.) (* * rht 11/9/84: Now checks result of NC.MakeLink before building link.) (PROG ((Window (WINDOW.FROM.TEDIT.THING TextStream)) (TextObject (TEXTOBJ TextStream)) Selection Link) (RETURN (COND ((fetch (SELECTION SET) of (SETQ Selection (fetch (TEXTOBJ SEL) of TextObject))) (AND (SETQ Link (NC.MakeLink Window LinkLabel DestinationID SourceID DisplayMode)) (TEDIT.INSERT.OBJECT (NC.MakeLinkIcon Link) (TEXTSTREAM TextObject) (SELECTQ (fetch (SELECTION POINT) of Selection) (LEFT (fetch (SELECTION CH#) of Selection)) (RIGHT (IMIN (ADD1 (fetch (TEXTOBJ TEXTLEN) of TextObject)) (ADD1 (fetch (SELECTION CHLIM) of Selection)))) NIL))) Link) (T (NC.ReportError "NC.InseretLinkInText" "No selection set when inserting link image object.") NIL)))))) (NC.InsertLinksInText (LAMBDA (TextStream LinkLabel) (* rht: "20-Nov-84 00:25") (* * Add several links to the text all with the same link label.) (PROG (Window SourceID DestinationIDs) (SETQ SourceID (NC.IDFromWindow (SETQ Window (WINDOW.FROM.TEDIT.THING TextStream)))) (NC.PrintMsg Window T "Please select the Cards or Boxes to be pointed to." (CHARACTER 13)) (SETQ DestinationIDs (NC.SelectNoteCards NIL (FUNCTION (LAMBDA (CardID) (COND ((NEQ CardID SourceID) T) (T (NC.PrintMsg (NC.FetchWindow SourceID) T "A Card/Box cannot point to itself. " (CHARACTER 13) "Selection ignored." (CHARACTER 13)) NIL)))) NC.SelectingMultipleCardsMenu SourceID)) (NC.ClearMsg Window T) (for DestinationID in DestinationIDs do (NC.InsertLinkInText TextStream LinkLabel DestinationID SourceID NIL))))) (NC.AddSourceLink (LAMBDA (ID DestinationID DatabaseStream) (* fgh: " 2-Oct-84 15:43") (* Add a source link from card ID to card DestinationID in DatabaseStream) (COND ((NEQ DestinationID (QUOTE NC00000)) (NC.SetGlobalLinks ID (for Link in (NC.FetchGlobalLinks ID) unless (EQ (fetch (NOTECARDLINK DESTINATIONID) of Link) (QUOTE NC00000)) collect Link)) (NC.MakeGlobalLink NIL NC.SourceLinkLabel DestinationID ID (QUOTE Title))) (T (NC.SetGlobalLinks ID (CONS (create NOTECARDLINK DESTINATIONID ←(QUOTE NC00000) LINKLABEL ← NC.SourceLinkLabel) (NC.FetchGlobalLinks ID))))) NIL)) (NC.AddToLink (LAMBDA (Link DatabaseStream) (* fgh: " 5-Oct-84 18:43") (* * Add Link to the ToLinks of the appropriate card on DatabaseStream) (PROG ((ID (fetch (NOTECARDLINK SOURCEID) of Link))) (COND ((NC.ActiveCardP ID) (NC.SetToLinks ID (CONS Link (NC.FetchToLinks ID))) (NC.SetLinksDirtyFlg ID T)) (T (WITH.MONITOR (NC.FetchMonitor DatabaseStream "NC.AddFromLink") (NC.GetLinks ID DatabaseStream) (NC.SetToLinks ID (CONS Link (NC.FetchToLinks ID))) (NC.SetLinksDirtyFlg ID T) (NC.PutLinks ID DatabaseStream)) (NC.SetFromLinks ID NIL) (NC.SetToLinks ID NIL))) (RETURN Link)))) (NC.DelFromLink (LAMBDA (Link DatabaseStream NoOrphanHookFlg) (* rht: " 1-Dec-84 15:30") (* Delete a FromLink from card on DatabaseStream. Hook card to orphan if this is the last link.) (* * rht 11/15/84: Changed decision as to when to orphanize a card. Now must have deleted its last link (not just last subbox or filedcard link). Also checks that link doesn't point from card to itself.) (* * rht 12/1/84: Now doesn't do any work unless ID is valid, i.e. not DELETED or FREE.) (PROG ((ID (fetch (NOTECARDLINK DESTINATIONID) of Link))) (COND ((NOT (NC.ValidID ID))) ((NC.ActiveCardP ID) (NC.SetFromLinks ID (DREMOVE (for OldLink in (NC.FetchFromLinks ID) thereis (AND (EQ (fetch (NOTECARDLINK LINKID) of Link) (fetch (NOTECARDLINK LINKID) of OldLink)) OldLink)) (NC.FetchFromLinks ID))) (NC.SetLinksDirtyFlg ID T) (AND (NULL NoOrphanHookFlg) (NOT (FMEMB ID NC.TopLevelCards)) (NOT (EQ (fetch (NOTECARDLINK SOURCEID) of Link) ID)) (NULL (NC.FetchNewCardFlg ID)) (NOT (EQ (fetch (NOTECARDLINK SOURCEID) of Link) NC.OrphanID)) (COND ((OR (NULL (NC.FetchFromLinks ID)) (for Link in (NC.FetchFromLinks ID) always (EQ (fetch (NOTECARDLINK SOURCEID) of Link) ID))) (NC.PrintMsg NIL T "You have just removed the last link to " (NC.RetrieveTitle ID) "." (CHARACTER 13) "It is being filed in the Orphan FileBox.") (NC.HookToOrphanCard ID NC.OrphanID DatabaseStream)) ((for Link in (NC.FetchFromLinks ID) never (FMEMB (fetch (NOTECARDLINK LINKLABEL) of Link) (QUOTE (SubBox FiledCard)))) (NC.PrintMsg NIL T "You have just unfiled " (NC.RetrieveTitle ID) " from its last filebox." (CHARACTER 13) "It is being filed in the Orphan FileBox.") (NC.HookToOrphanCard ID NC.OrphanID DatabaseStream))))) (T (WITH.MONITOR (NC.FetchMonitor DatabaseStream "NC.AddFromLink") (NC.GetLinks ID DatabaseStream) (NC.SetFromLinks ID (DREMOVE (for OldLink in (NC.FetchFromLinks ID) thereis (AND (EQ (fetch (NOTECARDLINK LINKID) of Link) (fetch (NOTECARDLINK LINKID) of OldLink)) OldLink)) (NC.FetchFromLinks ID))) (NC.SetLinksDirtyFlg ID T) (NC.PutLinks ID DatabaseStream) (AND (NULL NoOrphanHookFlg) (NOT (FMEMB ID NC.TopLevelCards)) (NOT (EQ (fetch (NOTECARDLINK SOURCEID) of Link) ID)) (NULL (NC.FetchNewCardFlg ID)) (NOT (EQ (fetch (NOTECARDLINK SOURCEID) of Link) NC.OrphanID)) (COND ((OR (NULL (NC.FetchFromLinks ID)) (for Link in (NC.FetchFromLinks ID) always (EQ (fetch (NOTECARDLINK SOURCEID) of Link) ID))) (NC.PrintMsg NIL T "You have just removed the last link to " (NC.RetrieveTitle ID) "." (CHARACTER 13) "It is being filed in the Orphan FileBox.") (NC.HookToOrphanCard ID NC.OrphanID DatabaseStream)) ((for Link in (NC.FetchFromLinks ID) never (FMEMB (fetch (NOTECARDLINK LINKLABEL) of Link) (QUOTE (SubBox FiledCard)))) (NC.PrintMsg NIL T "You have just unfiled " (NC.RetrieveTitle ID) " from its last filebox." (CHARACTER 13) "It is being filed in the Orphan FileBox.") (NC.HookToOrphanCard ID NC.OrphanID DatabaseStream))))) (NC.SetFromLinks ID NIL) (NC.SetToLinks ID NIL))) (RETURN Link)))) (NC.DelToLink (LAMBDA (Link DatabaseStream) (* rht: " 1-Dec-84 15:28") (* * Delete ToLink spoecified by Link from cards on DatabasseStream) (* * rht 12/1/84: Now doesn't do any work unless ID is valid, i.e. not DELETED or FREE.) (PROG ((ID (fetch (NOTECARDLINK SOURCEID) of Link))) (COND ((NOT (NC.ValidID ID))) ((NC.ActiveCardP ID) (NC.SetToLinks ID (DREMOVE (for OldLink in (NC.FetchToLinks ID) thereis (AND (EQ (fetch (NOTECARDLINK LINKID) of Link) (fetch (NOTECARDLINK LINKID) of OldLink)) OldLink)) (NC.FetchToLinks ID))) (NC.SetLinksDirtyFlg ID T)) (T (WITH.MONITOR (NC.FetchMonitor DatabaseStream "NC.AddFromLink") (NC.GetLinks ID DatabaseStream) (NC.SetToLinks ID (DREMOVE (for OldLink in (NC.FetchToLinks ID) thereis (AND (EQ (fetch (NOTECARDLINK LINKID) of Link) (fetch (NOTECARDLINK LINKID) of OldLink)) OldLink)) (NC.FetchToLinks ID))) (NC.SetLinksDirtyFlg ID T) (NC.PutLinks ID DatabaseStream)) (NC.SetFromLinks ID NIL) (NC.SetToLinks ID NIL))) (RETURN Link)))) (NC.DelReferencesToCard (LAMBDA (SourceID LinkOrDestinationID DatabaseStream) (* fgh: "23-Oct-84 12:01") (* The card specified by DestinationID is being deleted. Remove all references to it from the card specified by SourceID) (PROG (NoteCardType Substance) (COND ((NC.ActiveCardP SourceID) (SETQ NoteCardType (NC.FetchType SourceID)) (SETQ Substance (NC.FetchSubstance SourceID)) (APPLY* (NC.DelReferencesFn NoteCardType) SourceID LinkOrDestinationID)) (T (WITH.MONITOR (NC.FetchMonitor DatabaseStream "NC.DeleteReferencesToCard") (NC.GetNoteCard SourceID DatabaseStream) (SETQ NoteCardType (NC.FetchType SourceID)) (SETQ Substance (NC.FetchSubstance SourceID)) (APPLY* (NC.DelReferencesFn NoteCardType) SourceID LinkOrDestinationID) (NC.PutNoteCard SourceID DatabaseStream) (NC.DeactivateCard SourceID)))) (NC.DelReferencesToCardFromGlobalList SourceID LinkOrDestinationID DatabaseStream)))) (NC.DelReferencesToCardFromGlobalList (LAMBDA (SourceID LinkOrDestinationID DatabaseStream) (* rht: "19-Nov-84 22:53") (* The card or link specified by DestinationID is being deleted. Remove all references to it from the global links list of the card specified by SourceID) (* * rht 11/19/84: Fixed a naming typo changing ID to SourceID everywhere. Also fixed DestinationID arg to be LinkOrDestinationID.) (COND ((NC.ActiveCardP SourceID) (NC.SetGlobalLinks SourceID (for Link in (NC.FetchGlobalLinks SourceID) when (if (NC.IDP LinkOrDestinationID) then (NEQ LinkOrDestinationID (fetch (NOTECARDLINK DESTINATIONID) of Link)) else (NEQ (fetch (NOTECARDLINK LINKID) of LinkOrDestinationID) (fetch (NOTECARDLINK LINKID) of Link))) collect Link))) (T (WITH.MONITOR (NC.FetchMonitor DatabaseStream) (NC.GetLinks SourceID DatabaseStream) (NC.SetGlobalLinks SourceID (for Link in (NC.FetchGlobalLinks SourceID) when (if (NC.IDP LinkOrDestinationID) then (NEQ LinkOrDestinationID (fetch (NOTECARDLINK DESTINATIONID) of Link)) else (NEQ (fetch (NOTECARDLINK LINKID) of LinkOrDestinationID) (fetch (NOTECARDLINK LINKID) of Link))) collect Link)) (NC.PutLinks SourceID DatabaseStream)))))) (NC.DelReferencesToCardFromGraph (LAMBDA (SourceID LinkOrDestinationID) (* rht: "17-Nov-84 18:05") (* Delete from the graph specified by Graph all link icon nodes whose DESTINATIONID is eq to DestinationID) (* * rht 11/17/84: Now only redisplays graph if ID is both active *and* has a window.) (PROG ((ImageBox (NC.DeletedLinkImageBoxFn NC.DeletedLinkImageObject)) LinkIcon (LinkFlg (type? NOTECARDLINK LinkOrDestinationID)) LinkID DestinationID Graph) (COND (LinkFlg (SETQ LinkID (fetch (NOTECARDLINK LINKID) of LinkOrDestinationID)) (OR (NC.IDP SourceID) (SETQ SourceID (fetch (NOTECARDLINK SOURCEID) of LinkOrDestinationID)))) (T (SETQ DestinationID LinkOrDestinationID))) (SETQ Graph (NC.FetchSubstance SourceID)) (for GraphNode in (fetch (GRAPH GRAPHNODES) of Graph) when (AND (NC.LinkIconImageObjP (SETQ LinkIcon (fetch (GRAPHNODE NODELABEL) of GraphNode))) (COND (LinkFlg (EQ LinkID (fetch (NOTECARDLINK LINKID) of (NC.FetchLinkFromLinkIcon LinkIcon)))) (T (EQ (fetch (NOTECARDLINK DESTINATIONID) of (NC.FetchLinkFromLinkIcon LinkIcon)) DestinationID)))) do (replace (GRAPHNODE NODELABEL) of GraphNode with NC.DeletedLinkImageObject) (replace (GRAPHNODE NODEWIDTH) of GraphNode with (fetch (IMAGEBOX XSIZE) of ImageBox)) (replace (GRAPHNODE NODEHEIGHT) of GraphNode with (fetch (IMAGEBOX YSIZE) of ImageBox))) (if (AND (NC.ActiveCardP SourceID) (NC.FetchWindow SourceID)) then (REDISPLAYGRAPH (NC.FetchWindow SourceID)))))) (NC.DelReferencesToCardFromSketch (LAMBDA (SourceID LinkOrDestinationID) (* fgh: "23-Oct-84 12:07") (* * Remove all Link Icons pointing to Destination ID from the sketch Substance.) (PROG ((LinkFlg (type? NOTECARDLINK LinkOrDestinationID)) LinkID DestinationID Substance) (COND (LinkFlg (SETQ LinkID (fetch (NOTECARDLINK LINKID) of LinkOrDestinationID)) (OR (NC.IDP SourceID) (SETQ SourceID (fetch (NOTECARDLINK SOURCEID) of LinkOrDestinationID)))) (T (SETQ DestinationID LinkOrDestinationID))) (SETQ Substance (NC.FetchSubstance SourceID)) (bind SkImageObj (ImageBox ←(IMAGEBOXSIZE NC.DeletedLinkImageObject)) for SketchElt in (SUBSET (fetch (SKETCH SKETCHELTS) of Substance) (FUNCTION (LAMBDA (SketchElt) (PROG (LinkIcon) (RETURN (AND (EQ (fetch (GLOBALPART GTYPE) of SketchElt) (QUOTE SKIMAGEOBJ)) (NC.LinkIconImageObjP (SETQ LinkIcon (fetch (SKIMAGEOBJ SKIMAGEOBJ) of (fetch (GLOBALPART INDIVIDUALGLOBALPART) of SketchElt)))) (COND (LinkFlg (EQ LinkID (fetch (NOTECARDLINK LINKID) of (NC.FetchLinkFromLinkIcon LinkIcon)))) (T (EQ DestinationID (fetch (NOTECARDLINK DESTINATIONID) of (NC.FetchLinkFromLinkIcon LinkIcon))))))))))) do (SETQ SkImageObj (fetch (GLOBALPART INDIVIDUALGLOBALPART) of SketchElt)) (replace (SKIMAGEOBJ SKIMAGEOBJ) of SkImageObj with NC.DeletedLinkImageObject) (replace (SKIMAGEOBJ SKIMOBJ.GLOBALREGION) of SkImageObj with (CREATEREGION (fetch (REGION LEFT) of (fetch (SKIMAGEOBJ SKIMOBJ.GLOBALREGION) of SkImageObj)) (fetch (REGION BOTTOM) of (fetch (SKIMAGEOBJ SKIMOBJ.GLOBALREGION) of SkImageObj)) (fetch (IMAGEBOX XSIZE) of ImageBox) (fetch (IMAGEBOX YSIZE) of ImageBox))))))) (NC.DelReferencesToCardFromText (LAMBDA (SourceID LinkOrDestinationID) (* fgh: "23-Oct-84 12:04") (* Delete all IMAGEOBJECTS in textstream specified by Substance that are Link Icons whose DESTINATIONID is eq to Destination ID) (PROG ((LinkFlg (type? NOTECARDLINK LinkOrDestinationID)) LinkID DestinationID) (COND (LinkFlg (SETQ LinkID (fetch (NOTECARDLINK LINKID) of LinkOrDestinationID)) (OR (NC.IDP SourceID) (SETQ SourceID (fetch (NOTECARDLINK SOURCEID) of LinkOrDestinationID)))) (T (SETQ DestinationID LinkOrDestinationID))) (SETQ Substance (NC.FetchSubstance SourceID)) (for Link in (TEDIT.LIST.OF.OBJECTS (TEXTOBJ Substance) (FUNCTION NC.LinkIconImageObjP)) when (COND (LinkFlg (EQ LinkID (fetch (NOTECARDLINK LINKID) of (NC.FetchLinkFromLinkIcon (CAR Link))))) (T (EQ (fetch (NOTECARDLINK DESTINATIONID) of (NC.FetchLinkFromLinkIcon (CAR Link))) DestinationID))) do (replace (IMAGEOBJ IMAGEOBJFNS) of (CAR Link) with NC.NoDeleteImageFns) (* WHENDELETEDFN taken care of earlier in delete cycle) (TEDIT.DELETE Substance (CADR Link) 1) (TEDIT.INSERT.OBJECT NC.DeletedLinkImageObject Substance (CADR Link)))))) (NC.DeletedLinkDisplayFn (LAMBDA (ImageObj Stream) (* fgh: " 5-Oct-84 11:36") (SELECTQ (IMAGESTREAMTYPE Stream) (DISPLAY (* This is being displayed on the screen) (PROG ((ImageBox (NC.DeletedLinkImageBoxFn ImageObj Stream)) Bottom XSize YSize Left) (DSPXPOSITION (IPLUS 3 (SETQ Left (DSPXPOSITION NIL Stream))) Stream) (SETQ XSize (fetch (IMAGEBOX XSIZE) of ImageBox)) (SETQ YSize (fetch (IMAGEBOX YSIZE) of ImageBox)) (SETQ Bottom (IDIFFERENCE (DSPYPOSITION NIL Stream) (fetch (IMAGEBOX YDESC) of ImageBox))) (* don't bother to errorset this) (DSPFONT (PROG1 (DSPFONT TEDIT.DEFAULT.FONT Stream) (PRIN1 "Deleted" Stream)) Stream) (BITBLT NIL NIL NIL Stream (ADD1 Left) (IPLUS Bottom 2) (IDIFFERENCE XSize 2) (IDIFFERENCE YSize 4) (QUOTE TEXTURE) (COND ((EQ (DSPOPERATION NIL Stream) (QUOTE ERASE)) (QUOTE ERASE)) (T (QUOTE INVERT))) BLACKSHADE))) ((PRESS INTERPRESS) (* It's being displayed on a press file) NIL) NIL))) (NC.DeletedLinkGetFn (LAMBDA (InputStream TextStream) (* fgh: "26-Feb-84 01:17") (BIN InputStream) NC.DeletedLinkImageObject)) (NC.DeletedLinkImageBoxFn (LAMBDA (ImageObj Stream) (* NoteCards% User " 7-Jun-84 18:29") (PROG ((Font TEDIT.DEFAULT.FONT)) (RETURN (create IMAGEBOX XSIZE ←(IPLUS 6 (STRINGWIDTH "Deleted" Font)) YSIZE ←(IPLUS 4 (FONTPROP Font (QUOTE HEIGHT))) YDESC ←(IPLUS 2 (FONTPROP Font (QUOTE DESCENT))) XKERN ← 0))))) (NC.DeletedLinkPutFn (LAMBDA (ImageObj OutputStream) (* fgh: "26-Feb-84 01:04") (BOUT OutputStream 1))) (NC.CheckForOrphanDelete (LAMBDA (SourceID DestinationID SourceWindow) (* fgh: " 5-Oct-84 17:16") (* Check to make sure we are not deleteing the last reference to a note card from the orphan card. Last references are okay to delete it since they will be put in the orphan card. But deleting last reference from the orphan card is very, very bad. Warn the user.) (PROG ((FilingLinks (LIST NC.SubBoxLinkLabel NC.FiledCardLinkLabel))) (RETURN (AND (EQ SourceID NC.OrphanID) (NOT (for Link in (COND ((NC.ActiveCardP DestinationID) (NC.FetchFromLinks DestinationID)) (T (NC.GetLinks DestinationID PSA.Database) (NC.FetchFromLinks DestinationID))) thereis (AND (FMEMB (fetch (NOTECARDLINK LINKLABEL) of Link) FilingLinks) (NEQ (fetch (NOTECARDLINK SOURCEID) of Link) NC.OrphanID)))) (NC.PrintMsg (NC.FetchWindow SourceID) T (NC.RetrieveTitle DestinationID) (CHARACTER 13) "You have just deleted the last pointer to this Card/Box from the Orphan Box." (CHARACTER 13) "The Search operation can be used to create a new pointer.")))))) (NC.HookToOrphanCard (LAMBDA (ID OrphanCardID DatabaseStream FromID) (* NoteCards% User "26-Jun-84 18:24") (* The last reference to the card has just been deleted. Hook this card to the orphan card so it doesn't get lost forever) (COND ((NC.ActiveCardP OrphanCardID) (NC.MakeAContentsHook OrphanCardID ID (COND ((EQ (NC.RetrieveType ID DatabaseStream) (QUOTE CONTENTS)) (QUOTE Sub)) (T NIL)) DatabaseStream)) (T (WITH.MONITOR (NC.FetchMonitor DatabaseStream) (NC.GetNoteCard OrphanCardID DatabaseStream) (NC.MakeAContentsHook OrphanCardID ID (COND ((EQ (NC.RetrieveType ID DatabaseStream) (QUOTE CONTENTS)) (QUOTE Sub)) (T NIL)) DatabaseStream) (NC.PutNoteCard OrphanCardID DatabaseStream) (NC.PutLinks OrphanCardID DatabaseStream) (NC.DeactivateCard OrphanCardID)))))) (NC.InsertLinkBeforeMarker (LAMBDA (SourceID DestinationID LinkLabel DisplayMode Marker# DatabaseStream NoSpacerFlg) (* rht: " 7-Dec-84 20:06") (* Insert a link to DestinationID in SourceID just before the Marker#'th place marker object) (* * rht 12/7/84: Now returns the newly created link.) (PROG (Objects TextStream TextObject SEL InsertCharPtr (Spacer (CONCAT (CHARACTER 13))) Link) (COND ((NC.ActiveCardP SourceID) (SETQ TextStream (NC.FetchSubstance SourceID)) (SETQ TextObject (TEXTOBJ TextStream)) (COND ((AND (SETQ Objects (TEDIT.LIST.OF.OBJECTS TextObject (FUNCTION NC.PlaceMarkerP))) (FIXP Marker#)) (COND ((EQ Marker# 0) (TEDIT.SETSEL TextStream 1 0 (QUOTE LEFT))) ((IGREATERP Marker# (FLENGTH Objects)) (TEDIT.SETSEL TextStream (GETEOFPTR TextStream) 0 (QUOTE RIGHT))) (T (TEDIT.SETSEL TextStream (CADAR (FNTH Objects Marker#)) 0 (QUOTE LEFT))))) (NC.MarkersInFileBoxesFlg (TEDIT.SETSEL TextStream (GETEOFPTR TextStream) 0 (QUOTE RIGHT)))) (SETQ SEL (fetch (TEXTOBJ SEL) of TextObject)) (SETQ Link (NC.InsertLinkInText TextStream LinkLabel DestinationID SourceID DisplayMode) ) (COND ((NULL NoSpacerFlg) (TEDIT.SETSEL TextStream (SELECTQ (fetch (SELECTION POINT) of SEL) (LEFT (SUB1 (fetch (SELECTION CH#) of SEL))) (RIGHT (IMIN (ADD1 (fetch (TEXTOBJ TEXTLEN) of TextObject)) (ADD1 (fetch (SELECTION CHLIM) of SEL)))) NIL) 0 (QUOTE RIGHT)) (TEDIT.INSERT TextStream Spacer)))) (T (WITH.MONITOR (NC.FetchMonitor DatabaseStream) (COND ((NC.IDP (NC.GetNoteCard SourceID DatabaseStream)) (SETQ TextStream (NC.FetchSubstance SourceID)) (SETQ TextObject (TEXTOBJ TextStream)) (COND ((AND (SETQ Objects (TEDIT.LIST.OF.OBJECTS TextObject (FUNCTION NC.PlaceMarkerP))) (FIXP Marker#)) (COND ((EQ Marker# 0) (TEDIT.SETSEL TextStream 1 0 (QUOTE LEFT))) ((IGREATERP Marker# (FLENGTH Objects)) (TEDIT.SETSEL TextStream (GETEOFPTR TextStream) 0 (QUOTE RIGHT))) (T (TEDIT.SETSEL TextStream (CADAR (FNTH Objects Marker#)) 0 (QUOTE LEFT))))) (NC.MarkersInFileBoxesFlg (TEDIT.SETSEL TextStream (GETEOFPTR TextStream) 0 (QUOTE RIGHT)))) (SETQ SEL (fetch (TEXTOBJ SEL) of TextObject)) (SETQ Link (NC.InsertLinkInText TextStream LinkLabel DestinationID SourceID DisplayMode)) (COND ((NULL NoSpacerFlg) (TEDIT.SETSEL TextStream (SELECTQ (fetch (SELECTION POINT) of SEL) (LEFT (SUB1 (fetch (SELECTION CH#) of SEL))) (RIGHT (IMIN (ADD1 (fetch (TEXTOBJ TEXTLEN) of TextObject)) (ADD1 (fetch (SELECTION CHLIM) of SEL)))) NIL) 0 (QUOTE RIGHT)) (TEDIT.INSERT TextStream Spacer))) (NC.PutNoteCard SourceID DatabaseStream) (NC.PutLinks SourceID DatabaseStream) (NC.DeactivateCard SourceID)))))) (RETURN Link)))) (NC.LinkLabelP (LAMBDA (Link ListOfLabels) (* rht: " 4-Sep-84 17:21") (* * rht 9/4/84: Modified so as to return the linklabel if found or nil.) (CAR (FMEMB (fetch (NOTECARDLINK LINKLABEL) of Link) (OR (LISTP ListOfLabels) (LIST ListOfLabels)))))) (NC.MakeAContentsHook (LAMBDA (ContentsID DestinationID SubOrSuperFlg DatabaseStream) (* fgh: "28-Sep-84 19:09") (* Make a link from a contents card to another card as specified by DestinationID. If card is a regular card, insert link at end of contents card. If card is a supercontents of contents card then insert just before the subcontents marker (i.e., at end of super contents list). If card is a subcontents card then insert just before note cards marker (i.e., at end of subcontents list)) (COND ((EQ SubOrSuperFlg (QUOTE Sub)) (NC.InsertLinkBeforeMarker ContentsID DestinationID NC.SubBoxLinkLabel NIL 2 DatabaseStream)) (T (NC.InsertLinkBeforeMarker ContentsID DestinationID NC.FiledCardLinkLabel NIL NIL DatabaseStream))))) (NC.MakeLink (LAMBDA (Window LinkLabel DestinationID SourceID DisplayMode AnchorMode) (* rht: "26-Nov-84 11:47") (* Make a link from (OR Window SourceID) to DestinationID with linklabel of LinkLabel) (PROG (LinkID Link) (OR SourceID (SETQ SourceID (NC.IDFromWindow Window))) (OR DestinationID (PROGN (NC.PrintMsg (NC.FetchWindow SourceID) T "Please select the Card or Box to be linked to." (CHARACTER 13)) (SETQ DestinationID (NC.SelectNoteCards T (FUNCTION (LAMBDA (CardID) (COND ((NEQ CardID SourceID) T) (T (NC.PrintMsg (NC.FetchWindow SourceID) T "A Card/Box cannot link to itself. " (CHARACTER 13) "Selection ignored." (CHARACTER 13)) NIL)))) NC.SelectingSingleCardMenu SourceID)) (NC.ClearMsg (NC.FetchWindow SourceID) T))) (AND (NULL DestinationID) (RETURN NIL)) (COND ((EQ DestinationID (QUOTE *New% Card*)) (SETQ DestinationID (WINDOWPROP (NC.MakeNoteCard) (QUOTE NoteCardID))))) (SETQ LinkID (NC.GetNewLinkID PSA.Database)) (SETQ Link (create NOTECARDLINK LINKID ← LinkID SOURCEID ← SourceID DESTINATIONID ← DestinationID ANCHORMODE ← AnchorMode LINKLABEL ← LinkLabel DISPLAYMODE ←(OR DisplayMode (NC.DefaultLinkDisplayMode SourceID PSA.Database)))) (NC.AddToLink Link PSA.Database) (NC.AddFromLink Link PSA.Database) (RETURN Link)))) (NC.MakeContentsHooks (LAMBDA (ID DatabaseStream) (* rht: " 8-Dec-84 16:49") (* Hooks card specified by ID to all of the current contents cards by a Contents link) (* * rht 8/1/84: Changed the NC.PrintMsg2 call for "No FileBox has been specified." to use NIL as second arg rather than T. This prevents erasure of previous error messages.) (* * rht 12/8/84: Massive rewrite. Now calls NC.MakeChildLink. And always orphanizes if no parent specified. This is because it's currently called only by NC.InsureProperFiling.) (PROG (OneHook (Window (NC.FetchWindow ID)) NewParents) (NC.PrintMsg Window NIL "Please select the Boxes to file this card in." (CHARACTER 13) "NoBox files it in the ToBeFiled box." (CHARACTER 13)) (SETQ NewParents (NC.SelectNoteCards NIL (QUOTE NC.ContentsCardP) NC.SelectingContentsMenu ID)) (if (NULL (AND NewParents (for ParentID in NewParents bind OneHook when (NC.MakeChildLink ID ParentID Window) do (SETQ OneHook T) finally (RETURN OneHook)))) then (NC.PrintMsg Window NIL "No FileBox has been specified." (CHARACTER 13) "This card will be filed in the ToBeFiled Box." (CHARACTER 13)) (NC.HookToOrphanCard ID NC.UnclassifiedID DatabaseStream NIL)) (COND ((GETPROMPTWINDOW Window NIL NIL T) (SPAWN.MOUSE) (DISMISS 2000) (NC.ClearMsg Window T)))))) (NC.RelabelLink (LAMBDA (LinkOrLinkIcon Window NewLinkLabel ForceRedisplayFlg) (* rht: "20-Nov-84 11:41" pp pp) (* Relabel a NoteCard link. Ask user for new label. Update all the proper references to this link.) (* * rht 11/19/84: Fixed so that ID is defined before first use.) (PROG (Link LinkIcon LinkID ID DestinationID OldLabel NoteCardType GlobalLinkFlg) (COND ((NC.LinkIconImageObjP LinkOrLinkIcon) (SETQ Link (NC.FetchLinkFromLinkIcon LinkOrLinkIcon)) (SETQ LinkIcon LinkOrLinkIcon)) (T (SETQ Link LinkOrLinkIcon) (COND ((NOT (SETQ GlobalLinkFlg (NC.GlobalLinkP Link))) (SETQ LinkIcon (NC.FetchLinkIconForLink Link)))))) (SETQ ID (fetch (NOTECARDLINK SOURCEID) of Link)) (COND ((WINDOWP Window)) ((NC.ActiveCardP ID) (SETQ Window (NC.FetchWindow ID)))) (COND ((NC.SystemLinkLabelP (fetch (NOTECARDLINK LINKLABEL) of Link)) (NC.PrintMsg Window T "This is a system maintained pointer." (CHARACTER 13) "You cannot change its label." (CHARACTER 13)) (SPAWN.MOUSE) (DISMISS 1500) (NC.ClearMsg Window T)) ((SETQ NewLinkLabel (OR NewLinkLabel (NC.AskLinkLabel Window NIL NIL T T))) (SETQ DestinationID (fetch (NOTECARDLINK DESTINATIONID) of Link)) (SETQ LinkID (fetch (NOTECARDLINK LINKID) of Link)) (SETQ NoteCardType (NC.FetchType ID)) (* * Put new label in Link Icon or global links list) (COND (GlobalLinkFlg (for GlobalLink in (NC.FetchGlobalLinks ID) when (EQ (fetch (NOTECARDLINK LINKID) of GlobalLink) LinkID) do (replace (NOTECARDLINK LINKLABEL) of GlobalLink with NewLinkLabel) (NC.SetLinksDirtyFlg ID T) (RETURN))) (T (replace (NOTECARDLINK LINKLABEL) of (NC.FetchLinkFromLinkIcon LinkIcon) with NewLinkLabel) (NC.MarkCardDirty ID))) (* * Update ToLink list of the SourceID card) (for ToLink in (NC.FetchToLinks ID) when (EQ (fetch (NOTECARDLINK LINKID) of ToLink) LinkID) do (replace (NOTECARDLINK LINKLABEL) of ToLink with NewLinkLabel) (NC.SetLinksDirtyFlg ID T) (RETURN)) (* * Update FromLink list of DestinationID card) (COND ((NC.ActiveCardP DestinationID) (for FromLink in (NC.FetchFromLinks DestinationID) when (EQ (fetch (NOTECARDLINK LINKID) of FromLink) LinkID) do (replace (NOTECARDLINK LINKLABEL) of FromLink with NewLinkLabel) (NC.SetLinksDirtyFlg DestinationID T) (RETURN))) (T (WITH.MONITOR (NC.FetchMonitor PSA.Database) (NC.GetLinks DestinationID PSA.Database) (for FromLink in (NC.FetchFromLinks DestinationID) when (EQ (fetch (NOTECARDLINK LINKID) of FromLink) LinkID) do (replace (NOTECARDLINK LINKLABEL) of FromLink with NewLinkLabel) (NC.SetLinksDirtyFlg DestinationID T) (RETURN)) (NC.PutLinks DestinationID PSA.Database) (NC.DeactivateCard DestinationID)))) (* * Update images in SourceID window) (COND ((AND (NULL ForceRedisplayFlg) (NC.TEditBasedP NoteCardType)) (RETURN (QUOTE CHANGED))) ((WINDOWP Window) (NC.UpdateLinkImages Window (fetch (NOTECARDLINK DESTINATIONID) of Link)) (RETURN NIL)) (T (RETURN NIL)))))))) (NC.SystemLinkLabelP (LAMBDA (LinkLabel) (* fgh: "23-Apr-84 23:07") (* Return T in LinkLabel is a label for a system maintained link. NIL otherwise. System maintained links determined by hardwire list for now.) (FMEMB LinkLabel NC.SystemLinkLabels))) (NC.ValidLinkP (LAMBDA (Link DatabaseStream ZeroLinkOkayFlg) (* fgh: "29-May-84 16:07") (* Check Link to see if it is a valid NOTECARDLINK, incvluding check that the NoteCard specified by DESTINATIONID is an active card.) (PROG (DestinationID) (* If old format Link, just add on extra field) (AND (EQ (LENGTH Link) 2) (NCONC1 Link NIL)) (RETURN (AND (type? NOTECARDLINK Link) (OR (NC.IDP (SETQ DestinationID (fetch (NOTECARDLINK DESTINATIONID) of Link))) (AND ZeroLinkOkayFlg (EQ DestinationID (QUOTE NC00000)))) (PROG1 (OR (AND ZeroLinkOkayFlg (EQ DestinationID (QUOTE NC00000))) (EQ (NC.GetNoteCard DestinationID DatabaseStream) DestinationID)) (NC.DeactivateCard DestinationID))))))) (NC.MakeChildLink (LAMBDA (ChildID ParentID Window) (* rht: " 7-Dec-84 20:09") (* * Tries to add ChildID as a child of ParentID using either FiledCard or SubBox link as appropriate. Won't allow if would cause a cycle. Returns new link if successful, else NIL.) (COND ((for Link in (NC.FetchToLinks ParentID) thereis (AND (NC.ChildLinkP Link) (EQ ChildID (fetch (NOTECARDLINK DESTINATIONID) of Link)))) (NC.PrintMsg Window NIL (NC.RetrieveTitle ChildID PSA.Database) " is already a child of " (NC.RetrieveTitle ParentID PSA.Database) (CHARACTER 13)) NIL) ((AND (NEQ ParentID ChildID) (NC.NotDaughterP ChildID ParentID (FUNCTION NC.ChildLinkP))) (NC.MakeAContentsHook ParentID ChildID (if (EQ (NC.FetchType ChildID) (QUOTE FileBox)) then (QUOTE Sub)) PSA.Database)) (T (NC.PrintMsg Window T (NC.RetrieveTitle ChildID PSA.Database) " is an ancestor of " (NC.RetrieveTitle ParentID PSA.Database) (CHARACTER 13)) NIL)))) ) (* * Link display icons) (DEFINEQ (NC.SetLinkInLinkIcon (LAMBDA (LinkIcon Link) (* fgh: "16-Oct-84 23:41") (* * Set LinkIcon to be the icon for Link) (IMAGEOBJPROP LinkIcon (QUOTE OBJECTDATUM) Link))) (NC.FetchLinkIconForLink (LAMBDA (Link) (* fgh: "23-Oct-84 11:52") (* * Find the Link Icon corresponding to Link) (PROG ((LinkID (fetch (NOTECARDLINK LINKID) of Link)) (SourceID (fetch (NOTECARDLINK SOURCEID) of Link))) (RETURN (for LinkIcon in (CAR (APPLY* (NC.CollectReferencesFn (NC.FetchType SourceID)) SourceID NIL PSA.Database T)) thereis (COND ((EQ LinkID (fetch (NOTECARDLINK LINKID) of (NC.FetchLinkFromLinkIcon LinkIcon))) LinkIcon) (T NIL))))))) (NC.MakeLinkIcon (LAMBDA (Link) (* fgh: " 1-Oct-84 20:48") (* * Create a Link Icon image object from the lionk info in Link) (IMAGEOBJCREATE Link NC.LinkIconImageFns))) (NC.LinkIconButtonEventInFn (LAMBDA (ImageObject WINDOW) (* fgh: " 8-Nov-84 16:32") (* If the guy buttons inside a link image object) (PROG (ID ClippingRegion HotRegion LeftButtonFlg (Link (NC.FetchLinkFromLinkIcon ImageObject))) (SETQ WINDOW (COND ((WINDOWP WINDOW) WINDOW) ((DISPLAYSTREAMP WINDOW) (WFROMDS WINDOW)) ((TEXTSTREAMP WINDOW) (WINDOW.FROM.TEDIT.THING WINDOW)) (T NIL))) (SETQ LeftButtonFlg (MOUSESTATE LEFT)) (SETQ ClippingRegion (DSPCLIPPINGREGION NIL WINDOW)) (SETQ HotRegion (CREATEREGION (IPLUS (fetch (REGION LEFT) of ClippingRegion) (FTIMES .25 (fetch (REGION WIDTH) of ClippingRegion))) (fetch (REGION BOTTOM) of ClippingRegion) (FTIMES .5 (fetch (REGION WIDTH) of ClippingRegion)) (fetch (REGION HEIGHT) of ClippingRegion))) (until (OR (MOUSESTATE UP) (INSIDEP HotRegion (LASTMOUSEX WINDOW) (LASTMOUSEY WINDOW)))) (AND (MOUSESTATE UP) (RETURN NIL)) (RESETLST (RESETSAVE (INVERTW WINDOW)) (until (OR (MOUSESTATE UP) (NOT (INSIDEP HotRegion (LASTMOUSEX WINDOW) (LASTMOUSEY WINDOW)))))) (COND ((INSIDEP HotRegion (LASTMOUSEX WINDOW) (LASTMOUSEY WINDOW)) (RETURN (COND ((EQ NC.SelectionInProgress T) (* A selection is in progress. Don't really want to edit this object, want to select it. Just add to the selection collection list.) (AND (SETQ ID (fetch (NOTECARDLINK DESTINATIONID) of Link)) (NOT (FMEMB ID NC.SelectedCards)) (SETQ NC.SelectedCards (CONS ID NC.SelectedCards)))) ((EQ NC.SelectionInProgress (QUOTE Links)) (AND (NOT (MEMBER Link NC.SelectedCards)) (SETQ NC.SelectedCards (CONS Link NC.SelectedCards)))) (LeftButtonFlg (NC.EditNoteCard (fetch (NOTECARDLINK DESTINATIONID) of Link))) (T (NC.LinkIconMiddleButtonFn ImageObject WINDOW))))) ((INSIDEP ClippingRegion (LASTMOUSEX WINDOW) (LASTMOUSEY WINDOW)) (RETURN NIL)) (T (RETURN NIL)))))) (NC.LinkIconDisplayFn (LAMBDA (ImageObj ImageStream STREAMTYPE TEXTSTREAM SCALE TitleFlg) (* rht: "10-Dec-84 16:37") (* * Display a link icon) (* * rht 11/13/84: Made width of box lines also scale dependent.) (* * rht 12/4/84: Hacked so type-dependent icons come out optionally to left of text.) (PROG (YSize XSize Left Bottom DisplayType Window ID Title Label BoxLeft BoxBottom BoxWidth BoxHeight TextLeft TextBaseLine ImageBox (Scale (DSPSCALE NIL ImageStream)) (Link (NC.FetchLinkFromLinkIcon ImageObj)) (Font (FONTCREATE (QUOTE HELVETICA) 10 (QUOTE BOLD) NIL ImageStream)) TypeIcon) (* * Determine what type of Display to do) (SETQ DisplayType (COND (TitleFlg (QUOTE Title)) ((fetch (NOTECARDLINK DISPLAYMODE) of Link)) (T (QUOTE Icon)))) (SETQ ID (fetch (NOTECARDLINK DESTINATIONID) of Link)) (AND (FMEMB DisplayType (QUOTE (Title Both))) (SETQ Title (NC.RetrieveTitle ID PSA.Database))) (AND (FMEMB DisplayType (QUOTE (Label Both))) (SETQ Label (fetch (NOTECARDLINK LINKLABEL) of Link))) (if (EQ DisplayType (QUOTE SourceTitle)) then (SETQ Title (NC.RetrieveTitle (SETQ ID (fetch (NOTECARDLINK SOURCEID) of Link))))) (SETQ TypeIcon (NC.GetTypeIcon (NC.FetchType ID))) (* * Get the image box info for this icon) (SETQ ImageBox (OR (IMAGEOBJPROP ImageObj (QUOTE BOUNDBOX)) (NC.LinkIconImageBoxFn ImageObj ImageStream NIL NIL NIL DisplayType Title Label))) (SETQ XSize (fetch (IMAGEBOX XSIZE) of ImageBox)) (SETQ YSize (fetch (IMAGEBOX YSIZE) of ImageBox)) (SETQ Bottom (IDIFFERENCE (DSPYPOSITION NIL ImageStream) (fetch (IMAGEBOX YDESC) of ImageBox))) (SETQ Left (DSPXPOSITION NIL ImageStream)) (* * Put out the icon bitmap for the appropriate type.) (if (OR NC.AttachBitmapsToLinkIconsFlg (EQ DisplayType (QUOTE Icon))) then (SELECTQ (OR STREAMTYPE (SETQ STREAMTYPE (IMAGESTREAMTYPE ImageStream))) (DISPLAY (BITBLT TypeIcon 0 0 ImageStream (IPLUS Scale Left) (IPLUS Scale Bottom))) (PRESS (\WRITEPRESSBITMAP TypeIcon (IPLUS Scale Left) (IPLUS Scale Bottom) NIL NIL ImageStream)) (INTERPRESS (MOVETO (IPLUS Scale Left) (IPLUS Scale Bottom) ImageStream) (SHOWBITMAP.IP ImageStream TypeIcon NIL NIL NIL)) (NC.ReportError "NC.LinkIconDisplayFn" (CONCAT STREAMTYPE " is not a stream type that Notecards knows about")))) (if (EQ DisplayType (QUOTE Icon)) then (RETURN)) (* * Draw a box around the border of the link icon) (SETQ BoxLeft (IPLUS (if NC.AttachBitmapsToLinkIconsFlg then (TIMES Scale (BITMAPWIDTH TypeIcon)) else Scale) Left)) (SETQ BoxBottom (IPLUS Scale Bottom)) (SETQ BoxWidth (IDIFFERENCE XSize (TIMES Scale (PLUS 4 (if NC.AttachBitmapsToLinkIconsFlg then (BITMAPWIDTH TypeIcon) else 0))))) (SETQ BoxHeight (IDIFFERENCE YSize (TIMES Scale 4))) (MOVETO BoxLeft BoxBottom ImageStream) (RELDRAWTO BoxWidth 0 Scale NIL ImageStream) (RELDRAWTO 0 BoxHeight Scale NIL ImageStream) (RELDRAWTO (MINUS BoxWidth) 0 Scale NIL ImageStream) (if (NOT NC.AttachBitmapsToLinkIconsFlg) then (DRAWTO BoxLeft BoxBottom Scale NIL ImageStream)) (* * Enter the appropriate text.) (SETQ TextLeft (IPLUS BoxLeft (TIMES Scale 5))) (SETQ TextBaseLine (IPLUS Bottom (TIMES Scale 3) (FONTPROP Font (QUOTE DESCENT)))) (DSPXPOSITION TextLeft ImageStream) (DSPYPOSITION TextBaseLine ImageStream) (DSPFONT (PROG1 (DSPFONT Font ImageStream) (PRIN1 (SELECTQ DisplayType (SourceTitle Title) (Title Title) (Label (CONCAT "<" Label ">")) (Both (CONCAT "<" Label ">" " " Title)) "") ImageStream)) ImageStream)))) (NC.LinkIconImageBoxFn (LAMBDA (ImageObj ImageStream CurrentX RightMargin DummyArg DisplayType Title Label) (* rht: "16-Jan-85 15:55") (* * rht 9/20/84: Now scales result before returning by proper amount depending on stream type. e.g. for PRESS and INTERPRESS.) (* * rht 11/13/84: In computation of XSIZE, extra width is figured using characters in the font, "nn", rather than absolute pixel count.) (PROG (FONT Window ID NoteCardType (Link (NC.FetchLinkFromLinkIcon ImageObj)) (Scale (DSPSCALE NIL ImageStream)) TypeIcon) (SETQ DisplayType (COND ((EQ DisplayType T) (QUOTE Title)) (DisplayType DisplayType) ((fetch (NOTECARDLINK DISPLAYMODE) of Link)) (T (QUOTE Icon)))) (AND (FMEMB DisplayType (QUOTE (Title Both))) (OR Title (SETQ Title (NC.RetrieveTitle (SETQ ID (fetch (NOTECARDLINK DESTINATIONID) of Link)) PSA.Database)))) (AND (EQ DisplayType (QUOTE SourceTitle)) (OR Title (SETQ Title (NC.RetrieveTitle (SETQ ID (fetch (NOTECARDLINK SOURCEID) of Link)) PSA.Database)))) (AND (FMEMB DisplayType (QUOTE (Label Both))) (OR Label (SETQ Label (fetch (NOTECARDLINK LINKLABEL) of Link)))) (SETQ TypeIcon (NC.GetTypeIcon (NC.FetchType ID))) (RETURN (create IMAGEBOX XSIZE ←(IPLUS (TIMES Scale (if (OR NC.AttachBitmapsToLinkIconsFlg (EQ DisplayType (QUOTE Icon))) then (BITMAPWIDTH TypeIcon) else 0)) (if (EQ DisplayType (QUOTE Icon)) then (TIMES 2 Scale) else (STRINGWIDTH (CONCAT "nn" (SELECTQ DisplayType (SourceTitle Title) (Title Title) (Label (CONCAT "<" Label ">")) (Both (CONCAT "<" Label ">" " " Title)) "")) (SETQ FONT (FONTCREATE (QUOTE HELVETICA) 10 (QUOTE BOLD) NIL ImageStream)))) ) YSIZE ←(IMAX (TIMES Scale (BITMAPHEIGHT TypeIcon)) (PLUS (FONTPROP FONT (QUOTE HEIGHT)) (TIMES Scale 8))) YDESC ←(COND (RightMargin (* This is in a TEdittextstream) (FONTPROP FONT (QUOTE DESCENT))) (T 0)) XKERN ← 0))))) (NC.LinkIconImageObjP (LAMBDA (IMAGEOBJ) (* fgh: " 1-Oct-84 20:04") (* * Is IMAGEOBJ a Link Icon?) (AND (IMAGEOBJP IMAGEOBJ) (EQ (FUNCTION NC.LinkIconGetFn) (IMAGEOBJPROP IMAGEOBJ (QUOTE GETFN)))))) (NC.LinkIconPutFn (LAMBDA (ImageObject Stream) (* fgh: "30-Oct-84 22:43") (* * Writes the Link information in the link icon specified by ImageObject onto the file specified by Stream) (PRIN2 (NC.FetchLinkFromLinkIcon ImageObject) Stream))) (NC.LinkIconGetFn (LAMBDA (Stream) (* fgh: " 1-Oct-84 20:35") (* * Reads the link information from Stream and returns a link icon image object for this link info.) (NC.MakeLinkIcon (READ Stream)))) (NC.LinkIconMiddleButtonFn (LAMBDA (ImageObject Window) (* rht: "21-Nov-84 11:13") (* Middle button has been pressed in the Notecard pointer. Bring up menu of choices for manipulating this pointer.) (PROG ((ID (fetch (NOTECARDLINK DESTINATIONID) of (NC.FetchLinkFromLinkIcon ImageObject)))) (COND ((NC.IDP (NC.IDFromWindow Window)) (SELECTQ (MENU (COND ((type? MENU NC.LinkIconMiddleButtonMenu) NC.LinkIconMiddleButtonMenu) (T (SETQ NC.LinkIconMiddleButtonMenu (create MENU ITEMS ←(QUOTE ((Bring% Up% Card/Box (QUOTE Edit) "Bring up the note card pointed to by this pointer.") (Change% Link% Type (QUOTE Relabel) "Change the label of this pointer.") (Change% Display% Mode (QUOTE Display) "Change the type of information displayed in this pointer."))) CENTERFLG ← T TITLE ← "Pointer Ops"))))) (Edit (NC.EditNoteCard ID)) (Display (RETURN (NC.ChangeLinkDisplayMode ImageObject Window))) (Relabel (RETURN (NC.RelabelLink ImageObject Window))) NIL)) (T (NC.EditNoteCard ID)))))) (NC.LinkIconWhenCopiedFn (LAMBDA (ImageObject ToWindowStream FromTextStream ToTextStream) (* rht: "12-Dec-84 00:41") (* * Called when copying a link icon from FromTextStream to ToWindowStream. Sets the necessary link information up for card corresponding to ToWindowStream.) (* * rht 11/18/84: Major hacking. Now checks for all sorts of illegal cases. Either goes ahead with copy, converts link type to "Unspecified", or deletes the new "invisible" link. The latter will change when imageobj fns can return DON'T.) (* * rht 12/12/84: now does RETFROM instead of adding processes to delete imageobj's. This is cleaner, but still ugly.) (PROG (Label (Link (NC.FetchLinkFromLinkIcon ImageObject)) SourceID DestID NewSourceID NewLabel NewDisplayMode ImageObjectCopy) (SETQ Label (fetch (NOTECARDLINK LINKLABEL) of Link)) (SETQ NewSourceID (NC.CoerceToID ToTextStream)) (SETQ SourceID (fetch (NOTECARDLINK SOURCEID) of Link)) (SETQ DestID (fetch (NOTECARDLINK DESTINATIONID) of Link)) (SETQ ImageObjectCopy (IMAGEOBJPROP ImageObject (QUOTE ImageObjectCopy))) (COND ((AND (FMEMB Label (QUOTE (FiledCard SubBox))) (NEQ (NC.FetchType NewSourceID) (QUOTE FileBox))) (* Copy from filebox to non-filebox.) (NC.PrintMsg NIL NIL (CONCAT "Tried to copy filedcard or subbox link to a non-filebox." (CHARACTER 13) "Link type of copy set to 'Unspecified'." (CHARACTER 13))) (SETQ NewLabel NC.UnspecifiedLinkLabel) (SETQ NewDisplayMode (QUOTE Both))) ((AND (NEQ (NC.FetchType SourceID) (QUOTE FileBox)) (EQ (NC.FetchType NewSourceID) (QUOTE FileBox))) (* Copy from non-filebox to filebox.) (NC.PrintMsg NIL NIL (CONCAT "Can't copy links from non-filebox to filebox." (CHARACTER 13) "Try using CollectChildren." (CHARACTER 13))) (RETFROM (QUOTE TEDIT.COPY) NIL T)) ((AND (FMEMB Label (QUOTE (FiledCard SubBox))) (EQ NewSourceID SourceID)) (* Copy within same filebox.) (NC.PrintMsg NIL NIL (CONCAT "Can't copy links within a FileBox. Try move instead." (CHARACTER 13))) (RETFROM (QUOTE TEDIT.COPY) NIL T)) ((AND (EQ (NC.FetchType NewSourceID) (QUOTE FileBox)) (for Link1 in (NC.FetchToLinks NewSourceID) thereis (AND (NC.ChildLinkP Link1) (EQ DestID (fetch (NOTECARDLINK DESTINATIONID) of Link1))))) (* Copy to a filebox already containing this child.) (NC.PrintMsg NIL NIL (CONCAT (NC.RetrieveTitle DestID PSA.Database) " not copied: already appears as a child of " (NC.RetrieveTitle NewSourceID PSA.Database) (CHARACTER 13))) (RETFROM (QUOTE TEDIT.COPY) NIL T)) ((AND (EQ Label (QUOTE SubBox)) (OR (EQ NewSourceID DestID) (NOT (NC.NotDaughterP DestID NewSourceID (FUNCTION NC.ChildLinkP))))) (* Copy to a filebox causes a cycle.) (NC.PrintMsg NIL NIL (CONCAT "Couldn't copy " Link " because of subbox cycle." (CHARACTER 13))) (RETFROM (QUOTE TEDIT.COPY) NIL T)) ((AND (FMEMB Label NC.SystemLinkLabels) (NOT (FMEMB Label (QUOTE (FiledCard SubBox)))) (NEQ NewSourceID SourceID)) (* Copy of system link outside of own card.) (NC.PrintMsg NIL NIL (CONCAT "Tried to copy system link." (CHARACTER 13) "Link type of copy set to 'Unspecified'." (CHARACTER 13))) (SETQ NewLabel NC.UnspecifiedLinkLabel) (SETQ NewDisplayMode (QUOTE Both)))) (NC.FillInLinkIcon ImageObjectCopy (OR NewLabel Label) DestID NewSourceID (OR NewDisplayMode (fetch (NOTECARDLINK DISPLAYMODE) of Link)))))) (NC.LinkIconWhenDeletedFn (LAMBDA (ImageObject Stream) (* rht: "19-Nov-84 23:26") (* * When deleting a link icon image object from a card, make sure the link information on the source and destinmation cards get updated. When deleting a link image object from a prop list editor, just inform the user that this is a useless operation.) (* * rht 11/19/84: Now handles the case when a move is in progress. True if the old link is cached on the ImageObj. Also changed so that SourceID is computed from ImageObject rather than from Stream. Similarly for the window.) (PROG (Link SourceID DestinationID LinkType Window) (SETQ Link (NC.FetchLinkFromLinkIcon ImageObject)) (COND ((SETQ OldLink (IMAGEOBJPROP ImageObject (QUOTE LinkBeingMoved))) (NC.DelFromLink OldLink PSA.Database) (NC.DelToLink OldLink PSA.Database) (replace (NOTECARDLINK LINKID) of OldLink with -1) (IMAGEOBJPROP ImageObject (QUOTE LinkBeingMoved) NIL)) ((NC.IDP (SETQ SourceID (fetch (NOTECARDLINK SOURCEID) of Link))) (SETQ DestinationID (fetch (NOTECARDLINK DESTINATIONID) of Link)) (NC.CheckForOrphanDelete SourceID DestinationID) (NC.DelFromLink Link PSA.Database) (NC.DelToLink Link PSA.Database) (replace (NOTECARDLINK LINKID) of Link with -1)) ((AND (SETQ Window (NC.FetchWindow SourceID)) (WINDOWPROP Window (QUOTE PropListEditor))) (NC.PrintMsg Window T "Note:" (CHARACTER 13) "Deleting a pointer from this list does NOT" (CHARACTER 13) "delete the pointer from the card." (CHARACTER 13)) (ADD.PROCESS (LIST (QUOTE PROGN) (QUOTE (DISMISS 5000)) (LIST (QUOTE AND) (LIST (QUOTE OPENWP) Window) (LIST (QUOTE GETPROMPTWINDOW) Window NIL NIL T) (LIST (QUOTE NC.ClearMsg) Window T))))))))) (NC.LinkIconWhenInsertedFn (LAMBDA (ImageObj WindowStream) (* fgh: " 5-Oct-84 12:43") (* An Notecard link is being inserted. If this is a deleteundo, then have to re-establish the link information) (PROG ((StackPointer (STKPOS (QUOTE TEDIT.UNDO.DELETION))) SourceID Link) (COND ((NULL StackPointer) (RELSTK StackPointer) (RETURN)) (T (RELSTK StackPointer) (SETQ SourceID (NC.IDFromWindow WindowStream)) (COND ((NC.IDP SourceID) (SETQ Link (NC.FetchLinkFromLinkIcon ImageObj)) (NC.AddFromLink Link PSA.Database) (NC.AddToLink Link PSA.Database)))))))) (NC.LinkIconWhenMovedFn (LAMBDA (ImageObject ToWindowStream FromTextStream ToTextStream) (* rht: "12-Dec-84 00:42") (* * Called when moving a link icon from FromTextStream to ToWindowStream. Sets the necessary link information up for card corresponding to ToWindowStream.) (* * rht 11/18/84: Major hacking. Now checks for all sorts of illegal cases. Either goes ahead with move, converts link type to "Unspecified", or deletes the new "invisible" link. The code is very similar to NC.LinkIconWhenCopiedFn except that within-filebox moves are allowed. Also when aborting a move, we must insert a copy of the link back to take the place of the deleted original. This will all change when imageobj fns can return DON'T.) (* * rht 12/12/84: Now just RETFROM's rather than doing the addprocess stuff. Should be cleaner, but still ugly.) (PROG (Label (Link (NC.FetchLinkFromLinkIcon ImageObject)) SourceID DestID NewSourceID NewLabel NewDisplayMode) (SETQ Label (fetch (NOTECARDLINK LINKLABEL) of Link)) (SETQ NewSourceID (NC.CoerceToID ToTextStream)) (SETQ SourceID (fetch (NOTECARDLINK SOURCEID) of Link)) (SETQ DestID (fetch (NOTECARDLINK DESTINATIONID) of Link)) (COND ((AND (FMEMB Label (QUOTE (FiledCard SubBox))) (NEQ (NC.FetchType NewSourceID) (QUOTE FileBox))) (* Move from filebox to non-filebox.) (NC.PrintMsg NIL NIL (CONCAT "Tried to move filedcard or subbox link to a non-filebox." (CHARACTER 13) "Link type of copy set to 'Unspecified'." (CHARACTER 13))) (SETQ NewLabel NC.UnspecifiedLinkLabel) (SETQ NewDisplayMode (QUOTE Both))) ((AND (NEQ (NC.FetchType SourceID) (QUOTE FileBox)) (EQ (NC.FetchType NewSourceID) (QUOTE FileBox))) (* Move from non-filebox to filebox.) (NC.PrintMsg NIL NIL (CONCAT "Can't move links from non-filebox to filebox." (CHARACTER 13) "Try using CollectChildren." (CHARACTER 13))) (RETFROM (QUOTE TEDIT.MOVE) NIL T)) ((AND (EQ (NC.FetchType NewSourceID) (QUOTE FileBox)) (NEQ NewSourceID SourceID) (for Link1 in (NC.FetchToLinks NewSourceID) thereis (AND (NC.ChildLinkP Link1) (EQ DestID (fetch (NOTECARDLINK DESTINATIONID) of Link1))))) (* Move to a filebox already containing this child.) (NC.PrintMsg NIL NIL (CONCAT (NC.RetrieveTitle DestID PSA.Database) " not moved: already appears as a child of " (NC.RetrieveTitle NewSourceID PSA.Database) (CHARACTER 13))) (RETFROM (QUOTE TEDIT.MOVE) NIL T)) ((AND (EQ Label (QUOTE SubBox)) (NEQ NewSourceID SourceID) (OR (EQ NewSourceID DestID) (NOT (NC.NotDaughterP DestID NewSourceID (FUNCTION NC.ChildLinkP))))) (* Move to a filebox causes a cycle.) (NC.PrintMsg NIL NIL (CONCAT "Couldn't move " Link " because of subbox cycle." (CHARACTER 13))) (RETFROM (QUOTE TEDIT.MOVE) NIL T)) ((AND (FMEMB Label NC.SystemLinkLabels) (NOT (FMEMB Label (QUOTE (FiledCard SubBox)))) (NEQ NewSourceID SourceID)) (* Move of system link outside of own card.) (NC.PrintMsg NIL NIL (CONCAT "Tried to copy system link." (CHARACTER 13) "Link type of copy set to 'Unspecified'." (CHARACTER 13))) (SETQ NewLabel NC.UnspecifiedLinkLabel) (SETQ NewDisplayMode (QUOTE Both)))) (IMAGEOBJPROP ImageObject (QUOTE LinkBeingMoved) Link) (NC.FillInLinkIcon ImageObject (OR NewLabel Label) DestID NewSourceID (OR NewDisplayMode (fetch (NOTECARDLINK DISPLAYMODE) of Link)))))) (NC.FetchLinkFromLinkIcon (LAMBDA (LinkIcon) (* fgh: " 1-Oct-84 21:03") (* * (Return the link information from the LinkIcon image object)) (IMAGEOBJPROP LinkIcon (QUOTE OBJECTDATUM)))) (NC.ChangeLinkDisplayMode (LAMBDA (LinkOrLinkIcon Window NewDisplayMode) (* rht: "21-Nov-84 11:19") (* * Change the display mode of the NOTECARDLINK defined by LinkOrLinkIcon. Have the user choose the new display mode.) (* * NOTE: assumes that the SourceID card of the link is active, i.e., the substance and links are cached for this card.) (PROG (ID DestinationID Link LinkIcon GlobalLinkFlg) (COND ((NC.LinkIconImageObjP LinkOrLinkIcon) (SETQ Link (NC.FetchLinkFromLinkIcon LinkOrLinkIcon)) (SETQ LinkIcon LinkOrLinkIcon)) (T (SETQ Link LinkOrLinkIcon) (COND ((NOT (SETQ GlobalLinkFlg (NC.GlobalLinkP Link))) (SETQ LinkIcon (NC.FetchLinkIconForLink Link)))))) (SETQ ID (fetch (NOTECARDLINK SOURCEID) of Link)) (COND ((WINDOWP Window)) ((NC.ActiveCardP ID) (SETQ Window (NC.FetchWindow ID)))) (* * Get new display mode from user) (SETQ NewDisplayMode (OR NewDisplayMode (MENU (OR NC.LinkDisplayModesMenu (SETQ NC.LinkDisplayModesMenu (create MENU ITEMS ←(QUOTE ((NoteCard% Symbol (QUOTE Icon)) (Title% of% Destination (QUOTE Title)) (Link% Type (QUOTE Label)) (Both% Title% and% Type (QUOTE Both)))) TITLE ←(QUOTE Display% Mode?))))) (fetch (NOTECARDLINK DISPLAYMODE) of Link))) (* * Update link in LinkIcon or in global links list) (COND (GlobalLinkFlg (for GlobalLink in (NC.FetchGlobalLinks ID) when (EQ (fetch (NOTECARDLINK LINKID) of Link) (fetch (NOTECARDLINK LINKID) of GlobalLink)) do (replace (NOTECARDLINK DISPLAYMODE) of GlobalLink with NewDisplayMode)) (NC.SetLinksDirtyFlg ID T)) (T (replace (NOTECARDLINK DISPLAYMODE) of (NC.FetchLinkFromLinkIcon LinkIcon) with NewDisplayMode) (NC.MarkCardDirty ID))) (* * Update link in ToLinks List of Source card) (for ToLink in (NC.FetchToLinks ID) when (EQ (fetch (NOTECARDLINK LINKID) of Link) (fetch (NOTECARDLINK LINKID) of ToLink)) do (replace (NOTECARDLINK DISPLAYMODE) of ToLink with NewDisplayMode)) (NC.SetLinksDirtyFlg ID T) (* * Update Link in FromLinks list of Destination card) (SETQ DestinationID (fetch (NOTECARDLINK DESTINATIONID) of Link)) (COND ((NC.ActiveCardP DestinationID) (for FromLink in (NC.FetchFromLinks DestinationID) when (EQ (fetch (NOTECARDLINK LINKID) of Link) (fetch (NOTECARDLINK LINKID) of FromLink)) do (replace (NOTECARDLINK DISPLAYMODE) of FromLink with NewDisplayMode)) (NC.SetLinksDirtyFlg DestinationID T)) (T (WITH.MONITOR (NC.FetchMonitor PSA.Database) (NC.GetLinks DestinationID PSA.Database) (for FromLink in (NC.FetchFromLinks DestinationID) when (EQ (fetch (NOTECARDLINK LINKID) of Link) (fetch (NOTECARDLINK LINKID) of FromLink)) do (replace (NOTECARDLINK DISPLAYMODE) of FromLink with NewDisplayMode)) (NC.PutLinks DestinationID PSA.Database) (NC.DeactivateCard DestinationID)))) (* * Update the image in any active window for ID) (COND ((AND (WINDOWP Window) (NOT (NC.TEditBasedP (NC.FetchType ID)))) (NC.UpdateLinkImages Window (fetch (NOTECARDLINK DESTINATIONID) of Link)))) (* This causes tedit to redisplay the screen.) (RETURN (QUOTE CHANGED))))) (NC.DefaultLinkDisplayMode (LAMBDA (ID DatabaseStream) (* fgh: "23-Oct-84 17:23") (* RETURN the default NoteCard link display mode for the card - SourceID. Default display mode is determined by the card type of SourceID.) (PROG (NoteCardType DisplayMode CardType) (SETQ NoteCardType (NC.RetrieveType ID DatabaseStream)) Loop(SETQ DisplayMode (fetch (NoteCardType LinkDisplayMode) of (SETQ CardType (for Type in NC.CardTypes when (EQ (fetch (NoteCardType TypeName) of Type) NoteCardType) do (RETURN Type) finally (NC.ReportError "NC.DefaultLinkDisplayMode" (CONCAT " Unknown card type: " NoteCardType))) ))) (AND DisplayMode (RETURN DisplayMode)) (SETQ NoteCardType (fetch (NoteCardType SuperType) of CardType)) (AND (NEQ NoteCardType (QUOTE NoteCard)) (GO Loop)) (RETURN (QUOTE Icon))))) (NC.UpdateLinkImages (LAMBDA (SourceWindowOrID DestinationID) (* fgh: "10-Oct-84 20:34") (* * Update the Link Image Objects in SourceCard that point to DestinationID) (PROG (SourceWindow SourceCardID NoteCardType) (COND ((WINDOWP SourceWindowOrID) (SETQ SourceWindow SourceWindowOrID) (SETQ SourceCardID (NC.IDFromWindow SourceWindowOrID))) (T (SETQ SourceWindow (NC.FetchWindow SourceWindowOrID)) (SETQ SourceCardID SourceWindowOrID))) (SETQ NoteCardType (NC.FetchType SourceCardID)) (APPLY* (NC.UpdateLinkIconsFn NoteCardType) (OR SourceCardID SourceWindow) DestinationID)))) (NC.UpdateLinkImagesInGraph (LAMBDA (SourceCardID DestinationID) (* fgh: " 4-Oct-84 21:18") (* Update all the NoteCard links that point to DestinationID from the graph card specified by SourceCardID) (PROG (Window Graph LinkIcon ImageBox) (SETQ Window (NC.FetchWindow SourceCardID)) (SETQ Graph (NC.FetchSubstance SourceCardID)) (for GraphNode in (fetch (GRAPH GRAPHNODES) of Graph) when (AND (NC.LinkIconImageObjP (SETQ LinkIcon (fetch (GRAPHNODE NODELABEL) of GraphNode))) (EQ DestinationID (fetch (NOTECARDLINK DESTINATIONID) of ( NC.FetchLinkFromLinkIcon LinkIcon)))) do (SETQ ImageBox (NC.LinkIconImageBoxFn LinkIcon (WINDOWPROP Window (QUOTE DSP)))) (replace (GRAPHNODE NODEWIDTH) of GraphNode with (fetch (IMAGEBOX XSIZE) of ImageBox)) (replace (GRAPHNODE NODEHEIGHT) of GraphNode with (fetch (IMAGEBOX YSIZE) of ImageBox))) (REDISPLAYW Window)))) (NC.UpdateLinkImagesInSketch (LAMBDA (SourceCardID DestinationID) (* fgh: "11-Apr-84 16:53") (* For now do nothing since Link Images in Sketch have no titles.) NIL)) (NC.UpdateLinkImagesInText (LAMBDA (SourceCardIDOrWindow DestinationID) (* fgh: " 1-Oct-84 21:15") (* * Update the notecard link image objects that point to DestinationID fromn text card SourceCardIDOrWindow) (PROG (Window TextObject ListOfNoteCardLinks) (SETQ Window (COND ((WINDOWP SourceCardIDOrWindow) SourceCardIDOrWindow) (T (NC.FetchWindow SourceCardIDOrWindow)))) (SETQ TextObject (WINDOWPROP Window (QUOTE TEXTOBJ))) (SETQ ListOfNoteCardLinks (TEDIT.LIST.OF.OBJECTS TextObject (FUNCTION NC.LinkIconImageObjP)) ) (for Link in ListOfNoteCardLinks do (AND (EQ (fetch (NOTECARDLINK DESTINATIONID) of (NC.FetchLinkFromLinkIcon (CAR Link))) DestinationID) (TEDIT.OBJECT.CHANGED TextObject (CAR Link))))))) (NC.LinkIconCopyFn (LAMBDA (ImageObject) (* rht: "19-Nov-84 21:16") (* * Return a copy of image object. IF it is a system link label, then make its label unspecified.) (* * rht 11/18/84: No longer worries about system link labels. All that is handled by WhenCopiedFn and WhenMovedFn. Caches the new copy on the prop list of the original imageobj.) (PROG ((ImageObjectCopy (IMAGEOBJCREATE (fetch (NOTECARDLINK LINKID) of (NC.FetchLinkFromLinkIcon ImageObject)) NC.InvisibleLinkImageFns))) (IMAGEOBJPROP ImageObject (QUOTE ImageObjectCopy) ImageObjectCopy) (RETURN ImageObjectCopy)))) (NC.GetTypeIcon (LAMBDA (Type) (* rht: " 4-Dec-84 20:06") (* * Return the bitmap icon for the given type.) (SELECTQ Type (FileBox NC.FileBoxIcon) (Sketch NC.SketchCardIcon) ((Graph Browser) NC.GraphCardIcon) NC.TextCardIcon))) ) (DEFINEQ (NC.FillInLinkIcon (LAMBDA (ImageObj Label DestID SourceID DisplayMode) (* rht: "19-Nov-84 14:43") (* * Called by WhenCopiedFn and WhenMovedFn to build the new link and stick it in the ImageObj.) (IMAGEOBJPROP ImageObj (QUOTE OBJECTDATUM) (NC.MakeLink NIL Label DestID SourceID DisplayMode)) (replace (IMAGEOBJ IMAGEOBJFNS) of ImageObj with NC.LinkIconImageFns))) (NC.InvisibleLinkImageBoxFn (LAMBDA (ImageObj Stream) (* rht: "20-Nov-84 10:57") (* * Returns a zero-size image box.) (create IMAGEBOX XSIZE ← 0 YSIZE ← 0 YDESC ← 0 XKERN ← 0))) (NC.InvisibleLinkPutFn (LAMBDA (ImageObj OutputStream) (* fgh: "26-Feb-84 01:04") (BOUT OutputStream 1))) (NC.InvisibleLinkGetFn (LAMBDA (InputStream TextStream) (* rht: "21-Nov-84 12:10") (BIN InputStream) NC.InvisibleLinkImageObject)) ) (RPAQ NC.FileBoxIcon (READBITMAP)) (21 18 "OOOOOH@@" "OOOOOH@@" "OOOOOH@@" "H@@@@H@@" "H@@@@H@@" "H@B@@H@@" "H@@@@H@@" "OOOOOH@@" "H@@@@H@@" "H@@@@H@@" "H@B@@H@@" "H@@@@H@@" "OOOOOH@@" "H@@@@H@@" "H@@@@H@@" "H@B@@H@@" "H@@@@H@@" "OOOOOH@@") (RPAQ NC.GraphCardIcon (READBITMAP)) (21 18 "OOOOOH@@" "H@@@@H@@" "H@@@@H@@" "H@N@@H@@" "H@J@@H@@" "HAJ@@H@@" "HBO@@H@@" "HD@KHH@@" "KH@FHH@@" "JH@BHH@@" "JH@CHH@@" "KL@@@H@@" "HBN@@H@@" "HAJ@@H@@" "H@J@@H@@" "H@N@@H@@" "H@@@@H@@" "OOOOOH@@") (RPAQ NC.SketchCardIcon (READBITMAP)) (21 18 "OOOOOH@@" "H@@@@H@@" "HGO@@H@@" "HH@H@H@@" "H@@G@H@@" "HC@@HH@@" "HDH@DH@@" "HHD@BH@@" "I@B@@H@@" "I@B@@H@@" "HHDONH@@" "HDHHBH@@" "HC@HBH@@" "H@@HBH@@" "H@@HBH@@" "H@@ONH@@" "H@@@@H@@" "OOOOOH@@") (RPAQ NC.TextCardIcon (READBITMAP)) (21 18 "OOOOOH@@" "OOOOOH@@" "OOOOOH@@" "OOOOOH@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "H@@@@H@@" "OOOOOH@@") (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NC.FileBoxIcon NC.GraphCardIcon NC.SketchCardIcon NC.TextCardIcon) ) (PUTPROPS NCLINKS COPYRIGHT ("Xerox Corporation" 1984 1985)) (DECLARE: DONTCOPY (FILEMAP (NIL (5122 51628 (NC.GlobalLinkP 5132 . 5401) (NC.ChildLinkP 5403 . 5658) ( NC.ReverseLinkLabelP 5660 . 6283) (NC.GetNewLinkID 6285 . 6834) (NC.SaveNextLinkID 6836 . 7597) ( NC.MakeGlobalLink 7599 . 8342) (NC.AddFromLink 8344 . 9168) (NC.AddLinkToGraphCard 9170 . 9646) ( NC.AddLinkToSketchCard 9648 . 10260) (NC.InsertLinkInSketch 10262 . 11932) (NC.AddLinkToTextCard 11934 . 12402) (NC.AddLinksToTextCard 12404 . 12804) (NC.InsertLinkInText 12806 . 14243) ( NC.InsertLinksInText 14245 . 15353) (NC.AddSourceLink 15355 . 16190) (NC.AddToLink 16192 . 17000) ( NC.DelFromLink 17002 . 21314) (NC.DelToLink 21316 . 22780) (NC.DelReferencesToCard 22782 . 23989) ( NC.DelReferencesToCardFromGlobalList 23991 . 25657) (NC.DelReferencesToCardFromGraph 25659 . 27637) ( NC.DelReferencesToCardFromSketch 27639 . 29914) (NC.DelReferencesToCardFromText 29916 . 31520) ( NC.DeletedLinkDisplayFn 31522 . 32982) (NC.DeletedLinkGetFn 32984 . 33158) (NC.DeletedLinkImageBoxFn 33160 . 33587) (NC.DeletedLinkPutFn 33589 . 33737) (NC.CheckForOrphanDelete 33739 . 35081) ( NC.HookToOrphanCard 35083 . 36193) (NC.InsertLinkBeforeMarker 36195 . 40084) (NC.LinkLabelP 40086 . 40430) (NC.MakeAContentsHook 40432 . 41323) (NC.MakeLink 41325 . 43203) (NC.MakeContentsHooks 43205 . 44916) (NC.RelabelLink 44918 . 48925) (NC.SystemLinkLabelP 48927 . 49348) (NC.ValidLinkP 49350 . 50388 ) (NC.MakeChildLink 50390 . 51626)) (51660 87025 (NC.SetLinkInLinkIcon 51670 . 51914) ( NC.FetchLinkIconForLink 51916 . 52585) (NC.MakeLinkIcon 52587 . 52834) (NC.LinkIconButtonEventInFn 52836 . 55353) (NC.LinkIconDisplayFn 55355 . 60089) (NC.LinkIconImageBoxFn 60091 . 62815) ( NC.LinkIconImageObjP 62817 . 63118) (NC.LinkIconPutFn 63120 . 63432) (NC.LinkIconGetFn 63434 . 63712) (NC.LinkIconMiddleButtonFn 63714 . 65137) (NC.LinkIconWhenCopiedFn 65139 . 69627) ( NC.LinkIconWhenDeletedFn 69629 . 71805) (NC.LinkIconWhenInsertedFn 71807 . 72632) ( NC.LinkIconWhenMovedFn 72634 . 77010) (NC.FetchLinkFromLinkIcon 77012 . 77275) ( NC.ChangeLinkDisplayMode 77277 . 81448) (NC.DefaultLinkDisplayMode 81450 . 82712) (NC.UpdateLinkImages 82714 . 83466) (NC.UpdateLinkImagesInGraph 83468 . 84709) (NC.UpdateLinkImagesInSketch 84711 . 84994) (NC.UpdateLinkImagesInText 84996 . 85929) (NC.LinkIconCopyFn 85931 . 86684) (NC.GetTypeIcon 86686 . 87023)) (87026 88069 (NC.FillInLinkIcon 87036 . 87468) (NC.InvisibleLinkImageBoxFn 87470 . 87735) ( NC.InvisibleLinkPutFn 87737 . 87887) (NC.InvisibleLinkGetFn 87889 . 88067))))) STOP