Added two new command options: "select bbox", which returns the
bounding box of the selection (somewhat unuseful, especially as the result gets absorbed by the tag callback), and "box select", which sets the cursor box to the bounding box of the selection (much more useful). Also corrected the "port" command so that the command "port make" will search only for non-port labels.
This commit is contained in:
parent
52d9639011
commit
076ee09e2e
|
|
@ -545,6 +545,7 @@ selGetArrayFunc(selUse, use, trans, arg)
|
|||
* box size [width height]
|
||||
* box position [llx lly] [-edit]
|
||||
* box values [llx lly urx ury] [-edit]
|
||||
* box select
|
||||
*
|
||||
* box <direction> <distance> | cursor
|
||||
*
|
||||
|
|
@ -580,13 +581,14 @@ selGetArrayFunc(selUse, use, trans, arg)
|
|||
#define BOX_SIZE 2
|
||||
#define BOX_POSITION 3
|
||||
#define BOX_VALUES 4
|
||||
#define BOX_MOVE 5
|
||||
#define BOX_GROW 6
|
||||
#define BOX_SHRINK 7
|
||||
#define BOX_CORNER 8
|
||||
#define BOX_EXISTS 9
|
||||
#define BOX_HELP 10
|
||||
#define BOX_DEFAULT 11
|
||||
#define BOX_SELECT 5
|
||||
#define BOX_MOVE 6
|
||||
#define BOX_GROW 7
|
||||
#define BOX_SHRINK 8
|
||||
#define BOX_CORNER 9
|
||||
#define BOX_EXISTS 10
|
||||
#define BOX_HELP 11
|
||||
#define BOX_DEFAULT 12
|
||||
|
||||
void
|
||||
CmdBox(w, cmd)
|
||||
|
|
@ -599,6 +601,7 @@ CmdBox(w, cmd)
|
|||
"size [width height] set or return box size",
|
||||
"position [llx lly] [-edit] set or return box position",
|
||||
"values [llx lly urx ury] [-edit] set or return box coordinates",
|
||||
"select set box to selection bounding box",
|
||||
"move <direction> <distance> move box position",
|
||||
"grow <direction> <distance> expand box size",
|
||||
"shrink <direction> <distance> shrink box size",
|
||||
|
|
@ -907,6 +910,19 @@ CmdBox(w, cmd)
|
|||
boxptr->r_ytop = boxptr->r_ybot + height;
|
||||
break;
|
||||
|
||||
case BOX_SELECT:
|
||||
if (argc == 2)
|
||||
{
|
||||
Rect selarea;
|
||||
GeoTransRect(&SelectUse->cu_transform, &SelectDef->cd_bbox, &selarea);
|
||||
boxptr->r_xbot = selarea.r_xbot;
|
||||
boxptr->r_ybot = selarea.r_ybot;
|
||||
boxptr->r_xtop = selarea.r_xtop;
|
||||
boxptr->r_ytop = selarea.r_ytop;
|
||||
}
|
||||
else goto badusage;
|
||||
break;
|
||||
|
||||
case BOX_VALUES:
|
||||
if (argc == 2)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1449,7 +1449,12 @@ CmdPort(w, cmd)
|
|||
if (option != PORT_LAST && option != PORT_FIRST)
|
||||
{
|
||||
if (lab == NULL)
|
||||
lab = portFindLabel(editDef, TRUE, TRUE, &nonEdit);
|
||||
{
|
||||
if (option == PORT_MAKE)
|
||||
lab = portFindLabel(editDef, FALSE, TRUE, &nonEdit);
|
||||
else
|
||||
lab = portFindLabel(editDef, TRUE, TRUE, &nonEdit);
|
||||
}
|
||||
|
||||
if (option == PORT_EXISTS)
|
||||
{
|
||||
|
|
@ -1467,7 +1472,6 @@ CmdPort(w, cmd)
|
|||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
if ((option != PORT_LAST) && (option != PORT_FIRST) &&
|
||||
(option != PORT_MAKEALL) && (option != PORT_RENUMBER)
|
||||
|
|
|
|||
|
|
@ -680,12 +680,13 @@ CmdSelect(w, cmd)
|
|||
#define SEL_PICK 8
|
||||
#define SEL_SAVE 9
|
||||
#define SEL_FEEDBACK 10
|
||||
#define SEL_BOX 11
|
||||
#define SEL_CHUNK 12
|
||||
#define SEL_REGION 13
|
||||
#define SEL_NET 14
|
||||
#define SEL_SHORT 15
|
||||
#define SEL_DEFAULT 16
|
||||
#define SEL_BBOX 11
|
||||
#define SEL_BOX 12
|
||||
#define SEL_CHUNK 13
|
||||
#define SEL_REGION 14
|
||||
#define SEL_NET 15
|
||||
#define SEL_SHORT 16
|
||||
#define SEL_DEFAULT 17
|
||||
|
||||
static char *cmdSelectOption[] =
|
||||
{
|
||||
|
|
@ -700,6 +701,7 @@ CmdSelect(w, cmd)
|
|||
"pick",
|
||||
"save",
|
||||
"feedback",
|
||||
"bbox",
|
||||
"box",
|
||||
"chunk",
|
||||
"region",
|
||||
|
|
@ -724,6 +726,7 @@ CmdSelect(w, cmd)
|
|||
"pick delete selection from layout",
|
||||
"save file save selection on disk in file.mag",
|
||||
"feedback [style] copy selection to feedback",
|
||||
"bbox return the bounding box of the selection",
|
||||
"[more | less] box | chunk | region | net [layers]\n"
|
||||
" [de]select chunk/region/net specified by\n"
|
||||
" the lower left corner of the current box",
|
||||
|
|
@ -775,6 +778,7 @@ CmdSelect(w, cmd)
|
|||
bool more = FALSE, less = FALSE, samePlace = TRUE;
|
||||
#ifdef MAGIC_WRAPPER
|
||||
char *tclstr;
|
||||
Tcl_Obj *lobj;
|
||||
#endif
|
||||
|
||||
/* How close two clicks must be to be considered the same point: */
|
||||
|
|
@ -933,6 +937,32 @@ CmdSelect(w, cmd)
|
|||
TxPrintf(" select %s\n", *msg);
|
||||
return;
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Print or return the bounding box of the selection
|
||||
*--------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
case SEL_BBOX:
|
||||
GeoTransRect(&SelectUse->cu_transform, &SelectDef->cd_bbox, &selarea);
|
||||
|
||||
#ifdef MAGIC_WRAPPER
|
||||
lobj = Tcl_NewListObj(0, NULL);
|
||||
Tcl_ListObjAppendElement(magicinterp, lobj,
|
||||
Tcl_NewIntObj(selarea.r_xbot));
|
||||
Tcl_ListObjAppendElement(magicinterp, lobj,
|
||||
Tcl_NewIntObj(selarea.r_ybot));
|
||||
Tcl_ListObjAppendElement(magicinterp, lobj,
|
||||
Tcl_NewIntObj(selarea.r_xtop));
|
||||
Tcl_ListObjAppendElement(magicinterp, lobj,
|
||||
Tcl_NewIntObj(selarea.r_ytop));
|
||||
Tcl_SetObjResult(magicinterp, lobj);
|
||||
#else
|
||||
TxPrintf("Select bounding box: %d %d %d %d\n",
|
||||
selarea.r_xbot, selarea.r_ybot,
|
||||
selarea.r_xtop, selarea.r_ytop);
|
||||
#endif
|
||||
return;
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Make a copy of the selection at its present loction but do not
|
||||
* clear the selection.
|
||||
|
|
|
|||
Loading…
Reference in New Issue