recognize integrated_noise, improve `xschem preview_window` command

This commit is contained in:
stefan schippers 2024-01-27 11:42:05 +01:00
parent a1c2569506
commit 778dd2c0dc
6 changed files with 412 additions and 384 deletions

View File

@ -450,6 +450,9 @@
<Component Id="cmp2E04033BEABEC724FC52D75E042EBBC6" Guid="{3233E753-8FF7-43DB-9A93-A8F5485B7A05}">
<File Id="fil1407A9E0E3573D9579B328DE12CA9DCF" KeyPath="yes" Source="$(var.docSrcDir)\xschem_man\graphs19.png" />
</Component>
<Component Id="cmpA78C8D6823DB9F7E898D8016BD40E1F2" Guid="{D9EE6CA7-15FD-4DDE-A059-592559CBE2D3}">
<File Id="fil2A148FC6F10E4CD50F923332EE90DAA8" KeyPath="yes" Source="$(var.docSrcDir)\xschem_man\graphs20.png" />
</Component>
<Component Id="cmp7D84114D6FDF0E09CB66A982B3C581C3" Guid="{06F4736F-88F7-459A-BF81-9F04C78C45B7}">
<File Id="fil00E7CE2F76CC18FC1618A1670E025C42" KeyPath="yes" Source="$(var.docSrcDir)\xschem_man\gschemtoxschem.png" />
</Component>
@ -1277,6 +1280,7 @@
<ComponentRef Id="cmpB581F83F49E5962AD7E37BC077F24E1E" />
<ComponentRef Id="cmp9F2896DC4627DF350F685875FC198171" />
<ComponentRef Id="cmp2E04033BEABEC724FC52D75E042EBBC6" />
<ComponentRef Id="cmpA78C8D6823DB9F7E898D8016BD40E1F2" />
<ComponentRef Id="cmp7D84114D6FDF0E09CB66A982B3C581C3" />
<ComponentRef Id="cmpDB80566B13B66B2A92E91DA0585404A9" />
<ComponentRef Id="cmp8C7AB373FA963AF5F88C8B394FB28B19" />

File diff suppressed because it is too large Load Diff

View File

@ -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 </pre>
<li><kbd> polygon</kbd></li><pre>
Start a GUI placement of a polygon </pre>
<li><kbd> preview_window create|draw|destroy [winpath] [file]</kbd></li><pre>
<li><kbd> preview_window create|draw|destroy|close [winpath] [file]</kbd></li><pre>
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.</pre>
<li><kbd> print png|svg|ps|pdf|ps_full|pdf_full img_file [img_x img_y] [x1 y1 x2 y2]</kbd></li><pre>
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"

View File

@ -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 : "<NULL>");
}
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 : "<NULL>");
}
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 : "<NULL>");
}
else if(!strncmp(line, "Plotname:", 9) &&
( strstr(lowerline, "ac analysis") ||

View File

@ -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"))

View File

@ -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_, &current_file);
xctx = save_xctx; /* restore schematic */
save_xctx = NULL;