From c4b3e204a00ec24f5ca30ffcfa917182cd535f7c Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Tue, 18 Mar 2025 12:36:46 +0100 Subject: [PATCH] place_moved_wire(): in manhattan mode don`t store new wires if not needed (single point) --- src/move.c | 36 ++++++++++++++++++++---------------- src/xschem.tcl | 6 ++++-- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/move.c b/src/move.c index d07ffe5c..9d02b400 100644 --- a/src/move.c +++ b/src/move.c @@ -1058,10 +1058,11 @@ static void place_moved_wire(int n, int orthogonal_wiring) wire[n].x2 = xctx->rx1; wire[n].y2 = xctx->ry2; order_wire_points(n); - storeobject(-1, xctx->rx1,xctx->ry2,xctx->rx2,xctx->ry2,WIRE,0,0,NULL); - last = xctx->wires-1; - order_wire_points(last); - /* drawline(WIRELAYER,NOW, wire[last].x1, wire[last].y1, wire[last].x2, wire[last].y2, 0, NULL); */ + if( xctx->rx1 != xctx->rx2) { + storeobject(-1, xctx->rx1,xctx->ry2,xctx->rx2,xctx->ry2,WIRE,0,0,NULL); + last = xctx->wires-1; + order_wire_points(last); + } } /* wire x2,y2 point was moved @@ -1082,10 +1083,11 @@ static void place_moved_wire(int n, int orthogonal_wiring) wire[n].x2 = xctx->rx2; wire[n].y2 = xctx->ry2; order_wire_points(n); - storeobject(-1, xctx->rx1,xctx->ry1,xctx->rx2,xctx->ry1,WIRE,0,0,NULL); - last = xctx->wires-1; - order_wire_points(last); - /* drawline(WIRELAYER,NOW, wire[last].x1, wire[last].y1, wire[last].x2, wire[last].y2, 0, NULL); */ + if( xctx->rx1 != xctx->rx2) { + storeobject(-1, xctx->rx1,xctx->ry1,xctx->rx2,xctx->ry1,WIRE,0,0,NULL); + last = xctx->wires-1; + order_wire_points(last); + } } /* wire x1,y1 point was moved @@ -1106,10 +1108,11 @@ static void place_moved_wire(int n, int orthogonal_wiring) wire[n].x2 = xctx->rx2; wire[n].y2 = xctx->ry1; order_wire_points(n); - storeobject(-1, xctx->rx2,xctx->ry1,xctx->rx2,xctx->ry2,WIRE,0,0,NULL); - last = xctx->wires-1; - order_wire_points(last); - /* drawline(WIRELAYER,NOW, wire[last].x1, wire[last].y1, wire[last].x2, wire[last].y2, 0, NULL); */ + if( xctx->ry1 != xctx->ry2) { + storeobject(-1, xctx->rx2,xctx->ry1,xctx->rx2,xctx->ry2,WIRE,0,0,NULL); + last = xctx->wires-1; + order_wire_points(last); + } } /* wire x2,y2 point was moved @@ -1130,10 +1133,11 @@ static void place_moved_wire(int n, int orthogonal_wiring) wire[n].x2 = xctx->rx2; wire[n].y2 = xctx->ry2; order_wire_points(n); - storeobject(-1, xctx->rx1,xctx->ry1,xctx->rx1,xctx->ry2,WIRE,0,0,NULL); - last = xctx->wires-1; - order_wire_points(last); - /* drawline(WIRELAYER,NOW, wire[last].x1, wire[last].y1, wire[last].x2, wire[last].y2, 0, NULL); */ + if( xctx->ry1 != xctx->ry2) { + storeobject(-1, xctx->rx1,xctx->ry1,xctx->rx1,xctx->ry2,WIRE,0,0,NULL); + last = xctx->wires-1; + order_wire_points(last); + } } else /* no manhattan or traslation since both line points moved */ diff --git a/src/xschem.tcl b/src/xschem.tcl index 09c27154..fd04603c 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -4806,6 +4806,7 @@ proc load_file_dialog {{msg {}} {ext {}} {global_initdir {INITIALINSTDIR}} # 'levels' is set to the number of levels to descend into. # 'level' is used internally by the function and should not be set. proc get_list_of_dirs_with_symbols {{paths {}} {levels -1} {ext {\.(sch|sym)$}} {level -1}} { + # puts "get_list_of_dirs_with_symbols paths=$paths" global pathlist set dir_with_symbols {} if {$level == -1} { set level 0} @@ -4896,6 +4897,7 @@ proc insert_symbol_select_preview {} { } proc insert_symbol_update_dirs {paths {maxdepth -1}} { + # puts insert_symbol_update_dirs global insert_symbol new_symbol_browser_ext # regenerate list of dirs set insert_symbol(dirs) [get_list_of_dirs_with_symbols $paths $maxdepth $new_symbol_browser_ext] @@ -4930,14 +4932,13 @@ proc insert_symbol_filelist {paths {maxdepth -1}} { .ins.center.leftdir.l selection set active } set insert_symbol(dirindex) $sel - # puts "set dirindex=$paths" set paths [lindex $insert_symbol(dirs) $sel] # puts "insert_symbol_filelist: paths=$paths" .ins.top2.dir_e configure -state normal .ins.top2.dir_e delete 0 end .ins.top2.dir_e insert 0 $paths .ins.top2.dir_e configure -state readonly - #check if regex is valid + # check if regex is valid set err [catch {regexp $insert_symbol(regex) {12345}} res] if {$err} {return} set f [match_file $insert_symbol(regex) $paths 0] @@ -5110,6 +5111,7 @@ proc insert_symbol {{paths {}} {maxdepth -1} {ext {.*}}} { .ins.center.left.l selection set $insert_symbol(fileindex) .ins.center.left.l see $insert_symbol(fileindex) } + insert_symbol_filelist $paths $maxdepth return {} } #######################################################################