DIRECTORY Buttons, Controls, CtBasic, CtMisc, Draw2d, Imager, ImagerBackdoor, Rope, TextNode, TiogaAccess, TiogaAccessViewers, TiogaImager, ViewerClasses; CtMiscImpl: CEDAR PROGRAM IMPORTS Buttons, Draw2d, Imager, ImagerBackdoor, Rope, TiogaAccess, TiogaAccessViewers, TiogaImager EXPORTS CtMisc ~ BEGIN Context: TYPE ~ Imager.Context; Color: TYPE ~ Imager.Color; Rectangle: TYPE ~ Imager.Rectangle; VEC: TYPE ~ Imager.VEC; ROPE: TYPE ~ Rope.ROPE; Viewer: TYPE ~ ViewerClasses.Viewer; ButtonToggle: PUBLIC PROC [button: Viewer] ~ { index: INTEGER ¬ Rope.Find[button.name, "On", 0, FALSE]; Relabel: PROC [rope: ROPE, n: NAT] ~ { Buttons.ReLabel[button, Rope.Cat[ Rope.Substr[button.name, 0, index+1], rope, Rope.Substr[button.name, index+1+n]]]; }; IF index # -1 THEN { Relabel["ff", 1]; Buttons.SetDisplayStyle[button, $BlackOnWhite]; } ELSE { index ¬ Rope.Find[button.name, "Off", 0, FALSE]; IF index # -1 THEN Relabel["n", 2]; Buttons.SetDisplayStyle[button, $WhiteOnBlack]; }; }; ButtonOn: PUBLIC PROC [button: Viewer] RETURNS [BOOL] ~ { RETURN[Rope.Find[button.name, "on", 0, FALSE] # -1]; }; PrintTiogaSelection: PUBLIC PROC [ p: VEC, color: Color, context: Context ¬ NIL, screenStyle: BOOL ¬ FALSE] RETURNS [error: ROPE] ~ { c: Context ~ context; bounds: Rectangle ¬ ImagerBackdoor.GetBounds[c]; formattedNode: TiogaImager.FormattedNodes; reader: TiogaAccessViewers.Reader ~ TiogaAccessViewers.FromSelection[]; location: TextNode.Location ~ [NARROW[TiogaAccess.GetLocation[reader].node], 0]; IF location.node = NIL THEN RETURN["Bad Text"]; IF color = NIL THEN color ¬ ImagerBackdoor.GetColor[context]; formattedNode ¬ TiogaImager.FormatNodes[location, [bounds.w, bounds.h], IF screenStyle THEN screen ELSE print]; Imager.SetColor[c, color]; TiogaImager.Render[formattedNode.box, c, [p.x, p.y]]; }; PrintRope: PUBLIC PROC [ rope: ROPE, p: VEC, color: Color ¬ NIL, font: ROPE ¬ NIL, size: REAL ¬ 14.0, context: Context ¬ NIL] ~ { IF font = NIL THEN font ¬ "helvetica-mrr"; Imager.SetFont[context, Imager.FindFontScaled[Rope.Concat["xerox/pressfonts/", font], size]]; IF color # NIL THEN Imager.SetColor[context, color]; Draw2d.Label[context, [p.x, ImagerBackdoor.GetBounds[context].h-p.y], rope]; }; END. ’ CtMiscImpl.mesa Copyright Σ 1985, 1992 by Xerox Corporation. All rights reserved. Bloomenthal, July 4, 1992 12:08 pm PDT Types Button Miscellany Printing Κξ•NewlineDelimiter –"cedarcode" style™™Jšœ Οeœ6™BJ™&J˜—JšΟk œ˜šJ˜šΠbl œžœž˜Jšžœ\˜cJšžœ˜—J˜Jšœž˜headšΟl™Jšœžœ˜"Jšœž œ˜Jšœ žœ˜%Jšžœžœ žœ˜Jšžœž œžœ˜Jšœžœ˜'—š ™šΟn œž œ˜.Jšœžœ#žœ˜8š‘œžœžœžœ˜&˜!J˜R—J˜—šžœ ˜ šžœ˜J˜J˜/J˜—šžœ˜Jšœ)žœ˜0Jšžœ žœ˜#J˜/J˜——J˜J˜—š‘œž œžœžœ˜9Jšžœ!žœ˜4J˜——š ™š‘œžœžœ˜"Jšœžœ˜Jšœ ˜ Jšœžœ˜Jšœ žœžœ˜Jšžœ žœ˜Jšœ˜J˜0J˜*J˜GJšœžœ+˜PJšžœžœžœžœ ˜/Jšžœ žœžœ*˜=JšœHžœ žœžœ˜oJ˜J˜5J˜J˜—š‘ œž œ˜Jšœžœ˜ Jšœžœ˜Jšœžœ˜Jšœžœžœ˜Jšœžœ˜Jšœžœ˜J˜Jšžœžœžœ˜*J˜]Jšžœ žœžœ!˜4J˜LJ˜——J˜šžœ˜J˜——…—Ό L