diff --git a/commands/CmdCD.c b/commands/CmdCD.c index 5d71580d..2eec220e 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -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); } /* diff --git a/commands/CmdRS.c b/commands/CmdRS.c index 992987c0..86fc0760 100644 --- a/commands/CmdRS.c +++ b/commands/CmdRS.c @@ -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); } /* diff --git a/select/selCreate.c b/select/selCreate.c index ebb92793..4a7124a2 100644 --- a/select/selCreate.c +++ b/select/selCreate.c @@ -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. */