| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Padre::Plugin::REPL::Panel; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
9269
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
44
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
48
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
611
|
use Padre::Wx; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Padre::Util qw/_T/; |
|
10
|
|
|
|
|
|
|
use Wx qw/WXK_UP WXK_DOWN/; |
|
11
|
|
|
|
|
|
|
use base 'Wx::Panel'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
|
14
|
|
|
|
|
|
|
my $class = shift; |
|
15
|
|
|
|
|
|
|
my $main = shift; |
|
16
|
|
|
|
|
|
|
my $self = $class->SUPER::new( Padre::Current->main->bottom ); |
|
17
|
|
|
|
|
|
|
my $box = Wx::BoxSizer->new(Wx::wxVERTICAL); |
|
18
|
|
|
|
|
|
|
my $bottom_box = Wx::BoxSizer->new(Wx::wxHORIZONTAL); |
|
19
|
|
|
|
|
|
|
my $output = Wx::TextCtrl->new( |
|
20
|
|
|
|
|
|
|
$self, |
|
21
|
|
|
|
|
|
|
-1, |
|
22
|
|
|
|
|
|
|
"", |
|
23
|
|
|
|
|
|
|
Wx::wxDefaultPosition, |
|
24
|
|
|
|
|
|
|
Wx::wxDefaultSize, |
|
25
|
|
|
|
|
|
|
Wx::wxTE_READONLY |
|
26
|
|
|
|
|
|
|
| Wx::wxTE_MULTILINE |
|
27
|
|
|
|
|
|
|
| Wx::wxTE_DONTWRAP |
|
28
|
|
|
|
|
|
|
| Wx::wxNO_FULL_REPAINT_ON_RESIZE, |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
$box->Add( $output, 2, Wx::wxGROW ); |
|
31
|
|
|
|
|
|
|
my $input = Wx::TextCtrl->new( |
|
32
|
|
|
|
|
|
|
$self, |
|
33
|
|
|
|
|
|
|
-1, |
|
34
|
|
|
|
|
|
|
"", |
|
35
|
|
|
|
|
|
|
Wx::wxDefaultPosition, |
|
36
|
|
|
|
|
|
|
Wx::wxDefaultSize, |
|
37
|
|
|
|
|
|
|
Wx::wxTE_PROCESS_ENTER |
|
38
|
|
|
|
|
|
|
); |
|
39
|
|
|
|
|
|
|
Wx::Event::EVT_TEXT_ENTER( $self, $input, \&Padre::Plugin::REPL::evaluate ); |
|
40
|
|
|
|
|
|
|
Wx::Event::EVT_CHAR( $input, \&Padre::Plugin::REPL::Panel::process_key ); |
|
41
|
|
|
|
|
|
|
my $button = Wx::Button->new( $self, -1, _T("Evaluate") ); |
|
42
|
|
|
|
|
|
|
Wx::Event::EVT_BUTTON( $self, $button, \&Padre::Plugin::REPL::evaluate ); |
|
43
|
|
|
|
|
|
|
$bottom_box->Add( $input, 1 ); |
|
44
|
|
|
|
|
|
|
$bottom_box->Add($button); |
|
45
|
|
|
|
|
|
|
$box->Add( $bottom_box, 1, Wx::wxGROW ); |
|
46
|
|
|
|
|
|
|
$self->SetSizer($box); |
|
47
|
|
|
|
|
|
|
Padre::Current->main->bottom->show($self); |
|
48
|
|
|
|
|
|
|
return ( $input, $output ); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub process_key { |
|
52
|
|
|
|
|
|
|
my ( $input, $event ) = @_; |
|
53
|
|
|
|
|
|
|
my $code = $event->GetKeyCode; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
if ( $code == WXK_UP ) { |
|
56
|
|
|
|
|
|
|
Padre::Plugin::REPL::History::go_previous(); |
|
57
|
|
|
|
|
|
|
} elsif ( $code == WXK_DOWN ) { |
|
58
|
|
|
|
|
|
|
Padre::Plugin::REPL::History::go_next(); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
$event->Skip(); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub gettext_label { |
|
64
|
|
|
|
|
|
|
return "REPL"; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
|
68
|
|
|
|
|
|
|
|