<> <> <> <> DIRECTORY CD, CDCells, CDCommandOps, CDCommandOpsExtras2, CDCreateLabels, CDDirectory, CDOps, CDOrient, CDProperties, CDSequencer, CDTexts, Imager, RefTab, Rope, TerminalIO; CDMakeLabelCell: CEDAR PROGRAM IMPORTS CD, CDCells, CDCommandOps, CDCommandOpsExtras2, CDCreateLabels, CDDirectory, CDOps, CDOrient, CDProperties, RefTab, Rope, TerminalIO = BEGIN abortPlot: REF BOOL _ NEW[BOOL _ FALSE]; contextFilter: REF CD.ContextFilter _ NEW[CD.ContextFilter_ALL[TRUE]]; myProp: REF _ NEW[INT]; DrawContext: PROC [pr: CD.DrawRef, proc: CD.DrawContextLayerProc, ob: CD.Object, pos: CD.Position, orient: CD.Orientation, layer: CD.Layer] = BEGIN IF ob=NIL THEN RETURN; WITH ob.specificRef SELECT FROM tp: CDTexts.TextPtr => { ref: RefTab.Ref ~ NARROW[pr.devicePrivate]; tCell: CD.Object _ NIL; WITH ref.Fetch[ob].val SELECT FROM cob: CD.Object => tCell _ cob; ENDCASE => { tiogaFont: Imager.Font _ NIL; WITH CDProperties.GetProp[tp.cdFont.properties, $OriginalFont] SELECT FROM f: Imager.Font => tiogaFont _ f; ENDCASE => RETURN; IF tiogaFont#NIL AND tiogaFont.name.Length[]>17 AND Rope.Equal["Xerox/TiogaFonts/", tiogaFont.name.Substr[len: 17], FALSE] THEN { <<--realy is tiogafont>> tCell _ CDCreateLabels.CreateTextCell[pr.design, tp.text, tiogaFont, tp.cdFont.scaleI, layer]; } ELSE { tCell _ CDCreateLabels.CreateTextCell[pr.design, tp.text, tp.cdFont.font, 1, layer]; }; [] _ ref.Store[ob, tCell] }; IF tCell#NIL THEN { origin: CD.Position _ CDOrient.MapPoint[ pointInCell: CD.ClientOrigin[ob], cellSize: ob.size, cellInstOrient: orient, cellInstPos: pos ]; [] _ CDCells.IncludeOb[cell: cell, ob: tCell, position: origin, orientation: orient, mode: dontPropagate]; }; }; ENDCASE => NULL; END; cell: CD.Object; ProtectedMakeLabelCell: PROC[comm: CDSequencer.Command] = BEGIN design: CD.Design _ comm.design; dr: CD.DrawRef = CD.CreateDrawRef[[ drawContext: DrawContext, contextFilter: contextFilter, devicePrivate: RefTab.Create[], design: design ]]; cell _ CDCells.CreateEmptyCell[]; CDOps.DrawDesign[design, dr]; [] _ CDCells.RepositionCell[cell, NIL]; [] _ CDDirectory.Include[design, cell, "dummy"]; [] _ CDCells.IncludeOb[design: design, ob: cell]; END; MakeLabelCellComm: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["make a label cell\n"]; [] _ CDCommandOps.CallWithResource[ProtectedMakeLabelCell, comm, $MakeLabelCell, abortPlot]; END; CDCommandOpsExtras2.RegisterWithMenu[$ProgramMenu, "make a label cell", "a cell with labels containing all texts", $MakeLabelCellComm, MakeLabelCellComm, doQueueAndMark]; END.