(FILECREATED "19-Nov-85 14:50:55" {QV}<NOTECARDS>1.3K>RHTPATCH006.;3 13142
changes to: (VARS RHTPATCH006COMS)
(FNS NC.MakeLink NC.DeleteLink NC.HookToOrphanCard)
previous date: "18-Nov-85 17:01:24" {QV}<NOTECARDS>1.3K>RHTPATCH006.;1)
(* Copyright (c) 1985 by Xerox Corporation. All rights reserved.)
(PRETTYCOMPRINT RHTPATCH006COMS)
(RPAQQ RHTPATCH006COMS ((FNS NC.DeleteLink NC.HookToOrphanCard NC.MakeLink NC.SelectNoteCards)))
(DEFINEQ
(NC.DeleteLink
(LAMBDA (Link NoOrphanHookFlg Don'tDelLinkIconFlg) (* rht: "18-Nov-85 22:29")
(* * 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.)
(LET ((SourceCard (fetch (Link SourceCard) of Link)))
(WITH.MONITOR (NC.FetchMonitor (fetch (Card NoteFile) of SourceCard))
(OR Don'tDelLinkIconFlg (NC.DelReferencesToCard SourceCard Link))
(NC.DelFromLink Link NoOrphanHookFlg)
(NC.DelToLink Link)
(* * This UID replacement is worrisome. Does it mean that link deletion can't be undone?)
(replace (Link UID) of Link with -1)))))
(NC.HookToOrphanCard
(LAMBDA (Card OrphansCard) (* rht: "19-Nov-85 00:01")
(* The last reference to the card has just been
deleted. Hook this card to the orphan card so it
doesn't get lost forever)
(* * kirk: 14Nov85: deleted use of DatabaseStream and changed EQs to NC.Same*Ps)
(LET ((NoteFile (fetch (Card NoteFile) of Card)))
(OR OrphansCard (SETQ OrphansCard (fetch (NoteFile OrphansCard) of NoteFile)))
(COND
((NC.ActiveCardP OrphansCard)
(NC.MakeFilingLink OrphansCard Card (if (NC.FileBoxP Card T)
then NC.SubBoxLinkLabel
else NC.FiledCardLinkLabel)))
(T (WITH.MONITOR (NC.FetchMonitor NoteFile)
(NC.GetNoteCard OrphansCard)
(NC.MakeFilingLink OrphansCard Card (if (NC.FileBoxP Card T)
then NC.SubBoxLinkLabel
else NC.FiledCardLinkLabel))
(NC.PutNoteCard OrphansCard)
(NC.PutLinks OrphansCard)
(NC.DeactivateCard OrphansCard)))))))
(NC.MakeLink
(LAMBDA (Window LinkLabel DestinationCard SourceCard DisplayMode AnchorMode Message NoDisplayFlg
LinkToInsertAfter) (* rht: "19-Nov-85 12:02")
(* * 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.)
(LET (Link Type)
(OR SourceCard (SETQ SourceCard (NC.CoerceToCard Window)))
(OR Window (SETQ Window (NC.FetchWindow SourceCard)))
(OR Message (SETQ Message "Please select the Card or Box to be linked to."))
(OR DestinationCard (SETQ DestinationCard (NC.SelectNoteCards
T
(FUNCTION (LAMBDA (CardID)
(COND
((NEQ CardID SourceCard)
T)
(T (NC.PrintMsg Window T "A Card/Box cannot link to itself. "
(CHARACTER 13)
"Selection ignored."
(CHARACTER 13))
NIL))))
NC.SelectingSingleCardMenu SourceCard NIL Message)))
(COND
((EQ DestinationCard (QUOTE *New% Card*))
(SETQ DestinationCard (AND (SETQ Type (NC.AskNoteCardType (WINDOWREGION Window)
))
(NC.CoerceToCard (NC.MakeNoteCard
Type
(fetch (Card NoteFile)
of SourceCard)
NIL NoDisplayFlg))))))
(COND
(DestinationCard (SETQ Link (create Link
UID ←(NC.MakeUID)
SourceCard ← SourceCard
DestinationCard ← DestinationCard
AnchorMode ← AnchorMode
Label ← LinkLabel
DisplayMode ←(OR DisplayMode (
NC.DefaultLinkDisplayMode
SourceCard))))
(NC.AddToLink Link LinkToInsertAfter)
(NC.AddFromLink Link)
Link)
(T NIL)))))
(NC.SelectNoteCards
(LAMBDA (SingleCardFlg SelectionPredicate Menu InstigatingCardOrWindow ReturnLinksFlg Msg
CheckForCancelFlg) (* rht: "19-Nov-85 11:55")
(* 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.)
(PROG (Window WinRegion Card ButtonEventFn (OldLength 0)
InstigatingWindow InstigatingCard InstigatingNoteFile MenuWindow SelectedCard
LinkOrID TextObj)
(OR SelectionPredicate (SETQ SelectionPredicate (FUNCTION TRUE)))
(SETQ NC.SelectedCards)
(COND
((NC.CardP InstigatingCardOrWindow)
(SETQ InstigatingWindow (NC.FetchWindow InstigatingCardOrWindow)))
((WINDOWP InstigatingCardOrWindow)
(SETQ InstigatingWindow InstigatingCardOrWindow))
(T (SETQ InstigatingWindow NIL)))
(SETQ InstigatingCard (NC.CoerceToCard InstigatingCardOrWindow))
(SETQ InstigatingNoteFile (AND InstigatingCard (fetch (Card NoteFile) of
InstigatingCard)))
(SETQ WinRegion (WINDOWREGION (OR InstigatingWindow PROMPTWINDOW)))
(NC.PrintMsg InstigatingWindow T (COND
(Msg (CONCAT Msg (CHARACTER 13)))
(T ""))
"Items selected: ")
(RESETLST
(RESETSAVE NIL (BQUOTE (NC.ClearMsg , InstigatingWindow T)))
(RESETSAVE NC.SelectionInProgress (COND
(ReturnLinksFlg (QUOTE Links))
(T T)))
(RESETSAVE (ADDMENU Menu NIL (create POSITION
XCOORD ←(fetch (REGION LEFT) of
WinRegion)
YCOORD ←(COND
(InstigatingWindow (fetch (REGION TOP)
of WinRegion))
(T (fetch (REGION BOTTOM) of WinRegion)
))))
(LIST (QUOTE PROGN)
(LIST (QUOTE DETACHWINDOW)
(LIST (QUOTE WFROMMENU)
Menu))
(LIST (QUOTE DELETEMENU)
Menu T))) (* If there is an instigating window, make sure it and
all its attachments are visible on the screen.)
(COND
(InstigatingWindow (ATTACHWINDOW (WFROMMENU Menu)
InstigatingWindow
(QUOTE TOP)
(QUOTE LEFT))
(NC.MoveWindowOntoScreen InstigatingWindow)))
(until (COND
(SingleCardFlg (OR NC.SelectedCards (NULL NC.SelectionInProgress)))
(T (NULL NC.SelectionInProgress)))
do (until (MOUSESTATE LEFT))
(SETQ Window (WHICHW LASTMOUSEX LASTMOUSEY))
(AND Window (SETQ Card (NC.CardFromWindow Window)))
(COND
(Window (SETQ ButtonEventFn (WINDOWPROP Window (QUOTE BUTTONEVENTFN)))
(COND
((AND (NOT (INSIDEP (DSPCLIPPINGREGION NIL
(WINDOWPROP
Window
(QUOTE DSP)))
(LASTMOUSEX Window)
(LASTMOUSEY Window))))
(AND Card (for SelectedCard in NC.SelectedCards
never (NC.SameCardP Card SelectedCard))
(SETQ NC.SelectedCards (CONS Card NC.SelectedCards))))
(T (COND
(ButtonEventFn
(RESETLST (COND
((AND (EQ InstigatingWindow Window)
(SETQ TextObj (WINDOWPROP
Window
(QUOTE TEXTOBJ))))
(RESETSAVE (replace (TEXTOBJ
EDITOPACTIVE)
of TextObj with NIL)
(LIST
(FUNCTION (LAMBDA (TextObj
OldValue)
(replace (TEXTOBJ
EDITOPACTIVE)
of TextObj
with OldValue)))
TextObj
(fetch (TEXTOBJ
EDITOPACTIVE)
of TextObj)))))
(APPLY* ButtonEventFn Window))))))))
(COND
((IGREATERP (LENGTH NC.SelectedCards)
OldLength)
(COND
((EQ (CAR NC.SelectedCards)
(QUOTE *Undo% Selection*))
(* Chop off two elements from the list -
the indicator and the previous item.)
(SETQ NC.SelectedCards (CDDR NC.SelectedCards))
(SETQ OldLength (LENGTH NC.SelectedCards))
(NC.ClearMsg InstigatingWindow NIL)
(* Reprint the titles of the selections.)
)
((AND InstigatingNoteFile Card (NOT (NC.SameNoteFileP
(fetch (Card NoteFile)
of Card)
InstigatingNoteFile)))
(* Selection was not valid.)
(NC.PrintMsg InstigatingWindow T "*** Invalid selection. ***"
(CHARACTER 13))
(SETQ NC.SelectedCards (CDR NC.SelectedCards)))
((NULL (APPLY* SelectionPredicate (CAR NC.SelectedCards)))
(* Selection was not valid.)
(NC.PrintMsg InstigatingWindow T "*** Invalid selection. ***"
(CHARACTER 13))
(SETQ NC.SelectedCards (CDR NC.SelectedCards)))
(T (* A valid selection.)
(SETQ OldLength (LENGTH NC.SelectedCards))
(NC.ClearMsg InstigatingWindow NIL)))
(NC.PrintMsg InstigatingWindow NIL (COND
(Msg (CONCAT Msg (CHARACTER 13)))
(T ""))
"Items selected: ")
(for LinkOrCard in (REVERSE NC.SelectedCards)
do (NC.PrintMsg InstigatingWindow NIL
(NC.RetrieveTitle (COND
((type? Link LinkOrCard)
(fetch (Link SourceCard)
of LinkOrCard))
(T LinkOrCard)))
", "))))
(until (MOUSESTATE UP))
(TOTOPW (WFROMMENU Menu))) (* Allow TEdit to finish any outstanding Selections
caused by buttoning off of the Notecard link objects)
(BLOCK))
(UNTILMOUSESTATE UP)
(RETURN (PROG1 (COND
((EQ NC.SelectedCards (QUOTE CANCELLED))
(COND
(CheckForCancelFlg (QUOTE CANCELLED))
(T NIL)))
(SingleCardFlg (CAR NC.SelectedCards))
(T (DREVERSE NC.SelectedCards)))
(SETQ NC.SelectedCards))))))
)
(PUTPROPS RHTPATCH006 COPYRIGHT ("Xerox Corporation" 1985))
(DECLARE: DONTCOPY
(FILEMAP (NIL (466 13060 (NC.DeleteLink 476 . 1270) (NC.HookToOrphanCard 1272 . 2481) (NC.MakeLink
2483 . 4942) (NC.SelectNoteCards 4944 . 13058)))))
STOP