From 95a1071a1b5e11e511416c6b18d6d6aa035cfdeb Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 16 Nov 2011 21:58:58 +0000 Subject: [PATCH] Add the script file name to the close confirmation dialog. Closes #879. Originally committed to SVN as r5861. --- aegisub/src/frame_main.cpp | 34 +++++++++++++++++++--------------- aegisub/src/frame_main.h | 1 + 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index cb6e63147..996e8d788 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -323,7 +323,7 @@ int FrameMain::TryToCloseSubs(bool enableCancel) { if (context->ass->IsModified()) { int flags = wxYES_NO; if (enableCancel) flags |= wxCANCEL; - int result = wxMessageBox(_("Save before continuing?"), _("Unsaved changes"), flags,this); + int result = wxMessageBox(wxString::Format(_("Do you want to save changes to %s?"), GetScriptFileName()), _("Unsaved changes"), flags, this); if (result == wxYES) { (*cmd::get("subtitle/save"))(context.get()); // If it fails saving, return cancel anyway @@ -372,20 +372,7 @@ void FrameMain::SetDisplayMode(int video, int audio) { void FrameMain::UpdateTitle() { wxString newTitle; if (context->ass->IsModified()) newTitle << "* "; - if (context->ass->filename.empty()) { - // Apple HIG says "untitled" should not be capitalised - // and the window is a document window, it shouldn't contain the app name - // (The app name is already present in the menu bar) -#ifndef __WXMAC__ - newTitle << _("Untitled"); -#else - newTitle << _("untitled"); -#endif - } - else { - wxFileName file (context->ass->filename); - newTitle << file.GetFullName(); - } + newTitle << GetScriptFileName(); #ifndef __WXMAC__ newTitle << " - Aegisub " << GetAegisubLongVersionString(); @@ -691,3 +678,20 @@ void FrameMain::OnKeyDown(wxKeyEvent &event) { void FrameMain::OnMouseWheel(wxMouseEvent &evt) { ForwardMouseWheelEvent(this, evt); } + +wxString FrameMain::GetScriptFileName() const { + if (context->ass->filename.empty()) { + // Apple HIG says "untitled" should not be capitalised + // and the window is a document window, it shouldn't contain the app name + // (The app name is already present in the menu bar) +#ifndef __WXMAC__ + return _("Untitled"); +#else + return _("untitled"); +#endif + } + else { + wxFileName file (context->ass->filename); + return file.GetFullName(); + } +} diff --git a/aegisub/src/frame_main.h b/aegisub/src/frame_main.h index b43c3ef4f..5bed86ba6 100644 --- a/aegisub/src/frame_main.h +++ b/aegisub/src/frame_main.h @@ -96,6 +96,7 @@ class FrameMain: public wxFrame { bool LoadList(wxArrayString list); void UpdateTitle(); + wxString GetScriptFileName() const; void OnKeyDown(wxKeyEvent &event); void OnMouseWheel(wxMouseEvent &evt);