2006-02-26 23:45:34 +01:00
|
|
|
// Copyright (c) 2006, Rodrigo Braz Monteiro
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
|
|
|
|
/// @file subtitle_format.cpp
|
|
|
|
/// @brief Base class for subtitle format handlers
|
|
|
|
/// @ingroup subtitle_io
|
|
|
|
///
|
2006-02-26 23:45:34 +01:00
|
|
|
|
2012-03-29 01:58:40 +02:00
|
|
|
#include "subtitle_format.h"
|
|
|
|
|
2011-09-28 21:44:53 +02:00
|
|
|
#include "ass_dialogue.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "ass_file.h"
|
2013-01-04 16:01:50 +01:00
|
|
|
#include "compat.h"
|
2014-05-29 17:28:37 +02:00
|
|
|
#include "format.h"
|
2006-02-27 01:06:46 +01:00
|
|
|
#include "subtitle_format_ass.h"
|
2012-03-29 21:05:26 +02:00
|
|
|
#include "subtitle_format_ebu3264.h"
|
2007-06-19 07:04:15 +02:00
|
|
|
#include "subtitle_format_encore.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "subtitle_format_microdvd.h"
|
|
|
|
#include "subtitle_format_mkv.h"
|
|
|
|
#include "subtitle_format_srt.h"
|
2014-08-10 15:51:40 +02:00
|
|
|
#include "subtitle_format_ssa.h"
|
2008-07-18 03:36:20 +02:00
|
|
|
#include "subtitle_format_transtation.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "subtitle_format_ttxt.h"
|
|
|
|
#include "subtitle_format_txt.h"
|
2006-02-26 23:45:34 +01:00
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
#include <libaegisub/fs.h>
|
2014-04-23 22:53:24 +02:00
|
|
|
#include <libaegisub/make_unique.h>
|
2014-07-06 16:28:58 +02:00
|
|
|
#include <libaegisub/vfr.h>
|
2012-11-05 17:20:58 +01:00
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
#include <algorithm>
|
|
|
|
#include <boost/algorithm/string/join.hpp>
|
|
|
|
#include <boost/algorithm/string/replace.hpp>
|
2014-05-29 17:28:37 +02:00
|
|
|
#include <wx/choicdlg.h>
|
2013-01-04 16:01:50 +01:00
|
|
|
|
2014-03-09 22:17:56 +01:00
|
|
|
namespace {
|
|
|
|
std::vector<std::unique_ptr<SubtitleFormat>> formats;
|
|
|
|
}
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
SubtitleFormat::SubtitleFormat(std::string name)
|
|
|
|
: name(std::move(name))
|
2011-09-28 21:44:53 +02:00
|
|
|
{
|
2006-02-26 23:45:34 +01:00
|
|
|
}
|
|
|
|
|
2013-10-05 15:58:15 +02:00
|
|
|
bool SubtitleFormat::CanReadFile(agi::fs::path const& filename, std::string const&) const {
|
2013-01-04 16:01:50 +01:00
|
|
|
auto wildcards = GetReadWildcards();
|
|
|
|
return any_of(begin(wildcards), end(wildcards),
|
|
|
|
[&](std::string const& ext) { return agi::fs::HasExtension(filename, ext); });
|
2011-09-28 21:44:53 +02:00
|
|
|
}
|
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
bool SubtitleFormat::CanWriteFile(agi::fs::path const& filename) const {
|
|
|
|
auto wildcards = GetWriteWildcards();
|
|
|
|
return any_of(begin(wildcards), end(wildcards),
|
|
|
|
[&](std::string const& ext) { return agi::fs::HasExtension(filename, ext); });
|
2011-09-28 21:44:53 +02:00
|
|
|
}
|
|
|
|
|
2012-03-29 01:58:40 +02:00
|
|
|
bool SubtitleFormat::CanSave(const AssFile *subs) const {
|
2014-03-07 18:02:24 +01:00
|
|
|
if (!subs->Attachments.empty())
|
|
|
|
return false;
|
2012-03-29 01:58:40 +02:00
|
|
|
|
2014-05-12 17:34:28 +02:00
|
|
|
auto def = boost::flyweight<std::string>("Default");
|
2014-03-07 18:02:24 +01:00
|
|
|
for (auto const& line : subs->Events) {
|
2014-05-12 17:34:28 +02:00
|
|
|
if (line.Style != def || line.GetStrippedText() != line.Text)
|
2014-03-07 18:02:24 +01:00
|
|
|
return false;
|
2012-03-29 01:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-26 16:14:08 +01:00
|
|
|
agi::vfr::Framerate SubtitleFormat::AskForFPS(bool allow_vfr, bool show_smpte, agi::vfr::Framerate const& fps) {
|
2007-06-18 06:03:58 +02:00
|
|
|
wxArrayString choices;
|
2012-03-25 06:05:06 +02:00
|
|
|
|
2014-03-26 16:14:08 +01:00
|
|
|
bool vidLoaded = false;
|
|
|
|
if (fps.IsLoaded()) {
|
|
|
|
vidLoaded = true;
|
|
|
|
if (!fps.IsVFR())
|
2014-05-29 17:28:37 +02:00
|
|
|
choices.Add(fmt_tl("From video (%g)", fps.FPS()));
|
2012-03-29 21:04:36 +02:00
|
|
|
else if (allow_vfr)
|
|
|
|
choices.Add(_("From video (VFR)"));
|
2011-12-22 22:27:53 +01:00
|
|
|
else
|
2012-03-29 21:04:36 +02:00
|
|
|
vidLoaded = false;
|
2007-06-18 06:03:58 +02:00
|
|
|
}
|
2012-03-25 06:05:06 +02:00
|
|
|
|
2007-06-18 06:03:58 +02:00
|
|
|
// Standard FPS values
|
2009-05-13 22:24:21 +02:00
|
|
|
choices.Add(_("15.000 FPS"));
|
|
|
|
choices.Add(_("23.976 FPS (Decimated NTSC)"));
|
|
|
|
choices.Add(_("24.000 FPS (FILM)"));
|
2007-06-18 06:03:58 +02:00
|
|
|
choices.Add(_("25.000 FPS (PAL)"));
|
|
|
|
choices.Add(_("29.970 FPS (NTSC)"));
|
2012-03-29 21:04:36 +02:00
|
|
|
if (show_smpte)
|
2009-05-13 22:24:21 +02:00
|
|
|
choices.Add(_("29.970 FPS (NTSC with SMPTE dropframe)"));
|
|
|
|
choices.Add(_("30.000 FPS"));
|
|
|
|
choices.Add(_("50.000 FPS (PAL x2)"));
|
|
|
|
choices.Add(_("59.940 FPS (NTSC x2)"));
|
|
|
|
choices.Add(_("60.000 FPS"));
|
|
|
|
choices.Add(_("119.880 FPS (NTSC x4)"));
|
|
|
|
choices.Add(_("120.000 FPS"));
|
2007-06-18 06:03:58 +02:00
|
|
|
|
2013-10-06 16:37:35 +02:00
|
|
|
bool was_busy = wxIsBusy();
|
|
|
|
if (was_busy) wxEndBusyCursor();
|
2011-09-28 21:44:53 +02:00
|
|
|
int choice = wxGetSingleChoiceIndex(_("Please choose the appropriate FPS for the subtitles:"), _("FPS"), choices);
|
2013-10-06 16:37:35 +02:00
|
|
|
if (was_busy) wxBeginBusyCursor();
|
2012-03-29 21:04:58 +02:00
|
|
|
|
|
|
|
using agi::vfr::Framerate;
|
2011-12-22 22:27:53 +01:00
|
|
|
if (choice == -1)
|
2012-03-29 21:04:36 +02:00
|
|
|
return Framerate();
|
2007-06-19 07:04:15 +02:00
|
|
|
|
2007-06-18 06:03:58 +02:00
|
|
|
// Get FPS from choice
|
2012-03-29 21:04:36 +02:00
|
|
|
if (vidLoaded)
|
|
|
|
--choice;
|
|
|
|
if (!show_smpte && choice > 4)
|
|
|
|
--choice;
|
2011-12-22 22:27:53 +01:00
|
|
|
|
|
|
|
switch (choice) {
|
2014-03-26 16:14:08 +01:00
|
|
|
case -1: return fps; break;
|
2012-03-29 21:04:36 +02:00
|
|
|
case 0: return Framerate(15, 1); break;
|
|
|
|
case 1: return Framerate(24000, 1001); break;
|
|
|
|
case 2: return Framerate(24, 1); break;
|
|
|
|
case 3: return Framerate(25, 1); break;
|
|
|
|
case 4: return Framerate(30000, 1001); break;
|
|
|
|
case 5: return Framerate(30000, 1001, true); break;
|
|
|
|
case 6: return Framerate(30, 1); break;
|
|
|
|
case 7: return Framerate(50, 1); break;
|
|
|
|
case 8: return Framerate(60000, 1001); break;
|
|
|
|
case 9: return Framerate(60, 1); break;
|
|
|
|
case 10: return Framerate(120000, 1001); break;
|
|
|
|
case 11: return Framerate(120, 1); break;
|
2007-06-18 06:03:58 +02:00
|
|
|
}
|
2014-05-29 14:57:27 +02:00
|
|
|
throw agi::InternalError("Out of bounds result from wxGetSingleChoiceIndex?");
|
2007-06-18 06:03:58 +02:00
|
|
|
}
|
2007-06-19 05:34:53 +02:00
|
|
|
|
2012-10-12 19:16:39 +02:00
|
|
|
void SubtitleFormat::StripTags(AssFile &file) {
|
2014-03-07 19:58:51 +01:00
|
|
|
for (auto& current : file.Events)
|
|
|
|
current.StripTags();
|
2011-11-25 20:28:19 +01:00
|
|
|
}
|
2007-06-19 05:34:53 +02:00
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
void SubtitleFormat::ConvertNewlines(AssFile &file, std::string const& newline, bool mergeLineBreaks) {
|
2014-03-07 19:58:51 +01:00
|
|
|
for (auto& current : file.Events) {
|
|
|
|
std::string repl = current.Text;
|
2013-01-04 16:01:50 +01:00
|
|
|
boost::replace_all(repl, "\\h", " ");
|
|
|
|
boost::ireplace_all(repl, "\\n", newline);
|
2012-11-05 17:20:58 +01:00
|
|
|
if (mergeLineBreaks) {
|
2013-01-04 16:01:50 +01:00
|
|
|
std::string dbl(newline + newline);
|
|
|
|
size_t pos = 0;
|
|
|
|
while ((pos = repl.find(dbl, pos)) != std::string::npos)
|
|
|
|
boost::replace_all(repl, dbl, newline);
|
2007-06-19 05:34:53 +02:00
|
|
|
}
|
2014-03-07 19:58:51 +01:00
|
|
|
current.Text = repl;
|
2007-06-19 05:34:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-12 19:16:39 +02:00
|
|
|
void SubtitleFormat::StripComments(AssFile &file) {
|
2014-03-07 19:58:51 +01:00
|
|
|
file.Events.remove_and_dispose_if([](AssDialogue const& diag) {
|
|
|
|
return diag.Comment || diag.Text.get().empty();
|
|
|
|
}, [](AssDialogue *e) { delete e; });
|
2008-07-18 17:39:34 +02:00
|
|
|
}
|
|
|
|
|
2012-03-25 06:05:06 +02:00
|
|
|
/// @brief Split and merge lines so there are no overlapping lines
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
///
|
2010-01-06 06:23:58 +01:00
|
|
|
/// Algorithm described at http://devel.aegisub.org/wiki/Technical/SplitMerge
|
2012-10-12 19:16:39 +02:00
|
|
|
void SubtitleFormat::RecombineOverlaps(AssFile &file) {
|
2014-03-24 19:43:06 +01:00
|
|
|
auto cur = file.Events.begin();
|
|
|
|
for (auto next = std::next(cur); next != file.Events.end(); cur = std::prev(next)) {
|
|
|
|
if (next == file.Events.begin() || cur->End <= next->Start) {
|
|
|
|
++next;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-28 21:44:53 +02:00
|
|
|
|
2014-03-24 19:43:06 +01:00
|
|
|
std::unique_ptr<AssDialogue> prevdlg(&*cur);
|
|
|
|
std::unique_ptr<AssDialogue> curdlg(&*next);
|
|
|
|
++next;
|
|
|
|
|
|
|
|
auto insert_line = [&](AssDialogue *newdlg) {
|
|
|
|
file.Events.insert(std::find_if(next, file.Events.end(), [&](AssDialogue const& pos) {
|
|
|
|
return pos.Start >= newdlg->Start;
|
|
|
|
}), *newdlg);
|
|
|
|
};
|
2011-09-28 21:44:53 +02:00
|
|
|
|
|
|
|
//Is there an A part before the overlap?
|
|
|
|
if (curdlg->Start > prevdlg->Start) {
|
|
|
|
// Produce new entry with correct values
|
2013-11-21 18:13:36 +01:00
|
|
|
auto newdlg = new AssDialogue(*prevdlg);
|
2011-09-28 21:44:53 +02:00
|
|
|
newdlg->Start = prevdlg->Start;
|
|
|
|
newdlg->End = curdlg->Start;
|
|
|
|
newdlg->Text = prevdlg->Text;
|
2014-03-24 19:43:06 +01:00
|
|
|
insert_line(newdlg);
|
2011-09-28 21:44:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Overlapping A+B part
|
|
|
|
{
|
2013-11-21 18:13:36 +01:00
|
|
|
auto newdlg = new AssDialogue(*prevdlg);
|
2011-09-28 21:44:53 +02:00
|
|
|
newdlg->Start = curdlg->Start;
|
|
|
|
newdlg->End = (prevdlg->End < curdlg->End) ? prevdlg->End : curdlg->End;
|
|
|
|
// Put an ASS format hard linewrap between lines
|
2013-01-04 16:01:50 +01:00
|
|
|
newdlg->Text = curdlg->Text.get() + "\\N" + prevdlg->Text.get();
|
2014-03-24 19:43:06 +01:00
|
|
|
insert_line(newdlg);
|
2011-09-28 21:44:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Is there an A part after the overlap?
|
|
|
|
if (prevdlg->End > curdlg->End) {
|
|
|
|
// Produce new entry with correct values
|
2013-11-21 18:13:36 +01:00
|
|
|
auto newdlg = new AssDialogue(*prevdlg);
|
2011-09-28 21:44:53 +02:00
|
|
|
newdlg->Start = curdlg->End;
|
|
|
|
newdlg->End = prevdlg->End;
|
|
|
|
newdlg->Text = prevdlg->Text;
|
2014-03-24 19:43:06 +01:00
|
|
|
insert_line(newdlg);
|
2008-07-18 17:39:34 +02:00
|
|
|
}
|
2011-09-28 21:44:53 +02:00
|
|
|
|
|
|
|
// Is there a B part after the overlap?
|
|
|
|
if (curdlg->End > prevdlg->End) {
|
|
|
|
// Produce new entry with correct values
|
2013-11-21 18:13:36 +01:00
|
|
|
auto newdlg = new AssDialogue(*prevdlg);
|
2011-09-28 21:44:53 +02:00
|
|
|
newdlg->Start = prevdlg->End;
|
|
|
|
newdlg->End = curdlg->End;
|
|
|
|
newdlg->Text = curdlg->Text;
|
2014-03-24 19:43:06 +01:00
|
|
|
insert_line(newdlg);
|
2011-09-28 21:44:53 +02:00
|
|
|
}
|
2008-07-18 17:39:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-25 06:05:06 +02:00
|
|
|
/// @brief Merge identical lines that follow each other
|
2012-10-12 19:16:39 +02:00
|
|
|
void SubtitleFormat::MergeIdentical(AssFile &file) {
|
2014-03-07 19:58:51 +01:00
|
|
|
auto next = file.Events.begin();
|
|
|
|
auto cur = next++;
|
2012-03-25 06:05:06 +02:00
|
|
|
|
2014-03-07 18:02:24 +01:00
|
|
|
for (; next != file.Events.end(); cur = next++) {
|
2014-03-07 19:58:51 +01:00
|
|
|
if (cur->End == next->Start && cur->Text == next->Text) {
|
2008-07-18 17:39:34 +02:00
|
|
|
// Merge timing
|
2014-03-07 19:58:51 +01:00
|
|
|
next->Start = std::min(next->Start, cur->Start);
|
|
|
|
next->End = std::max(next->End, cur->End);
|
2012-03-25 06:05:06 +02:00
|
|
|
|
2008-07-18 17:39:34 +02:00
|
|
|
// Remove duplicate line
|
2014-03-07 19:58:51 +01:00
|
|
|
delete &*cur;
|
2008-07-18 17:39:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-09-28 21:44:53 +02:00
|
|
|
|
|
|
|
void SubtitleFormat::LoadFormats() {
|
|
|
|
if (formats.empty()) {
|
2014-04-23 22:53:24 +02:00
|
|
|
formats.emplace_back(agi::make_unique<AssSubtitleFormat>());
|
|
|
|
formats.emplace_back(agi::make_unique<Ebu3264SubtitleFormat>());
|
|
|
|
formats.emplace_back(agi::make_unique<EncoreSubtitleFormat>());
|
|
|
|
formats.emplace_back(agi::make_unique<MKVSubtitleFormat>());
|
|
|
|
formats.emplace_back(agi::make_unique<MicroDVDSubtitleFormat>());
|
|
|
|
formats.emplace_back(agi::make_unique<SRTSubtitleFormat>());
|
2014-08-10 15:51:40 +02:00
|
|
|
formats.emplace_back(agi::make_unique<SsaSubtitleFormat>());
|
2014-04-23 22:53:24 +02:00
|
|
|
formats.emplace_back(agi::make_unique<TTXTSubtitleFormat>());
|
|
|
|
formats.emplace_back(agi::make_unique<TXTSubtitleFormat>());
|
|
|
|
formats.emplace_back(agi::make_unique<TranStationSubtitleFormat>());
|
2011-09-28 21:44:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class Cont, class Pred>
|
2012-10-25 15:45:06 +02:00
|
|
|
SubtitleFormat *find_or_throw(Cont &container, Pred pred) {
|
2012-11-04 04:53:03 +01:00
|
|
|
auto it = find_if(container.begin(), container.end(), pred);
|
2011-09-28 21:44:53 +02:00
|
|
|
if (it == container.end())
|
2014-05-29 14:57:27 +02:00
|
|
|
throw UnknownSubtitleFormatError("Subtitle format for extension not found");
|
2014-03-09 22:17:56 +01:00
|
|
|
return it->get();
|
2011-09-28 21:44:53 +02:00
|
|
|
}
|
|
|
|
|
2013-10-05 15:58:15 +02:00
|
|
|
const SubtitleFormat *SubtitleFormat::GetReader(agi::fs::path const& filename, std::string const& encoding) {
|
2011-09-28 21:44:53 +02:00
|
|
|
LoadFormats();
|
2014-03-26 18:36:34 +01:00
|
|
|
return find_or_throw(formats, [&](std::unique_ptr<SubtitleFormat> const& f) {
|
|
|
|
return f->CanReadFile(filename, encoding);
|
|
|
|
});
|
2011-09-28 21:44:53 +02:00
|
|
|
}
|
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
const SubtitleFormat *SubtitleFormat::GetWriter(agi::fs::path const& filename) {
|
2011-09-28 21:44:53 +02:00
|
|
|
LoadFormats();
|
2014-03-26 18:36:34 +01:00
|
|
|
return find_or_throw(formats, [&](std::unique_ptr<SubtitleFormat> const& f) {
|
|
|
|
return f->CanWriteFile(filename);
|
|
|
|
});
|
2011-09-28 21:44:53 +02:00
|
|
|
}
|
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
std::string SubtitleFormat::GetWildcards(int mode) {
|
2011-09-28 21:44:53 +02:00
|
|
|
LoadFormats();
|
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
std::vector<std::string> all;
|
|
|
|
std::string final;
|
2011-09-28 21:44:53 +02:00
|
|
|
|
2014-03-09 22:17:56 +01:00
|
|
|
for (auto const& format : formats) {
|
|
|
|
auto cur = mode == 0 ? format->GetReadWildcards() : format->GetWriteWildcards();
|
2011-09-28 21:44:53 +02:00
|
|
|
if (cur.empty()) continue;
|
|
|
|
|
2014-03-09 22:17:56 +01:00
|
|
|
for (auto& str : cur) str.insert(0, "*.");
|
2013-01-04 16:01:50 +01:00
|
|
|
all.insert(all.end(), begin(cur), end(cur));
|
|
|
|
final += "|" + format->GetName() + " (" + boost::join(cur, ",") + ")|" + boost::join(cur, ";");
|
2011-09-28 21:44:53 +02:00
|
|
|
}
|
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
return from_wx(_("All Supported Formats")) + " (" + boost::join(all, ",") + ")|" + boost::join(all, ";") + final;
|
2011-09-28 21:44:53 +02:00
|
|
|
}
|