DIRECTORY Imager USING [Context], Rope USING [ROPE], TextNode USING [Location, Ref, Span], TEditDocument USING [Selection, SelectionGrain, SelectionId, SelectionPoint, TEditDocumentData], ViewerClasses USING [ModifyProc, Viewer]; TEditSelection: CEDAR DEFINITIONS = BEGIN OPEN TEditDocument; ROPE: TYPE ~ Rope.ROPE; Viewer: TYPE ~ ViewerClasses.Viewer; pSel: READONLY Selection; sSel: READONLY Selection; fSel: READONLY Selection; oldSel: READONLY Selection; nilSel: READONLY Selection; Create: PROC RETURNS [Selection]; Alloc: PROC RETURNS [Selection]; Free: PROC [Selection]; Copy: PROC [source, dest: Selection]; PushOrExchangeSelections: PROC; MakePrimary: PROC; MakeSecondary: PROC; CancelPrimary: PROC; CancelSecondary: PROC; CancelFeedback: PROC; CallWithSelAndDocAndTddLocks: PROC [viewer: Viewer, id: SelectionId _ primary, proc: PROC [tdd: TEditDocumentData, tSel: Selection]]; UnlockDocAndPSel: PROC [root: TextNode.Ref]; LockSel: PROC [selection: SelectionId, who: ROPE]; UnlockSel: PROC [selection: SelectionId]; LockBothSelections: PROC [who: ROPE]; -- locks primary, then secondary UnlockBothSelections: PROC; MakeSelection: PROC [new: Selection _ NIL, selection: SelectionId _ primary, startValid, endValid: BOOL _ FALSE, forkPaint: BOOL _ TRUE]; CaretVisible: PROC RETURNS [BOOL]; IsDown: PROC [id: SelectionId] RETURNS [BOOL]; ForceDown: PROC [id: SelectionId]; ShowSelection: PROC [id: SelectionId, self: Viewer, context: Imager.Context]; TakeDownForRedisplay: PROC [id: SelectionId, self: Viewer, context: Imager.Context]; FixUpAfterDisplay: PROC [id: SelectionId, self: Viewer, context: Imager.Context, caret: BOOL]; AdjustSelStates: PROC [self: Viewer]; TakeSelectionDown: PROC [id: SelectionId, self: Viewer, context: Imager.Context]; PutSelectionUp: PROC [id: SelectionId, self: Viewer, context: Imager.Context]; FakeSecondary: PROC [sel: Selection]; -- change sSel without showing it Deselect: PROC [selection: SelectionId _ primary]; MarkSelection: PROC [dc: Imager.Context, viewer: Viewer, selection: Selection, id: SelectionId]; ExtendSelection: PROC [dc: Imager.Context, viewer: Viewer, old, new: Selection, id: SelectionId, updateEnd: BOOL]; CannotFindIt: ERROR; ComputeSpanLines: PROC [viewer: Viewer, span: TextNode.Span] RETURNS [start, end: INTEGER, startClipped, endClipped: BOOL]; ComputePosLine: PROC [ viewer: Viewer, pos: TextNode.Location, firstLine: INTEGER _ 0] RETURNS [line: INTEGER, clipped: BOOL]; ComputePosPoint: PROC [ viewer: Viewer, pos: TextNode.Location, firstLine: INTEGER _ 0, lineOnly: BOOL _ FALSE] RETURNS [sp: SelectionPoint]; FixupSelection: PROC [selection: Selection, viewer: Viewer, start, end: BOOL _ TRUE]; FixupCaret: PROC [selection: Selection]; KillSelection: PROC; -- including resetting inputFocus MakePointSelection: PROC [selection: Selection, pos: TextNode.Location]; InputModify: ViewerClasses.ModifyProc; SelectEverything: PROC; -- expand to include everything GrowSelectionToBlanks: PROC; GrowSelectionToSomething: PROC [left, right: PROC [CHAR] RETURNS [BOOL]]; GrowSelection: PROC; PendingDeleteSelection: PROC; NotPendingDeleteSelection: PROC; CaretBeforeSelection: PROC; CaretAfterSelection: PROC; SelectProc: TYPE = PROC [viewer: Viewer, tdd: TEditDocumentData, x, y: INTEGER, sel: SelectionId, pDel: BOOL]; SelectPoint: SelectProc; SelectChar: SelectProc; SelectWord: SelectProc; SelectNode: SelectProc; SelectBranch: SelectProc; Update: SelectProc; LevelChange: TYPE = {reduce, expand, same}; Extend: PROC [viewer: Viewer, tdd: TEditDocumentData, x, y: INTEGER, sel: SelectionId, pDel: BOOL, changeLevel: LevelChange, saveEnds: BOOL]; SelectionRoot: PROC [s: Selection _ pSel] RETURNS [root: TextNode.Ref]; InsertionPoint: PROC [s: Selection _ pSel] RETURNS [ip: TextNode.Location]; GetSelectionGrain: PROC [sel: Selection] RETURNS [SelectionGrain]; Position: PROC [viewer: Viewer]; FindWhere: TYPE = { forwards, backwards, anywhere }; Find: PROC [ viewer: Viewer, findWhere: FindWhere _ anywhere, def, word: BOOL _ FALSE, id: SelectionId _ primary, case: BOOL _ TRUE -- case => case of characters is significant -- ]; FindRope: PROC [viewer: Viewer, rope: ROPE, findWhere: FindWhere _ anywhere, def, word: BOOL _ FALSE, id: SelectionId _ primary, case: BOOL _ TRUE -- case => case of characters is significant -- ]; DoFind: PROC [viewer: Viewer, rope: ROPE, findWhere: FindWhere _ anywhere, def, word: BOOL _ FALSE, id: SelectionId _ primary, case: BOOL _ TRUE -- case => case of characters is significant -- ] RETURNS [found: BOOL]; SetSelLooks: PROC [sel: Selection]; ShowPosition: PROC[viewer: Viewer, skipCommentNodes: BOOL _ TRUE]; END. †TEditSelection.mesa Copyright Σ 1985, 1986 by Xerox Corporation. All rights reserved. Edited by Paxton on December 29, 1982 10:31 am Doug Wyatt, April 2, 1985 2:52:40 pm PST Selection Access and Allocating pSel and sSel are the global primary and secondary selections fSel is the global feedback selection oldSel is old secondary selection saved for Repeats nilSel is for deselecting to create a selection record gets it from a small cache returns it to the cache. ok if fail to return. disaster if return twice the approved way to access selection records No one should do pSel^ _ tSel^ or vice versa ... call Copy instead. It's monitored. Selection Display and Control lock the selection so that no other process can change it give up lock on the selection start and end valid are if metrics were precomputed and can be trusted by the selection display code. forkPaint is false for selection display code; true for edit ops and others. Take down the selection without giving up the input focus. can be raised by ComputeSpanLines, ComputePosLine, or ComputePosPoint grows until procs return true. Making and Extending selections Misc functions Κ˜codešœ™KšœB™BKšœ.™.K™(—K˜šΟk ˜ Kšœœ ˜Kšœœœ˜Kšœ œ˜%KšœœM˜`Kšœœ˜)—K˜KšΠblœœ ˜!šœœœ˜K˜Kšœœœ˜Kšœœ˜$—headšœ™Kšœœ ˜Kšœœ ˜Kšœœ ˜Kšœœ ˜šœœ ˜Kšœ=™=Kšœ%™%Kšœ3™3Kšœ™K˜—šΟnœœœ ˜!Kšœ™—K˜šŸœœœ ˜ Kšœ™—K˜šŸœœ ˜KšœI™I—K˜šŸœœ˜%Kšœ,™,K™TK˜——šœ™KšŸœœ˜KšŸ œœ˜KšŸ œœ˜KšŸ œœ˜KšŸœœ˜šŸœœ˜K˜—šŸœœ4œ,˜†K˜—KšŸœœ˜,K˜šŸœœœ˜2K™9—K˜šŸ œœ˜)K™K™—KšŸœœœΟc ˜FK˜KšŸœœ˜K˜šŸ œœœ#˜LKš œœœ œœ˜K˜—šŸœœ˜Kšœ3œ˜?Kšœœ œ˜'K˜—šŸœœ˜K˜'Kšœ œœœ˜/Kšœ˜K˜—KšŸœœ4œœ˜UK˜KšŸ œœ˜(K˜KšŸ œœ !˜6K˜šŸœœ0˜HK˜—KšŸ œ˜&K˜KšŸœœ ˜7K˜KšŸœœ˜K˜š Ÿœœœœœœ˜IK™—K˜KšŸ œœ˜K˜KšŸœœ˜K˜KšŸœœ˜ K˜KšŸœœ˜K˜KšŸœœ˜K˜—™š œ œœ1œœ˜oK˜—K˜KšŸ œ ˜KšŸ œ ˜KšŸ œ ˜KšŸ œ ˜KšŸ œ ˜KšŸœ ˜K˜šœ œ˜+K˜—š Ÿœœ1œœ'œ˜K˜——šœ™KšŸ œœœ˜GK˜KšŸœœœ˜KK˜KšŸœœœ˜BK˜KšŸœœ˜ K˜Kšœ œ%˜4K˜šŸœœ˜ Kšœ0˜0Kšœ œœ˜K˜Kšœœœ /œ˜DK˜—šŸœœœ˜+Kšœ ˜ Kšœ œœ˜K˜Kšœœœ /œ˜DK˜—šŸœœœ˜)Kšœ ˜ Kšœ œœ˜K˜Kšœœœ /œ˜CKšœ œ˜K˜—šŸ œœ˜#K˜—šŸ œœ#œœ˜BK˜——K˜Kšœ˜—…—Tά