added "auto join/trim wires" menu option since now the trim operation is doing fast even on big designs

This commit is contained in:
Stefan Frederik 2021-01-02 03:24:26 +01:00
parent 6c98d34c65
commit 46e986cc62
11 changed files with 30 additions and 10 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;i<xctx->lastsel;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;k<cadlayers;k++) */
check_collapsing_objects();
if(autotrim_wires) trim_wires();
update_conn_cues(1, 1);
xctx->ui_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;k<cadlayers;k++) */
check_collapsing_objects();
if(autotrim_wires) trim_wires();
update_conn_cues(1, 1);
xctx->ui_state &= ~STARTMOVE;
if(xctx->ui_state & STARTMERGE) xctx->ui_state |= SELECTION; /* leave selection state so objects can be deleted */

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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" \

View File

@ -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

View File

@ -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