| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Padre::Plugin::XS; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
108083
|
use 5.010001; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
92
|
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
147
|
|
|
5
|
2
|
|
|
2
|
|
13
|
use strict; |
|
|
2
|
|
|
|
|
16
|
|
|
|
2
|
|
|
|
|
145
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
966
|
use Padre::Unload; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Try::Tiny; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.12'; |
|
11
|
|
|
|
|
|
|
use parent qw(Padre::Plugin); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Child modules we need to unload when disabled |
|
14
|
|
|
|
|
|
|
use constant CHILDREN => qw{ |
|
15
|
|
|
|
|
|
|
Padre::Plugin::XS |
|
16
|
|
|
|
|
|
|
Padre::Plugin::XS::PerlXS |
|
17
|
|
|
|
|
|
|
Padre::Plugin::XS::Document |
|
18
|
|
|
|
|
|
|
Perl::APIReference |
|
19
|
|
|
|
|
|
|
}; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
####### |
|
22
|
|
|
|
|
|
|
# Called by padre to know the plugin name |
|
23
|
|
|
|
|
|
|
####### |
|
24
|
|
|
|
|
|
|
sub plugin_name { |
|
25
|
|
|
|
|
|
|
return Wx::gettext('XS Support'); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
####### |
|
29
|
|
|
|
|
|
|
# Called by padre to check the required interface |
|
30
|
|
|
|
|
|
|
####### |
|
31
|
|
|
|
|
|
|
sub padre_interfaces { |
|
32
|
|
|
|
|
|
|
return ( |
|
33
|
|
|
|
|
|
|
'Padre::Plugin' => '0.98', |
|
34
|
|
|
|
|
|
|
'Padre::Document' => '0.98', |
|
35
|
|
|
|
|
|
|
'Padre::Wx' => '0.98', |
|
36
|
|
|
|
|
|
|
'Padre::Logger' => '0.98', |
|
37
|
|
|
|
|
|
|
); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
######### |
|
42
|
|
|
|
|
|
|
# We need plugin_enable |
|
43
|
|
|
|
|
|
|
# as we have an external dependency |
|
44
|
|
|
|
|
|
|
######### |
|
45
|
|
|
|
|
|
|
sub plugin_enable { |
|
46
|
|
|
|
|
|
|
my $self = shift; |
|
47
|
|
|
|
|
|
|
my $perl_api_ref = 0; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Tests for externals used |
|
50
|
|
|
|
|
|
|
try { |
|
51
|
|
|
|
|
|
|
if ( require Perl::APIReference ) { |
|
52
|
|
|
|
|
|
|
$perl_api_ref = 1; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
}; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return $perl_api_ref; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
####### |
|
60
|
|
|
|
|
|
|
# Add Plugin to Padre Menu |
|
61
|
|
|
|
|
|
|
####### |
|
62
|
|
|
|
|
|
|
sub menu_plugins_simple { |
|
63
|
|
|
|
|
|
|
my $self = shift; |
|
64
|
|
|
|
|
|
|
return $self->plugin_name => [ |
|
65
|
|
|
|
|
|
|
Wx::gettext('About...') => sub { $self->plugin_about }, |
|
66
|
|
|
|
|
|
|
]; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
####### |
|
70
|
|
|
|
|
|
|
# Called by padre to know which document to register for this plugin |
|
71
|
|
|
|
|
|
|
####### |
|
72
|
|
|
|
|
|
|
sub registered_documents { |
|
73
|
|
|
|
|
|
|
return ( |
|
74
|
|
|
|
|
|
|
'text/x-perlxs' => 'Padre::Plugin::XS::Document', |
|
75
|
|
|
|
|
|
|
); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
####### |
|
80
|
|
|
|
|
|
|
# Add icon to Plugin |
|
81
|
|
|
|
|
|
|
####### |
|
82
|
|
|
|
|
|
|
# Core plugins may reuse the page icon |
|
83
|
|
|
|
|
|
|
sub plugin_icon { |
|
84
|
|
|
|
|
|
|
require Padre::Wx::Icon; |
|
85
|
|
|
|
|
|
|
Padre::Wx::Icon::find('logo'); |
|
86
|
|
|
|
|
|
|
return; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
####### |
|
92
|
|
|
|
|
|
|
# plugin_about |
|
93
|
|
|
|
|
|
|
####### |
|
94
|
|
|
|
|
|
|
sub plugin_about { |
|
95
|
|
|
|
|
|
|
my $self = shift; |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# my $share = $self->plugin_directory_share or return; |
|
98
|
|
|
|
|
|
|
# my $file = File::Spec->catfile( $share, 'icons', '48x48', 'git.png' ); |
|
99
|
|
|
|
|
|
|
# return unless -f $file; |
|
100
|
|
|
|
|
|
|
# return unless -r $file; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
my $info = Wx::AboutDialogInfo->new; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# $info->SetIcon( Wx::Icon->new( $file, Wx::wxBITMAP_TYPE_PNG ) ); |
|
105
|
|
|
|
|
|
|
$info->SetName('Padre::Plugin::XS'); |
|
106
|
|
|
|
|
|
|
$info->SetVersion($VERSION); |
|
107
|
|
|
|
|
|
|
$info->SetDescription( Wx::gettext('Padre XS and perlapi support') ); |
|
108
|
|
|
|
|
|
|
$info->SetCopyright('(c) 2008-2013 The Padre development team'); |
|
109
|
|
|
|
|
|
|
$info->SetWebSite('http://padre.perlide.org/trac/wiki/PadrePluginXS'); |
|
110
|
|
|
|
|
|
|
$info->AddDeveloper('Steffen Mueller '); |
|
111
|
|
|
|
|
|
|
$info->AddDeveloper('Ahmad M. Zawawi '); |
|
112
|
|
|
|
|
|
|
$info->AddDeveloper('Kevin Dawson '); |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
# $info->SetArtists( |
|
115
|
|
|
|
|
|
|
# [ 'Scott Chacon ', |
|
116
|
|
|
|
|
|
|
# 'Licence ' |
|
117
|
|
|
|
|
|
|
# ] |
|
118
|
|
|
|
|
|
|
# ); |
|
119
|
|
|
|
|
|
|
Wx::AboutBox($info); |
|
120
|
|
|
|
|
|
|
return; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
######## |
|
124
|
|
|
|
|
|
|
# plugin_disable |
|
125
|
|
|
|
|
|
|
######## |
|
126
|
|
|
|
|
|
|
sub plugin_disable { |
|
127
|
|
|
|
|
|
|
my $self = shift; |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
# Close the dialog if it is hanging around |
|
130
|
|
|
|
|
|
|
$self->clean_dialog; |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
# Unload all our child classes |
|
133
|
|
|
|
|
|
|
for my $package (CHILDREN) { |
|
134
|
|
|
|
|
|
|
require Padre::Unload; |
|
135
|
|
|
|
|
|
|
Padre::Unload->unload($package); |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
$self->SUPER::plugin_disable(@_); |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
return 1; |
|
141
|
|
|
|
|
|
|
} |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
######## |
|
144
|
|
|
|
|
|
|
# Composed Method clean_dialog |
|
145
|
|
|
|
|
|
|
######## |
|
146
|
|
|
|
|
|
|
sub clean_dialog { |
|
147
|
|
|
|
|
|
|
my $self = shift; |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# Close the main dialog if it is hanging around |
|
150
|
|
|
|
|
|
|
if ( $self->{dialog} ) { |
|
151
|
|
|
|
|
|
|
$self->{dialog}->Hide; |
|
152
|
|
|
|
|
|
|
$self->{dialog}->Destroy; |
|
153
|
|
|
|
|
|
|
delete $self->{dialog}; |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
return 1; |
|
157
|
|
|
|
|
|
|
} |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
1; |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
__END__ |