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.104 1998/02/20 11:16:39 per Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.105 1998/02/22 18:19:05 per Exp $";   constant thread_safe=1;      #include <module.h>   #include <stat.h>   inherit "module";   inherit "roxenlib";      #ifndef VAR_MORE   #define VAR_MORE 0   #endif /* VAR_MORE */
Roxen.git/server/modules/graphics/graphic_text.pike:1132:    // This is a very unlikely event...    restore_cached_args();    if(cached_args[num]) return cached_args[num];    return 0;   }            int find_or_insert(mapping find)   { +  mapping f2 = copy_value(find); +  foreach(glob("magic_*", indices(f2)), string q) m_delete(f2,q);    if(!args_restored) restore_cached_args();    array a = indices(cached_args);    array b = values(cached_args);    int i; -  +     for(i=0; i<sizeof(a); i++) -  if(equal(find, b[i])) { +  if(equal(f2, b[i]))    return a[i]; -  } +     cached_args[number]=find;    remove_call_out(save_cached_args);    call_out(save_cached_args, 10);    return number++;   }         string magic_javascript_header(object id)   {    if(!id->supports->netscape_javascript || !id->supports->images) return "";
Roxen.git/server/modules/graphics/graphic_text.pike:1232:    ;       int num = find_or_insert( arg );       if(!short)    return query_location()+num+"/";    else    return (string)num;   }    - string internal_tag_on(string t, mapping args, mapping arglist, -  object id, mapping defines) - { -  mapping arg = ([]); -  if(arglist->text) arg->text = arglist->text; -  if(args->delay) -  { -  args->type = "delay"; -  } else if(args->mouseover) { -  args->type = "mouseover"; -  m_delete(args, "mouseover"); -  } else if(arg->mouseout) { -  arg->type = "mouseover"; -  m_delete(args, "mouseout"); -  } -  arg |= args; -  -  for(int i=2; i<10; i++) -  if(arg[(string)i]) -  { -  arg->scale = 1.0 / ((float)i*0.6); -  m_delete(arg, (string)i); -  break; -  } -  -  arglist->list += ({ arg }); -  return ""; - } -  - string internal_tag_text(string t, mapping arg, string contents, -  mapping arglist, object id, mapping defines) - { -  arglist->text = contents; -  return ""; - } -  +    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];       if(arg->background)    arg->background = fix_relative(arg->background,id);    if(arg->texture)
Roxen.git/server/modules/graphics/graphic_text.pike:1300:    contents = parse_rxml(contents, id, foo, defines);   #else    contents = parse_rxml(contents, id, foo);   #endif       string lp, url, ea;    string pre, post, defalign, gt, rest, magic;    int i;    string split;    - // if(arg->alternatives) - // { - // mapping arg_list = (["list":({})]); - // parse_html(contents,(["on":internal_tag_on]), - // (["text":internal_tag_text, ]), arg_list, id, defines); -  - // string js = "", href=""; - // mapping img_tag_args = ([]); - // array(int) nums = ({}); - // foreach(arg_list->list, mapping q) - // { - // mapping w = copy_value(q); - // m_delete(w, "text"); m_delete(w, "type"); m_delete(w, "delay"); - // m_delete(w, "href"); m_delete(w, "name"); m_delete(w, "align"); - // nums += ({ find_or_insert( w ) }); - // if(q->align) img_tag_args->align = q->align; - // if(q->name) img_tag_args->name = q->name; - // if(q->href) href = make_tag("a", (["href":q->href, "name":q->name])); - // } - // } -  +     // 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+"\">";    switch(t)    {    case "gtext":    case "anfang":
Roxen.git/server/modules/graphics/graphic_text.pike:1376:    if(arg->href)    {    url = arg->href;    lp = "<a href=\""+arg->href+"\" "+ea+">";    if(!arg->fg) arg->fg=defines->link||"#0000ff";    m_delete(arg, "href");    }       if(defines->fg && !arg->fg) arg->fg=defines->fg;    if(defines->bg && !arg->bg) arg->bg=defines->bg; - #if efun(get_font) +     if(!arg->nfont) arg->nfont=defines->nfont; - #endif -  if(!arg->font) arg->font=defines->font - #if !efun(get_font) -  ||QUERY(default_font) - #endif -  ; +  if(!arg->font) arg->font=defines->font;    if(!arg->bold) arg->bold=defines->bold;    if(!arg->italic) arg->italic=defines->italic;    if(!arg->black) arg->black=defines->black;    if(!arg->narrow) arg->narrow=defines->narrow;       if(arg->split)    { -  if (sizeof(split=arg->split) != 1) { +  if (sizeof(split=arg->split) != 1)    split = " "; -  } +     m_delete(arg,"split");    }       // Support for <gh 2> like things.    for(i=2; i<10; i++)    if(arg[(string)i])    {    arg->scale = 1.0 / ((float)i*0.6);    m_delete(arg, (string)i);    break;
Roxen.git/server/modules/graphics/graphic_text.pike:1448:       if(lp) res+=({ lp });       gt=replace(gt, "\n", " ");       foreach(gt/" "-({""}), word)    {    if (split != " ") {    array arr = word/split;    int i; -  for (i = sizeof(arr)-1; i--;) { +  for (i = sizeof(arr)-1; i--;)    arr[i] += split; -  } -  if (arr[-1] == "") { +  if (arr[-1] == "")    arr = arr[..sizeof(arr)-2]; -  } +     foreach (arr, word) {    array size = write_text(num,word,1,id);    res += ({ "<img border=0 alt=\"" +    replace(arg->alt || word, "\"", "'") +    "\" src=\"" + pre + quote(word) + gif + "\" width=" +    size[0] + " height=" + size[1] + " " + ea + ">"    });    }    res += ({"\n"});    } else {
Roxen.git/server/modules/graphics/graphic_text.pike:1477:    "\" 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) { +  if(!size)    return ("<font size=+1><b>Missing font or other similar error -- "    "failed to render text</b></font>"); -  } +     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    arg->glow = arg->fg; -  } +     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);    }