From 33dd0abc7fb6fbb56bdecc791c6ce70669a74149 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 11 Oct 2012 20:08:38 -0700 Subject: [PATCH] Kill AssFile::GetWildcardList It did not actually simplify or clarify any of the code that called it. --- aegisub/src/ass_file.cpp | 7 ------- aegisub/src/ass_file.h | 3 --- aegisub/src/command/subtitle.cpp | 7 ++++--- aegisub/src/dialog_export.cpp | 3 ++- aegisub/src/dialog_style_manager.cpp | 3 ++- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/aegisub/src/ass_file.cpp b/aegisub/src/ass_file.cpp index fa2190137..3d0a7ddae 100644 --- a/aegisub/src/ass_file.cpp +++ b/aegisub/src/ass_file.cpp @@ -475,13 +475,6 @@ void AssFile::AddToRecent(wxString const& file) const { OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(filepath.GetPath())); } -wxString AssFile::GetWildcardList(int mode) { - if (mode == 0) return SubtitleFormat::GetWildcards(0); - if (mode == 1) return "Advanced Substation Alpha (*.ass)|*.ass"; - if (mode == 2) return SubtitleFormat::GetWildcards(1); - return ""; -} - int AssFile::Commit(wxString const& desc, int type, int amendId, AssEntry *single_line) { ++commitId; // Allow coalescing only if it's the last change and the file has not been diff --git a/aegisub/src/ass_file.h b/aegisub/src/ass_file.h index 83af367c5..f61c919c2 100644 --- a/aegisub/src/ass_file.h +++ b/aegisub/src/ass_file.h @@ -147,9 +147,6 @@ public: void AddToRecent(wxString const& file) const; /// Can the file be saved in its current format? bool CanSave() const; - /// @brief Get the list of wildcards supported - /// @param mode 0 = open, 1 = save, 2 = export - static wxString GetWildcardList(int mode); /// @brief Get the script resolution /// @param[out] w Width diff --git a/aegisub/src/command/subtitle.cpp b/aegisub/src/command/subtitle.cpp index 4c81ab04d..98ef0d286 100644 --- a/aegisub/src/command/subtitle.cpp +++ b/aegisub/src/command/subtitle.cpp @@ -60,6 +60,7 @@ #include "../include/aegisub/context.h" #include "../main.h" #include "../subs_grid.h" +#include "../subtitle_format.h" #include "../video_context.h" #include "../utils.h" @@ -262,7 +263,7 @@ struct subtitle_open : public Command { void operator()(agi::Context *c) { wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString()); - wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST); + wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",SubtitleFormat::GetWildcards(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST); if (!filename.empty()) { wxGetApp().frame->LoadSubtitles(filename); } @@ -282,7 +283,7 @@ struct subtitle_open_charset : public Command { wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString()); // Get options and load - wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST); + wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",SubtitleFormat::GetWildcards(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST); if (!filename.empty()) { wxString charset = wxGetSingleChoice(_("Choose charset code:"), _("Charset"), agi::charset::GetEncodingsList(), c->parent, -1, -1, true, 250, 200); if (!charset.empty()) { @@ -329,7 +330,7 @@ static void save_subtitles(agi::Context *c, wxString filename) { c->videoController->Stop(); wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString()); wxFileName origPath(c->ass->filename); - filename = wxFileSelector(_("Save subtitles file"), path, origPath.GetName() + ".ass", "ass", AssFile::GetWildcardList(1), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, c->parent); + filename = wxFileSelector(_("Save subtitles file"), path, origPath.GetName() + ".ass", "ass", "Advanced Substation Alpha (*.ass)|*.ass", wxFD_SAVE | wxFD_OVERWRITE_PROMPT, c->parent); if (filename.empty()) return; } diff --git a/aegisub/src/dialog_export.cpp b/aegisub/src/dialog_export.cpp index 872404b10..4a78239f2 100644 --- a/aegisub/src/dialog_export.cpp +++ b/aegisub/src/dialog_export.cpp @@ -52,6 +52,7 @@ #include "charset_conv.h" #include "help_button.h" #include "libresrc/libresrc.h" +#include "subtitle_format.h" DialogExport::DialogExport(agi::Context *c) : wxDialog(c->parent, -1, _("Export"), wxDefaultPosition, wxSize(200, 100), wxCAPTION | wxCLOSE_BOX) @@ -143,7 +144,7 @@ DialogExport::~DialogExport() { void DialogExport::OnProcess(wxCommandEvent &) { if (!TransferDataFromWindow()) return; - wxString filename = wxFileSelector(_("Export subtitles file"), "", "", "", AssFile::GetWildcardList(2), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this); + wxString filename = wxFileSelector(_("Export subtitles file"), "", "", "", SubtitleFormat::GetWildcards(1), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this); if (filename.empty()) return; for (size_t i = 0; i < filter_list->GetCount(); ++i) { diff --git a/aegisub/src/dialog_style_manager.cpp b/aegisub/src/dialog_style_manager.cpp index 93be95b30..f49aaee22 100644 --- a/aegisub/src/dialog_style_manager.cpp +++ b/aegisub/src/dialog_style_manager.cpp @@ -66,6 +66,7 @@ #include "persist_location.h" #include "selection_controller.h" #include "standard_paths.h" +#include "subtitle_format.h" using std::tr1::placeholders::_1; @@ -590,7 +591,7 @@ void DialogStyleManager::OnCurrentDelete() { void DialogStyleManager::OnCurrentImport() { // Get file name wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString()); - wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST); + wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",SubtitleFormat::GetWildcards(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST); if (!filename) return; OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(wxFileName(filename).GetPath()));