CDLayers.mesa (part of ChipNDale)
Copyright © 1983, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, August 11, 1983 11:32 am
last edited by Christian Jacobi, September 19, 1985 3:12:15 am PDT
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.highLightError for placeholder layers
RETURN [layerPaint[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 design as result of user interaction.
abstract:
Objects might have this layer, e.g. rectangles. Might represent a paint layer.
Meaning is defined by technology.
paint:
Has a color...
--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 overpass each other.
--For correct behavior on multiple processes, the values have to be querried inside.
--Changes on other than per design basis may or may not be notifyed.
--procedures for technology implementors
MakeAbstract: PRIVATE PROC [abstract: Layer, represents: Layer←CD.highLightError];
--makes this layer an abstract layer
MakePlaceholder: PRIVATE PROC [layer: Layer, defaultsTo: Layer←CD.highLightError];
--makes this layer an placeholder layer
END.