CodeManager
view release on metacpan or search on metacpan
lib/Prima/CodeManager/File.pm view on Meta::CPAN
if ( $e-> has_selection) {
my @sel = $e-> selection;
@scope = ($$p{scope} == fds::Top) ? ($sel[0],$sel[1]) : ($sel[2], $sel[3]);
} else {
@scope = ($$p{scope} == fds::Top) ? (0,0) : (-1,-1);
}
} else {
@scope = $e-> cursor;
}
my @n = $e-> find( $$p{findText}, @scope, $$p{replaceText}, $$p{options});
if ( !defined $n[0]) {
Prima::MsgBox::message( "No more matches found!" , mb::NoSound | mb::Information );
return;
}
$e-> cursor(($$p{options} & fdo::BackwardSearch) ? $n[0] : $n[0] + $n[2], $n[1]);
$e-> selection( $n[0], $n[1], $n[0] + $n[2], $n[1]);
unless ( $$p{asFind}) {
if ( $$p{options} & fdo::ReplacePrompt) {
my $r = Prima::MsgBox::message_box( "Replace...","Replace text '$$p{findText}'?", mb::YesNoCancel|mb::Information|mb::NoSound);
# my $r = Prima::MsgBox::message_box( $e-> text,
# "Replace this text?",
# mb::YesNoCancel|mb::Information|mb::NoSound);
redo FIND if ($r == mb::No) && ($$p{result} == mb::ChangeAll);
last FIND if $r == mb::Cancel;
}
$e-> set_line( $n[1], $n[3]);
redo FIND if $$p{result} && $$p{result} == mb::ChangeAll;
}
}
}
#-------------------------------------------------------------------------------
sub find_next
{
my ( $self ) = ( shift );
# my ( $this ) = ( $Prima::CodeManager::developer{ "notes_".$Prima::CodeManager::developer{notes}->pageIndex } );
# return unless $this-> {findData};
return unless $findData;
$self-> do_find;
}
#-------------------------------------------------------------------------------
sub replace
{
my ( $self ) = ( shift );
# my ( $self ) = ( $d::eveloper{ "notes_".$Prima::CodeManager::developer{notes}->pageIndex } );
return unless find_dialog(0);
$self-> do_find;
}
################################################################################
sub about
{
my ( $self ) = @_;
my $project_color = 0x0088ff;
my @dim = ( 360, 170 );
# my $img = $self-> load_icon( "$::Prima::CodeManager::CodeManager_directory/img/CodeManager64.png" );
my $tmp_popup = Prima::Dialog-> create(
icon => $self-> load_icon( "$Prima::CodeManager::CodeManager_directory/img/cm64.png" ),
title => "CodeManager - About",
text => "CodeManager - About",
size => [ @dim ],
origin => [ 0, 0 ],
borderIcons => bi::SystemMenu,
centered => 1,
# borderStyle => bs::None,
backColor => $self->licz_kolor( 0xffffff, $project_color, 0.5, 0 ),
onPaint => sub {
my ( $this, $canvas) = @_;
$canvas-> clear;
$canvas-> color( $self->licz_kolor( 0xffffff, $project_color, 0.2, 0 ) );
$canvas-> bar( 0, 0, $this-> width, $this-> height);
my $margin = 2;
my $width = 1;
$canvas-> color( $self->licz_kolor( 0xffffff, $project_color, 0.8, 0 ) );
$canvas-> fillpoly([
$margin, $margin,
$margin, $this-> height - $margin - 1,
$this-> width - $margin - 1, $this-> height - $margin - 1,
$this-> width - $margin - 1, $margin
]);
$canvas-> color( $self->licz_kolor( 0xffffff, $project_color, 0.5, 0 ) );
$canvas-> fillpoly([
$margin + $width, $margin + $width,
$margin + $width, $this-> height - $margin - 1 - $width,
$this-> width - $margin - 1 - $width, $this-> height - $margin - 1 - $width,
$this-> width - $margin - 1 - $width, $margin + $width
]);
# $canvas-> put_image( $dim[0]/2-64, $dim[1] - 64 - 10, $img );
},
);
my $height = 18;
$tmp_popup-> insert (
Label =>
origin => [ 10, $dim[1]-15 - $height ],
size => [ $dim[0]-20, $height ],
text => "This is CodeManager, ver. $Prima::CodeManager::VERSION",
flat => 1,
x_centered => 1,
alignment => ta::Center,
color => $self->licz_kolor( 0x000000, $project_color, 0.6, 0 ),
borderWidth => 1,
font => {
height => $height,
style => fs::Bold,
},
);
my $about = "Copyright 2009-2013 by Waldemar Biernacki\n" .
"http://codemanager.sao.pl\n" .
"\n" .
"\nLicense statement:\n" .
"This program/library is free software; you can redistribute it\n" .
"and/or modify it under the same terms as Perl itself.";
$tmp_popup->insert( Label =>
origin => [ 10, 30 ],
size => [ $dim[0] - 20, $dim[1] - 75 ],
text => $about,
flat => 1,
x_centered => 1,
alignment => ta::Center,
color => $self->licz_kolor( 0x000000, $project_color, 0.6, 0 ),
borderWidth => 1,
font => { size=>8, style=>fs::Normal, },
);
( run in 0.756 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )