DIRECTORY Ascii, CD, CDLayers, CDOps, CDPanel, CDPanelFonts, CDPrivate, CDSequencer, CDTexts, Rope, TerminalIO; CDTextsCommands: CEDAR MONITOR IMPORTS Ascii, CDLayers, CDOps, CDPanel, CDPanelFonts, CDSequencer, CDTexts, Rope, TerminalIO SHARES CDTexts = BEGIN ROPE: TYPE = Rope.ROPE; CDFont: TYPE = CDTexts.CDFont; CreateTextComm: PROC [comm: CDSequencer.Command] = { ob: CD.Object; lay: CD.Layer; r: ROPE; font: CDFont _ CDPanelFonts.CurrentFont[comm.design]; CDPanel.Redisplay[comm.design]; IF font=NIL THEN CDSequencer.Quit["** no font"]; r _ TerminalIO.RequestRope["create text >"]; IF Rope.IsEmpty[r] THEN CDSequencer.Quit["empty text not included"]; lay _ CDLayers.CurrentLayer[comm.design]; lay _ CDPanelFonts.LayerForText[lay, comm.design.technology]; ob _ CDTexts.Create[text: r, font: font, layer: lay]; IF ob=NIL THEN CDSequencer.Quit["not done"]; CDOps.IncludeObject[design: comm.design, ob: ob, trans: [comm.pos, original]]; }; ChangeTextComm: PROC [comm: CDSequencer.Command] = { inst: CD.Instance ; CDPanel.Redisplay[comm.design]; inst _ CDOps.TheInstance[comm.design, "change text\n"]; IF inst#NIL THEN { WITH inst.ob.specific SELECT FROM t: CDTexts.TextSpecific => { ob: CD.Object; r: ROPE; TerminalIO.PutRopes["replace text """, t.text, """ >"]; r _ TerminalIO.RequestRope[]; IF Rope.IsEmpty[r] THEN TerminalIO.PutRope["empty text not used\n"] ELSE { ob _ CDTexts.Create[text: r, font: t.cdFont, layer: inst.ob.layer, flip: CDTexts.IsFlipText[inst.ob]]; CDOps.RedrawInstance[comm.design, inst, TRUE]; IF ob#NIL THEN inst.ob _ ob; CDOps.RedrawInstance[comm.design, inst, FALSE]; } } ENDCASE => TerminalIO.PutRope["selected ob is not text; not done\n"]; }; }; SetFlip: PROC [design: CD.Design, flip: BOOL _ TRUE] RETURNS [cnt: INT_0] = { FOR il: CD.InstanceList _ CDOps.InstList[design], il.rest WHILE il#NIL DO IF il.first.selected AND CDTexts.IsText[il.first.ob] THEN IF (flip AND CDTexts.IsRigidText[il.first.ob]) OR (~flip AND CDTexts.IsFlipText[il.first.ob]) THEN { ob: CD.Object _ CDTexts.Create[ text: NARROW[il.first.ob.specific, CDTexts.TextSpecific].text, font: NARROW[il.first.ob.specific, CDTexts.TextSpecific].cdFont, layer: il.first.ob.layer, flip: flip ]; IF ob#NIL THEN il.first.ob _ ob; cnt _ cnt+1 } ENDLOOP; IF cnt>0 THEN CDOps.Redraw[design]; }; SetFlipComm: PROC [comm: CDSequencer.Command] = { cnt: INT _ SetFlip[comm.design, TRUE]; TerminalIO.PutF["%g texts converted to flip mode\n", [integer[cnt]]] }; SetRigidComm: PROC [comm: CDSequencer.Command] = { cnt: INT _ SetFlip[comm.design, FALSE]; TerminalIO.PutF["%g texts converted to rigid mode\n", [integer[cnt]]]; }; ChangeFontComm: PROC [comm: CDSequencer.Command] = { n: INT _ 0; font: CDFont; CDPanel.Redisplay[comm.design]; font _ CDPanelFonts.CurrentFont[comm.design]; IF font=NIL THEN CDSequencer.Quit["** no font\n"]; FOR il: CD.InstanceList _ CDOps.InstList[comm.design], il.rest WHILE il#NIL DO IF il.first.selected AND CDTexts.IsText[il.first.ob] THEN IF SetInstanceFont[comm.design, il.first, font] THEN n _ n+1; ENDLOOP; TerminalIO.PutF["font changed for %g texts\n", [integer[n]]]; }; ChangeItalic: PROC [fontName: ROPE, italic: BOOL] RETURNS [new: ROPE] = { pressFontLeng: INT = 17; pressFontName: ROPE = "Xerox/PressFonts/"; tiogaFontLeng: INT = 17; tiogaFontName: ROPE = "Xerox/TiogaFonts/"; leng: INT _ Rope.Length[fontName]; new _ fontName; IF leng>tiogaFontLeng THEN IF Rope.Equal[Rope.Substr[fontName, 0, tiogaFontLeng], tiogaFontName, FALSE] THEN { IF Rope.Equal[Rope.Substr[fontName, 0, tiogaFontLeng], tiogaFontName, FALSE] THEN { IF italic THEN { IF Ascii.Upper[Rope.Fetch[fontName, leng-1]]='I THEN RETURN; RETURN [Rope.Concat[fontName, "I"]]; } ELSE { IF Ascii.Upper[Rope.Fetch[fontName, leng-1]]#'I THEN RETURN; RETURN [Rope.Substr[fontName, 0, leng-1]]; } } }; IF leng>pressFontLeng THEN IF Rope.Equal[Rope.Substr[fontName, 0, pressFontLeng], pressFontName, FALSE] THEN { IF italic THEN { IF Ascii.Upper[Rope.Fetch[fontName, leng-1]]='I THEN RETURN; RETURN [Rope.Replace[fontName, leng-2, 1, "i"]]; } ELSE { IF Ascii.Upper[Rope.Fetch[fontName, leng-2]]#'I THEN RETURN; RETURN [Rope.Replace[fontName, leng-2, 1, "r"]]; } } }; SetInstanceFont: PROC [design: CD.Design, text: CD.Instance, font: CDFont] RETURNS [ok: BOOL_FALSE] = { IF font#NIL THEN { ob: CD.Object _ CDTexts.Create[ text: NARROW[text.ob.specific, CDTexts.TextSpecific].text, font: font, layer: text.ob.layer, flip: CDTexts.IsFlipText[text.ob]]; CDOps.RedrawInstance[design, text]; IF ob#NIL THEN {text.ob _ ob; ok _ TRUE}; CDOps.RedrawInstance[design, text, FALSE]; } }; SetItalicIzation: PROC [design: CD.Design, comment: BOOL] = { n: INT _ 0; FOR w: CD.InstanceList _ CDOps.InstList[design], w.rest WHILE w#NIL DO IF CDTexts.IsText[w.first.ob] AND w.first.selected THEN { textPtr: CDTexts.TextSpecific _ NARROW[w.first.ob.specific]; oldFontName: ROPE _ textPtr.cdFont.supposedName; newFontName: ROPE _ ChangeItalic[oldFontName, comment]; IF ~Rope.Equal[oldFontName, newFontName] THEN { font: CDFont _ CDTexts.MakeFont[newFontName, textPtr.cdFont.scaleI]; IF SetInstanceFont[design, w.first, font] THEN n _ n+1; } } ENDLOOP; TerminalIO.PutF["comment property changed for %g texts\n", [integer[n]]]; }; MakeComment: PROC [comm: CDSequencer.Command] = { SetItalicIzation[comm.design, TRUE] }; UnMakeComment: PROC [comm: CDSequencer.Command] = { SetItalicIzation[comm.design, FALSE] }; CDSequencer.ImplementCommand[$DrawText, CreateTextComm]; CDSequencer.ImplementCommand[$ChangeText, ChangeTextComm]; CDSequencer.ImplementCommand[$ChangeFont, ChangeFontComm]; CDSequencer.ImplementCommand[$CDTextsRigid, SetRigidComm]; CDSequencer.ImplementCommand[$CDTextsFlip, SetFlipComm]; CDSequencer.ImplementCommand[$MakeComment, MakeComment]; CDSequencer.ImplementCommand[$UnMakeComment, UnMakeComment]; END. CDTextsCommands.mesa (part of ChipNDale) Copyright c 1983, 1985, 1986 by Xerox Corporation. All rights reserved. Created by Christian Jacobi, June 24, 1983 5:03 pm gbb April 8, 1986 5:46:03 pm PST Last Edited by: Christian Jacobi, October 21, 1986 12:17:16 pm PDT Κ˜codešœ)™)Kšœ Οmœ=™HKšœ3™3K™ K™B—K˜šΟk ˜ Kšœ˜Kšžœ˜K˜ Kšœ˜K˜Kšœ ˜ Kšœ ˜ Kšœ ˜ K˜Kšœ˜Kšœ ˜ K˜—šΟnœžœžœ˜KšžœV˜]Kšžœ ˜—Kšž˜K˜Kšžœžœžœ˜Kšœžœ˜K˜šŸœžœ ˜4Kšœžœ˜Kšœžœ˜Kšœžœ˜Kšœ5˜5Kšœ˜Kšžœžœžœ ˜0Kšœ,˜,Kšžœžœ-˜DKšœ*˜*Kšœ=˜=Kšœ5˜5Kšžœžœžœ˜,K˜NKšœ˜—K˜šŸœžœ ˜4Kšœžœ ˜Kšœ˜Kšœ7˜7šžœžœžœ˜šžœžœž˜!šœ˜Kšœžœ˜Kšœžœ˜Kšœ7˜7Kšœ˜Kšžœžœ,˜Cšžœ˜Kšœf˜fKšœ(žœ˜.Kšžœžœžœ˜Kšœ(žœ˜/K˜—K˜—Kšžœ>˜E—Kšœ˜—Kšœ˜K˜—šŸœžœ žœžœžœžœžœ˜Mš žœžœ0žœžœž˜Išžœžœžœ˜;š žœžœ#žœžœ"žœ˜dšœžœ˜Kšœžœ2˜>Kšœžœ4˜@Kšœ˜Kšœ ˜ Kšœ˜—Kšžœžœžœ˜ Kšœ ˜ Kšœ˜——Kšžœ˜ —Kšžœžœ˜#Kšœ˜—K˜šŸ œžœ ˜1Kšœžœžœ˜&KšœD˜DK˜—K˜šŸ œžœ ˜2Kšœžœžœ˜'KšœF˜FK˜—K˜šŸœžœ ˜4Kšœžœ˜Kšœ˜Kšœ-˜-Kšžœžœžœ"˜2š žœžœ5žœžœž˜Nšžœžœžœ˜:Kšžœ.žœ ˜=—Kšžœ˜—Kšœ=˜=Kšœ˜—K˜š Ÿ œžœ žœ žœžœžœ˜IKšœžœžœ˜CKšœžœžœ˜CKšœžœ˜"Kšœ˜šžœž˜šžœDžœžœ˜SšžœDžœžœ˜Sšžœžœ˜Kšžœ.žœžœ˜