(FILECREATED "22-Apr-87 16:37:56" {QV}<NOTECARDS>1.3K>NEXT>RGPATCH032.;1 16038 changes to: (VARS RGPATCH032COMS) (FNS NC.SelectNoteCards)) (* Copyright (c) 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT RGPATCH032COMS) (RPAQQ RGPATCH032COMS ((* * rg 4/22/87 changed some names, added PromptWindowProcess WINDOWPROP to allow promptwindow stacking) (* * changes to NCINTERFACE) (FNS NC.SelectNoteCards))) (* * rg 4/22/87 changed some names, added PromptWindowProcess WINDOWPROP to allow promptwindow stacking) (* * changes to NCINTERFACE) (DEFINEQ (NC.SelectNoteCards [LAMBDA (SingleCardFlg SelectionPredicate Menu InstigatingCardOrWindow Msg CheckForCancelFlg) (* Randy.Gobbel "22-Apr-87 16:35") (* 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. This function should always be called from inside of an NC.CardSelectionOperation wrapper.) (* * 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.) (* * rht 10/18/86: Give TTY process to process that originally had it if possible.) (* * rht & pmi 11/14/86: Now checks for valid card before testing SelectionPredicate.) (* * pmi 12/5/86 Modified prompt messages to mention SHIFT-selection.) (* * pmi 12/12/86: Removed obsolete ReturnLinksFlg argument.) (* * rg 3/18/87 reworked for NC.CardSelectionOperation: added NAMED-RESETSAVE forms for Card locking.) (* * 3/23/87: Changed to call REMOVEWINDOW instead of DETACHWINDOW before deleting the attached menu. Also changed so that menu is attached to InstigatingWindow rather than to PromptWindow. This makes it possible for windows to "slide down" when selection ends.) (* * rht 3/24/87: Now calls NC.CoerceToInterestedWindow) (* * RG 4/1/87 changed CANCELLED to DON'T) (* * rg 4/22/87 changed some names, added PromptWindowProcess WINDOWPROP to allow promptwindow stacking) (DECLARE (USEDFREE CardListResetVar)) (LET (Window Card ButtonEventFn InstigatingWindow InstigatingCard InstigatingNoteFile MenuWindow PromptWindow CopyInsertEvent SelectedCards BinLoopProcess OldTTYProcess OpInProgress ResetItems TTYResetVar InternalResetVar) (NAMED-RESETLST InternalResetVar (OR SelectionPredicate (SETQ SelectionPredicate (FUNCTION TRUE))) (SETQ PromptWindow (OR (NC.AttachPromptWindow (SETQ InstigatingWindow (NC.CoerceToInterestedWindow InstigatingCardOrWindow))) PROMPTWINDOW)) (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 shift-selected: ") (SETQ OldTTYProcess (TTY.PROCESS)) (* * if we are running under the mouse process, start up a new mouse process) (ALLOW.BUTTON.EVENTS) (* * 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] (NAMED-RESETSAVE InternalResetVar (WINDOWPROP PromptWindow (QUOTE SelectedCards) NIL) (BQUOTE (WINDOWPROP , PromptWindow (QUOTE SelectedCards) NIL))) (NAMED-RESETSAVE InternalResetVar (WINDOWPROP PromptWindow (QUOTE SelectingCards) T) (BQUOTE (WINDOWPROP , PromptWindow SelectingCards NIL))) (NAMED-RESETSAVE InternalResetVar (WINDOWPROP PromptWindow (QUOTE SelectCardsMonitor) (CREATE.MONITORLOCK (QUOTE SelectCards))) (BQUOTE (WINDOWPROP , PromptWindow SelectCardsMonitor NIL))) (NAMED-RESETSAVE InternalResetVar (WINDOWPROP PromptWindow (QUOTE PromptWindowProcess) (THIS.PROCESS)) (BQUOTE (WINDOWPROP , PromptWindow PromptWindowProcess NIL))) (* * Make the process behind the prompt window includiong control for a blibnking cursor) [WINDOWPROP PromptWindow (QUOTE PROCESS) (SETQ BinLoopProcess (ADD.PROCESS (QUOTE (PROG NIL (BLOCK) (TTYDISPLAYSTREAM (PROCESSPROP (THIS.PROCESS) (QUOTE WINDOW))) XXXX (BIN) (BLOCK) (GO XXXX))) (QUOTE WINDOW) PromptWindow (QUOTE NAME) (QUOTE BinLoopProcess) (QUOTE TTYENTRYFN) (FUNCTION [LAMBDA (Process) (PROCESSPROP Process (QUOTE OldCaret) (CARET CROSSHAIRS)) (ECHOMODE]) (QUOTE TTYEXITFN) (FUNCTION (LAMBDA (Process) (CARET (PROCESSPROP Process (QUOTE OldCaret))) (ECHOMODE T] (NAMED-RESETSAVE InternalResetVar NIL (BQUOTE (DEL.PROCESS , BinLoopProcess))) (* * Insure the prompt window is cleared on the way out) [NAMED-RESETSAVE InternalResetVar NIL (BQUOTE (PROGN (AND (HASTTYWINDOWP , BinLoopProcess) (TTY.PROCESS (if (AND (PROCESSP , OldTTYProcess) (HASTTYWINDOWP , OldTTYProcess) ) then , OldTTYProcess else 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))) [NAMED-RESETSAVE InternalResetVar (PROGN (ATTACHMENU Menu (OR InstigatingWindow PROMPTWINDOW) (if InstigatingWindow then (QUOTE TOP) else (QUOTE BOTTOM)) (if (AND (WINDOWP InstigatingWindow) (WINDOWP PromptWindow)) then (CDR (WINDOWPROP PromptWindow (QUOTE WHEREATTACHED)) ) else (QUOTE LEFT))) (WINDOWPROP (WFROMMENU Menu) (QUOTE SelectionPromptWindow) PromptWindow)) (BQUOTE (PROGN (REMOVEWINDOW (WFROMMENU , Menu] (* * 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) [WITH.MONITOR (WINDOWPROP PromptWindow (QUOTE SelectCardsMonitor)) (until (OR (EQ SelectedCards (QUOTE DON'T)) (AND SingleCardFlg SelectedCards) (EQ (CAR SelectedCards) (QUOTE DONE))) do ( (* * Wait for the user to respond by copy inserting something into the prompt window) (until [NOT (EQ SelectedCards (WINDOWPROP PromptWindow (QUOTE SelectedCards] do (MONITOR.AWAIT.EVENT (WINDOWPROP PromptWindow (QUOTE SelectCardsMonitor)) CopyInsertEvent)) (* * Get the latest selection list) (SETQ SelectedCards (WINDOWPROP PromptWindow (QUOTE SelectedCards))) (NAMED-RESETLST TTYResetVar (* * Turn off the caret) (NAMED-RESETSAVE TTYResetVar (TTY.PROCESS (THIS.PROCESS))) (* * If the last thing wasn't a done or cancel, process the new selection) (SETQ Card (CAR SelectedCards)) (WITH.MONITOR NC.LockLock (COND ((AND (NEQ Card (QUOTE DONE)) (NEQ SelectedCards (QUOTE DON'T)) (NEQ Card (QUOTE *New% Card*))) (* * Check to make sure that the selection is valid) [COND ((EQ Card (QUOTE *Undo% Selection*)) (* Chop off two elements from the list - the indicator and the previous item.) (SETQ Card (CADR SelectedCards)) (WINDOWPROP PromptWindow (QUOTE SelectedCards) (SETQ SelectedCards (CDDR SelectedCards))) (* now get our hands off of all the locks we've acquired for this card) (NAMED-RESETUNSAVE NC.SelectNoteCardsResetVar (NC.FetchUserDataProp Card (QUOTE ResetItems))) (NC.SetUserDataProp Card (QUOTE ResetItems) NIL) (NC.ClearMsg InstigatingWindow NIL)) [(OR (NOT (NC.ValidCardP Card)) (NULL (APPLY* SelectionPredicate Card))) (* Does this card match the slection predicate) (NC.PrintMsg InstigatingWindow T "*** Invalid selection. ***" (CHARACTER 13)) (WINDOWPROP PromptWindow (QUOTE SelectedCards) (SETQ SelectedCards (CDR SelectedCards] ((AND (SETQ OpInProgress (NC.CardCheckOpInProgress Card)) (NEQ OpInProgress (QUOTE US))) (NC.PrintOperationInProgressMsg InstigatingWindow "Select Card" OpInProgress) (DISMISS 1000) (WINDOWPROP PromptWindow (QUOTE SelectedCards) (SETQ SelectedCards (CDR SelectedCards))) (NC.ClearMsg InstigatingWindow NIL)) (T (* A valid selection.) (NC.ClearMsg InstigatingWindow NIL) (SETQ ResetItems NIL) (SETQ ResetItems (CONS (NAMED-RESETSAVE CardListResetVar (NC.SetUserDataProp Card (QUOTE ProcessInProgress) (THIS.PROCESS)) (BQUOTE ( NC.SetUserDataProp , Card ProcessInProgress NIL) )) ResetItems)) (SETQ ResetItems (CONS (NAMED-RESETSAVE CardListResetVar (NC.SetUserDataProp Card (QUOTE OperationInProgress) "Select Card") (BQUOTE ( NC.SetUserDataProp , Card OperationInProgress NIL) )) ResetItems)) (SETQ ResetItems (CONS [NAMED-RESETSAVE CardListResetVar [NC.NoteFileProp (fetch (Card NoteFile) of Card) (QUOTE CardProcessInProgressList) (CONS (THIS.PROCESS) (NC.NoteFileProp (fetch (Card NoteFile) of Card) (QUOTE CardProcessInProgressList] (BQUOTE (NC.ResetCardProcessInProgress , (fetch (Card NoteFile) of Card] ResetItems)) (SETQ ResetItems (CONS [NAMED-RESETSAVE CardListResetVar (SETQ NC.CardBusyList (CONS ( THIS.PROCESS) NC.CardBusyList)) (QUOTE (SETQ NC.CardBusyList (DREMOVE ( THIS.PROCESS) NC.CardBusyList] ResetItems)) (NAMED-RESETSAVE InternalResetVar (NC.SetUserDataProp Card (QUOTE ResetItems) ResetItems) (BQUOTE (NC.SetUserDataProp , Card ResetItems NIL] (* * Print the results in the prompt window) (NC.PrintMsg InstigatingWindow NIL (COND (Msg (CONCAT Msg (CHARACTER 13))) (T "")) "Items selected: ") (for ThisCard in (REVERSE SelectedCards) do (NC.PrintMsg InstigatingWindow NIL (NC.RetrieveTitle ThisCard) ", ") (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 DON'T)) (COND (CheckForCancelFlg (QUOTE DON'T)) (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 RGPATCH032 COPYRIGHT ("Xerox Corporation" 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (613 15957 (NC.SelectNoteCards 623 . 15955))))) STOP