Merge branch 'work' into tomerge

This commit is contained in:
Tim Edwards 2018-08-27 11:00:51 -04:00
commit 1345cc933c
2 changed files with 59 additions and 5 deletions

View File

@ -57,6 +57,8 @@ extern HashTable calmaDefInitHash;
extern void calmaLayerError(); extern void calmaLayerError();
bool calmaReadPath(); bool calmaReadPath();
typedef enum { LABEL_TYPE_NONE, LABEL_TYPE_TEXT, LABEL_TYPE_PORT } labelType;
/* /*
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
@ -276,6 +278,35 @@ calmaElementBoundary()
rp = CIFPolyToRects(pathheadp, plane, CIFPaintTable, (PaintUndoInfo *)NULL); rp = CIFPolyToRects(pathheadp, plane, CIFPaintTable, (PaintUndoInfo *)NULL);
CIFFreePath(pathheadp); CIFFreePath(pathheadp);
/* If the input layer is designated for ports by a "label" */
/* statement in the cifinput section, then find any label */
/* bounded by the path and attach the path to it. Note */
/* that this assumes two things: (1) that labels can only */
/* be attached to simple rectangles, and (2) that the */
/* rectangle appears in the GDS stream after the label. If */
/* either assumption is violated, this method needs to be */
/* re-coded. */
if (rp != NULL)
{
if ((ciftype >= 0) &&
((cifCurReadStyle->crs_labelSticky[ciftype] == LABEL_TYPE_PORT)))
{
Label *lab;
TileType type;
type = cifCurReadStyle->crs_labelLayer[ciftype];
for (lab = cifReadCellDef->cd_labels; lab; lab = lab->lab_next)
{
if ((GEO_SURROUND(&lab->lab_rect, &rp->r_r)) && (lab->lab_type == type))
{
lab->lab_rect = rp->r_r; /* Replace with larger rectangle */
break;
}
}
}
}
/* Paint the rectangles (if any) */ /* Paint the rectangles (if any) */
for (; rp != NULL ; rp = rp->r_next) for (; rp != NULL ; rp = rp->r_next)
{ {
@ -631,8 +662,6 @@ calmaElementPath()
} }
} }
typedef enum { LABEL_TYPE_NONE, LABEL_TYPE_TEXT, LABEL_TYPE_PORT } labelType;
/* /*
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
@ -871,7 +900,7 @@ calmaElementText()
&GeoOrigin, pos, textbody, type, flags); &GeoOrigin, pos, textbody, type, flags);
if ((lab != NULL) && (cifnum >= 0) && if ((lab != NULL) && (cifnum >= 0) &&
((cifCurReadStyle->crs_labelSticky[cifnum] == LABEL_TYPE_PORT))) (cifCurReadStyle->crs_labelSticky[cifnum] == LABEL_TYPE_PORT))
{ {
Label *sl; Label *sl;
int idx; int idx;

View File

@ -881,11 +881,36 @@ calmaOutFunc(def, f, cliprect)
(ClientData) &cos); (ClientData) &cos);
} }
/* Output labels */ /* Output labels. Do this in two passes, first for non-port labels */
/* while finding the highest-numbered port. Then output the port */
/* labels (if any) in the order of the port index. */
if (CalmaDoLabels) if (CalmaDoLabels)
{
int i, maxport = -1;
for (lab = def->cd_labels; lab; lab = lab->lab_next) for (lab = def->cd_labels; lab; lab = lab->lab_next)
{
if ((lab->lab_flags & PORT_DIR_MASK) == 0)
calmaWriteLabelFunc(lab, calmaWriteLabelFunc(lab,
CIFCurStyle->cs_labelLayer[lab->lab_type], f); CIFCurStyle->cs_labelLayer[lab->lab_type], f);
else
{
if ((lab->lab_flags & PORT_NUM_MASK) > maxport)
maxport = lab->lab_flags & PORT_NUM_MASK;
}
}
if (maxport >= 0)
for (i = 0; i <= maxport; i++)
for (lab = def->cd_labels; lab; lab = lab->lab_next)
if (((lab->lab_flags & PORT_DIR_MASK) != 0) &&
((lab->lab_flags & PORT_NUM_MASK) == i))
{
calmaWriteLabelFunc(lab,
CIFCurStyle->cs_labelLayer[lab->lab_type], f);
break;
}
}
/* End of structure */ /* End of structure */
calmaOutRH(4, CALMA_ENDSTR, CALMA_NODATA, f); calmaOutRH(4, CALMA_ENDSTR, CALMA_NODATA, f);