#!perl -w ## ------------------------------------------------------------ # MS Windoze-specific script. Sorry :-). ## ------------------------------------------------------------ # NOT like t0mas' original idea -- this makes buttons for # horizontal row use only bec if button text is longer # than 20 chars, it expands the length by 8 px for each one # (based on 8pt Myriad font). use ButtonFactory; use Win32::Clipboard; my ( $N_state $P_state @RGBt $BWi ); my $clipping; my $name_it = shift @ARGV; my $btnText = shift @ARGV; my $expsn = ((length ($btnText) - 20) > 0)? (length ($btnText) - 20) * 8 : 0 ; $BWi = 90 + $expsn; @RGBt = ($clipping=Win32::Clipboard::Get()) # Pick-'o-Color format for rgb triplet: "RGB(155, 50, 23)" ? grep /\d+/, (split /[^\d]/,$clipping) : split(/[^\w]/, shift @ARGV); if (scalar @RGBt == 3) { print "Using ", join( ', ',@RGBt ), " for color specification for buttons\n"; } else { die "No color as RGB triplet gotten! \nContents of \@RGBt if any: " ." $clipping ". "@RGBt"; } my $x=new ButtonFactory($BWi,21, $RGBt[0],$RGBt[1],$RGBt[2], $btnText =>"Myriad Web Bold.ttf"=>8); $N_state = $name_it .'N_state.png'; $P_state = $name_it .'P_state.png'; open (FILE,">$N_state") or die $!; binmode FILE; my $Ntime = time; print FILE $x->printNormal(); close (FILE); open (FILE,">$P_state") or die $!; binmode FILE; print FILE $x->printPressed(); close (FILE); utime $Ntime, $Ntime, ($N_state, $P_state); _END_