(FILECREATED "15-May-87 17:05:27" {QV}<NOTECARDS>1.3K>NEXT>RGPATCH041.;1 17403
changes to: (VARS RGPATCH041COMS)
(FNS NC.AddFromLink NC.ChangeLinkDisplayMode NC.CheckForOrphanDelete
NC.DelReferencesToCardFromGlobalList NC.DelToLink NC.RelabelLink))
(* Copyright (c) 1987 by Xerox Corporation. All rights reserved.)
(PRETTYCOMPRINT RGPATCH041COMS)
(RPAQQ RGPATCH041COMS ((* * rg 5/15/87 these now call NC.LinksCachedP instead of NC.ActiveCardP)
(* * changes to NCLINKS)
(FNS NC.AddFromLink NC.ChangeLinkDisplayMode NC.CheckForOrphanDelete
NC.DelReferencesToCardFromGlobalList NC.DelToLink NC.RelabelLink)))
(* * rg 5/15/87 these now call NC.LinksCachedP instead of NC.ActiveCardP)
(* * changes to NCLINKS)
(DEFINEQ
(NC.AddFromLink
[LAMBDA (Link) (* Randy.Gobbel "15-May-87 09:00")
(* * Add Link to the FromLinks of the appropraite card on DatbaseStream)
(* * kirk: 14Nov85: deleted use of of DatabaseStream)
(* * rht 2/14/86: Now calls NC.UncacheLinks instead of two calls to NC.SetToLinks and NC.SetFromLinks.)
(* * kef 7/22/86: Now only calls NC.PutFromLinks instead of NC.PutLinks because we can't be certain of owning the
write locks on all of the Link parts.)
(* * rg 5/15/87 now calls NC.LinksCachedP instead of NC.ActiveCardP)
(LET ((Card (fetch (Link DestinationCard) of Link)))
[COND
((NC.LinksCachedP Card)
(NC.SetFromLinks Card (CONS Link (NC.FetchFromLinks Card)))
(NC.SetLinksDirtyFlg Card T))
(T (WITH.MONITOR (NC.FetchMonitor (fetch (Card NoteFile) of Card))
(NC.GetLinks Card)
(NC.SetFromLinks Card (CONS Link (NC.FetchFromLinks Card)))
(NC.SetLinksDirtyFlg Card T)
(NC.PutFromLinks Card)
(NC.UncacheLinks Card]
Link])
(NC.ChangeLinkDisplayMode
[LAMBDA (LinkOrLinkIcon Window NewDisplayMode) (* Randy.Gobbel "15-May-87 16:39")
(* * 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.)
(* * rht 2/1/85: Now doesn't do all the work if new display mode is same as the old one. Or if user doesn't make a
selection from the menu.)
(* * kef 8/8/86: Now does the write through to the NoteFile even if the card is active, but not being edited.
Also, in the case of doing the write through, puts only the from links.)
(* * fgh 8/30/86 Adapted to call NC.IfCardPartNotBusy.)
(* * rht 9/29/86: Changed Ken's call to NC.CardBeingEditedP to NC.ActiveCardP and other minor changes.)
(* * rht 2/18/87: Added check for readonly notefile to fix bug %#376.0)
(* * rg 5/15/87 now calls NC.LinksCachedP instead of NC.ActiveCardP when changing FromLinks)
(LET (Card DestinationCard Link LinkIcon GlobalLinkFlg OldDisplayMode)
[if (NC.LinkIconImageObjP LinkOrLinkIcon)
then (SETQ Link (NC.FetchLinkFromLinkIcon LinkOrLinkIcon))
(SETQ LinkIcon LinkOrLinkIcon)
else (SETQ Link LinkOrLinkIcon)
(OR (SETQ GlobalLinkFlg (NC.GlobalLinkP Link))
(SETQ LinkIcon (NC.FetchLinkIconForLink Link]
(SETQ Card (fetch (Link SourceCard) of Link))
(SETQ OldDisplayMode (fetch (Link DisplayMode) of Link))
(if (NC.CheckForNotReadOnly Card Window "Can't change display mode for links in ")
then [COND
((WINDOWP Window))
((NC.ActiveCardP Card)
(SETQ Window (NC.FetchWindow Card]
(* * Get new display mode from user)
(SETQ DestinationCard (fetch (Link DestinationCard) of Link))
(NC.IfCardPartNotBusy
DestinationCard
(QUOTE FROMLINKS)
[if (NOT NewDisplayMode)
then (SETQ NewDisplayMode
(NC.DisplayModeFromStylesheetSelections
(STYLESHEET (CREATE.STYLE (QUOTE ITEMS)
[LIST
(create MENU
ITEMS ←
(QUOTE (Yes No Float)
))
(create MENU
ITEMS ←
(QUOTE (Yes No Float)
))
(create MENU
ITEMS ←
(QUOTE (Yes No Float]
(QUOTE ITEM.TITLES)
(QUOTE (Title?% LinkType?%
AttachBitmap?))
(QUOTE ITEM.TITLE.FONT)
(FONTCOPY MENUFONT (QUOTE
WEIGHT)
(QUOTE BOLD))
(QUOTE SELECTIONS)
(
NC.StylesheetSelectionsFromDisplayMode
OldDisplayMode)
(QUOTE NEED.NOT.FILL.IN)
NIL
(QUOTE TITLE)
(QUOTE Display% Mode?)
(QUOTE POSITION)
(create POSITION
XCOORD ← LASTMOUSEX
YCOORD ← LASTMOUSEY]
(if (OR (NULL NewDisplayMode)
(EQUAL NewDisplayMode OldDisplayMode))
then
(* * If new display mode is same as old, then bail out.)
NIL
else
(* * Update link in LinkIcon or in global links list)
(if GlobalLinkFlg
then (for GlobalLink in (NC.FetchGlobalLinks Card)
when (NC.SameLinkP Link GlobalLink)
do (replace (Link DisplayMode) of GlobalLink
with NewDisplayMode))
(NC.SetLinksDirtyFlg Card T)
else (replace (Link DisplayMode) of (NC.FetchLinkFromLinkIcon
LinkIcon)
with NewDisplayMode)
(NC.MarkCardDirty Card))
(* * Update link in ToLinks List of Source card)
(for ToLink in (NC.FetchToLinks Card) when (NC.SameLinkP
Link ToLink)
do (replace (Link DisplayMode) of ToLink with
NewDisplayMode))
(NC.SetLinksDirtyFlg Card T)
(* * Update Link in FromLinks list of Destination card)
(if (NC.LinksCachedP DestinationCard)
then (for FromLink in (NC.FetchFromLinks DestinationCard)
when (NC.SameLinkP Link FromLink)
do (replace (Link DisplayMode) of FromLink
with NewDisplayMode))
(NC.SetLinksDirtyFlg DestinationCard T)
else (WITH.MONITOR (NC.FetchMonitor (fetch (Card NoteFile)
of DestinationCard))
(NC.GetLinks DestinationCard)
(for FromLink in (NC.FetchFromLinks
DestinationCard)
when (NC.SameLinkP Link FromLink)
do (replace (Link DisplayMode)
of FromLink with NewDisplayMode))
(NC.PutFromLinks DestinationCard)
(NC.UncacheLinks DestinationCard)))
(* * Update the image in any active window for Card)
(if [AND (WINDOWP Window)
(NOT (NC.TEditBasedP (NC.RetrieveType Card]
then (NC.UpdateLinkImages Window (fetch (Link
DestinationCard)
of Link)))
(* This causes tedit to redisplay the screen.)
(QUOTE CHANGED])
(NC.CheckForOrphanDelete
[LAMBDA (SourceCard DestinationCard SourceWindow) (* Randy.Gobbel "15-May-87 16:40")
(* 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.)
(* * kirk: 14Nov85: changed EQs to NC.Same*Ps)
(* * rht 7/4/86: Brought up to date with 1.3k. E.g. took out mention of NC.OrphansID)
(* * rg 5/15/87 now calls NC.LinksCachedP instead of NC.ActiveCardP)
(LET [(FilingLinks (LIST NC.SubBoxLinkLabel NC.FiledCardLinkLabel))
(OrphansCard (fetch (NoteFile OrphansCard) of (fetch (Card NoteFile) of SourceCard]
(AND (NC.SameCardP SourceCard OrphansCard)
(for Link in (COND
((NC.LinksCachedP DestinationCard)
(NC.FetchFromLinks DestinationCard))
(T (NC.GetLinks DestinationCard)
(NC.FetchFromLinks DestinationCard)))
when (FMEMB (fetch (Link Label) of Link)
FilingLinks)
unless (NC.SameCardP (fetch (Link SourceCard) of Link)
OrphansCard)
never Link)
(NC.PrintMsg (NC.FetchWindow SourceCard)
T "You have just deleted the last filing link to " (NC.RetrieveTitle
DestinationCard)
(CHARACTER 13)
"The Search operation can be used to find it."])
(NC.DelReferencesToCardFromGlobalList
[LAMBDA (SourceCard LinkOrDestinationCard) (* Randy.Gobbel "15-May-87 16:52")
(* * LinkOrDestinationCard is being deleted. Remove all references to it from the global links list of SourceCard)
(* * rht 11/19/84: Fixed a naming typo changing ID to SourceCard everywhere. Also fixed DestinationID arg to be
LinkOrDestinationID.)
(* * kirk: 14Nov85: deleted use of of DatabaseStream and LinkID and changed EQs to NC.Same*Ps)
(* * rg 5/15/87 now calls NC.LinksCachedP instead of NC.ActiveCardP)
(COND
((NC.LinksCachedP SourceCard)
(NC.SetGlobalLinks SourceCard (for Link in (NC.FetchGlobalLinks SourceCard)
when (if (NC.CardP LinkOrDestinationCard)
then (NOT (NC.SameCardP
LinkOrDestinationCard
(fetch (Link DestinationCard)
of Link)))
else (NOT (NC.SameLinkP
LinkOrDestinationCard
Link)))
collect Link)))
(T (WITH.MONITOR (NC.FetchMonitor (fetch (Card NoteFile) of SourceCard))
(NC.GetLinks SourceCard)
(NC.SetGlobalLinks SourceCard
(for Link in (NC.FetchGlobalLinks SourceCard)
when (if (NC.CardP LinkOrDestinationCard)
then (NOT (NC.SameCardP
LinkOrDestinationCard
(fetch (Link
DestinationCard)
of Link)))
else (NOT (NC.SameLinkP
LinkOrDestinationCard
Link)))
collect Link))
(NC.PutLinks SourceCard])
(NC.DelToLink
[LAMBDA (Link) (* Randy.Gobbel "15-May-87 16:54")
(* * Delete ToLink spoecified by Link from cards on DatabasseStream)
(* * rht 12/1/84: Now doesn't do any work unless SourceCard is valid, i.e. not DELETED or FREE.)
(* * kirk: 13Nov85: changed to use NoteFile from card from link instead of DatabaseStream)
(* * rht 2/14/86: Now calls NC.UncacheLinks instead of two calls to NC.SetToLinks and NC.SetFromLinks.)
(* * rg 5/15/87 now calls NC.LinksCachedP instead of NC.ActiveCardP)
(PROG ((SourceCard (fetch (Link SourceCard) of Link)))
(COND
((NOT (NC.ValidCardP SourceCard)))
((NC.LinksCachedP SourceCard)
(NC.SetToLinks SourceCard (DREMOVE (for OldLink in (NC.FetchToLinks
SourceCard)
thereis (AND (NC.SameLinkP Link
OldLink)
OldLink))
(NC.FetchToLinks SourceCard)))
(NC.SetLinksDirtyFlg SourceCard T))
(T (WITH.MONITOR (NC.FetchMonitor (fetch (Card NoteFile) of SourceCard)
"NC.AddFromLink")
(NC.GetLinks SourceCard)
(NC.SetToLinks SourceCard (DREMOVE (for OldLink
in (NC.FetchToLinks
SourceCard)
thereis
(AND (NC.SameLinkP
Link OldLink)
OldLink))
(NC.FetchToLinks SourceCard)))
(NC.SetLinksDirtyFlg SourceCard T)
(NC.PutLinks SourceCard))
(NC.UncacheLinks SourceCard)))
(RETURN Link])
(NC.RelabelLink
[LAMBDA (LinkOrLinkIcon Window NewLinkLabel ForceRedisplayFlg)
(* Randy.Gobbel "15-May-87 17:03" 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 Card is defined before first use.)
(* * kirk 14Nov85: deleted use of and LinkID)
(* * kef 8/8/86: Added obtaining write lock and NC.PutFromLinks.)
(* * fgh 8/30/86 Adapted to NC.IfCardPartNotBusy)
(* * rht 9/29/86: Changed Ken's call to NC.CardBeingEditedP to NC.ActiveCardP and other minor mod's.)
(* * rg 5/15/87 now calls NC.LinksCachedP instead of NC.ActiveCardP)
(LET (Link LinkIcon Card DestinationCard OldLabel NoteCardType GlobalLinkFlg)
[if (NC.LinkIconImageObjP LinkOrLinkIcon)
then (SETQ Link (NC.FetchLinkFromLinkIcon LinkOrLinkIcon))
(SETQ LinkIcon LinkOrLinkIcon)
else (SETQ Link LinkOrLinkIcon)
(OR (SETQ GlobalLinkFlg (NC.GlobalLinkP Link))
(SETQ LinkIcon (NC.FetchLinkIconForLink Link]
(SETQ Card (fetch (Link SourceCard) of Link))
[COND
((WINDOWP Window))
((NC.ActiveCardP Card)
(SETQ Window (NC.FetchWindow Card]
(SETQ DestinationCard (fetch (Link DestinationCard) of Link))
(NC.IfCardPartNotBusy DestinationCard (QUOTE FROMLINKS)
(COND
((NC.SystemLinkLabelP (fetch (Link Label) 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 NoteCardType (NC.RetrieveType Card))
(* * Put new label in Link Icon or global links list)
(if GlobalLinkFlg
then (for GlobalLink in (NC.FetchGlobalLinks Card)
when (NC.SameLinkP GlobalLink Link)
do (replace (Link Label) of GlobalLink
with NewLinkLabel)
(NC.SetLinksDirtyFlg Card T)
(RETURN))
else (replace (Link Label) of (NC.FetchLinkFromLinkIcon
LinkIcon)
with NewLinkLabel)
(NC.MarkCardDirty Card))
(* * Update ToLink list of the SourceCard card)
(for ToLink in (NC.FetchToLinks Card)
when (NC.SameLinkP ToLink Link)
do (replace (Link Label) of ToLink with NewLinkLabel)
(NC.SetLinksDirtyFlg Card T)
(RETURN))
(* * Update FromLink list of DestinationCard card)
(if (NC.LinksCachedP DestinationCard)
then (for FromLink in (NC.FetchFromLinks
DestinationCard)
when (NC.SameLinkP FromLink Link)
do (replace (Link Label) of FromLink
with NewLinkLabel)
(NC.SetLinksDirtyFlg DestinationCard T)
(RETURN))
else (WITH.MONITOR (NC.FetchMonitor (fetch (Card NoteFile)
of DestinationCard))
(NC.GetLinks DestinationCard)
(for FromLink in (NC.FetchFromLinks
DestinationCard)
when (NC.SameLinkP FromLink Link)
do (replace (Link Label)
of FromLink with
NewLinkLabel)
(NC.SetLinksDirtyFlg
DestinationCard T)
(RETURN))
(NC.PutFromLinks DestinationCard)
(NC.UncacheLinks DestinationCard)))
(* * Update images in SourceCard window)
(COND
((AND (NULL ForceRedisplayFlg)
(NC.TEditBasedP NoteCardType))
(QUOTE CHANGED))
((WINDOWP Window)
(NC.UpdateLinkImages Window (fetch (Link DestinationCard)
of Link))
NIL)
(T NIL])
)
(PUTPROPS RGPATCH041 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
(FILEMAP (NIL (768 17322 (NC.AddFromLink 778 . 1989) (NC.ChangeLinkDisplayMode 1991 . 7802) (
NC.CheckForOrphanDelete 7804 . 9390) (NC.DelReferencesToCardFromGlobalList 9392 . 11163) (NC.DelToLink
11165 . 12876) (NC.RelabelLink 12878 . 17320)))))
STOP