TEditRefreshImpl.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) July 2, 1985 10:46:00 am PDT
Michael Plass, March 29, 1985 5:49:45 pm PST
Doug Wyatt, September 2, 1986 5:10:26 pm PDT
DIRECTORY
CedarProcess USING [SetPriority],
TEditRefresh,
MonitoredQueue USING [Create, MQ, Remove],
Process USING [Detach],
TEditDocument USING [GetViewerForRoot, SelectionId, TEditDocumentData],
TextNode USING [Node],
TEditTouchup USING [refresh],
ViewerClasses USING [Viewer],
ViewerForkers USING [ForkPaint];
TEditRefreshImpl: CEDAR MONITOR
IMPORTS CedarProcess, MonitoredQueue, Process, TEditDocument, TEditTouchup, ViewerForkers
EXPORTS TEditRefresh
= BEGIN
dirtyDocs: PUBLIC MonitoredQueue.MQ ← MonitoredQueue.Create[];
Refresh: PROC = {
CedarProcess.SetPriority[normal];
DO
WITH MonitoredQueue.Remove[dirtyDocs] SELECT FROM
doc: TextNode.Node => {
viewer: ViewerClasses.Viewer ← TEditDocument.GetViewerForRoot[doc];
IF viewer # NIL THEN
WITH viewer.data SELECT FROM
tdd: TEditDocument.TEditDocumentData =>
FOR v: ViewerClasses.Viewer ← viewer, v.link WHILE v # NIL DO
IF NOT v.iconic AND NOT v.destroyed THEN
ViewerForkers.ForkPaint[v, client, FALSE, TEditTouchup.refresh, TRUE];
IF v.link = viewer THEN EXIT;
ENDLOOP;
ENDCASE;
};
ENDCASE;
ENDLOOP;
};
ScrollToEndOfDoc: PUBLIC PROC [viewer: ViewerClasses.Viewer, glitch: BOOL] = {
WITH viewer.data SELECT FROM
tdd: TEditDocument.TEditDocumentData => {
tdd.scroll ← endofdoc;
tdd.scrollGlitch ← glitch;
};
ENDCASE;
};
ScrollToEndOfSel: PUBLIC PROC [viewer: ViewerClasses.Viewer, glitch: BOOL, id: TEditDocument.SelectionId ← primary] = {
WITH viewer.data SELECT FROM
tdd: TEditDocument.TEditDocumentData => {
tdd.scroll ← endofsel;
tdd.scrollGlitch ← glitch;
tdd.scrollSelectionId ← id;
};
ENDCASE;
};
TRUSTED {Process.Detach[FORK Refresh[]]};
END.