<< StyleToolToJaMImpl.mesa Written by Linda Gass on August 9, 1982 1:22 pm Last Edit by Linda Gass on November 4, 1982 2:29 pm>> <> DIRECTORY ChoiceButtons USING [EnumTypeRef, GetSelectedButton], IO USING [EndOfStream, GetToken, CreateInputStreamFromRope, PutFToRope, real], MessageWindow USING [Append, Blink], NodeStyle USING [FontFace, GetBindingMargin, GetBottomIndent, GetBottomLeading, GetBottomLeadingShrink, GetBottomLeadingStretch, GetBottomMargin, GetFirstIndent, GetFontSize, GetLeading, GetLeadingStretch, GetLeadingShrink, GetLeftIndent, GetLeftMargin, GetMinLineGap, GetPageBreakPenalty, GetPageBreakAfterFirstLinePenalty, GetPageBreakBeforeLastLinePenalty, GetPageBreakBeforeFirstLinePenalty, GetPageBreakAfterLastLinePenalty, GetPageLength, GetPageWidth, GetRestIndent, GetRightIndent, GetRightMargin, GetTabStops, GetTopIndent, GetTopLeading, GetTopLeadingStretch, GetTopLeadingShrink, GetTopMargin, GetVShift, Ref], Real USING [FixC], Rope USING [ROPE, Cat, Equal, Size], StyleToolDefs, StyleToolConvert USING [BadNumber, ConvertUnits, FontAlphChoiceToJaM, GetFontFamily, GetFontFaceJaM, GetFontAlphabetsChoice, GetFontUnderliningChoice, FontUndChoiceToJaM, GetLineFormattingChoice, LineChoiceToJaM, GetRealFromViewer], StyleToolToJaM, VFonts USING [Error, EstablishFont], ViewerClasses USING [Viewer], ViewerTools USING [GetContents, SetContents, SetSelection]; StyleToolToJaMImpl: CEDAR PROGRAM IMPORTS ChoiceButtons, IO, MessageWindow, NodeStyle, Real, Rope, StyleToolConvert, StyleToolDefs, VFonts, ViewerTools EXPORTS StyleToolToJaM = BEGIN OPEN StyleToolDefs, StyleToolToJaM; NoName: SIGNAL = CODE; GetNameFromViewer: PRIVATE PROCEDURE [viewer: ViewerClasses.Viewer] RETURNS [nameRope: Rope.ROPE] = { nameRope _ ViewerTools.GetContents[viewer]; IF Rope.Size[nameRope] = 0 THEN SIGNAL NoName ELSE { nameRope _ GetEssentialsOfName[nameRope]; IF Rope.Size[nameRope] = 0 THEN SIGNAL NoName; }; }; GetEssentialsOfName: PRIVATE PROC [name: Rope.ROPE] RETURNS [realName: Rope.ROPE] = { << strips off leading SP, CR, ESC, LF, TAB, COMMA, SEMICOLON if they exist and returns the alpha-numeric name.>> realName _ IO.GetToken[IO.CreateInputStreamFromRope[name] ! IO.EndOfStream => CONTINUE]; <> }; WriteDisplayInfo: PUBLIC PROCEDURE [handle: StyleToolHandle, info: NodeStyle.Ref, format: BOOLEAN] = BEGIN << write out everything that doesn't correspond to the default>> displayRope: Rope.ROPE _ ""; nameRope: Rope.ROPE _ GetNameFromViewer[handle.styleNameData.textViewer ! NoName => GOTO CouldntWriteStyleName]; formatNameRope, looksRope, ruleRope: Rope.ROPE; found: BOOLEAN; << first clear out the WriteOutViewer, in case it contains any information (we don't want the user to get confused; any old information should be discarded.>> ViewerTools.SetContents[handle.swap.jamCodeInfo.text, NIL]; ruleRope _ ChoiceButtons.GetSelectedButton[handle.ruleType]; IF ~ handle.changesMode THEN { -- dont bother writing out this information if the user is just interested in changes IF format THEN { formatNameRope _ GetNameFromViewer[handle.formatNameData.textViewer ! NoName => GOTO CouldntWriteFormat]; displayRope _ Rope.Cat[displayRope, "(", formatNameRope, ") {\n"]; } ELSE { looksRope _ GetNameFromViewer[handle.looksData.textViewer ! NoName => GOTO CouldntWriteLook]; displayRope _ Rope.Cat[displayRope, "(look.", looksRope, ") {\n"]; }; }; [displayRope, found] _ AppendFontInfoRope[handle, info, displayRope]; IF found THEN { displayRope _ AppendIndentInfoRope[handle, info, displayRope]; displayRope _ AppendLeadingInfoRope[handle, info, displayRope]; displayRope _ AppendMiscInfoRope[handle, info, displayRope]; IF ~Rope.Equal[ruleRope, "ScreenRule", FALSE] THEN { displayRope _ AppendPenaltyInfoRope[handle, info, displayRope]; displayRope _ AppendPageInfoRope[handle, info, displayRope]; }; << displayRope _ AppendArtworkInfoRope[handle, info, displayRope];>> IF ~ handle.changesMode THEN displayRope _ Rope.Cat[displayRope, "} ", ruleRope, "\n"]; ViewerTools.SetContents[handle.swap.jamCodeInfo.text, displayRope]; }; EXITS CouldntWriteStyleName => {OPEN MessageWindow; Append["Couldn't write style. No valid style name given.", TRUE]; Blink[]; -- force selection into Style Name viewer ViewerTools.SetSelection[handle.styleNameData.textViewer]; }; CouldntWriteFormat => {OPEN MessageWindow; Append["Couldn't write style. No valid Format name given.", TRUE]; Blink[]; ViewerTools.SetSelection[handle.formatNameData.textViewer]; }; CouldntWriteLook => {OPEN MessageWindow; Append["Couldn't write style. No valid Look name given.", TRUE]; Blink[]; ViewerTools.SetSelection[handle.looksData.textViewer]; }; END; RopeDifferences: PRIVATE PROC[handle: StyleToolHandle, selection, default, nodeInfo: Rope.ROPE] RETURNS [BOOLEAN] = { IF handle.changesMode THEN { IF ~Rope.Equal[selection, default, FALSE] AND ~Rope.Equal[selection, nodeInfo, FALSE] THEN RETURN [TRUE] ELSE RETURN [FALSE]; } ELSE { IF ~Rope.Equal[selection, default, FALSE] THEN RETURN [TRUE] ELSE RETURN [FALSE]; }; }; RealDifferences: PRIVATE PROC[handle: StyleToolHandle, selection, default, nodeInfo: REAL] RETURNS [BOOLEAN] = { IF handle.changesMode THEN { IF (selection # default) AND (selection # nodeInfo) THEN RETURN [TRUE] ELSE RETURN [FALSE]; } ELSE { IF (selection # default) THEN RETURN [TRUE] ELSE RETURN [FALSE]; }; }; IntDifferences: PRIVATE PROC[handle: StyleToolHandle, selection, default, nodeInfo: INTEGER] RETURNS [BOOLEAN] = { IF handle.changesMode THEN { IF (selection # default) AND (selection # nodeInfo) THEN RETURN [TRUE] ELSE RETURN [FALSE]; } ELSE { IF (selection # default) THEN RETURN [TRUE] ELSE RETURN [FALSE]; }; }; AppendUnits: PRIVATE PROCEDURE [displayRope, units: Rope.ROPE] RETURNS [Rope.ROPE] = { <> SELECT TRUE FROM Rope.Equal[units, "points", FALSE] => displayRope _ Rope.Cat[displayRope, " pt"]; Rope.Equal[units, "picas", FALSE] => displayRope _ Rope.Cat[displayRope, " pc"]; Rope.Equal[units, "inches", FALSE] => displayRope _ Rope.Cat[displayRope, " in"]; Rope.Equal[units, "centimeters", FALSE] => displayRope _ Rope.Cat[displayRope, " cm"]; Rope.Equal[units, "millimeters", FALSE] => displayRope _ Rope.Cat[displayRope, " mm"]; Rope.Equal[units, "didot points", FALSE] => displayRope _ Rope.Cat[displayRope, " dd"]; Rope.Equal[units, "ems", FALSE] => displayRope _ Rope.Cat[displayRope, " em"]; Rope.Equal[units, "ens", FALSE] => displayRope _ Rope.Cat[displayRope, " en"]; Rope.Equal[units, "spaces", FALSE] => displayRope _ Rope.Cat[displayRope, " sp"]; ENDCASE; RETURN[displayRope]; }; AppendValueAndUnits: PRIVATE PROCEDURE [handle: StyleToolHandle, displayRope: Rope.ROPE, selection, default, nodeInfo: REAL, addOn: Rope.ROPE, units: ChoiceButtons.EnumTypeRef] RETURNS [Rope.ROPE] = { IF RealDifferences[handle, selection, default, nodeInfo] THEN { displayRope _ Rope.Cat[displayRope, IO.PutFToRope[realNumberFormat, IO.real[selection]]]; displayRope _ AppendUnits[displayRope, units.flipLabel.name]; displayRope _ Rope.Cat[displayRope, " ", addOn, "\n"]; } ELSE { selectionOnRope: Rope.ROPE _ ChoiceButtons.GetSelectedButton[units]; IF ~Rope.Equal[selectionOnRope, "points", FALSE] THEN { displayRope _ Rope.Cat[displayRope," ", IO.PutFToRope[realNumberFormat, IO.real[selection]]]; displayRope _ AppendUnits[displayRope,units.flipLabel.name]; displayRope _ Rope.Cat[displayRope, " ", addOn, "\n"]; }; }; RETURN [displayRope]; }; GetReal: PRIVATE PROCEDURE [valueAndUnits: ValueAndUnitsRef] RETURNS [num: REAL] = BEGIN num _ 0; -- default to zero in case there's a bad number in the viewer. We want to return -- something reasonable rather than giving an error. IF valueAndUnits.valueData.textViewer.newVersion THEN num _ StyleToolConvert.GetRealFromViewer[valueAndUnits.valueData.textViewer ! StyleToolConvert.BadNumber => CONTINUE] ELSE { num _ valueAndUnits.originalValue; num _ StyleToolConvert.ConvertUnits[num, valueAndUnits.originalUnits, valueAndUnits.units.flipLabel.name]; -- make sure we return the number converted to the current units }; END; AppendFontInfoRope: PUBLIC PROCEDURE [handle: StyleToolHandle, default: NodeStyle.Ref, displayRope: Rope.ROPE] RETURNS [returnRope: Rope.ROPE, found: BOOLEAN] = BEGIN selectionOnRope, nodeInfoRope, defaultRope: Rope.ROPE; selectionReal, nodeInfoReal, defaultReal: REAL; bold, italic: BOOLEAN; fontFamily: Rope.ROPE _ NIL; fontSize: CARDINAL; found _ TRUE; selectionOnRope _ ChoiceButtons.GetSelectedButton[handle.display.fontFamilyChoice]; IF ~Rope.Equal[selectionOnRope, "none", FALSE] THEN { -- if no font family was selected then dont bother to append anything IF Rope.Equal[selectionOnRope, "other", FALSE] THEN { selectionOnRope _ GetNameFromViewer[handle.display.fontFamilyOtherViewer]; defaultRope _ StyleToolConvert.GetFontFamily[default.name[fontFamily]].text; nodeInfoRope _ StyleToolConvert.GetFontFamily[handle.nodeInfo.name[fontFamily]].text; } ELSE { defaultRope _ StyleToolConvert.GetFontFamily[default.name[fontFamily]].name; nodeInfoRope _ StyleToolConvert.GetFontFamily[handle.nodeInfo.name[fontFamily]].name; }; fontFamily _ selectionOnRope; IF RopeDifferences[handle, selectionOnRope, defaultRope, nodeInfoRope] THEN displayRope _ Rope.Cat[displayRope, """", selectionOnRope, """", " family\n"]; }; << selectionOnRope _ ChoiceButtons.GetSelectedButton[handle.display.fontFaceChoice]; defaultRope _ StyleToolConvert.GetFontFace[default.fontFace]; nodeInfoRope _ StyleToolConvert.GetFontFace[handle.nodeInfo.fontFace]; IF RopeDifferences[handle, selectionOnRope, defaultRope, nodeInfoRope] THEN displayRope _ Rope.Cat[displayRope, selectionOnRope, " face\n"];>> [displayRope, bold, italic] _ AppendFontFace[handle, default, displayRope]; selectionReal_ GetReal[handle.display.fontSizeInfo]; defaultReal _ NodeStyle.GetFontSize[default]; nodeInfoReal _ NodeStyle.GetFontSize[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "size", handle.display.fontSizeInfo.units]; fontSize _ Real.FixC[selectionReal]; <> IF fontFamily # NIL THEN { [] _ VFonts.EstablishFont[fontFamily, fontSize, bold, italic, FALSE ! VFonts.Error => SELECT code FROM illegalFormat => CONTINUE; fontNotFound => { -- Try again with bold and italic turned off because those will -- be synthesized [] _ VFonts.EstablishFont[fontFamily, fontSize, FALSE, FALSE, FALSE ! VFonts.Error => { OPEN MessageWindow; Append["Font specified cannot be found", TRUE]; Blink[]; found _ FALSE; CONTINUE; }]; CONTINUE; }; ENDCASE => ERROR;] }; selectionOnRope _ ChoiceButtons.GetSelectedButton[handle.display.fontAlphabetsChoice]; defaultRope _ StyleToolConvert.GetFontAlphabetsChoice[default.fontAlphabets]; nodeInfoRope _ StyleToolConvert.GetFontAlphabetsChoice[handle.nodeInfo.fontAlphabets]; IF RopeDifferences[handle, selectionOnRope, defaultRope, nodeInfoRope] THEN displayRope _ Rope.Cat[displayRope, StyleToolConvert.FontAlphChoiceToJaM[selectionOnRope], " alphabets\n"]; selectionOnRope _ ChoiceButtons.GetSelectedButton[handle.display.fontUnderliningChoice]; defaultRope _ StyleToolConvert.GetFontUnderliningChoice[default.underlining]; nodeInfoRope _ StyleToolConvert.GetFontUnderliningChoice[handle.nodeInfo.underlining]; IF RopeDifferences[handle, selectionOnRope, defaultRope, nodeInfoRope] THEN displayRope _ Rope.Cat[displayRope,StyleToolConvert.FontUndChoiceToJaM[selectionOnRope], " underlining\n"]; returnRope _ displayRope; END; AppendFontFace: PROCEDURE [handle: StyleToolHandle, default: NodeStyle.Ref, displayRope: Rope.ROPE] RETURNS [returnRope: Rope.ROPE, bold, italic: BOOLEAN] = BEGIN face: NodeStyle.FontFace; bold _ italic _ FALSE; IF (handle.display.boldFontFace.state=default AND handle.display.italicFontFace.state=default) OR (handle.display.boldFontFace.state=default AND handle.display.italicFontFace.state=off) OR (handle.display.boldFontFace.state=off AND handle.display.italicFontFace.state=default) THEN RETURN[displayRope, bold, italic] -- dont do anything if default and off ELSE IF handle.display.boldFontFace.state = off AND handle.display.italicFontFace.state = off THEN face _ Regular ELSE IF handle.display.boldFontFace.state = on AND handle.display.italicFontFace.state # on THEN {face _ Bold; bold _ TRUE} ELSE IF handle.display.boldFontFace.state # on AND handle.display.italicFontFace.state = on THEN {face _ Italic; italic _ TRUE} ELSE IF handle.display.boldFontFace.state = on AND handle.display.italicFontFace.state = on THEN {face _ BoldItalic; bold _ TRUE; italic _ TRUE}; IF default.fontFace # face AND handle.nodeInfo.fontFace # face THEN displayRope _ Rope.Cat[displayRope, StyleToolConvert.GetFontFaceJaM[face], " face\n"]; returnRope _ displayRope; END; AppendIndentInfoRope: PUBLIC PROCEDURE [handle: StyleToolHandle, default: NodeStyle.Ref, displayRope: Rope.ROPE] RETURNS [Rope.ROPE] = BEGIN selectionReal, nodeInfoReal, defaultReal: REAL; selectionReal _ GetReal[handle.display.leftIndentInfo]; defaultReal _ NodeStyle.GetLeftIndent[default]; nodeInfoReal _ NodeStyle.GetLeftIndent[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "leftIndent", handle.display.leftIndentInfo.units]; selectionReal _ GetReal[handle.display.rightIndentInfo]; defaultReal _ NodeStyle.GetRightIndent[default]; nodeInfoReal _ NodeStyle.GetRightIndent[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "rightIndent", handle.display.rightIndentInfo.units]; selectionReal _ GetReal[handle.display.firstIndentInfo]; defaultReal _ NodeStyle.GetFirstIndent[default]; nodeInfoReal _ NodeStyle.GetFirstIndent[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "firstIndent", handle.display.firstIndentInfo.units]; selectionReal _ GetReal[handle.display.restIndentInfo]; defaultReal _ NodeStyle.GetRestIndent[default]; nodeInfoReal _ NodeStyle.GetRestIndent[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "restIndent", handle.display.restIndentInfo.units]; selectionReal _ GetReal[handle.display.topIndentInfo]; defaultReal _ NodeStyle.GetTopIndent[default]; nodeInfoReal _ NodeStyle.GetTopIndent[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "topIndent", handle.display.topIndentInfo.units]; selectionReal _ GetReal[handle.display.bottomIndentInfo]; defaultReal _ NodeStyle.GetBottomIndent[default]; nodeInfoReal _ NodeStyle.GetBottomIndent[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "bottomIndent", handle.display.bottomIndentInfo.units]; RETURN[displayRope]; END; AppendLeadingInfoRope: PUBLIC PROCEDURE [handle: StyleToolHandle, default: NodeStyle.Ref, displayRope: Rope.ROPE] RETURNS [Rope.ROPE] = BEGIN leadingReal, stretchReal, shrinkReal, nodeInfoReal, defaultReal: REAL; AppendGlue: PROCEDURE [displayRope: Rope.ROPE, units: ChoiceButtons.EnumTypeRef, addOn: Rope.ROPE] RETURNS [Rope.ROPE] = { measure: Rope.ROPE _ ChoiceButtons.GetSelectedButton[units]; leadingReal _ StyleToolConvert.ConvertUnits[leadingReal, measure, "points"]; stretchReal _ StyleToolConvert.ConvertUnits[stretchReal, measure, "points"]; shrinkReal _ StyleToolConvert.ConvertUnits[shrinkReal, measure, "points"]; displayRope _ Rope.Cat[displayRope, IO.PutFToRope[realNumberFormat, IO.real[leadingReal]], " ", IO.PutFToRope[realNumberFormat, IO.real[stretchReal]], " ", IO.PutFToRope[realNumberFormat, IO.real[shrinkReal]]]; displayRope _ Rope.Cat[displayRope, " ", addOn, "\n"]; RETURN[displayRope]; }; GetStretchShrink: PROC [leadingInfo: LeadingRef] RETURNS [stretch, shrink: REAL] = { stretch _ shrink _ 0; IF leadingInfo.stretch.textViewer.newVersion THEN stretch _ StyleToolConvert.GetRealFromViewer[leadingInfo.stretch.textViewer ! StyleToolConvert.BadNumber => CONTINUE] ELSE stretch _ leadingInfo.originalStretch; IF leadingInfo.shrink.textViewer.newVersion THEN shrink _ StyleToolConvert.GetRealFromViewer[leadingInfo.shrink.textViewer ! StyleToolConvert.BadNumber => CONTINUE] ELSE shrink _ leadingInfo.originalShrink; }; leadingReal _ GetReal[handle.display.leadingInfo.leading]; [stretchReal, shrinkReal] _ GetStretchShrink[handle.display.leadingInfo]; defaultReal _ NodeStyle.GetLeadingStretch[default]; nodeInfoReal _ NodeStyle.GetLeadingStretch[handle.nodeInfo]; IF RealDifferences[handle, stretchReal, defaultReal, nodeInfoReal] THEN displayRope _ AppendGlue[displayRope, handle.display.leadingInfo.leading.units, "leadingGlue"] ELSE { defaultReal _ NodeStyle.GetLeadingShrink[default]; nodeInfoReal _ NodeStyle.GetLeadingShrink[handle.nodeInfo]; IF RealDifferences[handle, shrinkReal, defaultReal, nodeInfoReal] THEN displayRope _ AppendGlue[displayRope, handle.display.leadingInfo.leading.units, "leadingGlue"] ELSE { defaultReal _ NodeStyle.GetLeading[default]; nodeInfoReal _ NodeStyle.GetLeading[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, leadingReal, defaultReal, nodeInfoReal, "leading", handle.display.leadingInfo.leading.units]; }; }; leadingReal _ GetReal[handle.display.topLeadingInfo.leading]; [stretchReal, shrinkReal] _ GetStretchShrink[handle.display.topLeadingInfo]; defaultReal _ NodeStyle.GetTopLeadingStretch[default]; nodeInfoReal _ NodeStyle.GetTopLeadingStretch[handle.nodeInfo]; IF RealDifferences[handle, stretchReal, defaultReal, nodeInfoReal] THEN displayRope _ AppendGlue[displayRope, handle.display.topLeadingInfo.leading.units, "topLeadingGlue"] ELSE { defaultReal _ NodeStyle.GetTopLeadingShrink[default]; nodeInfoReal _ NodeStyle.GetTopLeadingShrink[handle.nodeInfo]; IF RealDifferences[handle, shrinkReal, defaultReal, nodeInfoReal] THEN displayRope _ AppendGlue[displayRope, handle.display.topLeadingInfo.leading.units, "topLeadingGlue"] ELSE { defaultReal _ NodeStyle.GetTopLeading[default]; nodeInfoReal _ NodeStyle.GetTopLeading[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, leadingReal, defaultReal, nodeInfoReal, "topLeading", handle.display.topLeadingInfo.leading.units]; }; }; leadingReal _ GetReal[handle.display.bottomLeadingInfo.leading]; [stretchReal, shrinkReal] _ GetStretchShrink[handle.display.bottomLeadingInfo]; defaultReal _ NodeStyle.GetBottomLeadingStretch[default]; nodeInfoReal _ NodeStyle.GetBottomLeadingStretch[handle.nodeInfo]; IF RealDifferences[handle, stretchReal, defaultReal, nodeInfoReal] THEN displayRope _ AppendGlue[displayRope, handle.display.bottomLeadingInfo.leading.units, "bottomLeadingGlue"] ELSE { defaultReal _ NodeStyle.GetBottomLeadingShrink[default]; nodeInfoReal _ NodeStyle.GetBottomLeadingShrink[handle.nodeInfo]; IF RealDifferences[handle, shrinkReal, defaultReal, nodeInfoReal] THEN displayRope _ AppendGlue[displayRope, handle.display.bottomLeadingInfo.leading.units, "bottomLeadingGlue"] ELSE { defaultReal _ NodeStyle.GetBottomLeading[default]; nodeInfoReal _ NodeStyle.GetBottomLeading[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, leadingReal, defaultReal, nodeInfoReal, "bottomLeading", handle.display.bottomLeadingInfo.leading.units]; }; }; RETURN[displayRope]; END; AppendMiscInfoRope: PUBLIC PROCEDURE [handle: StyleToolHandle, default: NodeStyle.Ref, displayRope: Rope.ROPE] RETURNS [Rope.ROPE] = BEGIN selectionOnRope, nodeInfoRope, defaultRope: Rope.ROPE; selectionReal, defaultReal, nodeInfoReal: REAL; selectionReal _ GetReal[handle.display.vshiftInfo]; defaultReal _ NodeStyle.GetVShift[default]; nodeInfoReal _ NodeStyle.GetVShift[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "vShift", handle.display.vshiftInfo.units]; selectionReal _ GetReal[handle.display.minLineGapInfo]; defaultReal _ NodeStyle.GetMinLineGap[default]; nodeInfoReal _ NodeStyle.GetMinLineGap[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "minLineGap", handle.display.minLineGapInfo.units]; selectionReal _ StyleToolConvert.GetRealFromViewer[ handle.display.tabStopsViewer ! StyleToolConvert.BadNumber => CONTINUE]; defaultReal _ NodeStyle.GetTabStops[default]; nodeInfoReal _ NodeStyle.GetTabStops[handle.nodeInfo]; IF RealDifferences[handle, selectionReal, defaultReal, nodeInfoReal] THEN displayRope _ Rope.Cat[displayRope,ViewerTools.GetContents[handle.display.tabStopsViewer], " sp tabStops\n"]; selectionOnRope _ ChoiceButtons.GetSelectedButton[handle.display.lineFormattingChoice]; defaultRope _ StyleToolConvert.GetLineFormattingChoice[default.lineFormatting]; nodeInfoRope _ StyleToolConvert.GetLineFormattingChoice[handle.nodeInfo.lineFormatting]; IF RopeDifferences[handle, selectionOnRope, defaultRope, nodeInfoRope] THEN displayRope _ Rope.Cat[displayRope, StyleToolConvert.LineChoiceToJaM[selectionOnRope], " lineFormatting\n"]; RETURN[displayRope]; END; AppendPenaltyInfoRope: PUBLIC PROCEDURE [handle: StyleToolHandle, default: NodeStyle.Ref, displayRope: Rope.ROPE] RETURNS [Rope.ROPE] = BEGIN selectionReal, defaultReal, nodeInfoReal: REAL; selectionReal _ StyleToolConvert.GetRealFromViewer[ handle.swap.penalty.pageBreakPenalty ! StyleToolConvert.BadNumber => CONTINUE]; defaultReal _ NodeStyle.GetPageBreakPenalty[default]; nodeInfoReal _ NodeStyle.GetPageBreakPenalty[handle.nodeInfo]; IF RealDifferences[handle, selectionReal, defaultReal, nodeInfoReal] THEN displayRope _ Rope.Cat[displayRope, ViewerTools.GetContents[handle.swap.penalty.pageBreakPenalty]," pageBreakPenalty\n"]; selectionReal _ StyleToolConvert.GetRealFromViewer[ handle.swap.penalty.afterFirstLinePenalty ! StyleToolConvert.BadNumber => CONTINUE]; defaultReal _ NodeStyle.GetPageBreakAfterFirstLinePenalty[default]; nodeInfoReal _ NodeStyle.GetPageBreakAfterFirstLinePenalty[handle.nodeInfo]; IF RealDifferences[handle, selectionReal, defaultReal, nodeInfoReal] THEN displayRope _ Rope.Cat[displayRope, ViewerTools.GetContents[handle.swap.penalty.afterFirstLinePenalty], " pageBreakAfterFirstLinePenalty\n"]; selectionReal _ StyleToolConvert.GetRealFromViewer[ handle.swap.penalty.beforeLastLinePenalty ! StyleToolConvert.BadNumber => CONTINUE]; defaultReal _ NodeStyle.GetPageBreakBeforeLastLinePenalty[default]; nodeInfoReal _ NodeStyle.GetPageBreakBeforeLastLinePenalty[handle.nodeInfo]; IF RealDifferences[handle, selectionReal, defaultReal, nodeInfoReal] THEN displayRope _ Rope.Cat[displayRope, ViewerTools.GetContents[handle.swap.penalty.beforeLastLinePenalty], " pageBreakBeforeLastLinePenalty\n"]; selectionReal _ StyleToolConvert.GetRealFromViewer[ handle.swap.penalty.beforeFirstLinePenalty ! StyleToolConvert.BadNumber => CONTINUE]; defaultReal _ NodeStyle.GetPageBreakBeforeFirstLinePenalty[default]; nodeInfoReal _ NodeStyle.GetPageBreakBeforeFirstLinePenalty[handle.nodeInfo]; IF RealDifferences[handle, selectionReal, defaultReal, nodeInfoReal] THEN displayRope _ Rope.Cat[displayRope, ViewerTools.GetContents[handle.swap.penalty.beforeFirstLinePenalty], " pageBreakBeforeFirstLinePenalty\n"]; selectionReal _ StyleToolConvert.GetRealFromViewer[ handle.swap.penalty.afterLastLinePenalty ! StyleToolConvert.BadNumber => CONTINUE]; defaultReal _ NodeStyle.GetPageBreakAfterLastLinePenalty[default]; nodeInfoReal _ NodeStyle.GetPageBreakAfterLastLinePenalty[handle.nodeInfo]; IF RealDifferences[handle, selectionReal, defaultReal, nodeInfoReal] THEN displayRope _ Rope.Cat[displayRope, ViewerTools.GetContents[handle.swap.penalty.afterLastLinePenalty], " pageBreakAfterLastLinePenalty\n"]; RETURN[displayRope]; END; AppendPageInfoRope: PUBLIC PROCEDURE [handle: StyleToolHandle, default: NodeStyle.Ref, displayRope: Rope.ROPE] RETURNS [Rope.ROPE] = BEGIN selectionReal, defaultReal, nodeInfoReal: REAL; -- selectionInt: INTEGER; selectionReal _ GetReal[handle.swap.layout.pageWidth]; defaultReal _ NodeStyle.GetPageWidth[default]; nodeInfoReal _ NodeStyle.GetPageWidth[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "pageWidth", handle.swap.layout.pageWidth.units]; selectionReal _ GetReal[handle.swap.layout.pageLength]; defaultReal _ NodeStyle.GetPageLength[default]; nodeInfoReal _ NodeStyle.GetPageLength[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "pageLength", handle.swap.layout.pageLength.units]; selectionReal _ GetReal[handle.swap.layout.leftMargin]; defaultReal _ NodeStyle.GetLeftMargin[default]; nodeInfoReal _ NodeStyle.GetLeftMargin[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "leftMargin", handle.swap.layout.leftMargin.units]; selectionReal _ GetReal[handle.swap.layout.rightMargin]; defaultReal _ NodeStyle.GetRightMargin[default]; nodeInfoReal _ NodeStyle.GetRightMargin[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "rightMargin", handle.swap.layout.rightMargin.units]; selectionReal _ GetReal[handle.swap.layout.topMargin]; defaultReal _ NodeStyle.GetTopMargin[default]; nodeInfoReal _ NodeStyle.GetTopMargin[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "topMargin", handle.swap.layout.topMargin.units]; selectionReal _ GetReal[handle.swap.layout.bottomMargin]; defaultReal _ NodeStyle.GetBottomMargin[default]; nodeInfoReal _ NodeStyle.GetBottomMargin[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "bottomMargin", handle.swap.layout.bottomMargin.units]; << selectionReal _ GetReal[handle.swap.layout.headerMargin]; defaultReal _ NodeStyle.GetHeaderMargin[default]; nodeInfoReal _ NodeStyle.GetHeaderMargin[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "headerMargin", handle.swap.layout.headerMargin.units]; selectionReal _ GetReal[handle.swap.layout.footerMargin]; defaultReal _ NodeStyle.GetFooterMargin[default]; nodeInfoReal _ NodeStyle.GetFooterMargin[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "footerMargin", handle.swap.layout.footerMargin.units];>> selectionReal _ GetReal[handle.swap.layout.bindingMargin]; defaultReal _ NodeStyle.GetBindingMargin[default]; nodeInfoReal _ NodeStyle.GetBindingMargin[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "bindingMargin", handle.swap.layout.bindingMargin.units]; << selectionReal _ GetReal[handle.swap.layout.lineLength]; defaultReal _ NodeStyle.GetLineLength[default]; nodeInfoReal _ NodeStyle.GetLineLength[handle.nodeInfo]; displayRope _ AppendValueAndUnits[handle, displayRope, selectionReal, defaultReal, nodeInfoReal, "lineLength", handle.swap.layout.lineLength.units]; selectionInt _ StyleToolConvert.GetIntegerFromViewer[handle.swap.layout.column ! StyleToolConvert.BadNumber => CONTINUE]; IF IntDifferences[handle, selectionInt, NodeStyle.GetColumns[default], NodeStyle.GetColumns[handle.nodeInfo]] THEN displayRope _ Rope.Cat[displayRope, IO.PutFToRope[integerFormat, IO.int[selectionInt]], " column\n"];>> RETURN[displayRope]; END; END.