CDPanel.mesa (part of ChipNDale)
Copyright © 1983, 1986 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, August 8, 1983 5:20 pm
Last edited by: Christian Jacobi, September 16, 1986 5:55:08 pm PDT
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)
CreatePanel:
PROC [design:
CD.Design]
RETURNS [ViewerClasses.Viewer];
--only one panel-viewer per design is created
--if panel-viewer already exists, simply return it
DefineNewLine:
PROC [tech:
CD.Technology←
NIL];
--the next features will be defined on a new line
DefineLayerEntry:
PROC [tech:
CD.Technology←
NIL, layer:
CD.Layer, text: Rope.
ROPE, min, default:
CD.Number ← 1];
--introduces a layer entry
--only layers of technology tech may be used
--use CDLayers to querry or update values; display is updated automatically
DefineIntEntry:
PROC [tech:
CD.Technology ←
NIL, cdValueKey:
REF, text: Rope.
ROPE ←
NIL, min:
INT ←
FIRST[
INT], max:
INT ←
LAST[
INT], default:
INT ← 0, lambda:
INT ← 1, redisplay:
BOOL ←
TRUE];
--cdValueKey must have been correctly registered with CDValue! CDPanel does NOT itself.
--(allows hooking entries onto already used keys)
--Restriction: displayed value does not follow changes of CDValue.StoreInt
--lambda=0: use lambda of technology
DefineButton:
PROC [tech:
CD.Technology ←
NIL, name: Rope.
ROPE ← NIL, proc: CDSequencer.CommandProc ←
NIL, command:
ATOM ←
NIL, queue: CDSequencer.QueueMethod ← useDefault, topLine:
BOOL ←
FALSE, border:
BOOL ←
FALSE, data:
REF ←
NIL, cdValueKey:
REF ←
NIL, redisplay:
BOOL ←
TRUE];
--button is always forked
--data is hanged on comm.data
--cdValueKey # NIL: overwrites name field by using CDValue
DefineLabel:
PROC [tech:
CD.Technology ←
NIL, name: Rope.
ROPE, border:
BOOL ←
FALSE, cdValueKey:
REF ←
NIL, redisplay:
BOOL ←
TRUE];
--if cdValueKey # NIL: overwrites name field by using CDValue
DefineRopeEntry:
PROC [tech:
CD.Technology ←
NIL, cdValueKey:
REF, button: Rope.
ROPE ←
NIL, width:
INT ← -1, editable:
BOOL ←
TRUE, redisplay:
BOOL ←
FALSE];
--cdValueKey must have been correctly registered with CDValue
-- value on design typical a ROPE; technology may have LIST OF ROPE
--width: of field for text; in viewer units; -1 means: use total width of panel
--Usually it is bad to set redisplay to true: user edited text may get lost
FromDisplayRope:
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
ToDisplayRope:
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
FromDisplay:
PROC [design:
CD.Design, cdValueKey:
REF]
RETURNS [
REF];
--Takes any displayed entry, stores it using CDValue.Store and also returns it
ToDisplay:
PROC [design:
CD.Design, cdValueKey:
REF]
RETURNS [
REF];
--Takes any value using CDValue.Fetch, displays and returns it
Redisplay:
PROC [design:
CD.Design];
--fetches with CDValue and update display for all entries which have a redisplay flag
END.