draw_symbol() and draw_temp_symbol(): do the second level @ resolution with translate3(): if no @var definition is found leave @var as is. This is what we want, to avoid trying to substitute @m.xm1......[id] ngspice variables.

This commit is contained in:
stefan schippers 2024-03-21 00:12:48 +01:00
parent 12b01e31c6
commit 3e6a3ba886
1 changed files with 6 additions and 12 deletions

View File

@ -717,12 +717,9 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
}
#endif
my_strdup2(_ALLOC_ID_, &txtptr, translate(n, text.txt_ptr));
/* this is not done in symbol_bbox and creates inconsistencies
* between bbox calculated text and displayed ext */
/*
* if(strchr(txtptr, '@') && !strstr(text.txt_ptr, "\\@"))
* my_strdup2(_ALLOC_ID_, &txtptr, translate(n, txtptr));
*/
/* do another round of substitutions if some @var are found, but if not found leave @var as is */
my_strdup2(_ALLOC_ID_, &txtptr, translate3(txtptr, xctx->inst[n].prop_ptr,
xctx->sym[xctx->inst[n].ptr].templ, NULL ));
dbg(1, "drawing string: str=%s prop=%s\n", txtptr, text.prop_ptr ? text.prop_ptr : "NULL");
draw_string(textlayer, what, txtptr,
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
@ -890,12 +887,9 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
customfont = set_text_custom_font(&text);
#endif
my_strdup2(_ALLOC_ID_, &txtptr, translate(n, text.txt_ptr));
/* this is not done in symbol_bbox and creates inconsistencies
* between bbox calculated text and displayed ext */
/*
* if(strchr(txtptr, '@') && !strstr(text.txt_ptr, "\\@"))
* my_strdup2(_ALLOC_ID_, &txtptr, translate(n, txtptr));
*/
/* do another round of substitutions if some @var are found, but if not found leave @var as is */
my_strdup2(_ALLOC_ID_, &txtptr, translate3(txtptr, xctx->inst[n].prop_ptr,
xctx->sym[xctx->inst[n].ptr].templ, NULL ));
if(txtptr[0]) draw_temp_string(gc, what, txtptr,
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
flip^text.flip, text.hcenter, text.vcenter, x0+x1, y0+y1, xscale, yscale);