NodeStyleOps.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Written by Bill Paxton, January 1981
Last changed by Bill Paxton, December 1, 1982 8:37 am
Doug Wyatt, March 2, 1985 5:35:13 pm PST
Michael Plass, March 14, 1985 4:47:24 pm PST
Beach, March 17, 1985 3:09:25 pm PST
DIRECTORY
NameSymbolTable USING [Name, Object],
NodeStyle USING [Name, Ref],
Rope USING [ROPE],
TextLooks USING [Looks],
TextNode USING [Ref],
TJaMBasic USING [Object];
NodeStyleOps: CEDAR DEFINITIONS
=
BEGIN
Ref: TYPE = NodeStyle.Ref;
Name: TYPE = NodeStyle.Name;
Object: TYPE = TJaMBasic.Object;
Style Operations
Create:
PROC
RETURNS [Ref];
create a style body
Copy:
PROC [dest, source: Ref];
copy a style body
Alloc:
PROC
RETURNS [Ref];
get from a small cache
Free:
PROC [Ref];
don't free more than once or disaster!
LoadStyle:
PROC [name: Name]
RETURNS [ok:
BOOL];
make sure that named style is loaded
fast return if is already loaded
ReloadStyle:
PROC [name: Name]
RETURNS [ok:
BOOL];
forces rereading of definition
Local Styles
LocalStyle: TYPE = REF LocalStyleRec;
LocalStyleRec: TYPE = RECORD [ name: Name, def: Rope.ROPE ];
defaultStyleName: Name;
defaultStyle: Ref;
defaultStylesForExtensions: LIST OF ExtObjPair;
ExtObjPair: TYPE = RECORD [ fileExtension: ATOM, styleObject: NameSymbolTable.Object ];
SetDefaultStyle: PROC [name: Rope.ROPE];
SetExtensionStyles: PROC [value: LIST OF Rope.ROPE];
Apply operations
ApplyAll:
PROC [ref: Ref, node: TextNode.Ref, kind: OfStyle ← screen];
ApplyAll[ref,NIL] sets ref to default values
including setting style name to "default"
ApplyAll[ref,node] for node # NIL
1. ApplyAll[ref, Parent[node]]
2. ApplyForNode[ref, node, alt]
where alt is "root" if parent=NIL
or "default" otherwise
ApplyForNode:
PROC [ref: Ref, node: TextNode.Ref, alt: Name, kind: OfStyle ← screen];
1. ApplyObject[ref, node prefix object]
2. ApplyFormat[ref, node format, alt]
3. ApplyObject[ref, node postfix object]
ApplyFormat:
PROC [ref: Ref, name, alt: Name, kind: OfStyle ← screen];
executes the name to modify the body
if name is null or undefined, applies alt instead
ApplyLooks:
PROC [ref: Ref, looks: TextLooks.Looks, kind: OfStyle ← screen];
executes the looks to modify the body
ApplyObject:
PROC [ref: Ref, object: NameSymbolTable.Object, kind: OfStyle ← screen];
executes the object to modify the body
OfStyle: TYPE = { screen, print, base };
StyleNameForNode:
PROC [TextNode.Ref]
RETURNS [Name];
does an ApplyAll and then returns the style name
Style Parameter Extensions
GetStyleParam:
PROC [s: Ref, name: Name, styleName: Name, kind: OfStyle]
RETURNS [
REAL];
GetStyleParamI:
PUBLIC
PROC [s: Ref, name: Name, styleName: Name, kind: OfStyle]
RETURNS [
INTEGER];
GetStyleParamObj:
PUBLIC
PROC [s: Ref, name: Name, styleName: Name, kind: OfStyle]
RETURNS [Object]
;
END.