diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index f50603f0c..525b485c6 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -92,6 +92,8 @@ #define StartupLog(a) #endif +static void autosave_timer_changed(wxTimer &timer, const agi::OptionValue &opt); + FrameMain::FrameMain (wxArrayString args) : wxFrame ((wxFrame*)NULL,-1,_T(""),wxDefaultPosition,wxSize(920,700),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN) { @@ -179,6 +181,7 @@ FrameMain::FrameMain (wxArrayString args) if (time > 0) { AutoSave.Start(time*1000); } + OPT_GET("App/Auto/Save Every Seconds")->Subscribe(this, std::tr1::bind(autosave_timer_changed, std::tr1::ref(AutoSave), std::tr1::placeholders::_1)); // Set accelerator keys StartupLog(_T("Install hotkeys")); @@ -1346,3 +1349,13 @@ bool FrameMain::HasASSDraw() { return false; #endif } + +static void autosave_timer_changed(wxTimer &timer, const agi::OptionValue &opt) { + int freq = opt.GetInt(); + if (freq <= 0) { + timer.Stop(); + } + else { + timer.Start(freq * 1000); + } +}