forked from mia/Aegisub
Fix crash when opening the Select Lines dialog for the second time
Originally committed to SVN as r6652.
This commit is contained in:
parent
462448c7d1
commit
2a324a56e5
2 changed files with 12 additions and 17 deletions
|
@ -189,12 +189,22 @@ wxDialog (c->parent, -1, _("Select"), wxDefaultPosition, wxDefaultSize, wxCAPTIO
|
|||
match_mode->SetSelection(OPT_GET("Tool/Select Lines/Mode")->GetInt());
|
||||
|
||||
Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogSelection::Process, this, wxID_OK);
|
||||
Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogSelection::OnClose, this, wxID_CANCEL);
|
||||
Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::tr1::bind(&HelpButton::OpenPage, "Select Lines"), wxID_HELP);
|
||||
apply_to_comments->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, std::tr1::bind(&DialogSelection::OnDialogueCheckbox, this, apply_to_dialogue));
|
||||
apply_to_dialogue->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, std::tr1::bind(&DialogSelection::OnDialogueCheckbox, this, apply_to_comments));
|
||||
}
|
||||
|
||||
DialogSelection::~DialogSelection() {
|
||||
OPT_SET("Tool/Select Lines/Text")->SetString(STD_STR(match_text->GetValue()));
|
||||
OPT_SET("Tool/Select Lines/Condition")->SetInt(select_unmatching_lines->GetValue());
|
||||
OPT_SET("Tool/Select Lines/Field")->SetInt(dialogue_field->GetSelection());
|
||||
OPT_SET("Tool/Select Lines/Action")->SetInt(selection_change_type->GetSelection());
|
||||
OPT_SET("Tool/Select Lines/Mode")->SetInt(match_mode->GetSelection());
|
||||
OPT_SET("Tool/Select Lines/Match/Case")->SetBool(case_sensitive->IsChecked());
|
||||
OPT_SET("Tool/Select Lines/Match/Dialogue")->SetBool(apply_to_dialogue->IsChecked());
|
||||
OPT_SET("Tool/Select Lines/Match/Comment")->SetBool(apply_to_comments->IsChecked());
|
||||
}
|
||||
|
||||
void DialogSelection::Process(wxCommandEvent&) {
|
||||
std::set<AssDialogue*> matches;
|
||||
|
||||
|
@ -268,19 +278,6 @@ void DialogSelection::Process(wxCommandEvent&) {
|
|||
Close();
|
||||
}
|
||||
|
||||
void DialogSelection::OnClose(wxCommandEvent&) {
|
||||
OPT_SET("Tool/Select Lines/Text")->SetString(STD_STR(match_text->GetValue()));
|
||||
OPT_SET("Tool/Select Lines/Condition")->SetInt(select_unmatching_lines->GetValue());
|
||||
OPT_SET("Tool/Select Lines/Field")->SetInt(dialogue_field->GetSelection());
|
||||
OPT_SET("Tool/Select Lines/Action")->SetInt(selection_change_type->GetSelection());
|
||||
OPT_SET("Tool/Select Lines/Mode")->SetInt(match_mode->GetSelection());
|
||||
OPT_SET("Tool/Select Lines/Match/Case")->SetBool(case_sensitive->IsChecked());
|
||||
OPT_SET("Tool/Select Lines/Match/Dialogue")->SetBool(apply_to_dialogue->IsChecked());
|
||||
OPT_SET("Tool/Select Lines/Match/Comment")->SetBool(apply_to_comments->IsChecked());
|
||||
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void DialogSelection::OnDialogueCheckbox(wxCheckBox *chk) {
|
||||
if(!apply_to_dialogue->IsChecked() && !apply_to_comments->GetValue())
|
||||
chk->SetValue(true);
|
||||
|
|
|
@ -51,13 +51,11 @@ class DialogSelection : public wxDialog {
|
|||
|
||||
void Process(wxCommandEvent&);
|
||||
|
||||
/// Close event handler to save settings and destroy
|
||||
void OnClose(wxCommandEvent&);
|
||||
|
||||
/// Dialogue/Comment check handler to ensure at least one is always checked
|
||||
/// @param chk The checkbox to check if both are clear
|
||||
void OnDialogueCheckbox(wxCheckBox *chk);
|
||||
|
||||
public:
|
||||
DialogSelection(agi::Context *c);
|
||||
~DialogSelection();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue