Added a negation capability to the "select intersect" command, so
that the intersection of (A and-not B) can be found. This and the (A and B) version give a large amount of capability like the cifoutput operators available as command-line commands. Also: Fixed the new "drop" command so that it properly redisplays and runs DRC after executing, and modified the behavior so that the dropped material is clipped to the area of the selection.
This commit is contained in:
parent
2cc557532d
commit
9656c86b96
|
|
@ -3955,6 +3955,9 @@ int cmdDropPaintCell(tile, cxp)
|
|||
|
||||
TiToRect(tile, &area);
|
||||
|
||||
/* Clip to search area */
|
||||
GEOCLIP(&area, &cxp->tc_scx->scx_area);
|
||||
|
||||
DBPaintMask(cellDef, &area, lMask);
|
||||
|
||||
return 0;
|
||||
|
|
@ -4078,6 +4081,7 @@ CmdDrop(w, cmd)
|
|||
TileTypeBitMask lMask, tMask;
|
||||
CellUse *checkUse;
|
||||
int pNum;
|
||||
Rect editBox;
|
||||
|
||||
if (cmd->tx_argc != 2)
|
||||
{
|
||||
|
|
@ -4085,7 +4089,7 @@ CmdDrop(w, cmd)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ToolGetEditBox((Rect *)NULL)) return;
|
||||
if (!ToolGetEditBox(&editBox)) return;
|
||||
if (!CmdParseLayers(cmd->tx_argv[1], &lMask))
|
||||
return;
|
||||
|
||||
|
|
@ -4121,6 +4125,10 @@ CmdDrop(w, cmd)
|
|||
cmdDropFunc, (ClientData)&lMask);
|
||||
}
|
||||
}
|
||||
|
||||
DRCCheckThis(EditCellUse->cu_def, TT_CHECKPAINT, &editBox);
|
||||
DBWAreaChanged(EditCellUse->cu_def, &editBox, DBW_ALLWINDOWS, &tMask);
|
||||
DBReComputeBbox(EditCellUse->cu_def);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -663,6 +663,8 @@ cmdIntersectArea(layer)
|
|||
int windowMask, xMask;
|
||||
DBWclientRec *crec;
|
||||
MagWindow *window;
|
||||
char *lptr;
|
||||
bool negate = FALSE;
|
||||
|
||||
bzero(&scx, sizeof(SearchContext));
|
||||
window = ToolGetBoxWindow(&scx.scx_area, &windowMask);
|
||||
|
|
@ -694,8 +696,23 @@ cmdIntersectArea(layer)
|
|||
scx.scx_use = (CellUse *) window->w_surfaceID;
|
||||
scx.scx_trans = GeoIdentityTransform;
|
||||
crec = (DBWclientRec *) window->w_clientData;
|
||||
ttype = DBTechNoisyNameType(layer);
|
||||
SelectIntersect(&scx, ttype, crec->dbw_bitmask);
|
||||
|
||||
/* Special behavior: "!" or "~" in front of layer name intersects */
|
||||
/* with NOT(layer). */
|
||||
|
||||
lptr = layer;
|
||||
if ((*lptr == '~') || (*lptr == '!'))
|
||||
{
|
||||
negate = TRUE;
|
||||
lptr++;
|
||||
}
|
||||
|
||||
ttype = DBTechNameType(lptr);
|
||||
if (ttype < 0) {
|
||||
TxError("Cannot parse layer type \"%s\".\n", layer);
|
||||
return;
|
||||
}
|
||||
SelectIntersect(&scx, ttype, crec->dbw_bitmask, negate);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ selIntersectPaintFunc(tile)
|
|||
*/
|
||||
|
||||
void
|
||||
SelectIntersect(scx, type, xMask)
|
||||
SelectIntersect(scx, type, xMask, negate)
|
||||
SearchContext *scx; /* Describes the area in which material
|
||||
* is to be selected. The resulting
|
||||
* coordinates should map to the coordinates
|
||||
|
|
@ -339,6 +339,7 @@ SelectIntersect(scx, type, xMask)
|
|||
* considered. 0 means treat everything as
|
||||
* expanded.
|
||||
*/
|
||||
bool negate; /* If true, search on NOT(type) */
|
||||
{
|
||||
TileTypeBitMask tMask, rMask;
|
||||
TileType s, t;
|
||||
|
|
@ -363,15 +364,23 @@ SelectIntersect(scx, type, xMask)
|
|||
|
||||
/* Select all paint of type "type" and copy into SelectDef */
|
||||
TTMaskSetOnlyType(&tMask, type);
|
||||
plane = DBPlane(t);
|
||||
|
||||
plane = DBPlane(type);
|
||||
(void) DBCellCopyAllPaint(scx, &tMask, xMask, SelectUse);
|
||||
|
||||
/* Scan Select2Def for all geometry inside the area of "type", and */
|
||||
/* copy back to SelectDef as "type" */
|
||||
|
||||
if (negate)
|
||||
{
|
||||
TTMaskCom(&tMask);
|
||||
TTMaskAndMask(&tMask, &DBPlaneTypes[plane]);
|
||||
}
|
||||
DBSrPaintArea((Tile *)NULL, SelectDef->cd_planes[plane],
|
||||
&scx->scx_area, &tMask, selIntersectPaintFunc, (ClientData)NULL);
|
||||
|
||||
if (negate) TTMaskSetOnlyType(&tMask, type); /* Restore original mask */
|
||||
|
||||
DBEraseMask(SelectDef, &TiPlaneRect, &tMask);
|
||||
|
||||
/* Display the new selection. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue