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.84 1997/09/28 16:30:45 grubba Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.85 1997/10/02 14:08:07 peter Exp $";   constant thread_safe=1;      #include <module.h>   inherit "module";   inherit "roxenlib";      #if efun(_static_modules)   # define map_array Array.map   import Image;   # define Image image
Roxen.git/server/modules/graphics/graphic_text.pike:142:    "tag.");       defvar("location", "/gtext/", "Mountpoint", TYPE_LOCATION|VAR_MORE,    "The URL-prefix for the graphic characters.");       defvar("cols", 16, "Default number of colors per image", TYPE_INT_LIST,    "The default number of colors to use. 16 seems to be enough. "    "The size of the image depends on the number of colors",    ({ 1,2,3,4,5,6,7,8,10,16,32,64,128,256 }));    +  defvar("gif", 0, "Append .gif to all images", TYPE_FLAG|VAR_MORE, +  "Append .gif to all images made by gtext. Normally this will " +  "only waste bandwidth");      #ifdef TYPE_FONT    // compatibility variables...    defvar("default_size", 32, 0, TYPE_INT,0,0,1);    defvar("default_font", "urw_itc_avant_garde-demi-r",0,TYPE_STRING,0,0,1);   #else    defvar("default_size", 32, "Default font size", TYPE_INT_LIST,    "The default size for the font. This is used for the 'base' size, "    "and can be scaled up or down in the tags.",    ({ 16, 32, 64 }));
Roxen.git/server/modules/graphics/graphic_text.pike:809:    };    cache_set(key, text, 0);    throw(err);   }         mapping find_file(string f, object rid)   {    int id;    sscanf(f,"%d/%s", id, f); +  +  if( query("gif") ) //Remove .gif +  f = f[..strlen(f)-5]; +     if (sizeof(f)) {    object g;    if (f[0] == '$') { // Illegal in BASE64    f = f[1..];    } else if (sizeof(indices(g=Gz))) {    catch(f = g->inflate()->inflate(MIME.decode_base64(f)));    } else if (sizeof(f)) {    catch(f = MIME.decode_base64(f));    }    }
Roxen.git/server/modules/graphics/graphic_text.pike:1018:      string tag_graphicstext(string t, mapping arg, string contents,    object id, object foo, mapping defines)   {   // Allow <accessed> and others inside <gtext>.          if(arg->help)    return register_module()[2];    +  string gif=""; +  if(query("gif")) +  gif=".gif"; +    #if efun(_static_modules)    contents = parse_rxml(contents, id, foo, defines);   #else    contents = parse_rxml(contents, id, foo);   #endif       string pre, post, defalign, gt, rest, magic;    int i;    string split;       // No images here, let's generate an alternative..    if(!id->supports->images || id->prestate->noimages)    {    if(!arg->split) contents=replace(contents,"\n", "\n<br>\n"); -  if(arg->submit) return "<input type=submit name=\""+(arg->name+".x")+"\" value=\""+contents+"\">"; +  if(arg->submit) return "<input type=submit name=\""+(arg->name+".x") +  + "\" value=\""+contents+"\">";    switch(t)    {    case "gtext":    case "anfang":    if(arg->href)    return "<a href=\""+arg->href+"\">"+contents+"</a>";    return contents;    default:    if(sscanf(t, "%s%d", t, i)==2)    rest="<h"+i+">"+contents+"</h"+i+">";
Roxen.git/server/modules/graphics/graphic_text.pike:1165:    for (i = sizeof(arr)-1; i--;) {    arr[i] += split;    }    if (arr[-1] == "") {    arr = arr[..sizeof(arr)-2];    }    foreach (arr, word) {    array size = write_text(num,word,1,id);    res += ({ "<img _parsed=1 border=0 alt=\"" +    replace(arg->alt || word, "\"", "'") + -  "\" src=\"" + pre + quote(word) + "\" width=" + +  "\" src=\"" + pre + quote(word) + gif + "\" width=" +    size[0] + " height=" + size[1] + " " + ea + ">"    });    }    res += ({"\n"});    } else {    array size = write_text(num,word,1,id);    res += ({ "<img _parsed=1 border=0 alt=\"" +    replace(arg->alt || word, "\"", "'") + -  "\" src=\"" + pre + quote(word) + "\" width=" + +  "\" src=\"" + pre + quote(word) + gif + "\" width=" +    size[0] + " height=" + size[1] + " " + ea + ">\n"    });    }    }    if(lp) res += ({ "</a>"+post });    return res*"";    }       array size = write_text(num,gt,1,id);    if(!size) {
Roxen.git/server/modules/graphics/graphic_text.pike:1211:    if(arg->bevel) arg->pressed=1;       int num2 = find_or_insert(arg);    array size = write_text(num2,gt,1,id);       if(!defines->magic_java) res = magic_javascript_header(id);    defines->magic_java="yes";       return res +    magic_image(url||"", size[0], size[1], "i"+(defines->mi++), -  query_location()+num+"/"+quote(gt), -  query_location()+num2+"/"+quote(gt), +  query_location()+num+"/"+quote(gt)+gif, +  query_location()+num2+"/"+quote(gt)+gif,    (arg->alt?arg->alt:replace(gt, "\"","'")),    (magic=="magic"?0:magic),    id,input?na||"submit":0,ea);    }    if(input)    return (pre+"<input type=image name=\""+na+"\" border=0 alt=\""+    (arg->alt?arg->alt:replace(gt,"\"","'"))+ -  "\" src="+query_location()+num+"/"+quote(gt) +  "\" src="+query_location()+num+"/"+quote(gt)+gif    +" align="+(al || defalign)+ea+    " width="+size[0]+" height="+size[1]+">"+rest+post); -  return (pre+(lp?lp:"")+ -  "<img _parsed=1 border=0 alt=\""+ -  (arg->alt?arg->alt:replace(gt,"\"","'")+"\"") -  +"\" src=\""+ -  query_location()+num+"/"+quote(gt)+"\" "+ea -  +" align="+(al || defalign)+ -  " width="+size[0]+" height="+size[1]+">"+rest+(lp?"</a>":"")+post); +  +  return (pre+(lp?lp:"") +  + "<img _parsed=1 border=0 alt=\"" +  + (arg->alt?arg->alt:replace(gt,"\"","'")+"\"") +  + "\" src=\"" +  + query_location()+num+"/"+quote(gt)+gif+"\" "+ea +  + " align="+(al || defalign) +  + " width="+size[0]+" height="+size[1]+">"+rest+(lp?"</a>":"")+post);   }      inline string ns_color(array (int) col)   {    if(!arrayp(col)||sizeof(col)!=3)    return "#000000";    return sprintf("#%02x%02x%02x", col[0],col[1],col[2]);   }