Branch: Tag:

2004-03-08

2004-03-08 09:18:05 by 0

Implemented a mini version of /internal-roxen-colorbar in order to prevent
browser-based image scaling which hides the selection marker.

Rev: server/base_server/configuration.pike:1.549
Rev: server/base_server/wizard.pike:1.148
Rev: server/modules/tags/javascript_support/scripts/ColorSelector.js:1.2

5:   // @appears Configuration   //! A site's main configuration    - constant cvs_version = "$Id: configuration.pike,v 1.548 2004/03/06 22:38:23 jonasw Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.549 2004/03/08 09:18:05 jonasw Exp $";   #include <module.h>   #include <module_constants.h>   #include <roxen.h>
1135:   }      // Returns tuple < image, mime-type > - static array(string) draw_saturation_bar(int hue,int brightness, int where) + static array(string) draw_saturation_bar(int hue,int brightness, int where, +  int small_version)   { -  Image.Image bar=Image.Image(30,256); +  Image.Image bar = +  small_version ? Image.Image(16, 128) : Image.Image(30, 256);       for(int i=0;i<128;i++)    {    int j = i * 2;    array color = hsv_to_rgb(hue, 255 - j, brightness); -  +  if (small_version) { +  bar->line(0, i, 15, i, @color); +  } else {    bar->line(0, j, 29, j, @color);    bar->line(0, j + 1,29, j + 1, @color);    } -  +  }    -  where = 255-where; +  where = 255 - where;    int hilite = (brightness > 128) ? 0 : 255; -  +  if (small_version) +  bar->line(0, where / 2, 15, where / 2, hilite, hilite, hilite); +  else    bar->line(0, where, 29, where, hilite, hilite, hilite);      #if constant(Image.JPEG) && constant(Image.JPEG.encode)
1170:       // Automatically generated colorbar. Used by wizard code...    int hue,bright,w; -  if(sscanf(from, "%*s:%d,%d,%d", hue, bright,w)==4) { -  array bar = draw_saturation_bar(hue, bright, w); +  string colorbar; +  if(sscanf(from, "%s:%d,%d,%d", colorbar, hue, bright,w)==4) { +  array bar = draw_saturation_bar(hue, bright, w, +  colorbar == "colorbar-small");    return Roxen.http_string_answer(bar[0], bar[1]);    }