CDLayers.mesa (part of ChipNDale)
Copyright © 1983, 1986 by Xerox Corporation. All rights reserved.
by Christian Jacobi, August 11, 1983 11:32 am
last edited by Christian Jacobi, March 14, 1986 1:28:55 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.
Layer: TYPE = CD.Layer;
Number: TYPE = CD.Number;
Design: TYPE = CD.Design;
--everybodys procedures
CurrentLayer: PROC [design: Design] RETURNS [Layer];
--returns current layer for this design
LayerWidth: PROC [design: Design, layer: Layer] RETURNS [Number];
--returns current width for layer "layer" in this design
PlaceholderToAbstract: PROC [design: Design, layer: Layer] RETURNS [Layer];
--returns corresponding abstract or paint layer given an placeholder layer for this design
AbstractToPaint: PROC [layer: Layer] RETURNS [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 [layerPaint[layer]]
};
Kind: PROC [layer: Layer] RETURNS [LayerKind] = INLINE {
--returns usage of layer
RETURN [layerKind[layer]];
};
LayerKind: TYPE = {paint, abstract, placeholder};
layerKind: READONLY REF READONLY ARRAY Layer OF LayerKind;
layerPaint: READONLY REF READONLY ARRAY Layer OF Layer;
There are three different usages of layers
placeholder:
Not to be put into data structures, only help for interacton.
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 typicaly
are not drawn into rectangles of devices.
paint:
Has a color...; is subject to drawRect
--procedures for control panel implementors
SetCurrentLayer: PROC [design: REF, layer: Layer];
--use technology for initializing defaults
SetLayerWidth: PROC [design: Design, layer: Layer, width: Number];
--NIL design for initializing defaults
SetPlaceholderToAbstract: PROC [design: Design, placeholder, abstract: Layer];
--NIL design for initializing defaults
RegisterNotifiers: PRIVATE PROC [layer: DesignNotifyProc←NIL, width: LayerNotifyProc←NIL, placeholder: LayerNotifyProc←NIL];
DesignNotifyProc: TYPE = PROC [design: Design];
LayerNotifyProc: TYPE = PROC [design: Design, layer: Layer];
--These Notify Proc's are not monitored and might pass each other.
--For correct behavior on multiple processes, the actual values have to be querried inside.
--Changes on an other than per design basis may or may not be notifyed.
--procedures for technology implementors
MakeAbstract: PRIVATE PROC [abstract: Layer, represents: Layer←CD.undefLayer];
--makes this layer an abstract layer
MakePlaceholder: PRIVATE PROC [layer: Layer, defaultsTo: Layer←CD.undefLayer];
--makes this layer a placeholder layer
--procedures for CDLayer implementors
MakePaint: PRIVATE PROC [layer: Layer];
--makes this layer a paint layer
END.