Preset deletion

degen-loop-screen
Alessandro Ranellucci 2012-06-19 17:47:48 +02:00
parent b910840f76
commit 0ef8da42a6
1 changed files with 15 additions and 0 deletions

View File

@ -97,6 +97,21 @@ sub new {
$self->sync_presets;
});
EVT_BUTTON($self, $self->{btn_delete_preset}, sub {
my $i = $self->{presets_choice}->GetSelection;
return if $i == 0; # this shouldn't happen but let's trap it anyway
my $res = Wx::MessageDialog->new($self, "Are you sure you want to delete the selected preset?", 'Delete Preset', &Wx::wxYES_NO | &Wx::wxNO_DEFAULT | &Wx::wxICON_QUESTION)->ShowModal;
return unless $res == &Wx::wxID_YES;
if (-e $self->{presets}[$i-1]) {
unlink $self->{presets}[$i-1];
}
splice @{$self->{presets}}, $i-1, 1;
$self->{presets_choice}->Delete($i);
$self->{presets_choice}->SetSelection(0);
$self->on_select_preset;
$self->sync_presets;
});
return $self;
}