App-PLab
view release on metacpan or search on metacpan
bin/PrAverB view on Meta::CPAN
$r[0] += 3;
$r[1] += 3;
$r[2] -= 3;
$r[3] -= 3;
$canvas-> rectangle( @r);
$canvas-> rop( rop::CopyPut);
$canvas-> color( $c);
}
}
sub compare_to
{
my @d = map {
my $g = $_[0]-> {bounds}-> [$_] - $_[1]-> {bounds}->[$_];
$g = 0 if abs($g) < 8; # XXX
$g;
} 0,1;
return ($d[1] != 0) ? -$d[1] : $d[0];
}
package AveWindow;
use vars qw(@ISA);
@ISA = qw(App::PLab::ImageAppWindow);
sub win_inidefaults
{
my $w = $_[0];
return (
$w-> SUPER::win_inidefaults,
PropShowMode => '1',
);
}
sub on_create
{
my $self = $_[0];
my $w = $_[0];
$self-> SUPER::on_create;
$self-> {dataExt} = 'pab';
$w-> {selectedRect} = undef;
$w-> {rects} = [];
$w-> insert( Popup =>
autoPopup => 0,
selected => 0,
name => 'FigurePopup',
items => [
['~Duplicate' => 'Ctrl+D' => kb::NoKey => q(win_figdup)],
['De~lete' => 'Del' => kb::NoKey => q(win_figdelete)],
['~Properties' => sub { $w-> fig_propdialog( $w-> {selectedRect})}],
],
);
my $scale = $::application-> uiScaling;
$scale = 1 if $scale < 1;
my %btn_profile = (
glyphs => 2,
text => "",
selectable => 0,
transparent => 1,
flat => 1,
size => [ map { $_ * $scale } 36, 36],
borderWidth => 1,
);
$w-> ToolBar-> insert(
[ SpeedButton =>
origin => [ 114 * $scale, 1],
image => App::PLab::ButtonGlyphs::icon( bg::floppy),
hint => 'Save file',
enabled => 0,
name => "FileSave",
onClick => sub { $w-> win_saveframe; },
%btn_profile,
],
[ SpeedButton =>
origin => [ 150 * $scale, 1],
image => App::PLab::ButtonGlyphs::icon( bg::print),
hint => 'Print',
enabled => 0,
name => "FilePrint",
onClick => sub { $w-> win_printframe(0); },
%btn_profile,
],
);
}
sub win_closeframe
{
my $w = $_[0];
$w-> SUPER::win_closeframe;
$w-> fig_clear();
}
sub win_newextras
{
my $w = $_[0];
$w-> SUPER::win_newextras;
my $pabname = $w-> win_extname( $w->{file});
if ( open F, "< $pabname") {
$_ = <F>;
return unless /Average\sbrightness\sdata/;
return unless /extinfo/;
my $i;
LOOP: while (<F>) {
my $comments;
chomp;
if ( /\#(.*)/) {
$comments = $1;
# print "got comments:$comments\n";
s/\#.*//;
}
next unless length $_;
my @dp = split(' ', $_);
# print "got data:@dp\n";
next unless $dp[0] =~ /^\d+$/;
next unless defined $comments;
@dp = split(' ', $comments);
( run in 2.191 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )