<> <> <> <> DIRECTORY CD USING [Design, Technology, Number, Layer], CDSequencer USING [CommandProc, QueueMethod], Rope USING [ROPE], ViewerClasses USING [Viewer]; CDPanel: CEDAR DEFINITIONS = BEGIN <> <> 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.ROPE _ NIL, cdValueKey: REF _ NIL, redisplay: BOOL _ FALSE, width: INT _ -1, space: INT _ -1, xpos: INT _ -1, maxx: INT _ -1, border: BOOL _ FALSE ]; <<--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: INT _ FIRST[INT], max: INT _ LAST[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: ATOM _ NIL, data: REF _ NIL, queue: CDSequencer.QueueMethod _ useDefault, topLine: BOOL _ FALSE, 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.