App-PLab
view release on metacpan or search on metacpan
# SB_END
# IV
sub IV_xorrect
{
my ( $w, $self) = @_;
my @r = @{$self->{xorData}};
my $pc = $w->{ini}->{Color_Pointer};
$pc = (( $pc >> 16) & 0xFF) | ( $pc & 0xFF00) | (( $pc & 0xFF) << 16); # RGB => BGR
$self-> begin_paint;
$self-> set(
fillPattern => fp::CloseDot,
color => cl::White,
backColor => $pc,
rop => rop::XorPut,
);
$self-> bar( @r);
$self-> end_paint;
}
sub IV_MouseDown
{
my ( $w, $self, $btn, $mod, $x, $y) = @_;
$w-> win_untemp(1);
if ( $btn == mb::Right && $mod & km::Shift && !$self->{transaction} && $w->{file}) {
$w-> iv_entermode( $self, 4);
$self-> {xorData} = [ $x, $y, $x, $y];
$w-> IV_xorrect( $self);
$self-> clear_event;
$w-> sb_text( "Select points to remove");
return;
}
if ( $btn == mb::Right && !$self->{transaction} && defined $w-> rpt_is( $self-> screen2point( $x, $y))) {
$w-> {lastPopupPoint} = [$self-> screen2point( $x, $y)];
$w-> iv_cancelmode( $self);
$self-> PointPopup-> popup( $self-> pointerPos);
$self-> clear_event;
return;
}
$w-> SUPER::IV_MouseDown( $self, $btn, $mod, $x, $y);
return unless $self-> eventFlag;
if ( $btn == mb::Left && !$self->{transaction}) {
my ( $ax, $ay) = $self-> screen2point( $x, $y);
if ( $ax >= 0 && $ay >= 0 && $ax < $w->{IVx} && $ay < $w->{IVy}) {
if ( $w-> rpt_toggle( $ax, $ay)) {
$self-> begin_paint;
$self-> color( $w->{ini}->{Color_Points});
my $p = ( 6 * $self-> zoom < 1) ? 1 : ( 6 * $self-> zoom);
$self-> ellipse( $x, $y, $p, $p);
$self-> end_paint;
$w-> sb_text( "New reference point: $ax $ay");
} else {
my $p = ( 32 * $self-> zoom < 1) ? 1 : ( 32 * $self-> zoom);
$self-> invalidate_rect( $x - $p, $y - $p, $x + $p, $y + $p);
$w-> sb_text( "Reference point deleted: $ax $ay");
}
$w-> sb_points();
}
}
$self-> clear_event;
}
sub IV_MouseUp
{
my ( $w, $self, $btn, $mod, $x, $y) = @_;
if ( $self->{transaction} && $self->{transaction} == 4 && $btn == mb::Right) {
$self-> {transaction} = undef;
$self-> capture( 0);
$w-> IV_xorrect( $self);
my @r = @{$self-> {xorData}};
$self-> {xorData} = [(-1)x4];
$self-> clear_event;
$r[2] = $x;
$r[3] = $y;
@r[0,2] = @r[2,0] if $r[0] > $r[2];
@r[1,3] = @r[3,1] if $r[1] > $r[3];
@r = $self-> screen2point( @r);
$w-> rpt_exclude( @r);
$self-> repaint;
return;
}
$w-> SUPER::IV_MouseUp( $self, $btn, $mod, $x, $y);
}
sub IV_MouseMove
{
my ( $w, $self, $mod, $x, $y) = @_;
if ( $self->{transaction} && $self->{transaction} == 4) {
$w-> IV_xorrect( $self);
$self-> {xorData}-> [2] = $x;
$self-> {xorData}-> [3] = $y;
$w-> IV_xorrect( $self);
$self-> clear_event;
}
$w-> SUPER::IV_MouseMove( $self, $mod, $x, $y);
}
sub IV_Paint
{
my ( $w, $self, $canvas) = @_;
$self-> on_paint( $canvas);
my $wl = $w-> {points};
my $z = $self-> zoom;
my $p = ( 6 * $z < 1) ? 1 : ( 6 * $z);
$canvas-> translate( $self-> point2screen( 0, 0));
if ( defined $wl) {
my $i;
$canvas-> color( $w-> {ini}->{Color_Points});
for ( $i = 0; $i < scalar @$wl; $i+=2) {
( run in 1.023 second using v1.01-cache-2.11-cpan-39bf76dae61 )