From 694bc631a06cf2156e9c7657491c7ac5bd7c9300 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Wed, 24 May 2023 09:08:57 +0200 Subject: [PATCH] redraw schematic when switching netlisting mode (Shift-V) to redraw disabled/enabled components for the new netlisting mode; The Properties->Toggle *_ignore... menu will do nothing if in symbol netlisting mode --- src/callback.c | 1 + src/scheduler.c | 39 +++++++++++++++++++++------------------ src/xschem.tcl | 10 +++++----- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/callback.c b/src/callback.c index c9c2cdda..dc938e6d 100644 --- a/src/callback.c +++ b/src/callback.c @@ -1656,6 +1656,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key, { xctx->netlist_type++; if(xctx->netlist_type==6) xctx->netlist_type=1; set_tcl_netlist_type(); + draw(); /* needed to ungrey or grey out components due to *_ignore attribute */ break; } if(key=='s' && (state == 0) ) /* simulate */ diff --git a/src/scheduler.c b/src/scheduler.c index 9aac1e5d..bca49275 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -3717,27 +3717,30 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(xctx->netlist_type == CAD_VERILOG_NETLIST) attr="verilog_ignore"; else if(xctx->netlist_type == CAD_VHDL_NETLIST) attr="vhdl_ignore"; else if(xctx->netlist_type == CAD_TEDAX_NETLIST) attr="tedax_ignore"; - else attr="spice_ignore"; - rebuild_selected_array(); - for(n=0; n < xctx->lastsel; ++n) { - if(xctx->sel_array[n].type == ELEMENT) { - i = xctx->sel_array[n].n; - if(first) { - xctx->push_undo(); - first = 0; + else if(xctx->netlist_type == CAD_SPICE_NETLIST) attr="spice_ignore"; + else attr = NULL; + if(attr) { + rebuild_selected_array(); + for(n=0; n < xctx->lastsel; ++n) { + if(xctx->sel_array[n].type == ELEMENT) { + i = xctx->sel_array[n].n; + if(first) { + xctx->push_undo(); + first = 0; + } + remove = 0; + if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr, attr, 0), "true")) remove = 1; + if(remove) { + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, NULL)); + } else { + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, "true")); + } + set_inst_flags(&xctx->inst[i]); + set_modify(1); } - remove = 0; - if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr, attr, 0), "true")) remove = 1; - if(remove) { - my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, NULL)); - } else { - my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, "true")); - } - set_inst_flags(&xctx->inst[i]); - set_modify(1); } + draw(); } - draw(); Tcl_ResetResult(interp); } diff --git a/src/xschem.tcl b/src/xschem.tcl index bf052882..6b8a6dec 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -5889,19 +5889,19 @@ proc build_widgets { {topwin {} } } { $topwin.menubar.option.menu add separator $topwin.menubar.option.menu add radiobutton -label "Spice netlist" -variable netlist_type -value spice \ -accelerator {Shift+V} \ - -command "xschem set netlist_type spice" + -command "xschem set netlist_type spice; xschem redraw" $topwin.menubar.option.menu add radiobutton -label "VHDL netlist" -variable netlist_type -value vhdl \ -accelerator {Shift+V} \ - -command "xschem set netlist_type vhdl" + -command "xschem set netlist_type vhdl; xschem redraw" $topwin.menubar.option.menu add radiobutton -label "Verilog netlist" -variable netlist_type -value verilog \ -accelerator {Shift+V} \ - -command "xschem set netlist_type verilog" + -command "xschem set netlist_type verilog; xschem redraw" $topwin.menubar.option.menu add radiobutton -label "tEDAx netlist" -variable netlist_type -value tedax \ -accelerator {Shift+V} \ - -command "xschem set netlist_type tedax" + -command "xschem set netlist_type tedax; xschem redraw" $topwin.menubar.option.menu add radiobutton -label "Symbol global attrs" -variable netlist_type -value symbol \ -accelerator {Shift+V} \ - -command "xschem set netlist_type symbol" + -command "xschem set netlist_type symbol; xschem redraw" $topwin.menubar.edit.menu add command -label "Undo" -command "xschem undo; xschem redraw" -accelerator U toolbar_add EditUndo "xschem undo; xschem redraw" "Undo" $topwin $topwin.menubar.edit.menu add command -label "Redo" -command "xschem redo; xschem redraw" -accelerator {Shift+U}