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. ΖClassIncreek.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Last Edited by Stone, August 31, 1982 1:42 pm Last Edited by McGregor, 1-Sep-81 Last Edited by Swinehart, April 14, 1982 10:06 am Doug Wyatt, February 28, 1985 7:08:29 pm PST Private to implementation; location in inscript file Client-public information; absolute state at that point allUp is generated when full keyboard state is entered; action readers should interpret allUp[] as a request to clear the current state in preparation for starting over. Will not affect mouse grain settings, even if it should. GetAction can raise IncreekError[outOfBounds], meaning that prior to or during invocation of the operation, information has been lost from the inscript. A Set... operation that originally succeeds can later result in this ERROR, due to the effects of additional keyboard input. inserts an action into the creek. Useful for simulation, error recovery, etc. Defaulting arguments selects default settings. The mouse grain is a hint to the recording entity (e.g., Interminal) that the application using self does not need mouse actions sampled more frequently than every ticks ms., or when motion is less than dots screen points. The mouse position will however always be accurate following a keyboard or mouse button action. This is because Level 1 interfaces can benefit from the state fields of a position. They don't have to know that a position is the OpaqueIncreekData. Κ”˜codešœ™Kšœ Οmœ1™šœžœ˜Kšœ  -˜9K˜K˜—K˜—Kšžœ˜—…— r