From 514b5be2c276b4da3de78545cd3d4b01031313ac Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Mon, 7 Apr 2025 14:50:28 +0200 Subject: [PATCH] fix sym_txt (text display/hide) in symbols, add commands to place ipins and opins, move create_plot_cmd to ctrl-shift-X, grouped some menus in Symbol menu --- doc/xschem_man/commands.html | 6 ++-- src/actions.c | 8 ++++- src/callback.c | 14 +++++--- src/draw.c | 4 +-- src/keys.help | 6 ++-- src/xschem.tcl | 35 +++++++++++++------ .../devices/bindkeys_cheatsheet.sym | 6 ++-- 7 files changed, 55 insertions(+), 24 deletions(-) diff --git a/doc/xschem_man/commands.html b/doc/xschem_man/commands.html index 1c79e308..83be3dbc 100644 --- a/doc/xschem_man/commands.html +++ b/doc/xschem_man/commands.html @@ -215,9 +215,9 @@ shift 'O' Toggle Light / Dark colorscheme shift+ctrl 'O' Load most recent file ctrl 'o' Open file - 'p' Place polygon. Operation ends by placing last point over first. -ctrl 'p' create xplot plot file for ngspice in simulation directory - (just type xplot in ngspice) alt 'p' Add symbol pin +ctrl 'p' Add schematic ipin +ctrl+shift 'P' Add schematic opin shift 'P' Pan view area alt 'q' Edit schematic file (dangerous!) - 'q' Edit prop @@ -250,6 +250,8 @@ shift 'W' Place wire, snapping to closest pin or net endpoint ctrl 'x' Cut into clipboard - 'x' New cad session shift 'X' Highlight discrepancies between object ports and attached nets +ctrl+shift 'X' create xplot plot file for ngspice in simulation directory + (just type xplot in ngspice) alt 'x' Toggle draw crosshair at mouse position - 'y' Toggle stretching wires - 'z' Zoom box diff --git a/src/actions.c b/src/actions.c index e36d230c..be579341 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1453,9 +1453,15 @@ void place_net_label(int type) if(type == 1) { const char *lab = tcleval("find_file_first lab_pin.sym"); place_symbol(-1, lab, xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1, 1/*to_push_undo*/); - } else { + } else if(type == 0) { const char *lab = tcleval("find_file_first lab_wire.sym"); place_symbol(-1, lab, xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1, 1/*to_push_undo*/); + } else if(type == 2) { + const char *lab = tcleval("find_file_first ipin.sym"); + place_symbol(-1, lab, xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1, 1/*to_push_undo*/); + } else if(type == 3) { + const char *lab = tcleval("find_file_first opin.sym"); + place_symbol(-1, lab, xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1, 1/*to_push_undo*/); } move_objects(START,0,0,0); xctx->ui_state |= START_SYMPIN; diff --git a/src/callback.c b/src/callback.c index 25f5f2d9..fdf11ca9 100644 --- a/src/callback.c +++ b/src/callback.c @@ -3337,10 +3337,7 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m break; case 'p': - if(rstate == ControlMask) { /* create xplot commandof hilight signals for ngspice */ - create_plot_cmd(); - } - else if(EQUAL_MODMASK) { /* add symbol pin */ + if(EQUAL_MODMASK) { /* add symbol pin */ xctx->push_undo(); unselect_all(1); storeobject(-1, xctx->mousex_snap-2.5, xctx->mousey_snap-2.5, xctx->mousex_snap+2.5, xctx->mousey_snap+2.5, @@ -3350,6 +3347,9 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m move_objects(START,0,0,0); xctx->ui_state |= START_SYMPIN; } + else if(rstate == ControlMask) { + place_net_label(2); + } else if( !(xctx->ui_state & STARTPOLYGON) && rstate==0) { /* start polygon */ if(xctx->semaphore >= 2) break; dbg(1, "callback(): start polygon\n"); @@ -3372,6 +3372,9 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m draw(); redraw_w_a_l_r_p_z_rubbers(1); } + else if(rstate == ControlMask) { + place_net_label(3); + } break; case 'q': @@ -3734,6 +3737,9 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m if(rstate == 0) { /* highlight discrepanciens between selected instance pin and net names */ hilight_net_pin_mismatches(); } + if(rstate == ControlMask) { /* create xplot command of hilight signals for ngspice */ + create_plot_cmd(); + } break; case 'y': diff --git a/src/draw.c b/src/draw.c index 58671b90..b718385e 100644 --- a/src/draw.c +++ b/src/draw.c @@ -676,9 +676,9 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot, draw_texts: - if( !(xctx->inst[n].flags & HIDE_SYMBOL_TEXTS) && (layer == cadlayers - 1)) { + if(xctx->sym_txt && !(xctx->inst[n].flags & HIDE_SYMBOL_TEXTS) && (layer == cadlayers - 1)) { if(xctx->inst[n].flags & PIN_OR_LABEL) c_for_text = TEXTWIRELAYER; - if(xctx->sym_txt && !(xctx->inst[n].flags & PIN_OR_LABEL)) c_for_text = TEXTLAYER; + if(!(xctx->inst[n].flags & PIN_OR_LABEL)) c_for_text = TEXTLAYER; if(c != layer) c_for_text = c; for(j=0;j< symptr->texts; ++j) { diff --git a/src/keys.help b/src/keys.help index 58d48e98..959e2a42 100644 --- a/src/keys.help +++ b/src/keys.help @@ -156,9 +156,9 @@ shift 'O' Toggle Light / Dark colorscheme shift+ctrl 'O' Load most recent file ctrl 'o' Open file - 'p' Place polygon. Operation ends by placing last point over first. -ctrl 'p' create xplot plot file for ngspice in simulation directory - (just type xplot in ngspice) alt 'p' Add symbol pin +ctrl 'p' Add schematic ipin +ctrl+shift 'P' Add schematic opin shift 'P' Pan view area alt 'q' Edit schematic file (dangerous!) - 'q' Edit prop @@ -191,6 +191,8 @@ shift 'W' Place wire, snapping to closest pin or net endpoint ctrl 'x' Cut into clipboard - 'x' New cad session shift 'X' Highlight discrepancies between object ports and attached nets +ctrl+shift 'X' create xplot plot file for ngspice in simulation directory + (just type xplot in ngspice) alt 'x' Toggle draw crosshair at mouse position - 'y' Toggle stretching wires - 'z' Zoom box diff --git a/src/xschem.tcl b/src/xschem.tcl index 957da595..86b7c644 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -9162,15 +9162,20 @@ proc build_widgets { {topwin {} } } { -command { update_schematic_header } -accelerator Shift+B $topwin.menubar.prop add command -background red -label "Edit file (danger!)" \ -command "xschem edit_file" -accelerator Alt+Q - $topwin.menubar.sym add radiobutton -label "Show symbols" \ + + $topwin.menubar.sym add cascade -label "Show symbols" -menu $topwin.menubar.sym.sym + menu $topwin.menubar.sym.sym -tearoff 0 + + $topwin.menubar.sym.sym add radiobutton -label "Show symbol details" \ -selectcolor $selectcolor -background grey60 -variable hide_symbols -value 0 \ -command {xschem set hide_symbols $hide_symbols; xschem redraw} -accelerator Alt+B - $topwin.menubar.sym add radiobutton -label "Show instance Bounding boxes for subcircuit symbols" \ + $topwin.menubar.sym.sym add radiobutton -label "Show instance Bounding boxes for subcircuit symbols" \ -selectcolor $selectcolor -background grey60 -variable hide_symbols -value 1 \ -command {xschem set hide_symbols $hide_symbols; xschem redraw} -accelerator Alt+B - $topwin.menubar.sym add radiobutton -label "Show instance Bounding boxes for all symbols" \ + $topwin.menubar.sym.sym add radiobutton -label "Show instance Bounding boxes for all symbols" \ -selectcolor $selectcolor -background grey60 -variable hide_symbols -value 2 \ -command {xschem set hide_symbols $hide_symbols; xschem redraw} -accelerator Alt+B + $topwin.menubar.sym add command -label "Set symbol width" \ -command { input_line "Enter Symbol width ($symbol_width)" "set symbol_width" $symbol_width @@ -9187,24 +9192,34 @@ proc build_widgets { {topwin {} } } { -command "schpins_to_sympins" -accelerator Alt+H $topwin.menubar.sym add command -label "Place symbol pin" \ -command "xschem add_symbol_pin" -accelerator Alt+P + $topwin.menubar.sym add command -label "Place schematic input port" \ + -command "xschem net_label 2" -accelerator Ctrl+P + $topwin.menubar.sym add command -label "Place schematic output port" \ + -command "xschem net_label 3" -accelerator Ctrl+Shift+P $topwin.menubar.sym add command -label "Place net pin label" \ -command "xschem net_label 1" -accelerator Alt+L $topwin.menubar.sym add command -label "Place net wire label" \ - -command "xschem net_label 0" -accelerator Alt-Shift-L + -command "xschem net_label 0" -accelerator Alt+Shift+L $topwin.menubar.sym add command -label "Change selected inst. texts to floaters" \ -command "xschem floaters_from_selected_inst" $topwin.menubar.sym add command -label "Unselect attached floaters" \ -command "xschem unselect_attached_floaters" - $topwin.menubar.sym add command -label "Print list of highlight nets" \ + + + $topwin.menubar.sym add cascade -label "List of nets" -menu $topwin.menubar.sym.list + menu $topwin.menubar.sym.list -tearoff 0 + + $topwin.menubar.sym.list add command -label "Print list of highlight nets" \ -command "xschem print_hilight_net 1" -accelerator J - $topwin.menubar.sym add command -label "Print list of highlight nets, with buses expanded" \ + $topwin.menubar.sym.list add command -label "Print list of highlight nets, with buses expanded" \ -command "xschem print_hilight_net 3" -accelerator Alt-Ctrl-J - $topwin.menubar.sym add command -label "Create labels from highlight nets" \ + $topwin.menubar.sym.list add command -label "Create labels from highlight nets" \ -command "xschem print_hilight_net 4" -accelerator Alt-J - $topwin.menubar.sym add command -label "Create labels from highlight nets with 'i' prefix" \ + $topwin.menubar.sym.list add command -label "Create labels from highlight nets with 'i' prefix" \ -command "xschem print_hilight_net 2" -accelerator Alt-Shift-J - $topwin.menubar.sym add command -label "Create pins from highlight nets" \ + $topwin.menubar.sym.list add command -label "Create pins from highlight nets" \ -command "xschem print_hilight_net 0" -accelerator Ctrl-J + $topwin.menubar.sym add checkbutton \ -selectcolor $selectcolor \ -label "Search all search-paths for schematic associated to symbol" -variable search_schematic @@ -9341,7 +9356,7 @@ proc build_widgets { {topwin {} } } { $topwin.menubar.simulation add command -label {Edit Netlist} \ -command {edit_netlist [xschem get netlist_name fallback]} $topwin.menubar.simulation add command -label {Send highlighted nets to viewer} \ - -command {xschem create_plot_cmd} -accelerator Shift+J + -command {xschem create_plot_cmd} -accelerator Ctrl+Shift+X $topwin.menubar.simulation add command -label {Changelog from current hierarchy} -command { viewdata [list_hierarchy] } diff --git a/xschem_library/devices/bindkeys_cheatsheet.sym b/xschem_library/devices/bindkeys_cheatsheet.sym index d74845a5..9598f63e 100644 --- a/xschem_library/devices/bindkeys_cheatsheet.sym +++ b/xschem_library/devices/bindkeys_cheatsheet.sym @@ -257,11 +257,11 @@ T {Open file} 762.5 -275 0 0 0.18 0.18 {layer=4} T {Colorscheme} 762.5 -263.75 0 0 0.18 0.18 {layer=12} T {-} 762.5 -252.5 0 0 0.18 0.18 {} T {-} 762.5 -286.25 0 0 0.18 0.18 {layer=7} -T {xplot file} 842.5 -275 0 0 0.18 0.18 {layer=4} +T {Add sch ipin} 842.5 -275 0 0 0.18 0.18 {layer=4} T {Pan view area} 842.5 -263.75 0 0 0.18 0.18 {layer=12} T {Polygon} 842.5 -252.5 0 0 0.18 0.18 {} T {Add sym pin} 842.5 -286.25 0 0 0.18 0.18 {layer=7} -T {-} 842.5 -297.5 0 0 0.18 0.18 {layer=6} +T {Add sch opin} 842.5 -297.5 0 0 0.18 0.18 {layer=6} T {Quit} 122.5 -275 0 0 0.18 0.18 {layer=4} T {Edit w editor} 122.5 -263.75 0 0 0.18 0.18 {layer=12} T {Edit attributes} 122.5 -252.5 0 0 0.18 0.18 {} @@ -302,7 +302,7 @@ T {Cut clipboard} 282.5 -115 0 0 0.18 0.18 {layer=4} T {Pin/net diffs} 282.5 -103.75 0 0 0.18 0.18 {layer=12} T {New xschem} 282.5 -92.5 0 0 0.18 0.18 {} T {Crosshair} 282.5 -126.25 0 0 0.18 0.18 {layer=7} -T {-} 282.5 -137.5 0 0 0.18 0.18 {layer=6} +T {xplot file} 282.5 -137.5 0 0 0.18 0.18 {layer=6} T {-} 522.5 -275 0 0 0.18 0.18 {layer=4} T {-} 522.5 -263.75 0 0 0.18 0.18 {layer=12} T {Toggle stretch} 522.5 -252.5 0 0 0.18 0.18 {}