CDLayers.mesa (part of ChipNDale)
Copyright © 1983, 1986, 1987 by Xerox Corporation. All rights reserved.
Created by: Christian Jacobi, August 11, 1983 11:32 am
Last edited by: Christian Jacobi, March 27, 1987 5:23:42 pm PST
DIRECTORY
CD;
CDLayers: CEDAR DEFINITIONS =
BEGIN
This module serves to decouple low level querries for current layer and width from
control panel modules, which resides on higher levels. But we do assume here
that some control panel module will actually initialize the witdhs.
Furthermore, and deeper, it allows to state the purpose of layers.
These two concepts are on different levels in the logically package hierarchy, but the
default procs are vanilla enough to be allowed to co-reside on this low logical level.
--Procedures for designer and interactive editor
CurrentLayer: PROC [design: CD.Design] RETURNS [CD.Layer];
--Returns current layer for this design
LayerWidth: PROC [design: CD.Design, layer: CD.Layer] RETURNS [CD.Number];
--Returns current width for layer "layer" in this design
PlaceholderToAbstract: PROC [design: CD.Design, layer: CD.Layer] RETURNS [CD.Layer];
--Returns corresponding abstract or paint layer given an placeholder layer for this design
--Low level stuff for any purpose
AbstractToPaint: PROC [layer: CD.Layer] RETURNS [CD.Layer] = INLINE {
--Returns corresponding paint layer given an abstract layer
--Identity for paint layers
--CD.undefLayer for abstract layer not representing a paint layer
--CD.errorLayer or CD.undefLayer for placeholder layers
RETURN [layerData[layer].paint]
};
Kind: PROC [layer: CD.Layer] RETURNS [LayerKind] = INLINE {
--Returns usage of layer
RETURN [layerData[layer].kind];
};
SuppressIR: PROC [layer: CD.Layer] RETURNS [BOOL] = INLINE {
RETURN [layerData[layer].suppressIR];
};
LayerKind: TYPE = {paint, abstract, placeholder};
There are three different usages of layers
placeholder:
Not to be put into data structures, only help for interactions.
Meaning may change over time and per design as result of user interaction.
abstract:
Objects might have this layer, e.g. rectangles. Might (or might not) represent
a paint layer. Meaning is defined by technology. Abstract layers typically
are not drawn into rectangles of devices.
paint:
Has a color...; is subject to masks
LayerData: TYPE = RECORD [paint, well: CD.Layer←CD.undefLayer, kind: LayerKind←placeholder, suppressIR: BOOLFALSE, wSurr: BYTE𡤀];
layerData: READONLY REF READONLY ARRAY CD.Layer OF LayerData;
--Procedures for control panel implementors
SetCurrentLayer: PROC [design: REF, layer: CD.Layer];
--Technology instead of design for initializing defaults
SetLayerWidth: PROC [design: REF, layer: CD.Layer, width: CD.Number];
--NIL or technology instead of design for initializing defaults
SetPlaceholderToAbstract: PROC [design: REF, placeholder, abstract: CD.Layer];
--set a placeholder to point to an abstract or paint layer
--NIL or technology instead of design for initializing defaults
RegisterNotifiers: PRIVATE PROC [layer: DesignNotifyProc←NIL, width: LayerNotifyProc←NIL, placeholder: LayerNotifyProc←NIL];
--Registeres notifiers which are called when a default value for a design changes
DesignNotifyProc: TYPE = PROC [design: CD.Design];
LayerNotifyProc: TYPE = PROC [design: CD.Design, layer: CD.Layer];
--These Notify Proc's are not monitored and might pass each other.
--The actual new default values have to be querried inside.
--Procedures for Technology implementors
MakeAbstract: PRIVATE PROC [abstract: CD.Layer, paint: CD.Layer ← CD.undefLayer, well: CD.Layer ← CD.undefLayer, wSurr: BYTE ← 0];
--Makes "abstract" an abstract layer
MakePlaceholder: PRIVATE PROC [placeholder: CD.Layer, defaultsTo: CD.Layer ← CD.undefLayer];
--Makes "placeholder" a placeholder layer
MakePaint: PRIVATE PROC [layer: CD.Layer];
--Makes "layer" a paint layer
MakeSuppressIR: PRIVATE PROC [layer: CD.Layer, suppressIR: BOOLTRUE];
--Sets "layers" suppressIR field
END.