DIRECTORY Ascii, CD, CDInstances, CDCommandOps, CDLayers, CDOps, CDPanel, CDPanelFonts, CDPanelFontsExtras, CDPrivate, CDSequencer, CDTexts, CDTextsExtras, Rope, TerminalIO; CDTextsCommands: CEDAR MONITOR IMPORTS Ascii, CDInstances, CDCommandOps, CDLayers, CDOps, CDPanel, CDPanelFonts, CDPanelFontsExtras, CDSequencer, CDTexts, CDTextsExtras, 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.RedisplayLabels[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 _ CDPanelFontsExtras.LayerForText[lay, comm.design.technology]; ob _ CDTexts.CreateText[text: r, font: font, layer: lay]; IF ob=NIL THEN CDSequencer.Quit["not done"]; CDOps.IncludeObjectI[design: comm.design, ob: ob, location: comm.pos, orientation: 0]; }; ChangeTextComm: PROC [comm: CDSequencer.Command] = { inst: CD.Instance ; CDPanel.RedisplayLabels[comm.design]; inst _ CDCommandOps.TheInstance[comm, "change text"]; IF inst#NIL THEN { WITH inst.ob.specificRef SELECT FROM t: CDTexts.TextPtr => { ob: CD.Object; r: ROPE; TerminalIO.WriteRopes["replace text """, t.text, """ >"]; r _ TerminalIO.RequestRope[]; IF Rope.IsEmpty[r] THEN TerminalIO.WriteRope["empty text not used\n"] ELSE { ob _ CDTextsExtras.Create[text: r, font: t.cdFont, layer: inst.ob.layer, flip: CDTextsExtras.IsFlipText[inst.ob]]; CDOps.DelayedRedraw[comm.design, CDInstances.InstRectO[inst]]; IF ob#NIL THEN inst.ob _ ob; CDOps.DelayedRedraw[comm.design, CDInstances.InstRectO[inst], FALSE]; } } ENDCASE => TerminalIO.WriteRope["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 CDTextsExtras.IsText[il.first.ob] THEN IF (flip AND CDTextsExtras.IsRigidText[il.first.ob]) OR (~flip AND CDTextsExtras.IsFlipText[il.first.ob]) THEN { ob: CD.Object _ CDTextsExtras.Create[ text: NARROW[il.first.ob.specificRef, CDTexts.TextPtr].text, font: NARROW[il.first.ob.specificRef, CDTexts.TextPtr].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.WriteF["%g texts converted to flip mode\n", [integer[cnt]]] }; SetRigidComm: PROC [comm: CDSequencer.Command] = { cnt: INT _ SetFlip[comm.design, FALSE]; TerminalIO.WriteF["%g texts converted to rigid mode\n", [integer[cnt]]]; }; ChangeFontComm: PROC [comm: CDSequencer.Command] = { n: INT _ 0; font: CDFont; CDPanel.RedisplayLabels[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 CDTextsExtras.IsText[il.first.ob] THEN IF SetInstanceFont[comm.design, il.first, font] THEN n _ n+1; ENDLOOP; TerminalIO.WriteF["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 _ CDTextsExtras.Create[ text: NARROW[text.ob.specificRef, CDTexts.TextPtr].text, font: font, layer: text.ob.layer, flip: CDTextsExtras.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 CDTextsExtras.IsText[w.first.ob] AND w.first.selected THEN { textPtr: CDTexts.TextPtr _ NARROW[w.first.ob.specificRef]; 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.WriteF["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, September 2, 1986 11:55:30 am PDT Κ%˜codešœ)™)Kšœ Οmœ=™HKšœ3™3K™ K™C—K˜šΟk ˜ Kšœ˜Kšžœ˜Kšœ ˜ Kšœ ˜ K˜ Kšœ˜K˜Kšœ ˜ Kšœ˜Kšœ ˜ Kšœ ˜ K˜K˜Kšœ˜Kšœ ˜ K˜—šΟnœžœžœ˜Kšžœ”˜›Kšžœ ˜—Kšž˜K˜Kšžœžœžœ˜Kšœžœ˜K˜šŸœžœ ˜4Kšœžœ˜Kšœžœ˜Kšœžœ˜Kšœ5˜5Kšœ%˜%Kšžœžœžœ ˜0Kšœ,˜,Kšžœžœ-˜DKšœ*˜*KšœC˜CKšœ9˜9Kšžœžœžœ˜,K˜VKšœ˜—K˜šŸœžœ ˜4Kšœžœ ˜Kšœ%˜%Kšœ5˜5šžœžœžœ˜šžœžœž˜$šœ˜Kšœžœ˜Kšœžœ˜Kšœ9˜9Kšœ˜Kšžœžœ.˜Ešžœ˜Kšœr˜rKšœ>˜>Kšžœžœžœ˜Kšœ>žœ˜EK˜—K˜—Kšžœ@˜G—Kšœ˜—Kšœ˜K˜—šŸœžœ žœžœžœžœžœ˜Mš žœžœ0žœžœž˜Išžœžœ#žœ˜Aš žœžœ)žœžœ(žœ˜pšœžœ˜%Kšœžœ0˜Kšœ˜Kšœ ˜ Kšœ˜—Kšžœžœžœ˜ Kšœ ˜ Kšœ˜——Kšžœ˜ —Kšžœžœ˜#Kšœ˜—K˜šŸ œžœ ˜1Kšœžœžœ˜&KšœF˜FK˜—K˜šŸ œžœ ˜2Kšœžœžœ˜'KšœH˜HK˜—K˜šŸœžœ ˜4Kšœžœ˜Kšœ%˜%Kšœ-˜-Kšžœžœžœ"˜2š žœžœ5žœžœž˜Nšžœžœ#žœ˜@Kšžœ.žœ ˜=—Kšžœ˜—Kšœ?˜?Kšœ˜—K˜š Ÿ œžœ žœ žœžœžœ˜IKšœžœžœ˜CKšœžœžœ˜CKšœžœ˜"Kšœ˜šžœž˜šžœDžœžœ˜SšžœDžœžœ˜Sšžœžœ˜Kšžœ.žœžœ˜