From c379e1e8e04fd97d98228de233a4a14c66e60204 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 8 Jan 2012 01:05:57 +0000 Subject: [PATCH] Prompt to save changes before creating new subtitles Originally committed to SVN as r6218. --- aegisub/src/command/subtitle.cpp | 3 ++- aegisub/src/frame_main.h | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/aegisub/src/command/subtitle.cpp b/aegisub/src/command/subtitle.cpp index 93e635ba4..f2e1ece8b 100644 --- a/aegisub/src/command/subtitle.cpp +++ b/aegisub/src/command/subtitle.cpp @@ -245,7 +245,8 @@ struct subtitle_new : public Command { STR_HELP("New subtitles.") void operator()(agi::Context *c) { - c->ass->LoadDefault(); + if (wxGetApp().frame->TryToCloseSubs() != wxCANCEL) + c->ass->LoadDefault(); } }; diff --git a/aegisub/src/frame_main.h b/aegisub/src/frame_main.h index cb90d164e..45c20afd0 100644 --- a/aegisub/src/frame_main.h +++ b/aegisub/src/frame_main.h @@ -104,10 +104,6 @@ class FrameMain: public wxFrame { void OnStatusClear(wxTimerEvent &event); void OnCloseWindow (wxCloseEvent &event); - /// Close the currently open subs, asking the user if they want to save if there are unsaved changes - /// @param enableCancel Should the user be able to cancel the close? - int TryToCloseSubs(bool enableCancel=true); - // AudioControllerAudioEventListener implementation void OnAudioOpen(AudioProvider *provider); void OnAudioClose(); @@ -142,6 +138,10 @@ public: bool IsVideoShown() const { return showVideo; } bool IsAudioShown() const { return showAudio; } + /// Close the currently open subs, asking the user if they want to save if there are unsaved changes + /// @param enableCancel Should the user be able to cancel the close? + int TryToCloseSubs(bool enableCancel=true); + void LoadSubtitles(wxString filename,wxString charset=""); DECLARE_EVENT_TABLE()