From 98395824bcdbc5686a8a7c5ce03371f9dba8a988 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Wed, 12 Nov 2025 17:44:55 +0100 Subject: [PATCH] floater=1 in text elements assumed as floater=true to avoid referencing instance no.1. Texts with @params will go thru translation using parent level param assignments in translate() --- src/actions.c | 7 ++++++- src/token.c | 15 ++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/actions.c b/src/actions.c index c8b6ff73..3ad090b7 100644 --- a/src/actions.c +++ b/src/actions.c @@ -114,6 +114,7 @@ const char *get_text_floater(int i) instname = get_tok_value(xctx->text[i].prop_ptr, "name", 0); if(!xctx->tok_size) { instname = get_tok_value(xctx->text[i].prop_ptr, "floater", 0); + if(xctx->tok_size && !strboolcmp(instname, "true")) instname = "true"; } } inst = get_instance(instname); @@ -940,7 +941,10 @@ int set_text_flags(xText *t) t->flags |= strboolcmp(str, "true") ? 0 : HIDE_TEXT; } str = get_tok_value(t->prop_ptr, "name", 0); - if(!xctx->tok_size) str = get_tok_value(t->prop_ptr, "floater", 0); + if(!xctx->tok_size) { + str = get_tok_value(t->prop_ptr, "floater", 0); + if(xctx->tok_size && !strboolcmp(str, "true")) str = "true"; + } t->flags |= xctx->tok_size ? TEXT_FLOATER : 0; my_strdup2(_ALLOC_ID_, &t->floater_instname, str); } @@ -2290,6 +2294,7 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback) if(strcmp(tclresult(), "yes") ) fallback = 0; /* 'no' or 'cancel' */ if(!strcmp(tclresult(), "") ) { /* 'cancel' */ cancel = 1; + my_strncpy(filename,"", PATH_MAX); } } } diff --git a/src/token.c b/src/token.c index 6d290058..1d1f7c42 100644 --- a/src/token.c +++ b/src/token.c @@ -5203,10 +5203,15 @@ const char *translate(int inst, const char* s) /* if spiceprefix==0 and token == @spiceprefix then set empty value */ } else if(!sp_prefix && !strcmp(token, "@spiceprefix")) { /* add nothing */ - } else if(inst >= 0) { - value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 0); - if(!xctx->tok_size && xctx->inst[inst].ptr >= 0) { - value=get_tok_value(xctx->sym[xctx->inst[inst].ptr].templ, token+1, 0); + } else { + if(inst >= 0) { + value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 0); + if(!xctx->tok_size && xctx->inst[inst].ptr >= 0) { + value=get_tok_value(xctx->sym[xctx->inst[inst].ptr].templ, token+1, 0); + } + } else { + xctx->tok_size = 1; + value = token + 1; } if(!xctx->tok_size) { /* above lines did not find a value for token */ if(token[0] =='%') { @@ -5285,7 +5290,7 @@ const char *translate(int inst, const char* s) * can be calculated */ my_strdup2(_ALLOC_ID_, &result, spice_get_node(tcl_hook2(result))); - if(is_expr(result)) { + if(is_expr(result) && inst >= 0) { dbg(1, "translate(): expr():%s\n", result); my_strdup2(_ALLOC_ID_, &result, eval_expr( translate3(result, 1, xctx->inst[inst].prop_ptr, xctx->sym[xctx->inst[inst].ptr].templ,