1
package Padre::Wx::Menu::Run;
3
# Fully encapsulated Run menu
9
use Padre::Wx::Menu ();
10
use Padre::Current qw{_CURRENT};
12
our $VERSION = '0.27';
13
our @ISA = 'Padre::Wx::Menu';
19
#####################################################################
20
# Padre::Wx::Menu Methods
26
# Create the empty menu as normal
27
my $self = $class->SUPER::new(@_);
29
# Add additional properties
30
$self->{main} = $main;
33
$self->{run_document} = $self->Append( -1,
34
Wx::gettext("Run Script\tF5")
36
Wx::Event::EVT_MENU( $main,
37
$self->{run_document},
43
$self->{run_command} = $self->Append( -1,
44
Wx::gettext("Run Command\tCtrl-F5")
46
Wx::Event::EVT_MENU( $main,
49
$_[0]->on_run_command;
53
$self->AppendSeparator;
55
$self->{stop} = $self->Append( -1,
58
Wx::Event::EVT_MENU( $main,
61
if ( $_[0]->{command} ) {
62
$_[0]->{command}->TerminateProcess;
64
delete $_[0]->{command};
77
my $document = _CURRENT(@_)->document;
79
# Disable if not document,
80
# otherwise match run_command state
81
$self->{run_document}->Enable(
83
? $self->{run_command}->IsEnabled
94
#####################################################################
99
$self->{run_document}->Enable(1);
100
$self->{run_command}->Enable(1);
101
$self->{stop}->Enable(0);
107
$self->{run_document}->Enable(0);
108
$self->{run_command}->Enable(0);
109
$self->{stop}->Enable(1);
114
# Copyright 2008-2009 The Padre development team as listed in Padre.pm.
116
# This program is free software; you can redistribute it and/or
117
# modify it under the same terms as Perl 5 itself.