(FILECREATED "20-Dec-85 19:45:00" {QV}<NOTECARDS>1.3K>FGHPATCH010.;9 23064 changes to: (VARS FGHPATCH010COMS) (FNS NC.SelectNoteCardsCopyInsertFn) previous date: "20-Dec-85 19:05:42" {QV}<NOTECARDS>1.3K>FGHPATCH010.;8) (* Copyright (c) 1985 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT FGHPATCH010COMS) (RPAQQ FGHPATCH010COMS ((* * This stuff implements the new SelectNoteCards regime) (* * New function for new file KOTOTEDITPATCHES) (FNS \TEDIT.FOREIGN.COPY?) (* * Redefined from NCINTERFACE) (FNS NC.SelectNoteCards NC.SelectionMenusWhenSelectedFn) (* * New stuff for NCINERFACE) (FNS NC.SelectNoteCardsCopyInsertFn NC.CopyButtonEventFn NC.CardImageObjP NC.CopyButtonEventFn NC.MakeCardImageObject) (VARS (NC.CardImageObjFns (IMAGEFNSCREATE))) (* * Redefined FNS from NCCARDS) (FNS NC.MakeNoteCard NC.EditNoteCard) (* * Depends on FGHPATCH011) (FILES FGHPATCH011))) (* * This stuff implements the new SelectNoteCards regime) (* * New function for new file KOTOTEDITPATCHES) (DEFINEQ (\TEDIT.FOREIGN.COPY? (LAMBDA (SEL) (* jds "19-Dec-85 16:56") (* IF the current process's window isn't a TEdit window, do a "Copy" by BKSYSBUFing the selected text. Then turn off all the various indicators.) (PROG (PROCW (SOURCE.TEXTOBJ (fetch \TEXTOBJ of SEL)) CH STREAM DEST.TEDIT? DEST.TEXTOBJ) (SETQ DEST.TEDIT? (AND (SETQ PROCW (PROCESSPROP (TTY.PROCESS) (QUOTE WINDOW))) (SETQ DEST.TEXTOBJ (WINDOWPROP PROCW (QUOTE TEXTOBJ))) (NOT (TEXTPROP DEST.TEXTOBJ (QUOTE COPYBYBKSYSBUF))))) (* Treat the destination specially if (1) the recipient process has a window, and (2) it's a TEdit window, and (3) the TEdit isn't declining special treatment by having COPYBYBKSYSBUF set in its props.) (COND ((OR (NOT DEST.TEDIT?) (AND PROCW DEST.TEXTOBJ (NEQ SOURCE.TEXTOBJ DEST.TEXTOBJ) (fetch EDITOPACTIVE of DEST.TEXTOBJ))) (* OK -- receiver isn't TEdit. Do it the hard way.) (\SETUPGETCH (fetch CH# of SEL) SOURCE.TEXTOBJ) (* Go to the first character to be copied) (SETQ STREAM (fetch STREAMHINT of SOURCE.TEXTOBJ)) (for I from 1 to (fetch DCH of SEL) do (* Run thru the selected text, copying only those items that really ARE characters--IMAGEOBJs don't get copied by this route.) (COND ((FIXP (SETQ CH (\BIN STREAM))) (BKSYSBUF (CHARACTER CH))) (T (COPYINSERT CH)))) (\SHOWSEL SEL NIL NIL) (* Then reset the copy-pending flags.) (SETQ TEDIT.COPY.PENDING NIL)))))) ) (* * Redefined from NCINTERFACE) (DEFINEQ (NC.SelectNoteCards (LAMBDA (SingleCardFlg SelectionPredicate Menu InstigatingCardOrWindow ReturnLinksFlg Msg CheckForCancelFlg) (* fgh: "20-Dec-85 19:05") (* 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.) (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))) ((WINDOWP InstigatingCardOrWindow) (SETQ InstigatingWindow InstigatingCardOrWindow)) (T (SETQ InstigatingWindow NIL))) (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: ") (* * Set up the prompt window for proper use by the CopyInsertFn) (SETQ PromptWindow (if InstigatingWindow then (GETPROMPTWINDOW InstigatingWindow) else PROMPTWINDOW)) (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) (AWAIT.EVENT CopyInsertEvent) (* * 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) (if (AND (NEQ (CAR SelectedCards) (QUOTE DONE)) (NEQ SelectedCards (QUOTE CANCELLED)) (NEQ (CAR SelectedCards) (QUOTE *New% Card*))) then (* * 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)) ((AND InstigatingNoteFile (CAR SelectedCards) (NOT (NC.SameNoteFileP (fetch (Card NoteFile) of (CAR SelectedCards)) InstigatingNoteFile))) (* This card not from the same NoteFile) (NC.PrintMsg InstigatingWindow T "*** Invalid selection. ***" (CHARACTER 13)) (WINDOWPROP PromptWindow (QUOTE SelectedCards) (SETQ SelectedCards (CDR SelectedCards)))) ((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) ", "))))) (* * 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)))))) (NC.SelectionMenusWhenSelectedFn (LAMBDA (Item Menu Button) (* fgh: "20-Dec-85 12:38") (* * rht 2/15/85: Added handler for Undo.) (* * fgh 12/20/85 Updated for use with 1.3 selection mechanism.) (SELECTQ (CAR Item) ((Done) (WINDOWPROP (MAINWINDOW (WFROMMENU Menu)) (QUOTE SelectedCards) (CONS (QUOTE DONE) (WINDOWPROP (MAINWINDOW (WFROMMENU Menu)) (QUOTE SelectedCards))))) ((Abort Cancel) (WINDOWPROP (MAINWINDOW (WFROMMENU Menu)) (QUOTE SelectedCards) (QUOTE CANCELLED))) (New% Card (WINDOWPROP (MAINWINDOW (WFROMMENU Menu)) (QUOTE SelectedCards) (CONS (QUOTE *New% Card*) (WINDOWPROP (MAINWINDOW (WFROMMENU Menu)) (QUOTE SelectedCards))))) (NoSource (WINDOWPROP (MAINWINDOW (WFROMMENU Menu)) (QUOTE SelectedCards) (LIST (QUOTE NC00000)))) (Undo (WINDOWPROP (MAINWINDOW (WFROMMENU Menu)) (QUOTE SelectedCards) (CONS (QUOTE *Undo% Selection*) (WINDOWPROP (MAINWINDOW (WFROMMENU Menu)) (QUOTE SelectedCards))))) NIL) (NOTIFY.EVENT (WINDOWPROP (MAINWINDOW (WFROMMENU Menu)) (QUOTE CopyInsertEvent))))) ) (* * New stuff for NCINERFACE) (DEFINEQ (NC.SelectNoteCardsCopyInsertFn (LAMBDA (ImageObj Window) (* fgh: "20-Dec-85 12:55") (* * Copy insert fn for promptwindow during SelectNoteCards operation) (LET ((Card (COND ((NC.LinkIconImageObjP ImageObj) (fetch (Link DestinationCard) of (NC.FetchLinkFromLinkIcon ImageObj))) ((NC.CardImageObjP ImageObj) (IMAGEOBJPROP ImageObj (QUOTE OBJECTDATUM))))) (SelectedCards (WINDOWPROP Window (QUOTE SelectedCards))) (CopyInsertEvent (WINDOWPROP Window (QUOTE CopyInsertEvent)))) (* * Add the selected acrd to the selected cards list) (if (AND Card (for SelectedCard in SelectedCards never (NC.SameCardP Card SelectedCard))) then (WINDOWPROP Window (QUOTE SelectedCards) (CONS Card SelectedCards))) (* * Wake up the main process) (NOTIFY.EVENT CopyInsertEvent)))) (NC.CopyButtonEventFn (LAMBDA (Window) (* fgh: "20-Dec-85 16:39") (* * Return NoteCardsObject if button is in title bar, else call the old copy button event fn or just the button event fn.) (LET (CopyButtonEventFn TTYWindow) (if (NOT (INSIDEP (DSPCLIPPINGREGION NIL (WINDOWPROP Window (QUOTE DSP))) (LASTMOUSEX Window) (LASTMOUSEY Window))) then (until (OR (MOUSESTATE UP) (NEQ Window (WHICHW)) (INSIDEP (DSPCLIPPINGREGION NIL (WINDOWPROP Window (QUOTE DSP))) (LASTMOUSEX Window) (LASTMOUSEY Window))) do (BLOCK)) (if (MOUSESTATE UP) then (if (AND (WINDOWP (SETQ TTYWindow (PROCESSPROP (TTY.PROCESS ) (QUOTE WINDOW)))) (WINDOWPROP TTYWindow (QUOTE SelectingCards))) then (COPYINSERT (NC.MakeCardImageObject (WINDOWPROP Window (QUOTE NoteCardObject))))) ) elseif (SETQ CopyButtonEventFn (WINDOWPROP Window (QUOTE OldCopyButtonEventFn))) then (APPLY* CopyButtonEventFn Window) elseif (SETQ CopyButtonEventFn (WINDOWPROP Window (QUOTE BUTTONEVENTFN))) then (APPLY* CopyButtonEventFn Window))))) (NC.CardImageObjP (LAMBDA (ImageObj) (* fgh: "19-Dec-85 23:34") (type? Card (IMAGEOBJPROP ImageObj (QUOTE OBJECTDATUM))))) (NC.CopyButtonEventFn (LAMBDA (Window) (* fgh: "20-Dec-85 16:39") (* * Return NoteCardsObject if button is in title bar, else call the old copy button event fn or just the button event fn.) (LET (CopyButtonEventFn TTYWindow) (if (NOT (INSIDEP (DSPCLIPPINGREGION NIL (WINDOWPROP Window (QUOTE DSP))) (LASTMOUSEX Window) (LASTMOUSEY Window))) then (until (OR (MOUSESTATE UP) (NEQ Window (WHICHW)) (INSIDEP (DSPCLIPPINGREGION NIL (WINDOWPROP Window (QUOTE DSP))) (LASTMOUSEX Window) (LASTMOUSEY Window))) do (BLOCK)) (if (MOUSESTATE UP) then (if (AND (WINDOWP (SETQ TTYWindow (PROCESSPROP (TTY.PROCESS ) (QUOTE WINDOW)))) (WINDOWPROP TTYWindow (QUOTE SelectingCards))) then (COPYINSERT (NC.MakeCardImageObject (WINDOWPROP Window (QUOTE NoteCardObject))))) ) elseif (SETQ CopyButtonEventFn (WINDOWPROP Window (QUOTE OldCopyButtonEventFn))) then (APPLY* CopyButtonEventFn Window) elseif (SETQ CopyButtonEventFn (WINDOWPROP Window (QUOTE BUTTONEVENTFN))) then (APPLY* CopyButtonEventFn Window))))) (NC.MakeCardImageObject (LAMBDA (CardObject) (* fgh: "19-Dec-85 23:33") (IMAGEOBJCREATE CardObject NC.CardImageObjFns))) ) (RPAQ NC.CardImageObjFns (IMAGEFNSCREATE)) (* * Redefined FNS from NCCARDS) (DEFINEQ (NC.MakeNoteCard (LAMBDA (NoteCardType NoteFile Title NoDisplayFlg TypeSpecificArgs Card) (* fgh: "19-Dec-85 19:10") (* Make a new note card of type NoteCardType. If type note specified, ask the user.) (* * rht 2/1/85: Added call to NC.MarkCardDirty.) (* * fgh 10/15/85 Added extra DatabaseStream argument for use by caching mechanism) (* * fgh 11/11/85: Updated to handle new Card object.) (LET (ReturnValue Window) (COND ((SETQ NoteCardType (OR NoteCardType (NC.AskNoteCardType (fetch (NoteFile Menu) of NoteFile)))) (SETQ Card (OR (PROGN (type? Card Card) Card) (NC.GetNewCard NoteFile))) (NC.SetNewCardFlg Card T) (NC.ActivateCard Card) (NC.SetType Card NoteCardType) (COND ((OR (NULL (ERSETQ (SETQ ReturnValue (APPLY* (NC.MakeCardFn NoteCardType) Card Title NoDisplayFlg TypeSpecificArgs)))) (NULL ReturnValue)) (NC.MarkCardDeleted Card) (NC.DeactivateCard Card T)) (T (SETQ Window (WINDOWP ReturnValue)) (COND ((NULL (NC.RetrieveTitle Card)) (SETQ Title (NC.SetTitle Card (SETQ Title (COND ((STRINGP Title) Title) ((AND Title (OR (LITATOM Title) (NUMBERP Title))) (MKSTRING Title)) (T "Untitled"))))) (AND Window (WINDOWPROP Window (QUOTE TITLE) Title))) (T (NC.SetTitle Card (MKSTRING (NC.RetrieveTitle Card))))) (COND (Window (WINDOWADDPROP Window (QUOTE CLOSEFN) (FUNCTION NC.QuitCard) (QUOTE FIRST)) (WINDOWPROP Window (QUOTE NoteCardObject) Card) (WINDOWPROP Window (QUOTE OldCopyButtonEventFn) (WINDOWPROP Window (QUOTE COPYBUTTONEVENTFN) (FUNCTION NC.CopyButtonEventFn))))) (NC.SetTitleDirtyFlg Card T) (* Reset the type in case of recursive calls change the type. Always want the highest level type in a recursive descent) (NC.SetType Card NoteCardType) (* Insure that a link ptr is set up during the first save) (NC.SetLinksDirtyFlg Card T) (NC.SetPropListDirtyFlg Card T) (* Mark that substance is dirty.) (NC.MarkCardDirty Card T))) ReturnValue))))) (NC.EditNoteCard (LAMBDA (Card Region/Position) (* fgh: "19-Dec-85 19:10") (* * 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.) (RESETLST (RESETSAVE (CURSOR WAITINGCURSOR)) (LET (NoteCardType Window Substance) (COND ((NC.ActiveCardP Card) (SETQ Substance (NC.FetchSubstance Card))) (T (NC.GetNoteCard Card) (SETQ Substance (NC.FetchSubstance Card)))) (SETQ NoteCardType (NC.RetrieveType Card)) (COND ((WINDOWP (SETQ Window (APPLY* (NC.EditFn NoteCardType) Card Substance Region/Position))) (WINDOWADDPROP Window (QUOTE CLOSEFN) (FUNCTION NC.QuitCard) (QUOTE FIRST)) (WINDOWPROP Window (QUOTE NoteCardObject) Card) (WINDOWPROP Window (QUOTE OldCopyButtonEventFn) (WINDOWPROP Window (QUOTE COPYBUTTONEVENTFN) (FUNCTION NC.CopyButtonEventFn))))) Window)))) ) (* * Depends on FGHPATCH011) (FILESLOAD FGHPATCH011) (PUTPROPS FGHPATCH010 COPYRIGHT ("Xerox Corporation" 1985)) (DECLARE: DONTCOPY (FILEMAP (NIL (1106 3070 (\TEDIT.FOREIGN.COPY? 1116 . 3068)) (3110 14507 (NC.SelectNoteCards 3120 . 13024) (NC.SelectionMenusWhenSelectedFn 13026 . 14505)) (14545 18875 (NC.SelectNoteCardsCopyInsertFn 14555 . 15575) (NC.CopyButtonEventFn 15577 . 17040) (NC.CardImageObjP 17042 . 17230) ( NC.CopyButtonEventFn 17232 . 18695) (NC.MakeCardImageObject 18697 . 18873)) (18963 22923 ( NC.MakeNoteCard 18973 . 21712) (NC.EditNoteCard 21714 . 22921))))) STOP