Added some options to the net selection with respect to labels.

The previous behavior was to generate hierarchical names for all
labels when copying contents of subcells.  This is "safe" for
copying selections without accidentally shorting things through
labeling, but it can make a mess of the selection.  Options are
now "select do labels" for the existing behavior, "select no labels"
to not show any labels, and "select simple labels" to show only the
root name of labels in subcells.
This commit is contained in:
Tim Edwards 2021-03-04 14:00:31 -05:00
parent c99e632744
commit 324721b514
10 changed files with 85 additions and 32 deletions

View File

@ -1 +1 @@
8.3.136 8.3.137

View File

@ -34,6 +34,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "calma/calma.h" /* for CalmaContactArrays */ #include "calma/calma.h" /* for CalmaContactArrays */
#include "commands/commands.h" /* for CmdFindNetProc() */ #include "commands/commands.h" /* for CmdFindNetProc() */
#include "select/selInt.h" /* for select use and def */ #include "select/selInt.h" /* for select use and def */
#include "select/select.h"
#include "utils/stack.h" #include "utils/stack.h"
#include "utils/malloc.h" #include "utils/malloc.h"
#include "utils/maxrect.h" #include "utils/maxrect.h"
@ -4786,7 +4787,7 @@ CIFGenLayer(op, area, cellDef, origDef, temps, hier, clientdata)
scx.scx_use = CIFDummyUse; scx.scx_use = CIFDummyUse;
scx.scx_trans = GeoIdentityTransform; scx.scx_trans = GeoIdentityTransform;
DBTreeCopyConnect(&scx, &DBConnectTbl[ttype], 0, DBTreeCopyConnect(&scx, &DBConnectTbl[ttype], 0,
DBConnectTbl, &TiPlaneRect, FALSE, Select2Use); DBConnectTbl, &TiPlaneRect, SEL_NO_LABELS, Select2Use);
cifSrTiles(op, area, Select2Def, temps, cifPaintFunc, cifSrTiles(op, area, Select2Def, temps, cifPaintFunc,
(ClientData) CIFPaintTable); (ClientData) CIFPaintTable);
DBCellClearDef(Select2Def); DBCellClearDef(Select2Def);

View File

@ -728,27 +728,29 @@ CmdSelect(w, cmd)
#define SEL_AREA 0 #define SEL_AREA 0
#define SEL_VISIBLE 1 #define SEL_VISIBLE 1
#define SEL_CELL 2 #define SEL_CELL 2
#define SEL_CLEAR 3 #define SEL_LABELS 3
#define SEL_FLAT 4 #define SEL_CLEAR 4
#define SEL_HELP 5 #define SEL_FLAT 5
#define SEL_KEEP 6 #define SEL_HELP 6
#define SEL_MOVE 7 #define SEL_KEEP 7
#define SEL_PICK 8 #define SEL_MOVE 8
#define SEL_SAVE 9 #define SEL_PICK 9
#define SEL_FEEDBACK 10 #define SEL_SAVE 10
#define SEL_BBOX 11 #define SEL_FEEDBACK 11
#define SEL_BOX 12 #define SEL_BBOX 12
#define SEL_CHUNK 13 #define SEL_BOX 13
#define SEL_REGION 14 #define SEL_CHUNK 14
#define SEL_NET 15 #define SEL_REGION 15
#define SEL_SHORT 16 #define SEL_NET 16
#define SEL_DEFAULT 17 #define SEL_SHORT 17
#define SEL_DEFAULT 18
static char *cmdSelectOption[] = static char *cmdSelectOption[] =
{ {
"area", "area",
"visible", "visible",
"cell", "cell",
"labels",
"clear", "clear",
"flat", "flat",
"help", "help",
@ -774,6 +776,7 @@ CmdSelect(w, cmd)
"[more | less] area [layers] [de]select all info under box in layers", "[more | less] area [layers] [de]select all info under box in layers",
"[more | less] visible [layers] [de]select all visible info under box in layers", "[more | less] visible [layers] [de]select all visible info under box in layers",
"[more | less | top] cell [name] [de]select cell under cursor, or \"name\"", "[more | less | top] cell [name] [de]select cell under cursor, or \"name\"",
"[do | no] labels [do not] select subcell labels",
"clear clear selection", "clear clear selection",
"flat flatten the contents of the selection", "flat flatten the contents of the selection",
"help print this message", "help print this message",
@ -832,6 +835,7 @@ CmdSelect(w, cmd)
bool layerspec; bool layerspec;
bool degenerate; bool degenerate;
bool more = FALSE, less = FALSE, samePlace = TRUE; bool more = FALSE, less = FALSE, samePlace = TRUE;
unsigned char labelpolicy = SEL_DO_LABELS;
#ifdef MAGIC_WRAPPER #ifdef MAGIC_WRAPPER
char *tclstr; char *tclstr;
Tcl_Obj *lobj; Tcl_Obj *lobj;
@ -851,7 +855,7 @@ CmdSelect(w, cmd)
/* See if "more" was given. If so, just strip off the "more" from /* See if "more" was given. If so, just strip off the "more" from
* the argument list and set the "more" flag. Similarly for options * the argument list and set the "more" flag. Similarly for options
* "less", "nocycle", "top", and "cell". * "less", "do", "no", "nocycle", "top", and "cell".
*/ */
if (cmd->tx_argc >= 2) if (cmd->tx_argc >= 2)
@ -876,6 +880,7 @@ CmdSelect(w, cmd)
else if (!strncmp(cmd->tx_argv[1], "nocycle", arg1len)) else if (!strncmp(cmd->tx_argv[1], "nocycle", arg1len))
{ {
samePlace = FALSE; samePlace = FALSE;
labelpolicy = SEL_NO_LABELS;
more = FALSE; more = FALSE;
less = FALSE; less = FALSE;
type = TT_SELECTBASE - 1; /* avoid cycling between types */ type = TT_SELECTBASE - 1; /* avoid cycling between types */
@ -890,6 +895,24 @@ CmdSelect(w, cmd)
optionArgs = &cmd->tx_argv[2]; optionArgs = &cmd->tx_argv[2];
cmd->tx_argc--; cmd->tx_argc--;
} }
else if (!strncmp(cmd->tx_argv[1], "do", arg1len))
{
labelpolicy = SEL_DO_LABELS;
optionArgs = &cmd->tx_argv[2];
cmd->tx_argc--;
}
else if (!strncmp(cmd->tx_argv[1], "no", arg1len))
{
labelpolicy = SEL_NO_LABELS;
optionArgs = &cmd->tx_argv[2];
cmd->tx_argc--;
}
else if (!strncmp(cmd->tx_argv[1], "simple", arg1len))
{
labelpolicy = SEL_SIMPLE_LABELS;
optionArgs = &cmd->tx_argv[2];
cmd->tx_argc--;
}
else if (!strncmp(cmd->tx_argv[1], "top", arg1len)) else if (!strncmp(cmd->tx_argv[1], "top", arg1len))
{ {
@ -982,6 +1005,14 @@ CmdSelect(w, cmd)
SelectClear(); SelectClear();
return; return;
case SEL_LABELS:
SelectDoLabels = labelpolicy;
if (SelectDoLabels)
TxPrintf("Selection includes subcell labels\n");
else
TxPrintf("Selection ignores subcell labels\n");
return;
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
* Print out help information. * Print out help information.
*-------------------------------------------------------------------- *--------------------------------------------------------------------

View File

@ -31,6 +31,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "utils/hash.h" #include "utils/hash.h"
#include "database/database.h" #include "database/database.h"
#include "database/databaseInt.h" #include "database/databaseInt.h"
#include "select/select.h"
#include "utils/signals.h" #include "utils/signals.h"
#include "utils/malloc.h" #include "utils/malloc.h"
@ -691,10 +692,15 @@ dbcConnectLabelFunc(scx, lab, tpath, csa2)
{ {
int newllen = tpath->tp_next - tpath->tp_first; int newllen = tpath->tp_next - tpath->tp_first;
newlabtext[0] = '\0'; newlabtext[0] = '\0';
if (newllen > 0) if (tpath->tp_first == NULL)
strncpy(newlabtext, tpath->tp_first, newllen); newlabptr = lab->lab_text;
sprintf(newlabtext + newllen, "%s", lab->lab_text); else
newlabptr = newlabtext; {
if (newllen > 0)
strncpy(newlabtext, tpath->tp_first, newllen);
sprintf(newlabtext + newllen, "%s", lab->lab_text);
newlabptr = newlabtext;
}
} }
else return 0; else return 0;
} }
@ -1019,9 +1025,10 @@ DBTreeCopyConnect(scx, mask, xMask, connect, area, doLabels, destUse)
* clipped to this area. Pass * clipped to this area. Pass
* TiPlaneRect to get everything. * TiPlaneRect to get everything.
*/ */
bool doLabels; /* If TRUE, copy connected labels unsigned char doLabels; /* If SEL_DO_LABELS, copy connected labels
* and paint. If FALSE, copy only * and paint. If SEL_NO_LABELS, copy only
* connected paint. * connected paint. If SEL_SIMPLE_LABELS,
* copy only root of labels in subcircuits.
*/ */
CellUse *destUse; /* Result use in which to place CellUse *destUse; /* Result use in which to place
* anything connected to material of * anything connected to material of
@ -1098,7 +1105,8 @@ DBTreeCopyConnect(scx, mask, xMask, connect, area, doLabels, destUse)
searchtype |= TF_LABEL_ATTACH_NOT_SE; searchtype |= TF_LABEL_ATTACH_NOT_SE;
} }
} }
if (doLabels) if (doLabels == SEL_SIMPLE_LABELS) tpath.tp_first = NULL;
if (doLabels != SEL_NO_LABELS)
DBTreeSrLabels(scx, newmask, xMask, &tpath, searchtype, DBTreeSrLabels(scx, newmask, xMask, &tpath, searchtype,
dbcConnectLabelFunc, (ClientData) &csa2); dbcConnectLabelFunc, (ClientData) &csa2);
} }

View File

@ -34,6 +34,7 @@
#include "extflat/EFint.h" #include "extflat/EFint.h"
#include "extract/extract.h" #include "extract/extract.h"
#include "extract/extractInt.h" #include "extract/extractInt.h"
#include "select/select.h"
#include "utils/malloc.h" #include "utils/malloc.h"
/* Forward declarations */ /* Forward declarations */
@ -505,7 +506,7 @@ antennacheckVisit(dev, hc, scale, trans, editUse)
/* To do: Mark tiles so area count can be progressive */ /* To do: Mark tiles so area count can be progressive */
DBTreeCopyConnect(&scx, &DBConnectTbl[t], 0, DBTreeCopyConnect(&scx, &DBConnectTbl[t], 0,
DBConnectTbl, &TiPlaneRect, FALSE, extPathUse); DBConnectTbl, &TiPlaneRect, SEL_NO_LABELS, extPathUse);
/* Search planes of tie types and accumulate all tiedown areas */ /* Search planes of tie types and accumulate all tiedown areas */
gdas.accum = (dlong)0; gdas.accum = (dlong)0;

View File

@ -45,6 +45,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "utils/signals.h" #include "utils/signals.h"
#include "windows/windows.h" #include "windows/windows.h"
#include "dbwind/dbwind.h" #include "dbwind/dbwind.h"
#include "select/select.h"
#include "utils/styles.h" #include "utils/styles.h"
#include "utils/stack.h" #include "utils/stack.h"
#include "utils/main.h" #include "utils/main.h"
@ -368,7 +369,7 @@ extLengthYank(use, labList)
scx.scx_trans = GeoIdentityTransform; scx.scx_trans = GeoIdentityTransform;
GEO_EXPAND(&lab->lab_rect, 1, &scx.scx_area); GEO_EXPAND(&lab->lab_rect, 1, &scx.scx_area);
DBTreeCopyConnect(&scx, &DBConnectTbl[lab->lab_type], 0, DBTreeCopyConnect(&scx, &DBConnectTbl[lab->lab_type], 0,
DBConnectTbl, &TiPlaneRect, TRUE, extPathUse); DBConnectTbl, &TiPlaneRect, SEL_DO_LABELS, extPathUse);
} }
if (DebugIsSet(extDebugID, extDebLength)) if (DebugIsSet(extDebugID, extDebLength))

View File

@ -35,6 +35,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "utils/styles.h" #include "utils/styles.h"
#include "textio/textio.h" #include "textio/textio.h"
#include "utils/main.h" #include "utils/main.h"
#include "select/select.h"
#include "netmenu/nmInt.h" #include "netmenu/nmInt.h"
/* The following owns describe the cell currently being highlighted, /* The following owns describe the cell currently being highlighted,
@ -294,7 +295,7 @@ NMShowUnderBox()
&DBAllButSpaceBits); &DBAllButSpaceBits);
DBCellClearDef(nmscShowUse->cu_def); DBCellClearDef(nmscShowUse->cu_def);
DBTreeCopyConnect(&scx, &DBAllButSpaceAndDRCBits, 0, DBTreeCopyConnect(&scx, &DBAllButSpaceAndDRCBits, 0,
DBConnectTbl, &TiPlaneRect, TRUE, nmscShowUse); DBConnectTbl, &TiPlaneRect, SEL_DO_LABELS, nmscShowUse);
DBWAreaChanged(nmscShowDef, &nmscShowDef->cd_bbox, DBW_ALLWINDOWS, DBWAreaChanged(nmscShowDef, &nmscShowDef->cd_bbox, DBW_ALLWINDOWS,
&DBAllButSpaceBits); &DBAllButSpaceBits);
NMShowCell(nmscShowUse, rootDef); NMShowCell(nmscShowUse, rootDef);
@ -418,6 +419,6 @@ nmSRNFunc(rect, name, label, cdarg)
scx.scx_trans = GeoIdentityTransform; scx.scx_trans = GeoIdentityTransform;
DBTreeCopyConnect(&scx, &DBConnectTbl[label->lab_type], 0, DBTreeCopyConnect(&scx, &DBConnectTbl[label->lab_type], 0,
DBConnectTbl, &TiPlaneRect, TRUE, nmscShowUse); DBConnectTbl, &TiPlaneRect, SEL_DO_LABELS, nmscShowUse);
return(0); return(0);
} }

View File

@ -749,7 +749,7 @@ SelectRegion(scx, type, xMask, pArea, less)
UndoDisable(); UndoDisable();
DBCellClearDef(Select2Def); DBCellClearDef(Select2Def);
DBTreeCopyConnect(scx, &connections[type], xMask, connections, DBTreeCopyConnect(scx, &connections[type], xMask, connections,
&TiPlaneRect, TRUE, Select2Use); &TiPlaneRect, SelectDoLabels, Select2Use);
UndoEnable(); UndoEnable();
/* Now transfer what we found into the main selection cell. Pick /* Now transfer what we found into the main selection cell. Pick
@ -850,7 +850,7 @@ SelectNet(scx, type, xMask, pArea, less)
UndoDisable(); UndoDisable();
DBCellClearDef(Select2Def); DBCellClearDef(Select2Def);
DBTreeCopyConnect(scx, &mask, xMask, DBConnectTbl, DBTreeCopyConnect(scx, &mask, xMask, DBConnectTbl,
&TiPlaneRect, TRUE, Select2Use); &TiPlaneRect, SelectDoLabels, Select2Use);
UndoEnable(); UndoEnable();
/* Network undo method added by Nishit and Tim, July 8-10, 2004 */ /* Network undo method added by Nishit and Tim, July 8-10, 2004 */

View File

@ -47,6 +47,7 @@ static int selStretchX, selStretchY; /* Stretch distances. Only one should
* ever be non-zero. * ever be non-zero.
*/ */
static TileType selStretchType; /* Type of material being stretched. */ static TileType selStretchType; /* Type of material being stretched. */
unsigned char SelectDoLabels = SEL_DO_LABELS; /* Whether or not to select subcell labels */
typedef struct planeAndArea typedef struct planeAndArea
{ {

View File

@ -56,6 +56,15 @@ extern void SelectStretch();
extern void SelectArray(); extern void SelectArray();
extern void SelectDump(); extern void SelectDump();
/* Flag to indicate whether selection captures subcell labels */
extern unsigned char SelectDoLabels;
/* Flag values for SelectDoLabels: */
#define SEL_NO_LABELS 0
#define SEL_DO_LABELS 1
#define SEL_SIMPLE_LABELS 2
/* The following is the root cell that contains the current selection. */ /* The following is the root cell that contains the current selection. */
extern CellDef *SelectRootDef; extern CellDef *SelectRootDef;