various fixes about "lastopened" and "lastclosed" file load options
This commit is contained in:
parent
8d2088edd5
commit
50c593ed65
|
|
@ -608,6 +608,14 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
if descended into a vector instance change inst number we are into to 'n',
|
||||
(same rules as 'descend' command) without going up and descending again
|
||||
if 'draw' string is given redraw screen </pre>
|
||||
<li><kbd> check_loaded n <filename></kbd></li><pre>
|
||||
check if schematic / symbol file is already opened and return window path
|
||||
the loaded schematic is in.
|
||||
for <filename> use absolute path or use [abs_sym_path filename]
|
||||
window_path[0] == ".drw"
|
||||
window_path[1] == ".x1.drw"
|
||||
...
|
||||
else return empty string </pre>
|
||||
<li><kbd> check_symbols</kbd></li><pre>
|
||||
List all used symbols in current schematic and warn if some symbol is newer </pre>
|
||||
<li><kbd> check_unique_names [1|0]</kbd></li><pre>
|
||||
|
|
|
|||
|
|
@ -3938,7 +3938,7 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m
|
|||
/* load last opened file */
|
||||
char f[PATH_MAX];
|
||||
xctx->semaphore--;
|
||||
my_strncpy(f, tcleval("lindex $tctx::recentfile 0"), S(f));
|
||||
my_strncpy(f, tcleval("get_lastopened"), S(f));
|
||||
ask_new_file(1, f);
|
||||
xctx->semaphore++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -494,6 +494,24 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
}
|
||||
|
||||
/* check_loaded n <filename>
|
||||
* check if schematic / symbol file is already opened and return window path
|
||||
* the loaded schematic is in.
|
||||
* for <filename> use absolute path or use [abs_sym_path filename]
|
||||
* window_path[0] == ".drw"
|
||||
* window_path[1] == ".x1.drw"
|
||||
* ...
|
||||
* else return empty string */
|
||||
else if(!strcmp(argv[1], "check_loaded"))
|
||||
{
|
||||
char win_path[WINDOW_PATH_SIZE] = "";
|
||||
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
|
||||
if(argc > 2) {
|
||||
check_loaded(argv[2], win_path);
|
||||
}
|
||||
Tcl_SetResult(interp, win_path, TCL_VOLATILE);
|
||||
}
|
||||
|
||||
/* check_symbols
|
||||
* List all used symbols in current schematic and warn if some symbol is newer */
|
||||
else if(!strcmp(argv[1], "check_symbols"))
|
||||
|
|
@ -3037,7 +3055,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
i--;
|
||||
lastclosed = 0;
|
||||
} else if(lastopened) {
|
||||
my_strncpy(f, tcleval("lindex $tctx::recentfile 0"), S(f));
|
||||
my_strncpy(f, tcleval("get_lastopened"), S(f));
|
||||
i--;
|
||||
lastopened = 0;
|
||||
} else {
|
||||
|
|
@ -3122,7 +3140,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
if(!strcmp(argv[i], "-lastclosed")) {
|
||||
my_strncpy(f, tcleval("get_lastclosed"), S(f));
|
||||
} else if(!strcmp(argv[i], "-lastopened")) {
|
||||
my_strncpy(f, tcleval("lindex $tctx::recentfile 0"), S(f));
|
||||
my_strncpy(f, tcleval("get_lastopened"), S(f));
|
||||
} else if(!is_from_web(argv[i])) {
|
||||
my_snprintf(f, S(f),"regsub {^~/} {%s} {%s/}", argv[i], home_dir);
|
||||
tcleval(f);
|
||||
|
|
|
|||
|
|
@ -1490,15 +1490,17 @@ int check_loaded(const char *f, char *win_path)
|
|||
int i;
|
||||
Xschem_ctx *ctx;
|
||||
int found = 0;
|
||||
my_strncpy(win_path, "", S(window_path[i]));
|
||||
for(i = 0; i < MAX_NEW_WINDOWS; ++i) {
|
||||
ctx = save_xctx[i];
|
||||
dbg(1, "window_count=%d i=%d\n", window_count, i);
|
||||
/* if only one schematic it is not yet saved in save_xctx */
|
||||
if(window_count == 0 && i == 0) {
|
||||
ctx = xctx;
|
||||
my_snprintf(window_path[0], S(window_path[0]), ".drw" );
|
||||
} else {
|
||||
ctx = save_xctx[i];
|
||||
}
|
||||
if(ctx) {
|
||||
if(ctx && ctx->sch[ctx->currsch]) {
|
||||
dbg(1, "%s <--> %s\n", ctx->sch[ctx->currsch], f);
|
||||
if(!strcmp(ctx->sch[ctx->currsch], f)) {
|
||||
dbg(1, "check_loaded(): f=%s, sch=%s\n", f, ctx->sch[ctx->currsch]);
|
||||
|
|
@ -3112,7 +3114,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
}
|
||||
|
||||
if(cli_opt_lastopened) {
|
||||
my_strncpy(cli_opt_filename, tcleval("lindex $tctx::recentfile 0"), S(cli_opt_filename));
|
||||
my_strncpy(cli_opt_filename, tcleval("get_lastopened"), S(cli_opt_filename));
|
||||
}
|
||||
|
||||
if(cli_opt_filename[0]) {
|
||||
|
|
|
|||
|
|
@ -8610,6 +8610,9 @@ proc get_lastclosed {} {
|
|||
if {$ret eq [abs_sym_path untitled.sch]} {
|
||||
continue
|
||||
}
|
||||
if {[xschem check_loaded $ret] ne {}} {
|
||||
continue
|
||||
}
|
||||
if { $ret ne {}} {
|
||||
break
|
||||
}
|
||||
|
|
@ -8619,6 +8622,16 @@ proc get_lastclosed {} {
|
|||
return $ret
|
||||
}
|
||||
|
||||
proc get_lastopened {} {
|
||||
set f {}
|
||||
foreach f $tctx::recentfile {
|
||||
if {[xschem check_loaded $f] eq {}} {
|
||||
break
|
||||
}
|
||||
}
|
||||
return $f
|
||||
}
|
||||
|
||||
proc quit_xschem { {force {}}} {
|
||||
global tabbed_interface
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue