From 778dd2c0dc556c8a4395d7d3383bdd611e95a47d Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 27 Jan 2024 11:42:05 +0100 Subject: [PATCH] recognize integrated_noise, improve `xschem preview_window` command --- XSchemWin/XSchemWix/doc.wxs | 4 + XSchemWin/XSchemWix/heat_doc.wxs | 748 +++++++++++++++-------------- doc/xschem_man/developer_info.html | 11 +- src/save.c | 9 +- src/scheduler.c | 4 +- src/xinit.c | 20 +- 6 files changed, 412 insertions(+), 384 deletions(-) diff --git a/XSchemWin/XSchemWix/doc.wxs b/XSchemWin/XSchemWix/doc.wxs index b7cbcefd..b6f7224f 100644 --- a/XSchemWin/XSchemWix/doc.wxs +++ b/XSchemWin/XSchemWix/doc.wxs @@ -450,6 +450,9 @@ + + + @@ -1277,6 +1280,7 @@ + diff --git a/XSchemWin/XSchemWix/heat_doc.wxs b/XSchemWin/XSchemWix/heat_doc.wxs index 709e93c5..c0c7ac43 100644 --- a/XSchemWin/XSchemWix/heat_doc.wxs +++ b/XSchemWin/XSchemWix/heat_doc.wxs @@ -3,1123 +3,1126 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1276,6 +1279,7 @@ + diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index 2d9ff461..87010d37 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -544,8 +544,6 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" - - @@ -1056,7 +1054,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" Start a GUI placement of a text object
  • polygon
  •     Start a GUI placement of a polygon 
    -
  • preview_window create|draw|destroy [winpath] [file]
  • +   
  • preview_window create|draw|destroy|close [winpath] [file]
  • +   destroy: will delete preview schematic data and destroy container window
    +   close: same as destroy but leave the container window.
        Used in fileselector to show a schematic preview.
  • print png|svg|ps|pdf|ps_full|pdf_full img_file [img_x img_y] [x1 y1 x2 y2]
  •     If img_x and img_y are set to 0 (recommended for svg and ps/pdf) 
    @@ -1489,6 +1489,11 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
     
     
     
    +
    +
    +
    +
    +
     
     
     
    diff --git a/src/save.c b/src/save.c
    index 7533ef54..9fa88410 100644
    --- a/src/save.c
    +++ b/src/save.c
    @@ -568,10 +568,17 @@ static int read_dataset(FILE *fd, Raw **rawptr, const char *type)
           dbg(dbglev, "read_dataset(): noise sim_type=%s\n", sim_type ? sim_type : "");
         }
         else if(!strncmp(line, "Plotname:", 9) && strstr(lowerline, "operating point")) {
    -
           if(!type) type = "op";
           if(!strcmp(type, "op")) sim_type = "op";
           dbg(dbglev, "read_dataset(): op sim_type=%s\n", sim_type ? sim_type : "");
    +    } 
    +    else if(!strncmp(line, "Plotname:", 9) && strstr(lowerline, "integrated noise")) {
    +      if(!type) type = "op";
    +      else if(!strcmp(type, "noise")) {
    +        sim_type = "noise";
    +      }
    +      if(!strcmp(type, "op")) sim_type = "op";
    +      dbg(dbglev, "read_dataset(): op sim_type=%s\n", sim_type ? sim_type : "");
         }
         else if(!strncmp(line, "Plotname:", 9) &&
                 ( strstr(lowerline, "ac analysis") ||
    diff --git a/src/scheduler.c b/src/scheduler.c
    index 186b2981..fa1f13f9 100644
    --- a/src/scheduler.c
    +++ b/src/scheduler.c
    @@ -3125,7 +3125,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
           xctx->ui_state2 = MENUSTARTPOLYGON;
         }
     
    -    /* preview_window create|draw|destroy [winpath] [file]
    +    /* preview_window create|draw|destroy|close [winpath] [file]
    +     *   destroy: will delete preview schematic data and destroy container window
    +     *   close: same as destroy but leave the container window.
          *   Used in fileselector to show a schematic preview.
          */
         else if(!strcmp(argv[1], "preview_window"))
    diff --git a/src/xinit.c b/src/xinit.c
    index 821481ed..f444a54d 100644
    --- a/src/xinit.c
    +++ b/src/xinit.c
    @@ -1178,7 +1178,7 @@ void preview_window(const char *what, const char *win_path, const char *fname)
       Xschem_ctx *save_xctx = NULL; /* save pointer to current schematic context structure */
       static Xschem_ctx *preview_xctx = NULL; /* save pointer to current schematic context structure */
       static Window pre_window;
    -  static Tk_Window tkpre_window;
    +  static Tk_Window tkpre_window = NULL;
       static int semaphore=0;
     
       /* avoid reentrant calls for example if an alert box is displayed while loading file to preview,
    @@ -1190,10 +1190,12 @@ void preview_window(const char *what, const char *win_path, const char *fname)
       if(!strcmp(what, "create")) {
         dbg(1, "preview_window() create, save ctx, win_path=%s\n", win_path);
         tkpre_window = Tk_NameToWindow(interp, win_path, mainwindow);
    -    Tk_MakeWindowExist(tkpre_window);
    -    pre_window = Tk_WindowId(tkpre_window);
    +    if(tkpre_window) {
    +      Tk_MakeWindowExist(tkpre_window);
    +      pre_window = Tk_WindowId(tkpre_window);
    +    }
       }
    -  else if(!strcmp(what, "draw")) {
    +  else if(tkpre_window && !strcmp(what, "draw") ) {
         dbg(1, "preview_window() draw\n");
         save_xctx = xctx; /* save current schematic */
         xctx = preview_xctx;
    @@ -1213,11 +1215,13 @@ void preview_window(const char *what, const char *win_path, const char *fname)
           resetwin(1, 0, 1, 0, 0);  /* create preview pixmap.  resetwin(create_pixmap, clear_pixmap, force) */
           dbg(1, "preview_window() draw, load schematic\n");
           load_schematic(1,fname, 0, 1);
    +    } else {
    +      resetwin(1, 1, 0, 0, 0);  /* resetwin(create_pixmap, clear_pixmap, force) */
         }
         zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); /* draw */
         xctx = save_xctx;
       }
    -  else if(!strcmp(what, "destroy")) {
    +  else if(!strcmp(what, "destroy") || !strcmp(what, "close")) {
         dbg(1, "preview_window() destroy\n");
         save_xctx = xctx; /* save current schematic */
         xctx = preview_xctx;
    @@ -1225,8 +1229,10 @@ void preview_window(const char *what, const char *win_path, const char *fname)
           delete_schematic_data(1);
           preview_xctx = NULL;
         }
    -    
    -    Tk_DestroyWindow(tkpre_window);
    +    if(!strcmp(what, "destroy")) {
    +      Tk_DestroyWindow(tkpre_window);
    +      tkpre_window = NULL;
    +    }
         my_free(_ALLOC_ID_, ¤t_file);
         xctx = save_xctx; /* restore schematic */
         save_xctx = NULL;