NodeStyleOps.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Written by Bill Paxton, January 1981
Last changed by Bill Paxton, December 1, 1982 8:37 am
Michael Plass, March 14, 1985 4:47:24 pm PST
Beach, March 20, 1985 5:52:54 pm PST
Doug Wyatt, September 2, 1986 1:14:32 pm PDT
Style Operations
Create:
PROC
RETURNS [Style];
create a style body
Copy:
PROC [dest, source: Style];
copy a style body
Alloc:
PROC
RETURNS [Style];
get from a small cache
Free:
PROC [Style];
don't free more than once or disaster!
LoadStyle:
PROC [name:
ATOM]
RETURNS [ok:
BOOL];
make sure that named style is loaded
fast return if is already loaded
ReloadStyle:
PROC [name:
ATOM]
RETURNS [ok:
BOOL];
forces rereading of definition
Local Styles
LocalStyle: TYPE ~ REF LocalStyleRec;
LocalStyleRec: TYPE ~ RECORD [ name: ATOM, def: ROPE ];
defaultStyleName: ATOM;
defaultStyle: Style;
defaultStylesForExtensions: LIST OF ExtObjPair;
ExtObjPair: TYPE ~ RECORD [fileExtension: ATOM, styleObject: REF];
SetDefaultStyle: PROC [name: ROPE];
SetExtensionStyles: PROC [value: LIST OF ROPE];
Apply operations
ApplyAll:
PROC [ref: Style, node: TextNode.Node, 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: Style, node: TextNode.Node, alt:
ATOM, kind: OfStyle ← screen];
1. ApplyObject[ref, node prefix object]
2. ApplyFormat[ref, node format, alt]
3. ApplyObject[ref, node postfix object]
ApplyFormat:
PROC [ref: Style, name, alt:
ATOM, kind: OfStyle ← screen];
executes the name to modify the body
if name is null or undefined, applies alt instead
ApplyLooks:
PROC [ref: Style, looks: TextLooks.Looks, kind: OfStyle ← screen];
executes the looks to modify the body
ApplyObject:
PROC [ref: Style, object:
REF, kind: OfStyle ← screen];
executes the object to modify the body
OfStyle: TYPE ~ { screen, print, base };
StyleNameForNode:
PROC [TextNode.Node]
RETURNS [
ATOM];
does an ApplyAll and then returns the style name