DIRECTORY Graphics USING [Context], Rope USING [ROPE], TiogaNode USING [Location, RefBranchNode, Span], TiogaDocument, TiogaFormat USING [LineInfo], ViewerClasses USING [ModifyProc, Viewer]; TiogaSelection: CEDAR DEFINITIONS = BEGIN OPEN TiogaDocument, ViewerClasses; pSel, sSel, oldSel, nilSel, fSel: READONLY Selection; ------ Selection Allocating and Access ------ Create: PROC RETURNS [Selection]; -- to create a selection record Alloc: PROC RETURNS [Selection]; -- gets it from a small cache Free: PROC [Selection]; -- returns it to the cache. ok if fail to return. disaster if return twice Copy: PROC [source, dest: Selection]; -- the approved way to access selection records ------ Selection Locking ------ CallWithSelAndDocAndTddLocks: PROC [ viewer: Viewer, id: SelectionId _ primary, proc: PROC [tdd: TiogaDocumentData, tSel: Selection]]; UnlockDocAndPSel: PROC [root: TiogaNode.RefBranchNode]; LockSel: PROC [selection: SelectionId, who: Rope.ROPE]; UnlockSel: PROC [selection: SelectionId]; LockBothSelections: PROC [who: Rope.ROPE]; -- locks primary, then secondary UnlockBothSelections: PROC; ------ Selection Commands ------ KillSelection: PROC ; -- including resetting inputFocus MakePointSelection: PROC [selection: Selection, pos: TiogaNode.Location]; SelectEverything: PROC; -- expand to include everything GrowSelectionToBlanks: PROC; GrowSelectionToSomething: PROC [left, right: PROC [CHAR] RETURNS [BOOLEAN]]; GrowSelection: PROC; PendingDeleteSelection: PROC; NotPendingDeleteSelection: PROC; CaretBeforeSelection: PROC; CaretAfterSelection: PROC; ------ Selection Display and Control ------ PushOrExchangeSelections, MakePrimary, MakeSecondary, CancelPrimary, CancelSecondary, CancelFeedback: PROC ; MakeSelection: PROC [new: Selection _ NIL, selection: SelectionId _ primary, startValid, endValid: BOOLEAN _ FALSE, forkPaint: BOOL _ TRUE] ; Deselect: PROC [selection: SelectionId _ primary]; InputModify: ModifyProc ; CaretVisible: PROC RETURNS [BOOL]; IsDown: PROC [id: SelectionId] RETURNS [BOOL]; ForceDown: PROC [id: SelectionId]; ShowSelection: PROC [id: SelectionId, self: Viewer, context: Graphics.Context]; TakeDownForRedisplay: PROC [id: SelectionId, self: Viewer, context: Graphics.Context]; FixUpAfterDisplay: PROC [id: SelectionId, self: Viewer, context: Graphics.Context, caret: BOOL]; AdjustSelStates: PROC [self: Viewer]; TakeSelectionDown: PROC [id: SelectionId, self: Viewer, context: Graphics.Context]; PutSelectionUp: PROC [id: SelectionId, self: Viewer, context: Graphics.Context]; FakeSecondary: PROC [sel: Selection]; -- change sSel without showing it MarkSelection: PROC [dc: Graphics.Context, viewer: Viewer, selection: Selection, id: SelectionId] ; ExtendSelection: PROC [dc: Graphics.Context, viewer: Viewer, old, new: Selection, id: SelectionId, updateEnd: BOOLEAN] ; CannotFindIt: ERROR; ComputeSpanLines: PUBLIC PROC [viewer: Viewer, span: TiogaNode.Span] RETURNS [start, end: INTEGER, startClipped, endClipped: BOOLEAN] ; ComputePosLine: PROC [ viewer: Viewer, pos: TiogaNode.Location, firstLine: INTEGER _ 0] RETURNS [line: INTEGER, clipped: BOOLEAN]; ComputePosPoint: PROC [ viewer: Viewer, pos: TiogaNode.Location, firstLine: INTEGER _ 0, lineOnly: BOOLEAN _ FALSE] RETURNS [sp: SelectionPoint]; FixupSelection: PROC [selection: Selection, viewer: Viewer, start, end: BOOLEAN _ TRUE] ; FixupCaret: PROC [selection: Selection] ; ------ Misc functions ------ SelectionRoot: PROC [s: Selection _ pSel] RETURNS [root: TiogaNode.RefBranchNode]; InsertionPoint: PROC [s: Selection _ pSel] RETURNS [ip: TiogaNode.Location]; GetSelectionGrain: PROC [sel: Selection] RETURNS [SelectionGrain]; InvalidateLineCache: PROC ; GetCachedLineInfo: PROC [viewer: Viewer, tdd: TiogaDocumentData, line: INTEGER] RETURNS [TiogaFormat.LineInfo, INTEGER] ; Position: PROC [viewer: Viewer] ; FindWhere: TYPE = { forwards, backwards, anywhere }; Find: PROC [ viewer: Viewer, findWhere: FindWhere _ anywhere, def, word: BOOLEAN _ FALSE, id: SelectionId _ primary, case: BOOL _ TRUE -- case => case of characters is significant -- ]; FindRope: PROC [viewer: Viewer, rope: Rope.ROPE, findWhere: FindWhere _ anywhere, def, word: BOOLEAN _ FALSE, id: SelectionId _ primary, case: BOOL _ TRUE -- case => case of characters is significant -- ]; DoFind: PROC [viewer: Viewer, rope: Rope.ROPE, findWhere: FindWhere _ anywhere, def, word: BOOLEAN _ FALSE, id: SelectionId _ primary, case: BOOL _ TRUE -- case => case of characters is significant -- ] RETURNS [found: BOOL]; ------ Screen to viewbox transforms ------ SelectProc: TYPE = PROC [viewer: Viewer, tdd: TiogaDocumentData, x,y: INTEGER, sel: SelectionId, pDel: BOOLEAN] ; SelectPoint, SelectChar, SelectWord, SelectNode, SelectBranch, Update: SelectProc; LevelChange: TYPE = {reduce, expand, same}; Extend: PROC [ viewer: Viewer, tdd: TiogaDocumentData, x,y: INTEGER, sel: SelectionId, pDel: BOOLEAN, changeLevel: LevelChange, saveEnds: BOOLEAN]; SetSelLooks: PROC [sel: Selection]; END. -- TiogaSelection.mesa, Edited by Paxton on June 17, 1983 1:34 pm -- pSel and sSel are the global primary and secondary selections -- fSel is the global feedback selection -- oldSel is old secondary selection saved for Repeat's -- nilSel is for deselecting No one should do pSel^ _ tSel^ or vice versa ... call Copy instead. It's monitored. lock the selection so that no other process can change it give up lock on the selection grows until procs return true. 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 ʾ˜JšÏcA™AJ˜šÏk ˜ Jšœ žœ ˜Jšœžœžœ˜Jšœ žœ!˜0J˜Jšœ žœ ˜Jšœžœ˜)J˜—Jšœžœžœžœ˜LJ˜šœ"žœ ˜5Jš@™@Jšœ!™(Jš7™7Jš™J˜—Jš-˜-˜JšÏnœžœžœ˜BJ˜JšŸœžœžœ˜?J˜JšŸœžœL˜dJ˜šŸœžœ/˜UJ™T——J˜š˜J˜šŸœžœ˜$Jšœ*˜*Jšœžœ,˜6J˜—JšŸœžœ!˜7J˜šŸœžœ$žœ˜7J™9—J˜šŸ œžœ˜)J™J™—JšŸœžœ žœ ˜KJ˜JšŸœžœ˜J˜—š ˜ J˜JšŸ œžœ!˜7J˜šŸœžœ1˜IJ˜—JšŸœžœ˜7J˜JšŸœžœ˜J˜š Ÿœžœžœžœžœžœ˜LJ™—J˜JšŸ œžœ˜J˜JšŸœžœ˜J˜JšŸœžœ˜ J˜JšŸœžœ˜J˜JšŸœžœ˜—J˜Jš+˜+˜šŸœŸ œŸ œ˜5JšŸ œŸœžœ˜6J˜—šŸ œžœžœ#˜LJš œžœžœ žœžœ˜@Jš³™³J˜—šŸœžœ$˜2Jšœ:™:J™—JšŸ œ˜J˜JšŸ œžœžœžœ˜"J˜Jš Ÿœžœžœžœž˜.J˜JšŸ œžœž˜"J˜JšŸ œžœ;ž˜OJ˜JšŸœžœ<˜VJ˜JšŸœžœCžœ˜`J˜JšŸœžœž˜%J˜JšŸœžœ;ž˜SJ˜JšŸœžœ;ž˜PJ˜JšŸ œžœ!˜GJ˜šŸ œžœP˜cJ˜—šŸœžœ'˜