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)
|
if (curlid == NULL)
|
||||||
{
|
{
|
||||||
TxPrintf(" %s ", CurrCellName);
|
|
||||||
curlid = (struct linked_id *)mallocMagic(sizeof(struct linked_id));
|
curlid = (struct linked_id *)mallocMagic(sizeof(struct linked_id));
|
||||||
curlid->lid_name = CurrCellName;
|
curlid->lid_name = CurrCellName;
|
||||||
curlid->lid_next = *lid;
|
curlid->lid_next = *lid;
|
||||||
|
|
@ -887,7 +886,7 @@ cmdFindWhatTileFunc(Tile *tile, ClientData clientData)
|
||||||
* Print out information about what's selected.
|
* Print out information about what's selected.
|
||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
* what [-list]
|
* what [-list[all]]
|
||||||
*
|
*
|
||||||
* Results:
|
* Results:
|
||||||
* None.
|
* None.
|
||||||
|
|
@ -896,7 +895,8 @@ cmdFindWhatTileFunc(Tile *tile, ClientData clientData)
|
||||||
* Information gets printed to identify the kinds of paint, plus
|
* Information gets printed to identify the kinds of paint, plus
|
||||||
* labels and subcells, that are selected.
|
* labels and subcells, that are selected.
|
||||||
* In the TCL version, the "-list" option puts the result in a
|
* 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;
|
int i, locargc;
|
||||||
bool foundAny;
|
bool foundAny;
|
||||||
bool doList = FALSE;
|
bool doList = FALSE, doListAll = FALSE;
|
||||||
TileTypeBitMask layers, maskBits, *rMask;
|
TileTypeBitMask layers, maskBits, *rMask;
|
||||||
CellUse *CheckUse;
|
CellUse *CheckUse;
|
||||||
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
Tcl_Obj *lobj, *paintobj, *labelobj, *cellobj;
|
Tcl_Obj *lobj, *paintobj, *paintcellobj, *labelobj, *cellobj;
|
||||||
extern int cmdWhatCellListFunc();
|
extern int cmdWhatCellListFunc();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -923,14 +923,23 @@ CmdWhat(w, cmd)
|
||||||
locargc = cmd->tx_argc;
|
locargc = cmd->tx_argc;
|
||||||
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
if ((locargc == 2) && !strncmp(cmd->tx_argv[locargc - 1], "-list", 5))
|
if (locargc == 2)
|
||||||
{
|
{
|
||||||
doList = TRUE;
|
if (!strncmp(cmd->tx_argv[locargc - 1], "-list", 5))
|
||||||
locargc--;
|
{
|
||||||
lobj = Tcl_NewListObj(0, NULL);
|
if (!strncmp(cmd->tx_argv[locargc - 1], "-listall", 8))
|
||||||
paintobj = Tcl_NewListObj(0, NULL);
|
{
|
||||||
labelobj = Tcl_NewListObj(0, NULL);
|
doListAll = TRUE;
|
||||||
cellobj = Tcl_NewListObj(0, NULL);
|
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)
|
if (locargc > 1)
|
||||||
{
|
{
|
||||||
|
|
@ -993,7 +1002,7 @@ CmdWhat(w, cmd)
|
||||||
if ((CheckUse != NULL) && (CheckUse->cu_def == SelectRootDef))
|
if ((CheckUse != NULL) && (CheckUse->cu_def == SelectRootDef))
|
||||||
{
|
{
|
||||||
CellUse *saveUse = EditCellUse;
|
CellUse *saveUse = EditCellUse;
|
||||||
struct linked_id *lid;
|
struct linked_id *lid, *lidp;
|
||||||
int pNum;
|
int pNum;
|
||||||
|
|
||||||
EditCellUse = CheckUse;
|
EditCellUse = CheckUse;
|
||||||
|
|
@ -1012,7 +1021,6 @@ CmdWhat(w, cmd)
|
||||||
/* cell or subcell that tile belongs to. */
|
/* cell or subcell that tile belongs to. */
|
||||||
|
|
||||||
lid = NULL;
|
lid = NULL;
|
||||||
TxPrintf(" %-8s (", DBTypeLongName(i));
|
|
||||||
for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++)
|
for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++)
|
||||||
if (TTMaskHasType(&DBPlaneTypes[pNum], i))
|
if (TTMaskHasType(&DBPlaneTypes[pNum], i))
|
||||||
{
|
{
|
||||||
|
|
@ -1021,7 +1029,25 @@ CmdWhat(w, cmd)
|
||||||
cmdFindWhatTileFunc, (ClientData)&lid);
|
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)
|
while (lid != NULL)
|
||||||
{
|
{
|
||||||
freeMagic(lid);
|
freeMagic(lid);
|
||||||
|
|
@ -1056,7 +1082,7 @@ CmdWhat(w, cmd)
|
||||||
qsort(labelBlockTop, labelEntryCount, sizeof(LabelStore), orderLabelFunc);
|
qsort(labelBlockTop, labelEntryCount, sizeof(LabelStore), orderLabelFunc);
|
||||||
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
if (doList)
|
if (doList || doListAll)
|
||||||
{
|
{
|
||||||
Tcl_Obj *newtriple;
|
Tcl_Obj *newtriple;
|
||||||
for (labelEntry = labelBlockTop; labelEntryCount-- > 0; labelEntry++)
|
for (labelEntry = labelBlockTop; labelEntryCount-- > 0; labelEntry++)
|
||||||
|
|
@ -1100,7 +1126,7 @@ CmdWhat(w, cmd)
|
||||||
|
|
||||||
foundAny = FALSE;
|
foundAny = FALSE;
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
if (doList)
|
if (doList || doListAll)
|
||||||
SelEnumCells(FALSE, (bool *) NULL, (SearchContext *) NULL,
|
SelEnumCells(FALSE, (bool *) NULL, (SearchContext *) NULL,
|
||||||
cmdWhatCellListFunc, (ClientData) cellobj);
|
cmdWhatCellListFunc, (ClientData) cellobj);
|
||||||
else
|
else
|
||||||
|
|
@ -1109,7 +1135,7 @@ CmdWhat(w, cmd)
|
||||||
cmdWhatCellFunc, (ClientData) &foundAny);
|
cmdWhatCellFunc, (ClientData) &foundAny);
|
||||||
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
if (doList)
|
if (doList || doListAll)
|
||||||
{
|
{
|
||||||
Tcl_ListObjAppendElement(magicinterp, lobj, paintobj);
|
Tcl_ListObjAppendElement(magicinterp, lobj, paintobj);
|
||||||
Tcl_ListObjAppendElement(magicinterp, lobj, labelobj);
|
Tcl_ListObjAppendElement(magicinterp, lobj, labelobj);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue