Roxen.git / server / modules / graphics / graphic_text.pike

version» Context lines:

Roxen.git/server/modules/graphics/graphic_text.pike:1: - constant cvs_version="$Id: graphic_text.pike,v 1.181 1999/06/10 14:39:54 jonasw Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.182 1999/06/25 17:56:05 per Exp $";   constant thread_safe=1;      #include <config.h>   #include <module.h>   #include <stat.h>   inherit "module";   inherit "roxenlib";      #ifndef VAR_MORE   #define VAR_MORE 0
Roxen.git/server/modules/graphics/graphic_text.pike:553:    image_cache = roxen.ImageCache( "gtext", draw_callback );   }      constant nbsp = iso88591["&nbsp;"];   constant replace_from = indices( iso88591 )+ ({"&ss;","&lt;","&gt;","&amp;",});   constant replace_to = values( iso88591 ) + ({ nbsp, "<", ">", "&", });      #define simplify_text( from ) replace(from,replace_from,replace_to)       - mixed draw_callback(mapping args, object id) + mixed draw_callback(mapping args, string text, object id)   {    array err;    mixed data;    int elapsed; -  string text = args->text; +     string orig_text = text;    object img;    -  +  if( objectp( text ) ) +  { +  if( !args->text ) +  error("Failed miserably to find a text to draw. That's not" +  " good.\nArgs=%O\n",args); +  id = (object)text; +  text = args->text; +  } +     if(!args->verbatim) // typographically correct...    {    text = replace(text, nbsp, " ");    text = simplify_text( text );    string res="",nspace="",cspace="";    foreach(text/"\n", string line)    {    cspace="";nspace="";    foreach(line/" ", string word)    {
Roxen.git/server/modules/graphics/graphic_text.pike:780:    arg->texture = fix_relative(arg->texture,id);    if(arg->magic_texture)    arg->magic_texture=fix_relative(arg->magic_texture,id);    if(arg->magic_background)    arg->magic_background=fix_relative(arg->magic_background,id);    if(arg->magicbg)    arg->magicbg = fix_relative(arg->magicbg,id);    if(arg->alpha)    arg->alpha = fix_relative(arg->alpha,id);    -  arg->text = ctn; -  +     if(!short) -  return query_internal_location()+image_cache->store( arg, id )+ +  return query_internal_location()+image_cache->store( ({arg,ctn}), id )+    (query("gif")?".foo":"");    else -  return image_cache->store( arg, id )+(query("gif")?".foo":""); +  return image_cache->store( ({arg,ctn}), id )+(query("gif")?".foo":"");   }      string tag_graphicstext(string t, mapping arg, string contents,    object id, object foo, mapping defines)   {    if((contents-" ")=="")    return "";   //Allow <accessed> and others inside <gtext>.    if(arg->nowhitespace)    {
Roxen.git/server/modules/graphics/graphic_text.pike:820:    arg->magic_background=fix_relative(arg->magic_background,id);    if(arg->magicbg)    arg->magicbg = fix_relative(arg->magicbg,id);    if(arg->alpha)    arg->alpha = fix_relative(arg->alpha,id);          string gif="";    if(query("gif")) gif="."+(arg->format?arg->format[..2]:"gif");    - #if efun(_static_modules) -  contents = parse_rxml(contents, id, foo, defines); - #else -  contents = parse_rxml(contents, id, foo); - #endif +  if( !arg->noparse && !arg->preparse ) +  contents = parse_rxml(contents, id); +  else +  { +  m_delete( arg, "noparse" ); +  m_delete( arg, "preparse" ); +  }       string lp, url, ea;    string pre, post, defalign, gt, rest, magic;    int i;    string split;       contents = contents[..(((int)arg->maxlen||QUERY(deflen))-1)];    m_delete(arg, "maxlen");       if(arg->magic)
Roxen.git/server/modules/graphics/graphic_text.pike:920:    if(split)    {    string word;    array res = ({ pre });    if(lp) res+=({ lp });       gt=replace(gt, "\n", " ");       foreach(gt/split-({""}), word)    { -  arg->text = word; -  string fn = image_cache->store( arg ); +  string fn = image_cache->store( ({arg,word}),id );    mapping size = image_cache->metadata( fn, id, 1 );    mapping tag =    ([    "alt":(arg->alt||word),    "src":query_internal_location()+fn+gif,    ]);    if( size )    {    tag->width = (string)size->xsize;    tag->height = (string)size->ysize;    }    res += ({ make_tag( "img", tag )+" " });    }    if(lp) res += ({ "</a>"+post });    return res*"";    }    -  arg->text = gt; -  string num = image_cache->store( arg ); -  mapping size = image_cache->metadata( arg, id, 1 ); +  string num = image_cache->store( ({arg,gt}),id ); +  mapping size = image_cache->metadata( num, id, 1 );       if(magic)    {    string res = "";    if(!arg->fg) arg->fg=defines->link||"#0000ff";    arg = mkmapping(indices(arg), values(arg));    if(arg->fuzz)    if(arg->fuzz != "fuzz")    arg->glow = arg->fuzz;    else
Roxen.git/server/modules/graphics/graphic_text.pike:963:    arg->fg = defines->alink||"#ff0000";    if(arg->magicbg) arg->background = arg->magicbg;    if(arg->bevel) arg->pressed=1;       foreach(glob("magic_*", indices(arg)), string q)    {    arg[q[6..]]=arg[q];    m_delete(arg, q);    }    -  string num2 = image_cache->store( arg ); -  size = image_cache->metadata( arg, id ); +  string num2 = image_cache->store( ({ arg, gt }),id ); +  size = image_cache->metadata( num2, id );       if(!defines->magic_java)    res = magic_javascript_header(id);    defines->magic_java="yes";    if(!size) size = ([ ]);    return replace(res +    magic_image(url||"", size->xsize, size->ysize, "i"+(defines->mi++),    query_internal_location()+num+gif,    query_internal_location()+num2+gif,    (arg->alt?arg->alt:replace(gt, "\"","'")),