(FILECREATED "17-Oct-86 15:29:13" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH114.;13 48981 changes to: (VARS RHTPATCH114COMS) (FNS NC.MakeLink) previous date: " 8-Oct-86 18:50:22" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH114.;11) (* Copyright (c) 1986 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT RHTPATCH114COMS) (RPAQQ RHTPATCH114COMS ((* * Changes to make cross-file links possible.) (FILES NCCROSSFILELINKS) (* * New function for NCCARDS) (FNS NC.ForceFilingForCardTypeP NC.RemoveDELETEMEImageObjsFromCard) (* * New stuff for NCLINKS) (GLOBALVARS NC.DELETEMEImageObjDatum NC.RemoveDELETEMEImageObjsFromCardFlg) (INITVARS (NC.DELETEMEImageObjDatum "[[DELETE ME]]") (NC.RemoveDELETEMEImageObjsFromCardFlg NIL)) (FNS NC.DELETEMEImageObjP) (* * Changes to NCCARDS) (FNS NC.EditNoteCard NC.CardNeedsFilingP NC.QuitCard) (* * Changes to NCLINKS) (FNS NC.MakeLink NC.FillInLinkIcon NC.LinkIconWhenCopiedFn NC.LinkIconWhenMovedFn NC.DeleteLink NC.InsureLinkDisplayMode) (* * Changes to NCINTERFACE) (FNS NC.SelectNoteCards))) (* * Changes to make cross-file links possible.) (FILESLOAD NCCROSSFILELINKS) (* * New function for NCCARDS) (DEFINEQ (NC.ForceFilingForCardTypeP (LAMBDA (CardType) (* rht: " 6-Oct-86 10:58") (* * Does this card type have to be filed somewhere? For now checks property, should eventually be a slot in the card type def'n.) (NULL (GETPROP CardType (QUOTE Don'tForceFilingFlg))))) (NC.RemoveDELETEMEImageObjsFromCard (LAMBDA (Card PredicateFn) (* rht: " 7-Oct-86 01:20") (* * If card needs cleaning, find and remove any image objects satisfying PredicateFn from Card. Currently only works for text cards.) (if (AND (NC.FetchUserDataProp Card (QUOTE NeedsCleaningFlg)) (NCP.TextBasedP Card)) then (LET ((WasActiveFlg (NCP.CardCachedP Card)) TextStream) (if (NOT WasActiveFlg) then (NCP.CacheCards Card)) (SETQ TextStream (NCP.CardSubstance Card)) (* Need to reverse list so that we delete the last icon first.) (for IconPair in (REVERSE (TEDIT.LIST.OF.OBJECTS (TEXTOBJ TextStream) PredicateFn)) do (TEDIT.DELETE TextStream (CADR IconPair) 1)) (if (NOT WasActiveFlg) then (NCP.UncacheCards Card))) (NC.SetUserDataProp Card (QUOTE NeedsCleaningFlg) NIL)))) ) (* * New stuff for NCLINKS) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NC.DELETEMEImageObjDatum NC.RemoveDELETEMEImageObjsFromCardFlg) ) (RPAQ? NC.DELETEMEImageObjDatum "[[DELETE ME]]") (RPAQ? NC.RemoveDELETEMEImageObjsFromCardFlg NIL) (DEFINEQ (NC.DELETEMEImageObjP (LAMBDA (ImageObj) (* rht: " 7-Oct-86 16:26") (* * Returns non-nil if ImageObj is a DELETEME imageobj.) (DECLARE (GLOBALVARS NC.DELETEMEImageObjDatum)) (AND (IMAGEOBJP ImageObj) (EQUAL (IMAGEOBJPROP ImageObj (QUOTE OBJECTDATUM)) NC.DELETEMEImageObjDatum)))) ) (* * Changes to NCCARDS) (DEFINEQ (NC.EditNoteCard (LAMBDA (Card Region/Position TypeSpecificArgs) (* rht: " 6-Oct-86 12:36") (* * Bring the already created NoteCard specified by ID onto the screen at Region or Position specified by Region/Position) (* * fgh 11/11/85: Updated to handle new Card object.) (* * fgh 2/5/86 Added call to NC.ApplyFn) (* * kirk 15May86 Added call to NC.AttachNoteFileName) (* * rht 7/13/86: Added TypeSpecificArgs arg.) (* * kef 7/16/86: Added NC.ObtainCardEditPermission.) (* * kef 8/7/86: Added check to make sure that applying the EditFn worked. If not, then release those write locks, thus keeping the writelock count consistent.) (* * fgh 8/30/86 Converted APPLY* to NC.ApplyFn.) (* * rht 10/6/86: Added checks before doing WINDOWPROP calls in case there was a recursive call to NC.EditNoteCard.) (DECLARE (GLOBALVARS NC.ShowNoteFileOnCards)) (RESETLST (RESETSAVE (CURSOR WAITINGCURSOR)) (PROG (NoteCardType Window Substance EditResult) (COND ((AND (NC.ActiveCardP Card) (NC.ObtainEditPermission Card)) (SETQ Substance (NC.FetchSubstance Card))) ((NC.ObtainEditPermission Card) (NC.GetNoteCard Card) (SETQ Substance (NC.FetchSubstance Card))) (T (RETURN (NC.CardPartBusy Card (QUOTE (SUBSTANCE TOLINKS GLOBALTOLINKS PROPLIST)))))) (SETQ NoteCardType (NC.RetrieveType Card)) (COND ((AND (SETQ EditResult (ERSETQ (NC.ApplyFn EditFn Card Substance Region/Position TypeSpecificArgs))) (WINDOWP (SETQ Window (CAR EditResult)))) (WINDOWADDPROP Window (QUOTE CLOSEFN) (FUNCTION NC.QuitCard) (QUOTE FIRST)) (OR (NC.CardP (WINDOWPROP Window (QUOTE NoteCardObject))) (WINDOWPROP Window (QUOTE NoteCardObject) Card)) (OR (EQ (WINDOWPROP Window (QUOTE COPYBUTTONEVENTFN)) (FUNCTION NC.CopyButtonEventFn)) (WINDOWPROP Window (QUOTE OldCopyButtonEventFn) (WINDOWPROP Window (QUOTE COPYBUTTONEVENTFN) (FUNCTION NC.CopyButtonEventFn)))) (if NC.ShowNoteFileOnCards then (NC.AttachNoteFileName Window))) (T (* At this point, we've obtain the write locks but the edit failed, so we'd better release them) (for CardPart in (QUOTE (SUBSTANCE TOLINKS GLOBALTOLINKS PROPLIST)) do (NC.ApplyFn ReleaseWritePermissionFn Card CardPart)) (RETURN))) (RETURN Window))))) (NC.CardNeedsFilingP (LAMBDA (Card) (* rht: " 6-Oct-86 21:28") (* * Returns non-nil if this card is filed in some not currently filed anywhere unless it's a top level card. Assumes card is active.) (* * fgh 11/12/85 Updated to handle Card objects.) (* * rht 10/6/86: Now checks for card types that don't have to be filed. Also makes sure that there's at least one filing link that's within this notefile.) (LET ((NoteFile (fetch (Card NoteFile) of Card))) (AND (NOT (NC.TopLevelCardP Card)) (NC.ForceFilingForCardTypeP (NC.FetchType Card)) (for Link in (NC.FetchFromLinks Card) never (AND (FMEMB (fetch (Link Label) of Link) (QUOTE (FiledCard SubBox))) (NC.SameNoteFileP NoteFile (fetch (Card NoteFile) of (fetch (Link SourceCard) of Link))))))))) (NC.QuitCard (LAMBDA (CardIdentifier CallCloseWFlg DontSaveFlg DontRecacheFlg DontCheckOpInProgressFlg InterestedWindow OperationMsg QuietFlg Don'tDeactivateFlg) (* rht: " 8-Oct-86 18:49") (* * Force note card specified by ID to quit or stop) (* * rht 2/9/85: New arg DontSaveFlg prevents NC.CardSaveFn from being called. Used when aborting a card. This is NOT equivalent to NC.QuitWithoutSaving.) (* * rht 6/25/85: Now moves card off screen before saving if NC.CloseCardsOffScreenFlg is non-nil.) (* * rht 6/25/85: Brought the insure proper filing check back here from NC.CardSaveFn. Bails out if user cancelled operation inside of NC.InsureProperFiling) (* * fgh 11/11/85: Updated to handle CardID and CardInfo objects.) (* * fgh 1/16/86 Put in code to insure that if one of the TopLevelCards is quit then it is reactivated immedialtely to make sure it stays cached for fast access.) (* * fgh 2/5/86 Added call to NC.ApplyFn) (* * fgh 5/2/86 Added DontRecacheFlg arg) (* * fgh 6/9/86 Added code to check to make sure other operations are not in progress. And DontCheckOpInProgressFlg arg to match) (* * fgh 6/26/86 Added InterestedWindow & OperationMsg arg.) (* * rht 7/2/86: Now bails out if notefile is readonly, user confirms, but we're supposed to write down changes.) (* * rht 7/13/86: Now takes QuietFlg arg.) (* * rht 7/14/86: Call NC.DeactivateCard from here instead of in card type QuitFn. Take a Don'tDeactivateFlg as well.) (* * rht 10/7/86: Now removes DELETEME imageobj's from card substance.) (DECLARE (GLOBALVARS NC.RemoveDELETEMEImageObjsFromCardFlg)) (PROG ((Card (NC.CoerceToCard CardIdentifier)) Window OperationInProgress ReadOnlyCardFlg) (SETQ Window (NC.FetchWindow Card)) (OR InterestedWindow (SETQ InterestedWindow Window)) (SETQ ReadOnlyCardFlg (NC.ReadOnlyCardP Card)) (* The window not being open should mean that it's shrunken. If so, expand it.) (COND ((AND Window (NOT (OPENWP Window))) (EXPANDW Window))) (* * if in the middle of some other operation, get out of here.) (if (AND (NULL DontCheckOpInProgressFlg) (SETQ OperationInProgress (NC.OperationInProgress Card))) then (NC.PrintOperationInProgressMsg Window "Close Card" OperationInProgress) (RETURN NIL)) (* * if proper filing says don't quit then get out) (OR DontSaveFlg ReadOnlyCardFlg (COND ((EQ (NC.InsureProperFiling Card) (QUOTE CANCELLED)) (RETURN (QUOTE DON'T))))) (* * If card is readonly but we've made changes that we're supposed to save, then get user confirmation and bail out.) (if (AND (NOT DontSaveFlg) (NOT Don'tDeactivateFlg) ReadOnlyCardFlg (NC.CardSomehowDirtyP Card) (NULL QuietFlg) (NOT (PROGN (NC.PrintMsg InterestedWindow T "Card has been changed, but notefile is readonly." (CHARACTER 13)) (NC.AskYesOrNo "Want to quit anyway, flushing changes? " NIL (QUOTE Yes) NIL InterestedWindow)))) then (RETURN (QUOTE DON'T))) (* * Otherwise go ahead and quit) (RETURN (NC.ProtectedCardOperation Card Close% Card (COND ((AND Window NC.CloseCardsOffScreenFlg) (COND ((NOT (NC.FetchSavedRegion Card)) (NC.SetSavedRegion Card (WINDOWPROP Window (QUOTE REGION))))) (MOVEW Window 1500 1500))) (OR DontSaveFlg (if ReadOnlyCardFlg then (NC.TurnOffDirtyFlgs Card) else (AND NC.RemoveDELETEMEImageObjsFromCardFlg ( NC.RemoveDELETEMEImageObjsFromCard Card (FUNCTION NC.DELETEMEImageObjP))) (NC.CardSaveFn Card (OR NC.CloseCardsOffScreenFlg QuietFlg) NIL InterestedWindow OperationMsg))) (AND Window (WINDOWDELPROP Window (QUOTE CLOSEFN) (FUNCTION NC.QuitCard))) (PROG1 (NC.ApplyFn QuitFn Card) (AND CallCloseWFlg Window (CLOSEW Window)) (OR Don'tDeactivateFlg ( NC.DeactivateCard Card)) (* * if this is one of the top level cards, then make sure it stays cached) (if (AND (NC.TopLevelCardP Card) (NULL DontRecacheFlg) (NULL Don'tDeactivateFlg)) then (NCP.ActivateCards Card)))))))) ) (* * Changes to NCLINKS) (DEFINEQ (NC.MakeLink (LAMBDA (Window LinkLabel DestinationCard SourceCard DisplayMode AnchorMode Message NoDisplayFlg LinkToInsertAfter CrossFileLinksMode) (* rht: "15-Oct-86 15:27") (* * Make a link from (OR Window SourceCard) to DestinationCard with linklabel of LinkLabel) (* * rht 1/12/85: If need to create a new card, then now shows card type menu near window of SourceID.) (* * rht 1/13/85: Added extra args Message and NoDisplayFlg.) (* * rht 3/26/85: Added LinkToInsertAfter arg which should be NIL or a link to insert the new To link after. If NIL, then insert at front of ToLinks.) (* * kirk 9/23/85: took out GETPROMPTWINDOW call for asknotecardtype) (* * kirk: 14Nov85: changed NC.CoerceToID to to NC.CoerceToCard) (* * fgh 11/16/85 Changed from PROG to LET and used COND to contyrol returnmed value.) (* * fgh 2/5/86 Changed call DefaultLinkDisplayMode to FetchLinkDisplayMode) (* * fgh 6/5/86 Now calls AskLinkLabel if LinkLabel arg is NIL) (* * rht 7/4/86: Added check for readonly card.) (* * kef 7/17/86: Added calls to grab the write permission on the appropriate card parts.) (* * kef 7/22/86: Saves the links on the Destination Card now right away, while still holding onto the FROMLINKS write lock.) (* * fgh 8/30/86 Adpated to use NC.IfCardPartNotBusy.) (* * rht 9/29/86: Tossed Ken's call to NC.PutFromLinks; It was the cause of too many nasty breaks. Also made syntactic fixes.) (* * rht 10/4/86: Now handles cross file links. New arg CrossFileLinksMode determines whether cross-file link will be two-way, i.e. will destination card know it's being linked to.) (DECLARE (GLOBALVARS NC.SelectingSingleCardMenu NC.NewCrossFileLinksTwoWayFlg)) (OR SourceCard (SETQ SourceCard (NC.CoerceToCard Window))) (AND (NC.CheckForNotReadOnly SourceCard Window "Can't make links in ") (LET (Link Type) (OR Window (SETQ Window (NC.FetchWindow SourceCard))) (OR Message (SETQ Message "Please select the Card or Box to be linked to.")) (OR LinkLabel (SETQ LinkLabel (NC.AskLinkLabel Window NIL NIL T NIL))) (OR DestinationCard (SETQ DestinationCard (NC.SelectNoteCards T (FUNCTION (LAMBDA (Card) (COND ((NOT (NC.SameCardP Card SourceCard)) T) (T (NC.PrintMsg Window T "A Card/Box cannot link to itself. " (CHARACTER 13) "Selection ignored." (CHARACTER 13)) NIL)))) NC.SelectingSingleCardMenu SourceCard NIL Message))) (if (EQ DestinationCard (QUOTE *New% Card*)) then (SETQ DestinationCard (AND (SETQ Type (NC.AskNoteCardType (WINDOWREGION Window))) (NC.CoerceToCard (NC.MakeNoteCard Type (fetch (Card NoteFile) of SourceCard) NIL NoDisplayFlg))))) (if DestinationCard then (NC.IfCardPartNotBusy DestinationCard (QUOTE FROMLINKS) (NC.IfCardPartNotBusy SourceCard (QUOTE TOLINKS) (* * If we're trying to link to a CrossFileLink card, then check whether card was just created. If so, then it's the first link, otherwise we make the link be to a new CrossFileLink card.) (AND (NC.CrossFileLinkCardP DestinationCard) (if (NC.FetchUserDataProp DestinationCard (QUOTE JustCreatedFlg)) then (NC.SetUserDataProp DestinationCard (QUOTE JustCreatedFlg) NIL) else (SETQ DestinationCard (NC.CopyCrossFileLinkCard DestinationCard)))) (* * If have cross-file link, then make two new crossfilelink cards, one per notefile. Make global link over there from crossfilelink card to DestinationCard and local link here from SourceCard to crossfilelink card.) (if (NOT (NC.SameNoteFileP (fetch (Card NoteFile) of SourceCard) (fetch (Card NoteFile) of DestinationCard))) then (LET ((CrossFileLinksTwoWayFlg (OR (EQ CrossFileLinksMode (QUOTE TWOWAY)) (AND (NULL CrossFileLinksMode) NC.NewCrossFileLinksTwoWayFlg)))) (if CrossFileLinksTwoWayFlg then (NC.MakeGlobalLink Window LinkLabel DestinationCard ( NC.CreateCrossFileLinkCard DestinationCard SourceCard T) DisplayMode)) (SETQ DestinationCard (NC.CreateCrossFileLinkCard SourceCard DestinationCard CrossFileLinksTwoWayFlg)))) (SETQ Link (create Link UID ←(NC.MakeUID) SourceCard ← SourceCard DestinationCard ← DestinationCard AnchorMode ← AnchorMode Label ← LinkLabel DisplayMode ←(OR DisplayMode (NC.FetchLinkDisplayMode SourceCard)))) (NC.AddToLink Link LinkToInsertAfter) (NC.AddFromLink Link) Link)) else NIL))))) (NC.FillInLinkIcon (LAMBDA (ImageObj Label DestinationCard SourceCard DisplayMode LinkToInsertAfter CrossFileLinksMode) (* rht: " 5-Oct-86 17:28") (* * Called by WhenCopiedFn and WhenMovedFn to build the new link and stick it in the ImageObj.) (IMAGEOBJPROP ImageObj (QUOTE OBJECTDATUM) (NC.MakeLink NIL Label DestinationCard SourceCard DisplayMode NIL NIL NIL LinkToInsertAfter CrossFileLinksMode)) (replace (IMAGEOBJ IMAGEOBJFNS) of ImageObj with NC.LinkIconImageFns))) (NC.LinkIconWhenCopiedFn (LAMBDA (ImageObject ToWindowStream FromTextStream ToTextStream) (* rht: " 7-Oct-86 16:28") (* * Called when copying a link icon from FromTextStream to ToWindowStream. Sets the necessary link information up for card corresponding to ToWindowStream.) (* * rht 11/18/84: Major hacking. Now checks for all sorts of illegal cases. Either goes ahead with copy, converts link type to "Unspecified", or deletes the new "invisible" link. The latter will change when imageobj fns can return DON'T.) (* * rht 12/12/84: now does RETFROM instead of adding processes to delete imageobj's. This is cleaner, but still ugly.) (* * rht 3/25/85: Fixed to handle copies within a sketch card. That is indicated by nullity of the two textstream args.) (* * rht 3/24/86: Changed call to NC.CoerceToID to NC.CoerceToCard) (* * fgh 6/30/86 Now ERROR! out of attempt to copy between NoteFiles) (* * rht 7/14/86: Reversed order of tests for WINDOWP and TEXTSTREAMP in computation of NewSourceCard.) (* * rht 8/11/86: Now only resets NewSourceCard if it was NIL so that copies to a sketch will work.) (* * rht 10/5/86: Undid change fgh 6/30/86: now allows copies of links across notefiles. Also handles illegal copies differently. Rather than RETFROM'ing or ERROR!'ing, it puts in a DELETE ME imageobj.) (DECLARE (GLOBALVARS NC.CopyCrossFileLinksMode NC.DELETEMEImageObjDatum)) (LET ((Link (NC.FetchLinkFromLinkIcon ImageObject)) (ImageObjectCopy (IMAGEOBJPROP ImageObject (QUOTE ImageObjectCopy))) (InTEditCopyFlg (COND ((STKPOS (QUOTE TEDIT.COPY)) T))) (Window (AND ToWindowStream (WFROMDS ToWindowStream T))) SourceCard DestinationCard NewSourceCard NewLabel NewDisplayMode OldDisplayMode Label InsertPos IllegalCopyFlg) (SETQ Label (fetch (Link Label) of Link)) (SETQ SourceCard (fetch (Link SourceCard) of Link)) (SETQ DestinationCard (fetch (Link DestinationCard) of Link)) (SETQ OldDisplayMode (fetch (Link DisplayMode) of Link)) (SETQ NewSourceCard (COND ((TEXTSTREAMP ToTextStream) (NC.CoerceToCard ToTextStream)) ((WINDOWP Window) (NC.CoerceToCard Window)))) (COND ((AND (NULL NewSourceCard) (NULL FromTextStream) (NULL ToTextStream)) (* We must be moving within a sketch.) (SETQ NewSourceCard SourceCard)) ((TEXTSTREAMP ToTextStream) (* If it's a text copy, then compute position to insert link at.) (SETQ InsertPos (NC.CharPosFromTextObject (TEXTOBJ ToTextStream))))) (COND ((NULL NewSourceCard) (* Trying to copy to a non NoteCard stream) (NC.PrintMsg Window NIL (CONCAT "Tried to copy a NoteCards link icon" " to a non-NoteCards stream." (CHARACTER 13))) (SETQ IllegalCopyFlg T)) ((NULL (NC.LinksSupportedP NewSourceCard (QUOTE (Local)))) (NC.PrintMsg Window NIL (CONCAT "Tried to copy a NoteCards link icon" " to a NoteCard that" " does not support links!!." (CHARACTER 13))) (SETQ IllegalCopyFlg T)) ((AND (FMEMB Label (QUOTE (FiledCard SubBox))) (NEQ (NC.RetrieveType NewSourceCard) (QUOTE FileBox))) (* Copy from filebox to non-filebox.) (NC.PrintMsg NIL NIL (CONCAT "Tried to copy filedcard or subbox link to a non-filebox." (CHARACTER 13) "Link type of copy set to 'Unspecified'." (CHARACTER 13))) (SETQ NewLabel NC.UnspecifiedLinkLabel) (SETQ NewDisplayMode (create LINKDISPLAYMODE copying OldDisplayMode SHOWTITLEFLG ← T SHOWLINKTYPEFLG ← T)) ) ((AND (NEQ (NC.RetrieveType SourceCard) (QUOTE FileBox)) (EQ (NC.RetrieveType NewSourceCard) (QUOTE FileBox))) (* Copy from non-filebox to filebox.) (NC.PrintMsg NIL NIL (CONCAT "Can't copy links from non-filebox to filebox." (CHARACTER 13) "Try using 'PutCardsHere'." (CHARACTER 13))) (SETQ IllegalCopyFlg T)) ((AND (FMEMB Label (QUOTE (FiledCard SubBox))) (EQ NewSourceCard SourceCard)) (* Copy within same filebox.) (NC.PrintMsg NIL NIL (CONCAT "Can't copy links within a FileBox. Try move instead." (CHARACTER 13))) (SETQ IllegalCopyFlg T)) ((AND (EQ (NC.RetrieveType NewSourceCard) (QUOTE FileBox)) (for Link1 in (NC.FetchToLinks NewSourceCard) thereis (AND (NC.ChildLinkP Link1) (EQ DestinationCard (fetch (Link DestinationCard) of Link1))))) (* Copy to a filebox already containing this child.) (NC.PrintMsg NIL NIL (CONCAT (NC.RetrieveTitle DestinationCard) " not copied: already appears as a child of " (NC.RetrieveTitle NewSourceCard) (CHARACTER 13))) (SETQ IllegalCopyFlg T)) ((AND (EQ Label (QUOTE SubBox)) (OR (EQ NewSourceCard DestinationCard) (NOT (NC.NotDaughterP DestinationCard NewSourceCard (FUNCTION NC.ChildLinkP))))) (* Copy to a filebox causes a cycle.) (NC.PrintMsg NIL NIL (CONCAT "Couldn't copy " Link " because of subbox cycle." (CHARACTER 13))) (SETQ IllegalCopyFlg T)) ((AND (FMEMB Label NC.SystemLinkLabels) (NOT (FMEMB Label (QUOTE (FiledCard SubBox)))) (NEQ NewSourceCard SourceCard)) (* Copy of system link outside of own card.) (NC.PrintMsg NIL NIL (CONCAT "Tried to copy system link." (CHARACTER 13) "Link type of copy set to 'Unspecified'." (CHARACTER 13))) (SETQ NewLabel NC.UnspecifiedLinkLabel) (SETQ NewDisplayMode (create LINKDISPLAYMODE copying OldDisplayMode SHOWTITLEFLG ← T SHOWLINKTYPEFLG ← T)) ) ((NC.CrossFileLinkCardP DestinationCard) (* Copy of a cross-file link.) (if (NOT (NC.ActiveCardP DestinationCard)) then (NC.GetNoteCard DestinationCard)) (* If it's to be two-way, then make a fresh CrossFileLinkCard.) (if (OR (EQ NC.CopyCrossFileLinksMode (QUOTE TWOWAY)) (AND (NULL NC.CopyCrossFileLinksMode) NC.NewCrossFileLinksTwoWayFlg)) then (SETQ DestinationCard (NC.GetCrossFileLinkDestCard DestinationCard))) (OR DestinationCard (SETQ IllegalCopyFlg T)))) (if IllegalCopyFlg then (IMAGEOBJPROP ImageObjectCopy (QUOTE OBJECTDATUM) NC.DELETEMEImageObjDatum) (NC.SetUserDataProp SourceCard (QUOTE NeedsCleaningFlg) T) else (NC.FillInLinkIcon ImageObjectCopy (OR NewLabel Label) DestinationCard NewSourceCard (OR NewDisplayMode OldDisplayMode) (NC.LinkAtCharPos InsertPos ToTextStream) NC.CopyCrossFileLinksMode)) (IMAGEOBJPROP ImageObject (QUOTE ImageObjectCopy) NIL)))) (NC.LinkIconWhenMovedFn (LAMBDA (ImageObject ToWindowStream FromTextStream ToTextStream) (* rht: " 5-Oct-86 17:43") (* * Called when moving a link icon from FromTextStream to ToWindowStream. Sets the necessary link information up for card corresponding to ToWindowStream.) (* * rht 11/18/84: Major hacking. Now checks for all sorts of illegal cases. Either goes ahead with move, converts link type to "Unspecified", or deletes the new "invisible" link. The code is very similar to NC.LinkIconWhenCopiedFn except that within-filebox moves are allowed. Also when aborting a move, we must insert a copy of the link back to take the place of the deleted original. This will all change when imageobj fns can return DON'T.) (* * rht 12/12/84: Now just RETFROM's rather than doing the addprocess stuff. Should be cleaner, but still ugly.) (* * kirk 15Nov85: deleted use of PSA.Database) (* * rht 3/24/86: Changed call to NC.CoerceToID to NC.CoerceToCard) (* * kirk 24Mar86: added Dave Newman patch to avoid duplicate links in sketch cards) (* * rht 7/14/86: Reversed order of tests for WINDOWP and TEXTSTREAMP in computation of NewSourceCard.) (* * rht 8/11/86: Now only resets NewSourceCard if it was NIL so that moves to a sketch will work. Now checks if SourceCard = NewSourceCard in which case we're moving within a card. Don't make a new link in that case.) (* * rht 10/5/86: Undid change fgh 6/30/86: now allows copies of links across notefiles.) (LET (Label (Link (NC.FetchLinkFromLinkIcon ImageObject)) SourceCard DestinationCard NewSourceCard NewLabel NewDisplayMode OldDisplayMode (Window (AND ToWindowStream (WFROMDS ToWindowStream T))) InsertPos) (SETQ Label (fetch (Link Label) of Link)) (SETQ NewSourceCard (COND ((TEXTSTREAMP ToTextStream) (NC.CoerceToCard ToTextStream)) ((WINDOWP Window) (NC.CoerceToCard Window)))) (SETQ SourceCard (fetch (Link SourceCard) of Link)) (SETQ DestinationCard (fetch (Link DestinationCard) of Link)) (SETQ OldDisplayMode (fetch (Link DisplayMode) of Link)) (COND ((AND (NULL NewSourceCard) (NULL FromTextStream) (NULL ToTextStream)) (* We must be moving within a sketch.) (SETQ NewSourceCard SourceCard)) ((TEXTSTREAMP ToTextStream) (* If it's a text copy, then compute position to insert link at.) (SETQ InsertPos (NC.CharPosFromTextObject (TEXTOBJ ToTextStream))))) (COND ((NULL NewSourceCard) (* Trying to copy to a non NoteCard stream) (NC.PrintMsg Window NIL (CONCAT "Tried to move a NoteCards link icon" " to a non-NoteCards stream!!." (CHARACTER 13) "Tsk. Tsk." (CHARACTER 13))) (RETFROM (QUOTE TEDIT.MOVE) NIL T)) ((NULL (NC.LinksSupportedP NewSourceCard (QUOTE (Local)))) (NC.PrintMsg Window NIL (CONCAT "Tried to move a NoteCards link icon" " to a NoteCard that" " does not support links!!." (CHARACTER 13) "Tsk. Tsk." (CHARACTER 13))) (RETFROM (QUOTE TEDIT.MOVE) NIL T)) ((AND (FMEMB Label (QUOTE (FiledCard SubBox))) (NEQ (NC.RetrieveType NewSourceCard) (QUOTE FileBox))) (* Move from filebox to non-filebox.) (NC.PrintMsg NIL NIL (CONCAT "Tried to move filedcard or subbox link to a non-filebox." (CHARACTER 13) "Link type of copy set to 'Unspecified'." (CHARACTER 13))) (SETQ NewLabel NC.UnspecifiedLinkLabel) (SETQ NewDisplayMode (create LINKDISPLAYMODE copying OldDisplayMode SHOWTITLEFLG ← T SHOWLINKTYPEFLG ← T)) ) ((AND (NEQ (NC.RetrieveType SourceCard) (QUOTE FileBox)) (EQ (NC.RetrieveType NewSourceCard) (QUOTE FileBox))) (* Move from non-filebox to filebox.) (NC.PrintMsg NIL NIL (CONCAT "Can't move links from non-filebox to filebox." (CHARACTER 13) "Try using PutCardsHere." (CHARACTER 13))) (RETFROM (QUOTE TEDIT.MOVE) NIL T)) ((AND (EQ (NC.RetrieveType NewSourceCard) (QUOTE FileBox)) (NEQ NewSourceCard SourceCard) (for Link1 in (NC.FetchToLinks NewSourceCard) thereis (AND (NC.ChildLinkP Link1) (EQ DestinationCard (fetch (Link DestinationCard) of Link1))))) (* Move to a filebox already containing this child.) (NC.PrintMsg NIL NIL (CONCAT (NC.RetrieveTitle DestinationCard) " not moved: already appears as a child of " (NC.RetrieveTitle NewSourceCard) (CHARACTER 13))) (RETFROM (QUOTE TEDIT.MOVE) NIL T)) ((AND (EQ Label (QUOTE SubBox)) (NEQ NewSourceCard SourceCard) (OR (EQ NewSourceCard DestinationCard) (NOT (NC.NotDaughterP DestinationCard NewSourceCard (FUNCTION NC.ChildLinkP))))) (* Move to a filebox causes a cycle.) (NC.PrintMsg NIL NIL (CONCAT "Couldn't move " Link " because of subbox cycle." (CHARACTER 13))) (RETFROM (QUOTE TEDIT.MOVE) NIL T)) ((AND (FMEMB Label NC.SystemLinkLabels) (NOT (FMEMB Label (QUOTE (FiledCard SubBox)))) (NEQ NewSourceCard SourceCard)) (* Move of system link outside of own card.) (NC.PrintMsg NIL NIL (CONCAT "Tried to copy system link." (CHARACTER 13) "Link type of copy set to 'Unspecified'." (CHARACTER 13))) (SETQ NewLabel NC.UnspecifiedLinkLabel) (SETQ NewDisplayMode (create LINKDISPLAYMODE copying OldDisplayMode SHOWTITLEFLG ← T SHOWLINKTYPEFLG ← T)) )) (if (EQ SourceCard NewSourceCard) then (* Moving within a card, so just reposition Link in ToLinks list.) (AND (NC.TEditBasedP SourceCard) (IMAGEOBJPROP ImageObject (QUOTE LinkBeingMovedWithinCard) Link)) (NC.AddToLink Link (NC.LinkAtCharPos InsertPos ToTextStream) T) else (IMAGEOBJPROP ImageObject (QUOTE LinkBeingMoved) Link) (NC.FillInLinkIcon ImageObject (OR NewLabel Label) DestinationCard NewSourceCard (OR NewDisplayMode OldDisplayMode) (NC.LinkAtCharPos InsertPos ToTextStream)))))) (NC.DeleteLink (LAMBDA (Link NoOrphanHookFlg Don'tDelLinkIconFlg) (* rht: " 6-Oct-86 10:48") (* * Delete a link with the option of not putting an orphan hook in case of last filing link. Also option of not deleting link icon from the source card's substance.) (* * fgh 5/2/86 Included calls to NC.DelReferencesToCardFromShowLinks in order to clean up ShowLinks windows when links are deleted.) (* * kef 7/17/86: Added the requirement that the write permissions be obtained for the TOLINKS of the Source Card and the FROMLINKS of the Destination Card.) (* * kef 7/22/86: Puts the links for the Destination Card now right away while we are still holding onto the write lock for the FROMLINKS.) (* * kef 7/30/86: Modified to check for Client's concept of whether he owns the write lock or not, thus deciding whether or not to setup the release of the write lock afterwards.) (* * fgh 8/30/86 Adpated to use NC.IfCardPartNotBusy. Note use of ERROR!. Unfortunately, it appears that the only way to keep TEDIT from deleting the Link's Image Object is to bail out but good. The control structure here works because NC.IfCardPartNotBusy returns NIL if the CardPart is busy. The Ts at the end as the last SExpr in each call to NC.IfCardPartNotBusy insure that NC.IfCardPartNotBusy returns non-NIL otherwise.) (* * rht 9/29/86: Removed the call to NC.PutFromLinks. Looks to me like it'll get called anyway by NC.DelFromLink if necessary.) (* * rht 10/6/86: Delete crossfilelink cards when their links are deleted.) (LET ((SourceCard (fetch (Link SourceCard) of Link)) (DestinationCard (fetch (Link DestinationCard) of Link)) BusyCardPart) (WITH.MONITOR (NC.FetchMonitor (fetch (Card NoteFile) of SourceCard)) (OR (NC.IfCardPartNotBusy DestinationCard (QUOTE FROMLINKS) (OR (NC.IfCardPartNotBusy DestinationCard (QUOTE TOLINKS) (OR Don'tDelLinkIconFlg ( NC.DelReferencesToCard SourceCard Link)) (NC.DelFromLink Link NoOrphanHookFlg) (NC.DelToLink Link) ( NC.DelReferencesToCardFromShowLinks SourceCard Link) ( NC.DelReferencesToCardFromShowLinks DestinationCard Link) (* * This UID replacement is worrisome. Does it mean that link deletion can't be undone?) (replace (Link UID) of Link with -1) T) (ERROR!)) T) (ERROR!))) (* * Delete cross file link cards when their links are deleted.) (if (NC.CrossFileLinkCardP DestinationCard) then (NC.DeleteNoteCard DestinationCard)) (if (NC.CrossFileLinkCardP SourceCard) then (NC.DeleteNoteCard SourceCard))))) (NC.InsureLinkDisplayMode (LAMBDA (LinkDisplayMode) (* rht: " 6-Oct-86 23:40") (* * Return the recordized form of the LinkDisplayMode argument.) (* * fgh 5/2/86 First created) (* * rht 10/6/86: Now uses FLOAT for ATTACHBITMAPFLG in most cases where LinkDisplayMode is atomic.) (COND ((type? LINKDISPLAYMODE LinkDisplayMode) LinkDisplayMode) (T (SELECTQ LinkDisplayMode (Title (create LINKDISPLAYMODE SHOWTITLEFLG ← T ATTACHBITMAPFLG ←(QUOTE FLOAT))) (Icon (create LINKDISPLAYMODE ATTACHBITMAPFLG ← T)) (Label (create LINKDISPLAYMODE SHOWLINKTYPEFLG ← T ATTACHBITMAPFLG ←(QUOTE FLOAT))) (Both (create LINKDISPLAYMODE SHOWTITLEFLG ← T SHOWLINKTYPEFLG ← T ATTACHBITMAPFLG ←(QUOTE FLOAT))) (create LINKDISPLAYMODE ATTACHBITMAPFLG ← T)))))) ) (* * Changes to NCINTERFACE) (DEFINEQ (NC.SelectNoteCards (LAMBDA (SingleCardFlg SelectionPredicate Menu InstigatingCardOrWindow ReturnLinksFlg Msg CheckForCancelFlg) (* rht: " 5-Oct-86 14:45") (* Select a set of note cards or a single note card, depending on SingleCardFlg. Works by interpreting all mouse presses until a card has been chosen (if SingleCardFlg is T) or until the Done button has been pressed (if SingleCardFlg is NIL). If the mouse press occus within a Title bar of a notecard, add that note card to the selected list. Otherwise, if you are pointing into a note card, call the BUTTONEVENTFN for that note card. The Selection in Progress flag has been set, so all note card BUTTONEVENTFNs should know to ignore all presses except those that occur on link icons. Link icon presses should simply add the desination of that link to the selected note cards list.) (* * rht 8/1/84: Changed second RESETSAVE call to give NC.ClearMsg a NIL argument.) (* * rht 1/9/85: Fixed so now prints name of selected item even it's a link.) (* * rht 2/15/85: Now can backspace over last selection chosen. Added new arg Msg so that when we reprint the list, we can reprint the message as well.) (* * rht 3/23/85: Added the CheckForCancelFlg arg, which if non-nil causes Cancel to be handled differently then Done after no selections. Namely, Cancel will return the atom CANCELLED whereas Done with no selections returns NIL. If CheckForCancelFlg is NIL then NIL is returned in both cases.) (* * fgh 11/14/85 Updated to handle Card and NoteFile objects.) (* * rht 11/18/85: Fixed so able to select when InstigatingNoteFile is NIL.) (* * fgh 12/20/85 Totally rewritten for 1.3 selection mechanism. Based on COPYINSERT now rather than on takingf over the mouse process.) (* * fgh 1/15/86 Added call to SPAWN.MOUSE in case this is called under the mouse process) (* * kirk 25Apr86 Changed to use SessionIcon (NC.NoteCardsIconWindow) rather than PROMPTWINDOW if no Instigating window is supplied.) (* * fgh 7/5/86 Added code to put CRs into printout of selected cards in order to keep prompt window from getting infinitely wide to accomdate the printout.) (* * rht 10/5/86: Now allows choice of cards from remote notefile.) (RESETLST (LET (Window Card ButtonEventFn InstigatingWindow InstigatingCard InstigatingNoteFile MenuWindow PromptWindow CopyInsertEvent SelectedCards PromptWindowProcess) (OR SelectionPredicate (SETQ SelectionPredicate (FUNCTION TRUE))) (COND ((NC.CardP InstigatingCardOrWindow) (SETQ InstigatingWindow (NC.FetchWindow InstigatingCardOrWindow)) (SETQ PromptWindow (NC.AttachPromptWindow InstigatingWindow))) ((WINDOWP InstigatingCardOrWindow) (SETQ InstigatingWindow InstigatingCardOrWindow) (SETQ PromptWindow (NC.AttachPromptWindow InstigatingWindow))) (T (SETQ InstigatingWindow (SETQ PromptWindow (NC.AttachPromptWindow NC.NoteCardsIconWindow))))) (SETQ InstigatingCard (NC.CoerceToCard InstigatingCardOrWindow)) (SETQ InstigatingNoteFile (AND InstigatingCard (fetch (Card NoteFile) of InstigatingCard))) (NC.PrintMsg InstigatingWindow T (COND (Msg (CONCAT Msg (CHARACTER 13))) (T "")) "Items selected: ") (* * if we are running under the mouse process, start up a new mouse process) (AND (EQ (QUOTE MOUSE) (PROCESSPROP (THIS.PROCESS) (QUOTE NAME))) (SPAWN.MOUSE)) (* * Set up the prompt window for proper use by the CopyInsertFn) (WINDOWPROP PromptWindow (QUOTE COPYINSERTFN) (FUNCTION NC.SelectNoteCardsCopyInsertFn)) (WINDOWPROP PromptWindow (QUOTE CopyInsertEvent) (SETQ CopyInsertEvent (CREATE.EVENT (QUOTE CopyInsertEvent))) ) (RESETSAVE (WINDOWPROP PromptWindow (QUOTE SelectedCards) NIL) (BQUOTE (WINDOWPROP , PromptWindow (QUOTE SelectedCards) NIL))) (RESETSAVE (WINDOWPROP PromptWindow (QUOTE SelectingCards) T) (BQUOTE (WINDOWPROP , PromptWindow SelectingCards NIL))) (* * Make the process behind the prompt window includiong control for a blibnking cursor) (WINDOWPROP PromptWindow (QUOTE PROCESS) (SETQ PromptWindowProcess (ADD.PROCESS (QUOTE (PROG NIL (BLOCK) (TTYDISPLAYSTREAM (PROCESSPROP (THIS.PROCESS) (QUOTE WINDOW) )) XXXX (BIN) (BLOCK) (GO XXXX))) (QUOTE WINDOW) PromptWindow (QUOTE NAME) (QUOTE SelectNoteCardsProc) (QUOTE TTYENTRYFN) (FUNCTION (LAMBDA (Process) (PROCESSPROP Process (QUOTE OldCaret) (CARET CROSSHAIRS)) (ECHOMODE))) (QUOTE TTYEXITFN) (FUNCTION (LAMBDA (Process) (CARET (PROCESSPROP Process (QUOTE OldCaret))) (ECHOMODE T)))))) (RESETSAVE NIL (BQUOTE (DEL.PROCESS , PromptWindowProcess))) (* * Insure the prompt window is cleared on the way out) (RESETSAVE NIL (BQUOTE (PROGN (AND (HASTTYWINDOWP , PromptWindowProcess) (TTY.PROCESS T)) (NC.ClearMsg , InstigatingWindow T)))) (* * Set up the menu above the prompt window) (* fix in case MENUPOSITION is set incorrectly in menu passed down) (replace (MENU MENUPOSITION) of Menu with (CONSTANT (create POSITION XCOORD ← 0 YCOORD ← 0))) (RESETSAVE (ATTACHMENU Menu PromptWindow (if InstigatingWindow then (QUOTE TOP) else (QUOTE BOTTOM)) (QUOTE LEFT)) (BQUOTE (PROGN (DETACHWINDOW (WFROMMENU , Menu)) (DELETEMENU , Menu T)))) (* * If there is an instigating window, make sure it and all its attachments are visible on the screen.) (if InstigatingWindow then (NC.MoveWindowOntoScreen InstigatingWindow)) (* * Give the prompt window the tty process) (TTY.PROCESS (WINDOWPROP PromptWindow (QUOTE PROCESS))) (* * Loop as long as necessary) (until (OR (EQ SelectedCards (QUOTE CANCELLED)) (AND SingleCardFlg SelectedCards) (EQ (CAR SelectedCards) (QUOTE DONE))) do ( (* * Wait for the user to respond by copy inserting something into the prompt window) (until (EQ CopyInsertEvent (AWAIT.EVENT CopyInsertEvent)) do NIL) (* * Get the latest selection list) (SETQ SelectedCards (WINDOWPROP PromptWindow (QUOTE SelectedCards) )) (RESETLST (* * Turn off the caret) (RESETSAVE (TTY.PROCESS (THIS.PROCESS))) (* * If the last thing wasn't a done or cancel, process the new selection) (COND ((AND (NEQ (CAR SelectedCards) (QUOTE DONE)) (NEQ SelectedCards (QUOTE CANCELLED)) (NEQ (CAR SelectedCards) (QUOTE *New% Card*))) (* * Check to make sure that the selection is valid) (COND ((EQ (CAR SelectedCards) (QUOTE *Undo% Selection*)) (* Chop off two elements from the list - the indicator and the previous item.) (WINDOWPROP PromptWindow (QUOTE SelectedCards) (SETQ SelectedCards (CDDR SelectedCards))) (NC.ClearMsg InstigatingWindow NIL)) ((NULL (APPLY* SelectionPredicate (CAR SelectedCards))) (* Does this card match the slection predicate) (NC.PrintMsg InstigatingWindow T "*** Invalid selection. ***" (CHARACTER 13)) (WINDOWPROP PromptWindow (QUOTE SelectedCards) (SETQ SelectedCards (CDR SelectedCards)))) (T (* A valid selection.) (NC.ClearMsg InstigatingWindow NIL))) (* * Print the results in the prompt window) (NC.PrintMsg InstigatingWindow NIL (COND (Msg (CONCAT Msg (CHARACTER 13))) (T "")) "Items selected: ") (for Card in (REVERSE SelectedCards) do (NC.PrintMsg InstigatingWindow NIL ( NC.RetrieveTitle Card) ", ") (if (AND InstigatingWindow (GREATERP (DSPXPOSITION NIL PromptWindow) (TIMES 1.25 (WINDOWPROP InstigatingWindow (QUOTE WIDTH))))) then (NC.PrintMsg InstigatingWindow NIL (CHARACTER 13))))))))) (* * Return the result) (PROG1 (COND ((EQ SelectedCards (QUOTE CANCELLED)) (COND (CheckForCancelFlg (QUOTE CANCELLED)) (T NIL))) (SingleCardFlg (if (EQ (CAR SelectedCards) (QUOTE DONE)) then NIL else (CAR SelectedCards))) (T (if (EQ (CAR SelectedCards) (QUOTE DONE)) then (DREVERSE (CDR SelectedCards)) else (DREVERSE SelectedCards)))) (WINDOWPROP PromptWindow (QUOTE SelectedCards) NIL)))))) ) (PUTPROPS RHTPATCH114 COPYRIGHT ("Xerox Corporation" 1986)) (DECLARE: DONTCOPY (FILEMAP (NIL (1260 2747 (NC.ForceFilingForCardTypeP 1270 . 1621) (NC.RemoveDELETEMEImageObjsFromCard 1623 . 2745)) (3004 3408 (NC.DELETEMEImageObjP 3014 . 3406)) (3440 12559 (NC.EditNoteCard 3450 . 6344) (NC.CardNeedsFilingP 6346 . 7354) (NC.QuitCard 7356 . 12557)) (12591 38420 (NC.MakeLink 12601 . 18400 ) (NC.FillInLinkIcon 18402 . 19007) (NC.LinkIconWhenCopiedFn 19009 . 26941) (NC.LinkIconWhenMovedFn 26943 . 34194) (NC.DeleteLink 34196 . 37419) (NC.InsureLinkDisplayMode 37421 . 38418)) (38456 48899 ( NC.SelectNoteCards 38466 . 48897))))) STOP