add `2` and `3` argument to set_modify (do only clear/set modified flag), save() -> save_schematic(): do not update title/tab names if saving with same name.
This commit is contained in:
parent
69a23355fb
commit
ee0de61220
|
|
@ -1452,8 +1452,15 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
<li><kbd> set_different_tok str new_str old_str</kbd></li><pre>
|
||||
Return string 'str' replacing/adding/removing tokens that are
|
||||
different between 'new_str' and 'old_str' </pre>
|
||||
<li><kbd> set_modify</kbd></li><pre>
|
||||
Force modify status on current schematic </pre>
|
||||
<li><kbd> set_modify [n]</kbd></li><pre>
|
||||
Force modify status on current schematic
|
||||
integer 'n':
|
||||
0 : clear modified flag, update title and tab names, upd. simulation button colors.
|
||||
1 : set modified flag, update title and tab names, upd. simulation button colors, rst floater caches.
|
||||
2 : clear modified flag, do nothing else.
|
||||
3 : set modified flag, do nothing else.
|
||||
-1 : set title, rst floater caches.
|
||||
-2 : rst floater caches, update simulation button colors (Simulate, Waves, Netlist).</pre>
|
||||
<li><kbd> setprop instance|symbol|text|rect ref tok [val] [fast]</kbd></li><pre>
|
||||
|
||||
setprop instance inst [tok] [val] [fast]
|
||||
|
|
@ -1685,6 +1692,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -140,9 +140,14 @@ const char *get_text_floater(int i)
|
|||
return txt_ptr;
|
||||
}
|
||||
|
||||
/* mod=-1 used to force set title
|
||||
* mod=-2 used to reset floaters cache
|
||||
* if floaters are present set_modify(1) (after a modify opration) must be done before draw()
|
||||
/* mod:
|
||||
* 0 : clear modified flag, update title and tab names, upd. simulation button colors.
|
||||
* 1 : set modified flag, update title and tab names, upd. simulation button colors, rst floater caches.
|
||||
* 2 : clear modified flag, do nothing else.
|
||||
* 3 : set modified flag, do nothing else.
|
||||
* -1 : set title, rst floater caches.
|
||||
* -2 : rst floater caches, update simulation button colors (Simulate, Waves, Netlist).
|
||||
* If floaters are present set_modify(1) (after a modify operation) must be done before draw()
|
||||
* to invalidate cached floater string values before redrawing
|
||||
* return 1 if floaters are found (mod==-2 or mod == 1 or mod == -1) */
|
||||
int set_modify(int mod)
|
||||
|
|
@ -152,8 +157,8 @@ int set_modify(int mod)
|
|||
dbg(1, "set_modify(): %d, prev_set_modify=%d\n", mod, xctx->prev_set_modify);
|
||||
|
||||
/* set modify state */
|
||||
if(mod == 0 || mod == 1) {
|
||||
xctx->modified = mod;
|
||||
if(mod == 0 || mod == 1 || mod == 2 || mod == 3) {
|
||||
xctx->modified = (mod & 1);
|
||||
}
|
||||
if(mod == 1 || (mod == 0 && xctx->prev_set_modify) || mod == -2) {
|
||||
/* Do not configure buttons if displaying in preview window */
|
||||
|
|
|
|||
|
|
@ -3322,6 +3322,7 @@ int save_schematic(const char *schname) /* 20171020 added return value */
|
|||
xRect *rect;
|
||||
int rects;
|
||||
char msg[PATH_MAX + 100];
|
||||
int same_name = 0;
|
||||
|
||||
if(!schname || !strcmp(schname, "")) return 0;
|
||||
|
||||
|
|
@ -3337,6 +3338,7 @@ int save_schematic(const char *schname) /* 20171020 added return value */
|
|||
set_modify(-1); /* set title to new filename */
|
||||
}
|
||||
else { /* user asks to save to same filename */
|
||||
same_name = 1;
|
||||
if(!stat(xctx->sch[xctx->currsch], &buf)) {
|
||||
if(xctx->time_last_modify && xctx->time_last_modify != buf.st_mtime) {
|
||||
tclvareval("ask_save_optional \"Schematic file: ", xctx->sch[xctx->currsch],
|
||||
|
|
@ -3372,7 +3374,8 @@ int save_schematic(const char *schname) /* 20171020 added return value */
|
|||
* xctx->prep_hash_wires=0;
|
||||
*/
|
||||
if(!strstr(xctx->sch[xctx->currsch], ".xschem_embedded_")) {
|
||||
set_modify(0);
|
||||
if(same_name) set_modify(2); /* clear only modified flag, do not set window title etc */
|
||||
else set_modify(0);
|
||||
}
|
||||
tclvareval(xctx->top_path, ".menubar entryconfigure Simulate -background $simulate_bg", NULL);
|
||||
tclvareval("set tctx::", xctx->current_win_path, "_simulate $simulate_bg", NULL);
|
||||
|
|
|
|||
|
|
@ -5179,8 +5179,16 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
my_free(_ALLOC_ID_, &s);
|
||||
}
|
||||
|
||||
/* set_modify
|
||||
* Force modify status on current schematic */
|
||||
/* set_modify [n]
|
||||
* Force modify status on current schematic
|
||||
* integer 'n':
|
||||
* 0 : clear modified flag, update title and tab names, upd. simulation button colors.
|
||||
* 1 : set modified flag, update title and tab names, upd. simulation button colors, rst floater caches.
|
||||
* 2 : clear modified flag, do nothing else.
|
||||
* 3 : set modified flag, do nothing else.
|
||||
* -1 : set title, rst floater caches.
|
||||
* -2 : rst floater caches, update simulation button colors (Simulate, Waves, Netlist).
|
||||
*/
|
||||
else if(!strcmp(argv[1], "set_modify"))
|
||||
{
|
||||
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
|
||||
|
|
|
|||
|
|
@ -1901,7 +1901,7 @@ proc traversal_setlabels {w parent_sch instname inst_sch sym_sch default_sch ins
|
|||
} else {
|
||||
xschem setprop instance $instname schematic [$w get] fast ;# set schematic attr on instance
|
||||
}
|
||||
xschem set_modify 1
|
||||
xschem set_modify 3 ;# set only modified flag to force a save, do not update window/tab titles
|
||||
xschem save
|
||||
set inst_sch [$w get]
|
||||
puts "inst_sch set to: $inst_sch"
|
||||
|
|
|
|||
Loading…
Reference in New Issue