CDPanel.mesa (part of ChipNDale)
Copyright © 1983, 1987 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, August 8, 1983 5:20 pm
Last edited by: Christian Jacobi, March 19, 1987 12:03:36 pm PST
DIRECTORY
CD USING [Design, Technology, Number, Layer],
CDSequencer USING [CommandProc, QueueMethod],
Rope USING [ROPE],
ViewerClasses USING [Viewer];
CDPanel: CEDAR DEFINITIONS =
BEGIN
Control panels for the display and modification of values by the interactive user.
Don't use define procedures from forked process! (order gets fooled).
Create: PROC [design: CD.Design] RETURNS [ViewerClasses.Viewer];
--Creates a control panel panel.
--Only one panel-viewer per design is created;
--If panel-viewer already exists, simply returns it.
Line: PROC [tech: CD.Technology ← NIL];
--Use a new line for the next feature.
Layer: PROC [layer: CD.Layer, text: Rope.ROPE, min, default: CD.Number ← 1, option: NAT ← 0, tech: CD.Technology ← NIL];
--Defines a layer entry in control panel.
--Only layers of technology tech may be used.
--Use CDLayers to querry or update values; display is updated automatically.
Info: TYPE = RECORD [
text: Rope.ROPENIL,
cdValueKey: REFNIL, redisplay: BOOLFALSE,
width: INT ← -1, space: INT ← -1,
xpos: INT ← -1, maxx: INT ← -1,
border: BOOLFALSE
];
--cdValueKey must have been correctly registered with CDValue! CDPanel does NOT itself.
--(allows hooking entries onto already used keys).
Number: PROC [button: Info, number: Info, min: INTFIRST[INT], max: INTLAST[INT], default: INT ← 0, lambda: INT ← 1, tech: CD.Technology ← NIL];
--Defines a number entry in control panel.
--Displayed value does not follow changes of CDValue.StoreInt; but redisplay works.
--lambda=0: use lambda of technology.
--Restriction: button.cdValueKey, number.text must be NIL.
Button: PROC [button: Info, proc: CDSequencer.CommandProc ← NIL, command: ATOMNIL, data: REFNIL, queue: CDSequencer.QueueMethod ← useDefault, topLine: BOOLFALSE, tech: CD.Technology ← NIL];
--Defines a button in control panel.
--The button is always forked.
--data is hanged on comm.data.
Label: PROC [label: Info, tech: CD.Technology ← NIL];
--Defines a label in control panel.
Text: PROC [button: Info, text: Info, editable: BOOL TRUE, tech: CD.Technology ← NIL];
--Defines a rope entry in control panel.
--cdValue on design typical a ROPE; technology may have LIST OF ROPE.
--Usually it is bad to set rope.redisplay to true: user edited text may get lost.
--Restriction: button.cdValueKey must be NIL.
TakeDownText: PROC [design: CD.Design, cdValueKey: REF] RETURNS [rope: Rope.ROPE];
--Shortcut for text entries.
--Takes the displayed rope, stores it using CDValue.Store, and also returns it.
PutUpText: PROC [design: CD.Design, cdValueKey: REF, rope: Rope.ROPE];
--Shortcut for text entries.
--Takes the given rope, stores it using CDValue.Store and updates the display on the panel.
TakeDown: PROC [design: CD.Design, cdValueKey: REF] RETURNS [REF];
--Takes any displayed entry, stores it using CDValue.Store, and, also returns it.
PutUp: PROC [design: CD.Design, cdValueKey: REF] RETURNS [REF];
--Fetches value using CDValue.Fetch, returns it, and,
--puts it into the display if redisplay flag is true.
PutUpAll: PROC [design: CD.Design];
--Fetches with CDValue and update display for all entries for which redisplay is true.
END.