diff --git a/src/actions.c b/src/actions.c index dc3a38e2..caac9955 100644 --- a/src/actions.c +++ b/src/actions.c @@ -896,6 +896,25 @@ void attach_labels_to_inst() /* offloaded from callback.c 20171005 */ bbox(END , 0.0 , 0.0 , 0.0 , 0.0); } +void place_net_label(int type) +{ + struct stat buf; + if(type == 1) { + if(!stat(abs_sym_path("lab_pin.sym", ""), &buf)) { + place_symbol(-1, "lab_pin.sym", mousex_snap, mousey_snap, 0, 0, NULL, 4, 1); + } else if(!stat(abs_sym_path("devices/lab_pin.sym", ""), &buf)) { + place_symbol(-1, "devices/lab_pin.sym", mousex_snap, mousey_snap, 0, 0, NULL, 4, 1); + } + } else { + if(!stat(abs_sym_path("lab_wire.sym", ""), &buf)) { + place_symbol(-1, "lab_wire.sym", mousex_snap, mousey_snap, 0, 0, NULL, 4, 1); + } else if(!stat(abs_sym_path("devices/lab_wire.sym", ""), &buf)) { + place_symbol(-1, "devices/lab_wire.sym", mousex_snap, mousey_snap, 0, 0, NULL, 4, 1); + } + } + move_objects(BEGIN,0,0,0); + ui_state |= START_SYMPIN; +} /* draw_sym==4 select element after placing */ /* draw_sym==2 begin bbox if(first_call), add bbox */ diff --git a/src/callback.c b/src/callback.c index 982d9710..2b5d6004 100644 --- a/src/callback.c +++ b/src/callback.c @@ -506,50 +506,7 @@ int callback(int event, int mx, int my, KeySym key, } if(key == 'X' && state == ShiftMask) /* highlight discrepanciens between selected instance pin and net names */ { - - - int i,j,k; - xSymbol *symbol; - int npin; - char *type=NULL; - char *labname=NULL; - char *lab=NULL; - char *netname=NULL; - int mult; - xRect *rct; - - rebuild_selected_array(); - prepare_netlist_structs(0); - for(k=0; kinst[j].ptr+ xctx->sym)->type); - if( type && IS_LABEL_SH_OR_PIN(type)) break; - symbol = xctx->sym + xctx->inst[j].ptr; - npin = symbol->rects[PINLAYER]; - rct=symbol->rect[PINLAYER]; - dbg(1, "\n"); - for(i=0;i= 2) break; descend_symbol();break; } - if(key==XK_Insert) /* insert sym */ + if(key==XK_Insert || (key == 'I' && state == ShiftMask) ) /* insert sym */ { if(semaphore >= 2) break; last_command = 0; @@ -1133,26 +1090,11 @@ int callback(int event, int mx, int my, KeySym key, break; } if(key=='l' && state == Mod1Mask) { /* add pin label*/ - struct stat buf; - if(!stat(abs_sym_path("lab_pin.sym", ""), &buf)) { - place_symbol(-1, "lab_pin.sym", mousex_snap, mousey_snap, 0, 0, NULL, 4, 1); - } else if(!stat(abs_sym_path("devices/lab_pin.sym", ""), &buf)) { - place_symbol(-1, "devices/lab_pin.sym", mousex_snap, mousey_snap, 0, 0, NULL, 4, 1); - } - move_objects(BEGIN,0,0,0); - ui_state |= START_SYMPIN; + place_net_label(1); break; } - if(key=='L' && state == (Mod1Mask | ShiftMask)) { /* add pin label*/ - struct stat buf; - if(!stat(abs_sym_path("lab_wire.sym", ""), &buf)) { - place_symbol(-1, "lab_wire.sym", mousex_snap, mousey_snap, 0, 0, NULL, 4, 1); - } else if(!stat(abs_sym_path("devices/lab_wire.sym", ""), &buf)) { - place_symbol(-1, "devices/lab_wire.sym", mousex_snap, mousey_snap, 0, 0, NULL, 4, 1); - } - move_objects(BEGIN,0,0,0); - ui_state |= START_SYMPIN; + place_net_label(0); break; } if(key=='F' && state==ShiftMask) /* Flip */ diff --git a/src/hilight.c b/src/hilight.c index 08fdccaf..3a50ebe3 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -301,6 +301,48 @@ void delete_hilight_net(void) my_free(766, &inst_color); hilight_color=0; } +void hilight_net_pin_mismatches(void) +{ + int i,j,k; + xSymbol *symbol; + int npin; + char *type=NULL; + char *labname=NULL; + char *lab=NULL; + char *netname=NULL; + int mult; + xRect *rct; + + rebuild_selected_array(); + prepare_netlist_structs(0); + for(k=0; kinst[j].ptr+ xctx->sym)->type); + if( type && IS_LABEL_SH_OR_PIN(type)) break; + symbol = xctx->sym + xctx->inst[j].ptr; + npin = symbol->rects[PINLAYER]; + rct=symbol->rect[PINLAYER]; + dbg(1, "\n"); + for(i=0;i=3) { ret = hilight_netname(argv[2]); } - Tcl_ResetResult(interp); - Tcl_AppendResult(interp,ret ? "1" : "0" , NULL); + /* + * Tcl_ResetResult(interp); + * Tcl_AppendResult(interp,ret ? "1" : "0" , NULL); */ + Tcl_SetResult(interp,ret ? "1" : "0" , TCL_STATIC); } + else if(!strcmp(argv[1],"flip")) + { + if(! (ui_state & (STARTMOVE | STARTCOPY) ) ) { + rebuild_selected_array(); + move_objects(BEGIN,0,0,0); + move_objects(FLIP|ROTATELOCAL,0,0,0); + move_objects(END,0,0,0); + } + Tcl_ResetResult(interp); + } + else if(!strcmp(argv[1],"rotate")) + { + + + if(! (ui_state & (STARTMOVE | STARTCOPY) ) ) { + rebuild_selected_array(); + move_objects(BEGIN,0,0,0); + move_objects(ROTATE|ROTATELOCAL,0,0,0); + move_objects(END,0,0,0); + } + Tcl_ResetResult(interp); + } + else if(!strcmp(argv[1],"net_label")) + { + if(argc>=3) place_net_label(atoi(argv[2])); + } + else if(!strcmp(argv[1],"net_pin_mismatch")) + { + hilight_net_pin_mismatches(); + } else if(!strcmp(argv[1],"send_to_gaw")) { enable_drill = 0; @@ -1490,8 +1521,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg int select, what, r; what = NOW; if(argc < 6) { - Tcl_ResetResult(interp); - Tcl_AppendResult(interp,"xschem search requires 4 or 5 additional fields.", NULL); + Tcl_SetResult(interp,"xschem search requires 4 or 5 additional fields.", TCL_STATIC); return TCL_ERROR; } if(argc == 7) { @@ -1507,10 +1537,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg Tcl_ResetResult(interp); if(r == 0) { if(has_x && !strcmp(argv[1],"searchmenu")) tcleval("tk_messageBox -type ok -message {Not found.}"); - Tcl_ResetResult(interp); - Tcl_AppendResult(interp,"0", NULL); + Tcl_SetResult(interp,"0", TCL_STATIC); } else { - Tcl_AppendResult(interp,"1", NULL); + Tcl_SetResult(interp,"1", TCL_STATIC); } return TCL_OK; } diff --git a/src/xschem.h b/src/xschem.h index ebf40359..1eb1a133 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -902,6 +902,7 @@ extern int load_sym_def(const char name[], FILE *embed_fd); extern void descend_symbol(void); extern int place_symbol(int pos, const char *symbol_name, double x, double y, int rot, int flip, const char *inst_props, int draw_sym, int first_call); +extern void place_net_label(int type); extern void attach_labels_to_inst(void); extern int sym_vs_sch_pins(void); extern int match_symbol(const char name[]); @@ -1050,6 +1051,7 @@ extern void delete_inst_node(int i); extern void delete_hilight_net(void); extern void hilight_child_pins(void); extern void hilight_parent_pins(void); +extern void hilight_net_pin_mismatches(void); extern struct node_hashentry **get_node_table_ptr(void); extern void change_elem_order(void); extern int set_different_token(char **s,const char *new, const char *old, int object, int n); diff --git a/src/xschem.tcl b/src/xschem.tcl index c2db86de..08cbaa17 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -3586,6 +3586,8 @@ font configure Underline-Font -underline true -size 24 toolbar_create EditDuplicate "xschem copy_objects" "Duplicate objects" .menubar.edit.menu add command -label "Move objects" -command "xschem move_objects" -accelerator M toolbar_create EditMove "xschem move_objects" "Move objects" + .menubar.edit.menu add command -label "Flip selected objects" -command "xschem flip" -accelerator {Alt-F} + .menubar.edit.menu add command -label "Rotate selected objects" -command "xschem rotate" -accelerator {Alt-R} .menubar.edit.menu add checkbutton -label "Constrained Horizontal move" -variable horizontal_move \ -command "xschem set horizontal_move" -accelerator H .menubar.edit.menu add checkbutton -label "Constrained Vertical move" -variable vertical_move \ @@ -3738,7 +3740,8 @@ font configure Underline-Font -underline true -size 24 .menubar.prop.menu add command -background red -label "Edit file (danger!)" -command "xschem edit_file" -accelerator Alt+Q .menubar.sym.menu add radiobutton -label "Show Symbols" -variable hide_symbols -value 0 \ -command {xschem set hide_symbols $hide_symbols; xschem redraw} -accelerator Alt+B - .menubar.sym.menu add radiobutton -label "Show instance Bounding boxes for subcircuit symbols" -variable hide_symbols -value 1 \ + .menubar.sym.menu add radiobutton -label "Show instance Bounding boxes for subcircuit symbols" \ + -variable hide_symbols -value 1 \ -command {xschem set hide_symbols $hide_symbols; xschem redraw} -accelerator Alt+B .menubar.sym.menu add radiobutton -label "Show instance Bounding boxes for all symbols" -variable hide_symbols -value 2 \ -command {xschem set hide_symbols $hide_symbols; xschem redraw} -accelerator Alt+B @@ -3767,6 +3770,8 @@ font configure Underline-Font -underline true -size 24 } .menubar.tools.menu add command -label "Insert symbol" -command "xschem place_symbol" -accelerator Ins 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} + .menubar.tools.menu add command -label "Insert wire label 2" -command "xschem net_label 0" -accelerator {Alt-Shift-L} .menubar.tools.menu add command -label "Insert text" -command "xschem place_text" -accelerator T toolbar_create ToolInsertText "xschem place_text" "Insert Text" .menubar.tools.menu add command -label "Insert wire" -command "xschem wire" -accelerator W @@ -3793,11 +3798,17 @@ font configure Underline-Font -underline true -size 24 -command "xschem break_wires" -accelerator {!} toolbar_create ToolBreak "xschem break_wires" "Break Wires" - .menubar.hilight.menu add command -label {Highlight duplicate instance names} -command "xschem check_unique_names 0" -accelerator {#} - .menubar.hilight.menu add command -label {Rename duplicate instance names} -command "xschem check_unique_names 1" -accelerator {Ctrl+#} + .menubar.hilight.menu add command -label {Highlight net-pin name mismatches on selected instancs} \ + -command "xschem net_pin_mismatch" \ + -accelerator {Shift-X} + .menubar.hilight.menu add command -label {Highlight duplicate instance names} -command "xschem check_unique_names 0" \ + -accelerator {#} + .menubar.hilight.menu add command -label {Rename duplicate instance names} -command "xschem check_unique_names 1" \ + -accelerator {Ctrl+#} .menubar.hilight.menu add command -label {Highlight selected net/pins} -command "xschem hilight" -accelerator K .menubar.hilight.menu add command -label {Send selected net/pins to GAW} -command "xschem send_to_gaw" -accelerator Alt+G - .menubar.hilight.menu add command -label {Select connected nets / pins} -command "xschem select_connected_nets" -accelerator Alt+K + .menubar.hilight.menu add command -label {Select connected nets / pins} -command "xschem select_connected_nets" \ + -accelerator Alt+K .menubar.hilight.menu add command -label {Un-highlight all net/pins} \ -command "xschem clear_hilights" -accelerator Shift+K .menubar.hilight.menu add command -label {Un-highlight selected net/pins} \ @@ -3821,9 +3832,12 @@ font configure Underline-Font -underline true -size 24 input_line {Set netlist file name} {xschem set user_top_netl_name} [xschem get user_top_netl_name] 40 } .menubar.simulation.menu add command -label {Configure simulators and tools} -command {simconf} - .menubar.simulation.menu add command -label {Utile Stimuli Editor (GUI)} -command {utile_gui [file tail [xschem get schname]]} - .menubar.simulation.menu add command -label "Utile Stimuli Editor ([lindex $editor 0])" -command {utile_edit [file tail [xschem get schname]]} - .menubar.simulation.menu add command -label {Utile Stimuli Translate} -command {utile_translate [file tail [xschem get schname]]} + .menubar.simulation.menu add command -label {Utile Stimuli Editor (GUI)} \ + -command {utile_gui [file tail [xschem get schname]]} + .menubar.simulation.menu add command -label "Utile Stimuli Editor ([lindex $editor 0])" \ + -command {utile_edit [file tail [xschem get schname]]} + .menubar.simulation.menu add command -label {Utile Stimuli Translate} \ + -command {utile_translate [file tail [xschem get schname]]} .menubar.simulation.menu add command -label {Shell [simulation path]} \ -command { if { [select_netlist_dir 0] ne "" } { @@ -3832,7 +3846,8 @@ font configure Underline-Font -underline true -size 24 } .menubar.simulation.menu add command -label {Edit Netlist} -command {edit_netlist [file tail [xschem get schname]]} .menubar.simulation.menu add command -label {Send highlighted nets to GAW} -command {xschem create_plot_cmd gaw} - .menubar.simulation.menu add command -label {Create Ngspice 'xplot' file} -command {xschem create_plot_cmd ngspice} -accelerator Shift+J + .menubar.simulation.menu add command -label {Create Ngspice 'xplot' file} \ + -command {xschem create_plot_cmd ngspice} -accelerator Shift+J .menubar.simulation.menu add separator .menubar.simulation.menu add checkbutton -label "LVS netlist: Top level is a .subckt" -variable top_subckt .menubar.simulation.menu add checkbutton -label "Use 'spiceprefix' attribute" -variable spiceprefix \