text elements with attribute name=xxx or floater=xxx will go through a tcl substitution (instead of the translate(...) function if the referenced xxx instance does not exist. floater=instname can now be given instead of name=instname (they are equivalent)
This commit is contained in:
parent
fc897c641b
commit
61a659e004
|
|
@ -104,8 +104,12 @@ const char *get_text_floater(int i)
|
|||
|
||||
if(xctx->text[i].floater_instname)
|
||||
instname = xctx->text[i].floater_instname;
|
||||
else
|
||||
else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
inst = get_instance(instname);
|
||||
if(inst >= 0) {
|
||||
if(xctx->text[i].floater_ptr) {
|
||||
|
|
@ -116,6 +120,13 @@ const char *get_text_floater(int i)
|
|||
txt_ptr = xctx->text[i].floater_ptr;
|
||||
}
|
||||
dbg(1, "floater: %s\n",txt_ptr);
|
||||
} else {
|
||||
/* do just a tcl substitution if floater does not reference an existing instance
|
||||
* (but name=something attribute must be present) and text matches tcleval(...) */
|
||||
if(strstr(txt_ptr, "tcleval(") == txt_ptr) {
|
||||
my_strdup(_ALLOC_ID_, &xctx->text[i].floater_ptr, tcl_hook2(xctx->text[i].txt_ptr));
|
||||
txt_ptr = xctx->text[i].floater_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
return txt_ptr;
|
||||
|
|
@ -807,6 +818,7 @@ int set_text_flags(xText *t)
|
|||
str = get_tok_value(t->prop_ptr, "hide", 0);
|
||||
t->flags |= strcmp(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);
|
||||
t->flags |= xctx->tok_size ? TEXT_FLOATER : 0;
|
||||
my_strdup2(_ALLOC_ID_, &t->floater_instname, str);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3569,6 +3569,10 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
is_floater = 0;
|
||||
get_tok_value(tmptext.prop_ptr, "name", 2);
|
||||
if(xctx->tok_size) is_floater = 1; /* get rid of floater texts in LCC symbols */
|
||||
else {
|
||||
get_tok_value(tmptext.prop_ptr, "floater", 2);
|
||||
if(xctx->tok_size) is_floater = 1; /* get rid of floater texts in LCC symbols */
|
||||
}
|
||||
if( !strcmp(get_tok_value(tmptext.prop_ptr, "symbol_ignore", 0), "true") || is_floater) {
|
||||
my_free(_ALLOC_ID_, &tmptext.prop_ptr);
|
||||
my_free(_ALLOC_ID_, &tmptext.txt_ptr);
|
||||
|
|
|
|||
Loading…
Reference in New Issue