diff --git a/aegisub/src/dialog_shift_times.cpp b/aegisub/src/dialog_shift_times.cpp index 3e2c4a3bc..170e10dc0 100644 --- a/aegisub/src/dialog_shift_times.cpp +++ b/aegisub/src/dialog_shift_times.cpp @@ -193,13 +193,22 @@ DialogShiftTimes::DialogShiftTimes(agi::Context *context) CenterOnParent(); Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogShiftTimes::Process, this, wxID_OK); - Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogShiftTimes::OnClose, this, wxID_CANCEL); Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::tr1::bind(&HelpButton::OpenPage, "Shift Times"), wxID_HELP); history_box->Bind(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, &DialogShiftTimes::OnHistoryClick, this); context->selectionController->AddSelectionListener(this); } DialogShiftTimes::~DialogShiftTimes() { + long shift; + shift_frames->GetValue().ToLong(&shift); + + OPT_SET("Tool/Shift Times/Time")->SetInt(shift_time->GetTime()); + OPT_SET("Tool/Shift Times/Frames")->SetInt(shift); + OPT_SET("Tool/Shift Times/ByTime")->SetBool(shift_by_time->GetValue()); + OPT_SET("Tool/Shift Times/Type")->SetInt(time_fields->GetSelection()); + OPT_SET("Tool/Shift Times/Affect")->SetInt(selection_mode->GetSelection()); + OPT_SET("Tool/Shift Times/Direction")->SetBool(shift_backward->GetValue()); + context->selectionController->RemoveSelectionListener(this); } @@ -235,20 +244,6 @@ void DialogShiftTimes::OnClear(wxCommandEvent &) { history->clear(); } -void DialogShiftTimes::OnClose(wxCommandEvent &) { - long shift; - shift_frames->GetValue().ToLong(&shift); - - OPT_SET("Tool/Shift Times/Time")->SetInt(shift_time->GetTime()); - OPT_SET("Tool/Shift Times/Frames")->SetInt(shift); - OPT_SET("Tool/Shift Times/ByTime")->SetBool(shift_by_time->GetValue()); - OPT_SET("Tool/Shift Times/Type")->SetInt(time_fields->GetSelection()); - OPT_SET("Tool/Shift Times/Affect")->SetInt(selection_mode->GetSelection()); - OPT_SET("Tool/Shift Times/Direction")->SetBool(shift_backward->GetValue()); - - Destroy(); -} - void DialogShiftTimes::OnByTime(wxCommandEvent &) { shift_time->Enable(true); shift_frames->Enable(false); diff --git a/aegisub/src/dialog_shift_times.h b/aegisub/src/dialog_shift_times.h index ff6426351..9295d9c9d 100644 --- a/aegisub/src/dialog_shift_times.h +++ b/aegisub/src/dialog_shift_times.h @@ -74,7 +74,6 @@ class DialogShiftTimes : public wxDialog, private SelectionListener int Shift(int initial_time, int shift, bool by_time, agi::vfr::Time type); void OnClear(wxCommandEvent&); - void OnClose(wxCommandEvent&); void OnByTime(wxCommandEvent&); void OnByFrames(wxCommandEvent&); void OnHistoryClick(wxCommandEvent&);