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);
|
TiToRect(tile, &area);
|
||||||
|
|
||||||
|
/* Clip to search area */
|
||||||
|
GEOCLIP(&area, &cxp->tc_scx->scx_area);
|
||||||
|
|
||||||
DBPaintMask(cellDef, &area, lMask);
|
DBPaintMask(cellDef, &area, lMask);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -4078,6 +4081,7 @@ CmdDrop(w, cmd)
|
||||||
TileTypeBitMask lMask, tMask;
|
TileTypeBitMask lMask, tMask;
|
||||||
CellUse *checkUse;
|
CellUse *checkUse;
|
||||||
int pNum;
|
int pNum;
|
||||||
|
Rect editBox;
|
||||||
|
|
||||||
if (cmd->tx_argc != 2)
|
if (cmd->tx_argc != 2)
|
||||||
{
|
{
|
||||||
|
|
@ -4085,7 +4089,7 @@ CmdDrop(w, cmd)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ToolGetEditBox((Rect *)NULL)) return;
|
if (!ToolGetEditBox(&editBox)) return;
|
||||||
if (!CmdParseLayers(cmd->tx_argv[1], &lMask))
|
if (!CmdParseLayers(cmd->tx_argv[1], &lMask))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -4121,6 +4125,10 @@ CmdDrop(w, cmd)
|
||||||
cmdDropFunc, (ClientData)&lMask);
|
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;
|
int windowMask, xMask;
|
||||||
DBWclientRec *crec;
|
DBWclientRec *crec;
|
||||||
MagWindow *window;
|
MagWindow *window;
|
||||||
|
char *lptr;
|
||||||
|
bool negate = FALSE;
|
||||||
|
|
||||||
bzero(&scx, sizeof(SearchContext));
|
bzero(&scx, sizeof(SearchContext));
|
||||||
window = ToolGetBoxWindow(&scx.scx_area, &windowMask);
|
window = ToolGetBoxWindow(&scx.scx_area, &windowMask);
|
||||||
|
|
@ -694,8 +696,23 @@ cmdIntersectArea(layer)
|
||||||
scx.scx_use = (CellUse *) window->w_surfaceID;
|
scx.scx_use = (CellUse *) window->w_surfaceID;
|
||||||
scx.scx_trans = GeoIdentityTransform;
|
scx.scx_trans = GeoIdentityTransform;
|
||||||
crec = (DBWclientRec *) window->w_clientData;
|
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
|
void
|
||||||
SelectIntersect(scx, type, xMask)
|
SelectIntersect(scx, type, xMask, negate)
|
||||||
SearchContext *scx; /* Describes the area in which material
|
SearchContext *scx; /* Describes the area in which material
|
||||||
* is to be selected. The resulting
|
* is to be selected. The resulting
|
||||||
* coordinates should map to the coordinates
|
* coordinates should map to the coordinates
|
||||||
|
|
@ -339,6 +339,7 @@ SelectIntersect(scx, type, xMask)
|
||||||
* considered. 0 means treat everything as
|
* considered. 0 means treat everything as
|
||||||
* expanded.
|
* expanded.
|
||||||
*/
|
*/
|
||||||
|
bool negate; /* If true, search on NOT(type) */
|
||||||
{
|
{
|
||||||
TileTypeBitMask tMask, rMask;
|
TileTypeBitMask tMask, rMask;
|
||||||
TileType s, t;
|
TileType s, t;
|
||||||
|
|
@ -363,15 +364,23 @@ SelectIntersect(scx, type, xMask)
|
||||||
|
|
||||||
/* Select all paint of type "type" and copy into SelectDef */
|
/* Select all paint of type "type" and copy into SelectDef */
|
||||||
TTMaskSetOnlyType(&tMask, type);
|
TTMaskSetOnlyType(&tMask, type);
|
||||||
plane = DBPlane(t);
|
|
||||||
|
plane = DBPlane(type);
|
||||||
(void) DBCellCopyAllPaint(scx, &tMask, xMask, SelectUse);
|
(void) DBCellCopyAllPaint(scx, &tMask, xMask, SelectUse);
|
||||||
|
|
||||||
/* Scan Select2Def for all geometry inside the area of "type", and */
|
/* Scan Select2Def for all geometry inside the area of "type", and */
|
||||||
/* copy back to SelectDef as "type" */
|
/* copy back to SelectDef as "type" */
|
||||||
|
|
||||||
|
if (negate)
|
||||||
|
{
|
||||||
|
TTMaskCom(&tMask);
|
||||||
|
TTMaskAndMask(&tMask, &DBPlaneTypes[plane]);
|
||||||
|
}
|
||||||
DBSrPaintArea((Tile *)NULL, SelectDef->cd_planes[plane],
|
DBSrPaintArea((Tile *)NULL, SelectDef->cd_planes[plane],
|
||||||
&scx->scx_area, &tMask, selIntersectPaintFunc, (ClientData)NULL);
|
&scx->scx_area, &tMask, selIntersectPaintFunc, (ClientData)NULL);
|
||||||
|
|
||||||
|
if (negate) TTMaskSetOnlyType(&tMask, type); /* Restore original mask */
|
||||||
|
|
||||||
DBEraseMask(SelectDef, &TiPlaneRect, &tMask);
|
DBEraseMask(SelectDef, &TiPlaneRect, &tMask);
|
||||||
|
|
||||||
/* Display the new selection. */
|
/* Display the new selection. */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue