various bug fixes for `xschem raw new` command
This commit is contained in:
parent
23092fc963
commit
d1bd5140fe
|
|
@ -1714,6 +1714,7 @@ void launcher(void)
|
||||||
char program[PATH_MAX];
|
char program[PATH_MAX];
|
||||||
int n;
|
int n;
|
||||||
rebuild_selected_array();
|
rebuild_selected_array();
|
||||||
|
tcleval("update");
|
||||||
if(xctx->lastsel ==1 && xctx->sel_array[0].type==ELEMENT)
|
if(xctx->lastsel ==1 && xctx->sel_array[0].type==ELEMENT)
|
||||||
{
|
{
|
||||||
double mx=xctx->mousex, my=xctx->mousey;
|
double mx=xctx->mousex, my=xctx->mousey;
|
||||||
|
|
@ -1730,7 +1731,7 @@ void launcher(void)
|
||||||
tcleval(program);
|
tcleval(program);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tcleval("update; after 300");
|
tcleval("after 300");
|
||||||
select_object(mx,my,0, 0);
|
select_object(mx,my,0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2300,7 +2300,7 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
|
||||||
raw->datasets = save_datasets;
|
raw->datasets = save_datasets;
|
||||||
raw->npoints[0] = save_npoints;
|
raw->npoints[0] = save_npoints;
|
||||||
}
|
}
|
||||||
if(save_extra_idx != -1) {
|
if(save_extra_idx != -1 && save_extra_idx != xctx->extra_idx) {
|
||||||
my_snprintf(str_extra_idx, S(str_extra_idx), "%d", save_extra_idx);
|
my_snprintf(str_extra_idx, S(str_extra_idx), "%d", save_extra_idx);
|
||||||
extra_rawfile(2, str_extra_idx, NULL, -1.0, -1.0);
|
extra_rawfile(2, str_extra_idx, NULL, -1.0, -1.0);
|
||||||
raw = xctx->raw;
|
raw = xctx->raw;
|
||||||
|
|
@ -3617,7 +3617,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
||||||
raw->datasets = save_datasets;
|
raw->datasets = save_datasets;
|
||||||
raw->npoints[0] = save_npoints;
|
raw->npoints[0] = save_npoints;
|
||||||
}
|
}
|
||||||
if(save_extra_idx != -1) {
|
if(save_extra_idx != -1 && save_extra_idx != xctx->extra_idx) {
|
||||||
my_snprintf(str_extra_idx, S(str_extra_idx), "%d", save_extra_idx);
|
my_snprintf(str_extra_idx, S(str_extra_idx), "%d", save_extra_idx);
|
||||||
extra_rawfile(2, str_extra_idx, NULL, -1.0, -1.0);
|
extra_rawfile(2, str_extra_idx, NULL, -1.0, -1.0);
|
||||||
raw = xctx->raw;
|
raw = xctx->raw;
|
||||||
|
|
|
||||||
19
src/save.c
19
src/save.c
|
|
@ -830,8 +830,13 @@ int raw_add_vector(const char *varname)
|
||||||
Raw *raw = xctx->raw;
|
Raw *raw = xctx->raw;
|
||||||
if(!raw || !raw->values) return 0;
|
if(!raw || !raw->values) return 0;
|
||||||
|
|
||||||
|
if(int_hash_lookup(&raw->table, varname, 0, XLOOKUP)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
raw->nvars++;
|
raw->nvars++;
|
||||||
my_realloc(_ALLOC_ID_, &raw->names, raw->nvars * sizeof(char *));
|
my_realloc(_ALLOC_ID_, &raw->names, raw->nvars * sizeof(char *));
|
||||||
|
my_realloc(_ALLOC_ID_, &raw->cursor_b_val, raw->nvars * sizeof(double));
|
||||||
|
raw->cursor_b_val[raw->nvars - 1] = 0.0;
|
||||||
raw->names[raw->nvars - 1] = NULL;
|
raw->names[raw->nvars - 1] = NULL;
|
||||||
my_strdup2(_ALLOC_ID_, &raw->names[raw->nvars - 1], varname);
|
my_strdup2(_ALLOC_ID_, &raw->names[raw->nvars - 1], varname);
|
||||||
int_hash_lookup(&raw->table, raw->names[raw->nvars - 1], raw->nvars - 1, XINSERT_NOREPLACE);
|
int_hash_lookup(&raw->table, raw->names[raw->nvars - 1], raw->nvars - 1, XINSERT_NOREPLACE);
|
||||||
|
|
@ -955,6 +960,7 @@ int new_rawfile(const char *name, const char *type, const char *sweepvar,
|
||||||
raw->values[0] = my_calloc(_ALLOC_ID_, number, sizeof(SPICE_DATA));
|
raw->values[0] = my_calloc(_ALLOC_ID_, number, sizeof(SPICE_DATA));
|
||||||
raw->values[1] = my_calloc(_ALLOC_ID_, number, sizeof(SPICE_DATA));
|
raw->values[1] = my_calloc(_ALLOC_ID_, number, sizeof(SPICE_DATA));
|
||||||
raw->names = my_calloc(_ALLOC_ID_, raw->nvars, sizeof(char *));
|
raw->names = my_calloc(_ALLOC_ID_, raw->nvars, sizeof(char *));
|
||||||
|
raw->cursor_b_val = my_calloc(_ALLOC_ID_, raw->nvars, sizeof(double));
|
||||||
my_strdup2(_ALLOC_ID_, &raw->names[0], sweepvar);
|
my_strdup2(_ALLOC_ID_, &raw->names[0], sweepvar);
|
||||||
int_hash_lookup(&raw->table, raw->names[0], 0, XINSERT_NOREPLACE);
|
int_hash_lookup(&raw->table, raw->names[0], 0, XINSERT_NOREPLACE);
|
||||||
|
|
||||||
|
|
@ -967,9 +973,11 @@ int new_rawfile(const char *name, const char *type, const char *sweepvar,
|
||||||
xctx->extra_prev_idx = xctx->extra_idx;
|
xctx->extra_prev_idx = xctx->extra_idx;
|
||||||
xctx->extra_idx = xctx->extra_raw_n;
|
xctx->extra_idx = xctx->extra_raw_n;
|
||||||
xctx->extra_raw_n++;
|
xctx->extra_raw_n++;
|
||||||
} else { /* file found: print warning, do nothing */
|
} else { /* file found: switch to it */
|
||||||
dbg(0, "new_rawfile(): the name: %s is already used. Choose a different name\n", name);
|
dbg(1, "new_rawfile() %d read: found: switch to it\n", i);
|
||||||
ret = 0;
|
xctx->extra_prev_idx = xctx->extra_idx;
|
||||||
|
xctx->extra_idx = i;
|
||||||
|
xctx->raw = xctx->extra_raw_arr[xctx->extra_idx];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
@ -1091,7 +1099,7 @@ int extra_rawfile(int what, const char *file, const char *type, double sweep1, d
|
||||||
my_strncpy(f, tclresult(), S(f));
|
my_strncpy(f, tclresult(), S(f));
|
||||||
i = atoi(file);
|
i = atoi(file);
|
||||||
if(i >= 0 && i < xctx->extra_raw_n) { /* if file found switch to it ... */
|
if(i >= 0 && i < xctx->extra_raw_n) { /* if file found switch to it ... */
|
||||||
dbg(1, "extra_rawfile() switch %d: found: switch to it\n", i);
|
dbg(1, "extra_rawfile() switch %d: found: switch %d to it\n", xctx->extra_idx, i);
|
||||||
xctx->extra_prev_idx = xctx->extra_idx;
|
xctx->extra_prev_idx = xctx->extra_idx;
|
||||||
xctx->extra_idx = i;
|
xctx->extra_idx = i;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1106,8 +1114,6 @@ int extra_rawfile(int what, const char *file, const char *type, double sweep1, d
|
||||||
/* **************** switch back ************* */
|
/* **************** switch back ************* */
|
||||||
} else if(what == 5 && xctx->extra_raw_n > 0) {
|
} else if(what == 5 && xctx->extra_raw_n > 0) {
|
||||||
int tmp;
|
int tmp;
|
||||||
dbg(1, "extra_rawfile() switch back: extra_idx=%d, extra_prev_idx=%d\n",
|
|
||||||
xctx->extra_idx, xctx->extra_prev_idx);
|
|
||||||
tmp = xctx->extra_idx;
|
tmp = xctx->extra_idx;
|
||||||
xctx->extra_idx = xctx->extra_prev_idx;
|
xctx->extra_idx = xctx->extra_prev_idx;
|
||||||
xctx->extra_prev_idx = tmp;
|
xctx->extra_prev_idx = tmp;
|
||||||
|
|
@ -1181,6 +1187,7 @@ int update_op()
|
||||||
tcleval("array unset ngspice::ngspice_data");
|
tcleval("array unset ngspice::ngspice_data");
|
||||||
if(xctx->raw && xctx->raw->values) {
|
if(xctx->raw && xctx->raw->values) {
|
||||||
xctx->raw->annot_p = 0;
|
xctx->raw->annot_p = 0;
|
||||||
|
dbg(1, "update_op(): nvars=%d\n", xctx->raw->nvars);
|
||||||
for(i = 0; i < xctx->raw->nvars; ++i) {
|
for(i = 0; i < xctx->raw->nvars; ++i) {
|
||||||
char s[100];
|
char s[100];
|
||||||
res = 1;
|
res = 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue