Config options for default style catalogs for various formats

This commit is contained in:
Niels Martin Hansen 2014-05-03 21:08:37 +02:00
parent f45f73151e
commit 6b827abec0
5 changed files with 22 additions and 4 deletions

View file

@ -388,6 +388,9 @@
}, },
"Subtitle Format" : { "Subtitle Format" : {
"ASS": {
"Default Style Catalog": "Default"
},
"EBU STL" : { "EBU STL" : {
"Display Standard" : 0, "Display Standard" : 0,
"Inclusive End Times" : true, "Inclusive End Times" : true,
@ -402,6 +405,15 @@
"F" : 0 "F" : 0
}, },
"Translate Alignments" : true "Translate Alignments" : true
},
"SRT": {
"Default Style Catalog": "Default",
},
"TTXT": {
"Default Style Catalog": "Default",
},
"TXT": {
"Default Style Catalog": "Default",
} }
}, },

View file

@ -291,7 +291,7 @@ void SubsController::Close() {
filename.clear(); filename.clear();
AssFile blank; AssFile blank;
blank.swap(*context->ass); blank.swap(*context->ass);
context->ass->LoadDefault(true, config::path->Decode("?user/catalog/Default.sty")); context->ass->LoadDefault(true, config::path->Decode("?user/catalog/" + OPT_GET("Subtitle Format/ASS/Default Style Catalog")->GetString() + ".sty"));
context->ass->Commit("", AssFile::COMMIT_NEW); context->ass->Commit("", AssFile::COMMIT_NEW);
FileOpen(filename); FileOpen(filename);
} }

View file

@ -38,11 +38,13 @@
#include "ass_dialogue.h" #include "ass_dialogue.h"
#include "ass_file.h" #include "ass_file.h"
#include "ass_style.h" #include "ass_style.h"
#include "options.h"
#include "utils.h" #include "utils.h"
#include "text_file_reader.h" #include "text_file_reader.h"
#include "text_file_writer.h" #include "text_file_writer.h"
#include <libaegisub/of_type_adaptor.h> #include <libaegisub/of_type_adaptor.h>
#include <libaegisub/path.h>
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
@ -353,7 +355,7 @@ void SRTSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename,
using namespace std; using namespace std;
TextFileReader file(filename, encoding); TextFileReader file(filename, encoding);
target->LoadDefault(false); target->LoadDefault(false, config::path->Decode("?user/catalog/" + OPT_GET("Subtitle Format/SRT/Default Style Catalog")->GetString() + ".sty"));
// See parsing algorithm at <http://devel.aegisub.org/wiki/SubtitleFormats/SRT> // See parsing algorithm at <http://devel.aegisub.org/wiki/SubtitleFormats/SRT>

View file

@ -42,6 +42,8 @@
#include "compat.h" #include "compat.h"
#include "options.h" #include "options.h"
#include <libaegisub/path.h>
#include <boost/range/adaptor/reversed.hpp> #include <boost/range/adaptor/reversed.hpp>
DEFINE_SIMPLE_EXCEPTION(TTXTParseError, SubtitleFormatParseError, "subtitle_io/parse/ttxt") DEFINE_SIMPLE_EXCEPTION(TTXTParseError, SubtitleFormatParseError, "subtitle_io/parse/ttxt")
@ -62,7 +64,7 @@ std::vector<std::string> TTXTSubtitleFormat::GetWriteWildcards() const {
} }
void TTXTSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const { void TTXTSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const {
target->LoadDefault(false); target->LoadDefault(false, config::path->Decode("?user/catalog/" + OPT_GET("Subtitle Format/TTXT/Default Style Catalog")->GetString() + ".sty"));
// Load XML document // Load XML document
wxXmlDocument doc; wxXmlDocument doc;

View file

@ -43,6 +43,8 @@
#include "utils.h" #include "utils.h"
#include "version.h" #include "version.h"
#include <libaegisub/path.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/trim.hpp> #include <boost/algorithm/string/trim.hpp>
@ -72,7 +74,7 @@ void TXTSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename,
TextFileReader file(filename, encoding, false); TextFileReader file(filename, encoding, false);
target->LoadDefault(false); target->LoadDefault(false, config::path->Decode("?user/catalog/" + OPT_GET("Subtitle Format/TXT/Default Style Catalog")->GetString() + ".sty"));
std::string actor; std::string actor;
std::string separator = OPT_GET("Tool/Import/Text/Actor Separator")->GetString(); std::string separator = OPT_GET("Tool/Import/Text/Actor Separator")->GetString();