see plug-ins/perl/Changes

This commit is contained in:
Marc Lehmann 1999-03-01 14:03:08 +00:00
parent 79d720bd6c
commit ad6a04b54b
4 changed files with 29 additions and 18 deletions

View File

@ -12,6 +12,7 @@ Revision history for Gimp-Perl extension.
- the path to the server-socket now includes the UID, to avoid
collisions. CGI-scripts should use either tcp or specify the path
directly using GIMP_HOST (see Gimp::Net for details).
- use _much_ saner defaults for the Scale types in Gimp::Fu.
1.055 Mon Feb 22 22:38:44 CET 1999
- applied seth's script changes.

View File

@ -128,23 +128,29 @@ sub import {
# the old value of the trace flag
my $old_trace;
sub _default {
my $d = shift;
my @a = @_;
if (ref $d) {
@a[0..$#$d] = @{$d};
} elsif (defined $d) {
$a[0] = $d;
}
@a;
}
sub wrap_text {
my $x=$_[0];
$x=~s/(\G.{$_[1]}\S*)\s+/$1\n/g;
$x;
}
sub _new_adjustment {
my @adj = eval { @{$_[1]} };
$adj[2]||=($adj[1]-$adj[0])*0.01;
$adj[3]||=($adj[1]-$adj[0])*0.01;
$adj[4]||=0;
new Gtk::Adjustment $_[0],@adj;
}
# find a suitable value for the "digits" value
sub _find_digits {
my $adj = shift;
my $digits = log($adj->step_increment || 1)/log(0.1);
$digits>0 ? int $digits+0.9 : 0;
}
sub interact($$$@) {
local $^W=0;
my($blurb)=shift;
@ -241,15 +247,17 @@ sub interact($$$@) {
$a->signal_connect("clicked", sub { show $fs });
} elsif($type == PF_SPINNER) {
my $adj = new Gtk::Adjustment $value,_default($extra,0,99,1,5,5);
my $adj = _new_adjustment ($value,$extra);
$a=new Gtk::SpinButton $adj,1,0;
$a->set_digits (_find_digits $adj);
$a->set_usize (120,0);
push(@setvals,sub{$adj->set_value($_[0])});
push(@getvals,sub{$adj->get_value});
} elsif($type == PF_SLIDER) {
my $adj = new Gtk::Adjustment $value,_default($extra,0,99,1,1,5);
my $adj = _new_adjustment ($value,$extra);
$a=new Gtk::HScale $adj;
$a->set_digits (_find_digits $adj);
$a->set_usize (120,0);
push(@setvals,sub{$adj->set_value($_[0])});
push(@getvals,sub{$adj->get_value});

View File

@ -12,6 +12,8 @@
# too many parens
# comments(!)
# This is distributed under the GPL (see COPYING.GNU for details).
=cut
=head1 NAME

View File

@ -1,10 +1,10 @@
#!/usr/bin/perl
#require 5.005;
require 5.005;
# Copyright Marc Lehmann <pcg@goof.com>
#
# This is distributed under the GPL.
# This is distributed under the GPL (see COPYING.GNU for details).
=cut
@ -114,7 +114,7 @@ my $tok; # current token
# parses a new token [ws, tok, ws]
sub get() {
my $ws1,$ws1,$ctok;
my($ws1,$ctk,$ws2);
# could be wrapped into one regex
$ws1 = $stream=~s/^((?:\s*(?:(;[^\n]*\n))?)*)// ? $1 : die;
$ctk = $stream=~s/^(\(
@ -190,7 +190,7 @@ sub toks2scheme {
}
while(@_) {
my @toks = shift;
my ($ws1,$t,$ws1)=$toks[0]
my ($unused,$t,$ws1)=$toks[0]
}
}
@ -249,7 +249,7 @@ sub dofile {
*isa = \&UNIVERSAL::isa;
sub usage {
print STDERR "Script-Fu to Script-Fu Translater 1.1\n";
print STDERR "Script-Fu to Script-Fu Translater 1.1.1\n";
print STDERR "Usage: $0 [-d] [-t translation] file.scm ...\n";
print STDERR "available translations are: @{[keys %translation]}\n";
exit(1);