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 { -- dont bother to move any viewers if not necessary 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]; -- Now redisplay the new value 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]; -- Now redisplay the new values 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]; -- BuildArtworkInfo[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 { -- make sure the font name field doesn't exist 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]; -- now put the buttons on page layout divider 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]; -- increase the swap height only by the divider width as we dont want the page layout info to be displayed initially 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 place in the upper right hand corner of the Style Tool depending upon which rule button was selected, display different information this gets called with the newly chosen units (name). this gets called with the newly chosen units (name). 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 [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 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 Κ Η– "cedar" style˜Iprocšœ™J™-J™7KšoΟk œ œAœ…œ3œœ œ9œœ œ?œ9œ$œAœœEœ^œœœ%œsœœœ|œ œœ\œ œœYœ œœXœ œœœΟc;œ œž%œ œ ž#œ œž1œœ žœ œœ œœœœœ ž*œœžœ ž(˜πKšžœžœžœžœžœžœžœž˜'šΟnœœ œ˜FKšœ†žœ˜Ÿ—šŸœœœ˜BKšœξžœ˜‡—šŸœœ œ˜CKšœΰœ˜δ—šŸœœ œ˜BKšœ7™7KšœΛœ(œ˜ό—šŸ œ)˜6KšžL™LKšBœœœœœœ'ž&œž5œCœœ>ž,œ)œœLžœ#œœ:žœ€œœΪœž4œœœœœž3œœœ‡œχœœΦœœ˜ί—Kšžœžœžœžœžœžœžœž˜'š Ÿœœ œœ˜SKšœœœœ˜J—š Ÿœœ œœ˜UKšœœœ œ˜F—š Ÿœ œ(œœ œœ(˜»Kš œœΔžQœ?œ‚œ˜υ—šŸ œ(˜8Kšž7™7Kšœ"œœœ/œ„œFœžœsœœ œœ˜‚—šŸ œ(˜:Kšž4™4Kš-œœ7œœ5œ–œLœ4œ+œ„œœ.œ*œœœάž œƒœΌœ.œ-œœ œœ˜± —š Ÿœ œ8œœ œ˜rKš!œ$œ œœ9œœ œ œœ œ5œœ œœ œœœ˜β—š Ÿ œœ œœ&œ˜_KšžX™XKšœ_œœ˜θ—Kšžœžœžœžœžœžœžœž˜'šŸœœœ˜AšŸ œ œ˜9Kšœœœž>œž-œœž'œŽœžœͺœκœ œO˜Ÿ KšžŸ™ŸKšœvœ―ž$œΞœ œœœβœ œœœNœ˜‚ —šŸœ œ˜;Kšœœ˜š Ÿœœœœ˜SKšœδœ˜θKšœκœ˜ξ——šŸœ œ˜