~ubuntu-branches/ubuntu/precise/padre/precise

« back to all changes in this revision

Viewing changes to lib/Padre/Wx/Menu/Help.pm

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2009-10-29 17:40:10 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20091029174010-yu27elyiv9izv0dv
Tags: 0.48.ds2-1
* New Upstream Version
  + new dependencies:
    - libdevel-refactor-perl 0.05
    - libfile-next-perl 1.04
    - libpod-perldoc-perl 3.15
    - libversion-perl (perl 5.10)
    - pip 0.13
  + new Recommends:
    - libformat-human-bytes-perl
  + dropped dependdencies
    - libcapture-tiny-perl
    - libfile-sharedir-par-perl
    - libpar-perl
  + bump libfile-which-perl, libppi-per, libppix-editortools-perl,
    libtest-script-perl and libwx-perl-processstream-perl dependencies
  + update translators list in d/copyright
  + add copyright holders for code borrowed from ExtUtils::MakeMaker
  + rules: drop empty Padre::Wx::Dialog::OpenResource::SearchTask manpage
  + refresh disable-tcp-server.patch
  + drop patches applied upstream: fix-perl-interpreter-path.patch,
    fix-pod-errors.patch and fix-whatis.patch
* Standards-Version: 3.8.3 (no changes)
* update debian/repack.sh to remove script/padre.exe,
  share/padre-splash-ccnc.bmp and  share/doc/perlopref.pod and plug it
  into debian/watch; describe repackaging in debian/copyright
* copyright: update
* update lintian override of template/example scripts not being
  executable
* add fix-helpprovider-with-no-perldoc.patch so that the Help browser does
  not hang because of the missing perlopref.pod
* update README.debian with regard to repackaging

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
use Padre::Wx       ();
13
13
use Padre::Wx::Menu ();
14
14
 
15
 
our $VERSION = '0.42';
 
15
our $VERSION = '0.48';
16
16
our @ISA     = 'Padre::Wx::Menu';
17
17
 
 
18
 
 
19
 
 
20
 
 
21
 
18
22
#####################################################################
19
23
# Padre::Wx::Menu Methods
20
24
 
33
37
                id         => Wx::wxID_HELP,
34
38
                label      => Wx::gettext('Help'),
35
39
                menu_event => sub {
36
 
                        $_[0]->menu->help->help( $_[0] );
 
40
                        $_[0]->help();
37
41
                },
38
42
        );
39
43
        $self->add_menu_item(
49
53
 
50
54
                                # TODO This feels wrong, the help menu code shouldn't
51
55
                                # populate the main window hash.
52
 
                                my $selection = $_[0]->current->text;
53
 
                                $_[0]->menu->help->help( $_[0] );
54
 
                                if ($selection) {
55
 
                                        $_[0]->{help}->help($selection);
56
 
                                }
 
56
                                $_[0]->help( $_[0]->current->text );
57
57
                                return;
58
58
                        }
59
59
                },
60
60
        );
 
61
 
 
62
        $self->add_menu_item(
 
63
                $self,
 
64
                name       => 'help.search',
 
65
                label      => Wx::gettext('Help Search'),
 
66
                shortcut   => 'F2',
 
67
                menu_event => sub {
 
68
 
 
69
                        #Show Help Search with no topic...
 
70
                        $_[0]->help_search;
 
71
                },
 
72
        );
 
73
 
61
74
        $self->{current} = $self->add_menu_item(
62
75
                $self,
63
76
                name       => 'help.current',
64
77
                label      => Wx::gettext('Current Document'),
65
78
                menu_event => sub {
66
 
                        $_[0]->menu->help->help( $_[0] );
67
 
                        $_[0]->{help}->help( $_[0]->current->document );
 
79
                        $_[0]->help( $_[0]->current->document );
68
80
                },
69
81
        );
70
82
 
98
110
                },
99
111
        );
100
112
 
101
 
        if (Padre::Util::WIN32) {
 
113
        if (Padre::Constant::WIN32) {
102
114
                $self->add_menu_item(
103
115
                        $self->{live},
104
116
                        name       => 'help.win32_questions',
109
121
                );
110
122
        }
111
123
 
 
124
        $self->AppendSeparator;
 
125
 
112
126
        # Add interesting and helpful websites
113
 
        $self->AppendSeparator;
114
 
 
115
127
        $self->add_menu_item(
116
128
                $self,
117
129
                name       => 'help.visit_perlmonks',
121
133
                },
122
134
        );
123
135
 
 
136
        $self->AppendSeparator;
 
137
 
124
138
        # Add Padre website tools
125
 
        $self->AppendSeparator;
126
139
        $self->add_menu_item(
127
140
                $self,
128
141
                name       => 'help.report_a_bug',
149
162
                },
150
163
        );
151
164
 
 
165
        $self->AppendSeparator;
 
166
 
152
167
        # Add the About
153
 
        $self->AppendSeparator;
154
168
        $self->add_menu_item(
155
169
                $self,
156
170
                name       => 'help.about',
157
171
                id         => Wx::wxID_ABOUT,
158
172
                label      => Wx::gettext('&About'),
159
173
                menu_event => sub {
160
 
                        $_[0]->menu->help->about;
 
174
                        $_[0]->about->ShowModal;
161
175
                },
162
176
        );
163
177
 
175
189
        return 1;
176
190
}
177
191
 
178
 
# TODO - This violates encapsulation, a menu entry shouldn't be
179
 
#        spawning windows and storing them in the window hash.
180
 
sub help {
181
 
        my $self = shift;
182
 
        my $main = shift;
183
 
 
184
 
        unless ( $main->{help} ) {
185
 
                require Padre::Wx::DocBrowser;
186
 
                $main->{help} = Padre::Wx::DocBrowser->new;
187
 
                Wx::Event::EVT_CLOSE(
188
 
                        $main->{help},
189
 
                        \&on_help_close,
190
 
                );
191
 
                $main->{help}->help('Padre');
192
 
        }
193
 
        $main->{help}->SetFocus;
194
 
        $main->{help}->Show(1);
195
 
        return;
196
 
}
197
 
 
198
 
# TODO - this feels utterly backwards to me
199
 
sub on_help_close {
200
 
        my ( $self, $event ) = @_;
201
 
        my $help = Padre->ide->wx->main->{help};
202
 
 
203
 
        if ( $event->CanVeto ) {
204
 
                $help->Hide;
205
 
        } else {
206
 
                delete Padre->ide->wx->main->{help};
207
 
                $help->Destroy;
208
 
        }
209
 
}
210
 
 
211
 
sub about {
212
 
        my $self = shift;
213
 
 
214
 
        my $about = Wx::AboutDialogInfo->new;
215
 
        $about->SetName("Padre");
216
 
        $about->SetDescription( "Perl Application Development and Refactoring Environment\n\n"
217
 
                        . "Based on Wx.pm $Wx::VERSION and "
218
 
                        . Wx::wxVERSION_STRING . "\n"
219
 
                        . "Config at "
220
 
                        . Padre::Constant::CONFIG_DIR . "\n"
221
 
                        . "SQLite user_version at "
222
 
                        . Padre::DB->pragma('user_version')
223
 
                        . "\n" );
224
 
        $about->SetVersion($Padre::VERSION);
225
 
        $about->SetCopyright( Wx::gettext("Copyright 2008-2009 The Padre development team as listed in Padre.pm") );
226
 
 
227
 
        # Only Unix/GTK native about box supports websites
228
 
        if (Padre::Constant::WXGTK) {
229
 
                $about->SetWebSite("http://padre.perlide.org/");
230
 
        }
231
 
 
232
 
        $about->AddDeveloper("Adam Kennedy");
233
 
        $about->AddDeveloper("Ahmad Zawawi - أحمد محمد زواوي");
234
 
        $about->AddDeveloper("Breno G. de Oliveira");
235
 
        $about->AddDeveloper("Brian Cassidy");
236
 
        $about->AddDeveloper("Cezary Morga");
237
 
        $about->AddDeveloper("Chris Dolan");
238
 
        $about->AddDeveloper("Claudio Ramirez");
239
 
        $about->AddDeveloper("Fayland Lam");
240
 
        $about->AddDeveloper("Gabriel Vieira");
241
 
        $about->AddDeveloper("Gábor Szabó - גאבור סבו ");
242
 
        $about->AddDeveloper("Heiko Jansen");
243
 
        $about->AddDeveloper("Jérôme Quelin");
244
 
        $about->AddDeveloper("Kaare Rasmussen");
245
 
        $about->AddDeveloper("Keedi Kim - 김도형");
246
 
        $about->AddDeveloper("Kenichi Ishigaki - 石垣憲一");
247
 
        $about->AddDeveloper("Max Maischein");
248
 
        $about->AddDeveloper("Patrick Donelan");
249
 
        $about->AddDeveloper("Paweł Murias");
250
 
        $about->AddDeveloper("Petar Shangov");
251
 
        $about->AddDeveloper("Ryan Niebur");
252
 
        $about->AddDeveloper("Steffen Müller");
253
 
 
254
 
        $about->AddTranslator("Arabic - Ahmad Zawawi - أحمد محمد زواوي");
255
 
        $about->AddTranslator("German - Heiko Jansen");
256
 
        $about->AddTranslator("French - Jérôme Quelin");
257
 
        $about->AddTranslator("Hebrew - Omer Zak - עומר זק");
258
 
        $about->AddTranslator("Hebrew - Shlomi Fish - שלומי פיש");
259
 
        $about->AddTranslator("Hebrew - Amir E. Aharoni - אמיר א. אהרוני");
260
 
        $about->AddTranslator("Hungarian - György Pásztor");
261
 
        $about->AddTranslator("Italian - Simone Blandino");
262
 
        $about->AddTranslator("Japanese - Kenichi Ishigaki - 石垣憲一");
263
 
        $about->AddTranslator("Korean - Keedi Kim - 김도형");
264
 
        $about->AddTranslator("Norwegian - Kjetil Skotheim");
265
 
        $about->AddTranslator("Russian - Andrew Shitov");
266
 
        $about->AddTranslator("Dutch - Dirk De Nijs");
267
 
        $about->AddTranslator("Polish - Cezary Morga");
268
 
        $about->AddTranslator("Portuguese (BR) - Breno G. de Oliveira");
269
 
        $about->AddTranslator("Spanish - Paco Alguacil");
270
 
        $about->AddTranslator("Spanish - Enrique Nell");
271
 
        $about->AddTranslator("Czech - Marcela Mašláňová");
272
 
        $about->AddTranslator("Chinese (Trad./TW) - BlueT - Matthew Lien - 練喆明");
273
 
 
274
 
        Wx::AboutBox($about);
275
 
        return;
276
 
}
277
192
 
278
193
1;
279
194