diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index 5db37d02..3f3d14a7 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -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
  • globals
  •     Return various global variables used in the program 
    -
  • 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
  • grabscreen
  •     grab root window 
  • hash_file file [skip_path_lines]
  • diff --git a/src/actions.c b/src/actions.c
    index 71e9145d..f2d35bd3 100644
    --- a/src/actions.c
    +++ b/src/actions.c
    @@ -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 */
    diff --git a/src/callback.c b/src/callback.c
    index a66276ae..c4788b68 100644
    --- a/src/callback.c
    +++ b/src/callback.c
    @@ -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 */
    diff --git a/src/scheduler.c b/src/scheduler.c
    index 1dd19499..dac6cc38 100644
    --- a/src/scheduler.c
    +++ b/src/scheduler.c
    @@ -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);
         }
     
    diff --git a/src/xschem.h b/src/xschem.h
    index 181600ef..a51b4ee9 100644
    --- a/src/xschem.h
    +++ b/src/xschem.h
    @@ -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);