From 4b8a3c653b19b8bd53311d773bb8f52c33d10772 Mon Sep 17 00:00:00 2001 From: Chayan Deb Date: Wed, 22 Jan 2025 19:01:48 +0530 Subject: [PATCH] [New Experimental Functionality]: Added the functionality of terminating the wire-draw mode when the user clicks a component endpoint. This feature is currently on by default (if the user has the 'Display snap cursor' option enabled. --- src/callback.c | 9 ++++++++- src/xschem.tcl | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/callback.c b/src/callback.c index 3df27b46..f1a36095 100644 --- a/src/callback.c +++ b/src/callback.c @@ -4272,7 +4272,14 @@ int rstate; /* (reduced state, without ShiftMask) */ xctx->drag_elements = 0; if(tclgetboolvar("persistent_command") && xctx->last_command) { if(xctx->last_command == STARTLINE) start_line(xctx->mousex_snap, xctx->mousey_snap); - if(xctx->last_command == STARTWIRE) start_wire(xctx->mousex_snap, xctx->mousey_snap); + if(xctx->last_command == STARTWIRE){ + if(tclgetboolvar("snap_cursor") && (xctx->prev_snapx == xctx->mousex_snap && xctx->prev_snapy == xctx->mousey_snap)){ + new_wire(PLACE|END, xctx->mousex_snap, xctx->mousey_snap); + xctx->last_command &= ~STARTWIRE; + } + else + start_wire(xctx->mousex_snap, xctx->mousey_snap); + } break; } /* handle all object insertions started from Tools/Edit menu */ diff --git a/src/xschem.tcl b/src/xschem.tcl index 6d5493ce..34696455 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -8200,7 +8200,7 @@ proc build_widgets { {topwin {} } } { -selectcolor $selectcolor -accelerator Y $topwin.menubar.option add checkbutton -label "Enable infix-interface" -variable infix_interface \ -selectcolor $selectcolor - $topwin.menubar.option add checkbutton -label "Enable snap cursor" -variable snap_cursor \ + $topwin.menubar.option add checkbutton -label "Display snap cursor" -variable snap_cursor \ -selectcolor $selectcolor $topwin.menubar.option add checkbutton -label "Enable orthogonal wiring" -variable orthogonal_wiring \ -selectcolor $selectcolor -accelerator Shift+L