improve `Shift-M` command by stretching nets that land on instance pins while moving instances
This commit is contained in:
parent
acef2b0d2c
commit
2b0655e3e9
|
|
@ -168,6 +168,7 @@ ctrl+shift 'o' Load most recent schematic
|
|||
ctrl 'o' Load schematic
|
||||
- 'm' Move selected obj.
|
||||
shift 'M' Move selected obj, insert wire when separating touching instance pins.
|
||||
Stretch wires that land on selected instance pins.
|
||||
shift 'N' Top level only netlist
|
||||
- 'n' Hierarchical Netlist
|
||||
ctrl 'n' Clear schematic
|
||||
|
|
|
|||
|
|
@ -2188,6 +2188,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
tclsetintvar("connect_by_kissing", 2); /* 2 will be used to reset var to 0 at end of move */
|
||||
select_attached_nets(); /* stretch nets that land on selected instance pins */
|
||||
move_objects(START,0,0,0);
|
||||
break;
|
||||
}
|
||||
|
|
@ -2633,6 +2634,15 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
if(xctx->last_command == STARTWIRE) start_wire(mx, my);
|
||||
break;
|
||||
}
|
||||
if(xctx->ui_state & MENUSTARTMOVE) {
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
/* stretch nets that land on selected instance pins if connect_by_kissing == 2 */
|
||||
select_attached_nets();
|
||||
move_objects(START,0,0,0);
|
||||
xctx->ui_state &=~MENUSTARTMOVE;
|
||||
break;
|
||||
}
|
||||
if(xctx->ui_state & MENUSTARTWIRE) {
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ ctrl+shift 'o' Load most recent schematic
|
|||
ctrl 'o' Load schematic
|
||||
- 'm' Move selected obj.
|
||||
shift 'M' Move selected obj, insert wire when separating touching instance pins.
|
||||
Stretch wires that land on selected instance pins.
|
||||
shift 'N' Top level only netlist
|
||||
- 'n' Hierarchical Netlist
|
||||
ctrl 'n' Clear schematic
|
||||
|
|
|
|||
|
|
@ -2196,7 +2196,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
move_objects(START,0,0,0);
|
||||
move_objects( END,0,atof(argv[2]), atof(argv[3]));
|
||||
}
|
||||
else move_objects(START,0,0,0);
|
||||
else xctx->ui_state |= MENUSTARTMOVE;
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
else { cmd_found = 0;}
|
||||
|
|
|
|||
34
src/select.c
34
src/select.c
|
|
@ -1036,6 +1036,40 @@ unsigned short select_object(double mx,double my, unsigned short select_mode, in
|
|||
return sel.type;
|
||||
}
|
||||
|
||||
/* Partial-select wire ends that land on instance pins */
|
||||
void select_attached_nets(void)
|
||||
{
|
||||
int inst, j, i, rects, r, sqx, sqy;
|
||||
double x0, y0;
|
||||
Wireentry *wptr;
|
||||
int cbk = (tclgetintvar("connect_by_kissing") == 2);
|
||||
|
||||
hash_wires();
|
||||
rebuild_selected_array();
|
||||
|
||||
if(cbk) for(j=0;j<xctx->lastsel; ++j) if(xctx->sel_array[j].type==ELEMENT) {
|
||||
inst = xctx->sel_array[j].n;
|
||||
if((xctx->inst[inst].ptr >= 0)) {
|
||||
rects = (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER];
|
||||
for(r = 0; r < rects; r++)
|
||||
{
|
||||
get_inst_pin_coord(inst, r, &x0, &y0);
|
||||
get_square(x0, y0, &sqx, &sqy);
|
||||
for(wptr=xctx->wire_spatial_table[sqx][sqy]; wptr; wptr=wptr->next) {
|
||||
i = wptr->n;
|
||||
if(xctx->wire[i].x1 == x0 && xctx->wire[i].y1 == y0) {
|
||||
select_wire(i,SELECTED1, 1);
|
||||
}
|
||||
if(xctx->wire[i].x2 == x0 && xctx->wire[i].y2 == y0) {
|
||||
select_wire(i,SELECTED2, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rebuild_selected_array();
|
||||
}
|
||||
}
|
||||
|
||||
void select_inside(double x1,double y1, double x2, double y2, int sel) /*added unselect (sel param) */
|
||||
{
|
||||
int c,i, tmpint;
|
||||
|
|
|
|||
|
|
@ -228,6 +228,7 @@ extern char win_temp_dir[PATH_MAX];
|
|||
#define PLACE_SYMBOL 4194304U /* used in move_objects after place_symbol to avoid storing intermediate undo state */
|
||||
#define START_SYMPIN 8388608U
|
||||
#define GRAPHPAN 16777216U
|
||||
#define MENUSTARTMOVE 33554432U
|
||||
#define SELECTED 1U /* used in the .sel field for selected objs. */
|
||||
#define SELECTED1 2U /* first point selected... */
|
||||
#define SELECTED2 4U /* second point selected... */
|
||||
|
|
@ -1254,6 +1255,7 @@ extern int text_bbox_nocairo(const char * str,double xscale, double yscale,
|
|||
extern unsigned short select_object(double mx,double my, unsigned short sel_mode,
|
||||
int override_lock); /* return type 20160503 */
|
||||
extern void unselect_all(int dr);
|
||||
extern void select_attached_nets(void);
|
||||
extern void select_inside(double x1,double y1, double x2, double y2, int sel);
|
||||
extern int Tcl_AppInit(Tcl_Interp *interp);
|
||||
extern void abort_operation(void);
|
||||
|
|
|
|||
|
|
@ -5923,6 +5923,8 @@ proc build_widgets { {topwin {} } } {
|
|||
$topwin.menubar.edit.menu add command -label "Duplicate objects" -command "xschem copy_objects" -accelerator C
|
||||
toolbar_add EditDuplicate "xschem copy_objects" "Duplicate objects" $topwin
|
||||
$topwin.menubar.edit.menu add command -label "Move objects" -command "xschem move_objects" -accelerator M
|
||||
$topwin.menubar.edit.menu add command -label "Move objects stretching attached wires" \
|
||||
-command "set connect_by_kissing 2; xschem move_objects" -accelerator Shift+M
|
||||
toolbar_add EditMove "xschem move_objects" "Move objects" $topwin
|
||||
$topwin.menubar.edit.menu add command -label "Flip selected objects" -command "xschem flip" -accelerator {Alt-F}
|
||||
$topwin.menubar.edit.menu add command -label "Rotate selected objects" -command "xschem rotate" -accelerator {Alt-R}
|
||||
|
|
|
|||
Loading…
Reference in New Issue