cvsuser     02/06/07 15:47:34

  Modified:    P5EEx/Blue/cgi-bin button.PL
  Log:
  messed around with bgcolor
  
  Revision  Changes    Path
  1.2       +47 -7     p5ee/P5EEx/Blue/cgi-bin/button.PL
  
  Index: button.PL
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/cgi-bin/button.PL,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- button.PL 8 Feb 2002 20:51:54 -0000       1.1
  +++ button.PL 7 Jun 2002 22:47:34 -0000       1.2
  @@ -121,11 +121,6 @@
       $color;
   }
   
  -$bgcolor = $cgi->param("bgcolor");
  -if (defined $bgcolor && $bgcolor ne "" && defined $color{$bgcolor}) {
  -    $im->transparent($color{$transparent});
  -}
  -
   #########################################################
   # COLORMAP INITIALIZATION
   #########################################################
  @@ -138,6 +133,10 @@
       }
   }
   
  +$bgcolor = $cgi->param("bgcolor");
  +$bgcolor = "#cccccc" if (!$bgcolor);
  +&color($bgcolor);   # make sure the bgcolor is in the color map
  +
   #########################################################
   # SET OPTIONAL ATTRIBUTES
   #########################################################
  @@ -186,7 +185,48 @@
   );
   
   if ($mode eq "button") {
  -    $im->fill(0,0,&color("#cccccc"));
  +    $im->fill(0,0,&color($bgcolor));
  +
  +    $im->line(0       ,0        ,$width-1,0        ,&color("#ffffff"));  # top
  +    $im->line(0       ,0        ,0       ,$height-1,&color("#ffffff"));  # left
  +    $im->line(0       ,$height-1,$width-1,$height-1,&color("#888888"));  # bottom
  +    $im->line($width-1,0        ,$width-1,$height-1,&color("#888888"));  # right
  +
  +    if ($bevel > 1) {
  +        $im->line(1       ,1        ,$width-2,1        ,&color("#dddddd"));  # top
  +        $im->line(1       ,1        ,1       ,$height-2,&color("#dddddd"));  # left
  +        $im->line(1       ,$height-2,$width-2,$height-2,&color("#aaaaaa"));  # 
bottom
  +        $im->line($width-2,1        ,$width-2,$height-2,&color("#aaaaaa"));  # right
  +    }
  +
  +    if (defined $fontname && $fontname ne "" && $fontname ne "builtin") {
  +        $fontfile = lc($fontname);
  +        $fontfile .= ".ttf" if ($fontfile !~ /\.ttf$/);
  +        $fontfile = "/usr/local/fonts/$fontfile";
  +        @bounds = GD::Image->stringTTF(0,$fontfile,$fontsize,0,1,1,$text);
  +        if ($#bounds == 7) {
  +            $stringheight = $bounds[5] - $bounds[3];
  +            $stringwidth = $bounds[2] - $bounds[0];
  +            $x = int(($width - $stringwidth)/2);
  +            $y = int(($height - $stringheight)/2);
  +            $im->stringTTF(&color($fontcolor),$fontfile,$fontsize,0,$x,$y,$text);
  +        }
  +        else {
  +            $im->string(gdSmallFont,5,5,$@ . ": $fontfile",&color($fontcolor));
  +        }
  +    }
  +    else {
  +        $fontsize = $#builtin_font if ($fontsize > $#builtin_font);
  +        $font = $builtin_font[$fontsize];
  +        $fontheight = $font->height;
  +        $fontwidth = $font->width;
  +        $x = int(($width - $fontwidth*length($text))/2);
  +        $y = int(($height - $fontheight + 1)/2);
  +        $im->string($font,$x,$y,$text,&color($fontcolor));
  +    }
  +}
  +elsif ($mode eq "tab2") {
  +    $im->fill(0,0,&color($bgcolor));
   
       $im->line(0       ,0        ,$width-1,0        ,&color("#ffffff"));  # top
       $im->line(0       ,0        ,0       ,$height-1,&color("#ffffff"));  # left
  @@ -227,7 +267,7 @@
       }
   }
   elsif ($mode eq "tab") {
  -    $im->fill(0,0,&color("#cccccc"));
  +    $im->fill(0,0,&color($bgcolor));
       my $selected = $cgi->param("selected");
       my $corner = $cgi->param("corner");
       $corner = 6 if (!defined $corner);
  
  
  


Reply via email to