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

version» Context lines:

Roxen.git/server/modules/graphics/gbutton.pike:18:   // icon_src -- icon reference   // icon_data -- inline icon data   // align -- left|center|right text alignment   // align_icon -- left|center_before|center_after|right icon alignment   // >Button text</gbutton>   //   // Alignment restriction: when text alignment is either left or right, icons   // must also be aligned left or right.       - constant cvs_version = "$Id: gbutton.pike,v 1.13 2000/02/03 17:19:01 wellhard Exp $"; + constant cvs_version = "$Id: gbutton.pike,v 1.14 2000/02/03 18:18:57 per Exp $";   constant thread_safe = 1;      #include <module.h>   inherit "module";   inherit "roxenlib";         roxen.ImageCache button_cache;   Image.Image button_border;   Image.Image button_mask;
Roxen.git/server/modules/graphics/gbutton.pike:113:         object(Image.Image)|mapping draw_button(mapping args, string text, object id)   {    Image.Image text_img, b, tmp, button;    int req_width, b_width, b_height, t_width, i_width, icn_x, txt_x;    mapping icon;    object button_font = resolve_font( args->font );       // Load images -  if (!button_border) { +  if (!button_border) +  {    button_border = roxen.load_image("roxen-images/gbutton_border.gif", id);    button_mask = roxen.load_image("roxen-images/gbutton_mask.gif", id);    }       // Colorize borders    if (!args->dim) -  +  {    b = button_border->clone()->grey()->    modify_by_intensity(1, 1, 1, args->bo, args->bob ); -  +  }    else    { -  array dim_bg = ({ 255, 255, 255 }); -  array dim_bo = ({ 0, 0, 0 }); -  for (int i = 0; i < 3; i++) { -  dim_bo[i] = (args->bo[i] + args->bg[i]) / 2; -  dim_bg[i] = (args->bg[i] + dim_bg[i]) / 2; -  } +  array dim_bg; +  array dim_bo;    -  b = button_border->clone()->grey()-> +  array hsv = Image.Color( @args->bg )->hsv( ); +  hsv[-1] = min( hsv[-1]+70, 255 ); +  +  dim_bg = (array)Image.Color.hsv( @hsv ); +  +  hsv[-1] = max( hsv[-1]-140, 0 ); +  dim_bo = (array)Image.Color.hsv( @hsv ); +  +  b = button_border->grey()->    modify_by_intensity(1, 1, 1, dim_bo, dim_bg);    }    b_width = b->xsize();    b_height = b->ysize();       // Get icon    if (args->icn)    icon = roxen.low_load_image(args->icn, id);    else if (args->icd)    icon = roxen.low_decode_image(args->icd);
Roxen.git/server/modules/graphics/gbutton.pike:278:    "wi" : (int) args->width, // Min button width    "al" : args->align || "left", // Text alignment    "dim" : args->dim || // Button dimming    (< "dim", "disabled" >)[lower_case(args->state || "")],    "icn" : args->icon_src && fix_relative(args->icon_src, id), // Icon URL    "icd" : args->icon_data, // Inline icon data    "ica" : args->align_icon || "left", // Icon alignment    "font": (args->font||roxen->query("default_font")),    ]);    +  array hsv = Image.Color( @new_args->bg )->hsv( ); +  hsv[-1] = min( hsv[-1]+70, 255 ); +  hsv[1] = max( hsv[1]-20, 0 ); +  new_args->bob = (array)Image.Color.hsv( @hsv ); +  hsv[-1] = max( hsv[-1]-140, 0 ); +  new_args->bo = (array)Image.Color.hsv( @hsv ); +     if(args->bordercolor)    new_args->bo=parse_color(args->bordercolor); // Border color -  else -  new_args->bo=Array.map(new_args->bg, lambda(int c){ return c/5; }); +        if(args->borderbottom)    new_args->bob=parse_color(args->borderbottom); -  else -  new_args->bob=Array.map(new_args->bg, lambda(int c){ c=c*2+64; return c>255?255:c; }); +        new_args->quant = args->quant || 128;    foreach(glob("*-*", indices(args)), string n)    new_args[n] = args[n];       string img_src =    query_internal_location() +    button_cache->store( ({ new_args, contents }), id);       if( tag == "gbutton-url" )