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.190 1999/11/28 02:52:24 nilsson Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.191 1999/11/28 16:44:52 nilsson 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:232:    }       if(args->border)    {    xoffset += (int)args->border;    yoffset += (int)args->border;    xsize += ((int)args->border)*2;    ysize += ((int)args->border)*2;    }    -  array (int) bgcolor = parse_color(args->bg); -  array (int) fgcolor = parse_color(args->fg); +  array (int) bgcolor = parse_color(args->bgcolor); +  array (int) fgcolor = parse_color(args->fgcolor);       object background,foreground;       if(args->texture)    {    object t = roxen.load_image(args->texture,id);    if( t )    {    foreground = t;    if(args->tile)
Roxen.git/server/modules/graphics/graphic_text.pike:613:       // Fonts and such are now initialized.    img = make_text_image(args,data,text,id);       // Now we have the image in 'img', or nothing.       if( !args->scroll && !args->fadein )    {    if(!args->notrans)    { -  array (int) bgcolor = parse_color(args->bg); +  array (int) bgcolor = parse_color(args->bgcolor);    object alpha;    alpha = img->distancesq( @bgcolor );    alpha->gamma( 8 );    return ([ "img":img, "alpha":alpha ]);    }    return img;    }       if(args->fadein)    {    int amount=2, steps=10, delay=10, initialdelay=0, ox;    string res = img->gif_begin();    sscanf(args->fadein,"%d,%d,%d,%d", amount, steps, delay, initialdelay);    if(initialdelay)    { -  object foo=Image.Image(img->xsize(),img->ysize(),@parse_color(args->bg)); +  object foo=Image.Image(img->xsize(),img->ysize(),@parse_color(args->bgcolor));    res += foo->gif_add(0,0,initialdelay);    }    for(int i = 0; i<(steps-1); i++)    {    object foo=img->clone();    foo = foo->apply_matrix(make_matrix(( (int)((steps-i)*amount))));    res += foo->gif_add(0,0,delay);    }    res+= img->gif_add(0,0,delay);    res += img->gif_end();
Roxen.git/server/modules/graphics/graphic_text.pike:653:    {    int len=100, steps=30, delay=5, ox;    string res = img->gif_begin() + img->gif_netscape_loop();    sscanf(args->scroll, "%d,%d,%d", len, steps, delay);    img=img->copy(0,0,(ox=img->xsize())+len-1,img->ysize()-1);    img->paste(img, ox, 0);    for(int i = 0; i<steps; i++)    {    int xp = i*ox/steps;    res += img->copy(xp, 0, xp+len, img->ysize(), -  @parse_color(args->bg))->gif_add(0,0,delay); +  @parse_color(args->bgcolor))->gif_add(0,0,delay);    }    res += img->gif_end();    data = ({ res, ({ len, img->ysize() }) });    }       return    ([    "data":data[0],    "meta":    ([
Roxen.git/server/modules/graphics/graphic_text.pike:690:    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 );   }         // -------------- helpfunctions to gtext tags and containers -----------------    - constant filearg=({"background","texture","magic-texture","magic-background","magic-bg","alpha"}); + constant filearg=({"background","texture","alpha","magic-texture","magic-background","magic-alpha"});   constant textarg=({"afont",    "alpha",    "bevel", -  "bg", +  "bgcolor",    "black",    "bold", -  "border", +     "bshadow",    "chisel",    "crop",    "encoding",    "fadein", -  "fg", +  "fgcolor",    "fs",    "font",    "font_size",    "format",    "ghost",    "glow",    "italic",    "light",    "mirrortile",    "more",
Roxen.git/server/modules/graphics/graphic_text.pike:755:       mapping defines=id->misc->defines;    mapping p=([]); //Picture rendering arguments.       foreach(filearg, string tmp)    if(arg[tmp]) {    p[tmp]=fix_relative(arg[tmp],id);    m_delete(arg,tmp);    }    +  if(arg->border && search(arg->border,",")) { +  p->border=arg->border; +  m_delete(arg,"border"); +  } +     foreach(textarg, string tmp)    if(arg[tmp]) {    p[tmp]=arg[tmp],id;    m_delete(arg,tmp);    }    -  if(defines->fg && !p->fg) p->fg=defines->fg; -  if(defines->bg && !p->bg) p->bg=defines->bg; +  if(defines->fgcolor && !p->fgcolor) p->fgcolor=defines->fgcolor; +  if(defines->bgcolor && !p->bgcolor) p->bgcolor=defines->bgcolor;    if(defines->nfont && !p->nfont) p->nfont=defines->nfont;    if(defines->afont && !p->afont) p->afont=defines->afont;    if(defines->font && !p->font) p->font=defines->font;    if(defines->bold && !p->bold) p->bold=defines->bold;    if(defines->italic && !p->italic) p->italic=defines->italic;    if(defines->black && !p->black) p->black=defines->black;    if(defines->narrow && !p->narrow) p->narrow=defines->narrow;       return p;   }
Roxen.git/server/modules/graphics/graphic_text.pike:803:       return c;   }         // ----------------- gtext tags and containers -------------------      string tag_gtext_url(string t, mapping arg, string c, RequestID id) {    c=fix_text(c,arg,id);    mapping p=mk_gtext_arg(arg,id); -  if(arg->href && !p->fg) p->fg=id->misc->defines->link||"#0000ff"; +  if(arg->href && !p->fgcolor) p->fgcolor=id->misc->defines->link||"#0000ff";    string ext="";    if(query("ext")) ext="."+(p->format || "gif");    if(!arg->short)    return query_internal_location()+image_cache->store( ({p,c}), id )+ext;    else    return "+"+image_cache->store( ({p,c}), id )+ext;   }      string tag_gtext_id(string t, mapping arg, RequestID id) {    mapping p=mk_gtext_arg(arg,id); -  if(arg->href && !p->fg) p->fg=id->misc->defines->link||"#0000ff"; +  if(arg->href && !p->fgcolor) p->fgcolor=id->misc->defines->link||"#0000ff";    if(!arg->short)    return query_internal_location()+"$"+image_cache->store(p, id)+"/";    else    return "+"+image_cache->store(p, id )+"/";   }      string tag_graphicstext(string t, mapping arg, string c, RequestID id)   {    mapping defines=id->misc->defines;    if((c-" ")=="")
Roxen.git/server/modules/graphics/graphic_text.pike:848:    input=1;    m_delete(arg,"submit");    }       if(!arg->noxml) { arg["/"]="/"; m_delete(arg, "noxml"); }    if(!arg->border) arg->border=arg->border||"0";       if(arg->href)    {    url = arg->href; -  lp = make_container("a",arg,"%s"); //This anchor might have some extra args. -  if(!p->fg) p->fg=defines->link||"#0000ff"; +  lp = replace(make_tag("a",arg),"%","%%")+"%s</a>"; +  if(!p->fgcolor) p->fgcolor=defines->link||"#0000ff";    m_delete(arg, "href");    }       if(arg->split)    {    string res="",split=arg->split;    if(lower_case(split)=="split") split=" ";    m_delete(arg,"split");    c=replace(c, "\n", " ");    int setalt=!arg->alt;
Roxen.git/server/modules/graphics/graphic_text.pike:891:    if(size) {    arg->width=size->xsize;    arg->height=size->ysize;    }       if(arg->magic)    {    string magic=replace(arg->magic,"'","`");    m_delete(arg,"magic");    -  if(!arg->fg) p->fg=defines->alink||"#ff0000"; +  if(!arg->fgcolor) p->fgcolor=defines->alink||"#ff0000";    if(p->bevel) p->pressed=1;    -  if(arg->fuzz) p->glow = arg->fuzz!="fuzz"?arg->fuzz:p->fg; -  if(arg["magic-bg"]) p->background = p["magic-bg"]; -  m_delete(p,"fuzz"); -  m_delete(p,"magic-bg"); -  +     foreach(glob("magic-*", indices(arg)), string q)    {    p[q[6..]]=arg[q];    m_delete(arg, q);    }       string num2 = image_cache->store( ({ p, c }),id );    size = image_cache->metadata( num2, id );    if(size) {    arg->width=MAX(arg->xsize,size->xsize);
Roxen.git/server/modules/graphics/graphic_text.pike:990:   {    int cols,changed;    if(args->bgcolor||args->text||args->link||args->alink    ||args->background||args->vlink)    cols=1;      #define FIX(Y,Z,X) do{if(!args->Y || args->Y==""){if(cols){defines->X=Z;args->Y=Z;changed=1;}}else{defines->X=args->Y;if(QUERY(colormode)&&args->Y[0]!='#'){args->Y=ns_color(parse_color(args->Y));changed=1;}}}while(0)       if(!search((id->client||({}))*"","Mosaic"))    { -  FIX(bgcolor,"#bfbfbf",bg); -  FIX(text, "#000000",fg); +  FIX(bgcolor,"#bfbfbf",bgcolor); +  FIX(text, "#000000",fgcolor);    FIX(link, "#0000b0",link);    FIX(alink, "#3f0f7b",alink);    FIX(vlink, "#ff0000",vlink);    } else { -  FIX(bgcolor,"#c0c0c0",bg); -  FIX(text, "#000000",fg); +  FIX(bgcolor,"#c0c0c0",bgcolor); +  FIX(text, "#000000",fgcolor);    FIX(link, "#0000ee",link);    FIX(alink, "#ff0000",alink);    FIX(vlink, "#551a8b",vlink);    }    if(changed && QUERY(colormode))    return ({make_tag("body", args) });   }      string|array(string) tag_fix_color(string tagname, mapping args, RequestID id,    object file, mapping defines)   {    int changed;       if(!id->misc->colors) -  id->misc->colors = ({ ({ defines->fg, defines->bg, tagname }) }); +  id->misc->colors = ({ ({ defines->fgcolor, defines->bgcolor, tagname }) });    else -  id->misc->colors += ({ ({ defines->fg, defines->bg, tagname }) }); +  id->misc->colors += ({ ({ defines->fgcolor, defines->bgcolor, tagname }) });   #undef FIX   #define FIX(X,Y) if(args->X && args->X!=""){defines->Y=args->X;if(QUERY(colormode) && args->X[0]!='#'){args->X=ns_color(parse_color(args->X));changed = 1;}}    -  FIX(bgcolor,bg); -  FIX(text,fg); -  FIX(color,fg); +  FIX(bgcolor,bgcolor); +  FIX(color,fgcolor); +  FIX(text,fgcolor);   #undef FIX       if(changed && QUERY(colormode))    return ({ make_tag(tagname, args) });    return 0;   }      string|void pop_color(string tagname,mapping args,RequestID id,object file,    mapping defines)   {    array c = id->misc->colors;    if(!c ||!sizeof(c))    return;       int i;    tagname = tagname[1..];       for(i=0;i<sizeof(c);i++)    if(c[-i-1][2]==tagname)    { -  defines->fg = c[-i-1][0]; -  defines->bg = c[-i-1][1]; +  defines->fgcolor = c[-i-1][0]; +  defines->bgcolor = c[-i-1][1];    break;    }    c = c[..sizeof(c)-i-2];    id->misc->colors = c;   }         // --------------- tag and container registration ----------------------      mapping query_tag_callers()