<> <> <> <> <> <> DIRECTORY ClassInscript USING [Inscript, InscriptPageDescriptor, InscriptPageDescBody, WaitMode], Intime USING [DeltaTime, DeltaDeltaTime, EventTime, MsTicks], Interminal USING [KeyName, KeyState, MousePosition, PenPosition]; ClassIncreek: DEFINITIONS = BEGIN OPEN ClassInscript, T:Intime, K:Interminal; Increek: TYPE = REF IncreekObject; IncreekObject: PRIVATE TYPE = InscriptPositionBody; -- NOT fully opaque! ViewPosition: TYPE = REF -- READONLY doesn't work! -- InscriptPositionBody; InscriptPosition: TYPE = REF InscriptPositionBody; InscriptPositionBody: TYPE = RECORD [ <> inscript: PRIVATE ClassInscript.Inscript, -- for releasing inscriptPage: PRIVATE ClassInscript.InscriptPageDescriptor, ip1: PRIVATE REF ClassInscript.InscriptPageDescBody, iP: PRIVATE ClassInscript.InscriptPageDescriptor, -- specific to current impl. -- ip2: PRIVATE REF ClassInscript.InscriptPageDescBody, eT: PRIVATE T.EventTime _ NULL, -- client shouldn't use <> eventTime: T.EventTime _ NULL, mousePosition: K.MousePosition _ NULL, keyState: K.KeyState _ [bits[ALL[up]]], chordState: K.KeyState _ [bits[ALL[up]]], downCount: INTEGER _ 0, mouseGrainTime: T.MsTicks _ NULL, mouseGrainDots: INTEGER _ NULL ]; PosResult: TYPE = {tooEarly, tooLate, onTime}; WaitMode: TYPE = ClassInscript.WaitMode; -- {forever, dontWait, timed}; ActionKind: TYPE = MACHINE DEPENDENT { deltaEventTime, eventTime, deltaMouse, mousePosition, penPosition, keyDown, keyUp, keyStillDown, allUp, timedOut -- never stored -- }; <> <> <<>> Acceptance: TYPE = {clicks, clicksAndMotion, all}; DeltaMouse: TYPE = RECORD [deltaX: [-8..8), deltaY: [-8..8)]; Action: TYPE = LONG POINTER TO ActionBody; ActionBody: TYPE = RECORD [ deltaDeltaTime: T.DeltaDeltaTime _ 0, contents: SELECT kind: ActionKind FROM deltaEventTime => [value: T.DeltaTime _ NULL], keyDown, keyStillDown, keyUp => [value: K.KeyName _ NULL], allUp => [], eventTime => [eventTime: T.EventTime _ NULL], deltaMouse => [value: DeltaMouse _ NULL], mousePosition => [mousePosition: K.MousePosition _ NULL], penPosition => [penPosition: K.PenPosition _ NULL], timedOut => [], ENDCASE ]; NewStdIncreek: PROC [template: Increek _ NIL] RETURNS [Increek]; Release: PROC [self: Increek] RETURNS [nilIncreek: Increek]; CopyIncreek: PROC [self: Increek, template: Increek]; <> GetAction: PROC [self: Increek, waitMode: WaitMode _ forever, waitInterval: T.MsTicks _ 100, acceptance: Acceptance _ clicks ] RETURNS [a: ActionBody]; <> InsertAction: PROC[self: Increek, action: ActionBody]; <> <<>> <<>> SetAtEarliest: PROC [self: Increek]; SetAtLatest: PROC [self: Increek]; SetAtTime: PROC [self: Increek, eventTime: T.EventTime] RETURNS [pR: PosResult]; SetMouseGrain: PROC [self: Increek, ticks: T.MsTicks _ 0, dots: INTEGER _ 0]; <> <> <<>> GetTime: PROC [self: Increek] RETURNS [eT: T.EventTime]; GetCurrentTime: PROC [self: Increek] RETURNS [eT: T.EventTime]; GetPositionFrom: PROC [self: Increek] RETURNS [p: ViewPosition] = INLINE {RETURN[self]}; <> <> IncreekError: -- abstraction -- ERROR[code: IncreekErrorCode]; IncreekErrorCode: TYPE = { outOfBounds -- position no longer valid during ReadAction }; END.