`xschem go_back 0` allows to go up in hierarchy *NOT* saving a modified schematic
This commit is contained in:
parent
151241afc7
commit
025823f14c
|
|
@ -876,9 +876,11 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
if returned value is 0 it means that last searched attribute did not exist </pre>
|
||||
<li><kbd> globals</kbd></li><pre>
|
||||
Return various global variables used in the program </pre>
|
||||
<li><kbd> go_back [notitle]</kbd></li><pre>
|
||||
<li><kbd> go_back [what]</kbd></li><pre>
|
||||
Go up one level (pop) in hierarchy
|
||||
if integer 'notitle' given pass it to the go_back() function (1=do not update window title) </pre>
|
||||
if integer 'what' given pass it to the go_back() function
|
||||
what = 1: ask confirm save if current schematic modified.
|
||||
what = 2: do not reset window title </pre>
|
||||
<li><kbd> grabscreen</kbd></li><pre>
|
||||
grab root window </pre>
|
||||
<li><kbd> hash_file file [skip_path_lines]</kbd></li><pre>
|
||||
|
|
|
|||
|
|
@ -2409,13 +2409,20 @@ int descend_schematic(int instnumber, int fallback, int alert, int set_title)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void go_back(int confirm, int set_title) /* 20171006 add confirm */
|
||||
/*
|
||||
* what:
|
||||
* 1: ask gui user confirm if schematic modified
|
||||
* 2: do *NOT* reset window title
|
||||
*/
|
||||
void go_back(int what)
|
||||
{
|
||||
int save_ok;
|
||||
int from_embedded_sym;
|
||||
int save_modified;
|
||||
char filename[PATH_MAX];
|
||||
int prev_sch_type;
|
||||
int confirm = what & 1;
|
||||
int set_title = !(confirm & 2);
|
||||
|
||||
save_ok=1;
|
||||
dbg(1,"go_back(): sch[xctx->currsch]=%s\n", xctx->sch[xctx->currsch]);
|
||||
|
|
@ -2429,9 +2436,13 @@ void go_back(int confirm, int set_title) /* 20171006 add confirm */
|
|||
tcleval("ask_save_optional");
|
||||
if(!strcmp(tclresult(), "yes") ) save_ok = save_schematic(xctx->sch[xctx->currsch], 0);
|
||||
else if(!strcmp(tclresult(), "") ) return;
|
||||
} else {
|
||||
save_ok = save_schematic(xctx->sch[xctx->currsch], 0);
|
||||
}
|
||||
/* do not automatically save if confirm==0. Script developers should take care of this */
|
||||
/*
|
||||
* else {
|
||||
* save_ok = save_schematic(xctx->sch[xctx->currsch], 0);
|
||||
* }
|
||||
*/
|
||||
}
|
||||
if(save_ok==0) {
|
||||
fprintf(errfp, "go_back(): file opening for write failed! %s \n", xctx->current_name);
|
||||
|
|
@ -2458,7 +2469,7 @@ void go_back(int confirm, int set_title) /* 20171006 add confirm */
|
|||
/* by default) to parent schematic if going back from embedded symbol */
|
||||
|
||||
my_strncpy(filename, xctx->sch[xctx->currsch], S(filename));
|
||||
load_schematic(1, filename, (set_title & 1), 1);
|
||||
load_schematic(1, filename, set_title, 1);
|
||||
/* if we are returning from a symbol created from a generator don't set modified flag on parent
|
||||
* as these symbols can not be edited / saved as embedded
|
||||
* xctx->sch_inst_number[xctx->currsch + 1] == -1 --> we came from an inst with no embed flag set */
|
||||
|
|
|
|||
|
|
@ -1887,7 +1887,7 @@ static void context_menu_action(double mx, double my)
|
|||
descend_symbol();
|
||||
break;
|
||||
case 14:
|
||||
go_back(1, 1);
|
||||
go_back(1);
|
||||
break;
|
||||
case 15: /* copy selection into clipboard */
|
||||
rebuild_selected_array();
|
||||
|
|
@ -3043,7 +3043,7 @@ int rstate; /* (reduced state, without ShiftMask) */
|
|||
if( (key=='e' && rstate == ControlMask) || (key==XK_BackSpace)) /* back */
|
||||
{
|
||||
if(xctx->semaphore >= 2) break;
|
||||
go_back(1, 1);break;
|
||||
go_back(1);break;
|
||||
}
|
||||
|
||||
if(key=='a' && rstate == 0) /* make symbol */
|
||||
|
|
|
|||
|
|
@ -2099,17 +2099,19 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
#endif
|
||||
}
|
||||
|
||||
/* go_back [notitle]
|
||||
/* go_back [what]
|
||||
* Go up one level (pop) in hierarchy
|
||||
* if integer 'notitle' given pass it to the go_back() function (1=do not update window title) */
|
||||
* if integer 'what' given pass it to the go_back() function
|
||||
* what = 1: ask confirm save if current schematic modified.
|
||||
* what = 2: do not reset window title */
|
||||
else if(!strcmp(argv[1], "go_back"))
|
||||
{
|
||||
int set_title = 1;
|
||||
int what = 1;
|
||||
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
|
||||
if(argc > 2 ) {
|
||||
set_title = atoi(argv[2]);
|
||||
what = atoi(argv[2]);
|
||||
}
|
||||
if((xctx->semaphore == 0)) go_back(0, set_title);
|
||||
if((xctx->semaphore == 0)) go_back(what);
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1528,7 +1528,7 @@ extern void toggle_ignore(void);
|
|||
extern void get_additional_symbols(int what);
|
||||
extern int change_sch_path(int instnumber, int dr);
|
||||
extern int descend_schematic(int instnumber, int fallback, int alert, int set_title);
|
||||
extern void go_back(int confirm, int set_title);
|
||||
extern void go_back(int what); /* what == 1: confirm save; what == 2: do not reset window title */
|
||||
extern void clear_schematic(int cancel, int symbol);
|
||||
extern void view_unzoom(double z);
|
||||
extern void view_zoom(double z);
|
||||
|
|
|
|||
Loading…
Reference in New Issue