DIRECTORY StyleDefs USING [StyleHandle, Font, StringType, StringRotation], Rope USING [ROPE], GriffinFontDefs USING [FontDescriptorHandle]; GriffinStyle: CEDAR DEFINITIONS ~ BEGIN StyleHandle: TYPE = StyleDefs.StyleHandle; StringType: TYPE = StyleDefs.StringType; CurrentStyle: PROCEDURE RETURNS [StyleHandle]; CopyCurrentStyle: PROCEDURE RETURNS [StyleHandle]; SetCurrentStyle: PROC[style: StyleHandle]; Initialize: PROC; --initialize the current style NextName: PROCEDURE RETURNS [Rope.ROPE]; Font: TYPE = StyleDefs.Font; InternalFont: TYPE = GriffinFontDefs.FontDescriptorHandle; FontSequence: TYPE = REF FontSequenceRec; FontSequenceRec: TYPE = RECORD[element: SEQUENCE length:NAT OF Font]; StyleSequence: TYPE = REF StyleSequenceRec; StyleSequenceRec: TYPE = RECORD[element: SEQUENCE length: NAT OF StyleHandle]; CreateStyleList: PROC RETURNS[styles: StyleSequence]; CreateFontList: PROC[styles: StyleSequence] RETURNS[fonts: FontSequence]; NumberOfStyle: PROC[style: StyleHandle, styles: StyleSequence] RETURNS [CARDINAL]; NumberOfFont: PROC[font: Font, fonts: FontSequence] RETURNS[CARDINAL]; FindEquivalentStyle: PROC[style: StyleHandle, styles: StyleSequence] RETURNS [StyleHandle]; InternalFontFromFont: PROC[Font] RETURNS[InternalFont]; FontFromInternalFont: PROC[ifont: InternalFont] RETURNS[Font]; ComputeStringType: PROC[stringRotation: StyleDefs.StringRotation, font: Font] RETURNS[StyleDefs.StringType]; END. pGriffinStyle.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Written by: Maureen Stone, September 5, 1985 5:45:41 pm PDT The Griffin Style machinery is very simple. Each object has a style, which is a REF. There is a current style which can be modified by the style menus (implemented in ControllerMenus). A NEW object created by Draw or Close gets a COPY of the current style. Equivalent styles will be merged when the file is written. A COPY of an object, however, copies the style REF. ApplyStyle will give all selected objects the same style REF. Styles read from a file will be compared to the existing set of styles before generating a new style. Therefore, reading the same file over and over will not create multiple copies of the styles. ControllerMenus changes the value of the current style through this handle. Makes a new StyleHandle. Only copies of the current style are ever stored on objects called when Indicate Style is bugged and when an object is Modified. Sets VALUE of current style to the VALUE of the indicated style. For use by GriffinFile. The Griffin File format understands sharing styles. It puts a list of all unique styles at the front of the file. The same sort of indirection is applied to Fonts. The styles are stored in the objects as numbers. CreateStyleList and CreateFontList enumerate the existing undeleted objects and create a list of styles and fonts. NumberOfStyle and NumberOfFont do the obvious search. Both style and font numbers start at 1 to correspond to Griffin file conventions. InternalFontFromFont, FontFromInternalFont and ComputeStringType convert types between the file format and those in StyleDefs When a file is read, new styles are generated and renamed with NextName. FindEquivalentStyle is an attempt to eliminate duplication when reading in a file. Reading in a style from a file changes its name. Κ_˜codešœ Οkœ™Kšœ Οmœ1™KšŸœœ7œ˜lKšœ˜——…—ši