extended `Shift-M` command to selected nets (nets attached to them will stretch)

This commit is contained in:
Stefan Schippers 2023-06-11 18:46:31 +02:00
parent 61e368b05e
commit 613dae091e
1 changed files with 46 additions and 18 deletions

View File

@ -1039,7 +1039,7 @@ unsigned short select_object(double mx,double my, unsigned short select_mode, in
/* Partial-select wire ends that land on instance pins */
void select_attached_nets(void)
{
int inst, j, i, rects, r, sqx, sqy;
int wire, inst, j, i, rects, r, sqx, sqy;
double x0, y0;
Wireentry *wptr;
int cbk = (tclgetintvar("connect_by_kissing") == 2);
@ -1047,27 +1047,55 @@ void select_attached_nets(void)
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);
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);
}
}
}
}
}
}
if(xctx->sel_array[j].type==WIRE) {
wire = xctx->sel_array[j].n;
for(r = 0; r < 2; r++)
{
if(r == 0) {
x0 = xctx->wire[wire].x1;
y0 = xctx->wire[wire].y1;
} else {
x0 = xctx->wire[wire].x2;
y0 = xctx->wire[wire].y2;
}
get_square(x0, y0, &sqx, &sqy);
for(wptr=xctx->wire_spatial_table[sqx][sqy]; wptr; wptr=wptr->next) {
i = wptr->n;
if(i == wire) continue;
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);
}
}
}
}
} /* for(j=0;j<xctx->lastsel; ++j) */
rebuild_selected_array();
}
} /* if(cbk) */
}
void select_inside(double x1,double y1, double x2, double y2, int sel) /*added unselect (sel param) */