DIRECTORY Buttons USING [Button, ButtonProc, Create, SetDisplayStyle], ChoiceButtons USING [BuildEnumTypeSelection, BuildTextPrompt, BuildTriStateButton, ButtonList, PromptDataRef, SelectionNotifierProc], Containers USING [ChildXBound, ChildYBound, Container, Create], IO USING [int, PutFR, real], Labels USING [Create, Label, Set, SetDisplayStyle], MessageWindow USING [Append, Blink], Rope USING [Equal, ROPE], StyleToolDefs, StyleToolBuilders, StyleToolConvert USING [ConvertUnits, GetRealFromViewer], StyleToolGraphics USING [CreateLayoutContainer], VFonts USING [CharWidth, EstablishFont, Font, StringWidth], ViewerClasses USING [Viewer], ViewerOps USING [CreateViewer, EstablishViewerPosition, MoveViewer], ViewerTools USING [InhibitUserEdits, MakeNewTextViewer, SetContents, SetSelection]; StyleToolBuildersImpl: CEDAR PROGRAM IMPORTS Buttons, ChoiceButtons, Containers, IO, Labels, MessageWindow, Rope, StyleToolConvert, StyleToolDefs, StyleToolGraphics, VFonts, ViewerOps, ViewerTools EXPORTS StyleToolBuilders = BEGIN OPEN StyleToolDefs, StyleToolBuilders; largeLabelFont: VFonts.Font _ VFonts.EstablishFont[family: "Helvetica", size: 12, bold: TRUE, italic: FALSE, defaultOnFailure: TRUE]; mediumLabelFont: VFonts.Font _ VFonts.EstablishFont[family: "Helvetica", size: 10, bold: TRUE, italic: FALSE, defaultOnFailure: TRUE]; smallLabelFont: VFonts.Font _VFonts.EstablishFont[family: "Helvetica", size: 8, bold: TRUE, italic: FALSE, defaultOnFailure: TRUE]; tinyLabelFont: VFonts.Font _VFonts.EstablishFont[family: "Helvetica", size: 6, bold: FALSE, italic: FALSE, defaultOnFailure: TRUE]; styleFormatLookWidth: INTEGER = 200; -- width of text viewer for style name, format name, looks realWidth: CARDINAL _ 6*VFonts.CharWidth['0]; -- width of text viewer for real #'s extraSpace: CARDINAL _ 2; -- provides a little extra spacing lineSpace: CARDINAL _ entryHeight + 2; -- vertical leading space between lines of text dividerHeight: CARDINAL _ 15; -- height of dividers BadNumber: SIGNAL = CODE; EmptyList: SIGNAL = CODE; CurrentNameNotInList: SIGNAL = CODE; stretchShrinkStart: INTEGER _ 230; -- x position of stretch shrink container midway: INTEGER _ 210; -- half way point in StyleTool container BuildStyleNameField: PUBLIC PROCEDURE[handle: StyleToolHandle] = BEGIN handle.styleNameData _ ChoiceButtons.BuildTextPrompt[ viewer: handle.outer, y: handle.height, title: "Style Name:", default: "default", font: largeLabelFont, textViewerWidth: styleFormatLookWidth ]; handle.height _ handle.styleNameData.newy + extraSpace; -- interline spacing END; BuildFormatNameField: PUBLIC PROC[handle: StyleToolHandle] = BEGIN handle.formatNameData _ ChoiceButtons.BuildTextPrompt[viewer: handle.outer, y: handle.height, title: "Format Name:", font: mediumLabelFont, textViewerWidth: styleFormatLookWidth]; handle.height _ handle.formatNameData.newy + extraSpace; -- interline spacing END; BuildLooksField: PUBLIC PROCEDURE [handle: StyleToolHandle] = BEGIN handle.looksData _ ChoiceButtons.BuildTextPrompt[viewer: handle.outer, y: handle.height, title: "Looks:", font: mediumLabelFont, textViewerWidth: styleFormatLookWidth]; handle.height _ handle.looksData.newy + entryVSpace; END; BuildRuleField: PUBLIC PROCEDURE [handle: StyleToolHandle] = BEGIN handle.ruleType _ ChoiceButtons.BuildEnumTypeSelection[viewer: handle.outer, x: 320, y: 18, buttonNames: ruleList, style: menuSelection, notifyClientProc: ChangeDisplay, clientdata: handle, allInOneRow: FALSE, maxWidth: 400, default: "StyleRule"]; END; ChangeDisplay: ChoiceButtons.SelectionNotifierProc = { oldy: INTEGER; handle: StyleToolHandle _ NARROW[clientdata]; SELECT TRUE FROM Rope.Equal[name, "ScreenRule"] => { -- take away the print information OPEN handle.swap; -- for penalty, jamCodeInfo, layoutHeader and layout oldy _ penalty.outer.wy; ViewerOps.MoveViewer[penalty.outer, LAST[INTEGER], penalty.outer.wy, penalty.outer.ww, penalty.outer.wh]; -- move out to "infinity" in x dimension ViewerOps.MoveViewer[layoutHeader.outer, LAST[INTEGER], layoutHeader.outer.wy, layoutHeader.outer.ww, layoutHeader.outer.wh]; ViewerOps.MoveViewer[layout.outer, LAST[INTEGER], layout.outer.wy, layout.outer.ww, layout.outer.wh]; ViewerOps.MoveViewer[jamCodeInfo.outer, 0, oldy, jamCodeInfo.outer.ww, jamCodeInfo.outer.wh]; ViewerOps.MoveViewer[handle.display.stretchShrinkContainer, LAST[INTEGER], handle.display.stretchShrinkContainer.wy, handle.display.stretchShrinkContainer.ww, handle.display.stretchShrinkContainer.wh]; }; Rope.Equal[name, "PrintRule"], Rope.Equal[name, "StyleRule"] => { OPEN handle.swap; -- for penalty, jamCodeInfo, layoutHeader and layout IF penalty.outer.wx = LAST[INTEGER] THEN { IF layout.visible THEN ViewerOps.MoveViewer[jamCodeInfo.outer,0,layout.outer.wy+layout.outer.wh+2, jamCodeInfo.outer.ww, jamCodeInfo.outer.wh] ELSE ViewerOps.MoveViewer[jamCodeInfo.outer, 0, layoutHeader.outer.wy + layoutHeader.outer.wh + 6, jamCodeInfo.outer.ww, jamCodeInfo.outer.wh]; ViewerOps.MoveViewer[penalty.outer, 0, penalty.outer.wy, penalty.outer.ww, penalty.outer.wh]; ViewerOps.MoveViewer[layoutHeader.outer, 0, layoutHeader.outer.wy, layoutHeader.outer.ww, layoutHeader.outer.wh]; IF layout.visible THEN ViewerOps.MoveViewer[layout.outer, 0, layout.outer.wy, layout.outer.ww, layout.outer.wh]; ViewerOps.MoveViewer[handle.display.stretchShrinkContainer, stretchShrinkStart, handle.display.stretchShrinkContainer.wy, handle.display.stretchShrinkContainer.ww, handle.display.stretchShrinkContainer.wh]; }; }; ENDCASE => ERROR; }; DisplayRealInViewer: PUBLIC PROCEDURE [num: REAL, v: ViewerClasses.Viewer] = BEGIN ViewerTools.SetContents[v, IO.PutFR[realNumberFormat, IO.real[num]]]; END; DisplayIntInViewer: PUBLIC PROCEDURE [num: INTEGER, v: ViewerClasses.Viewer] = BEGIN ViewerTools.SetContents[v, IO.PutFR[integerFormat, IO.int[num]]]; END; BuildValueAndUnits: PROCEDURE [container: Containers.Container, x,y: CARDINAL _ 0, itemTitle: Rope.ROPE, itemDefault: Rope.ROPE _ NIL] RETURNS [newValueAndUnits: ValueAndUnitsRef] = BEGIN newValueAndUnits _ NEW[ValueAndUnitsRec]; newValueAndUnits.valueData _ ChoiceButtons.BuildTextPrompt[ viewer: container, x: x, y: y, title: itemTitle, default: itemDefault, textViewerWidth: realWidth ]; newValueAndUnits.units _ ChoiceButtons.BuildEnumTypeSelection [ viewer: container, x: newValueAndUnits.valueData.newx + 5, y: y + 2, -- add 4 so that the units are aligned with the text prompt (otherwise too high) buttonNames: unitsList, default: "points", borderOnButtons: FALSE, notifyClientProc: ChangeUnits, clientdata: newValueAndUnits, style: flipThru ]; newValueAndUnits.originalUnits _ "points"; END; ChangeUnits: ChoiceButtons.SelectionNotifierProc = BEGIN valueAndUnits: ValueAndUnitsRef _ NARROW[clientdata]; newValue: REAL; IF valueAndUnits.valueData.textViewer.newVersion THEN { valueAndUnits.originalValue _ newValue _ StyleToolConvert.GetRealFromViewer[ valueAndUnits.valueData.textViewer! BadNumber => GOTO Leave]; valueAndUnits.originalUnits _ PrevRope[unitsList, name]; } ELSE newValue _ valueAndUnits.originalValue; newValue _ StyleToolConvert.ConvertUnits[newValue, valueAndUnits.originalUnits, name]; DisplayRealInViewer[newValue, valueAndUnits.valueData.textViewer]; valueAndUnits.valueData.textViewer.newVersion _ FALSE; EXITS Leave => RETURN; END; ChangeLeading: ChoiceButtons.SelectionNotifierProc = BEGIN leadingInfo: LeadingRef _ NARROW[clientdata]; leadingValue, stretchValue, shrinkValue: REAL; IF leadingInfo.leading.valueData.textViewer.newVersion THEN { leadingInfo.leading.originalValue _ leadingValue _ StyleToolConvert.GetRealFromViewer[leadingInfo.leading.valueData.textViewer ! BadNumber => GOTO Leave]; leadingInfo.leading.originalUnits _ PrevRope[unitsList, name]; } ELSE leadingValue _ leadingInfo.leading.originalValue; IF leadingInfo.stretch.textViewer.newVersion THEN leadingInfo.originalStretch _ stretchValue _ StyleToolConvert.GetRealFromViewer[ leadingInfo.stretch.textViewer ! BadNumber => GOTO Leave] ELSE stretchValue _ leadingInfo.originalStretch; IF leadingInfo.shrink.textViewer.newVersion THEN leadingInfo.originalShrink _ shrinkValue _ StyleToolConvert.GetRealFromViewer[ leadingInfo.shrink.textViewer ! BadNumber => GOTO Leave] ELSE shrinkValue _ leadingInfo.originalShrink; leadingValue _ StyleToolConvert.ConvertUnits[leadingValue, leadingInfo.leading.originalUnits, name]; stretchValue _ StyleToolConvert.ConvertUnits[stretchValue, leadingInfo.leading.originalUnits, name]; shrinkValue _ StyleToolConvert.ConvertUnits[shrinkValue, leadingInfo.leading.originalUnits, name]; DisplayRealInViewer[leadingValue, leadingInfo.leading.valueData.textViewer]; leadingInfo.leading.valueData.textViewer.newVersion _ FALSE; DisplayRealInViewer[stretchValue, leadingInfo.stretch.textViewer]; DisplayRealInViewer[shrinkValue, leadingInfo.shrink.textViewer]; leadingInfo.leading.valueData.textViewer.newVersion _ FALSE; leadingInfo.stretch.textViewer.newVersion _ FALSE; leadingInfo.shrink.textViewer.newVersion _ FALSE; EXITS Leave => RETURN; END; PrevRope: PROCEDURE [ropeList: ChoiceButtons.ButtonList, currentName: Rope.ROPE] RETURNS [prev: Rope.ROPE] = BEGIN eachName: ChoiceButtons.ButtonList; IF ropeList # NIL THEN { prev _ ropeList.first; eachName _ ropeList.rest; } ELSE SIGNAL EmptyList; WHILE (eachName # NIL) AND (eachName.first # currentName) DO prev _ eachName.first; eachName _ eachName.rest; ENDLOOP; IF (eachName = NIL) AND (ropeList.first # currentName) THEN SIGNAL CurrentNameNotInList; END; BuildDivider: PROC [name: Rope.ROPE _ NIL, container: Containers.Container, y: INTEGER] = BEGIN dividerLabel: Labels.Label_Labels.Create[ info:[name: name, parent: container, wy: y, border: TRUE], font: smallLabelFont]; Labels.SetDisplayStyle[dividerLabel, $BlackOnGrey]; Containers.ChildXBound[container, dividerLabel]; END; BuildDisplayViewer: PUBLIC PROC [handle: StyleToolHandle] = BEGIN BuildFontInfo: PROCEDURE[handle: StyleToolHandle] = BEGIN width: INTEGER = 400; otherY: INTEGER; -- y position of non-standard font name label, computed later tempLabel: Labels.Label; -- temporary placeholder for font face label nextX: INTEGER _ 0; -- used for placing font face buttons BuildDivider["FONT INFORMATION:", handle.outer, handle.height]; handle.height _ handle.height + entryHeight + entryVSpace; handle.display.fontFamilyChoice _ ChoiceButtons.BuildEnumTypeSelection[ viewer: handle.outer, x: 0, y: handle.height, title: "Font Family: ", buttonNames: fontFamilyList, notifyClientProc: FontFamilyCheck, clientdata: handle, style: menuSelection, allInOneRow: FALSE, maxWidth: width -- just a guess ]; handle.height _ handle.display.fontFamilyChoice.nexty + entryVSpace; otherY _ handle.height - entryVSpace - entryHeight + 2; handle.display.fontFamilyOtherLabel _ Labels.Create[[wx: midway, wy: otherY, ww: VFonts.StringWidth["Font Name: "], wh: entryHeight, parent: handle.outer, border: FALSE]]; handle.display.fontFamilyOtherViewer _ ViewerTools.MakeNewTextViewer[[parent: handle.outer, wx: handle.display.fontFamilyOtherLabel.wx + handle.display.fontFamilyOtherLabel.ww + 6, wy: otherY + 2, wh: entryHeight, scrollable: FALSE, border: FALSE]]; Containers.ChildXBound[handle.outer, handle.display.fontFamilyOtherViewer]; tempLabel _ Labels.Create[[name: "Font Face: ", parent: handle.outer, wy: handle.height, wh: entryHeight, border: FALSE]]; nextX _ tempLabel.wx + tempLabel.ww + entryHSpace; [handle.display.boldFontFace, nextX] _ ChoiceButtons.BuildTriStateButton[handle.outer, nextX, handle.height, "Bold"]; [handle.display.italicFontFace, nextX] _ ChoiceButtons.BuildTriStateButton[handle.outer, nextX, handle.height, "Italic"]; handle.display.fontSizeInfo _ BuildValueAndUnits[container: handle.outer, x: midway, y: handle.height - 4, itemTitle: "Font Size:"]; -- subtract 4 from y value to align handle.height _ handle.height + entryHeight + entryVSpace; handle.display.fontAlphabetsChoice _ ChoiceButtons.BuildEnumTypeSelection[ handle.outer, 0, handle.height, "Font Alphabets:", fontAlphabetsList, NIL, TRUE, NIL, NIL, NIL, menuSelection]; handle.height _ handle.height + entryHeight + entryVSpace; handle.display.fontUnderliningChoice _ ChoiceButtons.BuildEnumTypeSelection[handle.outer, 0,handle.height,"Font Underlining:", fontUnderliningList, NIL, TRUE, NIL, NIL, NIL, menuSelection]; handle.height _ handle.height + entryHeight + entryVSpace; END; BuildIndentInfo: PROCEDURE[handle: StyleToolHandle] = BEGIN space: CARDINAL _ 4; BuildRow: PROC [name1, name2: Rope.ROPE] RETURNS [v1, v2: ValueAndUnitsRef] = BEGIN v1 _ BuildValueAndUnits[container: handle.outer, y: handle.height, itemTitle: name1]; v2 _ BuildValueAndUnits[container: handle.outer, x: midway, y: handle.height, itemTitle: name2]; handle.height _ handle.height + lineSpace; END; BuildDivider["INDENT INFORMATION:", handle.outer, handle.height]; handle.height _ handle.height + entryHeight; [handle.display.leftIndentInfo, handle.display.rightIndentInfo] _ BuildRow["Left Indent:", "Right Indent: "]; [handle.display.firstIndentInfo, handle.display.restIndentInfo] _ BuildRow["First Indent:", "Rest Indent: "]; [handle.display.topIndentInfo, handle.display.bottomIndentInfo]_ BuildRow["Top Indent: ", "Bottom Indent:"]; handle.height _ handle.height + extraSpace; END; BuildLeadingInfo: PROCEDURE[handle: StyleToolHandle] = BEGIN height: CARDINAL _ 0; BuildStretchAndShrink: PROC RETURNS[stretchData, shrinkData: ChoiceButtons.PromptDataRef] = { stretchData _ ChoiceButtons.BuildTextPrompt[ viewer: handle.display.stretchShrinkContainer, x: 0, y: height, title: "stretch:", textViewerWidth: realWidth]; shrinkData _ ChoiceButtons.BuildTextPrompt[ viewer: handle.display.stretchShrinkContainer, x: stretchData.newx, y: height, title: "shrink:", textViewerWidth: realWidth]; }; BuildDivider["LEADING INFORMATION:", handle.outer, handle.height]; handle.height _ handle.height + entryHeight; handle.display.leadingContainer _ Containers.Create[[wy: handle.height, scrollable: FALSE, border: FALSE, parent: handle.outer]]; Containers.ChildXBound[handle.outer, handle.display.leadingContainer]; handle.display.stretchShrinkContainer _ Containers.Create[[wx: stretchShrinkStart, scrollable: FALSE, border: FALSE, parent: handle.display.leadingContainer]]; Containers.ChildXBound[handle.display.leadingContainer, handle.display.stretchShrinkContainer]; Containers.ChildYBound[handle.display.leadingContainer, handle.display.stretchShrinkContainer]; handle.display.leadingInfo _ NEW[LeadingRec]; handle.display.leadingInfo.leading _ NEW[ValueAndUnitsRec]; handle.display.leadingInfo.leading.valueData _ ChoiceButtons.BuildTextPrompt[ viewer: handle.display.leadingContainer, y: height, title:"Leading: ", textViewerWidth: realWidth]; handle.display.leadingInfo.leading.units _ ChoiceButtons.BuildEnumTypeSelection [viewer: handle.display.leadingContainer, x: handle.display.leadingInfo.leading.valueData.newx + 5, y: height + 2, buttonNames: unitsList, default: "points", borderOnButtons: FALSE, notifyClientProc: ChangeLeading, clientdata: handle.display.leadingInfo, style: flipThru]; [handle.display.leadingInfo.stretch, handle.display.leadingInfo.shrink] _ BuildStretchAndShrink[]; height _ height + lineSpace; handle.display.topLeadingInfo _ NEW[LeadingRec]; handle.display.topLeadingInfo.leading _ NEW[ValueAndUnitsRec]; handle.display.topLeadingInfo.leading.valueData _ ChoiceButtons.BuildTextPrompt[ viewer: handle.display.leadingContainer, y: height, title:"Top Leading: ", textViewerWidth: realWidth]; handle.display.topLeadingInfo.leading.units _ ChoiceButtons.BuildEnumTypeSelection[ viewer: handle.display.leadingContainer, x: handle.display.topLeadingInfo.leading.valueData.newx + 5, y: height + 2, buttonNames: unitsList, default: "points", borderOnButtons: FALSE, notifyClientProc: ChangeLeading,clientdata: handle.display.topLeadingInfo,style: flipThru]; [handle.display.topLeadingInfo.stretch, handle.display.topLeadingInfo.shrink] _ BuildStretchAndShrink[]; height _ height + lineSpace; handle.display.bottomLeadingInfo _ NEW[LeadingRec]; handle.display.bottomLeadingInfo.leading _ NEW[ValueAndUnitsRec]; handle.display.bottomLeadingInfo.leading.valueData _ ChoiceButtons.BuildTextPrompt[ viewer: handle.display.leadingContainer,y: height, title:"Bottom Leading:", textViewerWidth: realWidth]; handle.display.bottomLeadingInfo.leading.units _ ChoiceButtons.BuildEnumTypeSelection[ viewer: handle.display.leadingContainer, x: handle.display.bottomLeadingInfo.leading.valueData.newx + 5, y: height + 2, buttonNames: unitsList, default: "points", borderOnButtons: FALSE, notifyClientProc: ChangeLeading, clientdata: handle.display.bottomLeadingInfo, style: flipThru]; [handle.display.bottomLeadingInfo.stretch, handle.display.bottomLeadingInfo.shrink] _ BuildStretchAndShrink[]; height _ height + lineSpace + extraSpace; handle.height _ handle.height + height; ViewerOps.EstablishViewerPosition[handle.display.leadingContainer, 0, handle.display.leadingContainer.wy, handle.display.leadingContainer.ww, height]; ViewerOps.EstablishViewerPosition[handle.display.stretchShrinkContainer, handle.display.stretchShrinkContainer.wx, handle.display.stretchShrinkContainer.wy, handle.display.stretchShrinkContainer.ww, handle.display.stretchShrinkContainer.wh]; END; BuildMiscInfo: PROCEDURE[handle: StyleToolHandle] = BEGIN BuildDivider["MISCELLANEOUS INFORMATION:", handle.outer, handle.height]; handle.height _ handle.height + entryHeight; handle.display.minLineGapInfo _ BuildValueAndUnits[container: handle.outer, y: handle.height, itemTitle: "Minimum distance between tops and bottoms of lines:"]; handle.height _ handle.height + lineSpace; handle.display.vshiftInfo _ BuildValueAndUnits[container: handle.outer, y: handle.height, itemTitle: "Distance to raise text above baseline:"]; handle.height _ handle.height + lineSpace; handle.display.tabStopsViewer _ ChoiceButtons.BuildTextPrompt[viewer: handle.outer, y: handle.height, title: "Number of spaces equivalent to one tab:", textViewerWidth: realWidth].textViewer; handle.height _ handle.height + lineSpace + extraSpace; handle.display.lineFormattingChoice _ ChoiceButtons.BuildEnumTypeSelection[handle.outer, 0, handle.height, "Line Formatting:", lineFormattingList, NIL, TRUE, NIL, NIL, NIL, menuSelection]; handle.height _ handle.height + entryHeight + entryVSpace; END; BuildArtworkInfo: PROCEDURE[handle: StyleToolHandle] = BEGIN AddEntry: PROCEDURE [name: Rope.ROPE] RETURNS [v: ViewerClasses.Viewer] = BEGIN v _ ChoiceButtons.BuildTextPrompt[viewer: handle.outer, y: handle.height, title: name, textViewerWidth: realWidth].textViewer; handle.height _ handle.height + lineSpace; END; BuildDivider["TIOGA ARTWORK INFORMATION:", handle.outer, handle.height]; handle.height _ handle.height + entryHeight + entryVSpace; handle.display.pathTypeChoice _ ChoiceButtons.BuildEnumTypeSelection[handle.outer, 0, handle.height, "Path Type:", pathTypeList, NIL, FALSE, NIL, NIL, NIL, menuSelection]; handle.height _ handle.height + entryHeight + entryVSpace; handle.display.areaHueViewer _ AddEntry["Area Hue:"]; handle.display.areaSaturationViewer _ AddEntry["Area Saturation:"]; handle.display.areaBrightnessViewer _ AddEntry["Area Brightness:"]; handle.display.outlineHueViewer _ AddEntry["Outline Hue:"]; handle.display.outlineSaturationViewer _ AddEntry["Outline Saturation:"]; handle.display.outlineBrightnessViewer _ AddEntry["Outline Brightness:"]; handle.display.textHueViewer _ AddEntry["Text Hue:"]; handle.display.textSaturationViewer _ AddEntry["Text Saturation:"]; handle.display.textBrightnessViewer _ AddEntry["Text Brightness:"]; handle.display.textRotationViewer _ AddEntry["Text Rotation:"]; handle.display.lineWeightViewer _ AddEntry["Line Weight:"]; END; BuildFontInfo[handle]; BuildIndentInfo[handle]; BuildLeadingInfo[handle]; BuildMiscInfo[handle]; END; FontFamilyCheck: ChoiceButtons.SelectionNotifierProc = BEGIN handle: StyleToolHandle _ NARROW[clientdata]; IF Rope.Equal[name, "other", FALSE] THEN {-- put up the font name field for user type in Labels.Set[handle.display.fontFamilyOtherLabel, "Font Name:"]; ViewerTools.SetSelection[handle.display.fontFamilyOtherViewer]; } ELSE { Labels.Set[handle.display.fontFamilyOtherLabel, ""]; ViewerTools.SetContents[handle.display.fontFamilyOtherViewer, ""]; }; END; BuildSwapArea: PUBLIC PROCEDURE [handle: StyleToolHandle] = BEGIN handle.swap.outer _ Containers.Create[[wy: handle.height, scrollable: FALSE, border: FALSE, parent: handle.outer]]; Containers.ChildXBound[handle.outer, handle.swap.outer]; Containers.ChildYBound[handle.outer, handle.swap.outer]; BuildPenaltyInfo[handle]; BuildPageInfo[handle]; BuildJaMCodeViewer[handle]; ViewerOps.EstablishViewerPosition[handle.swap.outer, 0, handle.swap.outer.wy, handle.swap.outer.ww, handle.swap.height]; handle.height _ handle.height + handle.swap.height; END; BuildPenaltyInfo: PROC [handle: StyleToolHandle] = BEGIN SetUp: PROC [name: Rope.ROPE, x: INTEGER _ 0] RETURNS [v: ViewerClasses.Viewer] = { v _ ChoiceButtons.BuildTextPrompt[viewer: handle.swap.penalty.outer, x: x, y: handle.swap.penalty.height, title: name, textViewerWidth: realWidth].textViewer; }; SetUpRow: PROC [name1, name2: Rope.ROPE] RETURNS [v1, v2: ViewerClasses.Viewer] = { v1 _ SetUp[name1, 0]; v2 _ SetUp[name2, midway]; handle.swap.penalty.height _ handle.swap.penalty.height + lineSpace; }; handle.swap.penalty.outer _ Containers.Create[[wy: handle.swap.height, scrollable: FALSE, border: FALSE, parent: handle.swap.outer]]; Containers.ChildXBound[handle.swap.outer, handle.swap.penalty.outer]; BuildDivider["PAGE BREAK PENALTY INFORMATION:", handle.swap.penalty.outer, handle.swap.penalty.height]; handle.swap.penalty.height _ handle.swap.penalty.height + entryHeight; handle.swap.penalty.pageBreakPenalty _ SetUp["Page Break Penalty:"]; handle.swap.penalty.height _ handle.swap.penalty.height + lineSpace; [handle.swap.penalty.afterFirstLinePenalty, handle.swap.penalty.beforeLastLinePenalty] _ SetUpRow["After First Line Penalty:", "Before Last Line Penalty:"]; [handle.swap.penalty.beforeFirstLinePenalty, handle.swap.penalty.afterLastLinePenalty] _ SetUpRow["Before First Line Penalty:", "After Last Line Penalty:"]; ViewerOps.EstablishViewerPosition[handle.swap.penalty.outer, 0, handle.swap.penalty.outer.wy, handle.swap.penalty.outer.ww, handle.swap.penalty.height]; handle.swap.height _ handle.swap.height + handle.swap.penalty.height + 2; END; BuildPageInfo: PROCEDURE[handle: StyleToolHandle] = BEGIN AddRow: PROC [name1, name2: Rope.ROPE] RETURNS [v1, v2: ValueAndUnitsRef] = BEGIN v1 _ BuildValueAndUnits[container: handle.swap.layout.outer, y: handle.swap.layout.height, itemTitle: name1]; v2 _ BuildValueAndUnits[container: handle.swap.layout.outer, x: midway, y: handle.swap.layout.height, itemTitle: name2]; handle.swap.layout.height _ handle.swap.layout.height + lineSpace; END; BuildPageLayoutDivider: PROCEDURE = BEGIN tempButton: Buttons.Button _ NIL; tempLabel, dividerLabel: Labels.Label; startButtons: CARDINAL _ 250; spaceBetweenButtons: CARDINAL _ 16; handle.swap.layoutHeader.outer _ Containers.Create[[wy: handle.swap.height, scrollable: FALSE, border: FALSE, parent: handle.swap.outer]]; Containers.ChildXBound[handle.swap.outer, handle.swap.layoutHeader.outer]; dividerLabel _ Labels.Create[info: [ww: startButtons, wh: dividerHeight, name: "PAGE LAYOUT INFORMATION:", parent: handle.swap.layoutHeader.outer, border: TRUE], font: smallLabelFont]; Labels.SetDisplayStyle[dividerLabel, $BlackOnGrey]; handle.swap.layout.parametersButton _ Buttons.Create[info: [wx: startButtons, wh: dividerHeight, name: "Parameters", border: TRUE, parent: handle.swap.layoutHeader.outer], proc: ShowPageLayoutParams, clientData: handle, font: smallLabelFont]; Buttons.SetDisplayStyle[handle.swap.layout.parametersButton, $BlackOnWhite]; tempLabel _ Labels.Create[info: [wx: handle.swap.layout.parametersButton.wx + handle.swap.layout.parametersButton.ww, ww: spaceBetweenButtons, wh: dividerHeight, parent: handle.swap.layoutHeader.outer, border: TRUE]]; Labels.SetDisplayStyle[tempLabel, $BlackOnGrey]; tempButton _ Buttons.Create[info: [wx: tempLabel.wx + tempLabel.ww, wh: dividerHeight, name: "Graphics", border: TRUE, parent: handle.swap.layoutHeader.outer], proc: StartGraphics, clientData: handle, font: smallLabelFont]; Buttons.SetDisplayStyle[tempButton, $BlackOnWhite]; tempLabel _ Labels.Create[info: [wx: tempButton.wx + tempButton.ww, wh: dividerHeight, parent: handle.swap.layoutHeader.outer, border: TRUE]]; Labels.SetDisplayStyle[tempLabel, $BlackOnGrey]; Containers.ChildXBound[handle.swap.layoutHeader.outer, tempLabel]; handle.swap.layoutHeader.height _ handle.swap.layoutHeader.height + entryHeight; handle.swap.height _ handle.swap.height + handle.swap.layoutHeader.height; ViewerOps.EstablishViewerPosition[handle.swap.layoutHeader.outer, handle.swap.layoutHeader.outer.wx, handle.swap.layoutHeader.outer.wy, handle.swap.layoutHeader.outer.ww, handle.swap.layoutHeader.height]; END; BuildPageLayoutDivider[]; handle.swap.layout.outer _ Containers.Create[[wy: handle.swap.height, scrollable: FALSE, border: FALSE, parent: handle.swap.outer]]; Containers.ChildXBound[handle.swap.outer, handle.swap.layout.outer]; [handle.swap.layout.pageWidth, handle.swap.layout.pageLength] _ AddRow["Page Width:", "Page Length:"]; [handle.swap.layout.leftMargin, handle.swap.layout.rightMargin] _ AddRow["Left Margin:", "Right Margin:"]; [handle.swap.layout.topMargin, handle.swap.layout.bottomMargin] _ AddRow["Top Margin:", "Bottom Margin:"]; handle.swap.layout.bindingMargin _ BuildValueAndUnits[container: handle.swap.layout.outer, y: handle.swap.layout.height, itemTitle: "Binding Margin:"]; handle.swap.layout.height _ handle.swap.layout.height + lineSpace; ViewerOps.EstablishViewerPosition[handle.swap.layout.outer, LAST[INTEGER], handle.swap.layout.outer.wy, handle.swap.layout.outer.ww, handle.swap.layout.height]; handle.swap.height _ handle.swap.height + 6; END; ShowPageLayoutParams: Buttons.ButtonProc = { handle: StyleToolHandle _ NARROW[clientData]; IF handle.layoutGraphics.exists THEN RETURN; -- dont show params if doing graphical layout IF handle.swap.layout.visible THEN { handle.swap.layout.visible _ FALSE; Buttons.SetDisplayStyle[NARROW[parent], $BlackOnWhite]; ViewerOps.MoveViewer[handle.swap.layout.outer, LAST[INTEGER], handle.swap.layout.outer.wy, handle.swap.layout.outer.ww, handle.swap.layout.outer.wh]; ViewerOps.MoveViewer[handle.swap.jamCodeInfo.outer, 0, handle.swap.layoutHeader.outer.wy + handle.swap.layoutHeader.outer.wh + 6, handle.swap.jamCodeInfo.outer.ww, handle.swap.jamCodeInfo.outer.wh]; } ELSE { handle.swap.layout.visible _ TRUE; Buttons.SetDisplayStyle[NARROW[parent], $WhiteOnBlack]; ViewerOps.MoveViewer[handle.swap.layout.outer, 0, handle.swap.layout.outer.wy, handle.swap.layout.outer.ww, handle.swap.layout.outer.wh]; ViewerOps.MoveViewer[handle.swap.jamCodeInfo.outer, 0, handle.swap.layout.outer.wy + handle.swap.layout.outer.wh + 6, handle.swap.jamCodeInfo.outer.ww, handle.swap.jamCodeInfo.outer.wh]; }; }; StartGraphics: Buttons.ButtonProc = { handle: StyleToolHandle _ NARROW[clientData]; IF handle.layoutGraphics.exists THEN { MessageWindow.Append["A page layout graphics viewer already exists!", TRUE]; MessageWindow.Blink[]; } ELSE { handle.layoutGraphics.exists _ TRUE; IF handle.swap.layout.visible THEN { ViewerOps.MoveViewer[handle.swap.layout.outer, LAST[INTEGER], handle.swap.layout.outer.wy, handle.swap.layout.outer.ww, handle.swap.layout.outer.wh]; ViewerOps.MoveViewer[handle.swap.jamCodeInfo.outer, 0, handle.swap.layoutHeader.outer.wy + handle.swap.layoutHeader.outer.wh + 6, handle.swap.jamCodeInfo.outer.ww, handle.swap.jamCodeInfo.outer.wh]; handle.swap.layout.visible _ FALSE; Buttons.SetDisplayStyle[handle.swap.layout.parametersButton, $BlackOnWhite]; }; StyleToolGraphics.CreateLayoutContainer[handle]; }; }; BuildJaMCodeViewer: PROC [handle: StyleToolHandle] = BEGIN handle.swap.jamCodeInfo.outer _ Containers.Create[[wy: handle.swap.height + extraSpace, scrollable: FALSE, border: TRUE, parent: handle.swap.outer]]; Containers.ChildXBound[handle.swap.outer, handle.swap.jamCodeInfo.outer]; Containers.ChildYBound[handle.swap.outer, handle.swap.jamCodeInfo.outer]; BuildDivider["JaM CODE CORRESPONDING TO ABOVE STYLE:", handle.swap.jamCodeInfo.outer, 0]; handle.swap.jamCodeInfo.text _ ViewerOps.CreateViewer[ flavor: $Text, info: [wy: entryHeight + extraSpace, scrollable: TRUE, iconic: FALSE, border: FALSE, parent: handle.swap.jamCodeInfo.outer] ]; Containers.ChildXBound[handle.swap.jamCodeInfo.outer, handle.swap.jamCodeInfo.text]; Containers.ChildYBound[handle.swap.jamCodeInfo.outer, handle.swap.jamCodeInfo.text]; ViewerTools.InhibitUserEdits[handle.swap.jamCodeInfo.text]; ViewerOps.EstablishViewerPosition[handle.swap.jamCodeInfo.outer, 0, handle.swap.jamCodeInfo.outer.wy, handle.swap.jamCodeInfo.outer.ww, handle.swap.jamCodeInfo.outer.wh]; handle.swap.height _ handle.swap.height + handle.swap.jamCodeInfo.outer.wh; END; END. StyleToolBuildersImpl.mesa; Written by Linda Gass on August 9, 1982 9:48 am Last Edit by Linda Gass on November 4, 1982 2:25 pm Last Edited by: Plass, March 28, 1983 2:57 pm Last Edited by: Beach, February 22, 1984 3:28:53 pm PST Pavel, June 26, 1985 2:49:54 pm PDT -- ---- ---- ---- ---- ---- ---- ---- place in the upper right hand corner of the Style Tool depending upon which rule button was selected, display different information dont bother to move any viewers if not necessary -- ---- ---- ---- ---- ---- ---- ---- this gets called with the newly chosen units (name). Now redisplay the new value this gets called with the newly chosen units (name). Now redisplay the new values creates a gray divider with an optional name in it. Makes the divider as wide as parent -- ---- ---- ---- ---- ---- ---- ---- The following has been replaced by experiment Tri-State buttons handle.display.fontFaceChoice _ ChoiceButtons.BuildEnumTypeSelection[handle.outer, 0, handle.height, "Font Face: ", fontFaceList, NIL, TRUE, NIL, NIL, menuSelection]; handle.height _ handle.height + entryHeight + space; Build a separate container for the leading since we will want to move the stretch and shrink fields out of the way if we are specifying a screen rule BuildArtworkInfo[handle]; -- ---- ---- ---- ---- ---- ---- ---- make sure the font name field doesn't exist -- ---- ---- ---- ---- ---- ---- ---- now put the buttons on page layout divider [handle.swap.layout.headerMargin, handle.swap.layout.footerMargin] _ AddRow["Header Margin:", "Footer Margin:"]; -- temporarily not used handle.swap.layout.lineLength _ BuildValueAndUnits[container: handle.swap.layout.outer, y: handle.swap.layout.height, itemTitle: "Line Length:"]; handle.swap.layout.height _ handle.swap.layout.height + lineSpace; -- temporarily not used handle.swap.layout.column _ ChoiceButtons.BuildTextPrompt[viewer: handle.swap.layout.outer, y: handle.swap.layout.height, title: "Number of columns:", textViewerWidth: realWidth].textViewer; handle.swap.layout.height _ handle.swap.layout.height + lineSpace; -- temporarily not used increase the swap height only by the divider width as we dont want the page layout info to be displayed initially Move the Page Layout viewer into oblivion and move the Jam Code Viewer up Move the page layout viewer into view and move the Jam Code Viewer down In the future we will probably want to check that there isn't an instance of the graphics viewer already in existence (ie - another instance of the style tool created a graphics viewer). If there is one in existence already, graphics is likely to get confused. Make sure that the parameters for page layout inside the style tool are not visible. This could cause some confusion for the user. Move the Page Layout viewer into oblivion and move the Jam Code Viewer up Κη˜Jšœ™J™/J™3Jšœ-™-šœ7™7Icode™#—JšΟk ˜ ˜Jšœœ/˜<šœœ?˜RJ˜2—Jšœ œ/˜?Jšœœ˜Jšœœ'˜3Jšœœ˜$Jšœœ œ˜J˜J˜Jšœœ#˜9Jšœœ˜0Jšœœ/˜;Jšœœ ˜Jšœ œ5˜DJšœ œB˜SJ˜—Jšœœ˜$J˜Jšœ%œr˜ Jšœ˜J˜Jšœœ"˜,J˜šœXœ˜]Jšœœœ˜'—šœYœ˜^Jšœœœ˜'—šœVœ ˜cJšœœ˜—šœUœ ˜cJšœœ˜—J˜JšœœΟc:˜_Jšœ œž$˜RJ˜Jšœ œ ž"˜@Jšœ œž/˜XJšœœ ž˜6J˜Jšœ œœ˜Jšœ œœ˜Jšœœœ˜$Jšœœ ž)˜MJšœœ ž(˜CJšœ%™%šΟnœœ œ˜FJ˜5J˜J˜J˜J˜J˜J˜%J˜—Jšœ8ž˜LJšœ˜šŸœœœ˜BJ˜]J˜U—Jšœ9ž˜MJšœ˜šŸœœ œ˜CJ˜YJ˜O—J˜4Jšœ˜šŸœœ œ˜BJšœ6™6—˜JšœΛœ'˜χ—Jšœ˜˜6šœL™LJšœœ˜——Jšœœ ˜-šœœ˜šœ%ž"˜GJšœž4˜GJ˜šœ$œœ˜DJšœ%ž(˜M—šœ)œœ˜NJ˜.—šœ#œœ˜BJ˜"—˜FJ˜—šœ<œœ˜JJ˜)J˜)J˜*—J˜—˜AJšœž4˜Gšœœœœ˜*Jšœ0™0šœ˜J˜KJ˜+—šœC˜GJ˜G—˜JJ˜—˜BJ˜.—šœ˜˜GJ˜——˜OJ˜)J˜)J˜*—J˜—J˜—Jšœœ˜—J˜Jšœ%™%š Ÿœœ œœ˜SJšœœœ ˜E—Jšœ˜š Ÿœœ œœ˜UJšœœœ ˜A—Jšœ˜šŸœ œ(œœœœœ(˜»Jšœœ˜)—˜;J˜J˜ J˜J˜J˜J˜—˜?J˜J˜'Jšœ žP˜[J˜J˜Jšœœ˜J˜J˜J˜J˜—J˜*Jšœ˜šœ3˜8Jšœ6™6—˜Jšœ"œ ˜5—Jšœ œ˜šœ/œ˜7˜LJšœ1œ˜=—J˜8J˜—Jšœ(˜,J˜J˜VJšœ™J˜BJšœ0œ˜6Jšœ œ˜Jšœ˜šœ5˜:Jšœ4™4Jšœœ ˜-—Jšœ)œ˜.šœ5œ˜=˜2J˜KJšœœ˜—J˜>J˜—Jšœ2˜6J˜šœ+œ˜2˜PJšœ.œ˜9——Jšœ,˜0J˜šœ*œ˜1˜NJšœ-œ˜8——Jšœ*˜.J˜˜:J˜)—˜:J˜)—˜8J˜)—Jšœ™J˜LJšœ6œ˜˜PJ˜LJ˜—˜SJ˜(J˜J˜?J˜—šœ˜Jšœ+™+J˜4J˜BJ˜—Jšœ˜Jšœ%™%šŸ œœ œ˜AJšœFœ œ˜[J˜—J˜8J˜8J˜J˜J˜˜MJ˜*—J˜3Jšœ˜šŸœœ˜8š Ÿœœ œœœ˜SJ˜J—J˜S—˜šŸœœœœ%˜UJ˜——J˜J˜D˜JšœSœ˜YJšœœ˜+—J˜E˜JJ˜—J˜FJ˜J˜DJ˜D˜XJ˜E—˜XJ˜C—˜]J˜:—J˜IJšœ˜šŸ œ œ˜9š Ÿœœœœ˜QJ˜Z—J˜—˜GJ˜0—J˜Bšœ˜šŸœ œ˜)Jšœœ˜!——J˜&Jšœœ˜Jšœœ˜#˜KJšœ œ œ˜>—J˜J˜HJ˜IJšœœ˜%—J˜3J˜Jšœ*™*˜tJšœœF˜RJ˜*—J˜L˜uJ˜SJšœœ˜—J˜0˜VJšœœ*˜HJ˜?—J˜3˜VJšœ0œ˜7—J˜0J˜BJ˜PJ˜J˜AJ˜EJ˜D—šœ˜J˜J˜—šœRœ˜XJšœœ˜+—˜DJ˜—˜UJ˜—˜XJ˜—˜WJ˜šœˆ™ˆJ˜Z—J˜<—˜BJšœ‘™‘—J™ZJ˜™[J™KJ™—™ZJšœ<œœ˜JJ˜U—Jšœq™qJ˜,Jšœ˜˜-Jšœœ ˜-Jšœœœž-˜Zšœœ˜$Jšœœ˜#šœœ˜7JšœI™IJšœ/œœ˜=J˜W—˜6J˜JJ˜D—J˜——šœ˜Jšœœ˜"šœœ˜7JšœG™GJ˜NJ˜:—˜6J˜>J˜D—J˜—J˜J˜%˜Jšœœ ˜-—šœœ˜&JšœFœ˜LJ˜J˜—šœ˜šœœ˜&Jšœ…™…šœƒ™ƒJšœœ˜&———˜JšœI™IJšœ/œœ˜=J˜W—˜6J˜JJ˜D—Jšœœ˜#J˜L˜J˜0—J˜˜J˜—šŸœœ˜;J˜WJšœ œ œ˜=—J˜IJ˜IJ˜Y˜6J˜˜%Jšœ œ˜Jšœ œ˜Jšœœ˜J˜&J˜——J˜TJ˜TJ˜;˜CJ˜CJ˜"—J˜KJšœ˜J˜Jšœ˜—…—qŒ