mirror of https://github.com/odrling/Aegisub
Add listener for the autosave timer
Originally committed to SVN as r4765.
This commit is contained in:
parent
0248e7c754
commit
071ada7487
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue