-- TAStyleImpl.mesa -- written by Beach, July 3, 1982 4:54 pm -- modified by Beach, November 26, 1982 12:58 pm DIRECTORY JaMBasic USING [Object], JaMInternal USING [Frame], JaMOps USING [AGet, defaultFrame, Execute, MakeString, PopArray, PopReal, Push, StringToName], NameSymbolTable USING [MakeName, Name], NodeStyle USING [GetStyleName, GetReal, OfStyle, PathType, Ref], NodeStyleExtra USING [GetFrame, GetStyleParam, NameToObject], TAStyle; TAStyleImpl: PROGRAM IMPORTS JaMOps, NameSymbolTable, NodeStyle, NodeStyleExtra EXPORTS TAStyle = { Name: TYPE = NameSymbolTable.Name; penStyle: Name = NameSymbolTable.MakeName["penStyle"]; penSlant: Name = NameSymbolTable.MakeName["penSlant"]; penWidth: Name = NameSymbolTable.MakeName["penWidth"]; penHeight: Name = NameSymbolTable.MakeName["penHeight"]; shadowType: Name = NameSymbolTable.MakeName["shadowType"]; shadowDirection: Name = NameSymbolTable.MakeName["shadowDirection"]; shadowWeight: Name = NameSymbolTable.MakeName["shadowWeight"]; shadowAngle: Name = NameSymbolTable.MakeName["shadowAngle"]; shadowOffsetAmount: Name = NameSymbolTable.MakeName["shadowOffsetAmount"]; shadowPathType: Name = NameSymbolTable.MakeName["shadowPathType"]; shadowAreaHue: Name = NameSymbolTable.MakeName["shadowAreaHue"]; shadowAreaSaturation: Name = NameSymbolTable.MakeName["shadowAreaSaturation"]; shadowAreaBrightness: Name = NameSymbolTable.MakeName["shadowAreaBrightness"]; shadowOutlineHue: Name = NameSymbolTable.MakeName["shadowOutlineHue"]; shadowOutlineSaturation: Name = NameSymbolTable.MakeName["shadowOutlineSaturation"]; shadowOutlineBrightness: Name = NameSymbolTable.MakeName["shadowOutlineBrightness"]; captionFormatting: Name = NameSymbolTable.MakeName["captionFormatting"]; captionAlignment: Name = NameSymbolTable.MakeName["captionAlignment"]; filled: Name = NameSymbolTable.MakeName["filled"]; outlined: Name = NameSymbolTable.MakeName["outlined"]; filledAndOutlined: Name = NameSymbolTable.MakeName["filled+outlined"]; round: Name = NameSymbolTable.MakeName["round"]; square: Name = NameSymbolTable.MakeName["square"]; rectangular: Name = NameSymbolTable.MakeName["rectangular"]; italic: Name = NameSymbolTable.MakeName["italic"]; elliptical: Name = NameSymbolTable.MakeName["elliptical"]; drop: Name = NameSymbolTable.MakeName["drop"]; offset: Name = NameSymbolTable.MakeName["offset"]; none: Name = NameSymbolTable.MakeName["none"]; upLeft: Name = NameSymbolTable.MakeName["upLeft"]; upRight: Name = NameSymbolTable.MakeName["upRight"]; downLeft: Name = NameSymbolTable.MakeName["downLeft"]; downRight: Name = NameSymbolTable.MakeName["downRight"]; flushLeft: Name = NameSymbolTable.MakeName["flushLeft"]; flushRight: Name = NameSymbolTable.MakeName["flushRight"]; centered: Name = NameSymbolTable.MakeName["centered"]; flushTop: Name = NameSymbolTable.MakeName["flushTop"]; flushBottom: Name = NameSymbolTable.MakeName["flushBottom"]; baseline: Name = NameSymbolTable.MakeName["baseline"]; KludgeGetStyleParam: PROCEDURE[s: NodeStyle.Ref, name: Name, styleName: Name, kind: NodeStyle.OfStyle] RETURNS [obj: JaMBasic.Object] = { key: JaMBasic.Object; paramObject: array JaMBasic.Object; frame: JaMInternal.Frame _ NodeStyleExtra.GetFrame[s, styleName, kind]; JaMOps.Push[frame.opstk, NodeStyleExtra.NameToObject[name]]; JaMOps.Execute[frame, load]; paramObject _ JaMOps.PopArray[frame.opstk]; key _ JaMOps.AGet[paramObject, 0]; WITH x:key SELECT FROM name => obj _ NodeStyleExtra.GetStyleParam[s, LOOPHOLE[x.id.index], styleName, kind]; ENDCASE => ERROR; }; load: JaMBasic.Object = JaMOps.MakeString[".load", X]; ObjectNotAName: SIGNAL = CODE; ObjectToName: PROCEDURE[obj: JaMBasic.Object] RETURNS[name: Name] = { WITH x:obj SELECT FROM name => RETURN [LOOPHOLE[x.id]]; string => { nameObj: name JaMBasic.Object _ JaMOps.StringToName[x]; RETURN[LOOPHOLE[nameObj.id]]}; ENDCASE => SIGNAL ObjectNotAName; }; GetLineWeight: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[REAL] = { RETURN[NodeStyle.GetReal[s,lineWeight]]}; GetPenStyle: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[TAStyle.PenStyle] = { -- determine the pen style from the style applicable to this node penStyleName: Name _ ObjectToName[NodeStyleExtra.GetStyleParam[s, penStyle, NodeStyle.GetStyleName[s], screen]]; RETURN[SELECT penStyleName FROM round => Round, square => Square, rectangular => Rectangular, italic => Italic, elliptical => Elliptical, ENDCASE => ERROR]}; GetPenSlant: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[REAL] = { -- determine the rotation in degrees from vertical; positive is clockwise frame: JaMInternal.Frame _ JaMOps.defaultFrame; JaMOps.Push[frame.opstk, NodeStyleExtra.GetStyleParam[s, penSlant, NodeStyle.GetStyleName[s], screen]]; RETURN[JaMOps.PopReal[frame.opstk]]}; GetPenWidth: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[REAL] = { -- return the width of the pen in points frame: JaMInternal.Frame _ JaMOps.defaultFrame; JaMOps.Push[frame.opstk, NodeStyleExtra.GetStyleParam[s, penWidth, NodeStyle.GetStyleName[s], screen]]; RETURN[JaMOps.PopReal[frame.opstk]]}; GetPenHeight: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[REAL] = { -- return the height of the pen in points frame: JaMInternal.Frame _ JaMOps.defaultFrame; JaMOps.Push[frame.opstk, NodeStyleExtra.GetStyleParam[s, penHeight, NodeStyle.GetStyleName[s], screen]]; RETURN[JaMOps.PopReal[frame.opstk]]}; GetShadowType: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[TAStyle.ShadowType] = { -- return the type of shadow to apply shadowTypeName: Name _ ObjectToName[NodeStyleExtra.GetStyleParam[s, shadowType, NodeStyle.GetStyleName[s], screen]]; RETURN[SELECT shadowTypeName FROM drop => Drop, offset => Offset, none => None, ENDCASE => ERROR]}; GetShadowDirection: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[TAStyle.ShadowDirection] = { -- return the direction of the shadow from the original path shadowDirectionName: Name _ ObjectToName[NodeStyleExtra.GetStyleParam[s, shadowDirection, NodeStyle.GetStyleName[s], screen]]; RETURN[SELECT shadowDirectionName FROM upLeft => UpLeft, upRight => UpRight, downLeft => DownLeft, downRight => DownRight, ENDCASE => ERROR]}; GetShadowAngle: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[REAL] = { -- return the angle of the shadow from the original path frame: JaMInternal.Frame _ JaMOps.defaultFrame; JaMOps.Push[frame.opstk, NodeStyleExtra.GetStyleParam[s, shadowAngle, NodeStyle.GetStyleName[s], screen]]; RETURN[JaMOps.PopReal[frame.opstk]]}; GetShadowWeight: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[REAL] = { -- return the weight of the shadow outline frame: JaMInternal.Frame _ JaMOps.defaultFrame; JaMOps.Push[frame.opstk, NodeStyleExtra.GetStyleParam[s, shadowWeight, NodeStyle.GetStyleName[s], screen]]; RETURN[JaMOps.PopReal[frame.opstk]]}; GetShadowOffsetAmount: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[REAL] = { -- return the distance the shadow is offset from the original path frame: JaMInternal.Frame _ JaMOps.defaultFrame; JaMOps.Push[frame.opstk, NodeStyleExtra.GetStyleParam[s, shadowOffsetAmount, NodeStyle.GetStyleName[s], screen]]; RETURN[JaMOps.PopReal[frame.opstk]]}; GetShadowPathType: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[NodeStyle.PathType] = { -- return the kind of path to use to draw the shadow shadowPathTypeName: Name _ ObjectToName[NodeStyleExtra.GetStyleParam[s, shadowPathType, NodeStyle.GetStyleName[s], screen]]; RETURN[SELECT shadowPathTypeName FROM filled => Filled, outlined => Outlined, filledAndOutlined => FilledAndOutlined, ENDCASE => ERROR]}; GetShadowAreaHue: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[REAL] = { -- return the hue[0-255] of the shadow area frame: JaMInternal.Frame _ JaMOps.defaultFrame; JaMOps.Push[frame.opstk, NodeStyleExtra.GetStyleParam[s, shadowAreaHue, NodeStyle.GetStyleName[s], screen]]; RETURN[JaMOps.PopReal[frame.opstk]]}; GetShadowAreaSaturation: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[REAL] = { -- return the saturation[0-255] of the shadow area frame: JaMInternal.Frame _ JaMOps.defaultFrame; JaMOps.Push[frame.opstk, NodeStyleExtra.GetStyleParam[s, shadowAreaSaturation, NodeStyle.GetStyleName[s], screen]]; RETURN[JaMOps.PopReal[frame.opstk]]}; GetShadowAreaBrightness: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[REAL] = { -- return the brightness[0-255] of the shadow area frame: JaMInternal.Frame _ JaMOps.defaultFrame; JaMOps.Push[frame.opstk, NodeStyleExtra.GetStyleParam[s, shadowAreaBrightness, NodeStyle.GetStyleName[s], screen]]; RETURN[JaMOps.PopReal[frame.opstk]]}; GetShadowOutlineHue: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[REAL] = { -- return the hue[0-255] of the shadow outline frame: JaMInternal.Frame _ JaMOps.defaultFrame; JaMOps.Push[frame.opstk, NodeStyleExtra.GetStyleParam[s, shadowOutlineHue, NodeStyle.GetStyleName[s], screen]]; RETURN[JaMOps.PopReal[frame.opstk]]}; GetShadowOutlineSaturation: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[REAL] = { -- return the saturation[0-255] of the shadow outline frame: JaMInternal.Frame _ JaMOps.defaultFrame; JaMOps.Push[frame.opstk, NodeStyleExtra.GetStyleParam[s, shadowOutlineSaturation, NodeStyle.GetStyleName[s], screen]]; RETURN[JaMOps.PopReal[frame.opstk]]}; GetShadowOutlineBrightness: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[REAL] = { -- return the brightness[0-255] of the shadow outline frame: JaMInternal.Frame _ JaMOps.defaultFrame; JaMOps.Push[frame.opstk, NodeStyleExtra.GetStyleParam[s, shadowOutlineBrightness, NodeStyle.GetStyleName[s], screen]]; RETURN[JaMOps.PopReal[frame.opstk]]}; GetCaptionFormatting: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[TAStyle.CaptionFormatting] = { -- determine the horizontal justification for the text caption in this node captionFormattingName: Name _ ObjectToName[NodeStyleExtra.GetStyleParam[s, captionFormatting, NodeStyle.GetStyleName[s], screen]]; RETURN[SELECT captionFormattingName FROM flushLeft => FlushLeft, flushRight => FlushRight, centered => Centered, ENDCASE => ERROR]}; GetCaptionAlignment: PUBLIC PROCEDURE[s: NodeStyle.Ref] RETURNS[TAStyle.CaptionAlignment] = { -- determine the vertical justification for the text caption in this node captionAlignmentName: Name _ ObjectToName[NodeStyleExtra.GetStyleParam[s, captionAlignment, NodeStyle.GetStyleName[s], screen]]; RETURN[SELECT captionAlignmentName FROM flushTop => FlushTop, flushBottom => FlushBottom, baseline => Baseline, centered => Centered, ENDCASE => ERROR]}; }. Rick Beach, November 26, 1982, add caption styles Ęi˜J˜Jš Īc)œœĪk œ žœžœžœdžœžœBžœ4 œžœFœęžœáœØ œÜœ‚%˜ŊR—…—)@)¯