diff --git a/src/actions.c b/src/actions.c index 659c0e0f..594d0f38 100644 --- a/src/actions.c +++ b/src/actions.c @@ -888,6 +888,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot &xctx->inst[n].x2, &xctx->inst[n].y2); if(xctx->prep_hash_inst) hash_inst(XINSERT, n); /* no need to rehash, add item */ /* xctx->prep_hash_inst=0; */ + if(draw_sym & 3) bbox(ADD, xctx->inst[n].x1, xctx->inst[n].y1, xctx->inst[n].x2, xctx->inst[n].y2); set_modify(1); if(draw_sym&1) { @@ -1655,9 +1656,8 @@ void new_wire(int what, double mx_snap, double my_snap) hash_wire(XINSERT, xctx->wires-1, 1); drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0); } - /* xctx->prep_hash_wires = 0; */ xctx->prep_hi_structs = 0; - + if(autotrim_wires) trim_wires(); update_conn_cues(1,1); if(show_pin_net_names) { prepare_netlist_structs(0); diff --git a/src/callback.c b/src/callback.c index 113d9d56..a858b246 100644 --- a/src/callback.c +++ b/src/callback.c @@ -1028,6 +1028,7 @@ int callback(int event, int mx, int my, KeySym key, push_undo(); round_schematic_to_grid(cadsnap); set_modify(1); + if(autotrim_wires) trim_wires(); xctx->prep_hash_inst=0; xctx->prep_hash_wires=0; xctx->prep_net_structs=0; diff --git a/src/globals.c b/src/globals.c index 356b3e88..8114a6cc 100644 --- a/src/globals.c +++ b/src/globals.c @@ -132,6 +132,7 @@ int big_grid_points=0; int rainbow_colors=0; int dis_uniq_names=0; /* if set allow instances with duplicate names */ int persistent_command=0; /* remember last command 20181022 */ +int autotrim_wires=0; int color_ps=-1; int transparent_svg=-1; int only_probes=0; diff --git a/src/move.c b/src/move.c index 3bdf213d..39bec673 100644 --- a/src/move.c +++ b/src/move.c @@ -584,6 +584,7 @@ void copy_objects(int what) bbox(START, 0.0 , 0.0 , 0.0 , 0.0); newpropcnt=0; set_modify(1); push_undo(); /* 20150327 push_undo */ + firstw = firsti = 1; for(i=0;ilastsel;i++) { @@ -984,6 +985,7 @@ void copy_objects(int what) drawline(k, END, 0.0, 0.0, 0.0, 0.0, 0); } /* end for(k=0;kui_state &= ~STARTCOPY; xctx->x1=xctx->y_1=xctx->x2=xctx->y_2=xctx->move_rot=xctx->move_flip=xctx->deltax=xctx->deltay=0; @@ -1506,6 +1508,7 @@ void move_objects(int what, int merge, double dx, double dy) drawline(k, END, 0.0, 0.0, 0.0, 0.0, 0); } /*end for(k=0;kui_state &= ~STARTMOVE; if(xctx->ui_state & STARTMERGE) xctx->ui_state |= SELECTION; /* leave selection state so objects can be deleted */ diff --git a/src/save.c b/src/save.c index 5f2d7dbf..06bde458 100644 --- a/src/save.c +++ b/src/save.c @@ -1055,6 +1055,7 @@ void load_schematic(int load_symbols, const char *filename, int reset_undo) /* 2 tcleval( "wm iconname . \"xschem - [file tail [xschem get schname]]\""); } } + if(autotrim_wires) trim_wires(); update_conn_cues(0, 0); } diff --git a/src/scheduler.c b/src/scheduler.c index b7713963..5934f56d 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -110,6 +110,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg cmd_found = 1; push_undo(); round_schematic_to_grid(cadsnap); + if(autotrim_wires) trim_wires(); set_modify(1); xctx->prep_hash_inst=0; xctx->prep_hash_wires=0; @@ -2195,6 +2196,13 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg persistent_command=0; } } + else if(!strcmp(argv[2],"autotrim_wires")) { + if(!strcmp(argv[3],"1")) { + autotrim_wires=1; + } else { + autotrim_wires=0; + } + } else if(!strcmp(argv[2],"disable_unique_names")) { if(!strcmp(argv[3],"1")) { dis_uniq_names=1; @@ -2558,6 +2566,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg save = draw_window; draw_window = 1; drawline(WIRELAYER,NOW, x1,y1,x2,y2, 0); draw_window = save; + if(autotrim_wires) trim_wires(); } else xctx->ui_state |= MENUSTARTWIRE; } diff --git a/src/select.c b/src/select.c index c1604c8c..a5297fa2 100644 --- a/src/select.c +++ b/src/select.c @@ -355,7 +355,7 @@ void delete(void) xctx->prep_net_structs=0; xctx->prep_hi_structs=0; } - + if(autotrim_wires) trim_wires(); del_rect_line_arc_poly(); update_conn_cues(0, 0); xctx->lastsel = 0; diff --git a/src/xschem.h b/src/xschem.h index 3daadada..728f4c3e 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -712,6 +712,7 @@ extern char *tcl_command; extern char tcl_script[PATH_MAX]; extern char plotfile[PATH_MAX]; extern int persistent_command; +extern int autotrim_wires; extern int dis_uniq_names; extern int tcp_port; diff --git a/src/xschem.tcl b/src/xschem.tcl index f5138b55..52b8e452 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -3476,6 +3476,7 @@ set_ne big_grid_points 0 set_ne snap 10 set_ne grid 20 set_ne persistent_command 0 +set_ne autotrim_wires 0 set_ne disable_unique_names 1 set_ne sym_txt 1 set_ne show_infowindow 0 @@ -3639,6 +3640,7 @@ xschem set cairo_font_line_spacing $cairo_font_line_spacing xschem set cairo_vert_correct $cairo_vert_correct xschem set nocairo_vert_correct $nocairo_vert_correct xschem set persistent_command $persistent_command +xschem set autotrim_wires $autotrim_wires xschem set disable_unique_names $disable_unique_names # font name can not be set here as we need to wait for X-initialization # to complete. Done in xinit.c @@ -4009,10 +4011,7 @@ if { ( $::OS== "Windows" || [string length [lindex [array get env DISPLAY] 1] ] xschem set disable_unique_names $disable_unique_names } .menubar.tools.menu add checkbutton -label "Remember last command" -variable persistent_command \ - -accelerator {} \ - -command { - if { $persistent_command == 1} { xschem set persistent_command 1} else { xschem set persistent_command 0} - } + -command {xschem set persistent_command $persistent_command} .menubar.tools.menu add command -label "Insert symbol" -command "xschem place_symbol" -accelerator {Ins, Shift-I} toolbar_create ToolInsertSymbol "xschem place_symbol" "Insert Symbol" .menubar.tools.menu add command -label "Insert wire label" -command "xschem net_label 1" -accelerator {Alt-L} @@ -4040,9 +4039,11 @@ if { ( $::OS== "Windows" || [string length [lindex [array get env DISPLAY] 1] ] .menubar.tools.menu add command -label "Join/Trim wires" \ -command "xschem trim_wires" -accelerator {&} toolbar_create ToolJoinTrim "xschem trim_wires" "Join/Trim Wires" - .menubar.tools.menu add command -label "Break wires" \ + .menubar.tools.menu add command -label "Break wires at selected instance pins" \ -command "xschem break_wires" -accelerator {!} toolbar_create ToolBreak "xschem break_wires" "Break Wires" + .menubar.tools.menu add checkbutton -label "Auto Join/Trim Wires" -variable autotrim_wires \ + -command { xschem set autotrim_wires $autotrim_wires} .menubar.hilight.menu add command -label {Highlight net-pin name mismatches on selected instancs} \ -command "xschem net_pin_mismatch" \ diff --git a/src/xschemrc b/src/xschemrc index 28423724..bd58a993 100644 --- a/src/xschemrc +++ b/src/xschemrc @@ -129,6 +129,8 @@ set disable_unique_names 0 ## if set to 1 continue drawing lines / wires after click # set persistent_command 1 +## if set to 1 automatically join/trim wires while editing +# set autotrim_wires 0 ## set widget scaling (mainly for font display) # set tk_scaling 1.7 diff --git a/xschem_library/ngspice/solar_panel.sch b/xschem_library/ngspice/solar_panel.sch index 616debb7..cdcd08f4 100644 --- a/xschem_library/ngspice/solar_panel.sch +++ b/xschem_library/ngspice/solar_panel.sch @@ -1,4 +1,4 @@ -v {xschem version=2.9.8 file_version=1.2} +v {xschem version=2.9.9 file_version=1.2 } G {} K {} V {} @@ -85,10 +85,11 @@ N 345 -360 345 -310 {lab=0} N 1140 -480 1180 -480 {lab=LED} N 1140 -480 1140 -350 {lab=LED} N 230 -450 250 -450 {lab=#net2} -N 310 -450 400 -450 {lab=PANEL} +N 345 -450 400 -450 {lab=PANEL} N 860 -370 860 -250 {lab=0} N 860 -470 860 -430 { lab=#net3} N 960 -650 980 -650 { lab=#net4} +N 310 -450 345 -450 {lab=PANEL} C {title.sym} 160 -40 0 0 {name=l1 author="Stefan Schippers" net_name=true} C {code_shown.sym} 245 -245 0 0 {name=CONTROL value="* .control * save all