non-empty string given as win_path in `xschem new_schematic create` will avoid warnings if opening multiple windows/tabs of the same file. do not issue warnings if calling xschem with multiple identical schematic files from the command line. `xschem new_schematic` command: use abs_sym_pth on given filename to get correct path.
This commit is contained in:
parent
331934afc6
commit
2312bfc34e
|
|
@ -1996,7 +1996,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
if(!cancel) {
|
||||
if(f[0]) {
|
||||
new_schematic("create", NULL, f);
|
||||
new_schematic("create", "noconfirm", f);
|
||||
tclvareval("update_recent_file {", f, "}", NULL);
|
||||
} else {
|
||||
new_schematic("create", NULL, NULL);
|
||||
|
|
@ -2228,7 +2228,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_ResetResult(interp);
|
||||
}
|
||||
|
||||
/* new_schematic create|destroy|destroy_all|switch_win winpath file
|
||||
/* new_schematic create|destroy|destroy_all|switch_win|switch_tab winpath file
|
||||
* Open/destroy a new tab or window
|
||||
* create: create new empty window or with 'file' loaded if 'file' given.
|
||||
* The winpath must be given (even {} is ok) but is not used.
|
||||
|
|
@ -2252,7 +2252,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
char f[PATH_MAX + 100];
|
||||
my_snprintf(f, S(f),"regsub {^~/} {%s} {%s/}", argv[4], home_dir);
|
||||
tcleval(f);
|
||||
my_strncpy(f, tclresult(), S(f));
|
||||
my_strncpy(f, abs_sym_path(tclresult(), ""), S(f));
|
||||
r = new_schematic(argv[2], argv[3], f);
|
||||
}
|
||||
my_snprintf(s, S(s), "%d", r);
|
||||
|
|
|
|||
14
src/xinit.c
14
src/xinit.c
|
|
@ -1415,7 +1415,8 @@ static void switch_tab(int *window_count, const char *win_path)
|
|||
}
|
||||
}
|
||||
|
||||
static void create_new_window(int *window_count, const char *fname)
|
||||
/* non NULL and not empty noconfirm is used to avoid warning for duplicated filenames */
|
||||
static void create_new_window(int *window_count, const char *noconfirm, const char *fname)
|
||||
{
|
||||
Window win_id;
|
||||
char toppath[WINDOW_PATH_SIZE];
|
||||
|
|
@ -1425,7 +1426,7 @@ static void create_new_window(int *window_count, const char *fname)
|
|||
dbg(1, "new_schematic() create: fname=%s *window_count = %d\n", fname, *window_count);
|
||||
|
||||
my_strncpy(prev_window, xctx->current_win_path, S(prev_window));
|
||||
if(/* *window_count && */ fname && fname[0] && check_loaded(fname, toppath)) {
|
||||
if((!noconfirm || !noconfirm[0]) && fname && fname[0] && check_loaded(fname, toppath)) {
|
||||
char msg[PATH_MAX+100];
|
||||
my_snprintf(msg, S(msg),
|
||||
"tk_messageBox -type okcancel -icon warning -parent [xschem get topwindow] "
|
||||
|
|
@ -1505,7 +1506,8 @@ static void create_new_window(int *window_count, const char *fname)
|
|||
windowid(toppath);
|
||||
}
|
||||
|
||||
static void create_new_tab(int *window_count, const char *fname)
|
||||
/* non NULL and not empty noconfirm is used to avoid warning for duplicated filenames */
|
||||
static void create_new_tab(int *window_count, const char *noconfirm, const char *fname)
|
||||
{
|
||||
int i;
|
||||
char open_path[WINDOW_PATH_SIZE];
|
||||
|
|
@ -1513,7 +1515,7 @@ static void create_new_tab(int *window_count, const char *fname)
|
|||
char win_path[WINDOW_PATH_SIZE];
|
||||
|
||||
dbg(1, "new_schematic() new_tab, creating...\n");
|
||||
if(/* *window_count && */ fname && fname[0] && check_loaded(fname, open_path)) {
|
||||
if((!noconfirm || !noconfirm[0]) && fname && fname[0] && check_loaded(fname, open_path)) {
|
||||
char msg[PATH_MAX+100];
|
||||
my_snprintf(msg, S(msg),
|
||||
"tk_messageBox -type okcancel -icon warning -parent [xschem get topwindow] "
|
||||
|
|
@ -1818,9 +1820,9 @@ int new_schematic(const char *what, const char *win_path, const char *fname)
|
|||
return window_count;
|
||||
} else if(!strcmp(what, "create")) {
|
||||
if(!tabbed_interface) {
|
||||
create_new_window(&window_count, fname);
|
||||
create_new_window(&window_count, win_path, fname);
|
||||
} else {
|
||||
create_new_tab(&window_count, fname);
|
||||
create_new_tab(&window_count, win_path, fname);
|
||||
}
|
||||
} else if(!strcmp(what, "destroy")) {
|
||||
if(!tabbed_interface) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue