TEditTouchupImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Paxton on May 23, 1983 11:27 am
Maxwell, January 6, 1983 11:38 am
Russ Atkinson (RRA) June 4, 1985 1:20:12 am PDT
DIRECTORY
TEditTouchup,
Process USING [Ticks, MsecToTicks, SetTimeout],
Rope USING [ROPE],
TEditDocument USING [SpinAndLock, TEditDocumentData, Unlock];
TEditTouchupImpl:
CEDAR MONITOR
IMPORTS TEditDocument, Process
EXPORTS TEditTouchup = BEGIN
fullUpdate: PUBLIC REF ANY ← $Update;
refresh: PUBLIC REF ANY ← $Refresh;
RefreshOver:
PUBLIC
ENTRY
PROC = {
ENABLE
UNWIND =>
NULL;
BROADCAST refreshOver };
LockAfterScroll:
PUBLIC
PROC [tdd: TEditDocument.TEditDocumentData, who: Rope.
ROPE]
RETURNS [ok:
BOOL] = {
RETURN [LockAfter[tdd, who, TRUE]];
};
LockAfterRefresh:
PUBLIC
PROC [tdd: TEditDocument.TEditDocumentData, who: Rope.
ROPE]
RETURNS [ok:
BOOL] = {
RETURN [LockAfter[tdd, who, FALSE]];
};
LockAfter:
PROC [tdd: TEditDocument.TEditDocumentData, who: Rope.
ROPE, scroll:
BOOL]
RETURNS [ok:
BOOL ←
TRUE] = {
[] ← TEditDocument.SpinAndLock[tdd, "LockAfterRefresh"];
SELECT
TRUE
FROM
NOT tdd.dirty => ok ← TRUE;
alwaysOK => ok ← TRUE;
NOT scroll OR tdd.scroll=no => ok ← FALSE;
ENDCASE => ok ← TRUE;
IF NOT ok THEN TEditDocument.Unlock[tdd];
};
alwaysOK: BOOL ← FALSE;
UnlockAfterRefresh:
PUBLIC PROC [tdd: TEditDocument.TEditDocumentData] = {
IF tdd#NIL THEN TEditDocument.Unlock[tdd];
};
refreshOver: CONDITION;
aLittleWhile: Process.Ticks = Process.MsecToTicks[50];
maxCount: NAT ← 0;
TRUSTED {
Process.SetTimeout[@refreshOver, aLittleWhile];
};
END.