<> <> <> <> <> <<>> DIRECTORY AtomButtonsTypes, Convert, Feedback, FileNames, FS, GGBasicTypes, GGBoundBox, GGFont, GGFromImager, GGInterfaceTypes, GGModelTypes, GGScene, GGParseIn, GGParseOut, GGShapes, GGSlice, GGTransform, GGUtility, Imager, ImagerFont, ImagerInterpress, ImagerMemory, ImagerTransformation, Interpress, IO, Lines2d, NodeStyle, RealFns, RefText, Rope, Vectors2d, ViewerClasses; GGSliceImplB: CEDAR PROGRAM IMPORTS Convert, Feedback, FileNames, FS, GGBoundBox, GGFont, GGFromImager, GGScene, GGParseIn, GGParseOut, GGShapes, GGSlice, GGTransform, GGUtility, Imager, ImagerFont, ImagerInterpress, ImagerMemory, ImagerTransformation, Interpress, IO, Lines2d, RealFns, RefText, Rope, Vectors2d EXPORTS GGSlice = BEGIN << [Artwork node; type 'ArtworkInterpress on' to command tool] >> <<Text Points as shown>> < left, 1=> top, 2=> right, 3=> bottom, 4 => baseline, 5 => horizontal centerline, 6 => vertical centerline>> BoundBox: TYPE = GGModelTypes.BoundBox; CameraData: TYPE = GGInterfaceTypes.CameraData; Color: TYPE = Imager.Color; DefaultData: TYPE = GGModelTypes.DefaultData; ExtendMode: TYPE = GGModelTypes.ExtendMode; FeedbackData: TYPE = AtomButtonsTypes.FeedbackData; GGData: TYPE = GGInterfaceTypes.GGData; GargoyleDataObj: TYPE = GGInterfaceTypes.GargoyleDataObj; Point: TYPE = GGBasicTypes.Point; PointGenerator: TYPE = GGModelTypes.PointGenerator; PointGeneratorObj: TYPE = GGModelTypes.PointGeneratorObj; PointPairGenerator: TYPE = GGModelTypes.PointPairGenerator; PointPairGeneratorObj: TYPE = GGModelTypes.PointPairGeneratorObj; Scene: TYPE = GGModelTypes.Scene; SelectedObjectData: TYPE = GGModelTypes.SelectedObjectData; SelectionClass: TYPE = GGInterfaceTypes.SelectionClass; SelectMode: TYPE = GGModelTypes.SelectMode; Slice: TYPE = GGModelTypes.Slice; SliceClass: TYPE = GGModelTypes.SliceClass; SliceClassObj: TYPE = GGModelTypes.SliceClassObj; SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor; SliceDescriptorObj: TYPE = GGModelTypes.SliceDescriptorObj; SliceObj: TYPE = GGModelTypes.SliceObj; SliceParts: TYPE = GGModelTypes.SliceParts; Vector: TYPE = GGBasicTypes.Vector; Viewer: TYPE = ViewerClasses.Viewer; FontData: TYPE = GGFont.FontData; textMaxPoints: INTEGER = 12; textMaxEdges: INTEGER = 7; TextPoints: TYPE = REF TextPointsData; TextPointsData: TYPE = ARRAY [0..textMaxPoints) OF Point; -- see picture TextEdgeArray: TYPE = PACKED ARRAY [0..textMaxEdges) OF BOOL; -- left, top, right, bottom, baseline, centerline. TextPointArray: TYPE = PACKED ARRAY [0..textMaxPoints) OF BOOL; -- see picture. Used in text parts data. textPointRopes: ARRAY [0..textMaxPoints) OF Rope.ROPE = [ "lower left point", "base left point", "center left point", "upper left point", "lower mid point", "base mid point", "center mid point", "upper mid point", "lower right point", "base right point", "center right point", "upper right point" ]; textEdgeRopes: ARRAY [0..textMaxEdges) OF Rope.ROPE = [ "left edge", "top edge", "right edge", "bottom edge", "baseline", "horizontal center line", "vertical center line" ]; <<>> TextData: TYPE = REF TextDataObj; TextDataObj: TYPE = RECORD [ box: BoundBox, -- not a bounding box but part of the text representation feedbackBox: BoundBox, -- both a bounding box and part of the text representation points: TextPoints, -- cache for "joints" rope: Rope.ROPE, color: Imager.Color, fontData: FontData, trueFont: ImagerFont.Font, screenFont: ImagerFont.Font, inverse: ImagerTransformation.Transformation, -- inverse of transform inverseScale: Vector, -- cached value of ImagerTransformation.Factor[inverse].s amplifySpace: REAL _ 1.0, -- because the Imager allows space correction (see Imager.mesa) dropShadowOn: BOOL _ FALSE, dropShadowOffset: Vector, shadowColor: Imager.Color ]; TextParts: TYPE = REF TextPartsObj; TextPartsObj: TYPE = RECORD [ points: TextPointArray, -- which corners of text box are selected. edges: TextEdgeArray, -- which edges of text box are selected. includeText: BOOL -- FALSE => corners and edges only; no text ]; TextHitData: TYPE = REF TextHitDataObj; TextHitDataObj: TYPE = RECORD [ <> point: [-1..textMaxPoints), -- which point of box is hit. edge: [-1..textMaxEdges), -- which edge of box is hit. hitPoint: Point ]; FontNameError: PUBLIC SIGNAL = CODE; <<>> <> BuildTextSliceClass: PUBLIC PROC [] RETURNS [class: SliceClass] = { OPEN GGSlice; class _ NEW[SliceClassObj _ [ type: $Text, <> getBoundBox: TextBoundBox, getTightBox: TextTightBox, copy: TextCopy, <> drawParts: TextDrawParts, drawTransform: TextDrawTransform, drawSelectionFeedback: TextDrawSelectionFeedback, drawAttractorFeedback: NoOpDrawAttractorFeedback, <> transform: TextTransform, <> describe: TextDescribe, describeHit: TextDescribeHit, fileout: TextFileout, filein: TextFilein, <> isEmptyParts: TextIsEmptyParts, isCompleteParts: TextIsCompleteParts, newParts: TextNewParts, unionParts: TextUnionParts, differenceParts: TextDiffParts, movingParts: TextMovingParts, augmentParts: TextAugmentParts, setSelectedFields: NoOpSetSelectedFields, <> pointsInDescriptor: TextPointsInDescriptor, pointPairsInDescriptor: TextPointPairsInDescriptor, segmentsInDescriptor: NoOpSegmentsInDescriptor, walkSegments: NoOpWalkSegments, nextPoint: TextNextPoint, nextPointPair: TextNextPointPair, nextSegment: NoOpNextSegment, <> closestPoint: TextClosestPoint, closestJointToHitData: NoOpClosestJointToHitData, closestPointAndTangent: NoOpClosestPointAndTangent, closestSegment: TextClosestSegment, lineIntersection: NoOpLineIntersection, circleIntersection: NoOpCircleIntersection, hitDataAsSimpleCurve: NoOpHitDataAsSimpleCurve, <