diff options
Diffstat (limited to 'externals/grill')
-rw-r--r-- | externals/grill/flext/changes.txt | 1 | ||||
-rw-r--r-- | externals/grill/flext/source/flattr_ed.cpp | 28 |
2 files changed, 27 insertions, 2 deletions
diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt index d9b96343..759f6aa5 100644 --- a/externals/grill/flext/changes.txt +++ b/externals/grill/flext/changes.txt @@ -16,6 +16,7 @@ Version history: 0.4.8: - fixes for 64 bit builds (size_t is integer type of pointer size) - finally added a autoconf system (many many thanks to Tim Blechmann) +- more character escapes for attribute editor 0.4.7: - added flext::GetBool (just because flext::GetInt has been there for a while) diff --git a/externals/grill/flext/source/flattr_ed.cpp b/externals/grill/flext/source/flattr_ed.cpp index ff922897..cbc7f08c 100644 --- a/externals/grill/flext/source/flattr_ed.cpp +++ b/externals/grill/flext/source/flattr_ed.cpp @@ -84,6 +84,7 @@ void flext_base::SetAttrEditor(t_classid c) "set a [regsub {\\$} $a \\\\$]\n" // replace $ with \$ "set a [regsub {,} $a \\\\,]\n" // replace , with \, "set a [regsub {;} $a \\\\\\;]\n" // replace ; with \; +// "set a [regsub {%} $a %%]\n" // replace % with \% "lappend tmp $a\n" "}\n" "return $tmp\n" @@ -423,6 +424,19 @@ void flext_base::SetAttrEditor(t_classid c) ); } +static size_t escapeit(char *dst,size_t maxlen,const char *src) +{ + int ret = 0; + for(char *d = dst; *src && (d-dst) < (int)maxlen; ++src) { + if(*src == '%') + *(d++) = '%',*(d++) = '%'; + else + *(d++) = *src; + } + *d = 0; + return d-dst; +} + void flext_base::cb_GfxProperties(t_gobj *c, t_glist *) { flext_base *th = thisObject(c); @@ -491,7 +505,12 @@ void flext_base::cb_GfxProperties(t_gobj *c, t_glist *) // Retrieve attribute value th->GetAttrib(sym,gattr,lv); - PrintList(lv.Count(),lv.Atoms(),b,sizeof(buf)+buf-b); b += strlen(b); + for(int i = 0; i < lv.Count(); ++i) { + char tmp[100]; + PrintAtom(lv[i],tmp,sizeof tmp); + b += escapeit(b,sizeof(buf)+buf-b,tmp); + if(i < lv.Count()-1) { *(b++) = ' '; *(b++) = 0; } + } } else { strcpy(b,"{}"); b += strlen(b); @@ -503,7 +522,12 @@ void flext_base::cb_GfxProperties(t_gobj *c, t_glist *) // if there is initialization data take this, otherwise take the current data const AtomList &lp = initdata?*initdata:lv; - PrintList(lp.Count(),lp.Atoms(),b,sizeof(buf)+buf-b); b += strlen(b); + for(int i = 0; i < lp.Count(); ++i) { + char tmp[100]; + PrintAtom(lp[i],tmp,sizeof(tmp)); + b += escapeit(b,sizeof(buf)+buf-b,tmp); + if(i < lp.Count()-1) { *(b++) = ' '; *(b++) = 0; } + } } else { strcpy(b,"{}"); b += strlen(b); |