Extended the "what" command to take the option "-listall" in
addition to "-list", where the list of layers returned is more like the (recently extended) non-listing method where each type is followed by a list of cell names in which that type is found (within the selection area).
This commit is contained in:
parent
b0f89ea4af
commit
dd86ecc454
|
|
@ -825,7 +825,6 @@ int cmdWhatPrintCell(tile, cxp)
|
|||
}
|
||||
if (curlid == NULL)
|
||||
{
|
||||
TxPrintf(" %s ", CurrCellName);
|
||||
curlid = (struct linked_id *)mallocMagic(sizeof(struct linked_id));
|
||||
curlid->lid_name = CurrCellName;
|
||||
curlid->lid_next = *lid;
|
||||
|
|
@ -887,7 +886,7 @@ cmdFindWhatTileFunc(Tile *tile, ClientData clientData)
|
|||
* Print out information about what's selected.
|
||||
*
|
||||
* Usage:
|
||||
* what [-list]
|
||||
* what [-list[all]]
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
|
|
@ -896,7 +895,8 @@ cmdFindWhatTileFunc(Tile *tile, ClientData clientData)
|
|||
* Information gets printed to identify the kinds of paint, plus
|
||||
* labels and subcells, that are selected.
|
||||
* In the TCL version, the "-list" option puts the result in a
|
||||
* nested TCL list.
|
||||
* nested TCL list. The "-listall" variant gives more information
|
||||
* about what cell(s) each type exists in, in the type list.
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -908,12 +908,12 @@ CmdWhat(w, cmd)
|
|||
{
|
||||
int i, locargc;
|
||||
bool foundAny;
|
||||
bool doList = FALSE;
|
||||
bool doList = FALSE, doListAll = FALSE;
|
||||
TileTypeBitMask layers, maskBits, *rMask;
|
||||
CellUse *CheckUse;
|
||||
|
||||
#ifdef MAGIC_WRAPPER
|
||||
Tcl_Obj *lobj, *paintobj, *labelobj, *cellobj;
|
||||
Tcl_Obj *lobj, *paintobj, *paintcellobj, *labelobj, *cellobj;
|
||||
extern int cmdWhatCellListFunc();
|
||||
#endif
|
||||
|
||||
|
|
@ -923,14 +923,23 @@ CmdWhat(w, cmd)
|
|||
locargc = cmd->tx_argc;
|
||||
|
||||
#ifdef MAGIC_WRAPPER
|
||||
if ((locargc == 2) && !strncmp(cmd->tx_argv[locargc - 1], "-list", 5))
|
||||
if (locargc == 2)
|
||||
{
|
||||
doList = TRUE;
|
||||
locargc--;
|
||||
lobj = Tcl_NewListObj(0, NULL);
|
||||
paintobj = Tcl_NewListObj(0, NULL);
|
||||
labelobj = Tcl_NewListObj(0, NULL);
|
||||
cellobj = Tcl_NewListObj(0, NULL);
|
||||
if (!strncmp(cmd->tx_argv[locargc - 1], "-list", 5))
|
||||
{
|
||||
if (!strncmp(cmd->tx_argv[locargc - 1], "-listall", 8))
|
||||
{
|
||||
doListAll = TRUE;
|
||||
paintcellobj = Tcl_NewListObj(0, NULL);
|
||||
}
|
||||
else
|
||||
doList = TRUE;
|
||||
locargc--;
|
||||
lobj = Tcl_NewListObj(0, NULL);
|
||||
paintobj = Tcl_NewListObj(0, NULL);
|
||||
labelobj = Tcl_NewListObj(0, NULL);
|
||||
cellobj = Tcl_NewListObj(0, NULL);
|
||||
}
|
||||
}
|
||||
if (locargc > 1)
|
||||
{
|
||||
|
|
@ -993,7 +1002,7 @@ CmdWhat(w, cmd)
|
|||
if ((CheckUse != NULL) && (CheckUse->cu_def == SelectRootDef))
|
||||
{
|
||||
CellUse *saveUse = EditCellUse;
|
||||
struct linked_id *lid;
|
||||
struct linked_id *lid, *lidp;
|
||||
int pNum;
|
||||
|
||||
EditCellUse = CheckUse;
|
||||
|
|
@ -1012,7 +1021,6 @@ CmdWhat(w, cmd)
|
|||
/* cell or subcell that tile belongs to. */
|
||||
|
||||
lid = NULL;
|
||||
TxPrintf(" %-8s (", DBTypeLongName(i));
|
||||
for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++)
|
||||
if (TTMaskHasType(&DBPlaneTypes[pNum], i))
|
||||
{
|
||||
|
|
@ -1021,7 +1029,25 @@ CmdWhat(w, cmd)
|
|||
cmdFindWhatTileFunc, (ClientData)&lid);
|
||||
}
|
||||
|
||||
TxPrintf(")\n");
|
||||
if (!doListAll)
|
||||
{
|
||||
TxPrintf(" %-8s (", DBTypeLongName(i));
|
||||
for (lidp = lid; lidp; lidp = lidp->lid_next)
|
||||
TxPrintf(" %s ", lidp->lid_name);
|
||||
TxPrintf(")\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
Tcl_ListObjAppendElement(magicinterp, paintobj,
|
||||
Tcl_NewStringObj(DBTypeLongName(i), -1));
|
||||
Tcl_ListObjAppendElement(magicinterp, paintobj,
|
||||
paintcellobj);
|
||||
|
||||
for (lidp = lid; lidp; lidp = lidp->lid_next)
|
||||
Tcl_ListObjAppendElement(magicinterp, paintcellobj,
|
||||
Tcl_NewStringObj(lidp->lid_name, -1));
|
||||
}
|
||||
|
||||
while (lid != NULL)
|
||||
{
|
||||
freeMagic(lid);
|
||||
|
|
@ -1056,7 +1082,7 @@ CmdWhat(w, cmd)
|
|||
qsort(labelBlockTop, labelEntryCount, sizeof(LabelStore), orderLabelFunc);
|
||||
|
||||
#ifdef MAGIC_WRAPPER
|
||||
if (doList)
|
||||
if (doList || doListAll)
|
||||
{
|
||||
Tcl_Obj *newtriple;
|
||||
for (labelEntry = labelBlockTop; labelEntryCount-- > 0; labelEntry++)
|
||||
|
|
@ -1100,7 +1126,7 @@ CmdWhat(w, cmd)
|
|||
|
||||
foundAny = FALSE;
|
||||
#ifdef MAGIC_WRAPPER
|
||||
if (doList)
|
||||
if (doList || doListAll)
|
||||
SelEnumCells(FALSE, (bool *) NULL, (SearchContext *) NULL,
|
||||
cmdWhatCellListFunc, (ClientData) cellobj);
|
||||
else
|
||||
|
|
@ -1109,7 +1135,7 @@ CmdWhat(w, cmd)
|
|||
cmdWhatCellFunc, (ClientData) &foundAny);
|
||||
|
||||
#ifdef MAGIC_WRAPPER
|
||||
if (doList)
|
||||
if (doList || doListAll)
|
||||
{
|
||||
Tcl_ListObjAppendElement(magicinterp, lobj, paintobj);
|
||||
Tcl_ListObjAppendElement(magicinterp, lobj, labelobj);
|
||||
|
|
|
|||
Loading…
Reference in New Issue