Additional code to make sure that the database scaling acts on all
values in a mask hints property, and added back the handling of mask hints in the top level cell, since the hierarchical function on cells does not apply the function to the top level.
This commit is contained in:
parent
d4c3939feb
commit
a35f3b3d14
|
|
@ -201,7 +201,76 @@ cifHierCleanup()
|
|||
SigEnableInterrupts();
|
||||
}
|
||||
|
||||
/* Structure used by cifFlatMaskHints */
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* cifMaskHints --
|
||||
*
|
||||
* Copy a mask hint into a target cell by adding it to the
|
||||
* property list of the target cell. If the target cell already
|
||||
* has the same mask hint key, then the mask hint value is
|
||||
* appended to the property in the target cell def.
|
||||
*
|
||||
* Returns:
|
||||
* 0 to keep the search going.
|
||||
*
|
||||
* Side effects:
|
||||
* Modifies properties of the target cell def.
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
cifMaskHints(name, value, targetDef)
|
||||
char *name;
|
||||
char *value;
|
||||
CellDef *targetDef;
|
||||
{
|
||||
char *propvalue, *newval;
|
||||
bool propfound;
|
||||
|
||||
if (!strncmp(name, "MASKHINTS_", 10))
|
||||
{
|
||||
/* Check if name exists already in the flattened cell */
|
||||
propvalue = (char *)DBPropGet(targetDef, name, &propfound);
|
||||
if (propfound)
|
||||
{
|
||||
/* Append value to the property */
|
||||
newval = mallocMagic(strlen(value) + strlen(propvalue) + 2);
|
||||
sprintf(newval, "%s %s", propvalue, value);
|
||||
}
|
||||
else
|
||||
newval = StrDup((char **)NULL, value);
|
||||
|
||||
DBPropPut(targetDef, name, newval);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* CIFCopyMaskHints --
|
||||
*
|
||||
* Callback function to copy mask hints from one cell into another.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* May modify properties in the target cell.
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
CIFCopyMaskHints(sourceDef, targetDef)
|
||||
CellDef *sourceDef;
|
||||
CellDef *targetDef;
|
||||
{
|
||||
DBPropEnum(sourceDef, cifMaskHints, targetDef);
|
||||
}
|
||||
|
||||
/* Structure used by cifFlatMaskHints, below */
|
||||
|
||||
typedef struct _maskHintsData
|
||||
{
|
||||
|
|
@ -286,7 +355,6 @@ cifFlatMaskHints(name, value, mhd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
|
|
@ -437,6 +505,7 @@ cifHierCellFunc(scx)
|
|||
cifHierCopyFunc, (ClientData) CIFComponentDef);
|
||||
|
||||
/* Flatten mask hints in the area of interest */
|
||||
CIFCopyMaskHints(scx->scx_use->cu_def, CIFComponentDef);
|
||||
DBTreeSrCells(&newscx, 0, cifHierCopyMaskHints,
|
||||
(ClientData)CIFComponentDef);
|
||||
|
||||
|
|
@ -759,6 +828,7 @@ CIFGenSubcells(def, area, output)
|
|||
(void) DBTreeSrTiles(&scx, &CIFCurStyle->cs_yankLayers, 0,
|
||||
cifHierCopyFunc, (ClientData) CIFTotalDef);
|
||||
/* Flatten mask hints in the area of interest */
|
||||
CIFCopyMaskHints(def, CIFTotalDef);
|
||||
DBTreeSrCells(&scx, 0, cifHierCopyMaskHints,
|
||||
(ClientData)CIFTotalDef);
|
||||
|
||||
|
|
@ -887,12 +957,14 @@ cifHierElementFunc(use, transform, x, y, checkArea)
|
|||
scx.scx_use = use;
|
||||
(void) DBTreeSrTiles(&scx, &CIFCurStyle->cs_yankLayers, 0,
|
||||
cifHierCopyFunc, (ClientData) CIFTotalDef);
|
||||
CIFCopyMaskHints(use->cu_def, CIFTotalDef);
|
||||
DBTreeSrCells(&scx, 0, cifHierCopyMaskHints,
|
||||
(ClientData)CIFTotalDef);
|
||||
|
||||
DBCellClearDef(CIFComponentDef);
|
||||
(void) DBTreeSrTiles(&scx, &CIFCurStyle->cs_yankLayers, 0,
|
||||
cifHierCopyFunc, (ClientData) CIFComponentDef);
|
||||
CIFCopyMaskHints(use->cu_def, CIFComponentDef);
|
||||
DBTreeSrCells(&scx, 0, cifHierCopyMaskHints,
|
||||
(ClientData)CIFComponentDef);
|
||||
|
||||
|
|
|
|||
|
|
@ -322,6 +322,7 @@ extern void CIFInitCells();
|
|||
extern int cifHierCopyFunc();
|
||||
extern int cifHierCopyMaskHints();
|
||||
extern void CIFLoadStyle();
|
||||
extern void CIFCopyMaskHints();
|
||||
|
||||
/* Shared variables and structures: */
|
||||
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ CIFPaintLayer(rootDef, area, cifLayer, magicLayer, paintDef)
|
|||
scx.scx_trans = GeoIdentityTransform;
|
||||
(void) DBTreeSrTiles(&scx, &DBAllButSpaceAndDRCBits, 0,
|
||||
cifHierCopyFunc, (ClientData) CIFComponentDef);
|
||||
CIFCopyMaskHints(rootDef, CIFComponentDef);
|
||||
DBTreeSrCells(&scx, 0, cifHierCopyMaskHints,
|
||||
(ClientData)CIFComponentDef);
|
||||
|
||||
|
|
@ -281,6 +282,7 @@ CIFSeeLayer(rootDef, area, layer)
|
|||
scx.scx_trans = GeoIdentityTransform;
|
||||
(void) DBTreeSrTiles(&scx, &DBAllButSpaceAndDRCBits, 0,
|
||||
cifHierCopyFunc, (ClientData) CIFComponentDef);
|
||||
CIFCopyMaskHints(rootDef, CIFComponentDef);
|
||||
DBTreeSrCells(&scx, 0, cifHierCopyMaskHints,
|
||||
(ClientData)CIFComponentDef);
|
||||
|
||||
|
|
@ -449,6 +451,7 @@ CIFCoverageLayer(rootDef, area, layer)
|
|||
scx.scx_trans = GeoIdentityTransform;
|
||||
(void) DBTreeSrTiles(&scx, &DBAllButSpaceAndDRCBits, 0,
|
||||
cifHierCopyFunc, (ClientData) CIFComponentDef);
|
||||
CIFCopyMaskHints(rootDef, CIFComponentDef);
|
||||
DBTreeSrCells(&scx, 0, cifHierCopyMaskHints,
|
||||
(ClientData)CIFComponentDef);
|
||||
|
||||
|
|
|
|||
|
|
@ -768,6 +768,9 @@ cleanup:
|
|||
* remaining elements of the current array are skipped, but the
|
||||
* search is not aborted.
|
||||
*
|
||||
* NOTE: Unlike DBTreeSrTiles and DBTreeSrLabels, the function is not
|
||||
* applied to the top level cell, only to descendents.
|
||||
*
|
||||
* Each element of an array is returned separately.
|
||||
*
|
||||
* Results:
|
||||
|
|
@ -1807,10 +1810,10 @@ int dbScaleProp(name, value, cps)
|
|||
CellPropStruct *cps;
|
||||
{
|
||||
int scalen, scaled;
|
||||
char *newvalue;
|
||||
char *newvalue, *vptr;
|
||||
Rect r;
|
||||
|
||||
if (!strcmp(name, "FIXED_BBOX") || !strncmp(name, "MASKHINTS_", 10))
|
||||
if (!strcmp(name, "FIXED_BBOX"))
|
||||
{
|
||||
if (sscanf(value, "%d %d %d %d", &r.r_xbot, &r.r_ybot,
|
||||
&r.r_xtop, &r.r_ytop) == 4)
|
||||
|
|
@ -1830,6 +1833,55 @@ int dbScaleProp(name, value, cps)
|
|||
DBPropPut(cps->cps_def, name, newvalue);
|
||||
}
|
||||
}
|
||||
else if (!strncmp(name, "MASKHINTS_", 10))
|
||||
{
|
||||
char *vptr, *lastval;
|
||||
int lastlen;
|
||||
|
||||
newvalue = (char *)NULL;
|
||||
vptr = value;
|
||||
while (*vptr != '\0')
|
||||
{
|
||||
if (sscanf(vptr, "%d %d %d %d", &r.r_xbot, &r.r_ybot,
|
||||
&r.r_xtop, &r.r_ytop) == 4)
|
||||
{
|
||||
/* Scale numerator held in point X value, */
|
||||
/* scale denominator held in point Y value */
|
||||
|
||||
scalen = cps->cps_point.p_x;
|
||||
scaled = cps->cps_point.p_y;
|
||||
|
||||
DBScalePoint(&r.r_ll, scalen, scaled);
|
||||
DBScalePoint(&r.r_ur, scalen, scaled);
|
||||
|
||||
lastval = newvalue;
|
||||
lastlen = (lastval) ? strlen(lastval) : 0;
|
||||
newvalue = mallocMagic(40 + lastlen);
|
||||
|
||||
if (lastval)
|
||||
strcpy(newvalue, lastval);
|
||||
else
|
||||
*newvalue = '\0';
|
||||
|
||||
sprintf(newvalue + lastlen, "%s%d %d %d %d", (lastval) ? "" : " ",
|
||||
r.r_xbot, r.r_ybot, r.r_xtop, r.r_ytop);
|
||||
if (lastval) freeMagic(lastval);
|
||||
|
||||
/* Parse through the four values and check if there's more */
|
||||
while (*vptr && !isspace(*vptr)) vptr++;
|
||||
while (*vptr && isspace(*vptr)) vptr++;
|
||||
while (*vptr && !isspace(*vptr)) vptr++;
|
||||
while (*vptr && isspace(*vptr)) vptr++;
|
||||
while (*vptr && !isspace(*vptr)) vptr++;
|
||||
while (*vptr && isspace(*vptr)) vptr++;
|
||||
while (*vptr && !isspace(*vptr)) vptr++;
|
||||
while (*vptr && isspace(*vptr)) vptr++;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
if (newvalue)
|
||||
DBPropPut(cps->cps_def, name, newvalue);
|
||||
}
|
||||
return 0; /* Keep enumerating through properties */
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
|||
|
||||
/* ----------------------------------------------------------------------------
|
||||
*
|
||||
*DBPropPut --
|
||||
* DBPropPut --
|
||||
*
|
||||
* Put a property onto a celldef.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue