DIRECTORY IndexNotify, IndexToolPrivate, OrderedSymbolTableRef, Rope, TEditDocument, TEditMouseImpl, TEditSelection, TextNode, TiogaOps, TiogaOpsDefs, TIPUser, ViewerClasses, ViewerOps; IndexNotifyImpl: CEDAR PROGRAM IMPORTS OrderedSymbolTableRef, Rope, TEditMouseImpl, TEditSelection, TiogaOps, ViewerOps EXPORTS IndexNotify, TiogaOpsDefs SHARES TEditMouseImpl = BEGIN OPEN IndexToolPrivate; ROPE: TYPE = Rope.ROPE; NodeBody: PUBLIC TYPE = TextNode.Body; IndexNotifier: PUBLIC ViewerClasses.NotifyProc = { indexHandle: IndexHandle _ NARROW[ViewerOps.FetchProp[self, $IndexHandle], IndexHandle]; indexSelection: TEditDocument.Selection _ TEditSelection.Create[]; mouse: TIPUser.TIPScreenCoords; FOR list: LIST OF REF ANY _ input, list.rest UNTIL list = NIL DO WITH list.first SELECT FROM x: ATOM => SELECT x FROM $Feedback => TRUSTED { rightOfLine: BOOLEAN _ TEditMouseImpl.ResolveToChar[ indexSelection, indexHandle.indexViewer, NARROW[indexHandle.indexViewer.data, TEditDocument.TEditDocumentData], mouse.mouseX, mouse.mouseY]; ix: IndexEntry _ NEW[IndexEntryRec]; item: OrderedSymbolTableRef.Item; smallerItem, equalItem, largerItem: OrderedSymbolTableRef.Item; phrases: LIST OF ROPE _ NIL; node: TextNode.Ref _ indexSelection.start.pos.node; WHILE node # NIL AND node # indexHandle.rootIndexBranch DO nodeRope: ROPE _ TiogaOps.GetRope[node]; phrase: ROPE _ Rope.Substr[nodeRope, 0, Rope.Index[nodeRope, 0, ","]]; IF phrase = NIL OR phrase.Length = 0 THEN EXIT; phrases _ CONS[phrase, phrases]; node _ TiogaOps.Parent[node]; ENDLOOP; ix.phrases _ phrases; [smallerItem, equalItem, largerItem] _ OrderedSymbolTableRef.Lookup3[indexHandle.indexTable, ix]; item _ IF equalItem # NIL THEN equalItem ELSE IF largerItem # NIL THEN largerItem ELSE smallerItem; ix _ NARROW[item, IndexEntry]; TiogaOps.SetSelection[ viewer: indexHandle.indexViewer, start: [ix.branchLocationStart.node, ix.branchLocationStart.where], end: [ix.branchLocationEnd.node, ix.branchLocationEnd.where], level: word, caretBefore: TRUE, pendingDelete: TRUE, which: feedback]; }; $Hit => { TiogaOps.CancelSelection[feedback]; }; ENDCASE => NULL; z: TIPUser.TIPScreenCoords => { mouse _ z; mouse.mouseY _ self.ch - mouse.mouseY; }; ENDCASE => ERROR; ENDLOOP; }; END. nIndexNotifyImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Created by Rick Beach, July 12, 1983 5:47 pm Rick Beach, February 27, 1985 9:55:20 pm PST Call TEditMouseImpl.ResolveToChar to get Tioga location selection info returned in indexSelection.start.pos as TextNode.Location back up the tree from indexSelection.start.pos.node accumulating phrases lookup the phrases for next larger or equal use item as the ix item for feedback Make selection node reverse video Turn off reverse video Determine which IndexEntry corresponds to the hit and Process.Detach[FORK indexButtonProcs[which one]] Κ ˜codešœ™Kšœ Οmœ1™