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.182 1999/06/25 17:56:05 per Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.183 1999/07/10 21:42:58 peter 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:45:    " dramatically. You can try this out with the &lt;gauge&gt; tag.",    0, lambda(){return !query("colorparse");});       defvar("deflen", 300, "Default maximum text-length", TYPE_INT|VAR_MORE,    "The module will, per default, not try to render texts "    "longer than this. This is a safeguard for things like "    "&lt;gh1&gt;&lt;/gh&gt;, which would otherwise parse the"    " whole document. This can be overrided with maxlen=... in the "    "tag.");    -  defvar("gif", 0, "Append .fmt (gif, jpeg etc) to all images", TYPE_FLAG|VAR_MORE, +  defvar("gif", 0, "Append .fmt (gif, jpeg etc) to all images", +  TYPE_FLAG|VAR_MORE,    "Append .gif, .png, .gif etc to all images made by gtext. "    "Normally this will only waste bandwidth");   }      static private mapping cached_args = ([ ]);      #define MAX(a,b) ((a)<(b)?(b):(a))      static private mapping (int:array(array(int))) matrixes = ([]);   array (array(int)) make_matrix(int size)
Roxen.git/server/modules/graphics/graphic_text.pike:565:    array err;    mixed data;    int elapsed;    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); +  " good.\n");    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)
Roxen.git/server/modules/graphics/graphic_text.pike:697:    "type":"image/gif",    ])    ]);   }         mapping find_internal(string f, object rid)   {    if( strlen(f)>4 && query("gif") && f[-4]=='.') // Remove .ext    f = f[..strlen(f)-5]; +  if( strlen(f) && f[0..0]=="$" ) +  { +  array id_text = f/"/"; +  if( sizeof(id_text)==2 ) +  { // It's a gtext-id +  string second_key = roxen.argcache.store( (["":id_text[1]]) ); +  return image_cache->http_file_answer( id_text[0][1..] +"$"+ second_key, rid ); +  } +  }    return image_cache->http_file_answer( f, rid );   }      string magic_javascript_header(object id)   {    if(!id->supports->netscape_javascript || !id->supports->images) return "";    return    ("\n<script>\n"    "function i(ri,hi,txt)\n"    "{\n"
Roxen.git/server/modules/graphics/graphic_text.pike:761:    case "class":    case "id":    s+=i+"='"+in[i]+"' ";    m_delete(in, i);    break;    }    }    return s;   }    - string tag_gtext_id(string t, mapping arg, string ctn, + string tag_gtext_url(string t, mapping arg, string ctn,    object id, object foo, mapping defines)   {    int short=!!arg->short;    if(arg->help) return "Arguments are identical to the argumets to &lt;gtext&gt;. This tag returns a url-prefix that can be used to generate gtexts.";    m_delete(arg, "short"); m_delete(arg, "maxlen");    m_delete(arg,"magic"); m_delete(arg,"submit");    extra_args(arg); m_delete(arg,"split");    if(defines->fg && !arg->fg) arg->fg=defines->fg;    if(defines->bg && !arg->bg) arg->bg=defines->bg;    if(defines->nfont && !arg->nfont) arg->nfont=defines->nfont;
Roxen.git/server/modules/graphics/graphic_text.pike:788:    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,ctn}), id )+ +  return query_internal_location()+image_cache->store( arg, id )+    (query("gif")?".foo":"");    else -  return image_cache->store( ({arg,ctn}), id )+(query("gif")?".foo":""); +  return image_cache->store( arg, id )+(query("gif")?".foo":"");   }    -  + string tag_gtext_id(string t, mapping arg, object id, object foo, +  mapping defines) + { +  int short=!!arg->short; +  if(arg->help) return "Arguments are identical to the argumets to &lt;gtext&gt;. This tag returns a url-prefix that can be used to generate gtexts."; +  m_delete(arg, "short"); m_delete(arg, "maxlen"); +  m_delete(arg,"magic"); m_delete(arg,"submit"); +  extra_args(arg); m_delete(arg,"split"); +  if(defines->fg && !arg->fg) arg->fg=defines->fg; +  if(defines->bg && !arg->bg) arg->bg=defines->bg; +  if(defines->nfont && !arg->nfont) arg->nfont=defines->nfont; +  if(defines->afont && !arg->afont) arg->afont=defines->afont; +  if(defines->font && !arg->font) arg->font=defines->font; +  +  if(arg->background) +  arg->background = fix_relative(arg->background,id); +  if(arg->texture) +  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 )+"/"; +  else +  return "+"+image_cache->store( arg, id )+"/"; + } +    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)    {    sscanf(contents,"%*[ \n\r\t]%s",contents);    sscanf(reverse(contents),"%*[ \n\r\t]%s",contents);
Roxen.git/server/modules/graphics/graphic_text.pike:1088:    defines->fg = c[-i-1][0];    defines->bg = c[-i-1][1];    break;    }    c = c[..sizeof(c)-i-2];    id->misc->colors = c;   }      mapping query_tag_callers()   { -  mapping tags = ([ ]); +  mapping tags = ([ "gtext-id":tag_gtext_id ]);    if(query("colorparse"))    foreach(query("colorparsing"), string t)    {    switch(t)    {    case "body":    tags[t] = tag_body;    break;    default:    tags[t] = tag_fix_color;    tags["/"+t]=pop_color;    }    }    return tags;   }         mapping query_container_callers()   {    return ([ "anfang":tag_graphicstext, -  "gtext-id":tag_gtext_id, "gh":tag_graphicstext, +  "gtext-url":tag_gtext_url, "gh":tag_graphicstext,    "gh1":tag_graphicstext, "gh2":tag_graphicstext,    "gh3":tag_graphicstext, "gh4":tag_graphicstext,    "gh5":tag_graphicstext, "gh6":tag_graphicstext,    "gtext":tag_graphicstext, ]);   }