mirror of https://github.com/odrling/Aegisub
Make AssFile handle autosaving on every commit itself rather than going through FrameMain
Originally committed to SVN as r5247.
This commit is contained in:
parent
cecaff404b
commit
a8ebc1e456
|
@ -800,6 +800,11 @@ int AssFile::Commit(wxString desc, CommitType type, int amendId) {
|
|||
UndoStack.pop_front();
|
||||
}
|
||||
|
||||
if (OPT_GET("App/Auto/Save on Every Change")->GetBool()) {
|
||||
if (!filename.empty() && CanSave())
|
||||
Save(filename);
|
||||
}
|
||||
|
||||
AnnounceCommit(type);
|
||||
return commitId;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ FrameMain::FrameMain (wxArrayString args)
|
|||
|
||||
StartupLog("Initializing context models");
|
||||
AssFile::top = context->ass = new AssFile;
|
||||
context->ass->AddCommitListener(&FrameMain::OnSubtitlesCommit, this);
|
||||
context->ass->AddCommitListener(&FrameMain::UpdateTitle, this);
|
||||
context->ass->AddFileOpenListener(&FrameMain::OnSubtitlesOpen, this);
|
||||
context->ass->AddFileSaveListener(&FrameMain::UpdateTitle, this);
|
||||
|
||||
|
@ -1135,15 +1135,6 @@ void FrameMain::OnAudioClose()
|
|||
SetDisplayMode(-1, 0);
|
||||
}
|
||||
|
||||
void FrameMain::OnSubtitlesCommit() {
|
||||
if (OPT_GET("App/Auto/Save on Every Change")->GetBool()) {
|
||||
if (context->ass->IsModified() && context->ass->CanSave())
|
||||
(*cmd::get("subtitle/save"))(context.get());
|
||||
}
|
||||
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
void FrameMain::OnSubtitlesOpen() {
|
||||
UpdateTitle();
|
||||
|
||||
|
|
|
@ -158,7 +158,6 @@ private:
|
|||
|
||||
void OnVideoOpen();
|
||||
|
||||
void OnSubtitlesCommit();
|
||||
void OnSubtitlesOpen();
|
||||
void OnSubtitlesSave();
|
||||
|
||||
|
|
Loading…
Reference in New Issue