DIRECTORY Imager, ImagerFont, IO, List, Menus, Rope, TIPUser, ViewerClasses; Controls: CEDAR DEFINITIONS ~ BEGIN ClickProc: TYPE ~ Menus.ClickProc; -- proc called if entry button is pressed Viewer: TYPE ~ ViewerClasses.Viewer; -- buttons, controls, typescripts, graphics Context: TYPE ~ Imager.Context; Detents: TYPE ~ RECORD [t, val: REAL]; -- special positions within a control Entry: TYPE ~ RECORD [ -- specifications for a menu button name: Rope.ROPE, proc: ClickProc, row: INTEGER _ 0, x, y, w, h: INTEGER _ 0, font: Imager.Font _ NIL, fork: BOOL _ TRUE, documentation: REF ANY _ NIL, paint: BOOL _ TRUE, guarded: BOOL _ FALSE, style: ATOM _ $BlackOnWhite, viewer: Viewer _ NIL ]; MouseButton: TYPE ~ {none, left, middle, right}; -- which mouse button was operated MouseState: TYPE ~ {none, down, held, up}; -- state of mouse button operated Mouse: TYPE ~ RECORD [ -- complete mouse information x, y: INTEGER, state: MouseState, button: MouseButton ]; ControlProc: TYPE ~ PROC [control: ControlData]; -- proc called if control adjusted ControlType: TYPE ~ {horiz, vert, circ}; -- horiz. or vertical sliders, circular dial ControlTaper: TYPE ~ {log, lin, exp}; -- logarithmic, linear, or exponential ControlSizes: TYPE ~ RECORD [ horizWid: INTEGER, vertWid: INTEGER, circDia: INTEGER ]; ControlData: TYPE ~ REF ControlDataRec; -- complete control information ControlDataRec: TYPE ~ RECORD [ name: Rope.ROPE _ NIL, type: ControlType _ horiz, taper: ControlTaper _ lin, min, max, init: REAL _ 0.0, truncate: BOOL _ FALSE, report: BOOL _ TRUE, detents: LIST OF Detents _ NIL, proc: ControlProc _ NIL, data: REF ANY _ NIL, row: INTEGER _ 0, x, y, w, h: INTEGER _ 0, cx, cy, rad: REAL _ 0.0, t, val, preval: REAL _ 0.0, predetented: BOOL _ FALSE, detented: BOOL _ FALSE, mouse: Mouse _ [0, 0, none, none], dummy: BOOL _ FALSE, -- if true, don't paint this control outerData: OuterData _ NIL, viewer: Viewer _ NIL, title, status: Viewer _ NIL, graphics, parent: Viewer _ NIL ]; ControlList: TYPE ~ LIST OF ControlData; DestroyProc: TYPE ~ PROC [outer: OuterData]; -- call when outer viewer destroyed GraphicsProc: TYPE ~ PROC [graphics: GraphicsData]; -- call if graphics viewer mouse act GraphicsShow: TYPE ~ PROC [ context: Context, w, h: INTEGER, data: REF ANY _ NIL, whatChanged: REF ANY _ NIL ]; GraphicsData: TYPE ~ REF GraphicsDataRec; -- complete graphics viewer specs GraphicsDataRec: TYPE ~ RECORD [ proc: GraphicsProc _ NIL, show: GraphicsShow _ NIL, mouse: Mouse _ [0, 0, none, none], data: REF ANY _ NIL, viewer, parent: Viewer _ NIL ]; OuterData: TYPE ~ REF OuterDataRec; -- complete outer data OuterDataRec: TYPE ~ RECORD [ parent: Viewer _ NIL, graphics: Viewer _ NIL, typeScript: Viewer _ NIL, graphicsData: GraphicsData _ NIL, destroyProc: DestroyProc _ NIL, controls: ControlList _ NIL, entries: LIST OF Entry _ NIL, controlY: INTEGER _ 0, controlH: INTEGER _ 0, graphicsY: INTEGER _ 0, graphicsH: INTEGER _ 0, tsY: INTEGER _ 0, tsH: INTEGER _ 0, entryY: INTEGER _ 0, entryH: INTEGER _ 0, outerY: INTEGER _ 0, outerH: INTEGER _ 0, tSin: IO.STREAM _ NIL, tSout: IO.STREAM _ NIL, tSclear: BOOL _ TRUE, val: REAL _ 0.0, destroyed: BOOL _ FALSE, data: REF ANY _ NIL, directory: Rope.ROPE _ NIL, cmdOut: IO.STREAM _ NIL ]; OuterViewer: PROC [ name: Rope.ROPE _ NIL, column: ViewerClasses.Column _ left, entries: LIST OF Entry _ NIL, controls: ControlList _ NIL, controlSizes: ControlSizes _ [200, 25, 60], graphicsHeight: INT _ 0, graphicsProc: GraphicsProc _ NIL, graphicsShow: GraphicsShow _ NIL, destroyProc: DestroyProc _ NIL, typeScript: BOOL _ FALSE, data: REF ANY _ NIL, noOpen: BOOL _ FALSE] RETURNS [Viewer]; GraphicsViewer: PROC [ parent: Viewer, y, h: INT _ 0, proc: GraphicsProc, show: GraphicsShow, data: REF ANY] RETURNS [Viewer]; NewControl: PUBLIC PROC [ name: Rope.ROPE _ NIL, type: ControlType _ horiz, taper: ControlTaper _ lin, min, max, init: REAL _ 0.0, report: BOOL _ TRUE, truncate: BOOL _ FALSE, detents: LIST OF Detents _ NIL, proc: ControlProc _ NIL, data: REF ANY _ NIL, row: INTEGER _ 0, x, y, w, h: INTEGER _ 0, dummy: BOOL _ FALSE] RETURNS [ControlData]; EntryReLabel: PROC [outerData: OuterData, oldName, newName: Rope.ROPE]; EntryToggle: PROC [outerData: OuterData, state: BOOL, trueName, falseName: Rope.ROPE]; EntryStyle: PROC [outerData: OuterData, name: Rope.ROPE, style: ATOM]; EntryPositions: PUBLIC PROC [entries: LIST OF Entry] RETURNS [entryHeight: INTEGER]; EntryViewerList: PUBLIC PROC [parent: Viewer, entries: LIST OF Entry, data: OuterData]; EntryViewer: PROC [parent: Viewer, e: Entry, data: OuterData] RETURNS [Viewer]; TypeScriptClear: PROC [outerData: OuterData]; TypeScriptWrite: PROC [outerData: OuterData, rope: Rope.ROPE]; TypeScriptRead: PROC [outerData: OuterData] RETURNS [Rope.ROPE]; TypeScriptReadFileName: PROC [outerData: OuterData] RETURNS [Rope.ROPE]; ControlRow: PROC [c: ControlData, row: INTEGER]; ControlPositions: PROC [controls: ControlList, sizes: ControlSizes] RETURNS [height: INTEGER]; ControlViewerList: PROC [ parent, graphics: Viewer _ NIL, controls: Controls.ControlList, data: REF ANY]; ControlViewer: PROC [ parent, graphics: Viewer _ NIL, control: ControlData, data: REF ANY _ NIL, outerData: OuterData _ NIL]; SetControlVal: PROC [c: ControlData, val: REAL, repaint: BOOL _ TRUE]; GetControlVal: PROC [c: ControlData] RETURNS [REAL]; GetControlValInt: PROC [c: ControlData] RETURNS [INTEGER]; ControlReset: PROC [c1, c2, c3, c4, c5, c6: Controls.ControlData _ NIL]; SetMouse: PROC [a: ATOM, t: TIPUser.TIPScreenCoords] RETURNS [Mouse]; Quit: ClickProc; Restore: ClickProc; EndViewer: PROC [viewer: REF ANY]; UnTick: PROC [context: Context, c: ControlData]; Tick: PROC [context: Context, c: ControlData, val: REAL, detent: BOOL _ FALSE, width: INT _ 1]; Circle: PROC [context: Context, x, y, rad: REAL, fill: BOOL _ FALSE]; Square: PROC [context: Context, x, y, size: REAL]; Append: PROC [control: ControlData, list: ControlList _ NIL] RETURNS [ControlList]; END. PControls.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Bloomenthal, June 9, 1986 6:26:05 pm PDT Basic Types Procedures Create a top level viewer whose data field is of type OuterData. This viewer may contain an arbitrary number of controls, which may be created with NewControl[]. The viewer may also contain an arbitrary number of entries; when an entry's clickproc is called, it is passed the viewer's outerData. The viewer may also contain a single sub-viewer for graphical display. Lastly, the viewer may contain a single typescript viewer; if the typescript viewer exists, messages to and from the user may be accomplished with TypeScriptWrite[] and TypeScriptRead[]; the typescript viewer is placed at the top of the outer viewer, just below any entry buttons. If noOpen is TRUE then don't open the viewer (iconic or otherwise), thus permitting a program to manipulate the viewer first (for example, installing an icon from a file). Create a graphics viewer of height h and parent. Return a control. The name will appear above the control if the type is vert or circl, or to the right of the control if the type is horiz. If report is true, the current control value appears below the control name. If truncate is true, the reported value is given as an integer. proc, if non-nil, is called everytime the control is adjusted. The controls are normally ordered by OuterViewer, from right to left, beginning new rows as needed; if row is non-zero, however, the control will appear in the specified row and all subsequent controls will follow it. If y is non-zero, however, the control will appear at the specified y value, regardless of the value of row. If dummy is true, just use this control for positioning, not to be painted. Change the button name from oldName to newName (but alas, not the size). Change the button name to trueName or falseName, depending on state. Change the style of the named button; recognised display styles are: $BlackOnWhite - black letters on white background (default) $WhiteOnBlack - white letters on black background $BlackOnGrey - black letters on grey background If not already set, set default location and size for entries. Create set of entry viewers from list of entries. Create a button viewer from e. Write a carriage-return to the tyescript viewer if the current line is not empty. Write the rope into the typescript viewer. Wait for a reply terminated with a carriage-return. Wait for a reply and prepend directory name if necessary. Make c begin on given row; to have an effect, this call must preceed call to OuterViewer. If not already set, set default location and size for controls. Create set of viewers from list of controls. Create a control given a parent viewer. Set the value of the control to val and repaint the control iff repaint is true. Return the value of the control. Return the value of the control as rounded to an integer. Set to 0.0 and repaint any non-nil controls. Return coordinates, which button, and button state of the mouse. Default quit menu function. Menu function to restore all controls to intital settings. Destroy the given viewer. Delete the previously set tick mark on the given control. Set a tick mark for on the given control at location val. Draw a circle. Draw a (filled in) square. Add control to end of list and return pointer to beginning of list. Κ ˜šœ ™ Jšœ Οmœ1™J™—š ’œžœžœžœžœ˜WJšœ1™1J™—š’ œžœ-žœ ˜OJ™J™—š’œžœ˜-LšœQ™QL™—š’œžœ#žœ˜>Lšœ*™*L™—š’œžœžœžœ˜@Lšœ3™3L™—š’œžœžœžœ˜HLšœ9™9L™—šΠbn œžΟbœžœ˜0J™YJ™—š £œž€œ-žœ žœ˜^J™?J™—š’œžœ˜Jšœžœ˜Jšœ˜Jšœžœžœ˜J™,J™—š’ œžœ˜Jšœžœ˜Jšœ˜Jšœžœžœžœ˜Jšœžœ˜J™'J™—š ’ œžœžœ žœžœ˜FJ™PJ™—š’ œžœžœžœ˜4J™ J™—š’œžœžœžœ˜:J™9J™—š’ œžœ1žœ˜HL™,L™—š’œžœžœžœ ˜EJšœ@™@J™—š€œ ˜J™J™—š€œ ˜J™:J™—š£ œžœ žœžœ˜"J™J˜—š’œžœ$˜0J™9J™—š £œžœ)žœ žœžœ žœ˜_J™9J˜—š ’œžœžœžœžœ˜EJ™J˜—š’œžœ žœ˜2J™J˜—š’œžœ,žœžœ˜SJ™C—J˜Jšžœ˜—J˜J˜—…—&0