From a3eb1b0c17be1b7aa17a4835484a7dc49ef7a846 Mon Sep 17 00:00:00 2001 From: Chayan Deb Date: Fri, 14 Mar 2025 16:16:29 +0530 Subject: [PATCH] [Experimental Feature Update]: Orthogonal wiring feature is now applicable to wires connected to objects, when those objects are moved to a different position by the user. This requires 'enable_stretching' to be enabled, which will stretch the connected wires orthogonally when the user drags/moves objects around in the canvas. --- src/move.c | 74 ++++++++++++++++-------------------------------------- 1 file changed, 22 insertions(+), 52 deletions(-) diff --git a/src/move.c b/src/move.c index 37db4066..59893122 100644 --- a/src/move.c +++ b/src/move.c @@ -1141,60 +1141,30 @@ void move_objects(int what, int merge, double dx, double dy) if(xctx->manhattan_lines & 1) xctx->manhattan_lines=2; else if(xctx->manhattan_lines & 2) xctx->manhattan_lines=1; } - wire[n].sel = SELECTED; - delete_wires(SELECTED); - if(xctx->manhattan_lines & 1) { - if(xctx->nl_xx2!=xctx->nl_xx1) { - xctx->nl_xx1 = xctx->rx1; xctx->nl_yy1 = xctx->ry1; - xctx->nl_xx2 = xctx->rx2; xctx->nl_yy2 = xctx->ry2; - ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1); - storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1,WIRE,0,0,NULL); - hash_wire(XINSERT, xctx->wires-1, 1); - drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1, 0, NULL); - } - if(xctx->nl_yy2!=xctx->nl_yy1) { - xctx->nl_xx1 = xctx->rx1; xctx->nl_yy1 = xctx->ry1; - xctx->nl_xx2 = xctx->rx2; xctx->nl_yy2 = xctx->ry2; - ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2); - storeobject(-1, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2,WIRE,0,0,NULL); - hash_wire(XINSERT, xctx->wires-1, 1); - drawline(WIRELAYER,NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0, NULL); - } - } else if(xctx->manhattan_lines & 2) { - if(xctx->nl_yy2!=xctx->nl_yy1) { - xctx->nl_xx1 = xctx->rx1; xctx->nl_yy1 = xctx->ry1; - xctx->nl_xx2 = xctx->rx2; xctx->nl_yy2 = xctx->ry2; - ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2); - storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2,WIRE,0,0,NULL); - hash_wire(XINSERT, xctx->wires-1, 1); - drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2, 0, NULL); - } - if(xctx->nl_xx2!=xctx->nl_xx1) { - xctx->nl_xx1 = xctx->rx1; xctx->nl_yy1 = xctx->ry1; - xctx->nl_xx2 = xctx->rx2; xctx->nl_yy2 = xctx->ry2; - ORDER(xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2); - storeobject(-1, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2,WIRE,0,0,NULL); - hash_wire(XINSERT, xctx->wires-1, 1); - drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2, 0, NULL); - } - } else { - xctx->nl_xx1 = xctx->rx1; xctx->nl_yy1 = xctx->ry1; - xctx->nl_xx2 = xctx->rx2; xctx->nl_yy2 = xctx->ry2; - ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2); - storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2,WIRE,0,0,NULL); - hash_wire(XINSERT, xctx->wires-1, 1); - drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0, NULL); + wire[n].x1 = xctx->rx1; + wire[n].y1 = xctx->ry1; + if(xctx->manhattan_lines&1) + { + wire[n].x2 = xctx->rx2; + wire[n].y2 = xctx->ry1; + storeobject(-1, xctx->rx2,xctx->ry1,xctx->rx2,xctx->ry2,WIRE,0,0,NULL); + hash_wire(XINSERT, xctx->wires-1, 1); + drawline(WIRELAYER,ADD, xctx->rx2,xctx->ry1,xctx->rx2,xctx->ry2, 0, NULL); } - xctx->prep_hi_structs = 0; - if(tclgetboolvar("autotrim_wires")) trim_wires(); - prepare_netlist_structs(0); /* since xctx->prep_hi_structs==0, do a delete_netlist_structs() first, - * this clears both xctx->prep_hi_structs and xctx->prep_net_structs. */ - if(xctx->hilight_nets) { - propagate_hilights(1, 1, XINSERT_NOREPLACE); + else if(xctx->manhattan_lines&2) + { + wire[n].x2 = xctx->rx1; + wire[n].y2 = xctx->ry2; + storeobject(-1, xctx->rx1,xctx->ry2,xctx->rx2,xctx->ry2,WIRE,0,0,NULL); + hash_wire(XINSERT, xctx->wires-1, 1); + drawline(WIRELAYER,ADD, xctx->rx1,xctx->ry2,xctx->rx2,xctx->ry2, 0, NULL); } - draw(); - /* draw_hilight_net(1);*/ /* for updating connection bubbles on hilight nets */ - set_modify(1); + else + { + wire[n].x2 = xctx->rx2; + wire[n].y2 = xctx->ry2; + } + } break;