fix graph_fullxzoom if displaying multiple op (transformed to dc sweep) sims

This commit is contained in:
stefan schippers 2023-10-17 14:20:34 +02:00
parent b165720bc8
commit 9fda2adccb
2 changed files with 15 additions and 1 deletions

View File

@ -2018,6 +2018,8 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset)
int dset = dataset == -1 ? 0 : dataset; int dset = dataset == -1 ? 0 : dataset;
char *custom_rawfile = NULL; /* "rawfile" attr. set in graph: load and switch to specified raw */ char *custom_rawfile = NULL; /* "rawfile" attr. set in graph: load and switch to specified raw */
char *sim_type = NULL; char *sim_type = NULL;
int save_datasets = -1, save_npoints = -1;
Raw *raw = NULL;
if(idx < 0 ) idx = 0; if(idx < 0 ) idx = 0;
@ -2034,7 +2036,16 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset)
extra_rawfile(1, custom_rawfile, xctx->raw->sim_type); extra_rawfile(1, custom_rawfile, xctx->raw->sim_type);
} }
} }
raw = xctx->raw;
/* transform multiple OP points into a dc sweep */
if(raw && raw->sim_type && !strcmp(raw->sim_type, "op") && raw->datasets > 1 && raw->npoints[0] == 1) {
save_datasets = raw->datasets;
raw->datasets = 1;
save_npoints = raw->npoints[0];
raw->npoints[0] = raw->allpoints;
}
xx1 = get_raw_value(dset, idx, 0); xx1 = get_raw_value(dset, idx, 0);
xx2 = get_raw_value(dset, idx, xctx->raw->npoints[dset] -1); xx2 = get_raw_value(dset, idx, xctx->raw->npoints[dset] -1);
if(gr->logx) { if(gr->logx) {
@ -2049,6 +2060,10 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset)
my_free(_ALLOC_ID_, &sim_type); my_free(_ALLOC_ID_, &sim_type);
need_redraw = 1; need_redraw = 1;
if(save_npoints != -1) { /* restore multiple OP points from artificial dc sweep */
raw->datasets = save_datasets;
raw->npoints[0] = save_npoints;
}
return need_redraw; return need_redraw;
} else { } else {
return 0; return 0;

View File

@ -2211,7 +2211,6 @@ proc graph_edit_properties {n} {
# } # }
bind .graphdialog.top2.sweep <FocusOut> { bind .graphdialog.top2.sweep <FocusOut> {
puts [.graphdialog.top2.sweep get]
graph_push_undo graph_push_undo
xschem setprop rect 2 $graph_selected sweep [.graphdialog.top2.sweep get] xschem setprop rect 2 $graph_selected sweep [.graphdialog.top2.sweep get]
xschem draw_graph $graph_selected xschem draw_graph $graph_selected