CDMarkImpl.mesa (part of ChipNDale)
Copyright © 1983, 1984 by Xerox Corporation. All rights reserved.
by Christian Jacobi November 17, 1983 1:45 pm
last edited by Christian Jacobi December 7, 1983 10:14 am
DIRECTORY
CD,
CDViewer,
CDMark,
CDValue,
CDSequencer;
CDMarkImpl:
CEDAR
MONITOR
IMPORTS CDValue, CDViewer, CDSequencer
EXPORTS CDMark =
BEGIN
GetMark:
PUBLIC PROC [design:
CD.Design]
RETURNS [pos:
CD.Position← [0, 0]] =
--returns always some position, even if there is no mark
BEGIN
x: REF = CDValue.Fetch[boundTo: design, key: $Mark, propagation: design];
IF x#NIL THEN pos ← NARROW[x, REF CD.Position]^
END;
SetMark:
PUBLIC PROC [design:
CD.Design, pos:
CD.Position] =
BEGIN
p: REF CD.Position ← NEW[CD.Position←pos];
CDValue.Store[boundTo: design, key: $Mark, value: p];
CDViewer.ShowArrow[design, pos]
END;
SetMarkComm:
PROC [comm: CDSequencer.Command] =
BEGIN
SetMark[comm.design, comm.pos]
END;
RemoveMarkComm:
PROC [comm: CDSequencer.Command] =
BEGIN
CDViewer.RemoveArrow[comm.design]
END;
CDValue.EnregisterKey[$Mark];
CDSequencer.ImplementCommand[$ShowMark, SetMarkComm];
CDSequencer.ImplementCommand[$RemoveMark, RemoveMarkComm];
END.
--This Module is temporary; if Marks will work properly and integrated,
--Mark will be exported elsewhere