From 3eeaf53cd4a143715261de32544a0677e5db144b Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Fri, 9 Jun 2023 08:12:39 +0200 Subject: [PATCH] improve quit_xschem command and xschem new_schematic destroy_all --- src/scheduler.c | 2 ++ src/xinit.c | 4 ++-- src/xschem.tcl | 22 +++++++--------------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/scheduler.c b/src/scheduler.c index dd52739b..6e768d1c 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -2265,6 +2265,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg * destroy: destroy tab/window identified by winpath. Example: * xschem new_schematic destroy .x1.drw * destroy_all: close all tabs/additional windows + * if the 'force'argument is given do not issue a warning if modified + * tabs are about to be closed. * switch: switch context to specified 'winpath' window or specified schematic name * Main window/tab has winpath set to .drw, * Additional windows/tabs have winpath set to .x1.drw, .x2.drw and so on... diff --git a/src/xinit.c b/src/xinit.c index acc2581f..0f60f968 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -1872,9 +1872,9 @@ int new_schematic(const char *what, const char *win_path, const char *fname) } } else if(!strcmp(what, "destroy_all")) { if(!tabbed_interface) { - destroy_all_windows(&window_count, win_path ? 1 : 0); + destroy_all_windows(&window_count, (win_path && win_path[0]) ? 1 : 0); } else { - destroy_all_tabs(&window_count, win_path ? 1 : 0); + destroy_all_tabs(&window_count, (win_path && win_path[0]) ? 1 : 0); } } else if(!strcmp(what, "switch")) { if(tabbed_interface) switch_tab(&window_count, win_path); diff --git a/src/xschem.tcl b/src/xschem.tcl index 3989f453..2265a396 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -5365,22 +5365,13 @@ proc set_tab_names {{mod {}}} { } } -proc quit_xschem {} { +proc quit_xschem { {force {}}} { global tabbed_interface - set remaining [xschem new_schematic destroy_all] - if {$tabbed_interface != 1} { - if {$remaining == 0 } { - save_ctx [xschem get current_win_path] - restore_ctx .drw - xschem new_schematic switch .drw - housekeeping_ctx - xschem exit closewindow - } - } else { - xschem new_schematic switch .drw - xschem exit closewindow - } + xschem new_schematic destroy_all $force + xschem new_schematic switch .drw + set remaining [xschem exit closewindow $force] + return $remaining } proc raise_dialog {parent window_path } { @@ -5464,7 +5455,8 @@ set tctx::global_list { add_all_windows_drives auto_hilight autofocus_mainwindow autotrim_wires bespice_listen_port big_grid_points bus_replacement_char cadgrid cadlayers cadsnap cairo_font_name change_lw color_ps colors compare_sch connect_by_kissing constrained_move - copy_cell custom_label_prefix custom_token dark_colors dark_colorscheme dim_bg dim_value + copy_cell custom_label_prefix custom_token dark_colors dark_colorscheme + delay_flag dim_bg dim_value disable_unique_names do_all_inst draw_grid draw_window edit_prop_pos edit_prop_size edit_symbol_prop_new_sel editprop_sympath en_hilight_conn_inst enable_dim_bg enable_stretch filetmp flat_netlist fullscreen gaw_fd gaw_tcp_address graph_bus graph_digital