forked from mia/Aegisub
Eliminate all unnecessary uses of L and _T
Originally committed to SVN as r5611.
This commit is contained in:
parent
7250b89cbd
commit
d990bbbb99
115 changed files with 1426 additions and 1434 deletions
|
@ -82,13 +82,13 @@ void AegisubLocale::Init(int language) {
|
||||||
locale = new wxLocale(language);
|
locale = new wxLocale(language);
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
locale->AddCatalogLookupPathPrefix(StandardPaths::DecodePath(_T("?data/locale/")));
|
locale->AddCatalogLookupPathPrefix(StandardPaths::DecodePath("?data/locale/"));
|
||||||
locale->AddCatalog(_T("aegisub"));
|
locale->AddCatalog("aegisub");
|
||||||
#else
|
#else
|
||||||
locale->AddCatalog(_T(GETTEXT_PACKAGE));
|
locale->AddCatalog(GETTEXT_PACKAGE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
locale->AddCatalog(_T("wxstd"));
|
locale->AddCatalog("wxstd");
|
||||||
setlocale(LC_NUMERIC, "C");
|
setlocale(LC_NUMERIC, "C");
|
||||||
setlocale(LC_CTYPE, "C");
|
setlocale(LC_CTYPE, "C");
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ int AegisubLocale::PickLanguage() {
|
||||||
if (langs.Count() == 0) return -1;
|
if (langs.Count() == 0) return -1;
|
||||||
|
|
||||||
// Popup
|
// Popup
|
||||||
int picked = wxGetSingleChoiceIndex(_T("Please choose a language:"),_T("Language"),langNames,NULL,-1,-1,true,300,400);
|
int picked = wxGetSingleChoiceIndex("Please choose a language:","Language",langNames,NULL,-1,-1,true,300,400);
|
||||||
if (picked == -1) return -1;
|
if (picked == -1) return -1;
|
||||||
return langs[picked];
|
return langs[picked];
|
||||||
}
|
}
|
||||||
|
@ -140,15 +140,15 @@ wxArrayInt AegisubLocale::GetAvailableLanguages() {
|
||||||
wxString temp1;
|
wxString temp1;
|
||||||
|
|
||||||
// Open directory
|
// Open directory
|
||||||
wxString folder = StandardPaths::DecodePath(_T("?data/locale/"));
|
wxString folder = StandardPaths::DecodePath("?data/locale/");
|
||||||
wxDir dir;
|
wxDir dir;
|
||||||
if (!dir.Exists(folder)) return final;
|
if (!dir.Exists(folder)) return final;
|
||||||
if (!dir.Open(folder)) return final;
|
if (!dir.Open(folder)) return final;
|
||||||
|
|
||||||
// Enumerate folders
|
// Enumerate folders
|
||||||
for (bool cont = dir.GetFirst(&temp1,_T(""),wxDIR_DIRS);cont;cont = dir.GetNext(&temp1)) {
|
for (bool cont = dir.GetFirst(&temp1,"",wxDIR_DIRS);cont;cont = dir.GetNext(&temp1)) {
|
||||||
// Check if .so exists inside folder
|
// Check if .so exists inside folder
|
||||||
wxFileName file(folder + temp1 + _T("/aegisub.mo"));
|
wxFileName file(folder + temp1 + "/aegisub.mo");
|
||||||
if (file.FileExists()) {
|
if (file.FileExists()) {
|
||||||
const wxLanguageInfo *lang = wxLocale::FindLanguageInfo(temp1);
|
const wxLanguageInfo *lang = wxLocale::FindLanguageInfo(temp1);
|
||||||
if (lang) {
|
if (lang) {
|
||||||
|
@ -159,33 +159,33 @@ wxArrayInt AegisubLocale::GetAvailableLanguages() {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
const wchar_t* langs[] = {
|
const char* langs[] = {
|
||||||
_T("ca"),
|
"ca",
|
||||||
_T("cs"),
|
"cs",
|
||||||
_T("da"),
|
"da",
|
||||||
_T("de"),
|
"de",
|
||||||
_T("el"),
|
"el",
|
||||||
_T("es"),
|
"es",
|
||||||
_T("fi"),
|
"fi",
|
||||||
_T("fr_FR"),
|
"fr_FR",
|
||||||
_T("hu"),
|
"hu",
|
||||||
_T("it"),
|
"it",
|
||||||
_T("ja"),
|
"ja",
|
||||||
_T("ko"),
|
"ko",
|
||||||
_T("pt_BR"),
|
"pt_BR",
|
||||||
_T("ru"),
|
"ru",
|
||||||
_T("vi"),
|
"vi",
|
||||||
_T("zh_CN"),
|
"zh_CN",
|
||||||
_T("zh_TW")
|
"zh_TW"
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t len = sizeof(langs)/sizeof(wchar_t*);
|
size_t len = sizeof(langs)/sizeof(char*);
|
||||||
for (size_t i=0; i<len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
const wxLanguageInfo *lang = wxLocale::FindLanguageInfo(langs[i]);
|
const wxLanguageInfo *lang = wxLocale::FindLanguageInfo(langs[i]);
|
||||||
|
|
||||||
// If the locale file doesn't exist then don't list it as an option.
|
// If the locale file doesn't exist then don't list it as an option.
|
||||||
wxString locDir = wxStandardPaths::Get().GetLocalizedResourcesDir(langs[i], wxStandardPathsBase::ResourceCat_Messages);
|
wxString locDir = wxStandardPaths::Get().GetLocalizedResourcesDir(langs[i], wxStandardPathsBase::ResourceCat_Messages);
|
||||||
wxFileName file(wxString::Format(_T("%s/%s.mo"), locDir.c_str(), _T(GETTEXT_PACKAGE)));
|
wxFileName file(wxString::Format("%s/%s.mo", locDir.c_str(), GETTEXT_PACKAGE));
|
||||||
if (lang && file.FileExists()) final.Add(lang->Language);
|
if (lang && file.FileExists()) final.Add(lang->Language);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -57,8 +57,8 @@ AssAttachment::AssAttachment(wxString _name) {
|
||||||
wxFileName fname(GetFileName());
|
wxFileName fname(GetFileName());
|
||||||
wxString ext = fname.GetExt().Lower();
|
wxString ext = fname.GetExt().Lower();
|
||||||
wxString name;
|
wxString name;
|
||||||
if (ext == _T("ttf")) {
|
if (ext == "ttf") {
|
||||||
name = fname.GetName() + _T("_0.") + ext;
|
name = fname.GetName() + "_0." + ext;
|
||||||
}
|
}
|
||||||
else name = _name;
|
else name = _name;
|
||||||
|
|
||||||
|
@ -133,9 +133,9 @@ const wxString AssAttachment::GetEntryData() const {
|
||||||
|
|
||||||
// Write header
|
// Write header
|
||||||
wxString entryData;
|
wxString entryData;
|
||||||
if (group == _T("[Fonts]")) entryData = _T("fontname: ");
|
if (group == "[Fonts]") entryData = "fontname: ";
|
||||||
else entryData = _T("filename: ");
|
else entryData = "filename: ";
|
||||||
entryData += filename + _T("\r\n");
|
entryData += filename + "\r\n";
|
||||||
|
|
||||||
// Read three bytes
|
// Read three bytes
|
||||||
while (pos < size) {
|
while (pos < size) {
|
||||||
|
@ -162,13 +162,13 @@ const wxString AssAttachment::GetEntryData() const {
|
||||||
|
|
||||||
// Convert to text
|
// Convert to text
|
||||||
for (int i=0;i<toWrite;i++) {
|
for (int i=0;i<toWrite;i++) {
|
||||||
entryData += wxChar(dst[i]+33);
|
entryData += dst[i]+33;
|
||||||
written++;
|
written++;
|
||||||
|
|
||||||
// Line break
|
// Line break
|
||||||
if (written == 80 && pos < size) {
|
if (written == 80 && pos < size) {
|
||||||
written = 0;
|
written = 0;
|
||||||
entryData += _T("\r\n");
|
entryData += "\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ void AssAttachment::Import(wxString filename) {
|
||||||
|
|
||||||
// Open file and get size
|
// Open file and get size
|
||||||
wxFileInputStream fp(filename);
|
wxFileInputStream fp(filename);
|
||||||
if (!fp.Ok()) throw _T("Failed opening file");
|
if (!fp.Ok()) throw "Failed opening file";
|
||||||
int size = fp.SeekI(0,wxFromEnd);
|
int size = fp.SeekI(0,wxFromEnd);
|
||||||
fp.SeekI(0,wxFromStart);
|
fp.SeekI(0,wxFromStart);
|
||||||
|
|
||||||
|
@ -218,18 +218,18 @@ void AssAttachment::Import(wxString filename) {
|
||||||
///
|
///
|
||||||
wxString AssAttachment::GetFileName(bool raw) {
|
wxString AssAttachment::GetFileName(bool raw) {
|
||||||
// Raw
|
// Raw
|
||||||
if (raw || filename.Right(4).Lower() != _T(".ttf")) return filename;
|
if (raw || filename.Right(4).Lower() != ".ttf") return filename;
|
||||||
|
|
||||||
// Remove stuff after last underscore if it's a font
|
// Remove stuff after last underscore if it's a font
|
||||||
int lastUnder = -1;
|
int lastUnder = -1;
|
||||||
for (size_t i=0;i<filename.Length();i++) {
|
for (size_t i=0;i<filename.Length();i++) {
|
||||||
if (filename[i] == _T('_')) lastUnder = i;
|
if (filename[i] == '_') lastUnder = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Underline found
|
// Underline found
|
||||||
wxString final = filename;
|
wxString final = filename;
|
||||||
if (lastUnder != -1) {
|
if (lastUnder != -1) {
|
||||||
final = filename.Left(lastUnder) + _T(".ttf");
|
final = filename.Left(lastUnder) + ".ttf";
|
||||||
}
|
}
|
||||||
return final;
|
return final;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,12 +53,12 @@ AssDialogue::AssDialogue()
|
||||||
, Layer(0)
|
, Layer(0)
|
||||||
, Start(0)
|
, Start(0)
|
||||||
, End(5000)
|
, End(5000)
|
||||||
, Style(L"Default")
|
, Style("Default")
|
||||||
, Actor(L"")
|
, Actor("")
|
||||||
, Effect(L"")
|
, Effect("")
|
||||||
, Text(L"")
|
, Text("")
|
||||||
{
|
{
|
||||||
group = L"[Events]";
|
group = "[Events]";
|
||||||
Valid = true;
|
Valid = true;
|
||||||
for (int i=0;i<4;i++) Margin[i] = 0;
|
for (int i=0;i<4;i++) Margin[i] = 0;
|
||||||
}
|
}
|
||||||
|
@ -87,12 +87,12 @@ AssDialogue::AssDialogue(wxString _data,int version)
|
||||||
, Layer(0)
|
, Layer(0)
|
||||||
, Start(0)
|
, Start(0)
|
||||||
, End(5000)
|
, End(5000)
|
||||||
, Style(L"Default")
|
, Style("Default")
|
||||||
, Actor(L"")
|
, Actor("")
|
||||||
, Effect(L"")
|
, Effect("")
|
||||||
, Text(L"")
|
, Text("")
|
||||||
{
|
{
|
||||||
group = L"[Events]";
|
group = "[Events]";
|
||||||
Valid = false;
|
Valid = false;
|
||||||
// Try parsing in different ways
|
// Try parsing in different ways
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -105,7 +105,7 @@ AssDialogue::AssDialogue(wxString _data,int version)
|
||||||
|
|
||||||
// Not valid
|
// Not valid
|
||||||
if (!Valid) {
|
if (!Valid) {
|
||||||
throw _T("Failed parsing line.");
|
throw "Failed parsing line.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,22 +122,22 @@ bool AssDialogue::Parse(wxString rawData, int version) {
|
||||||
wxString temp;
|
wxString temp;
|
||||||
|
|
||||||
// Get type
|
// Get type
|
||||||
if (rawData.StartsWith(_T("Dialogue:"))) {
|
if (rawData.StartsWith("Dialogue:")) {
|
||||||
Comment = false;
|
Comment = false;
|
||||||
pos = 10;
|
pos = 10;
|
||||||
}
|
}
|
||||||
else if (rawData.StartsWith(_T("Comment:"))) {
|
else if (rawData.StartsWith("Comment:")) {
|
||||||
Comment = true;
|
Comment = true;
|
||||||
pos = 9;
|
pos = 9;
|
||||||
}
|
}
|
||||||
else return false;
|
else return false;
|
||||||
|
|
||||||
wxStringTokenizer tkn(rawData.Mid(pos),_T(","),wxTOKEN_RET_EMPTY_ALL);
|
wxStringTokenizer tkn(rawData.Mid(pos),",",wxTOKEN_RET_EMPTY_ALL);
|
||||||
if (!tkn.HasMoreTokens()) return false;
|
if (!tkn.HasMoreTokens()) return false;
|
||||||
|
|
||||||
// Get first token and see if it has "Marked=" in it
|
// Get first token and see if it has "Marked=" in it
|
||||||
temp = tkn.GetNextToken().Trim(false).Trim(true);
|
temp = tkn.GetNextToken().Trim(false).Trim(true);
|
||||||
if (temp.Lower().StartsWith(_T("marked="))) version = 0;
|
if (temp.Lower().StartsWith("marked=")) version = 0;
|
||||||
else if (version == 0) version = 1;
|
else if (version == 0) version = 1;
|
||||||
|
|
||||||
// Get layer number
|
// Get layer number
|
||||||
|
@ -213,14 +213,14 @@ wxString AssDialogue::GetData(bool ssa) const {
|
||||||
wxString s = Style;
|
wxString s = Style;
|
||||||
wxString a = Actor;
|
wxString a = Actor;
|
||||||
wxString e = Effect;
|
wxString e = Effect;
|
||||||
s.Replace(L",",L";");
|
s.Replace(",",";");
|
||||||
a.Replace(L",",L";");
|
a.Replace(",",";");
|
||||||
e.Replace(L",",L";");
|
e.Replace(",",";");
|
||||||
|
|
||||||
wxString str = wxString::Format(
|
wxString str = wxString::Format(
|
||||||
L"%s: %s,%s,%s,%s,%s,%d,%d,%d,%s,%s",
|
"%s: %s,%s,%s,%s,%s,%d,%d,%d,%s,%s",
|
||||||
Comment ? L"Comment" : L"Dialogue",
|
Comment ? "Comment" : "Dialogue",
|
||||||
ssa ? L"Marked=0" : wxString::Format("%01d", Layer).c_str(),
|
ssa ? "Marked=0" : wxString::Format("%01d", Layer).c_str(),
|
||||||
Start.GetASSFormated().c_str(),
|
Start.GetASSFormated().c_str(),
|
||||||
End.GetASSFormated().c_str(),
|
End.GetASSFormated().c_str(),
|
||||||
s.c_str(), a.c_str(),
|
s.c_str(), a.c_str(),
|
||||||
|
@ -229,8 +229,8 @@ wxString AssDialogue::GetData(bool ssa) const {
|
||||||
Text.c_str());
|
Text.c_str());
|
||||||
|
|
||||||
// Make sure that final has no line breaks
|
// Make sure that final has no line breaks
|
||||||
str.Replace(L"\n", "");
|
str.Replace("\n", "");
|
||||||
str.Replace(L"\r", "");
|
str.Replace("\r", "");
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -246,14 +246,14 @@ wxString AssDialogue::GetSSAText () const {
|
||||||
void AssDialogue::ParseSRTTags () {
|
void AssDialogue::ParseSRTTags () {
|
||||||
// Search and replace
|
// Search and replace
|
||||||
size_t total = 0;
|
size_t total = 0;
|
||||||
total += Text.Replace(_T("<i>"),_T("{\\i1}"));
|
total += Text.Replace("<i>","{\\i1}");
|
||||||
total += Text.Replace(_T("</i>"),_T("{\\i0}"));
|
total += Text.Replace("</i>","{\\i0}");
|
||||||
total += Text.Replace(_T("<b>"),_T("{\\b1}"));
|
total += Text.Replace("<b>","{\\b1}");
|
||||||
total += Text.Replace(_T("</b>"),_T("{\\b0}"));
|
total += Text.Replace("</b>","{\\b0}");
|
||||||
total += Text.Replace(_T("<u>"),_T("{\\u1}"));
|
total += Text.Replace("<u>","{\\u1}");
|
||||||
total += Text.Replace(_T("</u>"),_T("{\\u0}"));
|
total += Text.Replace("</u>","{\\u0}");
|
||||||
total += Text.Replace(_T("<s>"),_T("{\\s1}"));
|
total += Text.Replace("<s>","{\\s1}");
|
||||||
total += Text.Replace(_T("</s>"),_T("{\\s0}"));
|
total += Text.Replace("</s>","{\\s0}");
|
||||||
|
|
||||||
// Process <font> tag
|
// Process <font> tag
|
||||||
wxString work = Text;
|
wxString work = Text;
|
||||||
|
@ -266,8 +266,8 @@ void AssDialogue::ParseSRTTags () {
|
||||||
bool isOpen;
|
bool isOpen;
|
||||||
|
|
||||||
// Iterate
|
// Iterate
|
||||||
pos_open = work.find(_T("<FONT"),0);
|
pos_open = work.find("<FONT",0);
|
||||||
pos_close = work.find(_T("</FONT"),0);
|
pos_close = work.find("</FONT",0);
|
||||||
while (pos_open != wxString::npos || pos_close != wxString::npos) {
|
while (pos_open != wxString::npos || pos_close != wxString::npos) {
|
||||||
// Determine if it's an open or close tag
|
// Determine if it's an open or close tag
|
||||||
if (pos_open < pos_close) {
|
if (pos_open < pos_close) {
|
||||||
|
@ -278,7 +278,7 @@ void AssDialogue::ParseSRTTags () {
|
||||||
start = pos_close;
|
start = pos_close;
|
||||||
isOpen = false;
|
isOpen = false;
|
||||||
}
|
}
|
||||||
end = work.find(_T(">"),start)+1;
|
end = work.find(">",start)+1;
|
||||||
//if (end == wxString::npos) continue;
|
//if (end == wxString::npos) continue;
|
||||||
|
|
||||||
// Open tag
|
// Open tag
|
||||||
|
@ -286,17 +286,17 @@ void AssDialogue::ParseSRTTags () {
|
||||||
wxString replaced;
|
wxString replaced;
|
||||||
|
|
||||||
// Color tag
|
// Color tag
|
||||||
if ((pos = work.find(_T("COLOR=\""),start)) != wxString::npos) {
|
if ((pos = work.find("COLOR=\"",start)) != wxString::npos) {
|
||||||
if (pos < end) {
|
if (pos < end) {
|
||||||
pos += 7;
|
pos += 7;
|
||||||
size_t end_tag = Text.find(_T("\""),pos);
|
size_t end_tag = Text.find("\"",pos);
|
||||||
if (end_tag != wxString::npos) {
|
if (end_tag != wxString::npos) {
|
||||||
if (end_tag-pos == 7) {
|
if (end_tag-pos == 7) {
|
||||||
replaced += _T("{\\c&H");
|
replaced += "{\\c&H";
|
||||||
replaced += work.substr(pos+5,2);
|
replaced += work.substr(pos+5,2);
|
||||||
replaced += work.substr(pos+3,2);
|
replaced += work.substr(pos+3,2);
|
||||||
replaced += work.substr(pos+1,2);
|
replaced += work.substr(pos+1,2);
|
||||||
replaced += _T("&}");
|
replaced += "&}";
|
||||||
total++;
|
total++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,28 +304,28 @@ void AssDialogue::ParseSRTTags () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Face tag
|
// Face tag
|
||||||
if ((pos = work.find(_T("FACE=\""),start)) != wxString::npos) {
|
if ((pos = work.find("FACE=\"",start)) != wxString::npos) {
|
||||||
if (pos < end) {
|
if (pos < end) {
|
||||||
pos += 6;
|
pos += 6;
|
||||||
size_t end_tag = work.find(_T("\""),pos);
|
size_t end_tag = work.find("\"",pos);
|
||||||
if (end_tag != wxString::npos) {
|
if (end_tag != wxString::npos) {
|
||||||
replaced += _T("{\\fn");
|
replaced += "{\\fn";
|
||||||
replaced += work.substr(pos,end_tag-pos);
|
replaced += work.substr(pos,end_tag-pos);
|
||||||
replaced += _T("}");
|
replaced += "}";
|
||||||
total++;
|
total++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size tag
|
// Size tag
|
||||||
if ((pos = work.find(_T("SIZE=\""),start)) != wxString::npos) {
|
if ((pos = work.find("SIZE=\"",start)) != wxString::npos) {
|
||||||
if (pos < end) {
|
if (pos < end) {
|
||||||
pos += 6;
|
pos += 6;
|
||||||
size_t end_tag = Text.find(_T("\""),pos);
|
size_t end_tag = Text.find("\"",pos);
|
||||||
if (end_tag != wxString::npos) {
|
if (end_tag != wxString::npos) {
|
||||||
replaced += _T("{\\fs");
|
replaced += "{\\fs";
|
||||||
replaced += work.substr(pos,end_tag-pos);
|
replaced += work.substr(pos,end_tag-pos);
|
||||||
replaced += _T("}");
|
replaced += "}";
|
||||||
total++;
|
total++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,18 +343,18 @@ void AssDialogue::ParseSRTTags () {
|
||||||
// Find if it's italic, bold, underline, and strikeout
|
// Find if it's italic, bold, underline, and strikeout
|
||||||
wxString prev = Text.Left(start);
|
wxString prev = Text.Left(start);
|
||||||
bool isItalic=false,isBold=false,isUnder=false,isStrike=false;
|
bool isItalic=false,isBold=false,isUnder=false,isStrike=false;
|
||||||
if (CountMatches(prev,_T("{\\i1}")) > CountMatches(prev,_T("{\\i0}"))) isItalic = true;
|
if (CountMatches(prev,"{\\i1}") > CountMatches(prev,"{\\i0}")) isItalic = true;
|
||||||
if (CountMatches(prev,_T("{\\b1}")) > CountMatches(prev,_T("{\\b0}"))) isBold = true;
|
if (CountMatches(prev,"{\\b1}") > CountMatches(prev,"{\\b0}")) isBold = true;
|
||||||
if (CountMatches(prev,_T("{\\u1}")) > CountMatches(prev,_T("{\\u0}"))) isUnder = true;
|
if (CountMatches(prev,"{\\u1}") > CountMatches(prev,"{\\u0}")) isUnder = true;
|
||||||
if (CountMatches(prev,_T("{\\s1}")) > CountMatches(prev,_T("{\\s0}"))) isStrike = true;
|
if (CountMatches(prev,"{\\s1}") > CountMatches(prev,"{\\s0}")) isStrike = true;
|
||||||
|
|
||||||
// Generate new tag, by reseting and then restoring flags
|
// Generate new tag, by reseting and then restoring flags
|
||||||
wxString replaced = _T("{\\r");
|
wxString replaced = "{\\r";
|
||||||
if (isItalic) replaced += _T("\\i1");
|
if (isItalic) replaced += "\\i1";
|
||||||
if (isBold) replaced += _T("\\b1");
|
if (isBold) replaced += "\\b1";
|
||||||
if (isUnder) replaced += _T("\\u1");
|
if (isUnder) replaced += "\\u1";
|
||||||
if (isStrike) replaced += _T("\\s1");
|
if (isStrike) replaced += "\\s1";
|
||||||
replaced += _T("}");
|
replaced += "}";
|
||||||
|
|
||||||
// Replace
|
// Replace
|
||||||
//Text = Text.substr(0,start) + replaced + Text.substr(end);
|
//Text = Text.substr(0,start) + replaced + Text.substr(end);
|
||||||
|
@ -366,12 +366,12 @@ void AssDialogue::ParseSRTTags () {
|
||||||
// Get next
|
// Get next
|
||||||
work = Text;
|
work = Text;
|
||||||
work.UpperCase();
|
work.UpperCase();
|
||||||
pos_open = work.find(_T("<FONT"),0);
|
pos_open = work.find("<FONT",0);
|
||||||
pos_close = work.find(_T("</FONT"),0);
|
pos_close = work.find("</FONT",0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove double tagging
|
// Remove double tagging
|
||||||
Text.Replace(_T("}{"),_T(""));
|
Text.Replace("}{","");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssDialogue::ParseASSTags () {
|
void AssDialogue::ParseASSTags () {
|
||||||
|
@ -387,14 +387,14 @@ void AssDialogue::ParseASSTags () {
|
||||||
if (Text[cur] == '{') {
|
if (Text[cur] == '{') {
|
||||||
// Get contents of block
|
// Get contents of block
|
||||||
wxString work;
|
wxString work;
|
||||||
end = Text.find(_T("}"),cur);
|
end = Text.find("}",cur);
|
||||||
if (end == wxString::npos) {
|
if (end == wxString::npos) {
|
||||||
work = Text.substr(cur);
|
work = Text.substr(cur);
|
||||||
end = len;
|
end = len;
|
||||||
}
|
}
|
||||||
else work = Text.substr(cur,end-cur+1);
|
else work = Text.substr(cur,end-cur+1);
|
||||||
|
|
||||||
if (work.Find(_T("\\")) == wxNOT_FOUND) {
|
if (work.Find("\\") == wxNOT_FOUND) {
|
||||||
//We've found an override block with no backslashes
|
//We've found an override block with no backslashes
|
||||||
//We're going to assume it's a comment and not consider it an override block
|
//We're going to assume it's a comment and not consider it an override block
|
||||||
//Currently we'll treat this as a plain text block, but feel free to create a new class
|
//Currently we'll treat this as a plain text block, but feel free to create a new class
|
||||||
|
@ -415,7 +415,7 @@ void AssDialogue::ParseASSTags () {
|
||||||
// Look for \p in block
|
// Look for \p in block
|
||||||
std::vector<AssOverrideTag*>::iterator curTag;
|
std::vector<AssOverrideTag*>::iterator curTag;
|
||||||
for (curTag = block->Tags.begin();curTag != block->Tags.end();curTag++) {
|
for (curTag = block->Tags.begin();curTag != block->Tags.end();curTag++) {
|
||||||
if ((*curTag)->Name == L"\\p") {
|
if ((*curTag)->Name == "\\p") {
|
||||||
drawingLevel = (*curTag)->Params[0]->Get<int>(0);
|
drawingLevel = (*curTag)->Params[0]->Get<int>(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -428,7 +428,7 @@ void AssDialogue::ParseASSTags () {
|
||||||
// Plain-text/drawing block
|
// Plain-text/drawing block
|
||||||
else {
|
else {
|
||||||
wxString work;
|
wxString work;
|
||||||
end = Text.find(_T("{"),cur);
|
end = Text.find("{",cur);
|
||||||
if (end == wxString::npos) {
|
if (end == wxString::npos) {
|
||||||
work = Text.substr(cur);
|
work = Text.substr(cur);
|
||||||
end = len;
|
end = len;
|
||||||
|
@ -457,7 +457,7 @@ void AssDialogue::ParseASSTags () {
|
||||||
// Empty line, make an empty block
|
// Empty line, make an empty block
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
AssDialogueBlockPlain *block = new AssDialogueBlockPlain;
|
AssDialogueBlockPlain *block = new AssDialogueBlockPlain;
|
||||||
block->text = _T("");
|
block->text = "";
|
||||||
Blocks.push_back(block);
|
Blocks.push_back(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -482,7 +482,7 @@ void AssDialogue::StripTag (wxString tagName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert
|
// Insert
|
||||||
if (!temp.IsEmpty()) final += _T("{") + temp + _T("}");
|
if (!temp.IsEmpty()) final += "{" + temp + "}";
|
||||||
}
|
}
|
||||||
else final += (*cur)->GetText();
|
else final += (*cur)->GetText();
|
||||||
}
|
}
|
||||||
|
@ -497,7 +497,7 @@ void AssDialogue::ConvertTagsToSRT () {
|
||||||
AssDialogueBlockOverride* curBlock;
|
AssDialogueBlockOverride* curBlock;
|
||||||
AssDialogueBlockPlain *curPlain;
|
AssDialogueBlockPlain *curPlain;
|
||||||
AssOverrideTag* curTag;
|
AssOverrideTag* curTag;
|
||||||
wxString final = _T("");
|
wxString final = "";
|
||||||
bool isItalic=false,isBold=false,isUnder=false,isStrike=false;
|
bool isItalic=false,isBold=false,isUnder=false,isStrike=false;
|
||||||
bool temp;
|
bool temp;
|
||||||
|
|
||||||
|
@ -511,54 +511,54 @@ void AssDialogue::ConvertTagsToSRT () {
|
||||||
curTag = curBlock->Tags.at(j);
|
curTag = curBlock->Tags.at(j);
|
||||||
if (curTag->IsValid()) {
|
if (curTag->IsValid()) {
|
||||||
// Italics
|
// Italics
|
||||||
if (curTag->Name == _T("\\i")) {
|
if (curTag->Name == "\\i") {
|
||||||
temp = curTag->Params.at(0)->Get<bool>();
|
temp = curTag->Params.at(0)->Get<bool>();
|
||||||
if (temp && !isItalic) {
|
if (temp && !isItalic) {
|
||||||
isItalic = true;
|
isItalic = true;
|
||||||
final += _T("<i>");
|
final += "<i>";
|
||||||
}
|
}
|
||||||
if (!temp && isItalic) {
|
if (!temp && isItalic) {
|
||||||
isItalic = false;
|
isItalic = false;
|
||||||
final += _T("</i>");
|
final += "</i>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Underline
|
// Underline
|
||||||
if (curTag->Name == _T("\\u")) {
|
if (curTag->Name == "\\u") {
|
||||||
temp = curTag->Params.at(0)->Get<bool>();
|
temp = curTag->Params.at(0)->Get<bool>();
|
||||||
if (temp && !isUnder) {
|
if (temp && !isUnder) {
|
||||||
isUnder = true;
|
isUnder = true;
|
||||||
final += _T("<u>");
|
final += "<u>";
|
||||||
}
|
}
|
||||||
if (!temp && isUnder) {
|
if (!temp && isUnder) {
|
||||||
isUnder = false;
|
isUnder = false;
|
||||||
final += _T("</u>");
|
final += "</u>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strikeout
|
// Strikeout
|
||||||
if (curTag->Name == _T("\\s")) {
|
if (curTag->Name == "\\s") {
|
||||||
temp = curTag->Params.at(0)->Get<bool>();
|
temp = curTag->Params.at(0)->Get<bool>();
|
||||||
if (temp && !isStrike) {
|
if (temp && !isStrike) {
|
||||||
isStrike = true;
|
isStrike = true;
|
||||||
final += _T("<s>");
|
final += "<s>";
|
||||||
}
|
}
|
||||||
if (!temp && isStrike) {
|
if (!temp && isStrike) {
|
||||||
isStrike = false;
|
isStrike = false;
|
||||||
final += _T("</s>");
|
final += "</s>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bold
|
// Bold
|
||||||
if (curTag->Name == _T("\\b")) {
|
if (curTag->Name == "\\b") {
|
||||||
temp = curTag->Params.at(0)->Get<bool>();
|
temp = curTag->Params.at(0)->Get<bool>();
|
||||||
if (temp && !isBold) {
|
if (temp && !isBold) {
|
||||||
isBold = true;
|
isBold = true;
|
||||||
final += _T("<b>");
|
final += "<b>";
|
||||||
}
|
}
|
||||||
if (!temp && isBold) {
|
if (!temp && isBold) {
|
||||||
isBold = false;
|
isBold = false;
|
||||||
final += _T("</b>");
|
final += "</b>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -576,13 +576,13 @@ void AssDialogue::ConvertTagsToSRT () {
|
||||||
|
|
||||||
// Ensure all tags are closed
|
// Ensure all tags are closed
|
||||||
if (isBold)
|
if (isBold)
|
||||||
final += _T("</b>");
|
final += "</b>";
|
||||||
if (isItalic)
|
if (isItalic)
|
||||||
final += _T("</i>");
|
final += "</i>";
|
||||||
if (isUnder)
|
if (isUnder)
|
||||||
final += _T("</u>");
|
final += "</u>";
|
||||||
if (isStrike)
|
if (isStrike)
|
||||||
final += _T("</s>");
|
final += "</s>";
|
||||||
|
|
||||||
Text = final;
|
Text = final;
|
||||||
ClearBlocks();
|
ClearBlocks();
|
||||||
|
@ -593,9 +593,9 @@ void AssDialogue::UpdateText () {
|
||||||
Text.clear();
|
Text.clear();
|
||||||
for (std::vector<AssDialogueBlock*>::iterator cur=Blocks.begin();cur!=Blocks.end();cur++) {
|
for (std::vector<AssDialogueBlock*>::iterator cur=Blocks.begin();cur!=Blocks.end();cur++) {
|
||||||
if ((*cur)->GetType() == BLOCK_OVERRIDE) {
|
if ((*cur)->GetType() == BLOCK_OVERRIDE) {
|
||||||
Text += _T("{");
|
Text += "{";
|
||||||
Text += (*cur)->GetText();
|
Text += (*cur)->GetText();
|
||||||
Text += _T("}");
|
Text += "}";
|
||||||
}
|
}
|
||||||
else Text += (*cur)->GetText();
|
else Text += (*cur)->GetText();
|
||||||
}
|
}
|
||||||
|
@ -607,7 +607,7 @@ void AssDialogue::SetMarginString(const wxString origvalue,int which) {
|
||||||
// Make it numeric
|
// Make it numeric
|
||||||
wxString strvalue = origvalue;
|
wxString strvalue = origvalue;
|
||||||
if (!strvalue.IsNumber()) {
|
if (!strvalue.IsNumber()) {
|
||||||
strvalue = _T("");
|
strvalue = "";
|
||||||
for (size_t i=0;i<origvalue.Length();i++) {
|
for (size_t i=0;i<origvalue.Length();i++) {
|
||||||
if (origvalue.Mid(i,1).IsNumber()) {
|
if (origvalue.Mid(i,1).IsNumber()) {
|
||||||
strvalue += origvalue.Mid(i,1);
|
strvalue += origvalue.Mid(i,1);
|
||||||
|
@ -630,8 +630,8 @@ void AssDialogue::SetMarginString(const wxString origvalue,int which) {
|
||||||
wxString AssDialogue::GetMarginString(int which,bool pad) const {
|
wxString AssDialogue::GetMarginString(int which,bool pad) const {
|
||||||
if (which < 0 || which >= 4) throw Aegisub::InvalidMarginIdError();
|
if (which < 0 || which >= 4) throw Aegisub::InvalidMarginIdError();
|
||||||
int value = Margin[which];
|
int value = Margin[which];
|
||||||
if (pad) return wxString::Format(_T("%04i"),value);
|
if (pad) return wxString::Format("%04i",value);
|
||||||
else return wxString::Format(_T("%i"),value);
|
else return wxString::Format("%i",value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssDialogue::ProcessParameters(AssDialogueBlockOverride::ProcessParametersCallback callback,void *userData) {
|
void AssDialogue::ProcessParameters(AssDialogueBlockOverride::ProcessParametersCallback callback,void *userData) {
|
||||||
|
@ -657,9 +657,9 @@ bool AssDialogue::CollidesWith(AssDialogue *target) {
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString AssDialogue::GetStrippedText() const {
|
wxString AssDialogue::GetStrippedText() const {
|
||||||
static wxRegEx reg(_T("\\{[^\\{]*\\}"),wxRE_ADVANCED);
|
static wxRegEx reg("\\{[^\\{]*\\}",wxRE_ADVANCED);
|
||||||
wxString txt(Text);
|
wxString txt(Text);
|
||||||
reg.Replace(&txt,_T(""));
|
reg.Replace(&txt,"");
|
||||||
return txt;
|
return txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,7 +670,7 @@ AssEntry *AssDialogue::Clone() const {
|
||||||
void AssDialogueBlockDrawing::TransformCoords(int mx,int my,double x,double y) {
|
void AssDialogueBlockDrawing::TransformCoords(int mx,int my,double x,double y) {
|
||||||
// HACK: Implement a proper parser ffs!!
|
// HACK: Implement a proper parser ffs!!
|
||||||
// Could use Spline but it'd be slower and this seems to work fine
|
// Could use Spline but it'd be slower and this seems to work fine
|
||||||
wxStringTokenizer tkn(GetText(),_T(" "),wxTOKEN_DEFAULT);
|
wxStringTokenizer tkn(GetText()," ",wxTOKEN_DEFAULT);
|
||||||
wxString cur;
|
wxString cur;
|
||||||
wxString final;
|
wxString final;
|
||||||
bool isX = true;
|
bool isX = true;
|
||||||
|
@ -688,7 +688,7 @@ void AssDialogueBlockDrawing::TransformCoords(int mx,int my,double x,double y) {
|
||||||
else temp = (long int)((temp+my)*y + 0.5);
|
else temp = (long int)((temp+my)*y + 0.5);
|
||||||
|
|
||||||
// Write back to list
|
// Write back to list
|
||||||
final += wxString::Format(_T("%i "),temp);
|
final += wxString::Format("%i ",temp);
|
||||||
|
|
||||||
// Toggle X/Y
|
// Toggle X/Y
|
||||||
isX = !isX;
|
isX = !isX;
|
||||||
|
@ -696,8 +696,8 @@ void AssDialogueBlockDrawing::TransformCoords(int mx,int my,double x,double y) {
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
else {
|
else {
|
||||||
if (cur == _T("m") || cur == _T("n") || cur == _T("l") || cur == _T("b") || cur == _T("s") || cur == _T("p") || cur == _T("c")) isX = true;
|
if (cur == "m" || cur == "n" || cur == "l" || cur == "b" || cur == "s" || cur == "p" || cur == "c") isX = true;
|
||||||
final += cur + _T(" ");
|
final += cur + " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,11 +68,11 @@ AssEntry::~AssEntry() {
|
||||||
///
|
///
|
||||||
wxString AssEntry::GetSSAText() const {
|
wxString AssEntry::GetSSAText() const {
|
||||||
// Special cases
|
// Special cases
|
||||||
if (data.Lower() == _T("[v4+ styles]")) return wxString(_T("[V4 Styles]"));
|
if (data.Lower() == "[v4+ styles]") return wxString("[V4 Styles]");
|
||||||
if (data.Lower() == _T("scripttype: v4.00+")) return wxString(_T("ScriptType: v4.00"));
|
if (data.Lower() == "scripttype: v4.00+") return wxString("ScriptType: v4.00");
|
||||||
if (data.Lower().Left(7) == _T("format:")) {
|
if (data.Lower().Left(7) == "format:") {
|
||||||
if (group.Lower() == _T("[events]")) return wxString(_T("Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"));
|
if (group.Lower() == "[events]") return wxString("Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text");
|
||||||
if (group.Lower() == _T("[v4+ styles]")) return wxString(_T("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding"));
|
if (group.Lower() == "[v4+ styles]") return wxString("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding");
|
||||||
}
|
}
|
||||||
return GetEntryData();
|
return GetEntryData();
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ void AssFile::Load(const wxString &_filename,wxString charset,bool addToRecent)
|
||||||
SubtitleFormat *reader = SubtitleFormat::GetReader(_filename);
|
SubtitleFormat *reader = SubtitleFormat::GetReader(_filename);
|
||||||
|
|
||||||
if (!reader) {
|
if (!reader) {
|
||||||
wxMessageBox(L"Unknown file type","Error loading file",wxICON_ERROR | wxOK);
|
wxMessageBox("Unknown file type","Error loading file",wxICON_ERROR | wxOK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,25 +104,25 @@ void AssFile::Load(const wxString &_filename,wxString charset,bool addToRecent)
|
||||||
catch (agi::UserCancelException const&) {
|
catch (agi::UserCancelException const&) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (const wchar_t *except) {
|
catch (const char *except) {
|
||||||
wxMessageBox(except,_T("Error loading file"),wxICON_ERROR | wxOK);
|
wxMessageBox(except,"Error loading file",wxICON_ERROR | wxOK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (wxString &except) {
|
catch (wxString &except) {
|
||||||
wxMessageBox(except,_T("Error loading file"),wxICON_ERROR | wxOK);
|
wxMessageBox(except,"Error loading file",wxICON_ERROR | wxOK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Real exception
|
// Real exception
|
||||||
catch (agi::Exception &e) {
|
catch (agi::Exception &e) {
|
||||||
wxMessageBox(wxString(e.GetChainedMessage().c_str(), wxConvUTF8), L"Error loading file", wxICON_ERROR|wxOK);
|
wxMessageBox(wxString(e.GetChainedMessage().c_str(), wxConvUTF8), "Error loading file", wxICON_ERROR|wxOK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other error
|
// Other error
|
||||||
catch (...) {
|
catch (...) {
|
||||||
wxMessageBox(_T("Unknown error"),_T("Error loading file"),wxICON_ERROR | wxOK);
|
wxMessageBox("Unknown error","Error loading file",wxICON_ERROR | wxOK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,8 +156,8 @@ void AssFile::Load(const wxString &_filename,wxString charset,bool addToRecent)
|
||||||
|
|
||||||
// Add comments and set vars
|
// Add comments and set vars
|
||||||
AddComment(wxString("Script generated by Aegisub ") + GetAegisubLongVersionString());
|
AddComment(wxString("Script generated by Aegisub ") + GetAegisubLongVersionString());
|
||||||
AddComment(_T("http://www.aegisub.org/"));
|
AddComment("http://www.aegisub.org/");
|
||||||
SetScriptInfo(_T("ScriptType"),_T("v4.00+"));
|
SetScriptInfo("ScriptType","v4.00+");
|
||||||
|
|
||||||
// Push the initial state of the file onto the undo stack
|
// Push the initial state of the file onto the undo stack
|
||||||
UndoStack.clear();
|
UndoStack.clear();
|
||||||
|
@ -195,8 +195,8 @@ void AssFile::Save(wxString filename, bool setfilename, bool addToRecent, wxStri
|
||||||
void AssFile::SaveMemory(std::vector<char> &dst,const wxString encoding) {
|
void AssFile::SaveMemory(std::vector<char> &dst,const wxString encoding) {
|
||||||
// Set encoding
|
// Set encoding
|
||||||
wxString enc = encoding;
|
wxString enc = encoding;
|
||||||
if (enc.IsEmpty()) enc = _T("UTF-8");
|
if (enc.IsEmpty()) enc = "UTF-8";
|
||||||
if (enc != _T("UTF-8")) throw _T("Memory writer only supports UTF-8 for now.");
|
if (enc != "UTF-8") throw "Memory writer only supports UTF-8 for now.";
|
||||||
|
|
||||||
// Check if subs contain at least one style
|
// Check if subs contain at least one style
|
||||||
// Add a default style if they don't for compatibility with libass/asa
|
// Add a default style if they don't for compatibility with libass/asa
|
||||||
|
@ -215,7 +215,7 @@ void AssFile::SaveMemory(std::vector<char> &dst,const wxString encoding) {
|
||||||
wxCharBuffer buffer;
|
wxCharBuffer buffer;
|
||||||
for (cur=Line.begin();cur!=Line.end();cur++) {
|
for (cur=Line.begin();cur!=Line.end();cur++) {
|
||||||
// Convert
|
// Convert
|
||||||
wxString temp = (*cur)->GetEntryData() + _T("\r\n");
|
wxString temp = (*cur)->GetEntryData() + "\r\n";
|
||||||
buffer = temp.mb_str(wxConvUTF8);
|
buffer = temp.mb_str(wxConvUTF8);
|
||||||
lineSize = strlen(buffer);
|
lineSize = strlen(buffer);
|
||||||
|
|
||||||
|
@ -237,16 +237,16 @@ void AssFile::SaveMemory(std::vector<char> &dst,const wxString encoding) {
|
||||||
void AssFile::Export(wxString _filename) {
|
void AssFile::Export(wxString _filename) {
|
||||||
AssExporter exporter(this);
|
AssExporter exporter(this);
|
||||||
exporter.AddAutoFilters();
|
exporter.AddAutoFilters();
|
||||||
exporter.Export(_filename,_T("UTF-8"));
|
exporter.Export(_filename,"UTF-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AssFile::CanSave() {
|
bool AssFile::CanSave() {
|
||||||
// ASS format?
|
// ASS format?
|
||||||
wxString ext = filename.Lower().Right(4);
|
wxString ext = filename.Lower().Right(4);
|
||||||
if (ext == _T(".ass")) return true;
|
if (ext == ".ass") return true;
|
||||||
|
|
||||||
// Never save texts
|
// Never save texts
|
||||||
if (ext == _T(".txt")) return false;
|
if (ext == ".txt") return false;
|
||||||
|
|
||||||
// Check if it's a known extension
|
// Check if it's a known extension
|
||||||
SubtitleFormat *writer = SubtitleFormat::GetWriter(filename);
|
SubtitleFormat *writer = SubtitleFormat::GetWriter(filename);
|
||||||
|
@ -254,7 +254,7 @@ bool AssFile::CanSave() {
|
||||||
|
|
||||||
// Check if format supports timing
|
// Check if format supports timing
|
||||||
bool canTime = true;
|
bool canTime = true;
|
||||||
//if (filename.Lower().Right(4) == _T(".txt")) canTime = false;
|
//if (filename.Lower().Right(4) == ".txt") canTime = false;
|
||||||
|
|
||||||
// Scan through the lines
|
// Scan through the lines
|
||||||
AssStyle defstyle;
|
AssStyle defstyle;
|
||||||
|
@ -305,7 +305,7 @@ void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGro
|
||||||
wxString lowGroup = group.Lower();
|
wxString lowGroup = group.Lower();
|
||||||
|
|
||||||
// Attachment
|
// Attachment
|
||||||
if (lowGroup == _T("[fonts]") || lowGroup == _T("[graphics]")) {
|
if (lowGroup == "[fonts]" || lowGroup == "[graphics]") {
|
||||||
// Check if it's valid data
|
// Check if it's valid data
|
||||||
size_t dataLen = data.Length();
|
size_t dataLen = data.Length();
|
||||||
bool validData = (dataLen > 0) && (dataLen <= 80);
|
bool validData = (dataLen > 0) && (dataLen <= 80);
|
||||||
|
@ -314,7 +314,7 @@ void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGro
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is the filename line?
|
// Is the filename line?
|
||||||
bool isFilename = (data.StartsWith(_T("fontname: ")) || data.StartsWith(_T("filename: ")));
|
bool isFilename = (data.StartsWith("fontname: ") || data.StartsWith("filename: "));
|
||||||
|
|
||||||
// The attachment file is static, since it is built through several calls to this
|
// The attachment file is static, since it is built through several calls to this
|
||||||
// After it's done building, it's reset to NULL
|
// After it's done building, it's reset to NULL
|
||||||
|
@ -361,54 +361,54 @@ void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGro
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dialogue
|
// Dialogue
|
||||||
else if (lowGroup == _T("[events]")) {
|
else if (lowGroup == "[events]") {
|
||||||
if (data.StartsWith(_T("Dialogue:")) || data.StartsWith(_T("Comment:"))) {
|
if (data.StartsWith("Dialogue:") || data.StartsWith("Comment:")) {
|
||||||
AssDialogue *diag = new AssDialogue(data,version);
|
AssDialogue *diag = new AssDialogue(data,version);
|
||||||
//diag->ParseASSTags();
|
//diag->ParseASSTags();
|
||||||
entry = diag;
|
entry = diag;
|
||||||
entry->group = group;
|
entry->group = group;
|
||||||
}
|
}
|
||||||
else if (data.StartsWith(_T("Format:"))) {
|
else if (data.StartsWith("Format:")) {
|
||||||
entry = new AssEntry(_T("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"));
|
entry = new AssEntry("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text");
|
||||||
entry->group = group;
|
entry->group = group;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
else if (lowGroup == _T("[v4+ styles]")) {
|
else if (lowGroup == "[v4+ styles]") {
|
||||||
if (data.StartsWith(_T("Style:"))) {
|
if (data.StartsWith("Style:")) {
|
||||||
AssStyle *style = new AssStyle(data,version);
|
AssStyle *style = new AssStyle(data,version);
|
||||||
entry = style;
|
entry = style;
|
||||||
entry->group = group;
|
entry->group = group;
|
||||||
}
|
}
|
||||||
if (data.StartsWith(_T("Format:"))) {
|
if (data.StartsWith("Format:")) {
|
||||||
entry = new AssEntry(_T("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding"));
|
entry = new AssEntry("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding");
|
||||||
entry->group = group;
|
entry->group = group;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Script info
|
// Script info
|
||||||
else if (lowGroup == _T("[script info]")) {
|
else if (lowGroup == "[script info]") {
|
||||||
// Comment
|
// Comment
|
||||||
if (data.StartsWith(_T(";"))) {
|
if (data.StartsWith(";")) {
|
||||||
// Skip stupid comments added by other programs
|
// Skip stupid comments added by other programs
|
||||||
// Of course, we'll add our own in place later... ;)
|
// Of course, we'll add our own in place later... ;)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Version
|
// Version
|
||||||
if (data.StartsWith(_T("ScriptType:"))) {
|
if (data.StartsWith("ScriptType:")) {
|
||||||
wxString versionString = data.Mid(11);
|
wxString versionString = data.Mid(11);
|
||||||
versionString.Trim(true);
|
versionString.Trim(true);
|
||||||
versionString.Trim(false);
|
versionString.Trim(false);
|
||||||
versionString.MakeLower();
|
versionString.MakeLower();
|
||||||
int trueVersion;
|
int trueVersion;
|
||||||
if (versionString == _T("v4.00")) trueVersion = 0;
|
if (versionString == "v4.00") trueVersion = 0;
|
||||||
else if (versionString == _T("v4.00+")) trueVersion = 1;
|
else if (versionString == "v4.00+") trueVersion = 1;
|
||||||
else if (versionString == _T("v4.00++")) trueVersion = 2;
|
else if (versionString == "v4.00++") trueVersion = 2;
|
||||||
else throw _T("Unknown SSA file format version");
|
else throw "Unknown SSA file format version";
|
||||||
if (trueVersion != version) {
|
if (trueVersion != version) {
|
||||||
if (!(trueVersion == 2 && version == 1)) wxLogMessage(_T("Warning: File has the wrong extension."));
|
if (!(trueVersion == 2 && version == 1)) wxLogMessage("Warning: File has the wrong extension.");
|
||||||
version = trueVersion;
|
version = trueVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -447,25 +447,25 @@ void AssFile::LoadDefault(bool defline) {
|
||||||
// Write headers
|
// Write headers
|
||||||
AssStyle defstyle;
|
AssStyle defstyle;
|
||||||
int version = 1;
|
int version = 1;
|
||||||
AddLine(_T("[Script Info]"),_T("[Script Info]"),version);
|
AddLine("[Script Info]","[Script Info]",version);
|
||||||
AddLine(_T("Title: Default Aegisub file"),_T("[Script Info]"),version);
|
AddLine("Title: Default Aegisub file","[Script Info]",version);
|
||||||
AddLine(_T("ScriptType: v4.00+"),_T("[Script Info]"),version);
|
AddLine("ScriptType: v4.00+","[Script Info]",version);
|
||||||
AddLine(_T("WrapStyle: 0"), _T("[Script Info]"),version);
|
AddLine("WrapStyle: 0", "[Script Info]",version);
|
||||||
AddLine(_T("PlayResX: 640"),_T("[Script Info]"),version);
|
AddLine("PlayResX: 640","[Script Info]",version);
|
||||||
AddLine(_T("PlayResY: 480"),_T("[Script Info]"),version);
|
AddLine("PlayResY: 480","[Script Info]",version);
|
||||||
AddLine(_T("ScaledBorderAndShadow: yes"),_T("[Script Info]"),version);
|
AddLine("ScaledBorderAndShadow: yes","[Script Info]",version);
|
||||||
AddLine(_T("Collisions: Normal"),_T("[Script Info]"),version);
|
AddLine("Collisions: Normal","[Script Info]",version);
|
||||||
AddLine("",_T("[Script Info]"),version);
|
AddLine("","[Script Info]",version);
|
||||||
AddLine(_T("[V4+ Styles]"),_T("[V4+ Styles]"),version);
|
AddLine("[V4+ Styles]","[V4+ Styles]",version);
|
||||||
AddLine(_T("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding"),_T("[V4+ Styles]"),version);
|
AddLine("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding","[V4+ Styles]",version);
|
||||||
AddLine(defstyle.GetEntryData(),_T("[V4+ Styles]"),version);
|
AddLine(defstyle.GetEntryData(),"[V4+ Styles]",version);
|
||||||
AddLine("",_T("[V4+ Styles]"),version);
|
AddLine("","[V4+ Styles]",version);
|
||||||
AddLine(_T("[Events]"),_T("[Events]"),version);
|
AddLine("[Events]","[Events]",version);
|
||||||
AddLine(_T("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"),_T("[Events]"),version);
|
AddLine("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text","[Events]",version);
|
||||||
|
|
||||||
if (defline) {
|
if (defline) {
|
||||||
AssDialogue def;
|
AssDialogue def;
|
||||||
AddLine(def.GetEntryData(),_T("[Events]"),version);
|
AddLine(def.GetEntryData(),"[Events]",version);
|
||||||
}
|
}
|
||||||
|
|
||||||
Commit("", COMMIT_NEW);
|
Commit("", COMMIT_NEW);
|
||||||
|
@ -507,7 +507,7 @@ void AssFile::InsertStyle (AssStyle *style) {
|
||||||
// Look for insert position
|
// Look for insert position
|
||||||
for (cur=Line.begin();cur!=Line.end();cur++) {
|
for (cur=Line.begin();cur!=Line.end();cur++) {
|
||||||
curEntry = *cur;
|
curEntry = *cur;
|
||||||
if (curEntry->GetType() == ENTRY_STYLE || (lastGroup == _T("[V4+ Styles]") && curEntry->GetEntryData().substr(0,7) == _T("Format:"))) {
|
if (curEntry->GetType() == ENTRY_STYLE || (lastGroup == "[V4+ Styles]" && curEntry->GetEntryData().substr(0,7) == "Format:")) {
|
||||||
lastStyle = cur;
|
lastStyle = cur;
|
||||||
}
|
}
|
||||||
lastGroup = curEntry->group;
|
lastGroup = curEntry->group;
|
||||||
|
@ -521,17 +521,17 @@ void AssFile::InsertStyle (AssStyle *style) {
|
||||||
Line.push_back(curEntry);
|
Line.push_back(curEntry);
|
||||||
|
|
||||||
// Add header
|
// Add header
|
||||||
curEntry = new AssEntry(_T("[V4+ Styles]"));
|
curEntry = new AssEntry("[V4+ Styles]");
|
||||||
curEntry->group = _T("[V4+ Styles]");
|
curEntry->group = "[V4+ Styles]";
|
||||||
Line.push_back(curEntry);
|
Line.push_back(curEntry);
|
||||||
|
|
||||||
// Add format line
|
// Add format line
|
||||||
curEntry = new AssEntry(_T("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding"));
|
curEntry = new AssEntry("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding");
|
||||||
curEntry->group = _T("[V4+ Styles]");
|
curEntry->group = "[V4+ Styles]";
|
||||||
Line.push_back(curEntry);
|
Line.push_back(curEntry);
|
||||||
|
|
||||||
// Add style
|
// Add style
|
||||||
style->group = _T("[V4+ Styles]");
|
style->group = "[V4+ Styles]";
|
||||||
Line.push_back(style);
|
Line.push_back(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,20 +590,20 @@ void AssFile::InsertAttachment (wxString filename) {
|
||||||
|
|
||||||
// Insert
|
// Insert
|
||||||
wxString ext = filename.Right(4).Lower();
|
wxString ext = filename.Right(4).Lower();
|
||||||
if (ext == _T(".ttf") || ext == _T(".ttc") || ext == _T(".pfb")) newAttach->group = _T("[Fonts]");
|
if (ext == ".ttf" || ext == ".ttc" || ext == ".pfb") newAttach->group = "[Fonts]";
|
||||||
else newAttach->group = _T("[Graphics]");
|
else newAttach->group = "[Graphics]";
|
||||||
InsertAttachment(newAttach);
|
InsertAttachment(newAttach);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString AssFile::GetScriptInfo(const wxString _key) {
|
wxString AssFile::GetScriptInfo(const wxString _key) {
|
||||||
wxString key = _key;;
|
wxString key = _key;;
|
||||||
key.Lower();
|
key.Lower();
|
||||||
key += _T(":");
|
key += ":";
|
||||||
std::list<AssEntry*>::iterator cur;
|
std::list<AssEntry*>::iterator cur;
|
||||||
bool GotIn = false;
|
bool GotIn = false;
|
||||||
|
|
||||||
for (cur=Line.begin();cur!=Line.end();cur++) {
|
for (cur=Line.begin();cur!=Line.end();cur++) {
|
||||||
if ((*cur)->group == _T("[Script Info]")) {
|
if ((*cur)->group == "[Script Info]") {
|
||||||
GotIn = true;
|
GotIn = true;
|
||||||
wxString curText = (*cur)->GetEntryData();
|
wxString curText = (*cur)->GetEntryData();
|
||||||
curText.Lower();
|
curText.Lower();
|
||||||
|
@ -639,7 +639,7 @@ void AssFile::SetScriptInfo(wxString const& key, wxString const& value) {
|
||||||
bool found_script_info = false;
|
bool found_script_info = false;
|
||||||
|
|
||||||
for (std::list<AssEntry*>::iterator cur = Line.begin(); cur != Line.end(); ++cur) {
|
for (std::list<AssEntry*>::iterator cur = Line.begin(); cur != Line.end(); ++cur) {
|
||||||
if ((*cur)->group == _T("[Script Info]")) {
|
if ((*cur)->group == "[Script Info]") {
|
||||||
found_script_info = true;
|
found_script_info = true;
|
||||||
wxString cur_text = (*cur)->GetEntryData().Left(key_size).Lower();
|
wxString cur_text = (*cur)->GetEntryData().Left(key_size).Lower();
|
||||||
|
|
||||||
|
@ -667,7 +667,7 @@ void AssFile::SetScriptInfo(wxString const& key, wxString const& value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssFile::GetResolution(int &sw,int &sh) {
|
void AssFile::GetResolution(int &sw,int &sh) {
|
||||||
wxString temp = GetScriptInfo(_T("PlayResY"));
|
wxString temp = GetScriptInfo("PlayResY");
|
||||||
if (temp.IsEmpty() || !temp.IsNumber()) {
|
if (temp.IsEmpty() || !temp.IsNumber()) {
|
||||||
sh = 0;
|
sh = 0;
|
||||||
}
|
}
|
||||||
|
@ -677,7 +677,7 @@ void AssFile::GetResolution(int &sw,int &sh) {
|
||||||
sh = templ;
|
sh = templ;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = GetScriptInfo(_T("PlayResX"));
|
temp = GetScriptInfo("PlayResX");
|
||||||
if (temp.IsEmpty() || !temp.IsNumber()) {
|
if (temp.IsEmpty() || !temp.IsNumber()) {
|
||||||
sw = 0;
|
sw = 0;
|
||||||
}
|
}
|
||||||
|
@ -706,17 +706,17 @@ void AssFile::GetResolution(int &sw,int &sh) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssFile::AddComment(const wxString _comment) {
|
void AssFile::AddComment(const wxString _comment) {
|
||||||
wxString comment = _T("; ");
|
wxString comment = "; ";
|
||||||
comment += _comment;
|
comment += _comment;
|
||||||
std::list<AssEntry*>::iterator cur;
|
std::list<AssEntry*>::iterator cur;
|
||||||
int step = 0;
|
int step = 0;
|
||||||
|
|
||||||
for (cur=Line.begin();cur!=Line.end();cur++) {
|
for (cur=Line.begin();cur!=Line.end();cur++) {
|
||||||
// Start of group
|
// Start of group
|
||||||
if (step == 0 && (*cur)->group == _T("[Script Info]")) step = 1;
|
if (step == 0 && (*cur)->group == "[Script Info]") step = 1;
|
||||||
|
|
||||||
// First line after a ;
|
// First line after a ;
|
||||||
else if (step == 1 && !(*cur)->GetEntryData().StartsWith(_T(";"))) {
|
else if (step == 1 && !(*cur)->GetEntryData().StartsWith(";")) {
|
||||||
AssEntry *prev = *cur;
|
AssEntry *prev = *cur;
|
||||||
AssEntry *comm = new AssEntry(comment);
|
AssEntry *comm = new AssEntry(comment);
|
||||||
comm->group = prev->group;
|
comm->group = prev->group;
|
||||||
|
@ -755,7 +755,7 @@ void AssFile::AddToRecent(wxString file) {
|
||||||
|
|
||||||
wxString AssFile::GetWildcardList(int mode) {
|
wxString AssFile::GetWildcardList(int mode) {
|
||||||
if (mode == 0) return SubtitleFormat::GetWildcards(0);
|
if (mode == 0) return SubtitleFormat::GetWildcards(0);
|
||||||
else if (mode == 1) return _T("Advanced Substation Alpha (*.ass)|*.ass");
|
else if (mode == 1) return "Advanced Substation Alpha (*.ass)|*.ass";
|
||||||
else if (mode == 2) return SubtitleFormat::GetWildcards(1);
|
else if (mode == 2) return SubtitleFormat::GetWildcards(1);
|
||||||
else return "";
|
else return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,10 +128,10 @@ public:
|
||||||
/// @param setfilename Should the filename be changed to the passed path?
|
/// @param setfilename Should the filename be changed to the passed path?
|
||||||
/// @param addToRecent Should the file be added to the MRU list?
|
/// @param addToRecent Should the file be added to the MRU list?
|
||||||
/// @param encoding Encoding to use, or empty to let the writer decide (which usually means "App/Save Charset")
|
/// @param encoding Encoding to use, or empty to let the writer decide (which usually means "App/Save Charset")
|
||||||
void Save(wxString file,bool setfilename=false,bool addToRecent=true,const wxString encoding=_T(""));
|
void Save(wxString file,bool setfilename=false,bool addToRecent=true,const wxString encoding="");
|
||||||
/// @brief Save to a memory buffer. Used for subtitle providers which support it
|
/// @brief Save to a memory buffer. Used for subtitle providers which support it
|
||||||
/// @param[out] dst Destination vector
|
/// @param[out] dst Destination vector
|
||||||
void SaveMemory(std::vector<char> &dst,const wxString encoding=_T(""));
|
void SaveMemory(std::vector<char> &dst,const wxString encoding="");
|
||||||
/// @brief Saves exported copy, with effects applied
|
/// @brief Saves exported copy, with effects applied
|
||||||
/// @param file Path to save to; file name is never set to this
|
/// @param file Path to save to; file name is never set to this
|
||||||
void Export(wxString file);
|
void Export(wxString file);
|
||||||
|
|
|
@ -74,21 +74,21 @@ AssDialogueBlockOverride::~AssDialogueBlockOverride() {
|
||||||
void AssDialogueBlockOverride::ParseTags() {
|
void AssDialogueBlockOverride::ParseTags() {
|
||||||
delete_clear(Tags);
|
delete_clear(Tags);
|
||||||
|
|
||||||
wxStringTokenizer tkn(text, L"\\", wxTOKEN_STRTOK);
|
wxStringTokenizer tkn(text, "\\", wxTOKEN_STRTOK);
|
||||||
wxString curTag;
|
wxString curTag;
|
||||||
if (text.StartsWith(L"\\")) curTag = L"\\";
|
if (text.StartsWith("\\")) curTag = "\\";
|
||||||
|
|
||||||
while (tkn.HasMoreTokens()) {
|
while (tkn.HasMoreTokens()) {
|
||||||
curTag += tkn.GetNextToken();
|
curTag += tkn.GetNextToken();
|
||||||
|
|
||||||
// Check for parenthesis matching for \t
|
// Check for parenthesis matching for \t
|
||||||
while (curTag.Freq(L'(') > curTag.Freq(L')') && tkn.HasMoreTokens()) {
|
while (curTag.Freq('(') > curTag.Freq(')') && tkn.HasMoreTokens()) {
|
||||||
curTag << L"\\" << tkn.GetNextToken();
|
curTag << "\\" << tkn.GetNextToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
Tags.push_back(new AssOverrideTag(curTag));
|
Tags.push_back(new AssOverrideTag(curTag));
|
||||||
|
|
||||||
curTag = L"\\";
|
curTag = "\\";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void AssDialogueBlockOverride::AddTag(wxString const& tag) {
|
void AssDialogueBlockOverride::AddTag(wxString const& tag) {
|
||||||
|
@ -149,17 +149,17 @@ static void load_protos() {
|
||||||
|
|
||||||
// Longer tag names must appear before shorter tag names
|
// Longer tag names must appear before shorter tag names
|
||||||
|
|
||||||
proto[0].Set(L"\\alpha", VARDATA_TEXT); // \alpha
|
proto[0].Set("\\alpha", VARDATA_TEXT); // \alpha
|
||||||
proto[++i].Set(L"\\bord", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \bord<depth>
|
proto[++i].Set("\\bord", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \bord<depth>
|
||||||
proto[++i].Set(L"\\xbord", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \xbord<depth>
|
proto[++i].Set("\\xbord", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \xbord<depth>
|
||||||
proto[++i].Set(L"\\ybord", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \ybord<depth>
|
proto[++i].Set("\\ybord", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \ybord<depth>
|
||||||
proto[++i].Set(L"\\shad", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \shad<depth>
|
proto[++i].Set("\\shad", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \shad<depth>
|
||||||
proto[++i].Set(L"\\xshad", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \xshad<depth>
|
proto[++i].Set("\\xshad", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \xshad<depth>
|
||||||
proto[++i].Set(L"\\yshad", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \yshad<depth>
|
proto[++i].Set("\\yshad", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \yshad<depth>
|
||||||
|
|
||||||
// \fade(<a1>,<a2>,<a3>,<t1>,<t2>,<t3>,<t4>)
|
// \fade(<a1>,<a2>,<a3>,<t1>,<t2>,<t3>,<t4>)
|
||||||
i++;
|
i++;
|
||||||
proto[i].name = L"\\fade";
|
proto[i].name = "\\fade";
|
||||||
proto[i].AddParam(VARDATA_INT);
|
proto[i].AddParam(VARDATA_INT);
|
||||||
proto[i].AddParam(VARDATA_INT);
|
proto[i].AddParam(VARDATA_INT);
|
||||||
proto[i].AddParam(VARDATA_INT);
|
proto[i].AddParam(VARDATA_INT);
|
||||||
|
@ -170,7 +170,7 @@ static void load_protos() {
|
||||||
|
|
||||||
// \move(<x1>,<y1>,<x2>,<y2>[,<t1>,<t2>])
|
// \move(<x1>,<y1>,<x2>,<y2>[,<t1>,<t2>])
|
||||||
i++;
|
i++;
|
||||||
proto[i].name = L"\\move";
|
proto[i].name = "\\move";
|
||||||
proto[i].AddParam(VARDATA_FLOAT,PARCLASS_ABSOLUTE_POS_X);
|
proto[i].AddParam(VARDATA_FLOAT,PARCLASS_ABSOLUTE_POS_X);
|
||||||
proto[i].AddParam(VARDATA_FLOAT,PARCLASS_ABSOLUTE_POS_Y);
|
proto[i].AddParam(VARDATA_FLOAT,PARCLASS_ABSOLUTE_POS_Y);
|
||||||
proto[i].AddParam(VARDATA_FLOAT,PARCLASS_ABSOLUTE_POS_X);
|
proto[i].AddParam(VARDATA_FLOAT,PARCLASS_ABSOLUTE_POS_X);
|
||||||
|
@ -181,7 +181,7 @@ static void load_protos() {
|
||||||
// If these are rearranged, keep rect clip and vector clip adjacent in this order
|
// If these are rearranged, keep rect clip and vector clip adjacent in this order
|
||||||
// \clip(<x1>,<y1>,<x2>,<y2>)
|
// \clip(<x1>,<y1>,<x2>,<y2>)
|
||||||
i++;
|
i++;
|
||||||
proto[i].name = L"\\clip";
|
proto[i].name = "\\clip";
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_X);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_X);
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_Y);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_Y);
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_X);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_X);
|
||||||
|
@ -189,13 +189,13 @@ static void load_protos() {
|
||||||
|
|
||||||
// \clip([<scale>,]<some drawings>)
|
// \clip([<scale>,]<some drawings>)
|
||||||
i++;
|
i++;
|
||||||
proto[i].name = L"\\clip";
|
proto[i].name = "\\clip";
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_NORMAL,OPTIONAL_2);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_NORMAL,OPTIONAL_2);
|
||||||
proto[i].AddParam(VARDATA_TEXT,PARCLASS_DRAWING);
|
proto[i].AddParam(VARDATA_TEXT,PARCLASS_DRAWING);
|
||||||
|
|
||||||
// \iclip(<x1>,<y1>,<x2>,<y2>)
|
// \iclip(<x1>,<y1>,<x2>,<y2>)
|
||||||
i++;
|
i++;
|
||||||
proto[i].name = L"\\iclip";
|
proto[i].name = "\\iclip";
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_X);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_X);
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_Y);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_Y);
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_X);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_X);
|
||||||
|
@ -203,71 +203,71 @@ static void load_protos() {
|
||||||
|
|
||||||
// \iclip([<scale>,]<some drawings>)
|
// \iclip([<scale>,]<some drawings>)
|
||||||
i++;
|
i++;
|
||||||
proto[i].name = L"\\iclip";
|
proto[i].name = "\\iclip";
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_NORMAL,OPTIONAL_2);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_NORMAL,OPTIONAL_2);
|
||||||
proto[i].AddParam(VARDATA_TEXT,PARCLASS_DRAWING);
|
proto[i].AddParam(VARDATA_TEXT,PARCLASS_DRAWING);
|
||||||
|
|
||||||
proto[++i].Set(L"\\fscx", VARDATA_FLOAT,PARCLASS_RELATIVE_SIZE_X); // \fscx<percent>
|
proto[++i].Set("\\fscx", VARDATA_FLOAT,PARCLASS_RELATIVE_SIZE_X); // \fscx<percent>
|
||||||
proto[++i].Set(L"\\fscy", VARDATA_FLOAT,PARCLASS_RELATIVE_SIZE_Y); // \fscy<percent>
|
proto[++i].Set("\\fscy", VARDATA_FLOAT,PARCLASS_RELATIVE_SIZE_Y); // \fscy<percent>
|
||||||
// \pos(<x>,<y>)
|
// \pos(<x>,<y>)
|
||||||
i++;
|
i++;
|
||||||
proto[i].name = L"\\pos";
|
proto[i].name = "\\pos";
|
||||||
proto[i].AddParam(VARDATA_FLOAT,PARCLASS_ABSOLUTE_POS_X);
|
proto[i].AddParam(VARDATA_FLOAT,PARCLASS_ABSOLUTE_POS_X);
|
||||||
proto[i].AddParam(VARDATA_FLOAT,PARCLASS_ABSOLUTE_POS_Y);
|
proto[i].AddParam(VARDATA_FLOAT,PARCLASS_ABSOLUTE_POS_Y);
|
||||||
|
|
||||||
// \org(<x>,<y>)
|
// \org(<x>,<y>)
|
||||||
i++;
|
i++;
|
||||||
proto[i].name = L"\\org";
|
proto[i].name = "\\org";
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_X);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_X);
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_Y);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_ABSOLUTE_POS_Y);
|
||||||
|
|
||||||
proto[++i].Set(L"\\pbo", VARDATA_INT,PARCLASS_ABSOLUTE_POS_Y); // \pbo<y>
|
proto[++i].Set("\\pbo", VARDATA_INT,PARCLASS_ABSOLUTE_POS_Y); // \pbo<y>
|
||||||
// \fad(<t1>,<t2>)
|
// \fad(<t1>,<t2>)
|
||||||
i++;
|
i++;
|
||||||
proto[i].name = L"\\fad";
|
proto[i].name = "\\fad";
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_RELATIVE_TIME_START);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_RELATIVE_TIME_START);
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_RELATIVE_TIME_END);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_RELATIVE_TIME_END);
|
||||||
|
|
||||||
proto[++i].Set(L"\\fsp", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \fsp<pixels>
|
proto[++i].Set("\\fsp", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \fsp<pixels>
|
||||||
proto[++i].Set(L"\\frx", VARDATA_FLOAT); // \frx<degrees>
|
proto[++i].Set("\\frx", VARDATA_FLOAT); // \frx<degrees>
|
||||||
proto[++i].Set(L"\\fry", VARDATA_FLOAT); // \fry<degrees>
|
proto[++i].Set("\\fry", VARDATA_FLOAT); // \fry<degrees>
|
||||||
proto[++i].Set(L"\\frz", VARDATA_FLOAT); // \frz<degrees>
|
proto[++i].Set("\\frz", VARDATA_FLOAT); // \frz<degrees>
|
||||||
proto[++i].Set(L"\\fr", VARDATA_FLOAT); // \fr<degrees>
|
proto[++i].Set("\\fr", VARDATA_FLOAT); // \fr<degrees>
|
||||||
proto[++i].Set(L"\\fax", VARDATA_FLOAT); // \fax<factor>
|
proto[++i].Set("\\fax", VARDATA_FLOAT); // \fax<factor>
|
||||||
proto[++i].Set(L"\\fay", VARDATA_FLOAT); // \fay<factor>
|
proto[++i].Set("\\fay", VARDATA_FLOAT); // \fay<factor>
|
||||||
proto[++i].Set(L"\\1c", VARDATA_TEXT); // \1c&H<bbggrr>&
|
proto[++i].Set("\\1c", VARDATA_TEXT); // \1c&H<bbggrr>&
|
||||||
proto[++i].Set(L"\\2c", VARDATA_TEXT); // \2c&H<bbggrr>&
|
proto[++i].Set("\\2c", VARDATA_TEXT); // \2c&H<bbggrr>&
|
||||||
proto[++i].Set(L"\\3c", VARDATA_TEXT); // \3c&H<bbggrr>&
|
proto[++i].Set("\\3c", VARDATA_TEXT); // \3c&H<bbggrr>&
|
||||||
proto[++i].Set(L"\\4c", VARDATA_TEXT); // \4c&H<bbggrr>&
|
proto[++i].Set("\\4c", VARDATA_TEXT); // \4c&H<bbggrr>&
|
||||||
proto[++i].Set(L"\\1a", VARDATA_TEXT); // \1a&H<aa>&
|
proto[++i].Set("\\1a", VARDATA_TEXT); // \1a&H<aa>&
|
||||||
proto[++i].Set(L"\\2a", VARDATA_TEXT); // \2a&H<aa>&
|
proto[++i].Set("\\2a", VARDATA_TEXT); // \2a&H<aa>&
|
||||||
proto[++i].Set(L"\\3a", VARDATA_TEXT); // \3a&H<aa>&
|
proto[++i].Set("\\3a", VARDATA_TEXT); // \3a&H<aa>&
|
||||||
proto[++i].Set(L"\\4a", VARDATA_TEXT); // \4a&H<aa>&
|
proto[++i].Set("\\4a", VARDATA_TEXT); // \4a&H<aa>&
|
||||||
proto[++i].Set(L"\\fe", VARDATA_TEXT); // \fe<charset>
|
proto[++i].Set("\\fe", VARDATA_TEXT); // \fe<charset>
|
||||||
proto[++i].Set(L"\\ko", VARDATA_INT,PARCLASS_KARAOKE); // \ko<duration>
|
proto[++i].Set("\\ko", VARDATA_INT,PARCLASS_KARAOKE); // \ko<duration>
|
||||||
proto[++i].Set(L"\\kf", VARDATA_INT,PARCLASS_KARAOKE); // \kf<duration>
|
proto[++i].Set("\\kf", VARDATA_INT,PARCLASS_KARAOKE); // \kf<duration>
|
||||||
proto[++i].Set(L"\\be", VARDATA_INT); // \be<strength>
|
proto[++i].Set("\\be", VARDATA_INT); // \be<strength>
|
||||||
proto[++i].Set(L"\\blur", VARDATA_FLOAT); // \blur<strength>
|
proto[++i].Set("\\blur", VARDATA_FLOAT); // \blur<strength>
|
||||||
proto[++i].Set(L"\\fn", VARDATA_TEXT); // \fn<name>
|
proto[++i].Set("\\fn", VARDATA_TEXT); // \fn<name>
|
||||||
proto[++i].Set(L"\\fs+", VARDATA_FLOAT); // \fs+<size>
|
proto[++i].Set("\\fs+", VARDATA_FLOAT); // \fs+<size>
|
||||||
proto[++i].Set(L"\\fs-", VARDATA_FLOAT); // \fs-<size>
|
proto[++i].Set("\\fs-", VARDATA_FLOAT); // \fs-<size>
|
||||||
proto[++i].Set(L"\\fs", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \fs<size>
|
proto[++i].Set("\\fs", VARDATA_FLOAT,PARCLASS_ABSOLUTE_SIZE); // \fs<size>
|
||||||
proto[++i].Set(L"\\an", VARDATA_INT); // \an<alignment>
|
proto[++i].Set("\\an", VARDATA_INT); // \an<alignment>
|
||||||
proto[++i].Set(L"\\c", VARDATA_TEXT); // \c&H<bbggrr>&
|
proto[++i].Set("\\c", VARDATA_TEXT); // \c&H<bbggrr>&
|
||||||
proto[++i].Set(L"\\b", VARDATA_INT); // \b<0/1/weight>
|
proto[++i].Set("\\b", VARDATA_INT); // \b<0/1/weight>
|
||||||
proto[++i].Set(L"\\i", VARDATA_BOOL); // \i<0/1>
|
proto[++i].Set("\\i", VARDATA_BOOL); // \i<0/1>
|
||||||
proto[++i].Set(L"\\u", VARDATA_BOOL); // \u<0/1>
|
proto[++i].Set("\\u", VARDATA_BOOL); // \u<0/1>
|
||||||
proto[++i].Set(L"\\s", VARDATA_BOOL); // \s<0/1>
|
proto[++i].Set("\\s", VARDATA_BOOL); // \s<0/1>
|
||||||
proto[++i].Set(L"\\a", VARDATA_INT); // \a<alignment>
|
proto[++i].Set("\\a", VARDATA_INT); // \a<alignment>
|
||||||
proto[++i].Set(L"\\k", VARDATA_INT,PARCLASS_KARAOKE); // \k<duration>
|
proto[++i].Set("\\k", VARDATA_INT,PARCLASS_KARAOKE); // \k<duration>
|
||||||
proto[++i].Set(L"\\K", VARDATA_INT,PARCLASS_KARAOKE); // \K<duration>
|
proto[++i].Set("\\K", VARDATA_INT,PARCLASS_KARAOKE); // \K<duration>
|
||||||
proto[++i].Set(L"\\q", VARDATA_INT); // \q<0-3>
|
proto[++i].Set("\\q", VARDATA_INT); // \q<0-3>
|
||||||
proto[++i].Set(L"\\p", VARDATA_INT); // \p<n>
|
proto[++i].Set("\\p", VARDATA_INT); // \p<n>
|
||||||
proto[++i].Set(L"\\r", VARDATA_TEXT); // \r[<name>]
|
proto[++i].Set("\\r", VARDATA_TEXT); // \r[<name>]
|
||||||
|
|
||||||
// \t([<t1>,<t2>,][<accel>,]<style modifiers>)
|
// \t([<t1>,<t2>,][<accel>,]<style modifiers>)
|
||||||
i++;
|
i++;
|
||||||
proto[i].name = L"\\t";
|
proto[i].name = "\\t";
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_RELATIVE_TIME_START,OPTIONAL_3 | OPTIONAL_4);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_RELATIVE_TIME_START,OPTIONAL_3 | OPTIONAL_4);
|
||||||
proto[i].AddParam(VARDATA_INT,PARCLASS_RELATIVE_TIME_START,OPTIONAL_3 | OPTIONAL_4);
|
proto[i].AddParam(VARDATA_INT,PARCLASS_RELATIVE_TIME_START,OPTIONAL_3 | OPTIONAL_4);
|
||||||
proto[i].AddParam(VARDATA_FLOAT,PARCLASS_NORMAL,OPTIONAL_2 | OPTIONAL_4);
|
proto[i].AddParam(VARDATA_FLOAT,PARCLASS_NORMAL,OPTIONAL_2 | OPTIONAL_4);
|
||||||
|
@ -315,7 +315,7 @@ std::vector<wxString> tokenize(const wxString &text) {
|
||||||
if (text.empty()) {
|
if (text.empty()) {
|
||||||
return paramList;
|
return paramList;
|
||||||
}
|
}
|
||||||
if (text[0] != L'(') {
|
if (text[0] != '(') {
|
||||||
// There's just one parameter (because there's no parentheses)
|
// There's just one parameter (because there's no parentheses)
|
||||||
// This means text is all our parameters
|
// This means text is all our parameters
|
||||||
wxString param(text);
|
wxString param(text);
|
||||||
|
@ -335,12 +335,12 @@ std::vector<wxString> tokenize(const wxString &text) {
|
||||||
while (i < textlen && parDepth > 0) {
|
while (i < textlen && parDepth > 0) {
|
||||||
wxChar c = text[i];
|
wxChar c = text[i];
|
||||||
// parDepth 1 is where we start, and the tag-level we're interested in parsing on
|
// parDepth 1 is where we start, and the tag-level we're interested in parsing on
|
||||||
if (c == L',' && parDepth == 1) break;
|
if (c == ',' && parDepth == 1) break;
|
||||||
if (c == _T('(')) parDepth++;
|
if (c == '(') parDepth++;
|
||||||
else if (c == _T(')')) {
|
else if (c == ')') {
|
||||||
parDepth--;
|
parDepth--;
|
||||||
if (parDepth < 0) {
|
if (parDepth < 0) {
|
||||||
wxLogWarning(L"Unmatched parenthesis near '%s'!\nTag-parsing incomplete.", text.SubString(i, 10).c_str());
|
wxLogWarning("Unmatched parenthesis near '%s'!\nTag-parsing incomplete.", text.SubString(i, 10).c_str());
|
||||||
return paramList;
|
return paramList;
|
||||||
}
|
}
|
||||||
else if (parDepth == 0) {
|
else if (parDepth == 0) {
|
||||||
|
@ -372,7 +372,7 @@ void AssOverrideTag::ParseParameters(const wxString &text, AssOverrideTagProto::
|
||||||
|
|
||||||
int parsFlag = 1 << (totalPars - 1); // Get optional parameters flag
|
int parsFlag = 1 << (totalPars - 1); // Get optional parameters flag
|
||||||
// vector (i)clip is the second clip prototype in the list
|
// vector (i)clip is the second clip prototype in the list
|
||||||
if ((Name == L"\\clip" || Name == L"\\iclip") && totalPars != 4) {
|
if ((Name == "\\clip" || Name == "\\iclip") && totalPars != 4) {
|
||||||
++proto;
|
++proto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ void AssOverrideTag::ParseParameters(const wxString &text, AssOverrideTagProto::
|
||||||
}
|
}
|
||||||
|
|
||||||
wxChar firstChar = curtok[0];
|
wxChar firstChar = curtok[0];
|
||||||
bool auto4 = (firstChar == _T('!') || firstChar == _T('$') || firstChar == _T('%')) && curproto->type != VARDATA_BLOCK;
|
bool auto4 = (firstChar == '!' || firstChar == '$' || firstChar == '%') && curproto->type != VARDATA_BLOCK;
|
||||||
if (auto4) {
|
if (auto4) {
|
||||||
newparam->Set(curtok);
|
newparam->Set(curtok);
|
||||||
}
|
}
|
||||||
|
@ -445,27 +445,27 @@ AssOverrideTag::operator wxString() {
|
||||||
|
|
||||||
// Determine if it needs parentheses
|
// Determine if it needs parentheses
|
||||||
bool parentheses =
|
bool parentheses =
|
||||||
Name == L"\\t" ||
|
Name == "\\t" ||
|
||||||
Name == L"\\pos" ||
|
Name == "\\pos" ||
|
||||||
Name == L"\\fad" ||
|
Name == "\\fad" ||
|
||||||
Name == L"\\org" ||
|
Name == "\\org" ||
|
||||||
Name == L"\\clip" ||
|
Name == "\\clip" ||
|
||||||
Name == L"\\iclip" ||
|
Name == "\\iclip" ||
|
||||||
Name == L"\\move" ||
|
Name == "\\move" ||
|
||||||
Name == L"\\fade";
|
Name == "\\fade";
|
||||||
if (parentheses) result += L"(";
|
if (parentheses) result += "(";
|
||||||
|
|
||||||
// Add parameters
|
// Add parameters
|
||||||
bool any = false;
|
bool any = false;
|
||||||
for (std::vector<AssOverrideParameter*>::iterator cur=Params.begin();cur!=Params.end();cur++) {
|
for (std::vector<AssOverrideParameter*>::iterator cur=Params.begin();cur!=Params.end();cur++) {
|
||||||
if ((*cur)->GetType() != VARDATA_NONE && !(*cur)->omitted) {
|
if ((*cur)->GetType() != VARDATA_NONE && !(*cur)->omitted) {
|
||||||
result += (*cur)->Get<wxString>();
|
result += (*cur)->Get<wxString>();
|
||||||
result += L",";
|
result += ",";
|
||||||
any = true;
|
any = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (any) result = result.Left(result.Length()-1);
|
if (any) result = result.Left(result.Length()-1);
|
||||||
|
|
||||||
if (parentheses) result += L")";
|
if (parentheses) result += ")";
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ AssColor::AssColor (const wxColour &color) {
|
||||||
/// @brief Parse from SSA/ASS
|
/// @brief Parse from SSA/ASS
|
||||||
/// @param value
|
/// @param value
|
||||||
void AssColor::Parse(const wxString value) {
|
void AssColor::Parse(const wxString value) {
|
||||||
if (value.Len() > 0 && value[0] == _T('#')) {
|
if (value.Len() > 0 && value[0] == '#') {
|
||||||
// HTML colour
|
// HTML colour
|
||||||
SetWXColor(wxColor(value));
|
SetWXColor(wxColor(value));
|
||||||
return;
|
return;
|
||||||
|
@ -120,10 +120,10 @@ void AssColor::SetWXColor(const wxColor &color) {
|
||||||
/// @return
|
/// @return
|
||||||
wxString AssColor::GetASSFormatted(bool alpha,bool stripped,bool isStyle) const {
|
wxString AssColor::GetASSFormatted(bool alpha,bool stripped,bool isStyle) const {
|
||||||
wxString work;
|
wxString work;
|
||||||
if (!stripped) work += _T("&H");
|
if (!stripped) work += "&H";
|
||||||
if (alpha) work += wxString::Format(_T("%02X"),a);
|
if (alpha) work += wxString::Format("%02X",a);
|
||||||
work += wxString::Format(_T("%02X%02X%02X"),b,g,r);
|
work += wxString::Format("%02X%02X%02X",b,g,r);
|
||||||
if (!stripped && !isStyle) work += _T("&");
|
if (!stripped && !isStyle) work += "&";
|
||||||
return work;
|
return work;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ wxString AssColor::GetASSFormatted(bool alpha,bool stripped,bool isStyle) const
|
||||||
/// @return
|
/// @return
|
||||||
wxString AssColor::GetSSAFormatted() const {
|
wxString AssColor::GetSSAFormatted() const {
|
||||||
long color = (a<<24)+(b<<16)+(g<<8)+r;
|
long color = (a<<24)+(b<<16)+(g<<8)+r;
|
||||||
wxString output=wxString::Format(_T("%i"),(long)color);
|
wxString output=wxString::Format("%i",(long)color);
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,8 +144,8 @@ bool AssColor::operator!=(const AssColor &col) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
AssStyle::AssStyle()
|
AssStyle::AssStyle()
|
||||||
: name(L"Default")
|
: name("Default")
|
||||||
, font(L"Arial")
|
, font("Arial")
|
||||||
, fontsize(20.)
|
, fontsize(20.)
|
||||||
, primary(255, 255, 255)
|
, primary(255, 255, 255)
|
||||||
, secondary(255, 0, 0)
|
, secondary(255, 0, 0)
|
||||||
|
@ -166,7 +166,7 @@ AssStyle::AssStyle()
|
||||||
, encoding(1)
|
, encoding(1)
|
||||||
, relativeTo(1)
|
, relativeTo(1)
|
||||||
{
|
{
|
||||||
group = L"[V4+ Styles]";
|
group = "[V4+ Styles]";
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
Margin[i] = 10;
|
Margin[i] = 10;
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ AssStyle::AssStyle(const AssStyle& s)
|
||||||
, encoding(s.encoding)
|
, encoding(s.encoding)
|
||||||
, relativeTo(s.relativeTo)
|
, relativeTo(s.relativeTo)
|
||||||
{
|
{
|
||||||
group = L"[V4+ Styles]";
|
group = "[V4+ Styles]";
|
||||||
memcpy(Margin, s.Margin, sizeof(Margin));
|
memcpy(Margin, s.Margin, sizeof(Margin));
|
||||||
SetEntryData(s.GetEntryData());
|
SetEntryData(s.GetEntryData());
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ AssStyle::AssStyle(const AssStyle& s)
|
||||||
AssStyle::AssStyle(wxString _data,int version) {
|
AssStyle::AssStyle(wxString _data,int version) {
|
||||||
Valid = Parse(_data,version);
|
Valid = Parse(_data,version);
|
||||||
if (!Valid) {
|
if (!Valid) {
|
||||||
throw _T("[Error] Failed parsing line.");
|
throw "[Error] Failed parsing line.";
|
||||||
}
|
}
|
||||||
UpdateData();
|
UpdateData();
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ bool AssStyle::Parse(wxString rawData,int version) {
|
||||||
// Tokenize
|
// Tokenize
|
||||||
wxString temp;
|
wxString temp;
|
||||||
long templ;
|
long templ;
|
||||||
wxStringTokenizer tkn(rawData.Trim(false).Mid(6),_T(","),wxTOKEN_RET_EMPTY_ALL);
|
wxStringTokenizer tkn(rawData.Trim(false).Mid(6),",",wxTOKEN_RET_EMPTY_ALL);
|
||||||
|
|
||||||
// Read name
|
// Read name
|
||||||
if (!tkn.HasMoreTokens()) return false;
|
if (!tkn.HasMoreTokens()) return false;
|
||||||
|
@ -424,11 +424,11 @@ bool AssStyle::Parse(wxString rawData,int version) {
|
||||||
void AssStyle::UpdateData() {
|
void AssStyle::UpdateData() {
|
||||||
wxString final;
|
wxString final;
|
||||||
|
|
||||||
name.Replace(_T(","),_T(";"));
|
name.Replace(",",";");
|
||||||
font.Replace(_T(","),_T(";"));
|
font.Replace(",",";");
|
||||||
|
|
||||||
|
|
||||||
final = wxString::Format(_T("Style: %s,%s,%g,%s,%s,%s,%s,%d,%d,%d,%d,%g,%g,%g,%g,%d,%g,%g,%i,%i,%i,%i,%i"),
|
final = wxString::Format("Style: %s,%s,%g,%s,%s,%s,%s,%d,%d,%d,%d,%g,%g,%g,%g,%d,%g,%g,%i,%i,%i,%i,%i",
|
||||||
name.c_str(), font.c_str(), fontsize,
|
name.c_str(), font.c_str(), fontsize,
|
||||||
primary.GetASSFormatted(true,false,true).c_str(),
|
primary.GetASSFormatted(true,false,true).c_str(),
|
||||||
secondary.GetASSFormatted(true,false,true).c_str(),
|
secondary.GetASSFormatted(true,false,true).c_str(),
|
||||||
|
@ -449,7 +449,7 @@ void AssStyle::UpdateData() {
|
||||||
///
|
///
|
||||||
void AssStyle::SetMarginString(const wxString str,int which) {
|
void AssStyle::SetMarginString(const wxString str,int which) {
|
||||||
if (which < 0 || which >= 4) throw Aegisub::InvalidMarginIdError();
|
if (which < 0 || which >= 4) throw Aegisub::InvalidMarginIdError();
|
||||||
if (!str.IsNumber()) throw _T("Invalid margin value");
|
if (!str.IsNumber()) throw "Invalid margin value";
|
||||||
long value;
|
long value;
|
||||||
str.ToLong(&value);
|
str.ToLong(&value);
|
||||||
if (value < 0) value = 0;
|
if (value < 0) value = 0;
|
||||||
|
@ -464,7 +464,7 @@ void AssStyle::SetMarginString(const wxString str,int which) {
|
||||||
///
|
///
|
||||||
wxString AssStyle::GetMarginString(int which) const {
|
wxString AssStyle::GetMarginString(int which) const {
|
||||||
if (which < 0 || which >= 4) throw Aegisub::InvalidMarginIdError();
|
if (which < 0 || which >= 4) throw Aegisub::InvalidMarginIdError();
|
||||||
wxString result = wxString::Format(_T("%04i"),Margin[which]);
|
wxString result = wxString::Format("%04i",Margin[which]);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,11 +486,11 @@ wxString AssStyle::GetSSAText() const {
|
||||||
case 9: align = 7; break;
|
case 9: align = 7; break;
|
||||||
}
|
}
|
||||||
wxString n = name;
|
wxString n = name;
|
||||||
n.Replace(L",", L";");
|
n.Replace(",", ";");
|
||||||
wxString f = font;
|
wxString f = font;
|
||||||
f.Replace(L",", L";");
|
f.Replace(",", ";");
|
||||||
|
|
||||||
output = wxString::Format(_T("Style: %s,%s,%g,%s,%s,0,%s,%d,%d,%d,%g,%g,%d,%d,%d,%d,0,%i"),
|
output = wxString::Format("Style: %s,%s,%g,%s,%s,0,%s,%d,%d,%d,%g,%g,%d,%d,%d,%d,0,%i",
|
||||||
n.c_str(), f.c_str(), fontsize,
|
n.c_str(), f.c_str(), fontsize,
|
||||||
primary.GetSSAFormatted().c_str(),
|
primary.GetSSAFormatted().c_str(),
|
||||||
secondary.GetSSAFormatted().c_str(),
|
secondary.GetSSAFormatted().c_str(),
|
||||||
|
@ -554,25 +554,25 @@ bool AssStyle::IsEqualTo(AssStyle *style) const {
|
||||||
///
|
///
|
||||||
void AssStyle::GetEncodings(wxArrayString &encodingStrings) {
|
void AssStyle::GetEncodings(wxArrayString &encodingStrings) {
|
||||||
encodingStrings.Clear();
|
encodingStrings.Clear();
|
||||||
encodingStrings.Add(wxString(_T("0 - ")) + _("ANSI"));
|
encodingStrings.Add(wxString("0 - ") + _("ANSI"));
|
||||||
encodingStrings.Add(wxString(_T("1 - ")) + _("Default"));
|
encodingStrings.Add(wxString("1 - ") + _("Default"));
|
||||||
encodingStrings.Add(wxString(_T("2 - ")) + _("Symbol"));
|
encodingStrings.Add(wxString("2 - ") + _("Symbol"));
|
||||||
encodingStrings.Add(wxString(_T("77 - ")) + _("Mac"));
|
encodingStrings.Add(wxString("77 - ") + _("Mac"));
|
||||||
encodingStrings.Add(wxString(_T("128 - ")) + _("Shift_JIS"));
|
encodingStrings.Add(wxString("128 - ") + _("Shift_JIS"));
|
||||||
encodingStrings.Add(wxString(_T("129 - ")) + _("Hangeul"));
|
encodingStrings.Add(wxString("129 - ") + _("Hangeul"));
|
||||||
encodingStrings.Add(wxString(_T("130 - ")) + _("Johab"));
|
encodingStrings.Add(wxString("130 - ") + _("Johab"));
|
||||||
encodingStrings.Add(wxString(_T("134 - ")) + _("GB2312"));
|
encodingStrings.Add(wxString("134 - ") + _("GB2312"));
|
||||||
encodingStrings.Add(wxString(_T("136 - ")) + _("Chinese BIG5"));
|
encodingStrings.Add(wxString("136 - ") + _("Chinese BIG5"));
|
||||||
encodingStrings.Add(wxString(_T("161 - ")) + _("Greek"));
|
encodingStrings.Add(wxString("161 - ") + _("Greek"));
|
||||||
encodingStrings.Add(wxString(_T("162 - ")) + _("Turkish"));
|
encodingStrings.Add(wxString("162 - ") + _("Turkish"));
|
||||||
encodingStrings.Add(wxString(_T("163 - ")) + _("Vietnamese"));
|
encodingStrings.Add(wxString("163 - ") + _("Vietnamese"));
|
||||||
encodingStrings.Add(wxString(_T("177 - ")) + _("Hebrew"));
|
encodingStrings.Add(wxString("177 - ") + _("Hebrew"));
|
||||||
encodingStrings.Add(wxString(_T("178 - ")) + _("Arabic"));
|
encodingStrings.Add(wxString("178 - ") + _("Arabic"));
|
||||||
encodingStrings.Add(wxString(_T("186 - ")) + _("Baltic"));
|
encodingStrings.Add(wxString("186 - ") + _("Baltic"));
|
||||||
encodingStrings.Add(wxString(_T("204 - ")) + _("Russian"));
|
encodingStrings.Add(wxString("204 - ") + _("Russian"));
|
||||||
encodingStrings.Add(wxString(_T("222 - ")) + _("Thai"));
|
encodingStrings.Add(wxString("222 - ") + _("Thai"));
|
||||||
encodingStrings.Add(wxString(_T("238 - ")) + _("East European"));
|
encodingStrings.Add(wxString("238 - ") + _("East European"));
|
||||||
encodingStrings.Add(wxString(_T("255 - ")) + _("OEM"));
|
encodingStrings.Add(wxString("255 - ") + _("OEM"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
void AssStyleStorage::Save(wxString name) {
|
void AssStyleStorage::Save(wxString name) {
|
||||||
if (name.IsEmpty()) return;
|
if (name.IsEmpty()) return;
|
||||||
|
|
||||||
TextFileWriter file(StandardPaths::DecodePath(_T("?user/catalog/")+name+_T(".sty")), _T("UTF-8"));
|
TextFileWriter file(StandardPaths::DecodePath("?user/catalog/"+name+".sty"), "UTF-8");
|
||||||
|
|
||||||
for (std::list<AssStyle*>::iterator cur=style.begin();cur!=style.end();cur++) {
|
for (std::list<AssStyle*>::iterator cur=style.begin();cur!=style.end();cur++) {
|
||||||
file.WriteLineToFile((*cur)->GetEntryData());
|
file.WriteLineToFile((*cur)->GetEntryData());
|
||||||
|
@ -75,12 +75,12 @@ void AssStyleStorage::Load(wxString name) {
|
||||||
if (name.IsEmpty()) return;
|
if (name.IsEmpty()) return;
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
TextFileReader file(StandardPaths::DecodePath(_T("?user/catalog/")+name+_T(".sty")), _T("UTF-8"));
|
TextFileReader file(StandardPaths::DecodePath("?user/catalog/"+name+".sty"), "UTF-8");
|
||||||
|
|
||||||
AssStyle *curStyle;
|
AssStyle *curStyle;
|
||||||
while (file.HasMoreLines()) {
|
while (file.HasMoreLines()) {
|
||||||
wxString data = file.ReadLineFromFile();
|
wxString data = file.ReadLineFromFile();
|
||||||
if (data.substr(0,6) == _T("Style:")) {
|
if (data.substr(0,6) == "Style:") {
|
||||||
try {
|
try {
|
||||||
curStyle = new AssStyle(data);
|
curStyle = new AssStyle(data);
|
||||||
style.push_back(curStyle);
|
style.push_back(curStyle);
|
||||||
|
|
|
@ -71,13 +71,13 @@ void AssTime::ParseASS (const wxString text) {
|
||||||
// Count the number of colons
|
// Count the number of colons
|
||||||
size_t len = text.Length();
|
size_t len = text.Length();
|
||||||
int colons = 0;
|
int colons = 0;
|
||||||
for (pos=0;pos<len;pos++) if (text[pos] == _T(':')) colons++;
|
for (pos=0;pos<len;pos++) if (text[pos] == ':') colons++;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
||||||
// Set start so that there are only two colons at most
|
// Set start so that there are only two colons at most
|
||||||
if (colons > 2) {
|
if (colons > 2) {
|
||||||
for (pos=0;pos<len;pos++) {
|
for (pos=0;pos<len;pos++) {
|
||||||
if (text[pos] == _T(':')) {
|
if (text[pos] == ':') {
|
||||||
colons--;
|
colons--;
|
||||||
if (colons == 2) break;
|
if (colons == 2) break;
|
||||||
}
|
}
|
||||||
|
@ -89,14 +89,14 @@ void AssTime::ParseASS (const wxString text) {
|
||||||
try {
|
try {
|
||||||
// Hours
|
// Hours
|
||||||
if (colons == 2) {
|
if (colons == 2) {
|
||||||
while (text[end++] != _T(':')) {};
|
while (text[end++] != ':') {};
|
||||||
th = AegiStringToInt(text,pos,end);
|
th = AegiStringToInt(text,pos,end);
|
||||||
pos = end;
|
pos = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Minutes
|
// Minutes
|
||||||
if (colons >= 1) {
|
if (colons >= 1) {
|
||||||
while (text[end++] != _T(':')) {};
|
while (text[end++] != ':') {};
|
||||||
tm = AegiStringToInt(text,pos,end);
|
tm = AegiStringToInt(text,pos,end);
|
||||||
pos = end;
|
pos = end;
|
||||||
}
|
}
|
||||||
|
@ -183,8 +183,8 @@ wxString AssTime::GetASSFormated (bool msPrecision) const {
|
||||||
int s = (ms / 1000) % 60;
|
int s = (ms / 1000) % 60;
|
||||||
ms = ms % 1000;
|
ms = ms % 1000;
|
||||||
|
|
||||||
if (msPrecision) return wxString::Format(_T("%01i:%02i:%02i.%03i"),h,m,s,ms);
|
if (msPrecision) return wxString::Format("%01i:%02i:%02i.%03i",h,m,s,ms);
|
||||||
else return wxString::Format(_T("%01i:%02i:%02i.%02i"),h,m,s,ms/10);
|
else return wxString::Format("%01i:%02i:%02i.%02i",h,m,s,ms/10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ wxString AssTime::GetSRTFormated () {
|
||||||
}
|
}
|
||||||
ms = _ms;
|
ms = _ms;
|
||||||
|
|
||||||
wxString result = wxString::Format(_T("%02i:%02i:%02i,%03i"),h,m,s,ms);
|
wxString result = wxString::Format("%02i:%02i:%02i,%03i",h,m,s,ms);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,9 +358,9 @@ FractionalTime::FractionalTime (wxString separator, int numerator, int denominat
|
||||||
|
|
||||||
// fractions < 1 are not welcome here
|
// fractions < 1 are not welcome here
|
||||||
if ((num <= 0 || den <= 0) || (num < den))
|
if ((num <= 0 || den <= 0) || (num < den))
|
||||||
throw _T("FractionalTime: nonsensical enumerator or denominator");
|
throw "FractionalTime: nonsensical enumerator or denominator";
|
||||||
if (sep.IsEmpty())
|
if (sep.IsEmpty())
|
||||||
throw _T("FractionalTime: no separator specified");
|
throw "FractionalTime: no separator specified";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -377,17 +377,17 @@ FractionalTime::~FractionalTime () {
|
||||||
///
|
///
|
||||||
int FractionalTime::ToMillisecs (wxString _text) {
|
int FractionalTime::ToMillisecs (wxString _text) {
|
||||||
wxString text = _text;
|
wxString text = _text;
|
||||||
wxString re_str = _T("");
|
wxString re_str = "";
|
||||||
text.Trim(false);
|
text.Trim(false);
|
||||||
text.Trim(true);
|
text.Trim(true);
|
||||||
long h=0,m=0,s=0,f=0;
|
long h=0,m=0,s=0,f=0;
|
||||||
|
|
||||||
// hour minute second fraction
|
// hour minute second fraction
|
||||||
re_str << _T("(\\d+)") << sep << _T("(\\d+)") << sep << _T("(\\d+)") << sep << _T("(\\d+)");
|
re_str << "(\\d+)" << sep << "(\\d+)" << sep << "(\\d+)" << sep << "(\\d+)";
|
||||||
|
|
||||||
wxRegEx re(re_str, wxRE_ADVANCED);
|
wxRegEx re(re_str, wxRE_ADVANCED);
|
||||||
if (!re.IsValid())
|
if (!re.IsValid())
|
||||||
throw _T("FractionalTime: regex failure");
|
throw "FractionalTime: regex failure";
|
||||||
if (!re.Matches(text))
|
if (!re.Matches(text))
|
||||||
return 0; // FIXME: throw here too?
|
return 0; // FIXME: throw here too?
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ wxString FractionalTime::FromMillisecs(int64_t msec) {
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN:
|
RETURN:
|
||||||
return wxString::Format(_T("%02i") + sep + _T("%02i") + sep + _T("%02i") + sep + _T("%02i"),h,m,s,f);
|
return wxString::Format("%02i" + sep + "%02i" + sep + "%02i" + sep + "%02i",h,m,s,f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,7 @@ void AudioController::OpenAudio(const wxString &url)
|
||||||
|
|
||||||
wxString path_part;
|
wxString path_part;
|
||||||
|
|
||||||
if (url.StartsWith(_T("dummy-audio:"), &path_part))
|
if (url.StartsWith("dummy-audio:", &path_part))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* scheme ::= "dummy-audio" ":" signal-specifier "?" signal-parameters
|
* scheme ::= "dummy-audio" ":" signal-specifier "?" signal-parameters
|
||||||
|
@ -226,9 +226,9 @@ void AudioController::OpenAudio(const wxString &url)
|
||||||
* in every channel even if one would be LFE.
|
* in every channel even if one would be LFE.
|
||||||
* "ln", length of signal in samples. ln/sr gives signal length in seconds.
|
* "ln", length of signal in samples. ln/sr gives signal length in seconds.
|
||||||
*/
|
*/
|
||||||
provider = new DummyAudioProvider(5*30*60*1000, path_part.StartsWith(L"noise"));
|
provider = new DummyAudioProvider(5*30*60*1000, path_part.StartsWith("noise"));
|
||||||
}
|
}
|
||||||
else if (url.StartsWith(_T("video-audio:"), &path_part))
|
else if (url.StartsWith("video-audio:", &path_part))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* scheme ::= "video-audio" ":" stream-type
|
* scheme ::= "video-audio" ":" stream-type
|
||||||
|
@ -244,7 +244,7 @@ void AudioController::OpenAudio(const wxString &url)
|
||||||
* stream has to be decoded and stored.
|
* stream has to be decoded and stored.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else if (url.StartsWith(_T("file:"), &path_part))
|
else if (url.StartsWith("file:", &path_part))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* scheme ::= "file" ":" "//" file-system-path
|
* scheme ::= "file" ":" "//" file-system-path
|
||||||
|
|
|
@ -252,7 +252,7 @@ public:
|
||||||
int GetHeight() const
|
int GetHeight() const
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
display->GetTextExtent(_T("0123456789:."), &width, &height);
|
display->GetTextExtent("0123456789:.", &width, &height);
|
||||||
return height + 4;
|
return height + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,21 +397,21 @@ public:
|
||||||
|
|
||||||
if (changed_hour)
|
if (changed_hour)
|
||||||
{
|
{
|
||||||
time_string = wxString::Format(_T("%d:%02d:"), mark_hour, mark_minute);
|
time_string = wxString::Format("%d:%02d:", mark_hour, mark_minute);
|
||||||
last_hour = mark_hour;
|
last_hour = mark_hour;
|
||||||
last_minute = mark_minute;
|
last_minute = mark_minute;
|
||||||
}
|
}
|
||||||
else if (changed_minute)
|
else if (changed_minute)
|
||||||
{
|
{
|
||||||
time_string = wxString::Format(_T("%d:"), mark_minute);
|
time_string = wxString::Format("%d:", mark_minute);
|
||||||
last_minute = mark_minute;
|
last_minute = mark_minute;
|
||||||
}
|
}
|
||||||
if (scale_minor >= Sc_Decisecond)
|
if (scale_minor >= Sc_Decisecond)
|
||||||
time_string += wxString::Format(_T("%02d"), (int)mark_second);
|
time_string += wxString::Format("%02d", (int)mark_second);
|
||||||
else if (scale_minor == Sc_Centisecond)
|
else if (scale_minor == Sc_Centisecond)
|
||||||
time_string += wxString::Format(_T("%02.1f"), mark_second);
|
time_string += wxString::Format("%02.1f", mark_second);
|
||||||
else
|
else
|
||||||
time_string += wxString::Format(_T("%02.2f"), mark_second);
|
time_string += wxString::Format("%02.2f", mark_second);
|
||||||
|
|
||||||
int tw, th;
|
int tw, th;
|
||||||
dc.GetTextExtent(time_string, &tw, &th);
|
dc.GetTextExtent(time_string, &tw, &th);
|
||||||
|
|
|
@ -100,7 +100,7 @@ void AudioPlayer::OnStopAudio(wxCommandEvent &event) {
|
||||||
///
|
///
|
||||||
AudioPlayer* AudioPlayerFactory::GetAudioPlayer() {
|
AudioPlayer* AudioPlayerFactory::GetAudioPlayer() {
|
||||||
std::vector<std::string> list = GetClasses(OPT_GET("Audio/Player")->GetString());
|
std::vector<std::string> list = GetClasses(OPT_GET("Audio/Player")->GetString());
|
||||||
if (list.empty()) throw _T("No audio players are available.");
|
if (list.empty()) throw "No audio players are available.";
|
||||||
|
|
||||||
wxString error;
|
wxString error;
|
||||||
for (unsigned int i=0;i<list.size();i++) {
|
for (unsigned int i=0;i<list.size();i++) {
|
||||||
|
@ -108,9 +108,9 @@ AudioPlayer* AudioPlayerFactory::GetAudioPlayer() {
|
||||||
AudioPlayer *player = Create(list[i]);
|
AudioPlayer *player = Create(list[i]);
|
||||||
if (player) return player;
|
if (player) return player;
|
||||||
}
|
}
|
||||||
catch (wxString err) { error += list[i] + _T(" factory: ") + err + _T("\n"); }
|
catch (wxString err) { error += list[i] + " factory: " + err + "\n"; }
|
||||||
catch (const wxChar *err) { error += list[i] + _T(" factory: ") + wxString(err) + _T("\n"); }
|
catch (const wxChar *err) { error += list[i] + " factory: " + wxString(err) + "\n"; }
|
||||||
catch (...) { error += list[i] + _T(" factory: Unknown error\n"); }
|
catch (...) { error += list[i] + " factory: Unknown error\n"; }
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ void DirectSoundPlayer::OpenStream() {
|
||||||
// Initialize the DirectSound object
|
// Initialize the DirectSound object
|
||||||
HRESULT res;
|
HRESULT res;
|
||||||
res = DirectSoundCreate8(&DSDEVID_DefaultPlayback,&directSound,NULL); // TODO: support selecting audio device
|
res = DirectSoundCreate8(&DSDEVID_DefaultPlayback,&directSound,NULL); // TODO: support selecting audio device
|
||||||
if (FAILED(res)) throw _T("Failed initializing DirectSound");
|
if (FAILED(res)) throw "Failed initializing DirectSound";
|
||||||
|
|
||||||
// Set DirectSound parameters
|
// Set DirectSound parameters
|
||||||
AegisubApp *app = (AegisubApp*) wxTheApp;
|
AegisubApp *app = (AegisubApp*) wxTheApp;
|
||||||
|
@ -107,11 +107,11 @@ void DirectSoundPlayer::OpenStream() {
|
||||||
// Create the buffer
|
// Create the buffer
|
||||||
IDirectSoundBuffer *buf;
|
IDirectSoundBuffer *buf;
|
||||||
res = directSound->CreateSoundBuffer(&desc,&buf,NULL);
|
res = directSound->CreateSoundBuffer(&desc,&buf,NULL);
|
||||||
if (res != DS_OK) throw _T("Failed creating DirectSound buffer");
|
if (res != DS_OK) throw "Failed creating DirectSound buffer";
|
||||||
|
|
||||||
// Copy interface to buffer
|
// Copy interface to buffer
|
||||||
res = buf->QueryInterface(IID_IDirectSoundBuffer8,(LPVOID*) &buffer);
|
res = buf->QueryInterface(IID_IDirectSoundBuffer8,(LPVOID*) &buffer);
|
||||||
if (res != S_OK) throw _T("Failed casting interface to IDirectSoundBuffer8");
|
if (res != S_OK) throw "Failed casting interface to IDirectSoundBuffer8";
|
||||||
|
|
||||||
// Set data
|
// Set data
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
|
@ -199,7 +199,7 @@ class DirectSoundPlayer2Thread {
|
||||||
Win32KernelHandle error_happened;
|
Win32KernelHandle error_happened;
|
||||||
|
|
||||||
/// Statically allocated error message text describing reason for error_happened being set
|
/// Statically allocated error message text describing reason for error_happened being set
|
||||||
const wxChar *error_message;
|
const char *error_message;
|
||||||
|
|
||||||
/// Playback volume, 1.0 is "unchanged"
|
/// Playback volume, 1.0 is "unchanged"
|
||||||
double volume;
|
double volume;
|
||||||
|
@ -261,7 +261,7 @@ void DirectSoundPlayer2Thread::Run()
|
||||||
{
|
{
|
||||||
|
|
||||||
/// Macro used to set error_message, error_happened and end the thread
|
/// Macro used to set error_message, error_happened and end the thread
|
||||||
#define REPORT_ERROR(msg) { error_message = _T("DirectSoundPlayer2Thread: ") _T(msg); SetEvent(error_happened); return; }
|
#define REPORT_ERROR(msg) { error_message = "DirectSoundPlayer2Thread: " msg; SetEvent(error_happened); return; }
|
||||||
|
|
||||||
COMInitialization COM_library;
|
COMInitialization COM_library;
|
||||||
try { COM_library.Init(); }
|
try { COM_library.Init(); }
|
||||||
|
@ -313,7 +313,7 @@ void DirectSoundPlayer2Thread::Run()
|
||||||
bfr7->Release();
|
bfr7->Release();
|
||||||
bfr7 = 0;
|
bfr7 = 0;
|
||||||
|
|
||||||
//wx Log Debug(_T("DirectSoundPlayer2: Created buffer of %d bytes, supposed to be %d milliseconds or %d frames"), bufSize, WANTED_LATENCY*BUFFER_LENGTH, bufSize/provider->GetBytesPerSample());
|
//wx Log Debug("DirectSoundPlayer2: Created buffer of %d bytes, supposed to be %d milliseconds or %d frames", bufSize, WANTED_LATENCY*BUFFER_LENGTH, bufSize/provider->GetBytesPerSample());
|
||||||
|
|
||||||
|
|
||||||
// Now we're ready to roll!
|
// Now we're ready to roll!
|
||||||
|
@ -638,10 +638,10 @@ void DirectSoundPlayer2Thread::CheckError()
|
||||||
throw error_message;
|
throw error_message;
|
||||||
|
|
||||||
case WAIT_ABANDONED:
|
case WAIT_ABANDONED:
|
||||||
throw _T("The DirectShowPlayer2Thread error signal event was abandoned, somehow. This should not happen.");
|
throw "The DirectShowPlayer2Thread error signal event was abandoned, somehow. This should not happen.";
|
||||||
|
|
||||||
case WAIT_FAILED:
|
case WAIT_FAILED:
|
||||||
throw _T("Failed checking state of DirectShowPlayer2Thread error signal event.");
|
throw "Failed checking state of DirectShowPlayer2Thread error signal event.";
|
||||||
|
|
||||||
case WAIT_TIMEOUT:
|
case WAIT_TIMEOUT:
|
||||||
default:
|
default:
|
||||||
|
@ -685,7 +685,7 @@ DirectSoundPlayer2Thread::DirectSoundPlayer2Thread(AudioProvider *provider, int
|
||||||
thread_handle.handle = (HANDLE)_beginthreadex(0, 0, ThreadProc, this, 0, 0);
|
thread_handle.handle = (HANDLE)_beginthreadex(0, 0, ThreadProc, this, 0, 0);
|
||||||
|
|
||||||
if (!thread_handle)
|
if (!thread_handle)
|
||||||
throw _T("Failed creating playback thread in DirectSoundPlayer2. This is bad.");
|
throw "Failed creating playback thread in DirectSoundPlayer2. This is bad.";
|
||||||
|
|
||||||
HANDLE running_or_error[] = { thread_running, error_happened };
|
HANDLE running_or_error[] = { thread_running, error_happened };
|
||||||
switch (WaitForMultipleObjects(2, running_or_error, FALSE, INFINITE))
|
switch (WaitForMultipleObjects(2, running_or_error, FALSE, INFINITE))
|
||||||
|
@ -699,7 +699,7 @@ DirectSoundPlayer2Thread::DirectSoundPlayer2Thread(AudioProvider *provider, int
|
||||||
throw error_message;
|
throw error_message;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw _T("Failed wait for thread start or thread error in DirectSoundPlayer2. This is bad.");
|
throw "Failed wait for thread start or thread error in DirectSoundPlayer2. This is bad.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,10 +775,10 @@ bool DirectSoundPlayer2Thread::IsPlaying()
|
||||||
switch (WaitForSingleObject(is_playing, 0))
|
switch (WaitForSingleObject(is_playing, 0))
|
||||||
{
|
{
|
||||||
case WAIT_ABANDONED:
|
case WAIT_ABANDONED:
|
||||||
throw _T("The DirectShowPlayer2Thread playback state event was abandoned, somehow. This should not happen.");
|
throw "The DirectShowPlayer2Thread playback state event was abandoned, somehow. This should not happen.";
|
||||||
|
|
||||||
case WAIT_FAILED:
|
case WAIT_FAILED:
|
||||||
throw _T("Failed checking state of DirectShowPlayer2Thread playback state event.");
|
throw "Failed checking state of DirectShowPlayer2Thread playback state event.";
|
||||||
|
|
||||||
case WAIT_OBJECT_0:
|
case WAIT_OBJECT_0:
|
||||||
return true;
|
return true;
|
||||||
|
@ -914,7 +914,7 @@ void DirectSoundPlayer2::OpenStream()
|
||||||
{
|
{
|
||||||
thread = new DirectSoundPlayer2Thread(GetProvider(), WantedLatency, BufferLength);
|
thread = new DirectSoundPlayer2Thread(GetProvider(), WantedLatency, BufferLength);
|
||||||
}
|
}
|
||||||
catch (const wxChar *msg)
|
catch (const char *msg)
|
||||||
{
|
{
|
||||||
LOG_E("audio/player/dsound") << msg;
|
LOG_E("audio/player/dsound") << msg;
|
||||||
wxLogError(msg);
|
wxLogError(msg);
|
||||||
|
@ -933,7 +933,7 @@ void DirectSoundPlayer2::CloseStream()
|
||||||
{
|
{
|
||||||
delete thread;
|
delete thread;
|
||||||
}
|
}
|
||||||
catch (const wxChar *msg)
|
catch (const char *msg)
|
||||||
{
|
{
|
||||||
LOG_E("audio/player/dsound") << msg;
|
LOG_E("audio/player/dsound") << msg;
|
||||||
wxLogError(msg);
|
wxLogError(msg);
|
||||||
|
@ -959,7 +959,7 @@ void DirectSoundPlayer2::SetProvider(AudioProvider *provider)
|
||||||
|
|
||||||
AudioPlayer::SetProvider(provider);
|
AudioPlayer::SetProvider(provider);
|
||||||
}
|
}
|
||||||
catch (const wxChar *msg)
|
catch (const char *msg)
|
||||||
{
|
{
|
||||||
LOG_E("audio/player/dsound") << msg;
|
LOG_E("audio/player/dsound") << msg;
|
||||||
wxLogError(msg);
|
wxLogError(msg);
|
||||||
|
@ -980,7 +980,7 @@ void DirectSoundPlayer2::Play(int64_t start,int64_t count)
|
||||||
|
|
||||||
if (displayTimer && !displayTimer->IsRunning()) displayTimer->Start(15);
|
if (displayTimer && !displayTimer->IsRunning()) displayTimer->Start(15);
|
||||||
}
|
}
|
||||||
catch (const wxChar *msg)
|
catch (const char *msg)
|
||||||
{
|
{
|
||||||
LOG_E("audio/player/dsound") << msg;
|
LOG_E("audio/player/dsound") << msg;
|
||||||
wxLogError(msg);
|
wxLogError(msg);
|
||||||
|
@ -1002,7 +1002,7 @@ void DirectSoundPlayer2::Stop(bool timerToo)
|
||||||
displayTimer->Stop();
|
displayTimer->Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const wxChar *msg)
|
catch (const char *msg)
|
||||||
{
|
{
|
||||||
LOG_E("audio/player/dsound") << msg;
|
LOG_E("audio/player/dsound") << msg;
|
||||||
wxLogError(msg);
|
wxLogError(msg);
|
||||||
|
@ -1020,7 +1020,7 @@ bool DirectSoundPlayer2::IsPlaying()
|
||||||
if (!IsThreadAlive()) return false;
|
if (!IsThreadAlive()) return false;
|
||||||
return thread->IsPlaying();
|
return thread->IsPlaying();
|
||||||
}
|
}
|
||||||
catch (const wxChar *msg)
|
catch (const char *msg)
|
||||||
{
|
{
|
||||||
LOG_E("audio/player/dsound") << msg;
|
LOG_E("audio/player/dsound") << msg;
|
||||||
wxLogError(msg);
|
wxLogError(msg);
|
||||||
|
@ -1041,7 +1041,7 @@ int64_t DirectSoundPlayer2::GetStartPosition()
|
||||||
if (!IsThreadAlive()) return 0;
|
if (!IsThreadAlive()) return 0;
|
||||||
return thread->GetStartFrame();
|
return thread->GetStartFrame();
|
||||||
}
|
}
|
||||||
catch (const wxChar *msg)
|
catch (const char *msg)
|
||||||
{
|
{
|
||||||
LOG_E("audio/player/dsound") << msg;
|
LOG_E("audio/player/dsound") << msg;
|
||||||
wxLogError(msg);
|
wxLogError(msg);
|
||||||
|
@ -1062,7 +1062,7 @@ int64_t DirectSoundPlayer2::GetEndPosition()
|
||||||
if (!IsThreadAlive()) return 0;
|
if (!IsThreadAlive()) return 0;
|
||||||
return thread->GetEndFrame();
|
return thread->GetEndFrame();
|
||||||
}
|
}
|
||||||
catch (const wxChar *msg)
|
catch (const char *msg)
|
||||||
{
|
{
|
||||||
LOG_E("audio/player/dsound") << msg;
|
LOG_E("audio/player/dsound") << msg;
|
||||||
wxLogError(msg);
|
wxLogError(msg);
|
||||||
|
@ -1083,7 +1083,7 @@ int64_t DirectSoundPlayer2::GetCurrentPosition()
|
||||||
if (!IsThreadAlive()) return 0;
|
if (!IsThreadAlive()) return 0;
|
||||||
return thread->GetCurrentFrame();
|
return thread->GetCurrentFrame();
|
||||||
}
|
}
|
||||||
catch (const wxChar *msg)
|
catch (const char *msg)
|
||||||
{
|
{
|
||||||
LOG_E("audio/player/dsound") << msg;
|
LOG_E("audio/player/dsound") << msg;
|
||||||
wxLogError(msg);
|
wxLogError(msg);
|
||||||
|
@ -1101,7 +1101,7 @@ void DirectSoundPlayer2::SetEndPosition(int64_t pos)
|
||||||
{
|
{
|
||||||
if (IsThreadAlive()) thread->SetEndFrame(pos);
|
if (IsThreadAlive()) thread->SetEndFrame(pos);
|
||||||
}
|
}
|
||||||
catch (const wxChar *msg)
|
catch (const char *msg)
|
||||||
{
|
{
|
||||||
LOG_E("audio/player/dsound") << msg;
|
LOG_E("audio/player/dsound") << msg;
|
||||||
wxLogError(msg);
|
wxLogError(msg);
|
||||||
|
@ -1120,7 +1120,7 @@ void DirectSoundPlayer2::SetCurrentPosition(int64_t pos)
|
||||||
{
|
{
|
||||||
if (IsThreadAlive()) thread->Play(pos, thread->GetEndFrame()-pos);
|
if (IsThreadAlive()) thread->Play(pos, thread->GetEndFrame()-pos);
|
||||||
}
|
}
|
||||||
catch (const wxChar *msg)
|
catch (const char *msg)
|
||||||
{
|
{
|
||||||
LOG_E("audio/player/dsound") << msg;
|
LOG_E("audio/player/dsound") << msg;
|
||||||
wxLogError(msg);
|
wxLogError(msg);
|
||||||
|
@ -1137,7 +1137,7 @@ void DirectSoundPlayer2::SetVolume(double vol)
|
||||||
{
|
{
|
||||||
if (IsThreadAlive()) thread->SetVolume(vol);
|
if (IsThreadAlive()) thread->SetVolume(vol);
|
||||||
}
|
}
|
||||||
catch (const wxChar *msg)
|
catch (const char *msg)
|
||||||
{
|
{
|
||||||
LOG_E("audio/player/dsound") << msg;
|
LOG_E("audio/player/dsound") << msg;
|
||||||
wxLogError(msg);
|
wxLogError(msg);
|
||||||
|
@ -1155,7 +1155,7 @@ double DirectSoundPlayer2::GetVolume()
|
||||||
if (!IsThreadAlive()) return 0;
|
if (!IsThreadAlive()) return 0;
|
||||||
return thread->GetVolume();
|
return thread->GetVolume();
|
||||||
}
|
}
|
||||||
catch (const wxChar *msg)
|
catch (const char *msg)
|
||||||
{
|
{
|
||||||
LOG_E("audio/player/dsound") << msg;
|
LOG_E("audio/player/dsound") << msg;
|
||||||
wxLogError(msg);
|
wxLogError(msg);
|
||||||
|
|
|
@ -80,19 +80,19 @@ void OpenALPlayer::OpenStream()
|
||||||
// Open device
|
// Open device
|
||||||
device = alcOpenDevice(0);
|
device = alcOpenDevice(0);
|
||||||
if (!device) {
|
if (!device) {
|
||||||
throw _T("Failed opening default OpenAL device");
|
throw "Failed opening default OpenAL device";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create context
|
// Create context
|
||||||
context = alcCreateContext(device, 0);
|
context = alcCreateContext(device, 0);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
alcCloseDevice(device);
|
alcCloseDevice(device);
|
||||||
throw _T("Failed creating OpenAL context");
|
throw "Failed creating OpenAL context";
|
||||||
}
|
}
|
||||||
if (!alcMakeContextCurrent(context)) {
|
if (!alcMakeContextCurrent(context)) {
|
||||||
alcDestroyContext(context);
|
alcDestroyContext(context);
|
||||||
alcCloseDevice(device);
|
alcCloseDevice(device);
|
||||||
throw _T("Failed selecting OpenAL context");
|
throw "Failed selecting OpenAL context";
|
||||||
}
|
}
|
||||||
// Clear error code
|
// Clear error code
|
||||||
alGetError();
|
alGetError();
|
||||||
|
@ -102,7 +102,7 @@ void OpenALPlayer::OpenStream()
|
||||||
if (alGetError() != AL_NO_ERROR) {
|
if (alGetError() != AL_NO_ERROR) {
|
||||||
alcDestroyContext(context);
|
alcDestroyContext(context);
|
||||||
alcCloseDevice(device);
|
alcCloseDevice(device);
|
||||||
throw _T("Error generating OpenAL buffers");
|
throw "Error generating OpenAL buffers";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate source
|
// Generate source
|
||||||
|
@ -111,7 +111,7 @@ void OpenALPlayer::OpenStream()
|
||||||
alDeleteBuffers(num_buffers, buffers);
|
alDeleteBuffers(num_buffers, buffers);
|
||||||
alcDestroyContext(context);
|
alcDestroyContext(context);
|
||||||
alcCloseDevice(device);
|
alcCloseDevice(device);
|
||||||
throw _T("Error generating OpenAL source");
|
throw "Error generating OpenAL source";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine buffer length
|
// Determine buffer length
|
||||||
|
|
|
@ -81,7 +81,7 @@ void OSSPlayer::OpenStream()
|
||||||
wxString device = lagi_wxString(OPT_GET("Audio/OSS/Device")->GetString());
|
wxString device = lagi_wxString(OPT_GET("Audio/OSS/Device")->GetString());
|
||||||
dspdev = ::open(device.mb_str(wxConvUTF8), O_WRONLY, 0);
|
dspdev = ::open(device.mb_str(wxConvUTF8), O_WRONLY, 0);
|
||||||
if (dspdev < 0) {
|
if (dspdev < 0) {
|
||||||
throw _T("OSS player: opening device failed");
|
throw "OSS player: opening device failed";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use a reasonable buffer policy for low latency (OSS4)
|
// Use a reasonable buffer policy for low latency (OSS4)
|
||||||
|
@ -93,7 +93,7 @@ void OSSPlayer::OpenStream()
|
||||||
// Set number of channels
|
// Set number of channels
|
||||||
int channels = provider->GetChannels();
|
int channels = provider->GetChannels();
|
||||||
if (ioctl(dspdev, SNDCTL_DSP_CHANNELS, &channels) < 0) {
|
if (ioctl(dspdev, SNDCTL_DSP_CHANNELS, &channels) < 0) {
|
||||||
throw _T("OSS player: setting channels failed");
|
throw "OSS player: setting channels failed";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set sample format
|
// Set sample format
|
||||||
|
@ -106,11 +106,11 @@ void OSSPlayer::OpenStream()
|
||||||
sample_format = AFMT_S16_LE;
|
sample_format = AFMT_S16_LE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw _T("OSS player: can only handle 8 and 16 bit sound");
|
throw "OSS player: can only handle 8 and 16 bit sound";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl(dspdev, SNDCTL_DSP_SETFMT, &sample_format) < 0) {
|
if (ioctl(dspdev, SNDCTL_DSP_SETFMT, &sample_format) < 0) {
|
||||||
throw _T("OSS player: setting sample format failed");
|
throw "OSS player: setting sample format failed";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set sample rate
|
// Set sample rate
|
||||||
|
|
|
@ -62,9 +62,9 @@ PortAudioPlayer::PortAudioPlayer() {
|
||||||
PaError err = Pa_Initialize();
|
PaError err = Pa_Initialize();
|
||||||
|
|
||||||
if (err != paNoError) {
|
if (err != paNoError) {
|
||||||
static wchar_t errormsg[2048];
|
static char errormsg[2048];
|
||||||
swprintf(errormsg, 2048, L"Failed opening PortAudio: %s", Pa_GetErrorText(err));
|
sprintf(errormsg, 2048, "Failed opening PortAudio: %s", Pa_GetErrorText(err));
|
||||||
throw (const wchar_t *)errormsg;
|
throw errormsg;
|
||||||
}
|
}
|
||||||
pa_refcount++;
|
pa_refcount++;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ void PortAudioPlayer::OpenStream() {
|
||||||
const PaHostErrorInfo *pa_err = Pa_GetLastHostErrorInfo();
|
const PaHostErrorInfo *pa_err = Pa_GetLastHostErrorInfo();
|
||||||
LOG_D_IF(pa_err->errorCode != 0, "audio/player/portaudio") << "HostError: API: " << pa_err->hostApiType << ", " << pa_err->errorText << ", " << pa_err->errorCode;
|
LOG_D_IF(pa_err->errorCode != 0, "audio/player/portaudio") << "HostError: API: " << pa_err->hostApiType << ", " << pa_err->errorText << ", " << pa_err->errorCode;
|
||||||
LOG_D("audio/player/portaudio") << "Failed initializing PortAudio stream with error: " << Pa_GetErrorText(err);
|
LOG_D("audio/player/portaudio") << "Failed initializing PortAudio stream with error: " << Pa_GetErrorText(err);
|
||||||
throw wxString(_T("Failed initializing PortAudio stream with error: ") + wxString(Pa_GetErrorText(err),csConvLocal));
|
throw wxString("Failed initializing PortAudio stream with error: " + wxString(Pa_GetErrorText(err),csConvLocal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ void PulseAudioPlayer::OpenStream()
|
||||||
//printf("Initialising threaded main loop\n");
|
//printf("Initialising threaded main loop\n");
|
||||||
mainloop = pa_threaded_mainloop_new();
|
mainloop = pa_threaded_mainloop_new();
|
||||||
if (!mainloop) {
|
if (!mainloop) {
|
||||||
throw _T("Failed to initialise PulseAudio threaded mainloop object");
|
throw "Failed to initialise PulseAudio threaded mainloop object";
|
||||||
}
|
}
|
||||||
//printf("Starting main loop\n");
|
//printf("Starting main loop\n");
|
||||||
pa_threaded_mainloop_start(mainloop);
|
pa_threaded_mainloop_start(mainloop);
|
||||||
|
@ -95,7 +95,7 @@ void PulseAudioPlayer::OpenStream()
|
||||||
context = pa_context_new(pa_threaded_mainloop_get_api(mainloop), "Aegisub");
|
context = pa_context_new(pa_threaded_mainloop_get_api(mainloop), "Aegisub");
|
||||||
if (!context) {
|
if (!context) {
|
||||||
pa_threaded_mainloop_free(mainloop);
|
pa_threaded_mainloop_free(mainloop);
|
||||||
throw _T("Failed to create PulseAudio context");
|
throw "Failed to create PulseAudio context";
|
||||||
}
|
}
|
||||||
pa_context_set_state_callback(context, (pa_context_notify_cb_t)pa_context_notify, this);
|
pa_context_set_state_callback(context, (pa_context_notify_cb_t)pa_context_notify, this);
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ void PulseAudioPlayer::OpenStream()
|
||||||
pa_threaded_mainloop_stop(mainloop);
|
pa_threaded_mainloop_stop(mainloop);
|
||||||
pa_threaded_mainloop_free(mainloop);
|
pa_threaded_mainloop_free(mainloop);
|
||||||
wxString s(pa_strerror(paerror), wxConvUTF8);
|
wxString s(pa_strerror(paerror), wxConvUTF8);
|
||||||
s.Prepend(_T("PulseAudio reported error: "));
|
s.Prepend("PulseAudio reported error: ");
|
||||||
throw s.c_str();
|
throw s.c_str();
|
||||||
}
|
}
|
||||||
// otherwise loop once more
|
// otherwise loop once more
|
||||||
|
@ -137,7 +137,7 @@ void PulseAudioPlayer::OpenStream()
|
||||||
pa_context_unref(context);
|
pa_context_unref(context);
|
||||||
pa_threaded_mainloop_stop(mainloop);
|
pa_threaded_mainloop_stop(mainloop);
|
||||||
pa_threaded_mainloop_free(mainloop);
|
pa_threaded_mainloop_free(mainloop);
|
||||||
throw _T("PulseAudio could not create stream");
|
throw "PulseAudio could not create stream";
|
||||||
}
|
}
|
||||||
pa_stream_set_state_callback(stream, (pa_stream_notify_cb_t)pa_stream_notify, this);
|
pa_stream_set_state_callback(stream, (pa_stream_notify_cb_t)pa_stream_notify, this);
|
||||||
pa_stream_set_write_callback(stream, (pa_stream_request_cb_t)pa_stream_write, this);
|
pa_stream_set_write_callback(stream, (pa_stream_request_cb_t)pa_stream_write, this);
|
||||||
|
@ -148,7 +148,7 @@ void PulseAudioPlayer::OpenStream()
|
||||||
if (paerror) {
|
if (paerror) {
|
||||||
printf("PulseAudio reported error: %s (%d)\n", pa_strerror(paerror), paerror);
|
printf("PulseAudio reported error: %s (%d)\n", pa_strerror(paerror), paerror);
|
||||||
wxString s(pa_strerror(paerror), wxConvUTF8);
|
wxString s(pa_strerror(paerror), wxConvUTF8);
|
||||||
s.Prepend(_T("PulseAudio reported error: "));
|
s.Prepend("PulseAudio reported error: ");
|
||||||
throw s.c_str();
|
throw s.c_str();
|
||||||
}
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -158,7 +158,7 @@ void PulseAudioPlayer::OpenStream()
|
||||||
} else if (sstate == PA_STREAM_FAILED) {
|
} else if (sstate == PA_STREAM_FAILED) {
|
||||||
paerror = pa_context_errno(context);
|
paerror = pa_context_errno(context);
|
||||||
printf("PulseAudio player: Stream connection failed: %s (%d)\n", pa_strerror(paerror), paerror);
|
printf("PulseAudio player: Stream connection failed: %s (%d)\n", pa_strerror(paerror), paerror);
|
||||||
throw _T("PulseAudio player: Something went wrong connecting the stream");
|
throw "PulseAudio player: Something went wrong connecting the stream";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("Connected playback stream, now playing\n\n");
|
//printf("Connected playback stream, now playing\n\n");
|
||||||
|
|
|
@ -64,7 +64,7 @@ AvisynthAudioProvider::AvisynthAudioProvider(wxString filename) try : filename(f
|
||||||
throw agi::FileNotFoundError(STD_STR(filename));
|
throw agi::FileNotFoundError(STD_STR(filename));
|
||||||
|
|
||||||
// Include
|
// Include
|
||||||
if (filename.EndsWith(_T(".avs"))) {
|
if (filename.EndsWith(".avs")) {
|
||||||
char *fname = env->SaveString(fn.GetShortPath().mb_str(csConvLocal));
|
char *fname = env->SaveString(fn.GetShortPath().mb_str(csConvLocal));
|
||||||
script = env->Invoke("Import", fname);
|
script = env->Invoke("Import", fname);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ AvisynthAudioProvider::AvisynthAudioProvider(wxString filename) try : filename(f
|
||||||
AVSValue args[3] = { env->SaveString(fn.GetShortPath().mb_str(csConvLocal)), false, true };
|
AVSValue args[3] = { env->SaveString(fn.GetShortPath().mb_str(csConvLocal)), false, true };
|
||||||
|
|
||||||
// Load DirectShowSource.dll from app dir if it exists
|
// Load DirectShowSource.dll from app dir if it exists
|
||||||
wxFileName dsspath(StandardPaths::DecodePath(_T("?data/DirectShowSource.dll")));
|
wxFileName dsspath(StandardPaths::DecodePath("?data/DirectShowSource.dll"));
|
||||||
if (dsspath.FileExists()) {
|
if (dsspath.FileExists()) {
|
||||||
env->Invoke("LoadPlugin",env->SaveString(dsspath.GetShortPath().mb_str(csConvLocal)));
|
env->Invoke("LoadPlugin",env->SaveString(dsspath.GetShortPath().mb_str(csConvLocal)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ HDAudioProvider::HDAudioProvider(AudioProvider *src) {
|
||||||
|
|
||||||
// Start progress
|
// Start progress
|
||||||
volatile bool canceled = false;
|
volatile bool canceled = false;
|
||||||
DialogProgress *progress = new DialogProgress(AegisubApp::Get()->frame,_T("Load audio"),&canceled,_T("Reading to Hard Disk cache"),0,num_samples);
|
DialogProgress *progress = new DialogProgress(AegisubApp::Get()->frame,"Load audio",&canceled,"Reading to Hard Disk cache",0,num_samples);
|
||||||
progress->Show();
|
progress->Show();
|
||||||
|
|
||||||
// Write to disk
|
// Write to disk
|
||||||
|
@ -149,10 +149,10 @@ void HDAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) const {
|
||||||
wxString HDAudioProvider::DiskCachePath() {
|
wxString HDAudioProvider::DiskCachePath() {
|
||||||
// Default
|
// Default
|
||||||
wxString path = lagi_wxString(OPT_GET("Audio/Cache/HD/Location")->GetString());
|
wxString path = lagi_wxString(OPT_GET("Audio/Cache/HD/Location")->GetString());
|
||||||
if (path == _T("default")) return StandardPaths::DecodePath(_T("?temp/"));
|
if (path == "default") return StandardPaths::DecodePath("?temp/");
|
||||||
|
|
||||||
// Specified
|
// Specified
|
||||||
return DecodeRelativePath(path,StandardPaths::DecodePath(_T("?user/")));
|
return DecodeRelativePath(path,StandardPaths::DecodePath("?user/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Get disk cache filename
|
/// @brief Get disk cache filename
|
||||||
|
@ -160,7 +160,7 @@ wxString HDAudioProvider::DiskCachePath() {
|
||||||
wxString HDAudioProvider::DiskCacheName() {
|
wxString HDAudioProvider::DiskCacheName() {
|
||||||
// Get pattern
|
// Get pattern
|
||||||
wxString pattern = lagi_wxString(OPT_GET("Audio/Cache/HD/Name")->GetString());
|
wxString pattern = lagi_wxString(OPT_GET("Audio/Cache/HD/Name")->GetString());
|
||||||
if (pattern.Find(_T("%02i")) == wxNOT_FOUND) pattern = _T("audio%02i.tmp");
|
if (pattern.Find("%02i") == wxNOT_FOUND) pattern = "audio%02i.tmp";
|
||||||
|
|
||||||
// Try from 00 to 99
|
// Try from 00 to 99
|
||||||
for (int i=0;i<100;i++) {
|
for (int i=0;i<100;i++) {
|
||||||
|
@ -168,5 +168,5 @@ wxString HDAudioProvider::DiskCacheName() {
|
||||||
wxString curStringTry = DiskCachePath() + wxString::Format(pattern.c_str(),i);
|
wxString curStringTry = DiskCachePath() + wxString::Format(pattern.c_str(),i);
|
||||||
if (!wxFile::Exists(curStringTry)) return curStringTry;
|
if (!wxFile::Exists(curStringTry)) return curStringTry;
|
||||||
}
|
}
|
||||||
return L"";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,7 +311,7 @@ namespace Automation4 {
|
||||||
///
|
///
|
||||||
wxString FeatureFilter::GetScriptSettingsIdentifier()
|
wxString FeatureFilter::GetScriptSettingsIdentifier()
|
||||||
{
|
{
|
||||||
return inline_string_encode(wxString::Format(_T("Automation Settings %s"), GetName().c_str()));
|
return inline_string_encode(wxString::Format("Automation Settings %s", GetName().c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -430,7 +430,7 @@ namespace Automation4 {
|
||||||
///
|
///
|
||||||
wxString ScriptConfigDialog::Serialise()
|
wxString ScriptConfigDialog::Serialise()
|
||||||
{
|
{
|
||||||
return _T("");
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ namespace Automation4 {
|
||||||
/// @param parent
|
/// @param parent
|
||||||
///
|
///
|
||||||
ProgressSink::ProgressSink(wxWindow *parent)
|
ProgressSink::ProgressSink(wxWindow *parent)
|
||||||
: wxDialog(parent, -1, _T("Automation"), wxDefaultPosition, wxDefaultSize, wxBORDER_RAISED)
|
: wxDialog(parent, -1, "Automation", wxDefaultPosition, wxDefaultSize, wxBORDER_RAISED)
|
||||||
, debug_visible(false)
|
, debug_visible(false)
|
||||||
, data_updated(false)
|
, data_updated(false)
|
||||||
, cancelled(false)
|
, cancelled(false)
|
||||||
|
@ -450,10 +450,10 @@ namespace Automation4 {
|
||||||
{
|
{
|
||||||
// make the controls
|
// make the controls
|
||||||
progress_display = new wxGauge(this, -1, 1000, wxDefaultPosition, wxSize(300, 20));
|
progress_display = new wxGauge(this, -1, 1000, wxDefaultPosition, wxSize(300, 20));
|
||||||
title_display = new wxStaticText(this, -1, _T(""), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE|wxST_NO_AUTORESIZE);
|
title_display = new wxStaticText(this, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE|wxST_NO_AUTORESIZE);
|
||||||
task_display = new wxStaticText(this, -1, _T(""), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE|wxST_NO_AUTORESIZE);
|
task_display = new wxStaticText(this, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE|wxST_NO_AUTORESIZE);
|
||||||
cancel_button = new wxButton(this, wxID_CANCEL);
|
cancel_button = new wxButton(this, wxID_CANCEL);
|
||||||
debug_output = new wxTextCtrl(this, -1, _T(""), wxDefaultPosition, wxSize(300, 120), wxTE_MULTILINE|wxTE_READONLY);
|
debug_output = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxSize(300, 120), wxTE_MULTILINE|wxTE_READONLY);
|
||||||
|
|
||||||
// put it in a sizer
|
// put it in a sizer
|
||||||
sizer = new wxBoxSizer(wxVERTICAL);
|
sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
@ -537,7 +537,7 @@ namespace Automation4 {
|
||||||
*debug_output << pending_debug_output;
|
*debug_output << pending_debug_output;
|
||||||
debug_output->SetInsertionPointEnd();
|
debug_output->SetInsertionPointEnd();
|
||||||
|
|
||||||
pending_debug_output = _T("");
|
pending_debug_output = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
progress_display->SetValue((int)(progress*10));
|
progress_display->SetValue((int)(progress*10));
|
||||||
|
@ -642,7 +642,7 @@ namespace Automation4 {
|
||||||
evt.config_dialog->DeleteWindow();
|
evt.config_dialog->DeleteWindow();
|
||||||
delete w;
|
delete w;
|
||||||
} else {
|
} else {
|
||||||
wxMessageBox(_T("Uh... no config dialog?"));
|
wxMessageBox("Uh... no config dialog?");
|
||||||
}
|
}
|
||||||
|
|
||||||
// See note in auto4_base.h
|
// See note in auto4_base.h
|
||||||
|
@ -660,16 +660,16 @@ namespace Automation4 {
|
||||||
///
|
///
|
||||||
Script::Script(const wxString &_filename)
|
Script::Script(const wxString &_filename)
|
||||||
: filename(_filename)
|
: filename(_filename)
|
||||||
, name(_T(""))
|
, name("")
|
||||||
, description(_T(""))
|
, description("")
|
||||||
, author(_T(""))
|
, author("")
|
||||||
, version(_T(""))
|
, version("")
|
||||||
, loaded(false)
|
, loaded(false)
|
||||||
{
|
{
|
||||||
// copied from auto3
|
// copied from auto3
|
||||||
include_path.clear();
|
include_path.clear();
|
||||||
include_path.EnsureFileAccessible(filename);
|
include_path.EnsureFileAccessible(filename);
|
||||||
wxStringTokenizer toker(lagi_wxString(OPT_GET("Path/Automation/Include")->GetString()), _T("|"), wxTOKEN_STRTOK);
|
wxStringTokenizer toker(lagi_wxString(OPT_GET("Path/Automation/Include")->GetString()), "|", wxTOKEN_STRTOK);
|
||||||
while (toker.HasMoreTokens()) {
|
while (toker.HasMoreTokens()) {
|
||||||
// todo? make some error reporting here
|
// todo? make some error reporting here
|
||||||
wxFileName path(StandardPaths::DecodePath(toker.GetNextToken()));
|
wxFileName path(StandardPaths::DecodePath(toker.GetNextToken()));
|
||||||
|
@ -871,21 +871,21 @@ namespace Automation4 {
|
||||||
|
|
||||||
int error_count = 0;
|
int error_count = 0;
|
||||||
|
|
||||||
wxStringTokenizer tok(path, _T("|"), wxTOKEN_STRTOK);
|
wxStringTokenizer tok(path, "|", wxTOKEN_STRTOK);
|
||||||
while (tok.HasMoreTokens()) {
|
while (tok.HasMoreTokens()) {
|
||||||
wxDir dir;
|
wxDir dir;
|
||||||
wxString dirname = StandardPaths::DecodePath(tok.GetNextToken());
|
wxString dirname = StandardPaths::DecodePath(tok.GetNextToken());
|
||||||
if (!dir.Exists(dirname)) {
|
if (!dir.Exists(dirname)) {
|
||||||
//wxLogWarning(_T("A directory was specified in the Automation autoload path, but it doesn't exist: %s"), dirname.c_str());
|
//wxLogWarning("A directory was specified in the Automation autoload path, but it doesn't exist: %s", dirname.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!dir.Open(dirname)) {
|
if (!dir.Open(dirname)) {
|
||||||
//wxLogWarning(_T("Failed to open a directory in the Automation autoload path: %s"), dirname.c_str());
|
//wxLogWarning("Failed to open a directory in the Automation autoload path: %s", dirname.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString fn;
|
wxString fn;
|
||||||
wxFileName script_path(dirname + _T("/"), _T(""));
|
wxFileName script_path(dirname + "/", "");
|
||||||
bool more = dir.GetFirst(&fn, wxEmptyString, wxDIR_FILES);
|
bool more = dir.GetFirst(&fn, wxEmptyString, wxDIR_FILES);
|
||||||
while (more) {
|
while (more) {
|
||||||
script_path.SetName(fn);
|
script_path.SetName(fn);
|
||||||
|
@ -897,19 +897,19 @@ namespace Automation4 {
|
||||||
if (!s->GetLoadedState()) error_count++;
|
if (!s->GetLoadedState()) error_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const wchar_t *e) {
|
catch (const char *e) {
|
||||||
error_count++;
|
error_count++;
|
||||||
wxLogError(_T("Error loading Automation script: %s\n%s"), fn.c_str(), e);
|
wxLogError("Error loading Automation script: %s\n%s", fn.c_str(), e);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
error_count++;
|
error_count++;
|
||||||
wxLogError(_T("Error loading Automation script: %s\nUnknown error."), fn.c_str());
|
wxLogError("Error loading Automation script: %s\nUnknown error.", fn.c_str());
|
||||||
}
|
}
|
||||||
more = dir.GetNext(&fn);
|
more = dir.GetNext(&fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (error_count > 0) {
|
if (error_count > 0) {
|
||||||
wxLogWarning(_T("One or more scripts placed in the Automation autoload directory failed to load\nPlease review the errors above, correct them and use the Reload Autoload dir button in Automation Manager to attempt loading the scripts again."));
|
wxLogWarning("One or more scripts placed in the Automation autoload directory failed to load\nPlease review the errors above, correct them and use the Reload Autoload dir button in Automation Manager to attempt loading the scripts again.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -950,7 +950,7 @@ namespace Automation4 {
|
||||||
|
|
||||||
for (std::vector<ScriptFactory*>::iterator i = factories->begin(); i != factories->end(); ++i) {
|
for (std::vector<ScriptFactory*>::iterator i = factories->begin(); i != factories->end(); ++i) {
|
||||||
if (*i == factory) {
|
if (*i == factory) {
|
||||||
throw _T("Automation 4: Attempt to register the same script factory multiple times. This should never happen.");
|
throw "Automation 4: Attempt to register the same script factory multiple times. This should never happen.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
factories->push_back(factory);
|
factories->push_back(factory);
|
||||||
|
|
|
@ -197,7 +197,7 @@ namespace Automation4 {
|
||||||
lua_pushstring(L, "path");
|
lua_pushstring(L, "path");
|
||||||
lua_gettable(L, -3);
|
lua_gettable(L, -3);
|
||||||
|
|
||||||
wxStringTokenizer toker(lagi_wxString(OPT_GET("Path/Automation/Include")->GetString()), _T("|"), wxTOKEN_STRTOK);
|
wxStringTokenizer toker(lagi_wxString(OPT_GET("Path/Automation/Include")->GetString()), "|", wxTOKEN_STRTOK);
|
||||||
while (toker.HasMoreTokens()) {
|
while (toker.HasMoreTokens()) {
|
||||||
wxFileName path(StandardPaths::DecodePath(toker.GetNextToken()));
|
wxFileName path(StandardPaths::DecodePath(toker.GetNextToken()));
|
||||||
if (path.IsOk() && !path.IsRelative() && path.DirExists()) {
|
if (path.IsOk() && !path.IsRelative() && path.DirExists()) {
|
||||||
|
@ -256,7 +256,7 @@ namespace Automation4 {
|
||||||
LuaScriptReader script_reader(GetFilename());
|
LuaScriptReader script_reader(GetFilename());
|
||||||
if (lua_load(L, script_reader.reader_func, &script_reader, GetPrettyFilename().mb_str(wxConvUTF8))) {
|
if (lua_load(L, script_reader.reader_func, &script_reader, GetPrettyFilename().mb_str(wxConvUTF8))) {
|
||||||
wxString err(lua_tostring(L, -1), wxConvUTF8);
|
wxString err(lua_tostring(L, -1), wxConvUTF8);
|
||||||
err.Prepend(_T("Error loading Lua script \"") + GetPrettyFilename() + _T("\":\n\n"));
|
err.Prepend("Error loading Lua script \"" + GetPrettyFilename() + "\":\n\n");
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
_stackcheck.check_stack(1);
|
_stackcheck.check_stack(1);
|
||||||
|
@ -266,7 +266,7 @@ namespace Automation4 {
|
||||||
if (lua_pcall(L, 0, 0, 0)) {
|
if (lua_pcall(L, 0, 0, 0)) {
|
||||||
// error occurred, assumed to be on top of Lua stack
|
// error occurred, assumed to be on top of Lua stack
|
||||||
wxString err(lua_tostring(L, -1), wxConvUTF8);
|
wxString err(lua_tostring(L, -1), wxConvUTF8);
|
||||||
err.Prepend(_T("Error initialising Lua script \"") + GetPrettyFilename() + _T("\":\n\n"));
|
err.Prepend("Error initialising Lua script \"" + GetPrettyFilename() + "\":\n\n");
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
_stackcheck.check_stack(0);
|
_stackcheck.check_stack(0);
|
||||||
|
@ -276,7 +276,7 @@ namespace Automation4 {
|
||||||
lua_pop(L, 1); // just to avoid tripping the stackcheck in debug
|
lua_pop(L, 1); // just to avoid tripping the stackcheck in debug
|
||||||
// So this is an auto3 script...
|
// So this is an auto3 script...
|
||||||
// Throw it as an exception, the script factory manager will catch this and use the auto3 script instead of this script object
|
// Throw it as an exception, the script factory manager will catch this and use the auto3 script instead of this script object
|
||||||
throw _T("Attempted to load an Automation 3 script as an Automation 4 Lua script. Automation 3 is no longer supported.");
|
throw "Attempted to load an Automation 3 script as an Automation 4 Lua script. Automation 3 is no longer supported.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lua_getglobal(L, "script_name");
|
lua_getglobal(L, "script_name");
|
||||||
|
@ -308,12 +308,6 @@ namespace Automation4 {
|
||||||
name = GetPrettyFilename();
|
name = GetPrettyFilename();
|
||||||
description = wxString(e, wxConvUTF8);
|
description = wxString(e, wxConvUTF8);
|
||||||
}
|
}
|
||||||
catch (const wchar_t *e) {
|
|
||||||
Destroy();
|
|
||||||
loaded = false;
|
|
||||||
name = GetPrettyFilename();
|
|
||||||
description = e;
|
|
||||||
}
|
|
||||||
catch (const wxString& e) {
|
catch (const wxString& e) {
|
||||||
Destroy();
|
Destroy();
|
||||||
loaded = false;
|
loaded = false;
|
||||||
|
@ -328,7 +322,7 @@ namespace Automation4 {
|
||||||
Destroy();
|
Destroy();
|
||||||
loaded = false;
|
loaded = false;
|
||||||
name = GetPrettyFilename();
|
name = GetPrettyFilename();
|
||||||
description = _T("Unknown error initialising Lua script");
|
description = "Unknown error initialising Lua script";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,10 +429,10 @@ namespace Automation4 {
|
||||||
wxString package_paths(lua_tostring(L, -1), wxConvUTF8);
|
wxString package_paths(lua_tostring(L, -1), wxConvUTF8);
|
||||||
lua_pop(L, 2);
|
lua_pop(L, 2);
|
||||||
|
|
||||||
wxStringTokenizer toker(package_paths, L";", wxTOKEN_STRTOK);
|
wxStringTokenizer toker(package_paths, ";", wxTOKEN_STRTOK);
|
||||||
while (toker.HasMoreTokens()) {
|
while (toker.HasMoreTokens()) {
|
||||||
wxString filename = toker.GetNextToken();
|
wxString filename = toker.GetNextToken();
|
||||||
filename.Replace(L"?", module);
|
filename.Replace("?", module);
|
||||||
if (wxFileName::FileExists(filename)) {
|
if (wxFileName::FileExists(filename)) {
|
||||||
LuaScriptReader script_reader(filename);
|
LuaScriptReader script_reader(filename);
|
||||||
if (lua_load(L, script_reader.reader_func, &script_reader, filename.utf8_str())) {
|
if (lua_load(L, script_reader.reader_func, &script_reader, filename.utf8_str())) {
|
||||||
|
@ -590,7 +584,7 @@ namespace Automation4 {
|
||||||
if (result) {
|
if (result) {
|
||||||
// if the call failed, log the error here
|
// if the call failed, log the error here
|
||||||
wxString errmsg(lua_tostring(L, -2), wxConvUTF8);
|
wxString errmsg(lua_tostring(L, -2), wxConvUTF8);
|
||||||
ps->AddDebugOutput(_T("\n\nLua reported a runtime error:\n"));
|
ps->AddDebugOutput("\n\nLua reported a runtime error:\n");
|
||||||
ps->AddDebugOutput(errmsg);
|
ps->AddDebugOutput(errmsg);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
|
@ -762,7 +756,7 @@ namespace Automation4 {
|
||||||
bool result;
|
bool result;
|
||||||
if (err) {
|
if (err) {
|
||||||
wxString errmsg(lua_tostring(L, -1), wxConvUTF8);
|
wxString errmsg(lua_tostring(L, -1), wxConvUTF8);
|
||||||
wxLogWarning(_T("Runtime error in Lua macro validation function:\n%s"), errmsg.c_str());
|
wxLogWarning("Runtime error in Lua macro validation function:\n%s", errmsg.c_str());
|
||||||
result = false;
|
result = false;
|
||||||
} else {
|
} else {
|
||||||
result = !!lua_toboolean(L, -1);
|
result = !!lua_toboolean(L, -1);
|
||||||
|
@ -954,7 +948,7 @@ namespace Automation4 {
|
||||||
int err = lua_pcall(L, 2, 1, 0);
|
int err = lua_pcall(L, 2, 1, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
wxString errmsg(lua_tostring(L, -1), wxConvUTF8);
|
wxString errmsg(lua_tostring(L, -1), wxConvUTF8);
|
||||||
wxLogWarning(_T("Runtime error in Lua macro validation function:\n%s"), errmsg.c_str());
|
wxLogWarning("Runtime error in Lua macro validation function:\n%s", errmsg.c_str());
|
||||||
lua_pop(L, 1); // remove error message
|
lua_pop(L, 1); // remove error message
|
||||||
return config_dialog = 0;
|
return config_dialog = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1195,8 +1189,8 @@ namespace Automation4 {
|
||||||
///
|
///
|
||||||
void LuaScriptFactory::RegisterFactory ()
|
void LuaScriptFactory::RegisterFactory ()
|
||||||
{
|
{
|
||||||
engine_name = _T("Lua");
|
engine_name = "Lua";
|
||||||
filename_pattern = _T("*.lua");
|
filename_pattern = "*.lua";
|
||||||
Register(this);
|
Register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1208,7 +1202,7 @@ namespace Automation4 {
|
||||||
{
|
{
|
||||||
// Just check if file extension is .lua
|
// Just check if file extension is .lua
|
||||||
// Reject anything else
|
// Reject anything else
|
||||||
if (filename.Right(4).Lower() == _T(".lua")) {
|
if (filename.Right(4).Lower() == ".lua") {
|
||||||
return new LuaScript(filename);
|
return new LuaScript(filename);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -171,7 +171,7 @@ namespace Automation4 {
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
virtual wxString SerialiseValue() { return _T(""); }
|
virtual wxString SerialiseValue() { return ""; }
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @param serialised
|
/// @param serialised
|
||||||
|
|
|
@ -102,7 +102,7 @@ namespace Automation4 {
|
||||||
if (StringEmptyOrWhitespace(raw)) {
|
if (StringEmptyOrWhitespace(raw)) {
|
||||||
lua_pushstring(L, "clear");
|
lua_pushstring(L, "clear");
|
||||||
|
|
||||||
} else if (raw[0] == _T(';')) {
|
} else if (raw[0] == ';') {
|
||||||
// "text" field, same as "raw" but with semicolon stripped
|
// "text" field, same as "raw" but with semicolon stripped
|
||||||
wxString text(raw, 1, raw.size()-1);
|
wxString text(raw, 1, raw.size()-1);
|
||||||
lua_pushstring(L, text.mb_str(wxConvUTF8));
|
lua_pushstring(L, text.mb_str(wxConvUTF8));
|
||||||
|
@ -110,25 +110,25 @@ namespace Automation4 {
|
||||||
|
|
||||||
lua_pushstring(L, "comment");
|
lua_pushstring(L, "comment");
|
||||||
|
|
||||||
} else if (raw[0] == _T('[')) {
|
} else if (raw[0] == '[') {
|
||||||
lua_pushstring(L, "head");
|
lua_pushstring(L, "head");
|
||||||
|
|
||||||
} else if (section.Lower() == _T("[script info]")) {
|
} else if (section.Lower() == "[script info]") {
|
||||||
// assumed "info" class
|
// assumed "info" class
|
||||||
|
|
||||||
// first "key"
|
// first "key"
|
||||||
wxString key = raw.BeforeFirst(_T(':'));
|
wxString key = raw.BeforeFirst(':');
|
||||||
lua_pushstring(L, key.mb_str(wxConvUTF8));
|
lua_pushstring(L, key.mb_str(wxConvUTF8));
|
||||||
lua_setfield(L, -2, "key");
|
lua_setfield(L, -2, "key");
|
||||||
|
|
||||||
// then "value"
|
// then "value"
|
||||||
wxString value = raw.AfterFirst(_T(':'));
|
wxString value = raw.AfterFirst(':');
|
||||||
lua_pushstring(L, value.mb_str(wxConvUTF8));
|
lua_pushstring(L, value.mb_str(wxConvUTF8));
|
||||||
lua_setfield(L, -2, "value");
|
lua_setfield(L, -2, "value");
|
||||||
|
|
||||||
lua_pushstring(L, "info");
|
lua_pushstring(L, "info");
|
||||||
|
|
||||||
} else if (raw.Left(7).Lower() == _T("format:")) {
|
} else if (raw.Left(7).Lower() == "format:") {
|
||||||
|
|
||||||
// TODO: parse the format line; just use a tokenizer
|
// TODO: parse the format line; just use a tokenizer
|
||||||
|
|
||||||
|
@ -325,33 +325,33 @@ namespace Automation4 {
|
||||||
|
|
||||||
GETSTRING(section, "section", "common")
|
GETSTRING(section, "section", "common")
|
||||||
|
|
||||||
if (lclass == _T("clear")) {
|
if (lclass == "clear") {
|
||||||
result = new AssEntry(_T(""));
|
result = new AssEntry("");
|
||||||
result->group = section;
|
result->group = section;
|
||||||
|
|
||||||
} else if (lclass == _T("comment")) {
|
} else if (lclass == "comment") {
|
||||||
GETSTRING(raw, "text", "comment")
|
GETSTRING(raw, "text", "comment")
|
||||||
raw.Prepend(_T(";"));
|
raw.Prepend(";");
|
||||||
result = new AssEntry(raw);
|
result = new AssEntry(raw);
|
||||||
result->group = section;
|
result->group = section;
|
||||||
|
|
||||||
} else if (lclass == _T("head")) {
|
} else if (lclass == "head") {
|
||||||
result = new AssEntry(section);
|
result = new AssEntry(section);
|
||||||
result->group = section;
|
result->group = section;
|
||||||
|
|
||||||
} else if (lclass == _T("info")) {
|
} else if (lclass == "info") {
|
||||||
GETSTRING(key, "key", "info")
|
GETSTRING(key, "key", "info")
|
||||||
GETSTRING(value, "value", "info")
|
GETSTRING(value, "value", "info")
|
||||||
result = new AssEntry(wxString::Format(_T("%s: %s"), key.c_str(), value.c_str()));
|
result = new AssEntry(wxString::Format("%s: %s", key.c_str(), value.c_str()));
|
||||||
result->group = _T("[Script Info]"); // just so it can be read correctly back
|
result->group = "[Script Info]"; // just so it can be read correctly back
|
||||||
|
|
||||||
} else if (lclass == _T("format")) {
|
} else if (lclass == "format") {
|
||||||
// ohshi- ...
|
// ohshi- ...
|
||||||
// *FIXME* maybe ignore the actual data and just put some default stuff based on section?
|
// *FIXME* maybe ignore the actual data and just put some default stuff based on section?
|
||||||
result = new AssEntry(_T("Format: Auto4,Is,Broken"));
|
result = new AssEntry("Format: Auto4,Is,Broken");
|
||||||
result->group = section;
|
result->group = section;
|
||||||
|
|
||||||
} else if (lclass == _T("style")) {
|
} else if (lclass == "style") {
|
||||||
GETSTRING(name, "name", "style")
|
GETSTRING(name, "name", "style")
|
||||||
GETSTRING(fontname, "fontname", "style")
|
GETSTRING(fontname, "fontname", "style")
|
||||||
GETFLOAT(fontsize, "fontsize", "style")
|
GETFLOAT(fontsize, "fontsize", "style")
|
||||||
|
@ -407,12 +407,12 @@ namespace Automation4 {
|
||||||
|
|
||||||
result = sty;
|
result = sty;
|
||||||
|
|
||||||
} else if (lclass == _T("styleex")) {
|
} else if (lclass == "styleex") {
|
||||||
lua_pushstring(L, "Found line with class 'styleex' which is not supported. Wait until AS5 is a reality.");
|
lua_pushstring(L, "Found line with class 'styleex' which is not supported. Wait until AS5 is a reality.");
|
||||||
lua_error(L);
|
lua_error(L);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
} else if (lclass == _T("dialogue")) {
|
} else if (lclass == "dialogue") {
|
||||||
GETBOOL(comment, "comment", "dialogue")
|
GETBOOL(comment, "comment", "dialogue")
|
||||||
GETINT(layer, "layer", "dialogue")
|
GETINT(layer, "layer", "dialogue")
|
||||||
GETINT(start_time, "start_time", "dialogue")
|
GETINT(start_time, "start_time", "dialogue")
|
||||||
|
@ -883,9 +883,9 @@ namespace Automation4 {
|
||||||
int kcount = 0;
|
int kcount = 0;
|
||||||
int kdur = 0;
|
int kdur = 0;
|
||||||
int ktime = 0;
|
int ktime = 0;
|
||||||
wxString ktag = _T("");
|
wxString ktag = "";
|
||||||
wxString ktext = _T("");
|
wxString ktext = "";
|
||||||
wxString ktext_stripped = _T("");
|
wxString ktext_stripped = "";
|
||||||
|
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
|
@ -914,10 +914,10 @@ namespace Automation4 {
|
||||||
for (int j = 0; j < (int)ovr->Tags.size(); j++) {
|
for (int j = 0; j < (int)ovr->Tags.size(); j++) {
|
||||||
AssOverrideTag *tag = ovr->Tags[j];
|
AssOverrideTag *tag = ovr->Tags[j];
|
||||||
|
|
||||||
if (tag->IsValid() && tag->Name.Mid(0,2).CmpNoCase(_T("\\k")) == 0) {
|
if (tag->IsValid() && tag->Name.Mid(0,2).CmpNoCase("\\k") == 0) {
|
||||||
// karaoke tag
|
// karaoke tag
|
||||||
if (brackets_open) {
|
if (brackets_open) {
|
||||||
ktext += _T("}");
|
ktext += "}";
|
||||||
brackets_open = false;
|
brackets_open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -941,7 +941,7 @@ namespace Automation4 {
|
||||||
kcount++;
|
kcount++;
|
||||||
ktag = tag->Name.Mid(1);
|
ktag = tag->Name.Mid(1);
|
||||||
// check if it's a "set time" tag, special handling for that (depends on previous syllable duration)
|
// check if it's a "set time" tag, special handling for that (depends on previous syllable duration)
|
||||||
if (ktag == _T("kt")) {
|
if (ktag == "kt") {
|
||||||
ktime = tag->Params[0]->Get<int>() * 10;
|
ktime = tag->Params[0]->Get<int>() * 10;
|
||||||
kdur = 0;
|
kdur = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -954,7 +954,7 @@ namespace Automation4 {
|
||||||
} else {
|
} else {
|
||||||
// not karaoke tag
|
// not karaoke tag
|
||||||
if (!brackets_open) {
|
if (!brackets_open) {
|
||||||
ktext += _T("{");
|
ktext += "{";
|
||||||
brackets_open = true;
|
brackets_open = true;
|
||||||
}
|
}
|
||||||
ktext += *tag;
|
ktext += *tag;
|
||||||
|
@ -963,7 +963,7 @@ namespace Automation4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (brackets_open) {
|
if (brackets_open) {
|
||||||
ktext += _T("}");
|
ktext += "}";
|
||||||
brackets_open = false;
|
brackets_open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace Automation4 {
|
||||||
if (lua_isstring(L, -1)) {
|
if (lua_isstring(L, -1)) {
|
||||||
name = wxString(lua_tostring(L, -1), wxConvUTF8);
|
name = wxString(lua_tostring(L, -1), wxConvUTF8);
|
||||||
} else {
|
} else {
|
||||||
name = _T("");
|
name = "";
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ namespace Automation4 {
|
||||||
if (lua_isstring(L, -1)) {
|
if (lua_isstring(L, -1)) {
|
||||||
hint = wxString(lua_tostring(L, -1), wxConvUTF8);
|
hint = wxString(lua_tostring(L, -1), wxConvUTF8);
|
||||||
} else {
|
} else {
|
||||||
hint = _T("");
|
hint = "";
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
|
@ -520,7 +520,7 @@ nospin:
|
||||||
///
|
///
|
||||||
wxString SerialiseValue()
|
wxString SerialiseValue()
|
||||||
{
|
{
|
||||||
return wxString::Format(_T("%d"), value);
|
return wxString::Format("%d", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ nospin:
|
||||||
///
|
///
|
||||||
wxControl *Create(wxWindow *parent)
|
wxControl *Create(wxWindow *parent)
|
||||||
{
|
{
|
||||||
wxSpinCtrl *scw = new wxSpinCtrl(parent, -1, wxString::Format(_T("%d"), value), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, min, max, value);
|
wxSpinCtrl *scw = new wxSpinCtrl(parent, -1, wxString::Format("%d", value), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, min, max, value);
|
||||||
scw->SetToolTip(hint);
|
scw->SetToolTip(hint);
|
||||||
cw = scw;
|
cw = scw;
|
||||||
return cw;
|
return cw;
|
||||||
|
@ -833,7 +833,7 @@ nospin:
|
||||||
///
|
///
|
||||||
wxString SerialiseValue()
|
wxString SerialiseValue()
|
||||||
{
|
{
|
||||||
return value ? _T("1") : _T("0");
|
return value ? "1" : "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -843,7 +843,7 @@ nospin:
|
||||||
void UnserialiseValue(const wxString &serialised)
|
void UnserialiseValue(const wxString &serialised)
|
||||||
{
|
{
|
||||||
// fixme? should this allow more different "false" values?
|
// fixme? should this allow more different "false" values?
|
||||||
value = (serialised == _T("0")) ? false : true;
|
value = (serialised == "0") ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -934,26 +934,26 @@ skipbuttons:
|
||||||
LuaConfigDialogControl *ctl;
|
LuaConfigDialogControl *ctl;
|
||||||
|
|
||||||
// Check control class and create relevant control
|
// Check control class and create relevant control
|
||||||
if (controlclass == _T("label")) {
|
if (controlclass == "label") {
|
||||||
ctl = new LuaControl::Label(L);
|
ctl = new LuaControl::Label(L);
|
||||||
} else if (controlclass == _T("edit")) {
|
} else if (controlclass == "edit") {
|
||||||
ctl = new LuaControl::Edit(L);
|
ctl = new LuaControl::Edit(L);
|
||||||
} else if (controlclass == _T("intedit")) {
|
} else if (controlclass == "intedit") {
|
||||||
ctl = new LuaControl::IntEdit(L);
|
ctl = new LuaControl::IntEdit(L);
|
||||||
} else if (controlclass == _T("floatedit")) {
|
} else if (controlclass == "floatedit") {
|
||||||
ctl = new LuaControl::FloatEdit(L);
|
ctl = new LuaControl::FloatEdit(L);
|
||||||
} else if (controlclass == _T("textbox")) {
|
} else if (controlclass == "textbox") {
|
||||||
ctl = new LuaControl::Textbox(L);
|
ctl = new LuaControl::Textbox(L);
|
||||||
} else if (controlclass == _T("dropdown")) {
|
} else if (controlclass == "dropdown") {
|
||||||
ctl = new LuaControl::Dropdown(L);
|
ctl = new LuaControl::Dropdown(L);
|
||||||
} else if (controlclass == _T("checkbox")) {
|
} else if (controlclass == "checkbox") {
|
||||||
ctl = new LuaControl::Checkbox(L);
|
ctl = new LuaControl::Checkbox(L);
|
||||||
} else if (controlclass == _T("color")) {
|
} else if (controlclass == "color") {
|
||||||
ctl = new LuaControl::Color(L);
|
ctl = new LuaControl::Color(L);
|
||||||
} else if (controlclass == _T("coloralpha")) {
|
} else if (controlclass == "coloralpha") {
|
||||||
// FIXME
|
// FIXME
|
||||||
ctl = new LuaControl::Edit(L);
|
ctl = new LuaControl::Edit(L);
|
||||||
} else if (controlclass == _T("alpha")) {
|
} else if (controlclass == "alpha") {
|
||||||
// FIXME
|
// FIXME
|
||||||
ctl = new LuaControl::Edit(L);
|
ctl = new LuaControl::Edit(L);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1081,7 +1081,7 @@ badcontrol:
|
||||||
wxString LuaConfigDialog::Serialise()
|
wxString LuaConfigDialog::Serialise()
|
||||||
{
|
{
|
||||||
if (controls.size() == 0)
|
if (controls.size() == 0)
|
||||||
return _T("");
|
return "";
|
||||||
|
|
||||||
wxString res;
|
wxString res;
|
||||||
|
|
||||||
|
@ -1090,7 +1090,7 @@ badcontrol:
|
||||||
if (controls[i]->CanSerialiseValue()) {
|
if (controls[i]->CanSerialiseValue()) {
|
||||||
wxString sn = inline_string_encode(controls[i]->name);
|
wxString sn = inline_string_encode(controls[i]->name);
|
||||||
wxString sv = controls[i]->SerialiseValue();
|
wxString sv = controls[i]->SerialiseValue();
|
||||||
res += wxString::Format(_T("%s:%s|"), sn.c_str(), sv.c_str());
|
res += wxString::Format("%s:%s|", sn.c_str(), sv.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1108,12 +1108,12 @@ badcontrol:
|
||||||
void LuaConfigDialog::Unserialise(const wxString &serialised)
|
void LuaConfigDialog::Unserialise(const wxString &serialised)
|
||||||
{
|
{
|
||||||
// Split by pipe
|
// Split by pipe
|
||||||
wxStringTokenizer tk(serialised, _T("|"));
|
wxStringTokenizer tk(serialised, "|");
|
||||||
while (tk.HasMoreTokens()) {
|
while (tk.HasMoreTokens()) {
|
||||||
// Split by colon
|
// Split by colon
|
||||||
wxString pair = tk.GetNextToken();
|
wxString pair = tk.GetNextToken();
|
||||||
wxString name = inline_string_decode(pair.BeforeFirst(_T(':')));
|
wxString name = inline_string_decode(pair.BeforeFirst(':'));
|
||||||
wxString value = pair.AfterFirst(_T(':'));
|
wxString value = pair.AfterFirst(':');
|
||||||
|
|
||||||
// Hand value to all controls matching name
|
// Hand value to all controls matching name
|
||||||
for (size_t i = 0; i < controls.size(); ++i) {
|
for (size_t i = 0; i < controls.size(); ++i) {
|
||||||
|
|
|
@ -52,12 +52,12 @@ namespace Automation4 {
|
||||||
LuaScriptReader::LuaScriptReader(const wxString &filename)
|
LuaScriptReader::LuaScriptReader(const wxString &filename)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
f = _tfopen(filename.c_str(), _T("rb"));
|
f = _wfopen(filename.wc_str(), L"rb");
|
||||||
#else
|
#else
|
||||||
f = fopen(filename.fn_str(), "rb");
|
f = fopen(filename.fn_str(), "rb");
|
||||||
#endif
|
#endif
|
||||||
if (!f)
|
if (!f)
|
||||||
throw _T("Could not open script file");
|
throw "Could not open script file";
|
||||||
first = true;
|
first = true;
|
||||||
databuf = new char[bufsize];
|
databuf = new char[bufsize];
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ namespace Automation4 {
|
||||||
(b[0] == 0x2B && b[1] == 0x2F && b[2] == 0x76) || // utf7
|
(b[0] == 0x2B && b[1] == 0x2F && b[2] == 0x76) || // utf7
|
||||||
(b[0] == 0x00 && b[2] == 0x00) || // looks like utf16be
|
(b[0] == 0x00 && b[2] == 0x00) || // looks like utf16be
|
||||||
(b[1] == 0x00 && b[3] == 0x00)) { // looks like utf16le
|
(b[1] == 0x00 && b[3] == 0x00)) { // looks like utf16le
|
||||||
throw _T("The script file uses an unsupported character set. Only UTF-8 is supported.");
|
throw "The script file uses an unsupported character set. Only UTF-8 is supported.";
|
||||||
}
|
}
|
||||||
// assume utf8 without bom, and rewind file
|
// assume utf8 without bom, and rewind file
|
||||||
fseek(f, 0, SEEK_SET);
|
fseek(f, 0, SEEK_SET);
|
||||||
|
|
|
@ -51,16 +51,16 @@ wxMutex AviSynthWrapper::AviSynthMutex;
|
||||||
///
|
///
|
||||||
AviSynthWrapper::AviSynthWrapper() {
|
AviSynthWrapper::AviSynthWrapper() {
|
||||||
if (!avs_refcount) {
|
if (!avs_refcount) {
|
||||||
hLib=LoadLibrary(_T("avisynth.dll"));
|
hLib=LoadLibrary(L"avisynth.dll");
|
||||||
|
|
||||||
if (hLib == NULL) {
|
if (hLib == NULL) {
|
||||||
throw wxString(_T("Could not load avisynth.dll"));
|
throw wxString("Could not load avisynth.dll");
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNC *CreateScriptEnv = (FUNC*)GetProcAddress(hLib, "CreateScriptEnvironment");
|
FUNC *CreateScriptEnv = (FUNC*)GetProcAddress(hLib, "CreateScriptEnvironment");
|
||||||
|
|
||||||
if (CreateScriptEnv == NULL) {
|
if (CreateScriptEnv == NULL) {
|
||||||
throw wxString(_T("Failed to get address of CreateScriptEnv from avisynth.dll"));
|
throw wxString("Failed to get address of CreateScriptEnv from avisynth.dll");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Require Avisynth 2.5.6+?
|
// Require Avisynth 2.5.6+?
|
||||||
|
@ -70,7 +70,7 @@ AviSynthWrapper::AviSynthWrapper() {
|
||||||
env = CreateScriptEnv(AVISYNTH_INTERFACE_VERSION);
|
env = CreateScriptEnv(AVISYNTH_INTERFACE_VERSION);
|
||||||
|
|
||||||
if (env == NULL) {
|
if (env == NULL) {
|
||||||
throw wxString(_T("Failed to create a new avisynth script environment. Avisynth is too old?"));
|
throw wxString("Failed to create a new avisynth script environment. Avisynth is too old?");
|
||||||
}
|
}
|
||||||
// Set memory limit
|
// Set memory limit
|
||||||
const int memoryMax = OPT_GET("Provider/Avisynth/Memory Max")->GetInt();
|
const int memoryMax = OPT_GET("Provider/Avisynth/Memory Max")->GetInt();
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
/// @param size
|
/// @param size
|
||||||
///
|
///
|
||||||
BrowseButton::BrowseButton(wxWindow *parent,int id,wxString text,BrowseType _type,wxPoint position,wxSize size)
|
BrowseButton::BrowseButton(wxWindow *parent,int id,wxString text,BrowseType _type,wxPoint position,wxSize size)
|
||||||
: wxButton (parent,id,text == wxString(_T("")) ? wxString(_("Browse...")) : text,position,size)
|
: wxButton (parent,id,text == wxString("") ? wxString(_("Browse...")) : text,position,size)
|
||||||
{
|
{
|
||||||
type = _type;
|
type = _type;
|
||||||
ctrl[0] = NULL;
|
ctrl[0] = NULL;
|
||||||
|
@ -86,11 +86,11 @@ void BrowseButton::OnPressed(wxCommandEvent &event) {
|
||||||
// Folder
|
// Folder
|
||||||
if (type == BROWSE_FOLDER) {
|
if (type == BROWSE_FOLDER) {
|
||||||
// For some reason I can't make this work on Mac... -jfs
|
// For some reason I can't make this work on Mac... -jfs
|
||||||
wxString def = StandardPaths::DecodePathMaybeRelative(ctrl[0]->GetValue(), _T("?user/"));
|
wxString def = StandardPaths::DecodePathMaybeRelative(ctrl[0]->GetValue(), "?user/");
|
||||||
wxDirDialog dlg(0, _("Please choose the folder:"), def);
|
wxDirDialog dlg(0, _("Please choose the folder:"), def);
|
||||||
if (dlg.ShowModal() == wxID_OK) {
|
if (dlg.ShowModal() == wxID_OK) {
|
||||||
wxString dir = StandardPaths::EncodePath(dlg.GetPath());
|
wxString dir = StandardPaths::EncodePath(dlg.GetPath());
|
||||||
if (dir != _T("")) ctrl[0]->SetValue(dir);
|
if (dir != "") ctrl[0]->SetValue(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ void BrowseButton::OnPressed(wxCommandEvent &event) {
|
||||||
font = wxGetFontFromUser(NULL,font);
|
font = wxGetFontFromUser(NULL,font);
|
||||||
if (font.IsOk()) {
|
if (font.IsOk()) {
|
||||||
ctrl[0]->SetValue(font.GetFaceName());
|
ctrl[0]->SetValue(font.GetFaceName());
|
||||||
ctrl[1]->SetValue(wxString::Format(_T("%i"),font.GetPointSize()));
|
ctrl[1]->SetValue(wxString::Format("%i",font.GetPointSize()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ private:
|
||||||
void OnPressed(wxCommandEvent &event);
|
void OnPressed(wxCommandEvent &event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BrowseButton(wxWindow *parent,int id=-1,wxString text=_T(""),BrowseType type=BROWSE_FILE,wxPoint position=wxDefaultPosition,wxSize size=wxDefaultSize);
|
BrowseButton(wxWindow *parent,int id=-1,wxString text="",BrowseType type=BROWSE_FILE,wxPoint position=wxDefaultPosition,wxSize size=wxDefaultSize);
|
||||||
void Bind(wxTextCtrl *control,int pos=0);
|
void Bind(wxTextCtrl *control,int pos=0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ wxString GetEncoding(wxString const& filename) {
|
||||||
LOG_I("charset/file") << filename << " (" << log_choice << ")";
|
LOG_I("charset/file") << filename << " (" << log_choice << ")";
|
||||||
|
|
||||||
int choice = wxGetSingleChoiceIndex(_("Aegisub could not narrow down the character set to a single one.\nPlease pick one below:"),_("Choose character set"),choices);
|
int choice = wxGetSingleChoiceIndex(_("Aegisub could not narrow down the character set to a single one.\nPlease pick one below:"),_("Choose character set"),choices);
|
||||||
if (choice == -1) throw _T("Canceled");
|
if (choice == -1) throw "Canceled";
|
||||||
return choices.Item(choice);
|
return choices.Item(choice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -446,7 +446,7 @@ void hsl_to_hsv(int iH, int iS, int iL, unsigned char *oH, unsigned char *oS, un
|
||||||
///
|
///
|
||||||
wxString color_to_html(wxColour color)
|
wxString color_to_html(wxColour color)
|
||||||
{
|
{
|
||||||
return wxString::Format(_T("#%02X%02X%02X"), color.Red(), color.Green(), color.Blue());
|
return wxString::Format("#%02X%02X%02X", color.Red(), color.Green(), color.Blue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ wxColour html_to_color(wxString html)
|
||||||
{
|
{
|
||||||
html.Trim(true);
|
html.Trim(true);
|
||||||
html.Trim(false);
|
html.Trim(false);
|
||||||
if (html.StartsWith(_T("#"))) {
|
if (html.StartsWith("#")) {
|
||||||
html.Remove(0, 1);
|
html.Remove(0, 1);
|
||||||
}
|
}
|
||||||
if (html.size() == 6) {
|
if (html.size() == 6) {
|
||||||
|
|
|
@ -174,7 +174,7 @@ struct app_language : public Command {
|
||||||
OPT_SET("App/Locale")->SetInt(newCode);
|
OPT_SET("App/Locale")->SetInt(newCode);
|
||||||
|
|
||||||
// Ask to restart program
|
// Ask to restart program
|
||||||
int result = wxMessageBox(_T("Aegisub needs to be restarted so that the new language can be applied. Restart now?"),_T("Restart Aegisub?"),wxICON_QUESTION | wxYES_NO);
|
int result = wxMessageBox("Aegisub needs to be restarted so that the new language can be applied. Restart now?","Restart Aegisub?",wxICON_QUESTION | wxYES_NO);
|
||||||
if (result == wxYES) {
|
if (result == wxYES) {
|
||||||
// Restart Aegisub
|
// Restart Aegisub
|
||||||
if (wxGetApp().frame->Close()) {
|
if (wxGetApp().frame->Close()) {
|
||||||
|
|
|
@ -89,10 +89,10 @@ struct audio_open : public Command {
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Audio")->GetString());
|
wxString path = lagi_wxString(OPT_GET("Path/Last/Audio")->GetString());
|
||||||
wxString str = wxString(_("Audio Formats")) + _T(" (*.wav,*.mp3,*.ogg,*.flac,*.mp4,*.ac3,*.aac,*.mka,*.m4a,*.w64)|*.wav;*.mp3;*.ogg;*.flac;*.mp4;*.ac3;*.aac;*.mka;*.m4a;*.w64|")
|
wxString str = wxString(_("Audio Formats")) + " (*.wav,*.mp3,*.ogg,*.flac,*.mp4,*.ac3,*.aac,*.mka,*.m4a,*.w64)|*.wav;*.mp3;*.ogg;*.flac;*.mp4;*.ac3;*.aac;*.mka;*.m4a;*.w64|"
|
||||||
+ _("Video Formats") + _T(" (*.avi,*.mkv,*.ogm,*.mpg,*.mpeg)|*.avi;*.mkv;*.ogm;*.mp4;*.mpeg;*.mpg|")
|
+ _("Video Formats") + " (*.avi,*.mkv,*.ogm,*.mpg,*.mpeg)|*.avi;*.mkv;*.ogm;*.mp4;*.mpeg;*.mpg|"
|
||||||
+ _("All files") + _T(" (*.*)|*.*");
|
+ _("All files") + " (*.*)|*.*";
|
||||||
wxString filename = wxFileSelector(_("Open audio file"),path,_T(""),_T(""),str,wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
wxString filename = wxFileSelector(_("Open audio file"),path,"","",str,wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
c->audioController->OpenAudio(filename);
|
c->audioController->OpenAudio(filename);
|
||||||
OPT_SET("Path/Last/Audio")->SetString(STD_STR(filename));
|
OPT_SET("Path/Last/Audio")->SetString(STD_STR(filename));
|
||||||
|
@ -109,7 +109,7 @@ struct audio_open_blank : public Command {
|
||||||
STR_HELP("Open a 150 minutes blank audio clip, for debugging.")
|
STR_HELP("Open a 150 minutes blank audio clip, for debugging.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->audioController->OpenAudio(_T("dummy-audio:silence?sr=44100&bd=16&ch=1&ln=396900000"));
|
c->audioController->OpenAudio("dummy-audio:silence?sr=44100&bd=16&ch=1&ln=396900000");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ struct audio_open_noise : public Command {
|
||||||
STR_HELP("Open a 150 minutes noise-filled audio clip, for debugging.")
|
STR_HELP("Open a 150 minutes noise-filled audio clip, for debugging.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->audioController->OpenAudio(_T("dummy-audio:noise?sr=44100&bd=16&ch=1&ln=396900000"));
|
c->audioController->OpenAudio("dummy-audio:noise?sr=44100&bd=16&ch=1&ln=396900000");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -77,10 +77,10 @@ struct am_manager : public Command {
|
||||||
for (size_t i = 0; i < scripts.size(); ++i) {
|
for (size_t i = 0; i < scripts.size(); ++i) {
|
||||||
try {
|
try {
|
||||||
scripts[i]->Reload();
|
scripts[i]->Reload();
|
||||||
} catch (const wchar_t *e) {
|
} catch (const char *e) {
|
||||||
wxLogError(e);
|
wxLogError(e);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
wxLogError(_T("An unknown error occurred reloading Automation script '%s'."), scripts[i]->GetName().c_str());
|
wxLogError("An unknown error occurred reloading Automation script '%s'.", scripts[i]->GetName().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ static void combine_karaoke(AssDialogue *first, AssDialogue *second) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void combine_concat(AssDialogue *first, AssDialogue *second) {
|
static void combine_concat(AssDialogue *first, AssDialogue *second) {
|
||||||
first->Text += L"\\N" + second->Text;
|
first->Text += "\\N" + second->Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void combine_drop(AssDialogue *, AssDialogue *) { }
|
static void combine_drop(AssDialogue *, AssDialogue *) { }
|
||||||
|
|
|
@ -65,14 +65,14 @@ struct help_bugs : public Command {
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
if (wxGetMouseState().CmdDown()) {
|
if (wxGetMouseState().CmdDown()) {
|
||||||
if (wxGetMouseState().ShiftDown()) {
|
if (wxGetMouseState().ShiftDown()) {
|
||||||
wxMessageBox(_T("Now crashing with an access violation..."));
|
wxMessageBox("Now crashing with an access violation...");
|
||||||
for (char *foo = (char*)0;;) *foo++ = 42;
|
for (char *foo = (char*)0;;) *foo++ = 42;
|
||||||
} else {
|
} else {
|
||||||
wxMessageBox(_T("Now crashing with an unhandled exception..."));
|
wxMessageBox("Now crashing with an unhandled exception...");
|
||||||
throw c->parent;
|
throw c->parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AegisubApp::OpenURL(_T("http://devel.aegisub.org/"));
|
AegisubApp::OpenURL("http://devel.aegisub.org/");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ struct help_contents : public Command {
|
||||||
STR_HELP("Help topics.")
|
STR_HELP("Help topics.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
HelpButton::OpenPage(_T("Main"));
|
HelpButton::OpenPage("Main");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ struct help_files : public Command {
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
char *shared_path = agi::util::OSX_GetBundleSharedSupportDirectory();
|
char *shared_path = agi::util::OSX_GetBundleSharedSupportDirectory();
|
||||||
wxString help_path = wxString::Format(_T("%s/doc"), wxString(shared_path, wxConvUTF8).c_str());
|
wxString help_path = wxString::Format("%s/doc", wxString(shared_path, wxConvUTF8).c_str());
|
||||||
agi::util::OSX_OpenLocation(help_path.c_str());
|
agi::util::OSX_OpenLocation(help_path.c_str());
|
||||||
free(shared_path);
|
free(shared_path);
|
||||||
#endif
|
#endif
|
||||||
|
@ -116,7 +116,7 @@ struct help_forums : public Command {
|
||||||
STR_HELP("Visit Aegisub's forums.")
|
STR_HELP("Visit Aegisub's forums.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
AegisubApp::OpenURL(_T("http://forum.aegisub.org/"));
|
AegisubApp::OpenURL("http://forum.aegisub.org/");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ struct help_irc : public Command {
|
||||||
STR_HELP("Visit Aegisub's official IRC channel.")
|
STR_HELP("Visit Aegisub's official IRC channel.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
AegisubApp::OpenURL(_T("irc://irc.rizon.net/aegisub"));
|
AegisubApp::OpenURL("irc://irc.rizon.net/aegisub");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ struct help_website : public Command {
|
||||||
STR_HELP("Visit Aegisub's official website.")
|
STR_HELP("Visit Aegisub's official website.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
AegisubApp::OpenURL(_T("http://www.aegisub.org/"));
|
AegisubApp::OpenURL("http://www.aegisub.org/");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,11 +83,11 @@ struct keyframe_open : public Command {
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Keyframes")->GetString());
|
wxString path = lagi_wxString(OPT_GET("Path/Last/Keyframes")->GetString());
|
||||||
wxString filename = wxFileSelector(
|
wxString filename = wxFileSelector(
|
||||||
_T("Select the keyframes file to open"),
|
"Select the keyframes file to open",
|
||||||
path,
|
path,
|
||||||
_T("")
|
""
|
||||||
,_T(".txt"),
|
,".txt",
|
||||||
_T("All supported formats (*.txt, *.pass, *.stats, *.log)|*.txt;*.pass;*.stats;*.log|All files (*.*)|*.*"),
|
"All supported formats (*.txt, *.pass, *.stats, *.log)|*.txt;*.pass;*.stats;*.log|All files (*.*)|*.*",
|
||||||
wxFD_FILE_MUST_EXIST | wxFD_OPEN);
|
wxFD_FILE_MUST_EXIST | wxFD_OPEN);
|
||||||
|
|
||||||
if (filename.empty()) return;
|
if (filename.empty()) return;
|
||||||
|
@ -111,7 +111,7 @@ struct keyframe_save : public Command {
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Keyframes")->GetString());
|
wxString path = lagi_wxString(OPT_GET("Path/Last/Keyframes")->GetString());
|
||||||
wxString filename = wxFileSelector(_T("Select the Keyframes file to open"),path,_T(""),_T("*.key.txt"),_T("Text files (*.txt)|*.txt"),wxFD_OVERWRITE_PROMPT | wxFD_SAVE);
|
wxString filename = wxFileSelector("Select the Keyframes file to open",path,"","*.key.txt","Text files (*.txt)|*.txt",wxFD_OVERWRITE_PROMPT | wxFD_SAVE);
|
||||||
if (filename.empty()) return;
|
if (filename.empty()) return;
|
||||||
OPT_SET("Path/Last/Keyframes")->SetString(STD_STR(filename));
|
OPT_SET("Path/Last/Keyframes")->SetString(STD_STR(filename));
|
||||||
c->videoController->SaveKeyframes(filename);
|
c->videoController->SaveKeyframes(filename);
|
||||||
|
|
|
@ -259,7 +259,7 @@ struct subtitle_open : public Command {
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||||
wxString filename = wxFileSelector(_("Open subtitles file"),path,_T(""),_T(""),AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
wxGetApp().frame->LoadSubtitles(filename);
|
wxGetApp().frame->LoadSubtitles(filename);
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ struct subtitle_open_charset : public Command {
|
||||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||||
|
|
||||||
// Get options and load
|
// Get options and load
|
||||||
wxString filename = wxFileSelector(_("Open subtitles file"),path,_T(""),_T(""),AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
wxString charset = wxGetSingleChoice(_("Choose charset code:"), _("Charset"), agi::charset::GetEncodingsList<wxArrayString>(), c->parent, -1, -1, true, 250, 200);
|
wxString charset = wxGetSingleChoice(_("Choose charset code:"), _("Charset"), agi::charset::GetEncodingsList<wxArrayString>(), c->parent, -1, -1, true, 250, 200);
|
||||||
if (!charset.empty()) {
|
if (!charset.empty()) {
|
||||||
|
@ -336,7 +336,7 @@ static void save_subtitles(agi::Context *c, wxString filename) {
|
||||||
catch (const agi::Exception& err) {
|
catch (const agi::Exception& err) {
|
||||||
wxMessageBox(lagi_wxString(err.GetMessage()), "Error", wxOK | wxICON_ERROR, NULL);
|
wxMessageBox(lagi_wxString(err.GetMessage()), "Error", wxOK | wxICON_ERROR, NULL);
|
||||||
}
|
}
|
||||||
catch (const wchar_t *err) {
|
catch (const char *err) {
|
||||||
wxMessageBox(err, "Error", wxOK | wxICON_ERROR, NULL);
|
wxMessageBox(err, "Error", wxOK | wxICON_ERROR, NULL);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
|
|
@ -81,8 +81,8 @@ struct timecode_open : public Command {
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Timecodes")->GetString());
|
wxString path = lagi_wxString(OPT_GET("Path/Last/Timecodes")->GetString());
|
||||||
wxString str = wxString(_("All Supported Types")) + _T("(*.txt)|*.txt|") + _("All Files") + _T(" (*.*)|*.*");
|
wxString str = wxString(_("All Supported Types")) + "(*.txt)|*.txt|" + _("All Files") + " (*.*)|*.*";
|
||||||
wxString filename = wxFileSelector(_("Open timecodes file"),path,_T(""),_T(""),str,wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
wxString filename = wxFileSelector(_("Open timecodes file"),path,"","",str,wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
c->videoController->LoadTimecodes(filename);
|
c->videoController->LoadTimecodes(filename);
|
||||||
OPT_SET("Path/Last/Timecodes")->SetString(STD_STR(filename));
|
OPT_SET("Path/Last/Timecodes")->SetString(STD_STR(filename));
|
||||||
|
@ -105,8 +105,8 @@ struct timecode_save : public Command {
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Timecodes")->GetString());
|
wxString path = lagi_wxString(OPT_GET("Path/Last/Timecodes")->GetString());
|
||||||
wxString str = wxString(_("All Supported Types")) + _T("(*.txt)|*.txt|") + _("All Files") + _T(" (*.*)|*.*");
|
wxString str = wxString(_("All Supported Types")) + "(*.txt)|*.txt|" + _("All Files") + " (*.*)|*.*";
|
||||||
wxString filename = wxFileSelector(_("Save timecodes file"),path,_T(""),_T(""),str,wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
wxString filename = wxFileSelector(_("Save timecodes file"),path,"","",str,wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
c->videoController->SaveTimecodes(filename);
|
c->videoController->SaveTimecodes(filename);
|
||||||
OPT_SET("Path/Last/Timecodes")->SetString(STD_STR(filename));
|
OPT_SET("Path/Last/Timecodes")->SetString(STD_STR(filename));
|
||||||
|
|
|
@ -133,7 +133,7 @@ struct video_aspect_custom : public validator_video_attached {
|
||||||
//Why bloat using Contains when we can just check the output of Find?
|
//Why bloat using Contains when we can just check the output of Find?
|
||||||
pos = value.Find(':');
|
pos = value.Find(':');
|
||||||
if (pos==wxNOT_FOUND) pos = value.Find('/');
|
if (pos==wxNOT_FOUND) pos = value.Find('/');
|
||||||
if (pos==wxNOT_FOUND&&value.Contains(_T('x'))) {
|
if (pos==wxNOT_FOUND&&value.Contains('x')) {
|
||||||
pos = value.Find('x');
|
pos = value.Find('x');
|
||||||
scale=true;
|
scale=true;
|
||||||
}
|
}
|
||||||
|
@ -556,9 +556,9 @@ struct video_open : public Command {
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Video")->GetString());
|
wxString path = lagi_wxString(OPT_GET("Path/Last/Video")->GetString());
|
||||||
wxString str = wxString(_("Video Formats")) + _T(" (*.avi,*.mkv,*.mp4,*.avs,*.d2v,*.ogm,*.mpeg,*.mpg,*.vob,*.mov)|*.avi;*.avs;*.d2v;*.mkv;*.ogm;*.mp4;*.mpeg;*.mpg;*.vob;*.mov|")
|
wxString str = wxString(_("Video Formats")) + " (*.avi,*.mkv,*.mp4,*.avs,*.d2v,*.ogm,*.mpeg,*.mpg,*.vob,*.mov)|*.avi;*.avs;*.d2v;*.mkv;*.ogm;*.mp4;*.mpeg;*.mpg;*.vob;*.mov|"
|
||||||
+ _("All Files") + _T(" (*.*)|*.*");
|
+ _("All Files") + " (*.*)|*.*";
|
||||||
wxString filename = wxFileSelector(_("Open video file"),path,_T(""),_T(""),str,wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
wxString filename = wxFileSelector(_("Open video file"),path,"","",str,wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
c->videoController->SetVideo(filename);
|
c->videoController->SetVideo(filename);
|
||||||
OPT_SET("Path/Last/Video")->SetString(STD_STR(filename));
|
OPT_SET("Path/Last/Video")->SetString(STD_STR(filename));
|
||||||
|
|
|
@ -61,91 +61,91 @@ AboutScreen::AboutScreen(wxWindow *parent)
|
||||||
: wxDialog (parent, -1, _("About Aegisub"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX , _("About Aegisub"))
|
: wxDialog (parent, -1, _("About Aegisub"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX , _("About Aegisub"))
|
||||||
{
|
{
|
||||||
// Generate library string
|
// Generate library string
|
||||||
wxString libString = _T("Aegisub includes portions from the following other projects:\n");
|
wxString libString = "Aegisub includes portions from the following other projects:\n";
|
||||||
libString += _T(" wxWidgets - Copyright (c) Julian Smart, Robert Roebling et al;\n");
|
libString += " wxWidgets - Copyright (c) Julian Smart, Robert Roebling et al;\n";
|
||||||
libString += _T(" wxStyledTextCtrl - Copyright (c) Robin Dunn, Neil Hodgson;\n");
|
libString += " wxStyledTextCtrl - Copyright (c) Robin Dunn, Neil Hodgson;\n";
|
||||||
libString += _T(" Scintilla - Copyright (c) Neil Hodgson;\n");
|
libString += " Scintilla - Copyright (c) Neil Hodgson;\n";
|
||||||
libString += _T(" UniversalCharDet - Copyright (c) Netscape Communications Corp.;\n");
|
libString += " UniversalCharDet - Copyright (c) Netscape Communications Corp.;\n";
|
||||||
#ifdef WITH_AUTO4_LUA
|
#ifdef WITH_AUTO4_LUA
|
||||||
libString += _T(" Lua - Copyright (c) Lua.org, PUC-Rio;\n");
|
libString += " Lua - Copyright (c) Lua.org, PUC-Rio;\n";
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_HUNSPELL
|
#ifdef WITH_HUNSPELL
|
||||||
libString += _T(" Hunspell - Copyright (c) Kevin Hendricks;\n");
|
libString += " Hunspell - Copyright (c) Kevin Hendricks;\n";
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_PORTAUDIO
|
#ifdef WITH_PORTAUDIO
|
||||||
libString += _T(" PortAudio - Copyright (c) Ross Bencina, Phil Burk;\n");
|
libString += " PortAudio - Copyright (c) Ross Bencina, Phil Burk;\n";
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_FFMPEGSOURCE
|
#ifdef WITH_FFMPEGSOURCE
|
||||||
libString += _T(" FFmpeg - Copyright (c) Fabrice Bellard;\n");
|
libString += " FFmpeg - Copyright (c) Fabrice Bellard;\n";
|
||||||
libString += _T(" FFmpegSource - Copyright (c) Fredrik Mellbin;\n");
|
libString += " FFmpegSource - Copyright (c) Fredrik Mellbin;\n";
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_AVISYNTH
|
#ifdef WITH_AVISYNTH
|
||||||
libString += _T(" Avisynth 2.5 - Copyright (c) Ben Rudiak-Gould et al;\n");
|
libString += " Avisynth 2.5 - Copyright (c) Ben Rudiak-Gould et al;\n";
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_CSRI
|
#ifdef WITH_CSRI
|
||||||
libString += _T(" csri - Copyright (c) David Lamparter;\n");
|
libString += " csri - Copyright (c) David Lamparter;\n";
|
||||||
# ifdef __WINDOWS__
|
# ifdef __WINDOWS__
|
||||||
libString += _T(" vsfilter - Copyright (c) Gabest;\n");
|
libString += " vsfilter - Copyright (c) Gabest;\n";
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_LIBASS
|
#ifdef WITH_LIBASS
|
||||||
libString += _T(" libass - Copyright (c) Evgeniy Stepanov, Grigori Goronzy;\n");
|
libString += " libass - Copyright (c) Evgeniy Stepanov, Grigori Goronzy;\n";
|
||||||
#endif
|
#endif
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
libString += _T(" Matroska Parser - Copyright (c) Mike Matsnev;\n");
|
libString += " Matroska Parser - Copyright (c) Mike Matsnev;\n";
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_FREETYPE2
|
#ifdef WITH_FREETYPE2
|
||||||
libString += _T(" Freetype - Copyright (c) David Turner, Robert Wilhelm, Werner Lemberg;\n");
|
libString += " Freetype - Copyright (c) David Turner, Robert Wilhelm, Werner Lemberg;\n";
|
||||||
#endif
|
#endif
|
||||||
libString += _T(" MyThes - Copyright (c) Kevin B. Hendricks, Stratford, Ontario, Canada.\n");
|
libString += " MyThes - Copyright (c) Kevin B. Hendricks, Stratford, Ontario, Canada.\n";
|
||||||
|
|
||||||
wxString translatorCredit = _("Translated into LANGUAGE by PERSON\n");
|
wxString translatorCredit = _("Translated into LANGUAGE by PERSON\n");
|
||||||
if (translatorCredit == _T("Translated into LANGUAGE by PERSON\n")) translatorCredit.Clear();
|
if (translatorCredit == "Translated into LANGUAGE by PERSON\n") translatorCredit.Clear();
|
||||||
|
|
||||||
// Generate about string
|
// Generate about string
|
||||||
wxString aboutString;
|
wxString aboutString;
|
||||||
aboutString += wxString(_T("Aegisub ")) + GetAegisubShortVersionString() + _T(".\n");
|
aboutString += wxString("Aegisub ") + GetAegisubShortVersionString() + ".\n";
|
||||||
aboutString += _T("Copyright (c) 2005-2010 Rodrigo Braz Monteiro, Niels Martin Hansen et al.\n\n");
|
aboutString += "Copyright (c) 2005-2010 Rodrigo Braz Monteiro, Niels Martin Hansen et al.\n\n";
|
||||||
aboutString += _T("Programmers:\n");
|
aboutString += "Programmers:\n";
|
||||||
aboutString += _T(" Alysson Souza e Silva\n");
|
aboutString += " Alysson Souza e Silva\n";
|
||||||
aboutString += _T(" Amar Takhar\n");
|
aboutString += " Amar Takhar\n";
|
||||||
aboutString += _T(" Dan Donovan\n");
|
aboutString += " Dan Donovan\n";
|
||||||
aboutString += _T(" Daniel Moscoviter\n");
|
aboutString += " Daniel Moscoviter\n";
|
||||||
aboutString += _T(" David Conrad\n");
|
aboutString += " David Conrad\n";
|
||||||
aboutString += _T(" David Lamparter\n");
|
aboutString += " David Lamparter\n";
|
||||||
aboutString += _T(" Eric Batalitzky\n");
|
aboutString += " Eric Batalitzky\n";
|
||||||
aboutString += _T(" Evgeniy Stepanov\n");
|
aboutString += " Evgeniy Stepanov\n";
|
||||||
aboutString += _T(" Fredrik Mellbin\n");
|
aboutString += " Fredrik Mellbin\n";
|
||||||
aboutString += _T(" Grigori Goronzy\n");
|
aboutString += " Grigori Goronzy\n";
|
||||||
aboutString += _T(" Karl Blomster\n");
|
aboutString += " Karl Blomster\n";
|
||||||
aboutString += _T(" Mike Matsnev\n");
|
aboutString += " Mike Matsnev\n";
|
||||||
aboutString += _T(" Moritz Brunner\n");
|
aboutString += " Moritz Brunner\n";
|
||||||
aboutString += _T(" Muhammad Lukman Nasaruddin\n");
|
aboutString += " Muhammad Lukman Nasaruddin\n";
|
||||||
aboutString += _T(" Niels Martin Hansen\n");
|
aboutString += " Niels Martin Hansen\n";
|
||||||
aboutString += _T(" Patryk Pomykalski\n");
|
aboutString += " Patryk Pomykalski\n";
|
||||||
aboutString += _T(" Ravi Pinjala\n");
|
aboutString += " Ravi Pinjala\n";
|
||||||
aboutString += _T(" Rodrigo Braz Monteiro\n");
|
aboutString += " Rodrigo Braz Monteiro\n";
|
||||||
aboutString += _T(" Simone Cociancich\n");
|
aboutString += " Simone Cociancich\n";
|
||||||
aboutString += _T(" Thomas Goyne\n");
|
aboutString += " Thomas Goyne\n";
|
||||||
aboutString += _T("User manual written by:\n");
|
aboutString += "User manual written by:\n";
|
||||||
aboutString += _T(" Karl Blomster\n");
|
aboutString += " Karl Blomster\n";
|
||||||
aboutString += _T(" Niels Martin Hansen\n");
|
aboutString += " Niels Martin Hansen\n";
|
||||||
aboutString += _T(" Rodrigo Braz Monteiro\n");
|
aboutString += " Rodrigo Braz Monteiro\n";
|
||||||
aboutString += _T("Icons by:\n");
|
aboutString += "Icons by:\n";
|
||||||
aboutString += _T(" Philip Cash\n");
|
aboutString += " Philip Cash\n";
|
||||||
aboutString += _T("Additional thanks to:\n");
|
aboutString += "Additional thanks to:\n";
|
||||||
aboutString += _T(" Mentar\n");
|
aboutString += " Mentar\n";
|
||||||
aboutString += _T(" Sigurd Tao Lyngse\n");
|
aboutString += " Sigurd Tao Lyngse\n";
|
||||||
aboutString += _T(" Everyone in the Aegisub IRC channel\n");
|
aboutString += " Everyone in the Aegisub IRC channel\n";
|
||||||
aboutString += _T(" Everyone who ever reported a bug\n");
|
aboutString += " Everyone who ever reported a bug\n";
|
||||||
aboutString += translatorCredit;
|
aboutString += translatorCredit;
|
||||||
aboutString += _T("\n") + libString;
|
aboutString += "\n" + libString;
|
||||||
aboutString += _("\nSee the help file for full credits.\n");
|
aboutString += _("\nSee the help file for full credits.\n");
|
||||||
aboutString += wxString::Format(_("Built by %s on %s."), GetAegisubBuildCredit(), GetAegisubBuildTime());
|
aboutString += wxString::Format(_("Built by %s on %s."), GetAegisubBuildCredit(), GetAegisubBuildTime());
|
||||||
|
|
||||||
// Replace copyright symbol
|
// Replace copyright symbol
|
||||||
wxChar copySymbol = 0xA9;
|
wxChar copySymbol = 0xA9;
|
||||||
aboutString.Replace(_T("(c)"),wxString(copySymbol));
|
aboutString.Replace("(c)",wxString(copySymbol));
|
||||||
|
|
||||||
wxTextCtrl *textctrl = new wxTextCtrl(this, -1, aboutString, wxDefaultPosition, wxSize(-1,200), wxTE_MULTILINE|wxTE_READONLY|wxBORDER_NONE);
|
wxTextCtrl *textctrl = new wxTextCtrl(this, -1, aboutString, wxDefaultPosition, wxSize(-1,200), wxTE_MULTILINE|wxTE_READONLY|wxBORDER_NONE);
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ DialogAttachments::DialogAttachments(wxWindow *parent, AssFile *ass)
|
||||||
buttonSizer->Add(new wxButton(this,BUTTON_ATTACH_GRAPHICS,_("Attach &Graphics")),1,0,0);
|
buttonSizer->Add(new wxButton(this,BUTTON_ATTACH_GRAPHICS,_("Attach &Graphics")),1,0,0);
|
||||||
buttonSizer->Add(extractButton,1,0,0);
|
buttonSizer->Add(extractButton,1,0,0);
|
||||||
buttonSizer->Add(deleteButton,1,0,0);
|
buttonSizer->Add(deleteButton,1,0,0);
|
||||||
buttonSizer->Add(new HelpButton(this,_T("Attachment Manager")),1,wxLEFT,5);
|
buttonSizer->Add(new HelpButton(this,"Attachment Manager"),1,wxLEFT,5);
|
||||||
buttonSizer->Add(new wxButton(this,wxID_CANCEL,_("&Close")),1,0,0);
|
buttonSizer->Add(new wxButton(this,wxID_CANCEL,_("&Close")),1,0,0);
|
||||||
|
|
||||||
// Main sizer
|
// Main sizer
|
||||||
|
@ -140,10 +140,10 @@ DialogAttachments::~DialogAttachments() {
|
||||||
wxString last_section_name;
|
wxString last_section_name;
|
||||||
|
|
||||||
while (cur != ass->Line.begin()) {
|
while (cur != ass->Line.begin()) {
|
||||||
if (!((*cur)->group == L"[Fonts]" || (*cur)->group == L"[Graphics]"))
|
if (!((*cur)->group == "[Fonts]" || (*cur)->group == "[Graphics]"))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ((*cur)->GetEntryData() == L"[Fonts]" || (*cur)->GetEntryData() == L"[Graphics]") {
|
if ((*cur)->GetEntryData() == "[Fonts]" || (*cur)->GetEntryData() == "[Graphics]") {
|
||||||
if (found_attachments) {
|
if (found_attachments) {
|
||||||
--cur;
|
--cur;
|
||||||
continue;
|
continue;
|
||||||
|
@ -202,7 +202,7 @@ void DialogAttachments::OnAttachFont(wxCommandEvent &event) {
|
||||||
wxArrayString filenames;
|
wxArrayString filenames;
|
||||||
wxArrayString paths;
|
wxArrayString paths;
|
||||||
{
|
{
|
||||||
wxFileDialog diag (this,_("Choose file to be attached"), lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString()), _T(""), _T("Font Files (*.ttf)|*.ttf"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
|
wxFileDialog diag (this,_("Choose file to be attached"), lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString()), "", "Font Files (*.ttf)|*.ttf", wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
|
||||||
if (diag.ShowModal() == wxID_CANCEL) return;
|
if (diag.ShowModal() == wxID_CANCEL) return;
|
||||||
diag.GetFilenames(filenames);
|
diag.GetFilenames(filenames);
|
||||||
diag.GetPaths(paths);
|
diag.GetPaths(paths);
|
||||||
|
@ -219,7 +219,7 @@ void DialogAttachments::OnAttachFont(wxCommandEvent &event) {
|
||||||
delete newAttach;
|
delete newAttach;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newAttach->group = _T("[Fonts]");
|
newAttach->group = "[Fonts]";
|
||||||
ass->InsertAttachment(newAttach);
|
ass->InsertAttachment(newAttach);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ void DialogAttachments::OnAttachGraphics(wxCommandEvent &event) {
|
||||||
wxArrayString filenames;
|
wxArrayString filenames;
|
||||||
wxArrayString paths;
|
wxArrayString paths;
|
||||||
{
|
{
|
||||||
wxFileDialog diag (this,_("Choose file to be attached"), _T(""), _T(""), _T("Graphic Files (*.bmp,*.gif,*.jpg,*.ico,*.wmf)|*.bmp;*.gif;*.jpg;*.ico;*.wmf"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
|
wxFileDialog diag (this,_("Choose file to be attached"), "", "", "Graphic Files (*.bmp,*.gif,*.jpg,*.ico,*.wmf)|*.bmp;*.gif;*.jpg;*.ico;*.wmf", wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
|
||||||
if (diag.ShowModal() == wxID_CANCEL) return;
|
if (diag.ShowModal() == wxID_CANCEL) return;
|
||||||
diag.GetFilenames(filenames);
|
diag.GetFilenames(filenames);
|
||||||
diag.GetPaths(paths);
|
diag.GetPaths(paths);
|
||||||
|
@ -257,7 +257,7 @@ void DialogAttachments::OnAttachGraphics(wxCommandEvent &event) {
|
||||||
delete newAttach;
|
delete newAttach;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newAttach->group = _T("[Graphics]");
|
newAttach->group = "[Graphics]";
|
||||||
ass->InsertAttachment(newAttach);
|
ass->InsertAttachment(newAttach);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ void DialogAttachments::OnExtract(wxCommandEvent &event) {
|
||||||
bool fullPath = false;
|
bool fullPath = false;
|
||||||
|
|
||||||
// Multiple or single?
|
// Multiple or single?
|
||||||
if (listView->GetNextSelected(i) != -1) path = wxDirSelector(_("Select the path to save the files to:"),lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString())) + _T("/");
|
if (listView->GetNextSelected(i) != -1) path = wxDirSelector(_("Select the path to save the files to:"),lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString())) + "/";
|
||||||
else {
|
else {
|
||||||
// Default path
|
// Default path
|
||||||
wxString defPath = ((AssAttachment*) wxUIntToPtr(listView->GetItemData(i)))->GetFileName();
|
wxString defPath = ((AssAttachment*) wxUIntToPtr(listView->GetItemData(i)))->GetFileName();
|
||||||
|
|
|
@ -78,7 +78,7 @@ DialogAutomation::DialogAutomation(wxWindow *parent, Automation4::ScriptManager
|
||||||
close_button = new wxButton(this, wxID_CANCEL, _("&Close"));
|
close_button = new wxButton(this, wxID_CANCEL, _("&Close"));
|
||||||
|
|
||||||
// add headers to list view
|
// add headers to list view
|
||||||
list->InsertColumn(0, _T(""), wxLIST_FORMAT_CENTER, 20);
|
list->InsertColumn(0, "", wxLIST_FORMAT_CENTER, 20);
|
||||||
list->InsertColumn(1, _("Name"), wxLIST_FORMAT_LEFT, 140);
|
list->InsertColumn(1, _("Name"), wxLIST_FORMAT_LEFT, 140);
|
||||||
list->InsertColumn(2, _("Filename"), wxLIST_FORMAT_LEFT, 90);
|
list->InsertColumn(2, _("Filename"), wxLIST_FORMAT_LEFT, 90);
|
||||||
list->InsertColumn(3, _("Description"), wxLIST_FORMAT_LEFT, 330);
|
list->InsertColumn(3, _("Description"), wxLIST_FORMAT_LEFT, 330);
|
||||||
|
@ -94,7 +94,7 @@ DialogAutomation::DialogAutomation(wxWindow *parent, Automation4::ScriptManager
|
||||||
button_box->AddSpacer(10);
|
button_box->AddSpacer(10);
|
||||||
button_box->Add(reload_autoload_button, 0);
|
button_box->Add(reload_autoload_button, 0);
|
||||||
button_box->AddSpacer(10);
|
button_box->AddSpacer(10);
|
||||||
button_box->Add(new HelpButton(this,_T("Automation Manager")), 0);
|
button_box->Add(new HelpButton(this,"Automation Manager"), 0);
|
||||||
button_box->Add(close_button, 0);
|
button_box->Add(close_button, 0);
|
||||||
button_box->AddStretchSpacer(2);
|
button_box->AddStretchSpacer(2);
|
||||||
|
|
||||||
|
@ -154,9 +154,9 @@ void DialogAutomation::AddScript(ExtraScriptInfo &ei)
|
||||||
|
|
||||||
wxListItem itm;
|
wxListItem itm;
|
||||||
if (ei.is_global) {
|
if (ei.is_global) {
|
||||||
itm.SetText(_T("G"));
|
itm.SetText("G");
|
||||||
} else {
|
} else {
|
||||||
itm.SetText(_T("L"));
|
itm.SetText("L");
|
||||||
}
|
}
|
||||||
itm.SetData((int)script_info.size()-1);
|
itm.SetData((int)script_info.size()-1);
|
||||||
itm.SetId(list->GetItemCount());
|
itm.SetId(list->GetItemCount());
|
||||||
|
@ -215,19 +215,19 @@ void DialogAutomation::OnAdd(wxCommandEvent &evt)
|
||||||
const Automation4::ScriptFactory *fact = factories[i];
|
const Automation4::ScriptFactory *fact = factories[i];
|
||||||
if (fact->GetEngineName().IsEmpty() || fact->GetFilenamePattern().IsEmpty())
|
if (fact->GetEngineName().IsEmpty() || fact->GetFilenamePattern().IsEmpty())
|
||||||
continue;
|
continue;
|
||||||
fnfilter = wxString::Format(_T("%s%s scripts (%s)|%s|"), fnfilter.c_str(), fact->GetEngineName().c_str(), fact->GetFilenamePattern().c_str(), fact->GetFilenamePattern().c_str());
|
fnfilter = wxString::Format("%s%s scripts (%s)|%s|", fnfilter.c_str(), fact->GetEngineName().c_str(), fact->GetFilenamePattern().c_str(), fact->GetFilenamePattern().c_str());
|
||||||
catchall << fact->GetFilenamePattern() << _T(";");
|
catchall << fact->GetFilenamePattern() << ";";
|
||||||
}
|
}
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
fnfilter += _T("All files|*.*");
|
fnfilter += "All files|*.*";
|
||||||
#else
|
#else
|
||||||
fnfilter += _T("All files|*");
|
fnfilter += "All files|*";
|
||||||
#endif
|
#endif
|
||||||
if (!catchall.IsEmpty()) {
|
if (!catchall.IsEmpty()) {
|
||||||
catchall.RemoveLast();
|
catchall.RemoveLast();
|
||||||
}
|
}
|
||||||
if (factories.size() > 1) {
|
if (factories.size() > 1) {
|
||||||
fnfilter = _T("All supported scripts|") + catchall + _T("|") + fnfilter;
|
fnfilter = "All supported scripts|" + catchall + "|" + fnfilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString fname = wxFileSelector(_("Add Automation script"), lagi_wxString(OPT_GET("Path/Last/Automation")->GetString()), wxEmptyString, wxEmptyString, fnfilter, wxFD_OPEN|wxFD_FILE_MUST_EXIST, this);
|
wxString fname = wxFileSelector(_("Add Automation script"), lagi_wxString(OPT_GET("Path/Last/Automation")->GetString()), wxEmptyString, wxEmptyString, fnfilter, wxFD_OPEN|wxFD_FILE_MUST_EXIST, this);
|
||||||
|
@ -248,11 +248,11 @@ void DialogAutomation::OnAdd(wxCommandEvent &evt)
|
||||||
ei.is_global = false;
|
ei.is_global = false;
|
||||||
AddScript(ei);
|
AddScript(ei);
|
||||||
}
|
}
|
||||||
catch (const wchar_t *e) {
|
catch (const char *e) {
|
||||||
wxLogError(e);
|
wxLogError(e);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
wxLogError(_T("Unknown error loading script"));
|
wxLogError("Unknown error loading script");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,11 +288,11 @@ void DialogAutomation::OnReload(wxCommandEvent &evt)
|
||||||
try {
|
try {
|
||||||
ei.script->Reload();
|
ei.script->Reload();
|
||||||
}
|
}
|
||||||
catch (const wchar_t *e) {
|
catch (const char *e) {
|
||||||
wxMessageBox(e, _T("Error reloading Automation script"), wxOK|wxICON_ERROR, this);
|
wxMessageBox(e, "Error reloading Automation script", wxOK|wxICON_ERROR, this);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
wxMessageBox(_T("An unknown error occurred reloading Automation script."), _T("Error reloading Automation script"), wxOK|wxICON_ERROR, this);
|
wxMessageBox("An unknown error occurred reloading Automation script.", "Error reloading Automation script", wxOK|wxICON_ERROR, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
list->SetItem(i, 1, ei.script->GetName());
|
list->SetItem(i, 1, ei.script->GetName());
|
||||||
|
@ -323,7 +323,7 @@ void DialogAutomation::OnInfo(wxCommandEvent &evt)
|
||||||
info += _("Scripting engines installed:\n");
|
info += _("Scripting engines installed:\n");
|
||||||
const std::vector<Automation4::ScriptFactory*> &factories = Automation4::ScriptFactory::GetFactories();
|
const std::vector<Automation4::ScriptFactory*> &factories = Automation4::ScriptFactory::GetFactories();
|
||||||
for (std::vector<Automation4::ScriptFactory*>::const_iterator c = factories.begin(); c != factories.end(); ++c) {
|
for (std::vector<Automation4::ScriptFactory*>::const_iterator c = factories.begin(); c != factories.end(); ++c) {
|
||||||
info += wxString::Format(_T("- %s (%s)\n"), (*c)->GetEngineName().c_str(), (*c)->GetFilenamePattern().c_str());
|
info += wxString::Format("- %s (%s)\n", (*c)->GetEngineName().c_str(), (*c)->GetFilenamePattern().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ei) {
|
if (ei) {
|
||||||
|
@ -343,9 +343,9 @@ void DialogAutomation::OnInfo(wxCommandEvent &evt)
|
||||||
case Automation4::SCRIPTFEATURE_SUBFORMAT:
|
case Automation4::SCRIPTFEATURE_SUBFORMAT:
|
||||||
info += _(" Subtitle format handler: "); break;
|
info += _(" Subtitle format handler: "); break;
|
||||||
default:
|
default:
|
||||||
info += _T(" Unknown class: "); break;
|
info += " Unknown class: "; break;
|
||||||
}
|
}
|
||||||
info += (*f)->GetName() + _T("\n");
|
info += (*f)->GetName() + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -560,7 +560,7 @@ ColorPickerRecent::ColorPickerRecent(wxWindow *parent, wxWindowID id, int _cols,
|
||||||
void ColorPickerRecent::LoadFromString(const wxString &recent_string)
|
void ColorPickerRecent::LoadFromString(const wxString &recent_string)
|
||||||
{
|
{
|
||||||
colors.clear();
|
colors.clear();
|
||||||
wxStringTokenizer toker(recent_string, _T(" "), false);
|
wxStringTokenizer toker(recent_string, " ", false);
|
||||||
while (toker.HasMoreTokens()) {
|
while (toker.HasMoreTokens()) {
|
||||||
AssColor color;
|
AssColor color;
|
||||||
color.Parse(toker.NextToken());
|
color.Parse(toker.NextToken());
|
||||||
|
@ -582,7 +582,7 @@ wxString ColorPickerRecent::StoreToString()
|
||||||
wxString res;
|
wxString res;
|
||||||
for (int i = 0; i < rows*cols; i++) {
|
for (int i = 0; i < rows*cols; i++) {
|
||||||
AssColor color(colors[i]);
|
AssColor color(colors[i]);
|
||||||
res << color.GetASSFormatted(false, false, false) << _T(" ");
|
res << color.GetASSFormatted(false, false, false) << " ";
|
||||||
}
|
}
|
||||||
res.Trim(true);
|
res.Trim(true);
|
||||||
return res;
|
return res;
|
||||||
|
@ -931,29 +931,29 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color, C
|
||||||
wxSizer *spectrum_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Colour spectrum"));
|
wxSizer *spectrum_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Colour spectrum"));
|
||||||
spectrum = new ColorPickerSpectrum(this, SELECTOR_SPECTRUM, 0, -1, -1, ColorPickerSpectrum::HorzVert, wxSize(256, 256));
|
spectrum = new ColorPickerSpectrum(this, SELECTOR_SPECTRUM, 0, -1, -1, ColorPickerSpectrum::HorzVert, wxSize(256, 256));
|
||||||
slider = new ColorPickerSpectrum(this, SELECTOR_SLIDER, 0, -1, -1, ColorPickerSpectrum::Vert, wxSize(slider_width, 256));
|
slider = new ColorPickerSpectrum(this, SELECTOR_SLIDER, 0, -1, -1, ColorPickerSpectrum::Vert, wxSize(slider_width, 256));
|
||||||
wxString modes[] = { _("RGB/R"), _("RGB/G"), _("RGB/B"), _("HSL/L"), _("HSV/H") };
|
wxString modes[] = { _("RGB/R"), _("RGB/G"), _("RGB/B"), _("HSL/"), _("HSV/H") };
|
||||||
colorspace_choice = new wxChoice(this, SELECTOR_MODE, wxDefaultPosition, wxDefaultSize, 5, modes);
|
colorspace_choice = new wxChoice(this, SELECTOR_MODE, wxDefaultPosition, wxDefaultSize, 5, modes);
|
||||||
|
|
||||||
wxSize colorinput_size(70, -1);
|
wxSize colorinput_size(70, -1);
|
||||||
wxSize colorinput_labelsize(40, -1);
|
wxSize colorinput_labelsize(40, -1);
|
||||||
|
|
||||||
wxSizer *rgb_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("RGB colour"));
|
wxSizer *rgb_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("RGB colour"));
|
||||||
rgb_input[0] = new wxSpinCtrl(this, SELECTOR_RGB_R, _T(""), wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
rgb_input[0] = new wxSpinCtrl(this, SELECTOR_RGB_R, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
||||||
rgb_input[1] = new wxSpinCtrl(this, SELECTOR_RGB_G, _T(""), wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
rgb_input[1] = new wxSpinCtrl(this, SELECTOR_RGB_G, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
||||||
rgb_input[2] = new wxSpinCtrl(this, SELECTOR_RGB_B, _T(""), wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
rgb_input[2] = new wxSpinCtrl(this, SELECTOR_RGB_B, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
||||||
|
|
||||||
wxSizer *hsl_box = new wxStaticBoxSizer(wxVERTICAL, this, _("HSL colour"));
|
wxSizer *hsl_box = new wxStaticBoxSizer(wxVERTICAL, this, _("HSL colour"));
|
||||||
hsl_input[0] = new wxSpinCtrl(this, SELECTOR_HSL_H, _T(""), wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
hsl_input[0] = new wxSpinCtrl(this, SELECTOR_HSL_H, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
||||||
hsl_input[1] = new wxSpinCtrl(this, SELECTOR_HSL_S, _T(""), wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
hsl_input[1] = new wxSpinCtrl(this, SELECTOR_HSL_S, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
||||||
hsl_input[2] = new wxSpinCtrl(this, SELECTOR_HSL_L, _T(""), wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
hsl_input[2] = new wxSpinCtrl(this, SELECTOR_HSL_L, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
||||||
|
|
||||||
wxSizer *hsv_box = new wxStaticBoxSizer(wxVERTICAL, this, _("HSV colour"));
|
wxSizer *hsv_box = new wxStaticBoxSizer(wxVERTICAL, this, _("HSV colour"));
|
||||||
hsv_input[0] = new wxSpinCtrl(this, SELECTOR_HSV_H, _T(""), wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
hsv_input[0] = new wxSpinCtrl(this, SELECTOR_HSV_H, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
||||||
hsv_input[1] = new wxSpinCtrl(this, SELECTOR_HSV_S, _T(""), wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
hsv_input[1] = new wxSpinCtrl(this, SELECTOR_HSV_S, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
||||||
hsv_input[2] = new wxSpinCtrl(this, SELECTOR_HSV_V, _T(""), wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
hsv_input[2] = new wxSpinCtrl(this, SELECTOR_HSV_V, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
||||||
|
|
||||||
ass_input = new wxTextCtrl(this, SELECTOR_ASS_INPUT, _T(""), wxDefaultPosition, colorinput_size);
|
ass_input = new wxTextCtrl(this, SELECTOR_ASS_INPUT, "", wxDefaultPosition, colorinput_size);
|
||||||
html_input = new wxTextCtrl(this, SELECTOR_HTML_INPUT, _T(""), wxDefaultPosition, colorinput_size);
|
html_input = new wxTextCtrl(this, SELECTOR_HTML_INPUT, "", wxDefaultPosition, colorinput_size);
|
||||||
|
|
||||||
preview_bitmap = wxBitmap(40, 40, 24);
|
preview_bitmap = wxBitmap(40, 40, 24);
|
||||||
preview_box = new wxStaticBitmap(this, -1, preview_bitmap, wxDefaultPosition, wxSize(40, 40), STATIC_BORDER_FLAG);
|
preview_box = new wxStaticBitmap(this, -1, preview_bitmap, wxDefaultPosition, wxSize(40, 40), STATIC_BORDER_FLAG);
|
||||||
|
@ -989,9 +989,9 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color, C
|
||||||
rgb_box->Add(rgb_sizer, 1, wxEXPAND | wxALL, 3);
|
rgb_box->Add(rgb_sizer, 1, wxEXPAND | wxALL, 3);
|
||||||
|
|
||||||
wxFlexGridSizer *ass_input_sizer = new wxFlexGridSizer(2, 5, 5);
|
wxFlexGridSizer *ass_input_sizer = new wxFlexGridSizer(2, 5, 5);
|
||||||
ass_input_sizer->Add(new wxStaticText(this, -1, _T("ASS:"), wxDefaultPosition, colorinput_labelsize), 1, wxALIGN_CENTER_VERTICAL|wxEXPAND);
|
ass_input_sizer->Add(new wxStaticText(this, -1, "ASS:", wxDefaultPosition, colorinput_labelsize), 1, wxALIGN_CENTER_VERTICAL|wxEXPAND);
|
||||||
ass_input_sizer->Add(ass_input, 0);
|
ass_input_sizer->Add(ass_input, 0);
|
||||||
ass_input_sizer->Add(new wxStaticText(this, -1, _T("HTML:"), wxDefaultPosition, colorinput_labelsize), 1, wxALIGN_CENTER_VERTICAL|wxEXPAND);
|
ass_input_sizer->Add(new wxStaticText(this, -1, "HTML:", wxDefaultPosition, colorinput_labelsize), 1, wxALIGN_CENTER_VERTICAL|wxEXPAND);
|
||||||
ass_input_sizer->Add(html_input, 0);
|
ass_input_sizer->Add(html_input, 0);
|
||||||
ass_input_sizer->AddGrowableCol(0,1);
|
ass_input_sizer->AddGrowableCol(0,1);
|
||||||
rgb_box->Add(ass_input_sizer, 0, wxALL|wxCENTER|wxEXPAND, 3);
|
rgb_box->Add(ass_input_sizer, 0, wxALL|wxCENTER|wxEXPAND, 3);
|
||||||
|
@ -1023,7 +1023,7 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color, C
|
||||||
|
|
||||||
wxSizer *recent_sizer = new wxBoxSizer(wxVERTICAL);
|
wxSizer *recent_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
recent_sizer->Add(recent_box, 1, wxEXPAND);
|
recent_sizer->Add(recent_box, 1, wxEXPAND);
|
||||||
if (OPT_GET("Tool/Colour Picker/RGBAdjust Tool")->GetBool()) recent_sizer->Add(new wxButton(this,BUTTON_RGBADJUST,_T("rgbadjust()")), 0, wxEXPAND);
|
if (OPT_GET("Tool/Colour Picker/RGBAdjust Tool")->GetBool()) recent_sizer->Add(new wxButton(this,BUTTON_RGBADJUST,"rgbadjust()"), 0, wxEXPAND);
|
||||||
|
|
||||||
wxSizer *picker_sizer = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer *picker_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
picker_sizer->AddStretchSpacer();
|
picker_sizer->AddStretchSpacer();
|
||||||
|
@ -1675,7 +1675,7 @@ void DialogColorPicker::OnDropperMouse(wxMouseEvent &evt)
|
||||||
{
|
{
|
||||||
if (evt.LeftDown() && !screen_dropper_icon->HasCapture()) {
|
if (evt.LeftDown() && !screen_dropper_icon->HasCapture()) {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
screen_dropper_icon->SetCursor(wxCursor(_T("eyedropper_cursor")));
|
screen_dropper_icon->SetCursor(wxCursor("eyedropper_cursor"));
|
||||||
#else
|
#else
|
||||||
screen_dropper_icon->SetCursor(*wxCROSS_CURSOR);
|
screen_dropper_icon->SetCursor(*wxCROSS_CURSOR);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1732,7 +1732,7 @@ void DialogColorPicker::OnRGBAdjust(wxCommandEvent &evt)
|
||||||
double r = double(cur.Red()) / double(old.Red());
|
double r = double(cur.Red()) / double(old.Red());
|
||||||
double g = double(cur.Green()) / double(old.Green());
|
double g = double(cur.Green()) / double(old.Green());
|
||||||
double b = double(cur.Blue()) / double(old.Blue());
|
double b = double(cur.Blue()) / double(old.Blue());
|
||||||
wxString data = wxString::Format(L"rgbadjust(%g,%g,%g)", r, g, b);
|
wxString data = wxString::Format("rgbadjust(%g,%g,%g)", r, g, b);
|
||||||
|
|
||||||
if (wxTheClipboard->Open()) {
|
if (wxTheClipboard->Open()) {
|
||||||
wxTheClipboard->SetData(new wxTextDataObject(data));
|
wxTheClipboard->SetData(new wxTextDataObject(data));
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
struct ResolutionShortcut {
|
struct ResolutionShortcut {
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
const wxChar *name;
|
const char *name;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
int width;
|
int width;
|
||||||
|
@ -65,15 +65,15 @@ struct ResolutionShortcut {
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
static ResolutionShortcut resolutions[] = {
|
static ResolutionShortcut resolutions[] = {
|
||||||
{_T("640x480 (SD fullscreen)"), 640, 480},
|
{"640x480 (SD fullscreen)", 640, 480},
|
||||||
{_T("704x480 (SD anamorphic)"), 704, 480},
|
{"704x480 (SD anamorphic)", 704, 480},
|
||||||
{_T("640x360 (SD widescreen)"), 640, 360},
|
{"640x360 (SD widescreen)", 640, 360},
|
||||||
{_T("704x396 (SD widescreen)"), 704, 396},
|
{"704x396 (SD widescreen)", 704, 396},
|
||||||
{_T("640x352 (SD widescreen MOD16)"), 640, 352},
|
{"640x352 (SD widescreen MOD16)", 640, 352},
|
||||||
{_T("704x400 (SD widescreen MOD16)"), 704, 400},
|
{"704x400 (SD widescreen MOD16)", 704, 400},
|
||||||
{_T("1280x720 (HD 720p)"), 1280, 720},
|
{"1280x720 (HD 720p)", 1280, 720},
|
||||||
{_T("1920x1080 (HD 1080p)"), 1920, 1080},
|
{"1920x1080 (HD 1080p)", 1920, 1080},
|
||||||
{_T("1024x576 (SuperPAL widescreen)"), 1024, 576},
|
{"1024x576 (SuperPAL widescreen)", 1024, 576},
|
||||||
{0, 0, 0}
|
{0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,29 +95,29 @@ bool DialogDummyVideo::CreateDummyVideo(wxWindow *parent, wxString &out_filename
|
||||||
|
|
||||||
// Read back values and check sensibility
|
// Read back values and check sensibility
|
||||||
if (!dlg.fps->GetValue().ToDouble(&fps) || fps <= 0) {
|
if (!dlg.fps->GetValue().ToDouble(&fps) || fps <= 0) {
|
||||||
wxLogWarning(_T("Invalid framerate specified, assuming 23.976"));
|
wxLogWarning("Invalid framerate specified, assuming 23.976");
|
||||||
fps = 24/1.001;
|
fps = 24/1.001;
|
||||||
}
|
}
|
||||||
if (!dlg.width->GetValue().ToLong(&width) || width <= 0) {
|
if (!dlg.width->GetValue().ToLong(&width) || width <= 0) {
|
||||||
wxLogWarning(_T("Invalid width specified"));
|
wxLogWarning("Invalid width specified");
|
||||||
width = 0;
|
width = 0;
|
||||||
}
|
}
|
||||||
if (!dlg.height->GetValue().ToLong(&height) || height <= 0) {
|
if (!dlg.height->GetValue().ToLong(&height) || height <= 0) {
|
||||||
wxLogWarning(_T("Invalid height specified"));
|
wxLogWarning("Invalid height specified");
|
||||||
height = 0;
|
height = 0;
|
||||||
}
|
}
|
||||||
if (width == 0 && height == 0) {
|
if (width == 0 && height == 0) {
|
||||||
wxLogWarning(_T("Assuming 640x480"));
|
wxLogWarning("Assuming 640x480");
|
||||||
width = 640; height = 480;
|
width = 640; height = 480;
|
||||||
} else if (width == 0) {
|
} else if (width == 0) {
|
||||||
width = height * 4 / 3;
|
width = height * 4 / 3;
|
||||||
wxLogWarning(_T("Assuming 4:3 fullscreen, %dx%d"), width, height);
|
wxLogWarning("Assuming 4:3 fullscreen, %dx%d", width, height);
|
||||||
} else if (height == 0) {
|
} else if (height == 0) {
|
||||||
height = width * 3 / 4;
|
height = width * 3 / 4;
|
||||||
wxLogWarning(_T("Assuming 4:3 fullscreen, %dx%d"), width, height);
|
wxLogWarning("Assuming 4:3 fullscreen, %dx%d", width, height);
|
||||||
}
|
}
|
||||||
if ((length = dlg.length->GetValue()) <= 0) {
|
if ((length = dlg.length->GetValue()) <= 0) {
|
||||||
wxLogWarning(_T("Invalid duration, assuming 2 frames"));
|
wxLogWarning("Invalid duration, assuming 2 frames");
|
||||||
length = 2;
|
length = 2;
|
||||||
}
|
}
|
||||||
colour = dlg.colour->GetColour();
|
colour = dlg.colour->GetColour();
|
||||||
|
@ -148,14 +148,14 @@ DialogDummyVideo::DialogDummyVideo(wxWindow *parent)
|
||||||
{
|
{
|
||||||
// Main controls
|
// Main controls
|
||||||
length_display = 0;
|
length_display = 0;
|
||||||
resolution_shortcuts = new wxComboBox(this, Dummy_Video_Resolution_Shortcut, _T(""), wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY);
|
resolution_shortcuts = new wxComboBox(this, Dummy_Video_Resolution_Shortcut, "", wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY);
|
||||||
width = new wxTextCtrl(this, -1);
|
width = new wxTextCtrl(this, -1);
|
||||||
height = new wxTextCtrl(this, -1);
|
height = new wxTextCtrl(this, -1);
|
||||||
colour = new ColourButton(this, -1, wxSize(30, 17), lagi_wxColour(OPT_GET("Colour/Video Dummy/Last Colour")->GetColour()));
|
colour = new ColourButton(this, -1, wxSize(30, 17), lagi_wxColour(OPT_GET("Colour/Video Dummy/Last Colour")->GetColour()));
|
||||||
pattern = new wxCheckBox(this, -1, _("Checkerboard pattern"));
|
pattern = new wxCheckBox(this, -1, _("Checkerboard pattern"));
|
||||||
fps = new wxTextCtrl(this, Dummy_Video_FPS, wxString::Format("%f", OPT_GET("Video/Dummy/FPS")->GetDouble()));
|
fps = new wxTextCtrl(this, Dummy_Video_FPS, wxString::Format("%f", OPT_GET("Video/Dummy/FPS")->GetDouble()));
|
||||||
length = new wxSpinCtrl(this, Dummy_Video_Length, "", wxDefaultPosition, wxDefaultSize, 4096|wxALIGN_LEFT);
|
length = new wxSpinCtrl(this, Dummy_Video_Length, "", wxDefaultPosition, wxDefaultSize, 4096|wxALIGN_LEFT);
|
||||||
length_display = new wxStaticText(this, -1, _T(""));
|
length_display = new wxStaticText(this, -1, "");
|
||||||
|
|
||||||
// Support controls and layout
|
// Support controls and layout
|
||||||
wxFlexGridSizer *fg = new wxFlexGridSizer(2, 5, 5);
|
wxFlexGridSizer *fg = new wxFlexGridSizer(2, 5, 5);
|
||||||
|
@ -164,7 +164,7 @@ DialogDummyVideo::DialogDummyVideo(wxWindow *parent)
|
||||||
fg->AddStretchSpacer();
|
fg->AddStretchSpacer();
|
||||||
wxBoxSizer *res_sizer = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer *res_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
res_sizer->Add(width, 0, wxEXPAND);
|
res_sizer->Add(width, 0, wxEXPAND);
|
||||||
res_sizer->Add(new wxStaticText(this, -1, _T(" x ")), 0, wxALIGN_CENTRE_VERTICAL|wxFIXED_MINSIZE);
|
res_sizer->Add(new wxStaticText(this, -1, " x "), 0, wxALIGN_CENTRE_VERTICAL|wxFIXED_MINSIZE);
|
||||||
res_sizer->Add(height, 0, wxEXPAND);
|
res_sizer->Add(height, 0, wxEXPAND);
|
||||||
fg->Add(res_sizer, 0, wxEXPAND);
|
fg->Add(res_sizer, 0, wxEXPAND);
|
||||||
fg->Add(new wxStaticText(this, -1, _("Colour:")), 0, wxALIGN_CENTRE_VERTICAL);
|
fg->Add(new wxStaticText(this, -1, _("Colour:")), 0, wxALIGN_CENTRE_VERTICAL);
|
||||||
|
@ -185,7 +185,7 @@ DialogDummyVideo::DialogDummyVideo(wxWindow *parent)
|
||||||
wxStdDialogButtonSizer *btnSizer = new wxStdDialogButtonSizer();
|
wxStdDialogButtonSizer *btnSizer = new wxStdDialogButtonSizer();
|
||||||
btnSizer->AddButton(ok_button);
|
btnSizer->AddButton(ok_button);
|
||||||
btnSizer->AddButton(cancel_button);
|
btnSizer->AddButton(cancel_button);
|
||||||
btnSizer->AddButton(new HelpButton(this,_T("Dummy Video")));
|
btnSizer->AddButton(new HelpButton(this,"Dummy Video"));
|
||||||
btnSizer->Realize();
|
btnSizer->Realize();
|
||||||
main_sizer->Add(new wxStaticLine(this,wxHORIZONTAL),0,wxALL|wxEXPAND,5);
|
main_sizer->Add(new wxStaticLine(this,wxHORIZONTAL),0,wxALL|wxEXPAND,5);
|
||||||
main_sizer->Add(btnSizer,0,wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND,5);
|
main_sizer->Add(btnSizer,0,wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND,5);
|
||||||
|
@ -204,11 +204,11 @@ DialogDummyVideo::DialogDummyVideo(wxWindow *parent)
|
||||||
lastres++;
|
lastres++;
|
||||||
}
|
}
|
||||||
pattern->SetValue(OPT_GET("Video/Dummy/Pattern")->GetBool());
|
pattern->SetValue(OPT_GET("Video/Dummy/Pattern")->GetBool());
|
||||||
/*fps->Append(_T("23.976"));
|
/*fps->Append("23.976");
|
||||||
fps->Append(_T("29.97"));
|
fps->Append("29.97");
|
||||||
fps->Append(_T("24"));
|
fps->Append("24");
|
||||||
fps->Append(_T("25"));
|
fps->Append("25");
|
||||||
fps->Append(_T("30"));*/
|
fps->Append("30");*/
|
||||||
width->ChangeValue(AegiIntegerToString(OPT_GET("Video/Dummy/Last/Width")->GetInt()));
|
width->ChangeValue(AegiIntegerToString(OPT_GET("Video/Dummy/Last/Width")->GetInt()));
|
||||||
height->ChangeValue(AegiIntegerToString(OPT_GET("Video/Dummy/Last/Height")->GetInt()));
|
height->ChangeValue(AegiIntegerToString(OPT_GET("Video/Dummy/Last/Height")->GetInt()));
|
||||||
length->SetRange(0, 0x10000000);
|
length->SetRange(0, 0x10000000);
|
||||||
|
@ -245,8 +245,8 @@ END_EVENT_TABLE()
|
||||||
void DialogDummyVideo::OnResolutionShortcut(wxCommandEvent &evt)
|
void DialogDummyVideo::OnResolutionShortcut(wxCommandEvent &evt)
|
||||||
{
|
{
|
||||||
int rs = resolution_shortcuts->GetSelection();
|
int rs = resolution_shortcuts->GetSelection();
|
||||||
width->ChangeValue(wxString::Format(_T("%d"), resolutions[rs].width));
|
width->ChangeValue(wxString::Format("%d", resolutions[rs].width));
|
||||||
height->ChangeValue(wxString::Format(_T("%d"), resolutions[rs].height));
|
height->ChangeValue(wxString::Format("%d", resolutions[rs].height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
/// @param parent
|
/// @param parent
|
||||||
///
|
///
|
||||||
DialogExport::DialogExport (wxWindow *parent, AssFile *subs)
|
DialogExport::DialogExport (wxWindow *parent, AssFile *subs)
|
||||||
: wxDialog (parent, -1, _("Export"), wxDefaultPosition, wxSize(200,100), wxCAPTION | wxCLOSE_BOX, _T("Export"))
|
: wxDialog (parent, -1, _("Export"), wxDefaultPosition, wxSize(200,100), wxCAPTION | wxCLOSE_BOX, "Export")
|
||||||
{
|
{
|
||||||
// Filter list
|
// Filter list
|
||||||
wxSizer *TopSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Filters"));
|
wxSizer *TopSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Filters"));
|
||||||
|
@ -64,8 +64,8 @@ DialogExport::DialogExport (wxWindow *parent, AssFile *subs)
|
||||||
FilterList = new wxCheckListBox(this, Filter_List_Box, wxDefaultPosition, wxSize(200,100), filters);
|
FilterList = new wxCheckListBox(this, Filter_List_Box, wxDefaultPosition, wxSize(200,100), filters);
|
||||||
|
|
||||||
// Get selected filters
|
// Get selected filters
|
||||||
wxString selected = Export->GetOriginalSubs()->GetScriptInfo(_T("Export filters"));
|
wxString selected = Export->GetOriginalSubs()->GetScriptInfo("Export filters");
|
||||||
wxStringTokenizer token(selected, _T("|"));
|
wxStringTokenizer token(selected, "|");
|
||||||
int n = 0;
|
int n = 0;
|
||||||
while (token.HasMoreTokens()) {
|
while (token.HasMoreTokens()) {
|
||||||
wxString cur = token.GetNextToken();
|
wxString cur = token.GetNextToken();
|
||||||
|
@ -95,7 +95,7 @@ DialogExport::DialogExport (wxWindow *parent, AssFile *subs)
|
||||||
TopButtons->Add(new wxButton(this,Button_Select_None,_("Select none"),wxDefaultPosition,wxSize(80,-1)),1,wxEXPAND | wxRIGHT,0);
|
TopButtons->Add(new wxButton(this,Button_Select_None,_("Select none"),wxDefaultPosition,wxSize(80,-1)),1,wxEXPAND | wxRIGHT,0);
|
||||||
|
|
||||||
// Description field
|
// Description field
|
||||||
Description = new wxTextCtrl(this, -1, _T(""), wxDefaultPosition, wxSize(200,60), wxTE_MULTILINE | wxTE_READONLY);
|
Description = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxSize(200,60), wxTE_MULTILINE | wxTE_READONLY);
|
||||||
|
|
||||||
// Charset dropdown list
|
// Charset dropdown list
|
||||||
wxStaticText *charset_list_label = new wxStaticText(this, -1, _("Text encoding:"));
|
wxStaticText *charset_list_label = new wxStaticText(this, -1, _("Text encoding:"));
|
||||||
|
@ -103,8 +103,8 @@ DialogExport::DialogExport (wxWindow *parent, AssFile *subs)
|
||||||
wxSizer *charset_list_sizer = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer *charset_list_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
charset_list_sizer->Add(charset_list_label, 0, wxALIGN_CENTER | wxRIGHT, 5);
|
charset_list_sizer->Add(charset_list_label, 0, wxALIGN_CENTER | wxRIGHT, 5);
|
||||||
charset_list_sizer->Add(CharsetList, 1, wxEXPAND);
|
charset_list_sizer->Add(CharsetList, 1, wxEXPAND);
|
||||||
if (!CharsetList->SetStringSelection(Export->GetOriginalSubs()->GetScriptInfo(_T("Export Encoding")))) {
|
if (!CharsetList->SetStringSelection(Export->GetOriginalSubs()->GetScriptInfo("Export Encoding"))) {
|
||||||
CharsetList->SetStringSelection(_T("Unicode (UTF-8)"));
|
CharsetList->SetStringSelection("Unicode (UTF-8)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Top sizer
|
// Top sizer
|
||||||
|
@ -118,7 +118,7 @@ DialogExport::DialogExport (wxWindow *parent, AssFile *subs)
|
||||||
wxButton *process = new wxButton(this,Button_Process,_("Export..."));
|
wxButton *process = new wxButton(this,Button_Process,_("Export..."));
|
||||||
ButtonSizer->AddButton(process);
|
ButtonSizer->AddButton(process);
|
||||||
ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL));
|
ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL));
|
||||||
ButtonSizer->AddButton(new HelpButton(this,_T("Export")));
|
ButtonSizer->AddButton(new HelpButton(this,"Export"));
|
||||||
ButtonSizer->SetAffirmativeButton(process);
|
ButtonSizer->SetAffirmativeButton(process);
|
||||||
ButtonSizer->Realize();
|
ButtonSizer->Realize();
|
||||||
|
|
||||||
|
@ -149,12 +149,12 @@ DialogExport::~DialogExport() {
|
||||||
wxString infoList;
|
wxString infoList;
|
||||||
for (unsigned int i=0;i<FilterList->GetCount();i++) {
|
for (unsigned int i=0;i<FilterList->GetCount();i++) {
|
||||||
if (FilterList->IsChecked(i)) {
|
if (FilterList->IsChecked(i)) {
|
||||||
infoList += FilterList->GetString(i) + _T("|");
|
infoList += FilterList->GetString(i) + "|";
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (n > 0) infoList = infoList.Left(infoList.Length()-1);
|
if (n > 0) infoList = infoList.Left(infoList.Length()-1);
|
||||||
Export->GetOriginalSubs()->SetScriptInfo(_T("Export filters"),infoList);
|
Export->GetOriginalSubs()->SetScriptInfo("Export filters",infoList);
|
||||||
|
|
||||||
// Delete exporter
|
// Delete exporter
|
||||||
if (Export) delete Export;
|
if (Export) delete Export;
|
||||||
|
@ -196,7 +196,7 @@ END_EVENT_TABLE()
|
||||||
///
|
///
|
||||||
void DialogExport::OnProcess(wxCommandEvent &event) {
|
void DialogExport::OnProcess(wxCommandEvent &event) {
|
||||||
// Get destination
|
// Get destination
|
||||||
wxString filename = wxFileSelector(_("Export subtitles file"),_T(""),_T(""),_T(""),AssFile::GetWildcardList(2),wxFD_SAVE | wxFD_OVERWRITE_PROMPT,this);
|
wxString filename = wxFileSelector(_("Export subtitles file"),"","","",AssFile::GetWildcardList(2),wxFD_SAVE | wxFD_OVERWRITE_PROMPT,this);
|
||||||
if (filename.empty()) return;
|
if (filename.empty()) return;
|
||||||
|
|
||||||
// Add filters
|
// Add filters
|
||||||
|
@ -209,18 +209,18 @@ void DialogExport::OnProcess(wxCommandEvent &event) {
|
||||||
// Export
|
// Export
|
||||||
try {
|
try {
|
||||||
wxBusyCursor busy;
|
wxBusyCursor busy;
|
||||||
Export->GetOriginalSubs()->SetScriptInfo(_T("Export Encoding"), CharsetList->GetStringSelection());
|
Export->GetOriginalSubs()->SetScriptInfo("Export Encoding", CharsetList->GetStringSelection());
|
||||||
Export->Export(filename, CharsetList->GetStringSelection(), this);
|
Export->Export(filename, CharsetList->GetStringSelection(), this);
|
||||||
}
|
}
|
||||||
catch (const wchar_t *error) {
|
catch (const char *error) {
|
||||||
wxString err(error);
|
wxString err(error);
|
||||||
wxMessageBox(err, _T("Error exporting subtitles"), wxOK | wxICON_ERROR, this);
|
wxMessageBox(err, "Error exporting subtitles", wxOK | wxICON_ERROR, this);
|
||||||
}
|
}
|
||||||
catch (const agi::charset::ConvError& err) {
|
catch (const agi::charset::ConvError& err) {
|
||||||
wxMessageBox(err.GetMessage(), _T("Error exporting subtitles"), wxOK | wxICON_ERROR, this);
|
wxMessageBox(err.GetMessage(), "Error exporting subtitles", wxOK | wxICON_ERROR, this);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
wxMessageBox(_T("Unknown error"), _T("Error exporting subtitles"), wxOK | wxICON_ERROR, this);
|
wxMessageBox("Unknown error", "Error exporting subtitles", wxOK | wxICON_ERROR, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close dialog
|
// Close dialog
|
||||||
|
|
|
@ -99,11 +99,11 @@ DialogFontsCollector::DialogFontsCollector(wxWindow *parent, AssFile *ass)
|
||||||
|
|
||||||
// Destination box
|
// Destination box
|
||||||
wxString dest = lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString());
|
wxString dest = lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString());
|
||||||
if (dest == _T("?script")) {
|
if (dest == "?script") {
|
||||||
wxFileName filename(subs->filename);
|
wxFileName filename(subs->filename);
|
||||||
dest = filename.GetPath();
|
dest = filename.GetPath();
|
||||||
}
|
}
|
||||||
while (dest.Right(1) == _T("/")) dest = dest.Left(dest.Length()-1);
|
while (dest.Right(1) == "/") dest = dest.Left(dest.Length()-1);
|
||||||
DestBox = new wxTextCtrl(this,-1,dest,wxDefaultPosition,wxSize(250,20),0);
|
DestBox = new wxTextCtrl(this,-1,dest,wxDefaultPosition,wxSize(250,20),0);
|
||||||
BrowseButton = new wxButton(this,BROWSE_BUTTON,_("&Browse..."));
|
BrowseButton = new wxButton(this,BROWSE_BUTTON,_("&Browse..."));
|
||||||
wxSizer *DestBottomSizer = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer *DestBottomSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
@ -123,13 +123,13 @@ DialogFontsCollector::DialogFontsCollector(wxWindow *parent, AssFile *ass)
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
choices.Add(_("DEBUG: Verify all fonts in system"));
|
choices.Add(_("DEBUG: Verify all fonts in system"));
|
||||||
#endif
|
#endif
|
||||||
CollectAction = new wxRadioBox(this,RADIO_BOX,_T("Action"),wxDefaultPosition,wxDefaultSize,choices,1);
|
CollectAction = new wxRadioBox(this,RADIO_BOX, "Action",wxDefaultPosition,wxDefaultSize,choices,1);
|
||||||
size_t lastAction = OPT_GET("Tool/Fonts Collector/Action")->GetInt();
|
size_t lastAction = OPT_GET("Tool/Fonts Collector/Action")->GetInt();
|
||||||
if (lastAction >= choices.GetCount()) lastAction = 0;
|
if (lastAction >= choices.GetCount()) lastAction = 0;
|
||||||
CollectAction->SetSelection(lastAction);
|
CollectAction->SetSelection(lastAction);
|
||||||
|
|
||||||
// Log box
|
// Log box
|
||||||
LogBox = new ScintillaTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(300,210));
|
LogBox = new ScintillaTextCtrl(this,-1,"",wxDefaultPosition,wxSize(300,210));
|
||||||
LogBox->SetWrapMode(wxSTC_WRAP_WORD);
|
LogBox->SetWrapMode(wxSTC_WRAP_WORD);
|
||||||
LogBox->SetMarginWidth(1,0);
|
LogBox->SetMarginWidth(1,0);
|
||||||
LogBox->SetReadOnly(true);
|
LogBox->SetReadOnly(true);
|
||||||
|
@ -146,7 +146,7 @@ DialogFontsCollector::DialogFontsCollector(wxWindow *parent, AssFile *ass)
|
||||||
wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
|
wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
|
||||||
ButtonSizer->AddButton(StartButton);
|
ButtonSizer->AddButton(StartButton);
|
||||||
ButtonSizer->AddButton(CloseButton);
|
ButtonSizer->AddButton(CloseButton);
|
||||||
ButtonSizer->AddButton(new HelpButton(this,_T("Fonts Collector")));
|
ButtonSizer->AddButton(new HelpButton(this,"Fonts Collector"));
|
||||||
ButtonSizer->SetAffirmativeButton(StartButton);
|
ButtonSizer->SetAffirmativeButton(StartButton);
|
||||||
ButtonSizer->Realize();
|
ButtonSizer->Realize();
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ void DialogFontsCollector::OnBrowse(wxCommandEvent &event) {
|
||||||
// Chose file name
|
// Chose file name
|
||||||
if (CollectAction->GetSelection()==2) {
|
if (CollectAction->GetSelection()==2) {
|
||||||
wxFileName fname(DestBox->GetValue());
|
wxFileName fname(DestBox->GetValue());
|
||||||
wxString dest = wxFileSelector(_("Select archive file name"),DestBox->GetValue(),fname.GetFullName(),_T(".zip"),_("Zip Archives (*.zip)|*.zip"),wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
wxString dest = wxFileSelector(_("Select archive file name"),DestBox->GetValue(),fname.GetFullName(),".zip",_("Zip Archives (*.zip)|*.zip"),wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||||
if (!dest.empty()) {
|
if (!dest.empty()) {
|
||||||
DestBox->SetValue(dest);
|
DestBox->SetValue(dest);
|
||||||
}
|
}
|
||||||
|
@ -321,7 +321,7 @@ void DialogFontsCollector::Update(int value) {
|
||||||
DestBox->Enable(false);
|
DestBox->Enable(false);
|
||||||
BrowseButton->Enable(false);
|
BrowseButton->Enable(false);
|
||||||
DestLabel->Enable(false);
|
DestLabel->Enable(false);
|
||||||
DestLabel->SetLabel(_T("N/A\n"));
|
DestLabel->SetLabel("N/A\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect to folder
|
// Collect to folder
|
||||||
|
@ -332,7 +332,7 @@ void DialogFontsCollector::Update(int value) {
|
||||||
DestLabel->SetLabel(_("Choose the folder where the fonts will be collected to.\nIt will be created if it doesn't exist."));
|
DestLabel->SetLabel(_("Choose the folder where the fonts will be collected to.\nIt will be created if it doesn't exist."));
|
||||||
|
|
||||||
// Remove filename from browse box
|
// Remove filename from browse box
|
||||||
if (dst.Right(4) == _T(".zip")) {
|
if (dst.Right(4) == ".zip") {
|
||||||
wxFileName fn(dst);
|
wxFileName fn(dst);
|
||||||
DestBox->SetValue(fn.GetPath());
|
DestBox->SetValue(fn.GetPath());
|
||||||
}
|
}
|
||||||
|
@ -346,9 +346,9 @@ void DialogFontsCollector::Update(int value) {
|
||||||
DestLabel->SetLabel(_("Enter the name of the destination zip file to collect the fonts to.\nIf a folder is entered, a default name will be used."));
|
DestLabel->SetLabel(_("Enter the name of the destination zip file to collect the fonts to.\nIf a folder is entered, a default name will be used."));
|
||||||
|
|
||||||
// Add filename to browse box
|
// Add filename to browse box
|
||||||
if (dst.Right(4) != _T(".zip")) {
|
if (dst.Right(4) != ".zip") {
|
||||||
wxFileName fn(dst + _T("//"));
|
wxFileName fn(dst + "//");
|
||||||
fn.SetFullName(_T("fonts.zip"));
|
fn.SetFullName("fonts.zip");
|
||||||
DestBox->SetValue(fn.GetFullPath());
|
DestBox->SetValue(fn.GetFullPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,12 +270,12 @@ int DrawBoxedText(wxDC &dc, const wxString &txt, int x, int y)
|
||||||
// Assume the pen, brush and font properties have already been set in the DC.
|
// Assume the pen, brush and font properties have already been set in the DC.
|
||||||
// Return the advance width, including box margins, borders etc
|
// Return the advance width, including box margins, borders etc
|
||||||
|
|
||||||
if (txt == _T(""))
|
if (txt == "")
|
||||||
{
|
{
|
||||||
// Empty string gets special handling:
|
// Empty string gets special handling:
|
||||||
// The box is drawn in shorter width, to emphasize it's empty
|
// The box is drawn in shorter width, to emphasize it's empty
|
||||||
// GetTextExtent has to be called with a non-empty string, otherwise it returns the wrong height
|
// GetTextExtent has to be called with a non-empty string, otherwise it returns the wrong height
|
||||||
dc.GetTextExtent(_T(" "), &tw, &th);
|
dc.GetTextExtent(" ", &tw, &th);
|
||||||
dc.DrawRectangle(x, y-2, 4, th+4);
|
dc.DrawRectangle(x, y-2, 4, th+4);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
@ -426,14 +426,14 @@ void KaraokeLineMatchDisplay::OnPaint(wxPaintEvent &event)
|
||||||
dc.SetTextForeground(sel_text);
|
dc.SetTextForeground(sel_text);
|
||||||
dc.SetBrush(wxBrush(sel_back));
|
dc.SetBrush(wxBrush(sel_back));
|
||||||
wxString txt = unmatched_destination.Left(destination_sel_length);
|
wxString txt = unmatched_destination.Left(destination_sel_length);
|
||||||
if (txt != _T(""))
|
if (txt != "")
|
||||||
next_x += DrawBoxedText(dc, txt, next_x, y_line2);
|
next_x += DrawBoxedText(dc, txt, next_x, y_line2);
|
||||||
|
|
||||||
dc.SetTextBackground(inner_back);
|
dc.SetTextBackground(inner_back);
|
||||||
dc.SetTextForeground(inner_text);
|
dc.SetTextForeground(inner_text);
|
||||||
dc.SetBrush(wxBrush(inner_back));
|
dc.SetBrush(wxBrush(inner_back));
|
||||||
txt = unmatched_destination.Mid(destination_sel_length);
|
txt = unmatched_destination.Mid(destination_sel_length);
|
||||||
if (txt != _T(""))
|
if (txt != "")
|
||||||
DrawBoxedText(dc, txt, next_x, y_line2);
|
DrawBoxedText(dc, txt, next_x, y_line2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ wxString KaraokeLineMatchDisplay::GetOutputLine()
|
||||||
for (size_t i = 0; i < matched_groups.size(); ++i)
|
for (size_t i = 0; i < matched_groups.size(); ++i)
|
||||||
{
|
{
|
||||||
MatchGroup &match = matched_groups[i];
|
MatchGroup &match = matched_groups[i];
|
||||||
res = wxString::Format(_T("%s{\\k%d}%s"), res.c_str(), match.duration, match.dst.c_str());
|
res = wxString::Format("%s{\\k%d}%s", res.c_str(), match.duration, match.dst.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -857,9 +857,9 @@ DialogKanjiTimer::DialogKanjiTimer(agi::Context *c)
|
||||||
Interpolate = new wxCheckBox(this,-1,_("Attempt to interpolate kanji."),wxDefaultPosition,wxDefaultSize,wxALIGN_LEFT);
|
Interpolate = new wxCheckBox(this,-1,_("Attempt to interpolate kanji."),wxDefaultPosition,wxDefaultSize,wxALIGN_LEFT);
|
||||||
Interpolate->SetValue(OPT_GET("Tool/Kanji Timer/Interpolation")->GetBool());
|
Interpolate->SetValue(OPT_GET("Tool/Kanji Timer/Interpolation")->GetBool());
|
||||||
|
|
||||||
SourceStyle=new wxComboBox(this,-1,_T(""),wxDefaultPosition,wxSize(160,-1),
|
SourceStyle=new wxComboBox(this,-1,"",wxDefaultPosition,wxSize(160,-1),
|
||||||
subs->GetStyles(),wxCB_READONLY,wxDefaultValidator,_("Source Style"));
|
subs->GetStyles(),wxCB_READONLY,wxDefaultValidator,_("Source Style"));
|
||||||
DestStyle = new wxComboBox(this,-1,_T(""),wxDefaultPosition,wxSize(160,-1),
|
DestStyle = new wxComboBox(this,-1,"",wxDefaultPosition,wxSize(160,-1),
|
||||||
subs->GetStyles(),wxCB_READONLY,wxDefaultValidator,_("Dest Style"));
|
subs->GetStyles(),wxCB_READONLY,wxDefaultValidator,_("Dest Style"));
|
||||||
|
|
||||||
wxStaticText *ShortcutKeys = new wxStaticText(this,-1,_("When the destination textbox has focus, use the following keys:\n\nRight Arrow: Increase dest. selection length\nLeft Arrow: Decrease dest. selection length\nUp Arrow: Increase source selection length\nDown Arrow: Decrease source selection length\nEnter: Link, accept line when done\nBackspace: Unlink last"));
|
wxStaticText *ShortcutKeys = new wxStaticText(this,-1,_("When the destination textbox has focus, use the following keys:\n\nRight Arrow: Increase dest. selection length\nLeft Arrow: Decrease dest. selection length\nUp Arrow: Increase source selection length\nDown Arrow: Decrease source selection length\nEnter: Link, accept line when done\nBackspace: Unlink last"));
|
||||||
|
@ -898,7 +898,7 @@ DialogKanjiTimer::DialogKanjiTimer(agi::Context *c)
|
||||||
|
|
||||||
// Button sizer
|
// Button sizer
|
||||||
wxStdDialogButtonSizer *buttonSizer = new wxStdDialogButtonSizer();
|
wxStdDialogButtonSizer *buttonSizer = new wxStdDialogButtonSizer();
|
||||||
buttonSizer->AddButton(new HelpButton(this,_T("Kanji Timer")));
|
buttonSizer->AddButton(new HelpButton(this,"Kanji Timer"));
|
||||||
buttonSizer->SetAffirmativeButton(CloseKT);
|
buttonSizer->SetAffirmativeButton(CloseKT);
|
||||||
buttonSizer->Realize();
|
buttonSizer->Realize();
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ DialogPasteOver::DialogPasteOver (wxWindow *parent, std::vector<bool>& options)
|
||||||
wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
|
wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
|
||||||
ButtonSizer->AddButton(new wxButton(this, wxID_OK));
|
ButtonSizer->AddButton(new wxButton(this, wxID_OK));
|
||||||
ButtonSizer->AddButton(new wxButton(this, wxID_CANCEL));
|
ButtonSizer->AddButton(new wxButton(this, wxID_CANCEL));
|
||||||
ButtonSizer->AddButton(new HelpButton(this,_T("Paste Over")));
|
ButtonSizer->AddButton(new HelpButton(this,"Paste Over"));
|
||||||
ButtonSizer->Realize();
|
ButtonSizer->Realize();
|
||||||
|
|
||||||
// Main sizer
|
// Main sizer
|
||||||
|
|
|
@ -76,11 +76,11 @@ DialogResample::DialogResample(agi::Context *c)
|
||||||
MarginSymmetrical = NULL; // Do not remove this
|
MarginSymmetrical = NULL; // Do not remove this
|
||||||
wxSizer *MarginBoxSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Margin offset"));
|
wxSizer *MarginBoxSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Margin offset"));
|
||||||
wxSizer *MarginSizer = new wxGridSizer(3,3,5,5);
|
wxSizer *MarginSizer = new wxGridSizer(3,3,5,5);
|
||||||
MarginTop = new wxTextCtrl(this,TEXT_MARGIN_T,_T("0"),wxDefaultPosition,wxSize(50,-1),0);
|
MarginTop = new wxTextCtrl(this,TEXT_MARGIN_T,"0",wxDefaultPosition,wxSize(50,-1),0);
|
||||||
MarginLeft = new wxTextCtrl(this,TEXT_MARGIN_L,_T("0"),wxDefaultPosition,wxSize(50,-1),0);
|
MarginLeft = new wxTextCtrl(this,TEXT_MARGIN_L,"0",wxDefaultPosition,wxSize(50,-1),0);
|
||||||
MarginSymmetrical = new wxCheckBox(this,CHECK_SYMMETRICAL,_("Symmetrical"));
|
MarginSymmetrical = new wxCheckBox(this,CHECK_SYMMETRICAL,_("Symmetrical"));
|
||||||
MarginRight = new wxTextCtrl(this,TEXT_MARGIN_R,_T("0"),wxDefaultPosition,wxSize(50,-1),0);
|
MarginRight = new wxTextCtrl(this,TEXT_MARGIN_R,"0",wxDefaultPosition,wxSize(50,-1),0);
|
||||||
MarginBottom = new wxTextCtrl(this,TEXT_MARGIN_B,_T("0"),wxDefaultPosition,wxSize(50,-1),0);
|
MarginBottom = new wxTextCtrl(this,TEXT_MARGIN_B,"0",wxDefaultPosition,wxSize(50,-1),0);
|
||||||
MarginSizer->AddSpacer(1);
|
MarginSizer->AddSpacer(1);
|
||||||
MarginSizer->Add(MarginTop,1,wxEXPAND);
|
MarginSizer->Add(MarginTop,1,wxEXPAND);
|
||||||
MarginSizer->AddSpacer(1);
|
MarginSizer->AddSpacer(1);
|
||||||
|
@ -117,7 +117,7 @@ DialogResample::DialogResample(agi::Context *c)
|
||||||
wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
|
wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
|
||||||
ButtonSizer->AddButton(new wxButton(this,wxID_OK));
|
ButtonSizer->AddButton(new wxButton(this,wxID_OK));
|
||||||
ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL));
|
ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL));
|
||||||
ButtonSizer->AddButton(new HelpButton(this,_T("Resample")));
|
ButtonSizer->AddButton(new HelpButton(this,"Resample"));
|
||||||
ButtonSizer->Realize();
|
ButtonSizer->Realize();
|
||||||
|
|
||||||
// Main sizer
|
// Main sizer
|
||||||
|
@ -235,7 +235,7 @@ void DialogResample::OnResample (wxCommandEvent &event) {
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
if (x1 == 0 || y1 == 0) {
|
if (x1 == 0 || y1 == 0) {
|
||||||
wxMessageBox(_T("Invalid source resolution. This should not happen. Please contact the developers."),_("Error"),wxCENTRE|wxICON_ERROR);
|
wxMessageBox("Invalid source resolution. This should not happen. Please contact the developers.",_("Error"),wxCENTRE|wxICON_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (x2 == 0 || y2 == 0) {
|
if (x2 == 0 || y2 == 0) {
|
||||||
|
@ -266,7 +266,7 @@ void DialogResample::OnResample (wxCommandEvent &event) {
|
||||||
for (entryIter cur=c->ass->Line.begin();cur!=c->ass->Line.end();cur++) {
|
for (entryIter cur=c->ass->Line.begin();cur!=c->ass->Line.end();cur++) {
|
||||||
// Apply to dialogues
|
// Apply to dialogues
|
||||||
curDiag = dynamic_cast<AssDialogue*>(*cur);
|
curDiag = dynamic_cast<AssDialogue*>(*cur);
|
||||||
if (curDiag && !(curDiag->Comment && (curDiag->Effect.StartsWith(_T("template")) || curDiag->Effect.StartsWith(_T("code"))))) {
|
if (curDiag && !(curDiag->Comment && (curDiag->Effect.StartsWith("template") || curDiag->Effect.StartsWith("code")))) {
|
||||||
try {
|
try {
|
||||||
// Override tags
|
// Override tags
|
||||||
curDiag->ParseASSTags();
|
curDiag->ParseASSTags();
|
||||||
|
@ -293,7 +293,7 @@ void DialogResample::OnResample (wxCommandEvent &event) {
|
||||||
curDiag->ClearBlocks();
|
curDiag->ClearBlocks();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
catch (const wchar_t *err) {
|
catch (const char *err) {
|
||||||
wxLogMessage(err);
|
wxLogMessage(err);
|
||||||
}
|
}
|
||||||
catch (wxString err) {
|
catch (wxString err) {
|
||||||
|
@ -318,8 +318,8 @@ void DialogResample::OnResample (wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change script resolution
|
// Change script resolution
|
||||||
c->ass->SetScriptInfo(_T("PlayResX"),wxString::Format(_T("%i"),x2));
|
c->ass->SetScriptInfo("PlayResX",wxString::Format("%i",x2));
|
||||||
c->ass->SetScriptInfo(_T("PlayResY"),wxString::Format(_T("%i"),y2));
|
c->ass->SetScriptInfo("PlayResY",wxString::Format("%i",y2));
|
||||||
|
|
||||||
// Flag as modified
|
// Flag as modified
|
||||||
c->ass->Commit(_("resolution resampling"), AssFile::COMMIT_SCRIPTINFO | AssFile::COMMIT_DIAG_FULL);
|
c->ass->Commit(_("resolution resampling"), AssFile::COMMIT_SCRIPTINFO | AssFile::COMMIT_DIAG_FULL);
|
||||||
|
@ -332,8 +332,8 @@ void DialogResample::OnResample (wxCommandEvent &event) {
|
||||||
/// @param event
|
/// @param event
|
||||||
///
|
///
|
||||||
void DialogResample::OnGetDestRes (wxCommandEvent &event) {
|
void DialogResample::OnGetDestRes (wxCommandEvent &event) {
|
||||||
ResX->SetValue(wxString::Format(_T("%i"),c->videoController->GetWidth()));
|
ResX->SetValue(wxString::Format("%i",c->videoController->GetWidth()));
|
||||||
ResY->SetValue(wxString::Format(_T("%i"),c->videoController->GetHeight()));
|
ResY->SetValue(wxString::Format("%i",c->videoController->GetHeight()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ enum {
|
||||||
/// @param name
|
/// @param name
|
||||||
///
|
///
|
||||||
DialogSearchReplace::DialogSearchReplace (wxWindow *parent,bool _hasReplace,wxString name)
|
DialogSearchReplace::DialogSearchReplace (wxWindow *parent,bool _hasReplace,wxString name)
|
||||||
: wxDialog(parent, -1, name, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("SearchReplace"))
|
: wxDialog(parent, -1, name, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, "SearchReplace")
|
||||||
{
|
{
|
||||||
// Setup
|
// Setup
|
||||||
hasReplace = _hasReplace;
|
hasReplace = _hasReplace;
|
||||||
|
@ -78,14 +78,14 @@ DialogSearchReplace::DialogSearchReplace (wxWindow *parent,bool _hasReplace,wxSt
|
||||||
// Find sizer
|
// Find sizer
|
||||||
wxSizer *FindSizer = new wxFlexGridSizer(2,2,5,15);
|
wxSizer *FindSizer = new wxFlexGridSizer(2,2,5,15);
|
||||||
wxArrayString FindHistory = lagi_MRU_wxAS("Find");
|
wxArrayString FindHistory = lagi_MRU_wxAS("Find");
|
||||||
FindEdit = new wxComboBox(this,-1,_T(""),wxDefaultPosition,wxSize(300,-1),FindHistory,wxCB_DROPDOWN);
|
FindEdit = new wxComboBox(this,-1,"",wxDefaultPosition,wxSize(300,-1),FindHistory,wxCB_DROPDOWN);
|
||||||
//if (FindHistory.Count()) FindEdit->SetStringSelection(FindHistory[0]);
|
//if (FindHistory.Count()) FindEdit->SetStringSelection(FindHistory[0]);
|
||||||
FindEdit->SetSelection(0);
|
FindEdit->SetSelection(0);
|
||||||
FindSizer->Add(new wxStaticText(this,-1,_("Find what:")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,0);
|
FindSizer->Add(new wxStaticText(this,-1,_("Find what:")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,0);
|
||||||
FindSizer->Add(FindEdit,0,wxRIGHT,0);
|
FindSizer->Add(FindEdit,0,wxRIGHT,0);
|
||||||
if (hasReplace) {
|
if (hasReplace) {
|
||||||
wxArrayString ReplaceHistory = lagi_MRU_wxAS("Replace");
|
wxArrayString ReplaceHistory = lagi_MRU_wxAS("Replace");
|
||||||
ReplaceEdit = new wxComboBox(this,-1,_T(""),wxDefaultPosition,wxSize(300,-1),ReplaceHistory,wxCB_DROPDOWN);
|
ReplaceEdit = new wxComboBox(this,-1,"",wxDefaultPosition,wxSize(300,-1),ReplaceHistory,wxCB_DROPDOWN);
|
||||||
FindSizer->Add(new wxStaticText(this,-1,_("Replace with:")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,0);
|
FindSizer->Add(new wxStaticText(this,-1,_("Replace with:")),0,wxRIGHT | wxALIGN_CENTER_VERTICAL,0);
|
||||||
FindSizer->Add(ReplaceEdit,0,wxRIGHT,0);
|
FindSizer->Add(ReplaceEdit,0,wxRIGHT,0);
|
||||||
ReplaceEdit->SetSelection(0);
|
ReplaceEdit->SetSelection(0);
|
||||||
|
@ -515,7 +515,7 @@ void SearchReplaceEngine::ReplaceAll() {
|
||||||
// Normal replace
|
// Normal replace
|
||||||
else {
|
else {
|
||||||
if (!Search.matchCase) {
|
if (!Search.matchCase) {
|
||||||
wxString Left = _T(""), Right = *Text;
|
wxString Left = "", Right = *Text;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
Left.Alloc(Right.Len());
|
Left.Alloc(Right.Len());
|
||||||
while (pos <= (int)(Right.Len() - LookFor.Len())) {
|
while (pos <= (int)(Right.Len() - LookFor.Len())) {
|
||||||
|
@ -615,7 +615,7 @@ wxString *SearchReplaceEngine::GetText(int n,int field) {
|
||||||
else if (field == 1) return &cur->Style;
|
else if (field == 1) return &cur->Style;
|
||||||
else if (field == 2) return &cur->Actor;
|
else if (field == 2) return &cur->Actor;
|
||||||
else if (field == 3) return &cur->Effect;
|
else if (field == 3) return &cur->Effect;
|
||||||
else throw wxString(_T("Invalid field"));
|
else throw wxString("Invalid field");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -286,3 +286,4 @@ void DialogSpellChecker::SetWord(wxString const& word) {
|
||||||
|
|
||||||
add_button->Enable(spellchecker->CanAddWord(word));
|
add_button->Enable(spellchecker->CanAddWord(word));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *style, agi::Context *c,bool local,AssStyleStorage *store,bool newStyle)
|
DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *style, agi::Context *c,bool local,AssStyleStorage *store,bool newStyle)
|
||||||
: wxDialog (parent,-1,_("Style Editor"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER,_T("DialogStyleEditor"))
|
: wxDialog (parent,-1,_("Style Editor"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER,"DialogStyleEditor")
|
||||||
, c(c)
|
, c(c)
|
||||||
, isLocal(local)
|
, isLocal(local)
|
||||||
, isNew(newStyle)
|
, isNew(newStyle)
|
||||||
|
@ -116,7 +116,7 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *style, agi::Co
|
||||||
wxString AngleValue = AegiFloatToString(style->angle);
|
wxString AngleValue = AegiFloatToString(style->angle);
|
||||||
wxString EncodingValue = AegiIntegerToString(style->encoding);
|
wxString EncodingValue = AegiIntegerToString(style->encoding);
|
||||||
wxString SpacingValue = AegiFloatToString(style->spacing);
|
wxString SpacingValue = AegiFloatToString(style->spacing);
|
||||||
wxString alignValues[9] = { _T("7"),_T("8"),_T("9"),_T("4"),_T("5"),_T("6"),_T("1"),_T("2"),_T("3") };
|
wxString alignValues[9] = { "7","8","9","4","5","6","1","2","3" };
|
||||||
wxArrayString fontList = wxFontEnumerator::GetFacenames();
|
wxArrayString fontList = wxFontEnumerator::GetFacenames();
|
||||||
fontList.Sort();
|
fontList.Sort();
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *style, agi::Co
|
||||||
// Create controls
|
// Create controls
|
||||||
StyleName = new wxTextCtrl(this,-1,style->name);
|
StyleName = new wxTextCtrl(this,-1,style->name);
|
||||||
FontName = new wxComboBox(this,TEXT_FONT_NAME,style->font,wxDefaultPosition,wxSize(150,-1),0,0,wxCB_DROPDOWN);
|
FontName = new wxComboBox(this,TEXT_FONT_NAME,style->font,wxDefaultPosition,wxSize(150,-1),0,0,wxCB_DROPDOWN);
|
||||||
FontSize = new wxTextCtrl(this,TEXT_FONT_SIZE,_T(""),wxDefaultPosition,wxSize(50,-1),0,NumValidator(FontSizeValue,true,false));
|
FontSize = new wxTextCtrl(this,TEXT_FONT_SIZE,"",wxDefaultPosition,wxSize(50,-1),0,NumValidator(FontSizeValue,true,false));
|
||||||
BoxBold = new wxCheckBox(this,CHECKBOX_STYLE_BOLD,_("Bold"));
|
BoxBold = new wxCheckBox(this,CHECKBOX_STYLE_BOLD,_("Bold"));
|
||||||
BoxItalic = new wxCheckBox(this,CHECKBOX_STYLE_ITALIC,_("Italic"));
|
BoxItalic = new wxCheckBox(this,CHECKBOX_STYLE_ITALIC,_("Italic"));
|
||||||
BoxUnderline = new wxCheckBox(this,CHECKBOX_STYLE_UNDERLINE,_("Underline"));
|
BoxUnderline = new wxCheckBox(this,CHECKBOX_STYLE_UNDERLINE,_("Underline"));
|
||||||
|
@ -152,14 +152,14 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *style, agi::Co
|
||||||
for (int i=0;i<3;i++) margin[i] = new wxSpinCtrl(this,TEXT_MARGIN_L+i,AegiFloatToString(style->Margin[i]),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,9999,style->Margin[i]);
|
for (int i=0;i<3;i++) margin[i] = new wxSpinCtrl(this,TEXT_MARGIN_L+i,AegiFloatToString(style->Margin[i]),wxDefaultPosition,wxSize(60,-1),wxSP_ARROW_KEYS,0,9999,style->Margin[i]);
|
||||||
margin[3] = 0;
|
margin[3] = 0;
|
||||||
Alignment = new wxRadioBox(this, RADIO_ALIGNMENT, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS);
|
Alignment = new wxRadioBox(this, RADIO_ALIGNMENT, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS);
|
||||||
Outline = new wxTextCtrl(this,TEXT_OUTLINE,_T(""),wxDefaultPosition,wxSize(40,20),0,NumValidator(OutlineValue,true,false));
|
Outline = new wxTextCtrl(this,TEXT_OUTLINE,"",wxDefaultPosition,wxSize(40,20),0,NumValidator(OutlineValue,true,false));
|
||||||
Shadow = new wxTextCtrl(this,TEXT_SHADOW,_T(""),wxDefaultPosition,wxSize(40,20),0,NumValidator(ShadowValue,true,false));
|
Shadow = new wxTextCtrl(this,TEXT_SHADOW,"",wxDefaultPosition,wxSize(40,20),0,NumValidator(ShadowValue,true,false));
|
||||||
OutlineType = new wxCheckBox(this,CHECKBOX_OUTLINE,_("Opaque box"));
|
OutlineType = new wxCheckBox(this,CHECKBOX_OUTLINE,_("Opaque box"));
|
||||||
ScaleX = new wxTextCtrl(this,TEXT_SCALE_X,_T(""),wxDefaultPosition, wxSize(70,20),0,NumValidator(ScaleXValue,true,false));
|
ScaleX = new wxTextCtrl(this,TEXT_SCALE_X,"",wxDefaultPosition, wxSize(70,20),0,NumValidator(ScaleXValue,true,false));
|
||||||
ScaleY = new wxTextCtrl(this,TEXT_SCALE_Y,_T(""),wxDefaultPosition, wxSize(70,20),0,NumValidator(ScaleYValue,true,false));
|
ScaleY = new wxTextCtrl(this,TEXT_SCALE_Y,"",wxDefaultPosition, wxSize(70,20),0,NumValidator(ScaleYValue,true,false));
|
||||||
Angle = new wxTextCtrl(this,TEXT_ANGLE,_T(""),wxDefaultPosition, wxSize(40,20),0,NumValidator(AngleValue,true,true));
|
Angle = new wxTextCtrl(this,TEXT_ANGLE,"",wxDefaultPosition, wxSize(40,20),0,NumValidator(AngleValue,true,true));
|
||||||
Spacing = new wxTextCtrl(this,TEXT_SPACING,_T(""),wxDefaultPosition,wxSize(40,20),0,NumValidator(SpacingValue,true,true));
|
Spacing = new wxTextCtrl(this,TEXT_SPACING,"",wxDefaultPosition,wxSize(40,20),0,NumValidator(SpacingValue,true,true));
|
||||||
Encoding = new wxComboBox(this,COMBO_ENCODING,_T(""),wxDefaultPosition, wxDefaultSize, encodingStrings,wxCB_READONLY);
|
Encoding = new wxComboBox(this,COMBO_ENCODING,"",wxDefaultPosition, wxDefaultSize, encodingStrings,wxCB_READONLY);
|
||||||
|
|
||||||
// Set control tooltips
|
// Set control tooltips
|
||||||
StyleName->SetToolTip(_("Style name."));
|
StyleName->SetToolTip(_("Style name."));
|
||||||
|
@ -322,7 +322,7 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *style, agi::Co
|
||||||
okButton->SetDefault();
|
okButton->SetDefault();
|
||||||
ButtonSizer->AddButton(new wxButton(this, wxID_CANCEL));
|
ButtonSizer->AddButton(new wxButton(this, wxID_CANCEL));
|
||||||
ButtonSizer->AddButton(new wxButton(this, wxID_APPLY));
|
ButtonSizer->AddButton(new wxButton(this, wxID_APPLY));
|
||||||
ButtonSizer->AddButton(new HelpButton(this, _T("Style Editor")));
|
ButtonSizer->AddButton(new HelpButton(this, "Style Editor"));
|
||||||
ButtonSizer->AddButton(okButton);
|
ButtonSizer->AddButton(okButton);
|
||||||
ButtonSizer->Realize();
|
ButtonSizer->Realize();
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ void DialogStyleEditor::OnSetColor4 (wxCommandEvent &event) { OnSetColor(4); }
|
||||||
///
|
///
|
||||||
void ReplaceStyle(wxString tag,int n,AssOverrideParameter* param,void *userData) {
|
void ReplaceStyle(wxString tag,int n,AssOverrideParameter* param,void *userData) {
|
||||||
wxArrayString strings = *((wxArrayString*)userData);
|
wxArrayString strings = *((wxArrayString*)userData);
|
||||||
if (tag == _T("\\r")) {
|
if (tag == "\\r") {
|
||||||
if (param->GetType() == VARDATA_TEXT) {
|
if (param->GetType() == VARDATA_TEXT) {
|
||||||
if (param->Get<wxString>() == strings[0]) {
|
if (param->Get<wxString>() == strings[0]) {
|
||||||
param->Set(strings[1]);
|
param->Set(strings[1]);
|
||||||
|
@ -463,7 +463,7 @@ void DialogStyleEditor::Apply (bool apply,bool close) {
|
||||||
for (unsigned int i=0;i<styles.Count();i++) {
|
for (unsigned int i=0;i<styles.Count();i++) {
|
||||||
if (newStyleName.CmpNoCase(styles[i]) == 0) {
|
if (newStyleName.CmpNoCase(styles[i]) == 0) {
|
||||||
if ((isLocal && (c->ass->GetStyle(styles[i]) != style)) || (!isLocal && (store->GetStyle(styles[i]) != style))) {
|
if ((isLocal && (c->ass->GetStyle(styles[i]) != style)) || (!isLocal && (store->GetStyle(styles[i]) != style))) {
|
||||||
wxMessageBox(_T("There is already a style with this name. Please choose another name."),_T("Style name conflict."),wxICON_ERROR|wxOK);
|
wxMessageBox("There is already a style with this name. Please choose another name.","Style name conflict.",wxICON_ERROR|wxOK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,7 @@ void DialogStyleEditor::Apply (bool apply,bool close) {
|
||||||
if (!isNew && isLocal) {
|
if (!isNew && isLocal) {
|
||||||
// See if user wants to update style name through script
|
// See if user wants to update style name through script
|
||||||
int answer = wxNO;
|
int answer = wxNO;
|
||||||
if (work->name != _T("Default")) answer = wxMessageBox(_("Do you want to change all instances of this style in the script to this new name?"),_("Update script?"),wxYES_NO | wxCANCEL);
|
if (work->name != "Default") answer = wxMessageBox(_("Do you want to change all instances of this style in the script to this new name?"),_("Update script?"),wxYES_NO | wxCANCEL);
|
||||||
|
|
||||||
// Cancel
|
// Cancel
|
||||||
if (answer == wxCANCEL) return;
|
if (answer == wxCANCEL) return;
|
||||||
|
@ -545,7 +545,7 @@ void DialogStyleEditor::UpdateWorkStyle() {
|
||||||
// Update encoding
|
// Update encoding
|
||||||
long templ = 0;
|
long templ = 0;
|
||||||
wxString enc = Encoding->GetValue();
|
wxString enc = Encoding->GetValue();
|
||||||
enc.Left(enc.Find(_T("-"))-1).ToLong(&templ);
|
enc.Left(enc.Find("-")-1).ToLong(&templ);
|
||||||
work->encoding = templ;
|
work->encoding = templ;
|
||||||
|
|
||||||
// Angle and spacing
|
// Angle and spacing
|
||||||
|
@ -588,7 +588,7 @@ void DialogStyleEditor::OnChooseFont (wxCommandEvent &event) {
|
||||||
wxFont newfont = wxGetFontFromUser(this,oldfont);
|
wxFont newfont = wxGetFontFromUser(this,oldfont);
|
||||||
if (newfont.Ok()) {
|
if (newfont.Ok()) {
|
||||||
FontName->SetValue(newfont.GetFaceName());
|
FontName->SetValue(newfont.GetFaceName());
|
||||||
FontSize->SetValue(wxString::Format(_T("%i"),newfont.GetPointSize()));
|
FontSize->SetValue(wxString::Format("%i",newfont.GetPointSize()));
|
||||||
BoxBold->SetValue(newfont.GetWeight() == wxFONTWEIGHT_BOLD);
|
BoxBold->SetValue(newfont.GetWeight() == wxFONTWEIGHT_BOLD);
|
||||||
BoxItalic->SetValue(newfont.GetStyle() == wxFONTSTYLE_ITALIC);
|
BoxItalic->SetValue(newfont.GetStyle() == wxFONTSTYLE_ITALIC);
|
||||||
BoxUnderline->SetValue(newfont.GetUnderlined());
|
BoxUnderline->SetValue(newfont.GetUnderlined());
|
||||||
|
@ -601,7 +601,7 @@ void DialogStyleEditor::OnChooseFont (wxCommandEvent &event) {
|
||||||
if (SubsPreview) SubsPreview->SetStyle(*work);
|
if (SubsPreview) SubsPreview->SetStyle(*work);
|
||||||
|
|
||||||
// Comic sans warning
|
// Comic sans warning
|
||||||
if (newfont.GetFaceName() == _T("Comic Sans MS")) {
|
if (newfont.GetFaceName() == "Comic Sans MS") {
|
||||||
wxMessageBox(_("You have chosen to use the \"Comic Sans\" font. As the programmer and a typesetter,\nI must urge you to reconsider. Comic Sans is the most abused font in the history\nof computing, so please avoid using it unless it's REALLY suitable. Thanks."), _("Warning"), wxICON_EXCLAMATION | wxOK);
|
wxMessageBox(_("You have chosen to use the \"Comic Sans\" font. As the programmer and a typesetter,\nI must urge you to reconsider. Comic Sans is the most abused font in the history\nof computing, so please avoid using it unless it's REALLY suitable. Thanks."), _("Warning"), wxICON_EXCLAMATION | wxOK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -617,7 +617,7 @@ void DialogStyleEditor::OnSetColor (int n) {
|
||||||
case 2: modify = &work->secondary; break;
|
case 2: modify = &work->secondary; break;
|
||||||
case 3: modify = &work->outline; break;
|
case 3: modify = &work->outline; break;
|
||||||
case 4: modify = &work->shadow; break;
|
case 4: modify = &work->shadow; break;
|
||||||
default: throw _T("Internal error in style editor, attempted setting colour id outside range");
|
default: throw "Internal error in style editor, attempted setting colour id outside range";
|
||||||
}
|
}
|
||||||
modify->SetWXColor(colorButton[n-1]->GetColour());
|
modify->SetWXColor(colorButton[n-1]->GetColour());
|
||||||
if (SubsPreview) SubsPreview->SetStyle(*work);
|
if (SubsPreview) SubsPreview->SetStyle(*work);
|
||||||
|
|
|
@ -93,14 +93,14 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
DialogStyleManager::DialogStyleManager (agi::Context *context)
|
DialogStyleManager::DialogStyleManager (agi::Context *context)
|
||||||
: wxDialog (context->parent,-1,_("Styles Manager"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE,_T("DialogStylesManager"))
|
: wxDialog (context->parent,-1,_("Styles Manager"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE,"DialogStylesManager")
|
||||||
, c(context)
|
, c(context)
|
||||||
{
|
{
|
||||||
SetIcon(BitmapToIcon(GETIMAGE(style_toolbutton_24)));
|
SetIcon(BitmapToIcon(GETIMAGE(style_toolbutton_24)));
|
||||||
|
|
||||||
// Catalog
|
// Catalog
|
||||||
wxSizer *CatalogBox = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Catalog of available storages"));
|
wxSizer *CatalogBox = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Catalog of available storages"));
|
||||||
CatalogList = new wxComboBox(this,LIST_CATALOG, _T(""), wxDefaultPosition, wxSize(-1,-1), 0, NULL, wxCB_READONLY | wxCB_READONLY, wxDefaultValidator, _T("Catalog List"));
|
CatalogList = new wxComboBox(this,LIST_CATALOG, "", wxDefaultPosition, wxSize(-1,-1), 0, NULL, wxCB_READONLY | wxCB_READONLY, wxDefaultValidator, "Catalog List");
|
||||||
wxButton *CatalogNew = new wxButton(this, BUTTON_CATALOG_NEW, _("New"));
|
wxButton *CatalogNew = new wxButton(this, BUTTON_CATALOG_NEW, _("New"));
|
||||||
wxButton *CatalogDelete = new wxButton(this, BUTTON_CATALOG_DELETE, _("Delete"));
|
wxButton *CatalogDelete = new wxButton(this, BUTTON_CATALOG_DELETE, _("Delete"));
|
||||||
CatalogBox->Add(CatalogList,1,wxEXPAND | wxRIGHT | wxALIGN_RIGHT,5);
|
CatalogBox->Add(CatalogList,1,wxEXPAND | wxRIGHT | wxALIGN_RIGHT,5);
|
||||||
|
@ -197,7 +197,7 @@ DialogStyleManager::DialogStyleManager (agi::Context *context)
|
||||||
// Buttons
|
// Buttons
|
||||||
wxStdDialogButtonSizer *buttonSizer = new wxStdDialogButtonSizer();
|
wxStdDialogButtonSizer *buttonSizer = new wxStdDialogButtonSizer();
|
||||||
buttonSizer->SetCancelButton(new wxButton(this, wxID_CLOSE));
|
buttonSizer->SetCancelButton(new wxButton(this, wxID_CLOSE));
|
||||||
buttonSizer->AddButton(new HelpButton(this,_T("Styles Manager")));
|
buttonSizer->AddButton(new HelpButton(this,"Styles Manager"));
|
||||||
buttonSizer->Realize();
|
buttonSizer->Realize();
|
||||||
|
|
||||||
// General layout
|
// General layout
|
||||||
|
@ -260,22 +260,22 @@ void DialogStyleManager::LoadCatalog () {
|
||||||
CatalogList->Clear();
|
CatalogList->Clear();
|
||||||
|
|
||||||
// Create catalog if it doesn't exist
|
// Create catalog if it doesn't exist
|
||||||
wxString dirname = StandardPaths::DecodePath(_T("?user/catalog/"));
|
wxString dirname = StandardPaths::DecodePath("?user/catalog/");
|
||||||
if (!wxDirExists(dirname)) {
|
if (!wxDirExists(dirname)) {
|
||||||
if (!wxMkdir(dirname)) {
|
if (!wxMkdir(dirname)) {
|
||||||
throw _T("Failed creating directory for style catalogues");
|
throw "Failed creating directory for style catalogues";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Create default style
|
// Create default style
|
||||||
Store.Clear();
|
Store.Clear();
|
||||||
AssStyle *defstyle = new AssStyle;
|
AssStyle *defstyle = new AssStyle;
|
||||||
Store.style.push_back(defstyle);
|
Store.style.push_back(defstyle);
|
||||||
Store.Save(_T("Default"));
|
Store.Save("Default");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get dir
|
// Get dir
|
||||||
dirname = StandardPaths::DecodePath(_T("?user/catalog/*.sty"));
|
dirname = StandardPaths::DecodePath("?user/catalog/*.sty");
|
||||||
|
|
||||||
// Populate
|
// Populate
|
||||||
wxString curfile = wxFindFirstFile(dirname,wxFILE);
|
wxString curfile = wxFindFirstFile(dirname,wxFILE);
|
||||||
|
@ -288,8 +288,8 @@ void DialogStyleManager::LoadCatalog () {
|
||||||
|
|
||||||
// Set to default if available
|
// Set to default if available
|
||||||
StorageActions(false);
|
StorageActions(false);
|
||||||
wxString pickStyle = c->ass->GetScriptInfo(_T("Last Style Storage"));
|
wxString pickStyle = c->ass->GetScriptInfo("Last Style Storage");
|
||||||
if (pickStyle.IsEmpty()) pickStyle = _T("Default");
|
if (pickStyle.IsEmpty()) pickStyle = "Default";
|
||||||
int opt = CatalogList->FindString(pickStyle, false);
|
int opt = CatalogList->FindString(pickStyle, false);
|
||||||
if (opt != wxNOT_FOUND) {
|
if (opt != wxNOT_FOUND) {
|
||||||
CatalogList->SetSelection(opt);
|
CatalogList->SetSelection(opt);
|
||||||
|
@ -413,7 +413,7 @@ void DialogStyleManager::OnChangeCatalog (wxCommandEvent &) {
|
||||||
|
|
||||||
/// @brief New catalog entry button
|
/// @brief New catalog entry button
|
||||||
void DialogStyleManager::OnCatalogNew (wxCommandEvent &) {
|
void DialogStyleManager::OnCatalogNew (wxCommandEvent &) {
|
||||||
wxString name = wxGetTextFromUser(_("New storage name:"), _("New catalog entry"), _T(""), this);
|
wxString name = wxGetTextFromUser(_("New storage name:"), _("New catalog entry"), "", this);
|
||||||
if (!name.empty()) {
|
if (!name.empty()) {
|
||||||
// Remove bad characters from the name
|
// Remove bad characters from the name
|
||||||
wxString badchars = wxFileName::GetForbiddenChars();
|
wxString badchars = wxFileName::GetForbiddenChars();
|
||||||
|
@ -421,7 +421,7 @@ void DialogStyleManager::OnCatalogNew (wxCommandEvent &) {
|
||||||
for (size_t i = 0; i < name.Length(); ++i) {
|
for (size_t i = 0; i < name.Length(); ++i) {
|
||||||
for (size_t j = 0; j < badchars.Length(); ++j) {
|
for (size_t j = 0; j < badchars.Length(); ++j) {
|
||||||
if (name[i] == badchars[j]) {
|
if (name[i] == badchars[j]) {
|
||||||
name[i] = _T('_');
|
name[i] = '_';
|
||||||
++badchars_removed;
|
++badchars_removed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -446,10 +446,10 @@ void DialogStyleManager::OnCatalogNew (wxCommandEvent &) {
|
||||||
StorageActions(true);
|
StorageActions(true);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
wxString dirname = StandardPaths::DecodePath(_T("?user/catalog/"));
|
wxString dirname = StandardPaths::DecodePath("?user/catalog/");
|
||||||
if (!wxDirExists(dirname)) {
|
if (!wxDirExists(dirname)) {
|
||||||
if (!wxMkdir(dirname)) {
|
if (!wxMkdir(dirname)) {
|
||||||
throw _T("Failed creating directory for style catalogues");
|
throw "Failed creating directory for style catalogues";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Store.Save(name);
|
Store.Save(name);
|
||||||
|
@ -465,7 +465,7 @@ void DialogStyleManager::OnCatalogDelete (wxCommandEvent &) {
|
||||||
wxString message = wxString::Format(_("Are you sure you want to delete the storage \"%s\" from the catalog?"), name.c_str());
|
wxString message = wxString::Format(_("Are you sure you want to delete the storage \"%s\" from the catalog?"), name.c_str());
|
||||||
int option = wxMessageBox(message, _("Confirm delete"), wxYES_NO | wxICON_EXCLAMATION , this);
|
int option = wxMessageBox(message, _("Confirm delete"), wxYES_NO | wxICON_EXCLAMATION , this);
|
||||||
if (option == wxYES) {
|
if (option == wxYES) {
|
||||||
wxRemoveFile(StandardPaths::DecodePath(_T("?user/catalog/") + name + _T(".sty")));
|
wxRemoveFile(StandardPaths::DecodePath("?user/catalog/" + name + ".sty"));
|
||||||
CatalogList->Delete(sel);
|
CatalogList->Delete(sel);
|
||||||
StorageList->Clear();
|
StorageList->Clear();
|
||||||
StorageActions(false);
|
StorageActions(false);
|
||||||
|
@ -543,7 +543,7 @@ void DialogStyleManager::OnCopyToStorage (wxCommandEvent &) {
|
||||||
for (list<AssStyle *>::iterator style = Store.style.begin(); style != Store.style.end(); ++style) {
|
for (list<AssStyle *>::iterator style = Store.style.begin(); style != Store.style.end(); ++style) {
|
||||||
if ((*style)->name.CmpNoCase(styleName) == 0) {
|
if ((*style)->name.CmpNoCase(styleName) == 0) {
|
||||||
addStyle = false;
|
addStyle = false;
|
||||||
if (wxYES == wxMessageBox(wxString::Format(_T("There is already a style with the name \"%s\" on the current storage. Proceed and overwrite anyway?"),styleName.c_str()), _T("Style name collision."), wxYES_NO)) {
|
if (wxYES == wxMessageBox(wxString::Format("There is already a style with the name \"%s\" on the current storage. Proceed and overwrite anyway?",styleName.c_str()), "Style name collision.", wxYES_NO)) {
|
||||||
**style = *styleMap.at(selections[i]);
|
**style = *styleMap.at(selections[i]);
|
||||||
copied.push_back(styleName);
|
copied.push_back(styleName);
|
||||||
}
|
}
|
||||||
|
@ -578,7 +578,7 @@ void DialogStyleManager::OnCopyToCurrent (wxCommandEvent &) {
|
||||||
for (std::vector<AssStyle *>::iterator style = styleMap.begin(); style != styleMap.end(); ++style) {
|
for (std::vector<AssStyle *>::iterator style = styleMap.begin(); style != styleMap.end(); ++style) {
|
||||||
if ((*style)->name.CmpNoCase(styleName) == 0) {
|
if ((*style)->name.CmpNoCase(styleName) == 0) {
|
||||||
addStyle = false;
|
addStyle = false;
|
||||||
if (wxYES == wxMessageBox(wxString::Format(_T("There is already a style with the name \"%s\" on the current script. Proceed and overwrite anyway?"),styleName.c_str()), _T("Style name collision."), wxYES_NO)) {
|
if (wxYES == wxMessageBox(wxString::Format("There is already a style with the name \"%s\" on the current script. Proceed and overwrite anyway?",styleName.c_str()), "Style name collision.", wxYES_NO)) {
|
||||||
**style = *styleStorageMap.at(selections[i]);
|
**style = *styleStorageMap.at(selections[i]);
|
||||||
copied.push_back(styleName);
|
copied.push_back(styleName);
|
||||||
}
|
}
|
||||||
|
@ -651,13 +651,13 @@ void DialogStyleManager::OnCurrentCopy (wxCommandEvent &) {
|
||||||
/// @param list
|
/// @param list
|
||||||
/// @param v
|
/// @param v
|
||||||
void DialogStyleManager::CopyToClipboard (wxListBox *list, std::vector<AssStyle*> v) {
|
void DialogStyleManager::CopyToClipboard (wxListBox *list, std::vector<AssStyle*> v) {
|
||||||
wxString data = _T("");
|
wxString data = "";
|
||||||
AssStyle *s;
|
AssStyle *s;
|
||||||
wxArrayInt selections;
|
wxArrayInt selections;
|
||||||
list->GetSelections(selections);
|
list->GetSelections(selections);
|
||||||
|
|
||||||
for(int unsigned i=0;i<selections.size();i++) {
|
for(int unsigned i=0;i<selections.size();i++) {
|
||||||
if (i!=0) data += _T("\r\n");
|
if (i!=0) data += "\r\n";
|
||||||
s = v.at(selections[i]);
|
s = v.at(selections[i]);
|
||||||
s->UpdateData();
|
s->UpdateData();
|
||||||
data += s->GetEntryData();
|
data += s->GetEntryData();
|
||||||
|
@ -671,7 +671,7 @@ void DialogStyleManager::CopyToClipboard (wxListBox *list, std::vector<AssStyle*
|
||||||
|
|
||||||
/// @brief Paste from clipboard
|
/// @brief Paste from clipboard
|
||||||
void DialogStyleManager::PasteToCurrent() {
|
void DialogStyleManager::PasteToCurrent() {
|
||||||
wxString data = _T("");
|
wxString data = "";
|
||||||
|
|
||||||
if (wxTheClipboard->Open()) {
|
if (wxTheClipboard->Open()) {
|
||||||
if (wxTheClipboard->IsSupported(wxDF_TEXT)) {
|
if (wxTheClipboard->IsSupported(wxDF_TEXT)) {
|
||||||
|
@ -682,14 +682,14 @@ void DialogStyleManager::PasteToCurrent() {
|
||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxStringTokenizer st(data,_T('\n'));
|
wxStringTokenizer st(data,'\n');
|
||||||
while (st.HasMoreTokens()) {
|
while (st.HasMoreTokens()) {
|
||||||
AssStyle *s = NULL;
|
AssStyle *s = NULL;
|
||||||
try {
|
try {
|
||||||
s = new AssStyle(st.GetNextToken().Trim(true));
|
s = new AssStyle(st.GetNextToken().Trim(true));
|
||||||
if (s->Valid) {
|
if (s->Valid) {
|
||||||
while (c->ass->GetStyle(s->name) != NULL)
|
while (c->ass->GetStyle(s->name) != NULL)
|
||||||
s->name = _T("Copy of ") + s->name;
|
s->name = "Copy of " + s->name;
|
||||||
|
|
||||||
s->UpdateData();
|
s->UpdateData();
|
||||||
c->ass->InsertStyle(s);
|
c->ass->InsertStyle(s);
|
||||||
|
@ -710,7 +710,7 @@ void DialogStyleManager::PasteToCurrent() {
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
void DialogStyleManager::PasteToStorage() {
|
void DialogStyleManager::PasteToStorage() {
|
||||||
wxString data = _T("");
|
wxString data = "";
|
||||||
|
|
||||||
if (wxTheClipboard->Open()) {
|
if (wxTheClipboard->Open()) {
|
||||||
if (wxTheClipboard->IsSupported(wxDF_TEXT)) {
|
if (wxTheClipboard->IsSupported(wxDF_TEXT)) {
|
||||||
|
@ -721,14 +721,14 @@ void DialogStyleManager::PasteToStorage() {
|
||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxStringTokenizer st(data,_T('\n'));
|
wxStringTokenizer st(data,'\n');
|
||||||
while (st.HasMoreTokens()) {
|
while (st.HasMoreTokens()) {
|
||||||
AssStyle *s = NULL;
|
AssStyle *s = NULL;
|
||||||
try {
|
try {
|
||||||
s = new AssStyle(st.GetNextToken().Trim(true));
|
s = new AssStyle(st.GetNextToken().Trim(true));
|
||||||
if (s->Valid) {
|
if (s->Valid) {
|
||||||
while (Store.GetStyle(s->name) != NULL)
|
while (Store.GetStyle(s->name) != NULL)
|
||||||
s->name = _T("Copy of ") + s->name;
|
s->name = "Copy of " + s->name;
|
||||||
|
|
||||||
s->UpdateData();
|
s->UpdateData();
|
||||||
Store.style.push_back(s);
|
Store.style.push_back(s);
|
||||||
|
@ -786,7 +786,7 @@ void DialogStyleManager::OnStorageDelete (wxCommandEvent &) {
|
||||||
wxString message;
|
wxString message;
|
||||||
if (n!=1) {
|
if (n!=1) {
|
||||||
message = _("Are you sure you want to delete these ");
|
message = _("Are you sure you want to delete these ");
|
||||||
message += wxString::Format(_T("%i"),n);
|
message += wxString::Format("%i",n);
|
||||||
message += _(" styles?");
|
message += _(" styles?");
|
||||||
}
|
}
|
||||||
else message = _("Are you sure you want to delete this style?");
|
else message = _("Are you sure you want to delete this style?");
|
||||||
|
@ -819,7 +819,7 @@ void DialogStyleManager::OnCurrentDelete (wxCommandEvent &) {
|
||||||
wxString message;
|
wxString message;
|
||||||
if (n!=1) {
|
if (n!=1) {
|
||||||
message = _("Are you sure you want to delete these ");
|
message = _("Are you sure you want to delete these ");
|
||||||
message += wxString::Format(_T("%i"),n);
|
message += wxString::Format("%i",n);
|
||||||
message += _(" styles?");
|
message += _(" styles?");
|
||||||
}
|
}
|
||||||
else message = _("Are you sure you want to delete this style?");
|
else message = _("Are you sure you want to delete this style?");
|
||||||
|
@ -849,7 +849,7 @@ void DialogStyleManager::OnCurrentDelete (wxCommandEvent &) {
|
||||||
void DialogStyleManager::OnCurrentImport(wxCommandEvent &) {
|
void DialogStyleManager::OnCurrentImport(wxCommandEvent &) {
|
||||||
// Get file name
|
// Get file name
|
||||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||||
wxString filename = wxFileSelector(_("Open subtitles file"),path,_T(""),_T(""),AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||||
|
|
||||||
if (!filename.IsEmpty()) {
|
if (!filename.IsEmpty()) {
|
||||||
// Save path
|
// Save path
|
||||||
|
@ -859,11 +859,11 @@ void DialogStyleManager::OnCurrentImport(wxCommandEvent &) {
|
||||||
try {
|
try {
|
||||||
// Load file
|
// Load file
|
||||||
AssFile temp;
|
AssFile temp;
|
||||||
temp.Load(filename,_T(""),false);
|
temp.Load(filename,"",false);
|
||||||
|
|
||||||
// Get styles
|
// Get styles
|
||||||
wxArrayString styles = temp.GetStyles();
|
wxArrayString styles = temp.GetStyles();
|
||||||
if (styles.Count() == 0 || (styles.Count() == 1 && styles[0] == _T("Default"))) {
|
if (styles.Count() == 0 || (styles.Count() == 1 && styles[0] == "Default")) {
|
||||||
wxMessageBox(_("The selected file has no available styles."),_("Error Importing Styles"),wxOK);
|
wxMessageBox(_("The selected file has no available styles."),_("Error Importing Styles"),wxOK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -879,7 +879,7 @@ void DialogStyleManager::OnCurrentImport(wxCommandEvent &) {
|
||||||
// Check if there is already a style with that name
|
// Check if there is already a style with that name
|
||||||
int test = CurrentList->FindString(styles[selections[i]], false);
|
int test = CurrentList->FindString(styles[selections[i]], false);
|
||||||
if (test != wxNOT_FOUND) {
|
if (test != wxNOT_FOUND) {
|
||||||
int answer = wxMessageBox(wxString::Format(_T("There is already a style with the name \"%s\" on the current script. Overwrite?"),styles[selections[i]].c_str()),_T("Style name collision."),wxYES_NO);
|
int answer = wxMessageBox(wxString::Format("There is already a style with the name \"%s\" on the current script. Overwrite?",styles[selections[i]].c_str()),"Style name collision.",wxYES_NO);
|
||||||
if (answer == wxYES) {
|
if (answer == wxYES) {
|
||||||
// Overwrite
|
// Overwrite
|
||||||
modified = true;
|
modified = true;
|
||||||
|
|
|
@ -104,12 +104,12 @@ DialogTimingProcessor::DialogTimingProcessor(agi::Context *c)
|
||||||
hasLeadIn = new wxCheckBox(this,CHECK_ENABLE_LEADIN,_("Add lead in:"));
|
hasLeadIn = new wxCheckBox(this,CHECK_ENABLE_LEADIN,_("Add lead in:"));
|
||||||
hasLeadIn->SetToolTip(_("Enable adding of lead-ins to lines."));
|
hasLeadIn->SetToolTip(_("Enable adding of lead-ins to lines."));
|
||||||
hasLeadIn->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Lead/IN")->GetBool());
|
hasLeadIn->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Lead/IN")->GetBool());
|
||||||
leadIn = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(80,-1),0,NumValidator(leadInTime));
|
leadIn = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(80,-1),0,NumValidator(leadInTime));
|
||||||
leadIn->SetToolTip(_("Lead in to be added, in milliseconds."));
|
leadIn->SetToolTip(_("Lead in to be added, in milliseconds."));
|
||||||
hasLeadOut = new wxCheckBox(this,CHECK_ENABLE_LEADOUT,_("Add lead out:"));
|
hasLeadOut = new wxCheckBox(this,CHECK_ENABLE_LEADOUT,_("Add lead out:"));
|
||||||
hasLeadOut->SetToolTip(_("Enable adding of lead-outs to lines."));
|
hasLeadOut->SetToolTip(_("Enable adding of lead-outs to lines."));
|
||||||
hasLeadOut->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Lead/OUT")->GetBool());
|
hasLeadOut->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Lead/OUT")->GetBool());
|
||||||
leadOut = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(80,-1),0,NumValidator(leadOutTime));
|
leadOut = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(80,-1),0,NumValidator(leadOutTime));
|
||||||
leadOut->SetToolTip(_("Lead out to be added, in milliseconds."));
|
leadOut->SetToolTip(_("Lead out to be added, in milliseconds."));
|
||||||
LeadSizer->Add(hasLeadIn,0,wxRIGHT|wxEXPAND,5);
|
LeadSizer->Add(hasLeadIn,0,wxRIGHT|wxEXPAND,5);
|
||||||
LeadSizer->Add(leadIn,0,wxRIGHT|wxEXPAND,5);
|
LeadSizer->Add(leadIn,0,wxRIGHT|wxEXPAND,5);
|
||||||
|
@ -123,7 +123,7 @@ DialogTimingProcessor::DialogTimingProcessor(agi::Context *c)
|
||||||
adjsEnable->SetToolTip(_("Enable snapping of subtitles together if they are within a certain distance of each other."));
|
adjsEnable->SetToolTip(_("Enable snapping of subtitles together if they are within a certain distance of each other."));
|
||||||
adjsEnable->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Adjacent")->GetBool());
|
adjsEnable->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Adjacent")->GetBool());
|
||||||
wxStaticText *adjsThresText = new wxStaticText(this,-1,_("Threshold:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
|
wxStaticText *adjsThresText = new wxStaticText(this,-1,_("Threshold:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
|
||||||
adjacentThres = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(adjsThresTime));
|
adjacentThres = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(60,-1),0,NumValidator(adjsThresTime));
|
||||||
adjacentThres->SetToolTip(_("Maximum difference between start and end time for two subtitles to be made continuous, in milliseconds."));
|
adjacentThres->SetToolTip(_("Maximum difference between start and end time for two subtitles to be made continuous, in milliseconds."));
|
||||||
adjacentBias = new wxSlider(this,-1,mid(0,int(OPT_GET("Tool/Timing Post Processor/Adjacent Bias")->GetDouble()*100),100),0,100,wxDefaultPosition,wxSize(-1,20));
|
adjacentBias = new wxSlider(this,-1,mid(0,int(OPT_GET("Tool/Timing Post Processor/Adjacent Bias")->GetDouble()*100),100),0,100,wxDefaultPosition,wxSize(-1,20));
|
||||||
adjacentBias->SetToolTip(_("Sets how to set the adjoining of lines. If set totally to left, it will extend start time of the second line; if totally to right, it will extend the end time of the first line."));
|
adjacentBias->SetToolTip(_("Sets how to set the adjoining of lines. If set totally to left, it will extend start time of the second line; if totally to right, it will extend the end time of the first line."));
|
||||||
|
@ -141,16 +141,16 @@ DialogTimingProcessor::DialogTimingProcessor(agi::Context *c)
|
||||||
keysEnable->SetToolTip(_("Enable snapping of subtitles to nearest keyframe, if distance is within threshold."));
|
keysEnable->SetToolTip(_("Enable snapping of subtitles to nearest keyframe, if distance is within threshold."));
|
||||||
keysEnable->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Keyframe")->GetBool());
|
keysEnable->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Keyframe")->GetBool());
|
||||||
wxStaticText *textStartBefore = new wxStaticText(this,-1,_("Starts before thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
|
wxStaticText *textStartBefore = new wxStaticText(this,-1,_("Starts before thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
|
||||||
keysStartBefore = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresStartBefore));
|
keysStartBefore = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresStartBefore));
|
||||||
keysStartBefore->SetToolTip(_("Threshold for 'before start' distance, that is, how many frames a subtitle must start before a keyframe to snap to it."));
|
keysStartBefore->SetToolTip(_("Threshold for 'before start' distance, that is, how many frames a subtitle must start before a keyframe to snap to it."));
|
||||||
wxStaticText *textStartAfter = new wxStaticText(this,-1,_("Starts after thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
|
wxStaticText *textStartAfter = new wxStaticText(this,-1,_("Starts after thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
|
||||||
keysStartAfter = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresStartAfter));
|
keysStartAfter = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresStartAfter));
|
||||||
keysStartAfter->SetToolTip(_("Threshold for 'after start' distance, that is, how many frames a subtitle must start after a keyframe to snap to it."));
|
keysStartAfter->SetToolTip(_("Threshold for 'after start' distance, that is, how many frames a subtitle must start after a keyframe to snap to it."));
|
||||||
wxStaticText *textEndBefore = new wxStaticText(this,-1,_("Ends before thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
|
wxStaticText *textEndBefore = new wxStaticText(this,-1,_("Ends before thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
|
||||||
keysEndBefore = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresEndBefore));
|
keysEndBefore = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresEndBefore));
|
||||||
keysEndBefore->SetToolTip(_("Threshold for 'before end' distance, that is, how many frames a subtitle must end before a keyframe to snap to it."));
|
keysEndBefore->SetToolTip(_("Threshold for 'before end' distance, that is, how many frames a subtitle must end before a keyframe to snap to it."));
|
||||||
wxStaticText *textEndAfter = new wxStaticText(this,-1,_("Ends after thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
|
wxStaticText *textEndAfter = new wxStaticText(this,-1,_("Ends after thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE);
|
||||||
keysEndAfter = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresEndAfter));
|
keysEndAfter = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresEndAfter));
|
||||||
keysEndAfter->SetToolTip(_("Threshold for 'after end' distance, that is, how many frames a subtitle must end after a keyframe to snap to it."));
|
keysEndAfter->SetToolTip(_("Threshold for 'after end' distance, that is, how many frames a subtitle must end after a keyframe to snap to it."));
|
||||||
KeyframesFlexSizer->Add(keysEnable,0,wxRIGHT|wxEXPAND,10);
|
KeyframesFlexSizer->Add(keysEnable,0,wxRIGHT|wxEXPAND,10);
|
||||||
KeyframesFlexSizer->Add(textStartBefore,0,wxRIGHT|wxALIGN_CENTER,5);
|
KeyframesFlexSizer->Add(textStartBefore,0,wxRIGHT|wxALIGN_CENTER,5);
|
||||||
|
@ -170,7 +170,7 @@ DialogTimingProcessor::DialogTimingProcessor(agi::Context *c)
|
||||||
ApplyButton = new wxButton(this,wxID_OK);
|
ApplyButton = new wxButton(this,wxID_OK);
|
||||||
ButtonSizer->AddButton(ApplyButton);
|
ButtonSizer->AddButton(ApplyButton);
|
||||||
ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL));
|
ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL));
|
||||||
ButtonSizer->AddButton(new HelpButton(this,_T("Timing Processor")));
|
ButtonSizer->AddButton(new HelpButton(this,"Timing Processor"));
|
||||||
ButtonSizer->Realize();
|
ButtonSizer->Realize();
|
||||||
|
|
||||||
// Right Sizer
|
// Right Sizer
|
||||||
|
|
|
@ -219,7 +219,7 @@ void AegisubVersionCheckerThread::PostErrorEvent(const wxString &error_text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const wxChar * GetOSShortName()
|
static const char * GetOSShortName()
|
||||||
{
|
{
|
||||||
int osver_maj, osver_min;
|
int osver_maj, osver_min;
|
||||||
wxOperatingSystemId osid = wxGetOsVersion(&osver_maj, &osver_min);
|
wxOperatingSystemId osid = wxGetOsVersion(&osver_maj, &osver_min);
|
||||||
|
@ -227,22 +227,22 @@ static const wxChar * GetOSShortName()
|
||||||
if (osid & wxOS_WINDOWS_NT)
|
if (osid & wxOS_WINDOWS_NT)
|
||||||
{
|
{
|
||||||
if (osver_maj == 5 && osver_min == 0)
|
if (osver_maj == 5 && osver_min == 0)
|
||||||
return _T("win2k");
|
return "win2k";
|
||||||
else if (osver_maj == 5 && osver_min == 1)
|
else if (osver_maj == 5 && osver_min == 1)
|
||||||
return _T("winxp");
|
return "winxp";
|
||||||
else if (osver_maj == 5 && osver_min == 2)
|
else if (osver_maj == 5 && osver_min == 2)
|
||||||
return _T("win2k3"); // this is also xp64
|
return "win2k3"; // this is also xp64
|
||||||
else if (osver_maj == 6 && osver_min == 0)
|
else if (osver_maj == 6 && osver_min == 0)
|
||||||
return _T("win60"); // vista and server 2008
|
return "win60"; // vista and server 2008
|
||||||
else if (osver_maj == 6 && osver_min == 1)
|
else if (osver_maj == 6 && osver_min == 1)
|
||||||
return _T("win61"); // 7 and server 2008r2
|
return "win61"; // 7 and server 2008r2
|
||||||
else
|
else
|
||||||
return _T("windows"); // future proofing? I doubt we run on nt4
|
return "windows"; // future proofing? I doubt we run on nt4
|
||||||
}
|
}
|
||||||
else if (osid & wxOS_MAC_OSX_DARWIN && osver_maj == 0x10) // yes 0x10, not decimal 10, don't ask me
|
else if (osid & wxOS_MAC_OSX_DARWIN && osver_maj == 0x10) // yes 0x10, not decimal 10, don't ask me
|
||||||
{
|
{
|
||||||
// ugliest hack in the world? nah.
|
// ugliest hack in the world? nah.
|
||||||
static wxChar osxstring[] = _T("osx00");
|
static char osxstring[] = "osx00";
|
||||||
char minor = osver_min >> 4;
|
char minor = osver_min >> 4;
|
||||||
char patch = osver_min & 0x0F;
|
char patch = osver_min & 0x0F;
|
||||||
osxstring[3] = minor + ((minor<=9) ? '0' : ('a'-1));
|
osxstring[3] = minor + ((minor<=9) ? '0' : ('a'-1));
|
||||||
|
@ -250,27 +250,27 @@ static const wxChar * GetOSShortName()
|
||||||
return osxstring;
|
return osxstring;
|
||||||
}
|
}
|
||||||
else if (osid & wxOS_UNIX_LINUX)
|
else if (osid & wxOS_UNIX_LINUX)
|
||||||
return _T("linux");
|
return "linux";
|
||||||
else if (osid & wxOS_UNIX_FREEBSD)
|
else if (osid & wxOS_UNIX_FREEBSD)
|
||||||
return _T("freebsd");
|
return "freebsd";
|
||||||
else if (osid & wxOS_UNIX_OPENBSD)
|
else if (osid & wxOS_UNIX_OPENBSD)
|
||||||
return _T("openbsd");
|
return "openbsd";
|
||||||
else if (osid & wxOS_UNIX_NETBSD)
|
else if (osid & wxOS_UNIX_NETBSD)
|
||||||
return _T("netbsd");
|
return "netbsd";
|
||||||
else if (osid & wxOS_UNIX_SOLARIS)
|
else if (osid & wxOS_UNIX_SOLARIS)
|
||||||
return _T("solaris");
|
return "solaris";
|
||||||
else if (osid & wxOS_UNIX_AIX)
|
else if (osid & wxOS_UNIX_AIX)
|
||||||
return _T("aix");
|
return "aix";
|
||||||
else if (osid & wxOS_UNIX_HPUX)
|
else if (osid & wxOS_UNIX_HPUX)
|
||||||
return _T("hpux");
|
return "hpux";
|
||||||
else if (osid & wxOS_UNIX)
|
else if (osid & wxOS_UNIX)
|
||||||
return _T("unix");
|
return "unix";
|
||||||
else if (osid & wxOS_OS2)
|
else if (osid & wxOS_OS2)
|
||||||
return _T("os2");
|
return "os2";
|
||||||
else if (osid & wxOS_DOS)
|
else if (osid & wxOS_DOS)
|
||||||
return _T("dos");
|
return "dos";
|
||||||
else
|
else
|
||||||
return _T("unknown");
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ static wxString GetSystemLanguage()
|
||||||
getsyslang_fallback:
|
getsyslang_fallback:
|
||||||
// On an old version of Windows, let's just return the LANGID as a string
|
// On an old version of Windows, let's just return the LANGID as a string
|
||||||
LANGID langid = GetUserDefaultUILanguage();
|
LANGID langid = GetUserDefaultUILanguage();
|
||||||
res = wxString::Format(_T("x-win%04x"), langid);
|
res = wxString::Format("x-win%04x", langid);
|
||||||
|
|
||||||
}
|
}
|
||||||
FreeModule(kernel32);
|
FreeModule(kernel32);
|
||||||
|
@ -326,7 +326,7 @@ void AegisubVersionCheckerThread::DoCheck()
|
||||||
std::set<wxString> accept_tags;
|
std::set<wxString> accept_tags;
|
||||||
#ifdef UPDATE_CHECKER_ACCEPT_TAGS
|
#ifdef UPDATE_CHECKER_ACCEPT_TAGS
|
||||||
{
|
{
|
||||||
wxStringTokenizer tk(wxString(UPDATE_CHECKER_ACCEPT_TAGS, wxConvUTF8), _T(" "));
|
wxStringTokenizer tk(wxString(UPDATE_CHECKER_ACCEPT_TAGS, wxConvUTF8), " ");
|
||||||
while (tk.HasMoreTokens())
|
while (tk.HasMoreTokens())
|
||||||
{
|
{
|
||||||
accept_tags.insert(tk.GetNextToken());
|
accept_tags.insert(tk.GetNextToken());
|
||||||
|
@ -334,11 +334,11 @@ void AegisubVersionCheckerThread::DoCheck()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const wxString servername = _T("updates.aegisub.org");
|
const wxString servername = "updates.aegisub.org";
|
||||||
const wxString base_updates_path = _T("/trunk");
|
const wxString base_updates_path = "/trunk";
|
||||||
|
|
||||||
wxString querystring = wxString::Format(
|
wxString querystring = wxString::Format(
|
||||||
_T("?rev=%d&rel=%d&os=%s&lang=%s"),
|
"?rev=%d&rel=%d&os=%s&lang=%s",
|
||||||
GetSVNRevision(),
|
GetSVNRevision(),
|
||||||
GetIsOfficialRelease()?1:0,
|
GetIsOfficialRelease()?1:0,
|
||||||
GetOSShortName(),
|
GetOSShortName(),
|
||||||
|
@ -347,7 +347,7 @@ void AegisubVersionCheckerThread::DoCheck()
|
||||||
wxString path = base_updates_path + querystring;
|
wxString path = base_updates_path + querystring;
|
||||||
|
|
||||||
wxHTTP http;
|
wxHTTP http;
|
||||||
http.SetHeader(_T("Connection"), _T("Close"));
|
http.SetHeader("Connection", "Close");
|
||||||
http.SetFlags(wxSOCKET_WAITALL|wxSOCKET_BLOCK);
|
http.SetFlags(wxSOCKET_WAITALL|wxSOCKET_BLOCK);
|
||||||
|
|
||||||
if (!http.Connect(servername))
|
if (!http.Connect(servername))
|
||||||
|
@ -369,7 +369,7 @@ void AegisubVersionCheckerThread::DoCheck()
|
||||||
while (!stream->Eof() && stream->GetSize() > 0)
|
while (!stream->Eof() && stream->GetSize() > 0)
|
||||||
{
|
{
|
||||||
wxString line = text.ReadLine();
|
wxString line = text.ReadLine();
|
||||||
wxStringTokenizer tkn(line, _T("|"), wxTOKEN_RET_EMPTY_ALL);
|
wxStringTokenizer tkn(line, "|", wxTOKEN_RET_EMPTY_ALL);
|
||||||
wxArrayString parsed;
|
wxArrayString parsed;
|
||||||
while (tkn.HasMoreTokens()) {
|
while (tkn.HasMoreTokens()) {
|
||||||
parsed.Add(tkn.GetNextToken());
|
parsed.Add(tkn.GetNextToken());
|
||||||
|
@ -383,21 +383,21 @@ void AegisubVersionCheckerThread::DoCheck()
|
||||||
wxString line_friendlyname = inline_string_decode(parsed[4]);
|
wxString line_friendlyname = inline_string_decode(parsed[4]);
|
||||||
wxString line_description = inline_string_decode(parsed[5]);
|
wxString line_description = inline_string_decode(parsed[5]);
|
||||||
|
|
||||||
if ((line_type == _T("branch") || line_type == _T("dev")) && GetIsOfficialRelease())
|
if ((line_type == "branch" || line_type == "dev") && GetIsOfficialRelease())
|
||||||
{
|
{
|
||||||
// stable runners don't want unstable, not interesting, skip
|
// stable runners don't want unstable, not interesting, skip
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the tags match
|
// check if the tags match
|
||||||
if (line_tags_str.IsEmpty() || line_tags_str == _T("all"))
|
if (line_tags_str.IsEmpty() || line_tags_str == "all")
|
||||||
{
|
{
|
||||||
// looking good
|
// looking good
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool accepts_all_tags = true;
|
bool accepts_all_tags = true;
|
||||||
wxStringTokenizer tk(line_tags_str, _T(" "));
|
wxStringTokenizer tk(line_tags_str, " ");
|
||||||
while (tk.HasMoreTokens())
|
while (tk.HasMoreTokens())
|
||||||
{
|
{
|
||||||
if (accept_tags.find(tk.GetNextToken()) == accept_tags.end())
|
if (accept_tags.find(tk.GetNextToken()) == accept_tags.end())
|
||||||
|
@ -410,7 +410,7 @@ void AegisubVersionCheckerThread::DoCheck()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line_type == _T("upgrade") || line_type == _T("bugfix"))
|
if (line_type == "upgrade" || line_type == "bugfix")
|
||||||
{
|
{
|
||||||
// de facto interesting
|
// de facto interesting
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ void AssTransformCleanInfoFilter::ProcessSubs(AssFile *subs, wxWindow *) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString field = curEntry->GetEntryData().Left(curEntry->GetEntryData().Find(_T(':'))).Lower();
|
wxString field = curEntry->GetEntryData().Left(curEntry->GetEntryData().Find(':')).Lower();
|
||||||
if (field != "scripttype" &&
|
if (field != "scripttype" &&
|
||||||
field != "collisions" &&
|
field != "collisions" &&
|
||||||
field != "playresx" &&
|
field != "playresx" &&
|
||||||
|
|
|
@ -112,7 +112,7 @@ FFMS_Index *FFmpegSourceProvider::DoIndexing(FFMS_Indexer *Indexer, const wxStri
|
||||||
throw agi::UserCancelException("indexing cancelled by user");
|
throw agi::UserCancelException("indexing cancelled by user");
|
||||||
}
|
}
|
||||||
if (Index == NULL) {
|
if (Index == NULL) {
|
||||||
MsgString.Append(_T("Failed to index: ")).Append(wxString(ErrInfo.Buffer, wxConvUTF8));
|
MsgString.Append("Failed to index: ").Append(wxString(ErrInfo.Buffer, wxConvUTF8));
|
||||||
throw MsgString;
|
throw MsgString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ FFMS_Index *FFmpegSourceProvider::DoIndexing(FFMS_Indexer *Indexer, const wxStri
|
||||||
FFMS_WriteIndex(CacheName.utf8_str(), Index, &ErrInfo);
|
FFMS_WriteIndex(CacheName.utf8_str(), Index, &ErrInfo);
|
||||||
/*if (FFMS_WriteIndex(CacheName.char_str(), Index, FFMSErrMsg, MsgSize)) {
|
/*if (FFMS_WriteIndex(CacheName.char_str(), Index, FFMSErrMsg, MsgSize)) {
|
||||||
wxString temp(FFMSErrMsg, wxConvUTF8);
|
wxString temp(FFMSErrMsg, wxConvUTF8);
|
||||||
MsgString << _T("Failed to write index: ") << temp;
|
MsgString << "Failed to write index: " << temp;
|
||||||
throw MsgString;
|
throw MsgString;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ std::map<int,wxString> FFmpegSourceProvider::GetTracksOfType(FFMS_Indexer *Index
|
||||||
int FFmpegSourceProvider::AskForTrackSelection(const std::map<int,wxString> &TrackList, FFMS_TrackType Type) {
|
int FFmpegSourceProvider::AskForTrackSelection(const std::map<int,wxString> &TrackList, FFMS_TrackType Type) {
|
||||||
std::vector<int> TrackNumbers;
|
std::vector<int> TrackNumbers;
|
||||||
wxArrayString Choices;
|
wxArrayString Choices;
|
||||||
wxString TypeName = _T("");
|
wxString TypeName = "";
|
||||||
if (Type == FFMS_TYPE_VIDEO)
|
if (Type == FFMS_TYPE_VIDEO)
|
||||||
TypeName = _("video");
|
TypeName = _("video");
|
||||||
else if (Type == FFMS_TYPE_AUDIO)
|
else if (Type == FFMS_TYPE_AUDIO)
|
||||||
|
@ -178,19 +178,19 @@ int FFmpegSourceProvider::AskForTrackSelection(const std::map<int,wxString> &Tra
|
||||||
void FFmpegSourceProvider::SetLogLevel() {
|
void FFmpegSourceProvider::SetLogLevel() {
|
||||||
wxString LogLevel = lagi_wxString(OPT_GET("Provider/FFmpegSource/Log Level")->GetString());
|
wxString LogLevel = lagi_wxString(OPT_GET("Provider/FFmpegSource/Log Level")->GetString());
|
||||||
|
|
||||||
if (!LogLevel.CmpNoCase(_T("panic")))
|
if (!LogLevel.CmpNoCase("panic"))
|
||||||
FFMS_SetLogLevel(FFMS_LOG_PANIC);
|
FFMS_SetLogLevel(FFMS_LOG_PANIC);
|
||||||
else if (!LogLevel.CmpNoCase(_T("fatal")))
|
else if (!LogLevel.CmpNoCase("fatal"))
|
||||||
FFMS_SetLogLevel(FFMS_LOG_FATAL);
|
FFMS_SetLogLevel(FFMS_LOG_FATAL);
|
||||||
else if (!LogLevel.CmpNoCase(_T("error")))
|
else if (!LogLevel.CmpNoCase("error"))
|
||||||
FFMS_SetLogLevel(FFMS_LOG_ERROR);
|
FFMS_SetLogLevel(FFMS_LOG_ERROR);
|
||||||
else if (!LogLevel.CmpNoCase(_T("warning")))
|
else if (!LogLevel.CmpNoCase("warning"))
|
||||||
FFMS_SetLogLevel(FFMS_LOG_WARNING);
|
FFMS_SetLogLevel(FFMS_LOG_WARNING);
|
||||||
else if (!LogLevel.CmpNoCase(_T("info")))
|
else if (!LogLevel.CmpNoCase("info"))
|
||||||
FFMS_SetLogLevel(FFMS_LOG_INFO);
|
FFMS_SetLogLevel(FFMS_LOG_INFO);
|
||||||
else if (!LogLevel.CmpNoCase(_T("verbose")))
|
else if (!LogLevel.CmpNoCase("verbose"))
|
||||||
FFMS_SetLogLevel(FFMS_LOG_VERBOSE);
|
FFMS_SetLogLevel(FFMS_LOG_VERBOSE);
|
||||||
else if (!LogLevel.CmpNoCase(_T("debug")))
|
else if (!LogLevel.CmpNoCase("debug"))
|
||||||
FFMS_SetLogLevel(FFMS_LOG_DEBUG);
|
FFMS_SetLogLevel(FFMS_LOG_DEBUG);
|
||||||
else
|
else
|
||||||
FFMS_SetLogLevel(FFMS_LOG_QUIET);
|
FFMS_SetLogLevel(FFMS_LOG_QUIET);
|
||||||
|
@ -200,13 +200,13 @@ void FFmpegSourceProvider::SetLogLevel() {
|
||||||
FFMS_IndexErrorHandling FFmpegSourceProvider::GetErrorHandlingMode() {
|
FFMS_IndexErrorHandling FFmpegSourceProvider::GetErrorHandlingMode() {
|
||||||
wxString Mode = lagi_wxString(OPT_GET("Provider/Audio/FFmpegSource/Decode Error Handling")->GetString());
|
wxString Mode = lagi_wxString(OPT_GET("Provider/Audio/FFmpegSource/Decode Error Handling")->GetString());
|
||||||
|
|
||||||
if (!Mode.CmpNoCase(_T("ignore")))
|
if (!Mode.CmpNoCase("ignore"))
|
||||||
return FFMS_IEH_IGNORE;
|
return FFMS_IEH_IGNORE;
|
||||||
else if (!Mode.CmpNoCase(_T("clear")))
|
else if (!Mode.CmpNoCase("clear"))
|
||||||
return FFMS_IEH_CLEAR_TRACK;
|
return FFMS_IEH_CLEAR_TRACK;
|
||||||
else if (!Mode.CmpNoCase(_T("stop")))
|
else if (!Mode.CmpNoCase("stop"))
|
||||||
return FFMS_IEH_STOP_TRACK;
|
return FFMS_IEH_STOP_TRACK;
|
||||||
else if (!Mode.CmpNoCase(_T("abort")))
|
else if (!Mode.CmpNoCase("abort"))
|
||||||
return FFMS_IEH_ABORT;
|
return FFMS_IEH_ABORT;
|
||||||
else
|
else
|
||||||
return FFMS_IEH_STOP_TRACK; // questionable default?
|
return FFMS_IEH_STOP_TRACK; // questionable default?
|
||||||
|
@ -241,7 +241,7 @@ wxString FFmpegSourceProvider::GetCacheFilename(const wxString& _filename)
|
||||||
|
|
||||||
// Generate the filename
|
// Generate the filename
|
||||||
unsigned int *md5 = (unsigned int*) digest;
|
unsigned int *md5 = (unsigned int*) digest;
|
||||||
wxString result = wxString::Format(_T("?user/ffms2cache/%08X%08X%08X%08X.ffindex"),md5[0],md5[1],md5[2],md5[3]);
|
wxString result = wxString::Format("?user/ffms2cache/%08X%08X%08X%08X.ffindex",md5[0],md5[1],md5[2],md5[3]);
|
||||||
result = StandardPaths::DecodePath(result);
|
result = StandardPaths::DecodePath(result);
|
||||||
|
|
||||||
// Ensure that folder exists
|
// Ensure that folder exists
|
||||||
|
@ -252,7 +252,7 @@ wxString FFmpegSourceProvider::GetCacheFilename(const wxString& _filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileName dirfn(dir);
|
wxFileName dirfn(dir);
|
||||||
return dirfn.GetShortPath() + _T("/") + fn.GetFullName();
|
return dirfn.GetShortPath() + "/" + fn.GetFullName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
|
||||||
return (wxThread::ExitCode)1;
|
return (wxThread::ExitCode)1;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString cachedirname = StandardPaths::DecodePath(_T("?user/ffms2cache/"));
|
wxString cachedirname = StandardPaths::DecodePath("?user/ffms2cache/");
|
||||||
wxDir cachedir;
|
wxDir cachedir;
|
||||||
if (!cachedir.Open(cachedirname)) {
|
if (!cachedir.Open(cachedirname)) {
|
||||||
LOG_D("provider/ffmpegsource/cache") << "couldn't open cache directory " << cachedirname.c_str();
|
LOG_D("provider/ffmpegsource/cache") << "couldn't open cache directory " << cachedirname.c_str();
|
||||||
|
@ -314,7 +314,7 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
|
||||||
int64_t cursize = wxDir::GetTotalSize(cachedirname).GetValue();
|
int64_t cursize = wxDir::GetTotalSize(cachedirname).GetValue();
|
||||||
int maxfiles = OPT_GET("Provider/FFmpegSource/Cache/Files")->GetInt();
|
int maxfiles = OPT_GET("Provider/FFmpegSource/Cache/Files")->GetInt();
|
||||||
|
|
||||||
if (!cachedir.HasFiles(_T("*.ffindex"))) {
|
if (!cachedir.HasFiles("*.ffindex")) {
|
||||||
LOG_D("provider/ffmpegsource/cache") << "no index files in cache folder, exiting";
|
LOG_D("provider/ffmpegsource/cache") << "no index files in cache folder, exiting";
|
||||||
return (wxThread::ExitCode)0;
|
return (wxThread::ExitCode)0;
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
|
||||||
|
|
||||||
// unusually paranoid sanity check
|
// unusually paranoid sanity check
|
||||||
// (someone might have deleted the file(s) after we did HasFiles() above; does wxDir.Open() lock the dir?)
|
// (someone might have deleted the file(s) after we did HasFiles() above; does wxDir.Open() lock the dir?)
|
||||||
if (!cachedir.GetFirst(&curfn_str, _T("*.ffindex"), wxDIR_FILES)) {
|
if (!cachedir.GetFirst(&curfn_str, "*.ffindex", wxDIR_FILES)) {
|
||||||
LOG_D("provider/ffmpegsource/cache") << "undefined error";
|
LOG_D("provider/ffmpegsource/cache") << "undefined error";
|
||||||
return (wxThread::ExitCode)1;
|
return (wxThread::ExitCode)1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
void FFT::DoTransform (size_t n_samples,float *input,float *output_r,float *output_i,bool inverse) {
|
void FFT::DoTransform (size_t n_samples,float *input,float *output_r,float *output_i,bool inverse) {
|
||||||
// Check if it's power of two
|
// Check if it's power of two
|
||||||
if (!IsPowerOfTwo(n_samples)) {
|
if (!IsPowerOfTwo(n_samples)) {
|
||||||
throw L"FFT requires power of two input.";
|
throw "FFT requires power of two input.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inverse transform
|
// Inverse transform
|
||||||
|
|
|
@ -123,7 +123,7 @@ wxArrayString FontFileLister::CacheGetFilesWithFace(wxString facename) {
|
||||||
FontMap::iterator iter = fontTable.find(facename);
|
FontMap::iterator iter = fontTable.find(facename);
|
||||||
if (iter != fontTable.end()) return iter->second;
|
if (iter != fontTable.end()) return iter->second;
|
||||||
else {
|
else {
|
||||||
iter = fontTable.find(_T("*")+facename);
|
iter = fontTable.find("*"+facename);
|
||||||
if (iter != fontTable.end()) return iter->second;
|
if (iter != fontTable.end()) return iter->second;
|
||||||
return wxArrayString();
|
return wxArrayString();
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ void FontFileLister::AddFont(wxString filename,wxString facename) {
|
||||||
// See if it's a valid facename
|
// See if it's a valid facename
|
||||||
facename.Trim(true).Trim(false);
|
facename.Trim(true).Trim(false);
|
||||||
if (facename.IsEmpty()) return;
|
if (facename.IsEmpty()) return;
|
||||||
if (facename.Lower().StartsWith(_T("copyright "))) return;
|
if (facename.Lower().StartsWith("copyright ")) return;
|
||||||
|
|
||||||
// Add filename to general list
|
// Add filename to general list
|
||||||
if (fontFiles.Index(filename) == wxNOT_FOUND) {
|
if (fontFiles.Index(filename) == wxNOT_FOUND) {
|
||||||
|
@ -178,18 +178,18 @@ bool FontFileLister::IsFilenameCached(wxString filename) {
|
||||||
void FontFileLister::SaveCache() {
|
void FontFileLister::SaveCache() {
|
||||||
try {
|
try {
|
||||||
// Open file
|
// Open file
|
||||||
TextFileWriter file(StandardPaths::DecodePath(_T("?user/fontscache.dat")));
|
TextFileWriter file(StandardPaths::DecodePath("?user/fontscache.dat"));
|
||||||
|
|
||||||
// For each face...
|
// For each face...
|
||||||
for (FontMap::iterator iter = fontTable.begin();iter!=fontTable.end();iter++) {
|
for (FontMap::iterator iter = fontTable.begin();iter!=fontTable.end();iter++) {
|
||||||
// Write face name
|
// Write face name
|
||||||
wxString line = iter->first + _T("?");
|
wxString line = iter->first + "?";
|
||||||
size_t len = iter->second.Count();
|
size_t len = iter->second.Count();
|
||||||
|
|
||||||
// Write file names
|
// Write file names
|
||||||
for (size_t i=0;i<len;i++) {
|
for (size_t i=0;i<len;i++) {
|
||||||
line += iter->second[i];
|
line += iter->second[i];
|
||||||
if (i != len-1) line += _T("|");
|
if (i != len-1) line += "|";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write line
|
// Write line
|
||||||
|
@ -207,20 +207,20 @@ void FontFileLister::SaveCache() {
|
||||||
void FontFileLister::LoadCache() {
|
void FontFileLister::LoadCache() {
|
||||||
try {
|
try {
|
||||||
// Load cache
|
// Load cache
|
||||||
TextFileReader file(StandardPaths::DecodePath(_T("?user/fontscache.dat")));
|
TextFileReader file(StandardPaths::DecodePath("?user/fontscache.dat"));
|
||||||
|
|
||||||
// Read each line
|
// Read each line
|
||||||
while (file.HasMoreLines()) {
|
while (file.HasMoreLines()) {
|
||||||
// Read line
|
// Read line
|
||||||
wxString line = file.ReadLineFromFile();
|
wxString line = file.ReadLineFromFile();
|
||||||
int pos = line.Find(_T('?'));
|
int pos = line.Find('?');
|
||||||
|
|
||||||
// Get face name
|
// Get face name
|
||||||
wxString face = line.Left(pos);
|
wxString face = line.Left(pos);
|
||||||
if (face.IsEmpty()) continue;
|
if (face.IsEmpty()) continue;
|
||||||
|
|
||||||
// Get files
|
// Get files
|
||||||
wxStringTokenizer tkn(line.Mid(pos+1),_T("|"));
|
wxStringTokenizer tkn(line.Mid(pos+1),"|");
|
||||||
while (tkn.HasMoreTokens()) {
|
while (tkn.HasMoreTokens()) {
|
||||||
wxString file = tkn.GetNextToken();
|
wxString file = tkn.GetNextToken();
|
||||||
if (!file.IsEmpty()) {
|
if (!file.IsEmpty()) {
|
||||||
|
|
|
@ -324,7 +324,7 @@ void FrameMain::LoadSubtitles(wxString filename,wxString charset) {
|
||||||
config::mru->Remove("Subtitle", STD_STR(filename));
|
config::mru->Remove("Subtitle", STD_STR(filename));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (const wchar_t *err) {
|
catch (const char *err) {
|
||||||
wxMessageBox(wxString(err), "Error", wxOK | wxICON_ERROR, NULL);
|
wxMessageBox(wxString(err), "Error", wxOK | wxICON_ERROR, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -631,7 +631,7 @@ catch (const agi::Exception& err) {
|
||||||
catch (wxString err) {
|
catch (wxString err) {
|
||||||
StatusTimeout("Exception when attempting to autosave file: " + err);
|
StatusTimeout("Exception when attempting to autosave file: " + err);
|
||||||
}
|
}
|
||||||
catch (const wchar_t *err) {
|
catch (const char *err) {
|
||||||
StatusTimeout("Exception when attempting to autosave file: " + wxString(err));
|
StatusTimeout("Exception when attempting to autosave file: " + wxString(err));
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
|
|
@ -257,7 +257,7 @@ OpenGLTextTexture::OpenGLTextTexture(OpenGLTextGlyph &glyph) {
|
||||||
|
|
||||||
// Allocate texture
|
// Allocate texture
|
||||||
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,width,height,0,GL_ALPHA,GL_UNSIGNED_BYTE,NULL);
|
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,width,height,0,GL_ALPHA,GL_UNSIGNED_BYTE,NULL);
|
||||||
if (glGetError()) throw _T("Internal OpenGL text renderer error: Could not allocate Text Texture");
|
if (glGetError()) throw "Internal OpenGL text renderer error: Could not allocate Text Texture";
|
||||||
|
|
||||||
TryToInsert(glyph);
|
TryToInsert(glyph);
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ void OpenGLTextTexture::Insert(OpenGLTextGlyph &glyph) {
|
||||||
// Upload image to video memory
|
// Upload image to video memory
|
||||||
glBindTexture(GL_TEXTURE_2D, tex);
|
glBindTexture(GL_TEXTURE_2D, tex);
|
||||||
glTexSubImage2D(GL_TEXTURE_2D,0,x,y,imgw,imgh,GL_LUMINANCE_ALPHA,GL_UNSIGNED_BYTE,&alpha[0]);
|
glTexSubImage2D(GL_TEXTURE_2D,0,x,y,imgw,imgh,GL_LUMINANCE_ALPHA,GL_UNSIGNED_BYTE,&alpha[0]);
|
||||||
if (glGetError()) throw _T("Internal OpenGL text renderer error: Error uploading glyph data to video memory.");
|
if (glGetError()) throw "Internal OpenGL text renderer error: Error uploading glyph data to video memory.";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw a glyph at (x,y)
|
/// Draw a glyph at (x,y)
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
/// @param size
|
/// @param size
|
||||||
///
|
///
|
||||||
HelpButton::HelpButton(wxWindow *parent,wxString _page,wxPoint position,wxSize size)
|
HelpButton::HelpButton(wxWindow *parent,wxString _page,wxPoint position,wxSize size)
|
||||||
: wxButton (parent,wxID_HELP,_T(""),position,size)
|
: wxButton (parent,wxID_HELP,"",position,size)
|
||||||
{
|
{
|
||||||
id = _page;
|
id = _page;
|
||||||
Connect(GetId(),wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(HelpButton::OnPressed));
|
Connect(GetId(),wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(HelpButton::OnPressed));
|
||||||
|
@ -72,7 +72,7 @@ HelpButton::HelpButton(wxWindow *parent,wxString _page,wxPoint position,wxSize s
|
||||||
void HelpButton::OnPressed(wxCommandEvent &event) {
|
void HelpButton::OnPressed(wxCommandEvent &event) {
|
||||||
// Verify if the page is valid
|
// Verify if the page is valid
|
||||||
if (id.IsEmpty()) {
|
if (id.IsEmpty()) {
|
||||||
wxLogMessage(_T("TODO"));
|
wxLogMessage("TODO");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,15 +91,15 @@ void HelpButton::OpenPage(const wxString pageID) {
|
||||||
wxString page = (*pages)[pageID];
|
wxString page = (*pages)[pageID];
|
||||||
|
|
||||||
// Get the file type
|
// Get the file type
|
||||||
wxFileType *type = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("html"));
|
wxFileType *type = wxTheMimeTypesManager->GetFileTypeFromExtension("html");
|
||||||
if (type) {
|
if (type) {
|
||||||
//wxString path = StandardPaths::DecodePath(wxString::Format(_T("http://docs.aegisub.net/%s"),page.c_str()));
|
//wxString path = StandardPaths::DecodePath(wxString::Format("http://docs.aegisub.net/%s",page.c_str()));
|
||||||
wxString docsPath = StandardPaths::DecodePath(_T("?data/docs"));
|
wxString docsPath = StandardPaths::DecodePath("?data/docs");
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
docsPath.Replace(_T("\\"),_T("/"));
|
docsPath.Replace("\\","/");
|
||||||
docsPath = _T("/") + docsPath;
|
docsPath = "/" + docsPath;
|
||||||
#endif
|
#endif
|
||||||
wxString path = wxString::Format(_T("file://%s/%s.html"),docsPath.c_str(),page.c_str());
|
wxString path = wxString::Format("file://%s/%s.html",docsPath.c_str(),page.c_str());
|
||||||
wxLaunchDefaultBrowser(path);
|
wxLaunchDefaultBrowser(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,27 +116,27 @@ void HelpButton::InitStatic() {
|
||||||
if (!pages) {
|
if (!pages) {
|
||||||
pages = new std::map<wxString,wxString>;
|
pages = new std::map<wxString,wxString>;
|
||||||
std::map<wxString,wxString> &page = *pages;
|
std::map<wxString,wxString> &page = *pages;
|
||||||
page[_T("Attachment Manager")] = _T("Attachment_Manager");
|
page["Attachment Manager"] = "Attachment_Manager";
|
||||||
page[_T("Automation Manager")] = _T("Automation_Manager");
|
page["Automation Manager"] = "Automation_Manager";
|
||||||
page[_T("Colour Picker")] = _T("Colour_Picker");
|
page["Colour Picker"] = "Colour_Picker";
|
||||||
page[_T("Dummy Video")] = _T("Dummy_video");
|
page["Dummy Video"] = "Dummy_video";
|
||||||
page[_T("Export")] = _T("Exporting");
|
page["Export"] = "Exporting";
|
||||||
page[_T("Fonts Collector")] = _T("Fonts_Collector");
|
page["Fonts Collector"] = "Fonts_Collector";
|
||||||
page[_T("Kanji Timer")] = _T("Kanji_Timer");
|
page["Kanji Timer"] = "Kanji_Timer";
|
||||||
page[_T("Main")] = _T("Main_Page");
|
page["Main"] = "Main_Page";
|
||||||
page[_T("Options")] = _T("Options");
|
page["Options"] = "Options";
|
||||||
page[_T("Paste Over")] = _T("Paste_Over");
|
page["Paste Over"] = "Paste_Over";
|
||||||
page[_T("Properties")] = _T("Properties");
|
page["Properties"] = "Properties";
|
||||||
page[_T("Resample resolution")] = _T("Resolution_Resampler");
|
page["Resample resolution"] = "Resolution_Resampler";
|
||||||
page[_T("Shift Times")] = _T("Shift_Times");
|
page["Shift Times"] = "Shift_Times";
|
||||||
page[_T("Select Lines")] = _T("Select_Lines");
|
page["Select Lines"] = "Select_Lines";
|
||||||
page[_T("Spell Checker")] = _T("Spell_Checker");
|
page["Spell Checker"] = "Spell_Checker";
|
||||||
page[_T("Style Editor")] = _T("Styles");
|
page["Style Editor"] = "Styles";
|
||||||
page[_T("Styles Manager")] = _T("Styles");
|
page["Styles Manager"] = "Styles";
|
||||||
page[_T("Styling Assistant")] = _T("Styling_Assistant");
|
page["Styling Assistant"] = "Styling_Assistant";
|
||||||
page[_T("Timing Processor")] = _T("Timing_Post-Processor");
|
page["Timing Processor"] = "Timing_Post-Processor";
|
||||||
page[_T("Translation Assistant")] = _T("Translation_Assistant");
|
page["Translation Assistant"] = "Translation_Assistant";
|
||||||
page[_T("Visual Typesetting")] = _T("Visual_Typesetting");
|
page["Visual Typesetting"] = "Visual_Typesetting";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ private:
|
||||||
static void InitStatic();
|
static void InitStatic();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HelpButton(wxWindow *parent,wxString page=_T(""),wxPoint position=wxDefaultPosition,wxSize size=wxDefaultSize);
|
HelpButton(wxWindow *parent,wxString page="",wxPoint position=wxDefaultPosition,wxSize size=wxDefaultSize);
|
||||||
|
|
||||||
static void OpenPage(const wxString page);
|
static void OpenPage(const wxString page);
|
||||||
static void ClearPages();
|
static void ClearPages();
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
/// @brief Use this to set any post-loading warnings, such as "being loaded with unreliable seeking"
|
/// @brief Use this to set any post-loading warnings, such as "being loaded with unreliable seeking"
|
||||||
virtual wxString GetWarning() const { return L""; }
|
virtual wxString GetWarning() const { return ""; }
|
||||||
|
|
||||||
/// @brief Name of decoder, e.g. "Avisynth/FFMpegSource"
|
/// @brief Name of decoder, e.g. "Avisynth/FFMpegSource"
|
||||||
virtual wxString GetDecoderName() const = 0;
|
virtual wxString GetDecoderName() const = 0;
|
||||||
|
|
|
@ -96,12 +96,12 @@ namespace config {
|
||||||
// wxWidgets macro
|
// wxWidgets macro
|
||||||
IMPLEMENT_APP(AegisubApp)
|
IMPLEMENT_APP(AegisubApp)
|
||||||
|
|
||||||
static const wchar_t *LastStartupState = NULL;
|
static const char *LastStartupState = NULL;
|
||||||
|
|
||||||
#ifdef WITH_STARTUPLOG
|
#ifdef WITH_STARTUPLOG
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
#define StartupLog(a) MessageBox(0, a, _T("Aegisub startup log"), 0)
|
#define StartupLog(a) MessageBox(0, L ## a, L"Aegisub startup log", 0)
|
||||||
#else
|
#else
|
||||||
#define StartupLog(a) LastStartupState = a
|
#define StartupLog(a) LastStartupState = a
|
||||||
#endif
|
#endif
|
||||||
|
@ -165,13 +165,13 @@ static void wxAssertHandler(const wxString &file, int line, const wxString &func
|
||||||
bool AegisubApp::OnInit() {
|
bool AegisubApp::OnInit() {
|
||||||
// App name (yeah, this is a little weird to get rid of an odd warning)
|
// App name (yeah, this is a little weird to get rid of an odd warning)
|
||||||
#if defined(__WXMSW__) || defined(__WXMAC__)
|
#if defined(__WXMSW__) || defined(__WXMAC__)
|
||||||
SetAppName(_T("Aegisub"));
|
SetAppName("Aegisub");
|
||||||
#else
|
#else
|
||||||
SetAppName(_T("aegisub"));
|
SetAppName("aegisub");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// logging.
|
// logging.
|
||||||
const std::string path_log(StandardPaths::DecodePath(_T("?user/log/")));
|
const std::string path_log(StandardPaths::DecodePath("?user/log/"));
|
||||||
wxFileName::Mkdir(path_log, 0777, wxPATH_MKDIR_FULL);
|
wxFileName::Mkdir(path_log, 0777, wxPATH_MKDIR_FULL);
|
||||||
agi::log::log = new agi::log::LogSink(path_log);
|
agi::log::log = new agi::log::LogSink(path_log);
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ bool AegisubApp::OnInit() {
|
||||||
cmd::init_builtin_commands();
|
cmd::init_builtin_commands();
|
||||||
|
|
||||||
// Init hotkeys.
|
// Init hotkeys.
|
||||||
const std::string conf_user_hotkey(StandardPaths::DecodePath(_T("?user/hotkey.json")));
|
const std::string conf_user_hotkey(StandardPaths::DecodePath("?user/hotkey.json"));
|
||||||
agi::hotkey::hotkey = new agi::hotkey::Hotkey(conf_user_hotkey, GET_DEFAULT_CONFIG(default_hotkey));
|
agi::hotkey::hotkey = new agi::hotkey::Hotkey(conf_user_hotkey, GET_DEFAULT_CONFIG(default_hotkey));
|
||||||
|
|
||||||
// Init icons.
|
// Init icons.
|
||||||
|
@ -198,13 +198,13 @@ bool AegisubApp::OnInit() {
|
||||||
// Install assertion handler
|
// Install assertion handler
|
||||||
// wxSetAssertHandler(wxAssertHandler);
|
// wxSetAssertHandler(wxAssertHandler);
|
||||||
|
|
||||||
const std::string conf_mru(StandardPaths::DecodePath(_T("?user/mru.json")));
|
const std::string conf_mru(StandardPaths::DecodePath("?user/mru.json"));
|
||||||
config::mru = new agi::MRUManager(conf_mru, GET_DEFAULT_CONFIG(default_mru));
|
config::mru = new agi::MRUManager(conf_mru, GET_DEFAULT_CONFIG(default_mru));
|
||||||
|
|
||||||
// Set config file
|
// Set config file
|
||||||
StartupLog(_T("Load configuration"));
|
StartupLog("Load configuration");
|
||||||
try {
|
try {
|
||||||
const std::string conf_user(StandardPaths::DecodePath(_T("?user/config.json")));
|
const std::string conf_user(StandardPaths::DecodePath("?user/config.json"));
|
||||||
config::opt = new agi::Options(conf_user, GET_DEFAULT_CONFIG(default_config));
|
config::opt = new agi::Options(conf_user, GET_DEFAULT_CONFIG(default_config));
|
||||||
} catch (agi::Exception& e) {
|
} catch (agi::Exception& e) {
|
||||||
LOG_E("config/init") << "Caught exception: " << e.GetName() << " -> " << e.GetMessage();
|
LOG_E("config/init") << "Caught exception: " << e.GetName() << " -> " << e.GetMessage();
|
||||||
|
@ -213,14 +213,14 @@ bool AegisubApp::OnInit() {
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
// Try loading configuration from the install dir if one exists there
|
// Try loading configuration from the install dir if one exists there
|
||||||
try {
|
try {
|
||||||
const std::string conf_local(StandardPaths::DecodePath(_T("?data/config.json")));
|
const std::string conf_local(StandardPaths::DecodePath("?data/config.json"));
|
||||||
std::ifstream* localConfig = agi::io::Open(conf_local);
|
std::ifstream* localConfig = agi::io::Open(conf_local);
|
||||||
config::opt->ConfigNext(*localConfig);
|
config::opt->ConfigNext(*localConfig);
|
||||||
delete localConfig;
|
delete localConfig;
|
||||||
|
|
||||||
if (OPT_GET("App/Local Config")->GetBool()) {
|
if (OPT_GET("App/Local Config")->GetBool()) {
|
||||||
// Local config, make ?user mean ?data so all user settings are placed in install dir
|
// Local config, make ?user mean ?data so all user settings are placed in install dir
|
||||||
StandardPaths::SetPathValue(_T("?user"), StandardPaths::DecodePath(_T("?data")));
|
StandardPaths::SetPathValue("?user", StandardPaths::DecodePath("?data"));
|
||||||
}
|
}
|
||||||
} catch (agi::acs::AcsError const&) {
|
} catch (agi::acs::AcsError const&) {
|
||||||
// File doesn't exist or we can't read it
|
// File doesn't exist or we can't read it
|
||||||
|
@ -231,7 +231,7 @@ bool AegisubApp::OnInit() {
|
||||||
config::opt->ConfigUser();
|
config::opt->ConfigUser();
|
||||||
}
|
}
|
||||||
catch (agi::Exception const& err) {
|
catch (agi::Exception const& err) {
|
||||||
wxMessageBox(L"Configuration file is invalid. Error reported:\n" + lagi_wxString(err.GetMessage()), L"Error");
|
wxMessageBox("Configuration file is invalid. Error reported:\n" + lagi_wxString(err.GetMessage()), "Error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,29 +239,29 @@ bool AegisubApp::OnInit() {
|
||||||
SetThreadName((DWORD) -1,"AegiMain");
|
SetThreadName((DWORD) -1,"AegiMain");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
StartupLog(_T("Inside OnInit"));
|
StartupLog("Inside OnInit");
|
||||||
frame = NULL;
|
frame = NULL;
|
||||||
try {
|
try {
|
||||||
// Initialize randomizer
|
// Initialize randomizer
|
||||||
StartupLog(_T("Initialize random generator"));
|
StartupLog("Initialize random generator");
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
|
||||||
// locale for loading options
|
// locale for loading options
|
||||||
StartupLog(_T("Set initial locale"));
|
StartupLog("Set initial locale");
|
||||||
setlocale(LC_NUMERIC, "C");
|
setlocale(LC_NUMERIC, "C");
|
||||||
setlocale(LC_CTYPE, "C");
|
setlocale(LC_CTYPE, "C");
|
||||||
|
|
||||||
// Crash handling
|
// Crash handling
|
||||||
#if !defined(_DEBUG) || defined(WITH_EXCEPTIONS)
|
#if !defined(_DEBUG) || defined(WITH_EXCEPTIONS)
|
||||||
StartupLog(_T("Install exception handler"));
|
StartupLog("Install exception handler");
|
||||||
wxHandleFatalExceptions(true);
|
wxHandleFatalExceptions(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
StartupLog(_T("Store options back"));
|
StartupLog("Store options back");
|
||||||
OPT_SET("Version/Last Version")->SetInt(GetSVNRevision());
|
OPT_SET("Version/Last Version")->SetInt(GetSVNRevision());
|
||||||
AssTime::UseMSPrecision = OPT_GET("App/Nonstandard Milisecond Times")->GetBool();
|
AssTime::UseMSPrecision = OPT_GET("App/Nonstandard Milisecond Times")->GetBool();
|
||||||
|
|
||||||
StartupLog(_T("Initialize final locale"));
|
StartupLog("Initialize final locale");
|
||||||
|
|
||||||
// Set locale
|
// Set locale
|
||||||
int lang = OPT_GET("App/Locale")->GetInt();
|
int lang = OPT_GET("App/Locale")->GetInt();
|
||||||
|
@ -277,46 +277,46 @@ bool AegisubApp::OnInit() {
|
||||||
|
|
||||||
// Load Automation scripts
|
// Load Automation scripts
|
||||||
#ifdef WITH_AUTOMATION
|
#ifdef WITH_AUTOMATION
|
||||||
StartupLog(_T("Load global Automation scripts"));
|
StartupLog("Load global Automation scripts");
|
||||||
global_scripts = new Automation4::AutoloadScriptManager(lagi_wxString(OPT_GET("Path/Automation/Autoload")->GetString()));
|
global_scripts = new Automation4::AutoloadScriptManager(lagi_wxString(OPT_GET("Path/Automation/Autoload")->GetString()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Load export filters
|
// Load export filters
|
||||||
StartupLog(L"Register export filters");
|
StartupLog("Register export filters");
|
||||||
AssExportFilterChain::Register(new AssFixStylesFilter);
|
AssExportFilterChain::Register(new AssFixStylesFilter);
|
||||||
AssExportFilterChain::Register(new AssTransformCleanInfoFilter);
|
AssExportFilterChain::Register(new AssTransformCleanInfoFilter);
|
||||||
AssExportFilterChain::Register(new AssTransformFramerateFilter);
|
AssExportFilterChain::Register(new AssTransformFramerateFilter);
|
||||||
|
|
||||||
// Get parameter subs
|
// Get parameter subs
|
||||||
StartupLog(_T("Parse command line"));
|
StartupLog("Parse command line");
|
||||||
wxArrayString subs;
|
wxArrayString subs;
|
||||||
for (int i=1;i<argc;i++) {
|
for (int i=1;i<argc;i++) {
|
||||||
subs.Add(argv[i]);
|
subs.Add(argv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open main frame
|
// Open main frame
|
||||||
StartupLog(_T("Create main window"));
|
StartupLog("Create main window");
|
||||||
frame = new FrameMain(subs);
|
frame = new FrameMain(subs);
|
||||||
SetTopWindow(frame);
|
SetTopWindow(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (const wchar_t *err) {
|
catch (const char *err) {
|
||||||
wxMessageBox(err,_T("Fatal error while initializing"));
|
wxMessageBox(err,"Fatal error while initializing");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (agi::Exception const& e) {
|
catch (agi::Exception const& e) {
|
||||||
wxMessageBox(e.GetMessage(),_T("Fatal error while initializing"));
|
wxMessageBox(e.GetMessage(),"Fatal error while initializing");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
catch (...) {
|
catch (...) {
|
||||||
wxMessageBox(_T("Unhandled exception"),_T("Fatal error while initializing"));
|
wxMessageBox("Unhandled exception","Fatal error while initializing");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
StartupLog(_T("Initialization complete"));
|
StartupLog("Initialization complete");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,10 +360,10 @@ static void UnhandledExeception(bool stackWalk) {
|
||||||
if (AssFile::top) {
|
if (AssFile::top) {
|
||||||
// Current filename if any.
|
// Current filename if any.
|
||||||
wxFileName file(AssFile::top->filename);
|
wxFileName file(AssFile::top->filename);
|
||||||
if (!file.HasName()) file.SetName(_T("untitled"));
|
if (!file.HasName()) file.SetName("untitled");
|
||||||
|
|
||||||
// Set path and create if it doesn't exist.
|
// Set path and create if it doesn't exist.
|
||||||
file.SetPath(StandardPaths::DecodePath(_T("?user/recovered")));
|
file.SetPath(StandardPaths::DecodePath("?user/recovered"));
|
||||||
if (!file.DirExists()) file.Mkdir();
|
if (!file.DirExists()) file.Mkdir();
|
||||||
|
|
||||||
// Save file
|
// Save file
|
||||||
|
@ -372,7 +372,7 @@ static void UnhandledExeception(bool stackWalk) {
|
||||||
|
|
||||||
#if wxUSE_STACKWALKER == 1
|
#if wxUSE_STACKWALKER == 1
|
||||||
if (stackWalk) {
|
if (stackWalk) {
|
||||||
StackWalker walker(_T("Fatal exception"));
|
StackWalker walker("Fatal exception");
|
||||||
walker.WalkFromException();
|
walker.WalkFromException();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -383,7 +383,7 @@ static void UnhandledExeception(bool stackWalk) {
|
||||||
else if (LastStartupState) {
|
else if (LastStartupState) {
|
||||||
#if wxUSE_STACKWALKER == 1
|
#if wxUSE_STACKWALKER == 1
|
||||||
if (stackWalk) {
|
if (stackWalk) {
|
||||||
StackWalker walker(_T("Fatal exception"));
|
StackWalker walker("Fatal exception");
|
||||||
walker.WalkFromException();
|
walker.WalkFromException();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -405,7 +405,7 @@ void AegisubApp::OnFatalException() {
|
||||||
|
|
||||||
|
|
||||||
void AegisubApp::HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const {
|
void AegisubApp::HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const {
|
||||||
#define SHOW_EXCEPTION(str) wxMessageBox(str, L"Exception in event handler", wxOK|wxICON_ERROR|wxSTAY_ON_TOP)
|
#define SHOW_EXCEPTION(str) wxMessageBox(str, "Exception in event handler", wxOK|wxICON_ERROR|wxSTAY_ON_TOP)
|
||||||
try {
|
try {
|
||||||
wxApp::HandleEvent(handler, func, event);
|
wxApp::HandleEvent(handler, func, event);
|
||||||
}
|
}
|
||||||
|
@ -415,9 +415,6 @@ void AegisubApp::HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEven
|
||||||
catch (const std::exception &e) {
|
catch (const std::exception &e) {
|
||||||
SHOW_EXCEPTION(wxString(e.what(), wxConvUTF8));
|
SHOW_EXCEPTION(wxString(e.what(), wxConvUTF8));
|
||||||
}
|
}
|
||||||
catch (const wchar_t *e) {
|
|
||||||
SHOW_EXCEPTION(wxString(e));
|
|
||||||
}
|
|
||||||
catch (const char *e) {
|
catch (const char *e) {
|
||||||
SHOW_EXCEPTION(wxString(e, wxConvUTF8));
|
SHOW_EXCEPTION(wxString(e, wxConvUTF8));
|
||||||
}
|
}
|
||||||
|
@ -436,7 +433,7 @@ void AegisubApp::HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEven
|
||||||
StackWalker::StackWalker(wxString cause) {
|
StackWalker::StackWalker(wxString cause) {
|
||||||
|
|
||||||
wxFileName report_dir("");
|
wxFileName report_dir("");
|
||||||
report_dir.SetPath(StandardPaths::DecodePath(_T("?user/reporter")));
|
report_dir.SetPath(StandardPaths::DecodePath("?user/reporter"));
|
||||||
if (!report_dir.DirExists()) report_dir.Mkdir();
|
if (!report_dir.DirExists()) report_dir.Mkdir();
|
||||||
|
|
||||||
crash_text = new wxFile(StandardPaths::DecodePath("?user/crashlog.txt"), wxFile::write_append);
|
crash_text = new wxFile(StandardPaths::DecodePath("?user/crashlog.txt"), wxFile::write_append);
|
||||||
|
@ -516,18 +513,18 @@ int AegisubApp::OnRun() {
|
||||||
|
|
||||||
// Catch errors
|
// Catch errors
|
||||||
catch (const wxString &err) { error = err; }
|
catch (const wxString &err) { error = err; }
|
||||||
catch (const wxChar *err) { error = err; }
|
catch (const char *err) { error = err; }
|
||||||
catch (const std::exception &e) { error = wxString(_T("std::exception: ")) + wxString(e.what(),wxConvUTF8); }
|
catch (const std::exception &e) { error = wxString("std::exception: ") + wxString(e.what(),wxConvUTF8); }
|
||||||
catch (const agi::Exception &e) { error = "agi::exception: " + lagi_wxString(e.GetChainedMessage()); }
|
catch (const agi::Exception &e) { error = "agi::exception: " + lagi_wxString(e.GetChainedMessage()); }
|
||||||
catch (...) { error = _T("Program terminated in error."); }
|
catch (...) { error = "Program terminated in error."; }
|
||||||
|
|
||||||
// Report errors
|
// Report errors
|
||||||
if (!error.IsEmpty()) {
|
if (!error.IsEmpty()) {
|
||||||
std::ofstream file;
|
std::ofstream file;
|
||||||
file.open(wxString(StandardPaths::DecodePath(_T("?user/crashlog.txt"))).mb_str(),std::ios::out | std::ios::app);
|
file.open(wxString(StandardPaths::DecodePath("?user/crashlog.txt")).mb_str(),std::ios::out | std::ios::app);
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
wxDateTime time = wxDateTime::Now();
|
wxDateTime time = wxDateTime::Now();
|
||||||
wxString timeStr = _T("---") + time.FormatISODate() + _T(" ") + time.FormatISOTime() + _T("------------------");
|
wxString timeStr = "---" + time.FormatISODate() + " " + time.FormatISOTime() + "------------------";
|
||||||
file << std::endl << timeStr.mb_str(csConvLocal);
|
file << std::endl << timeStr.mb_str(csConvLocal);
|
||||||
file << "\nVER - " << GetAegisubLongVersionString();
|
file << "\nVER - " << GetAegisubLongVersionString();
|
||||||
file << "\nEXC - Aegisub has crashed with unhandled exception \"" << error.mb_str(csConvLocal) <<"\".\n";
|
file << "\nEXC - Aegisub has crashed with unhandled exception \"" << error.mb_str(csConvLocal) <<"\".\n";
|
||||||
|
|
|
@ -88,7 +88,7 @@ void MatroskaWrapper::Open(wxString filename,bool parse) {
|
||||||
// Failed parsing
|
// Failed parsing
|
||||||
if (!file) {
|
if (!file) {
|
||||||
delete input;
|
delete input;
|
||||||
throw wxString(_T("MatroskaParser error: ") + wxString(err,wxConvUTF8)).c_str();
|
throw wxString("MatroskaParser error: " + wxString(err,wxConvUTF8)).c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse
|
// Parse
|
||||||
|
@ -98,7 +98,7 @@ void MatroskaWrapper::Open(wxString filename,bool parse) {
|
||||||
// Failed opening
|
// Failed opening
|
||||||
else {
|
else {
|
||||||
delete input;
|
delete input;
|
||||||
throw _T("Unable to open Matroska file for parsing.");
|
throw "Unable to open Matroska file for parsing.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,9 +258,9 @@ void MatroskaWrapper::GetSubtitles(AssFile *target) {
|
||||||
wxString TrackLanguage = wxString(trackInfo->Language,*wxConvCurrent);
|
wxString TrackLanguage = wxString(trackInfo->Language,*wxConvCurrent);
|
||||||
|
|
||||||
// Known subtitle format
|
// Known subtitle format
|
||||||
if (CodecID == _T("S_TEXT/SSA") || CodecID == _T("S_TEXT/ASS") || CodecID == _T("S_TEXT/UTF8")) {
|
if (CodecID == "S_TEXT/SSA" || CodecID == "S_TEXT/ASS" || CodecID == "S_TEXT/UTF8") {
|
||||||
tracksFound.Add(track);
|
tracksFound.Add(track);
|
||||||
tracksNames.Add(wxString::Format(_T("%i ("),track) + CodecID + _T(" ") + TrackLanguage + _T("): ") + TrackName);
|
tracksNames.Add(wxString::Format("%i (",track) + CodecID + " " + TrackLanguage + "): " + TrackName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ void MatroskaWrapper::GetSubtitles(AssFile *target) {
|
||||||
if (tracksFound.Count() == 0) {
|
if (tracksFound.Count() == 0) {
|
||||||
target->LoadDefault(true);
|
target->LoadDefault(true);
|
||||||
Close();
|
Close();
|
||||||
throw _T("File has no recognised subtitle tracks.");
|
throw "File has no recognised subtitle tracks.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only one track found
|
// Only one track found
|
||||||
|
@ -279,7 +279,7 @@ void MatroskaWrapper::GetSubtitles(AssFile *target) {
|
||||||
|
|
||||||
// Pick a track
|
// Pick a track
|
||||||
else {
|
else {
|
||||||
int choice = wxGetSingleChoiceIndex(_T("Choose which track to read:"),_T("Multiple subtitle tracks found"),tracksNames);
|
int choice = wxGetSingleChoiceIndex("Choose which track to read:","Multiple subtitle tracks found",tracksNames);
|
||||||
if (choice == -1) {
|
if (choice == -1) {
|
||||||
target->LoadDefault(true);
|
target->LoadDefault(true);
|
||||||
Close();
|
Close();
|
||||||
|
@ -294,7 +294,7 @@ void MatroskaWrapper::GetSubtitles(AssFile *target) {
|
||||||
trackInfo = mkv_GetTrackInfo(file,trackToRead);
|
trackInfo = mkv_GetTrackInfo(file,trackToRead);
|
||||||
wxString CodecID = wxString(trackInfo->CodecID,*wxConvCurrent);
|
wxString CodecID = wxString(trackInfo->CodecID,*wxConvCurrent);
|
||||||
int codecType = 0;
|
int codecType = 0;
|
||||||
if (CodecID == _T("S_TEXT/UTF8")) codecType = 1;
|
if (CodecID == "S_TEXT/UTF8") codecType = 1;
|
||||||
|
|
||||||
// Read private data if it's ASS/SSA
|
// Read private data if it's ASS/SSA
|
||||||
if (codecType == 0) {
|
if (codecType == 0) {
|
||||||
|
@ -308,20 +308,20 @@ void MatroskaWrapper::GetSubtitles(AssFile *target) {
|
||||||
delete[] privData;
|
delete[] privData;
|
||||||
|
|
||||||
// Load into file
|
// Load into file
|
||||||
wxString group = _T("[Script Info]");
|
wxString group = "[Script Info]";
|
||||||
int version = 1;
|
int version = 1;
|
||||||
if (CodecID == _T("S_TEXT/SSA")) version = 0;
|
if (CodecID == "S_TEXT/SSA") version = 0;
|
||||||
wxStringTokenizer token(privString,_T("\r\n"),wxTOKEN_STRTOK);
|
wxStringTokenizer token(privString,"\r\n",wxTOKEN_STRTOK);
|
||||||
while (token.HasMoreTokens()) {
|
while (token.HasMoreTokens()) {
|
||||||
wxString next = token.GetNextToken();
|
wxString next = token.GetNextToken();
|
||||||
if (next[0] == _T('[')) group = next;
|
if (next[0] == '[') group = next;
|
||||||
target->AddLine(next,group,version,&group);
|
target->AddLine(next,group,version,&group);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert "[Events]"
|
// Insert "[Events]"
|
||||||
//target->AddLine(_T(""),group,lasttime,version,&group);
|
//target->AddLine("",group,lasttime,version,&group);
|
||||||
//target->AddLine(_T("[Events]"),group,lasttime,version,&group);
|
//target->AddLine("[Events]",group,lasttime,version,&group);
|
||||||
//target->AddLine(_T("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"),group,lasttime,version,&group);
|
//target->AddLine("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text",group,lasttime,version,&group);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load default if it's SRT
|
// Load default if it's SRT
|
||||||
|
@ -368,18 +368,18 @@ void MatroskaWrapper::GetSubtitles(AssFile *target) {
|
||||||
AssTime subStart,subEnd;
|
AssTime subStart,subEnd;
|
||||||
subStart.SetMS(startTime / timecodeScaleLow);
|
subStart.SetMS(startTime / timecodeScaleLow);
|
||||||
subEnd.SetMS(endTime / timecodeScaleLow);
|
subEnd.SetMS(endTime / timecodeScaleLow);
|
||||||
//wxLogMessage(subStart.GetASSFormated() + _T("-") + subEnd.GetASSFormated() + _T(": ") + blockString);
|
//wxLogMessage(subStart.GetASSFormated() + "-" + subEnd.GetASSFormated() + ": " + blockString);
|
||||||
|
|
||||||
// Process SSA/ASS
|
// Process SSA/ASS
|
||||||
if (codecType == 0) {
|
if (codecType == 0) {
|
||||||
// Get order number
|
// Get order number
|
||||||
int pos = blockString.Find(_T(","));
|
int pos = blockString.Find(",");
|
||||||
wxString orderString = blockString.Left(pos);
|
wxString orderString = blockString.Left(pos);
|
||||||
orderString.ToLong(&order);
|
orderString.ToLong(&order);
|
||||||
blockString = blockString.Mid(pos+1);
|
blockString = blockString.Mid(pos+1);
|
||||||
|
|
||||||
// Get layer number
|
// Get layer number
|
||||||
pos = blockString.Find(_T(","));
|
pos = blockString.Find(",");
|
||||||
long int layer = 0;
|
long int layer = 0;
|
||||||
if (pos) {
|
if (pos) {
|
||||||
wxString layerString = blockString.Left(pos);
|
wxString layerString = blockString.Left(pos);
|
||||||
|
@ -388,15 +388,15 @@ void MatroskaWrapper::GetSubtitles(AssFile *target) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assemble final
|
// Assemble final
|
||||||
blockString = wxString::Format(_T("Dialogue: %i,"),layer) + subStart.GetASSFormated() + _T(",") + subEnd.GetASSFormated() + _T(",") + blockString;
|
blockString = wxString::Format("Dialogue: %i,",layer) + subStart.GetASSFormated() + "," + subEnd.GetASSFormated() + "," + blockString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process SRT
|
// Process SRT
|
||||||
else {
|
else {
|
||||||
blockString = wxString(_T("Dialogue: 0,")) + subStart.GetASSFormated() + _T(",") + subEnd.GetASSFormated() + _T(",Default,,0000,0000,0000,,") + blockString;
|
blockString = wxString("Dialogue: 0,") + subStart.GetASSFormated() + "," + subEnd.GetASSFormated() + ",Default,,0000,0000,0000,," + blockString;
|
||||||
blockString.Replace(_T("\r\n"),_T("\\N"));
|
blockString.Replace("\r\n","\\N");
|
||||||
blockString.Replace(_T("\r"),_T("\\N"));
|
blockString.Replace("\r","\\N");
|
||||||
blockString.Replace(_T("\n"),_T("\\N"));
|
blockString.Replace("\n","\\N");
|
||||||
order++;
|
order++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,8 +412,8 @@ void MatroskaWrapper::GetSubtitles(AssFile *target) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert into file
|
// Insert into file
|
||||||
wxString group = _T("[Events]");
|
wxString group = "[Events]";
|
||||||
int version = (CodecID == _T("S_TEXT/SSA"));
|
int version = (CodecID == "S_TEXT/SSA");
|
||||||
for (unsigned int i=0;i<subList.size();i++) {
|
for (unsigned int i=0;i<subList.size();i++) {
|
||||||
target->AddLine(subList[i],group,version,&group);
|
target->AddLine(subList[i],group,version,&group);
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ bool MatroskaWrapper::HasSubtitles(wxString const& filename) {
|
||||||
|
|
||||||
if (trackInfo->Type == 0x11) {
|
if (trackInfo->Type == 0x11) {
|
||||||
wxString CodecID = wxString(trackInfo->CodecID, *wxConvCurrent);
|
wxString CodecID = wxString(trackInfo->CodecID, *wxConvCurrent);
|
||||||
if (CodecID == _T("S_TEXT/SSA") || CodecID == _T("S_TEXT/ASS") || CodecID == _T("S_TEXT/UTF8")) {
|
if (CodecID == "S_TEXT/SSA" || CodecID == "S_TEXT/ASS" || CodecID == "S_TEXT/UTF8") {
|
||||||
mkv_Close(file);
|
mkv_Close(file);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ Video::Video(wxTreebook *book, Preferences *parent): OptionPage(book, parent, _(
|
||||||
wxArrayString choice_res(3, cres_arr);
|
wxArrayString choice_res(3, cres_arr);
|
||||||
OptionChoice(general, _("Match video resolution on open"), choice_res, "Video/Check Script Res");
|
OptionChoice(general, _("Match video resolution on open"), choice_res, "Video/Check Script Res");
|
||||||
|
|
||||||
const wxString czoom_arr[24] = { _T("12.5%"), _T("25%"), _T("37.5%"), _T("50%"), _T("62.5%"), _T("75%"), _T("87.5%"), _T("100%"), _T("112.5%"), _T("125%"), _T("137.5%"), _T("150%"), _T("162.5%"), _T("175%"), _T("187.5%"), _T("200%"), _T("212.5%"), _T("225%"), _T("237.5%"), _T("250%"), _T("262.5%"), _T("275%"), _T("287.5%"), _T("300%") };
|
const wxString czoom_arr[24] = { "12.5%", "25%", "37.5%", "50%", "62.5%", "75%", "87.5%", "100%", "112.5%", "125%", "137.5%", "150%", "162.5%", "175%", "187.5%", "200%", "212.5%", "225%", "237.5%", "250%", "262.5%", "275%", "287.5%", "300%" };
|
||||||
wxArrayString choice_zoom(24, czoom_arr);
|
wxArrayString choice_zoom(24, czoom_arr);
|
||||||
OptionChoice(general, _("Default Zoom"), choice_zoom, "Video/Default Zoom");
|
OptionChoice(general, _("Default Zoom"), choice_zoom, "Video/Default Zoom");
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ Interface_Hotkeys::Interface_Hotkeys(wxTreebook *book, Preferences *parent): Opt
|
||||||
Paths::Paths(wxTreebook *book, Preferences *parent): OptionPage(book, parent, _("Paths")) {
|
Paths::Paths(wxTreebook *book, Preferences *parent): OptionPage(book, parent, _("Paths")) {
|
||||||
|
|
||||||
wxFlexGridSizer *general = PageSizer(_("General"));
|
wxFlexGridSizer *general = PageSizer(_("General"));
|
||||||
general->Add(new wxStaticText(this, wxID_ANY, _T("TBD..")), 0, wxALL, 5);
|
general->Add(new wxStaticText(this, wxID_ANY, "TBD.."), 0, wxALL, 5);
|
||||||
|
|
||||||
SetSizerAndFit(sizer);
|
SetSizerAndFit(sizer);
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ Paths::Paths(wxTreebook *book, Preferences *parent): OptionPage(book, parent, _(
|
||||||
File_Associations::File_Associations(wxTreebook *book, Preferences *parent): OptionPage(book, parent, _("File Associations")) {
|
File_Associations::File_Associations(wxTreebook *book, Preferences *parent): OptionPage(book, parent, _("File Associations")) {
|
||||||
|
|
||||||
wxFlexGridSizer *assoc = PageSizer(_("General"));
|
wxFlexGridSizer *assoc = PageSizer(_("General"));
|
||||||
assoc->Add(new wxStaticText(this, wxID_ANY, _T("TBD..")), 0, wxALL, 5);
|
assoc->Add(new wxStaticText(this, wxID_ANY, "TBD.."), 0, wxALL, 5);
|
||||||
|
|
||||||
SetSizerAndFit(sizer);
|
SetSizerAndFit(sizer);
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ Advanced::Advanced(wxTreebook *book, Preferences *parent): OptionPage(book, pare
|
||||||
Advanced_Interface::Advanced_Interface(wxTreebook *book, Preferences *parent): OptionPage(book, parent, _("Backup"), PAGE_SUB) {
|
Advanced_Interface::Advanced_Interface(wxTreebook *book, Preferences *parent): OptionPage(book, parent, _("Backup"), PAGE_SUB) {
|
||||||
wxFlexGridSizer *interface_ = PageSizer(_("Interface"));
|
wxFlexGridSizer *interface_ = PageSizer(_("Interface"));
|
||||||
|
|
||||||
interface_->Add(new wxStaticText(this, wxID_ANY, _T("TBD..")), 0, wxALL, 5);
|
interface_->Add(new wxStaticText(this, wxID_ANY, "TBD.."), 0, wxALL, 5);
|
||||||
|
|
||||||
SetSizerAndFit(sizer);
|
SetSizerAndFit(sizer);
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ Advanced_Audio::Advanced_Audio(wxTreebook *book, Preferences *parent): OptionPag
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_DEBUG)
|
#if defined(WIN32) || defined(_DEBUG)
|
||||||
wxFlexGridSizer *windows = PageSizer(_("Windows Specific"));
|
wxFlexGridSizer *windows = PageSizer(_("Windows Specific"));
|
||||||
const wxString adm_arr[3] = { _T("ConvertToMono"), _T("GetLeftChannel"), _T("GetRightChannel") };
|
const wxString adm_arr[3] = { "ConvertToMono", "GetLeftChannel", "GetRightChannel" };
|
||||||
wxArrayString adm_choice(3, adm_arr);
|
wxArrayString adm_choice(3, adm_arr);
|
||||||
OptionChoice(windows, _("Avisynth down-mixer"), adm_choice, "Audio/Downmixer");
|
OptionChoice(windows, _("Avisynth down-mixer"), adm_choice, "Audio/Downmixer");
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -59,9 +59,9 @@ SpellChecker *SpellCheckerFactory::GetSpellChecker() {
|
||||||
SpellChecker *checker = Create(list[i]);
|
SpellChecker *checker = Create(list[i]);
|
||||||
if (checker) return checker;
|
if (checker) return checker;
|
||||||
}
|
}
|
||||||
catch (wxString err) { error += list[i] + _T(" factory: ") + err + _T("\n"); }
|
catch (wxString err) { error += list[i] + " factory: " + err + "\n"; }
|
||||||
catch (const wxChar *err) { error += list[i] + _T(" factory: ") + wxString(err) + _T("\n"); }
|
catch (const char *err) { error += list[i] + " factory: " + wxString(err) + "\n"; }
|
||||||
catch (...) { error += list[i] + _T(" factory: Unknown error\n"); }
|
catch (...) { error += list[i] + " factory: Unknown error\n"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Failed
|
// Failed
|
||||||
|
|
|
@ -61,29 +61,29 @@ wxString Spline::EncodeToASS() {
|
||||||
switch (cur->type) {
|
switch (cur->type) {
|
||||||
case CURVE_POINT: {
|
case CURVE_POINT: {
|
||||||
if (lastCommand != 'm') {
|
if (lastCommand != 'm') {
|
||||||
result += L"m ";
|
result += "m ";
|
||||||
lastCommand = 'm';
|
lastCommand = 'm';
|
||||||
}
|
}
|
||||||
int x = cur->p1.x;
|
int x = cur->p1.x;
|
||||||
int y = cur->p1.y;
|
int y = cur->p1.y;
|
||||||
scale.ToScriptCoords(&x, &y);
|
scale.ToScriptCoords(&x, &y);
|
||||||
result += wxString::Format(L"%i %i ", x, y);
|
result += wxString::Format("%i %i ", x, y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CURVE_LINE: {
|
case CURVE_LINE: {
|
||||||
if (lastCommand != 'l') {
|
if (lastCommand != 'l') {
|
||||||
result += L"l ";
|
result += "l ";
|
||||||
lastCommand = 'l';
|
lastCommand = 'l';
|
||||||
}
|
}
|
||||||
int x = cur->p2.x;
|
int x = cur->p2.x;
|
||||||
int y = cur->p2.y;
|
int y = cur->p2.y;
|
||||||
scale.ToScriptCoords(&x, &y);
|
scale.ToScriptCoords(&x, &y);
|
||||||
result += wxString::Format(L"%i %i ", x, y);
|
result += wxString::Format("%i %i ", x, y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CURVE_BICUBIC: {
|
case CURVE_BICUBIC: {
|
||||||
if (lastCommand != 'b') {
|
if (lastCommand != 'b') {
|
||||||
result += L"b ";
|
result += "b ";
|
||||||
lastCommand = 'b';
|
lastCommand = 'b';
|
||||||
}
|
}
|
||||||
int x2 = cur->p2.x;
|
int x2 = cur->p2.x;
|
||||||
|
@ -95,7 +95,7 @@ wxString Spline::EncodeToASS() {
|
||||||
scale.ToScriptCoords(&x2, &y2);
|
scale.ToScriptCoords(&x2, &y2);
|
||||||
scale.ToScriptCoords(&x3, &y3);
|
scale.ToScriptCoords(&x3, &y3);
|
||||||
scale.ToScriptCoords(&x4, &y4);
|
scale.ToScriptCoords(&x4, &y4);
|
||||||
result += wxString::Format(L"%i %i %i %i %i %i ", x2, y2, x3, y3, x4, y4);
|
result += wxString::Format("%i %i %i %i %i %i ", x2, y2, x3, y3, x4, y4);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: break;
|
default: break;
|
||||||
|
@ -117,7 +117,7 @@ void Spline::DecodeFromASS(wxString str) {
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
|
||||||
// Tokenize the string
|
// Tokenize the string
|
||||||
wxStringTokenizer tkn(str,L" ");
|
wxStringTokenizer tkn(str," ");
|
||||||
while (tkn.HasMoreTokens()) {
|
while (tkn.HasMoreTokens()) {
|
||||||
wxString token = tkn.GetNextToken();
|
wxString token = tkn.GetNextToken();
|
||||||
|
|
||||||
|
@ -180,12 +180,12 @@ void Spline::DecodeFromASS(wxString str) {
|
||||||
|
|
||||||
// Got something else
|
// Got something else
|
||||||
else {
|
else {
|
||||||
if (token == L"m") lastCommand = 'm';
|
if (token == "m") lastCommand = 'm';
|
||||||
else if (token == L"l") lastCommand = 'l';
|
else if (token == "l") lastCommand = 'l';
|
||||||
else if (token == L"b") lastCommand = 'b';
|
else if (token == "b") lastCommand = 'b';
|
||||||
else if (token == L"n") lastCommand = 'n';
|
else if (token == "n") lastCommand = 'n';
|
||||||
else if (token == L"s") lastCommand = 's';
|
else if (token == "s") lastCommand = 's';
|
||||||
else if (token == L"c") lastCommand = 'c';
|
else if (token == "c") lastCommand = 'c';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,20 +74,20 @@ StandardPaths::StandardPaths() {
|
||||||
wxString userDir = paths.GetUserDataDir();
|
wxString userDir = paths.GetUserDataDir();
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
wxString dataDir = paths.GetDataDir();
|
wxString dataDir = paths.GetDataDir();
|
||||||
wxString userDir = paths.GetUserDataDir() + _T("-") + _T(AEGISUB_VERSION_DATA);
|
wxString userDir = paths.GetUserDataDir() + "-" + AEGISUB_VERSION_DATA;
|
||||||
#else
|
#else
|
||||||
wxString dataDir = paths.GetDataDir() + _T("/") + _T(AEGISUB_VERSION_DATA);
|
wxString dataDir = paths.GetDataDir() + "/" + AEGISUB_VERSION_DATA;
|
||||||
wxString userDir = paths.GetUserConfigDir() + _T("/.aegisub-") + _T(AEGISUB_VERSION_DATA);
|
wxString userDir = paths.GetUserConfigDir() + "/.aegisub-" + AEGISUB_VERSION_DATA;
|
||||||
#endif
|
#endif
|
||||||
wxString tempDir = paths.GetTempDir();
|
wxString tempDir = paths.GetTempDir();
|
||||||
|
|
||||||
// Set paths
|
// Set paths
|
||||||
DoSetPathValue(_T("?data"),dataDir);
|
DoSetPathValue("?data",dataDir);
|
||||||
DoSetPathValue(_T("?user"),userDir);
|
DoSetPathValue("?user",userDir);
|
||||||
DoSetPathValue(_T("?temp"),tempDir);
|
DoSetPathValue("?temp",tempDir);
|
||||||
|
|
||||||
// Create paths if they don't exist
|
// Create paths if they don't exist
|
||||||
wxFileName folder(userDir + _T("/"));
|
wxFileName folder(userDir + "/");
|
||||||
if (!folder.DirExists()) folder.Mkdir(0777,wxPATH_MKDIR_FULL);
|
if (!folder.DirExists()) folder.Mkdir(0777,wxPATH_MKDIR_FULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,10 +99,10 @@ StandardPaths::StandardPaths() {
|
||||||
///
|
///
|
||||||
wxString StandardPaths::DoDecodePath(wxString path) {
|
wxString StandardPaths::DoDecodePath(wxString path) {
|
||||||
// Decode
|
// Decode
|
||||||
if (path[0] == _T('?')) {
|
if (path[0] == '?') {
|
||||||
// Split ?part from rest
|
// Split ?part from rest
|
||||||
path.Replace(_T("\\"),_T("/"));
|
path.Replace("\\","/");
|
||||||
int pos = path.Find(_T("/"));
|
int pos = path.Find("/");
|
||||||
wxString path1,path2;
|
wxString path1,path2;
|
||||||
if (pos == wxNOT_FOUND) path1 = path;
|
if (pos == wxNOT_FOUND) path1 = path;
|
||||||
else {
|
else {
|
||||||
|
@ -113,10 +113,10 @@ wxString StandardPaths::DoDecodePath(wxString path) {
|
||||||
// Replace ?part if valid
|
// Replace ?part if valid
|
||||||
std::map<wxString,wxString>::iterator iter = paths.find(path1);
|
std::map<wxString,wxString>::iterator iter = paths.find(path1);
|
||||||
if (iter == paths.end()) return path;
|
if (iter == paths.end()) return path;
|
||||||
wxString final = iter->second + _T("/") + path2;
|
wxString final = iter->second + "/" + path2;
|
||||||
final.Replace(_T("//"),_T("/"));
|
final.Replace("//","/");
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
final.Replace(_T("/"),_T("\\"));
|
final.Replace("/","\\");
|
||||||
#endif
|
#endif
|
||||||
return final;
|
return final;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ void StandardPaths::DoSetPathValue(const wxString &path, const wxString &value)
|
||||||
wxString StandardPaths::DecodePathMaybeRelative(const wxString &path, const wxString &relativeTo) {
|
wxString StandardPaths::DecodePathMaybeRelative(const wxString &path, const wxString &relativeTo) {
|
||||||
wxFileName res(DecodePath(path));
|
wxFileName res(DecodePath(path));
|
||||||
if (res.IsRelative())
|
if (res.IsRelative())
|
||||||
res.Assign(DecodePath(relativeTo + _T("/") + path));
|
res.Assign(DecodePath(relativeTo + "/" + path));
|
||||||
return res.GetFullPath();
|
return res.GetFullPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,12 @@
|
||||||
wxString inline_string_encode(const wxString &input)
|
wxString inline_string_encode(const wxString &input)
|
||||||
{
|
{
|
||||||
const size_t inlen = input.length();
|
const size_t inlen = input.length();
|
||||||
wxString output(_T(""));
|
wxString output("");
|
||||||
output.Alloc(inlen);
|
output.Alloc(inlen);
|
||||||
for (size_t i = 0; i < inlen; i++) {
|
for (size_t i = 0; i < inlen; i++) {
|
||||||
wxChar c = input[i];
|
wxChar c = input[i];
|
||||||
if (c <= 0x1F || c == 0x23 || c == 0x2C || c == 0x3A || c == 0x7C) {
|
if (c <= 0x1F || c == 0x23 || c == 0x2C || c == 0x3A || c == 0x7C) {
|
||||||
output << wxString::Format(_T("#%02X"), c);
|
output << wxString::Format("#%02X", c);
|
||||||
} else {
|
} else {
|
||||||
output << c;
|
output << c;
|
||||||
}
|
}
|
||||||
|
@ -68,11 +68,11 @@ wxString inline_string_encode(const wxString &input)
|
||||||
wxString inline_string_decode(const wxString &input)
|
wxString inline_string_decode(const wxString &input)
|
||||||
{
|
{
|
||||||
const size_t inlen = input.length();
|
const size_t inlen = input.length();
|
||||||
wxString output(_T(""));
|
wxString output("");
|
||||||
output.Alloc(inlen);
|
output.Alloc(inlen);
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
while (i < inlen) {
|
while (i < inlen) {
|
||||||
if (input[i] == _T('#')) {
|
if (input[i] == '#') {
|
||||||
// check if there's actually enough extra characters at the end of the string
|
// check if there's actually enough extra characters at the end of the string
|
||||||
if (inlen - i < 3)
|
if (inlen - i < 3)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -170,10 +170,10 @@ SubsEditBox::SubsEditBox(wxWindow *parent, agi::Context *context)
|
||||||
{
|
{
|
||||||
// Top controls
|
// Top controls
|
||||||
wxArrayString styles;
|
wxArrayString styles;
|
||||||
styles.Add(_T("Default"));
|
styles.Add("Default");
|
||||||
CommentBox = new wxCheckBox(this,wxID_ANY,_("Comment"));
|
CommentBox = new wxCheckBox(this,wxID_ANY,_("Comment"));
|
||||||
StyleBox = new wxComboBox(this,wxID_ANY,_T("Default"),wxDefaultPosition,wxSize(110,-1),styles,wxCB_READONLY | wxTE_PROCESS_ENTER);
|
StyleBox = new wxComboBox(this,wxID_ANY,"Default",wxDefaultPosition,wxSize(110,-1),styles,wxCB_READONLY | wxTE_PROCESS_ENTER);
|
||||||
ActorBox = new wxComboBox(this,wxID_ANY,_T("Actor"),wxDefaultPosition,wxSize(110,-1),styles,wxCB_DROPDOWN | wxTE_PROCESS_ENTER);
|
ActorBox = new wxComboBox(this,wxID_ANY,"Actor",wxDefaultPosition,wxSize(110,-1),styles,wxCB_DROPDOWN | wxTE_PROCESS_ENTER);
|
||||||
Effect = new wxTextCtrl(this,wxID_ANY,"",wxDefaultPosition,wxSize(80,-1),wxTE_PROCESS_ENTER);
|
Effect = new wxTextCtrl(this,wxID_ANY,"",wxDefaultPosition,wxSize(80,-1),wxTE_PROCESS_ENTER);
|
||||||
|
|
||||||
// Middle controls
|
// Middle controls
|
||||||
|
@ -284,12 +284,12 @@ SubsEditBox::SubsEditBox(wxWindow *parent, agi::Context *context)
|
||||||
(text.Blue() + origBgColour.Blue()) / 2);
|
(text.Blue() + origBgColour.Blue()) / 2);
|
||||||
|
|
||||||
// Setup placeholders for effect and actor boxes
|
// Setup placeholders for effect and actor boxes
|
||||||
bind_focus_handler(Effect, wxEVT_SET_FOCUS, "", L"Effect", text);
|
bind_focus_handler(Effect, wxEVT_SET_FOCUS, "", "Effect", text);
|
||||||
bind_focus_handler(Effect, wxEVT_KILL_FOCUS, L"Effect", "", grey);
|
bind_focus_handler(Effect, wxEVT_KILL_FOCUS, "Effect", "", grey);
|
||||||
Effect->SetForegroundColour(grey);
|
Effect->SetForegroundColour(grey);
|
||||||
|
|
||||||
bind_focus_handler(ActorBox, wxEVT_SET_FOCUS, "", L"Actor", text);
|
bind_focus_handler(ActorBox, wxEVT_SET_FOCUS, "", "Actor", text);
|
||||||
bind_focus_handler(ActorBox, wxEVT_KILL_FOCUS, L"Actor", "", grey);
|
bind_focus_handler(ActorBox, wxEVT_KILL_FOCUS, "Actor", "", grey);
|
||||||
ActorBox->SetForegroundColour(grey);
|
ActorBox->SetForegroundColour(grey);
|
||||||
|
|
||||||
TextEdit->Bind(wxEVT_STC_STYLENEEDED, &SubsEditBox::OnNeedStyle, this);
|
TextEdit->Bind(wxEVT_STC_STYLENEEDED, &SubsEditBox::OnNeedStyle, this);
|
||||||
|
@ -387,10 +387,10 @@ void SubsEditBox::Update(int type) {
|
||||||
MarginL->ChangeValue(line->GetMarginString(0,false));
|
MarginL->ChangeValue(line->GetMarginString(0,false));
|
||||||
MarginR->ChangeValue(line->GetMarginString(1,false));
|
MarginR->ChangeValue(line->GetMarginString(1,false));
|
||||||
MarginV->ChangeValue(line->GetMarginString(2,false));
|
MarginV->ChangeValue(line->GetMarginString(2,false));
|
||||||
Effect->ChangeValue(line->Effect.empty() ? L"Effect" : line->Effect);
|
Effect->ChangeValue(line->Effect.empty() ? "Effect" : line->Effect);
|
||||||
CommentBox->SetValue(line->Comment);
|
CommentBox->SetValue(line->Comment);
|
||||||
StyleBox->Select(StyleBox->FindString(line->Style));
|
StyleBox->Select(StyleBox->FindString(line->Style));
|
||||||
ActorBox->ChangeValue(line->Actor.empty() ? L"Actor" : line->Actor);
|
ActorBox->ChangeValue(line->Actor.empty() ? "Actor" : line->Actor);
|
||||||
ActorBox->SetStringSelection(line->Actor);
|
ActorBox->SetStringSelection(line->Actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -716,7 +716,7 @@ void SubsEditBox::SetTag(wxString tag, wxString value, bool atEnd) {
|
||||||
}
|
}
|
||||||
else if (ovr) {
|
else if (ovr) {
|
||||||
wxString alt;
|
wxString alt;
|
||||||
if (tag == L"\\c") alt = L"\\1c";
|
if (tag == "\\c") alt = "\\1c";
|
||||||
// Remove old of same
|
// Remove old of same
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (size_t i = 0; i < ovr->Tags.size(); i++) {
|
for (size_t i = 0; i < ovr->Tags.size(); i++) {
|
||||||
|
@ -756,22 +756,22 @@ void SubsEditBox::OnFlagButton(wxCommandEvent &evt) {
|
||||||
AssStyle defStyle;
|
AssStyle defStyle;
|
||||||
if (!style) style = &defStyle;
|
if (!style) style = &defStyle;
|
||||||
if (id == BUTTON_BOLD) {
|
if (id == BUTTON_BOLD) {
|
||||||
tagname = L"\\b";
|
tagname = "\\b";
|
||||||
desc = _("toggle bold");
|
desc = _("toggle bold");
|
||||||
state = style->bold;
|
state = style->bold;
|
||||||
}
|
}
|
||||||
else if (id == BUTTON_ITALICS) {
|
else if (id == BUTTON_ITALICS) {
|
||||||
tagname = L"\\i";
|
tagname = "\\i";
|
||||||
desc = _("toggle italic");
|
desc = _("toggle italic");
|
||||||
state = style->italic;
|
state = style->italic;
|
||||||
}
|
}
|
||||||
else if (id == BUTTON_UNDERLINE) {
|
else if (id == BUTTON_UNDERLINE) {
|
||||||
tagname = L"\\u";
|
tagname = "\\u";
|
||||||
desc = _("toggle underline");
|
desc = _("toggle underline");
|
||||||
state = style->underline;
|
state = style->underline;
|
||||||
}
|
}
|
||||||
else if (id == BUTTON_STRIKEOUT) {
|
else if (id == BUTTON_STRIKEOUT) {
|
||||||
tagname = L"\\s";
|
tagname = "\\s";
|
||||||
desc = _("toggle strikeout");
|
desc = _("toggle strikeout");
|
||||||
state = style->strikeout;
|
state = style->strikeout;
|
||||||
}
|
}
|
||||||
|
@ -807,11 +807,11 @@ void SubsEditBox::OnFontButton(wxCommandEvent &) {
|
||||||
AssStyle defStyle;
|
AssStyle defStyle;
|
||||||
if (!style) style = &defStyle;
|
if (!style) style = &defStyle;
|
||||||
|
|
||||||
startfont.SetFaceName(get_value(*line, blockn, style->font, L"\\fn"));
|
startfont.SetFaceName(get_value(*line, blockn, style->font, "\\fn"));
|
||||||
startfont.SetPointSize(get_value(*line, blockn, (int)style->fontsize, L"\\fs"));
|
startfont.SetPointSize(get_value(*line, blockn, (int)style->fontsize, "\\fs"));
|
||||||
startfont.SetWeight(get_value(*line, blockn, style->bold, L"\\b") ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL);
|
startfont.SetWeight(get_value(*line, blockn, style->bold, "\\b") ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL);
|
||||||
startfont.SetStyle(get_value(*line, blockn, style->italic, L"\\i") ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL);
|
startfont.SetStyle(get_value(*line, blockn, style->italic, "\\i") ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL);
|
||||||
startfont.SetUnderlined(get_value(*line, blockn, style->underline, L"\\u"));
|
startfont.SetUnderlined(get_value(*line, blockn, style->underline, "\\u"));
|
||||||
|
|
||||||
wxFont font = wxGetFontFromUser(this, startfont);
|
wxFont font = wxGetFontFromUser(this, startfont);
|
||||||
if (!font.Ok() || font == startfont) {
|
if (!font.Ok() || font == startfont) {
|
||||||
|
@ -820,19 +820,19 @@ void SubsEditBox::OnFontButton(wxCommandEvent &) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font.GetFaceName() != startfont.GetFaceName()) {
|
if (font.GetFaceName() != startfont.GetFaceName()) {
|
||||||
SetTag(L"\\fn", font.GetFaceName());
|
SetTag("\\fn", font.GetFaceName());
|
||||||
}
|
}
|
||||||
if (font.GetPointSize() != startfont.GetPointSize()) {
|
if (font.GetPointSize() != startfont.GetPointSize()) {
|
||||||
SetTag(L"\\fs", wxString::Format("%i", font.GetPointSize()));
|
SetTag("\\fs", wxString::Format("%i", font.GetPointSize()));
|
||||||
}
|
}
|
||||||
if (font.GetWeight() != startfont.GetWeight()) {
|
if (font.GetWeight() != startfont.GetWeight()) {
|
||||||
SetTag(L"\\b", wxString::Format("%i", font.GetWeight() == wxFONTWEIGHT_BOLD));
|
SetTag("\\b", wxString::Format("%i", font.GetWeight() == wxFONTWEIGHT_BOLD));
|
||||||
}
|
}
|
||||||
if (font.GetStyle() != startfont.GetStyle()) {
|
if (font.GetStyle() != startfont.GetStyle()) {
|
||||||
SetTag(L"\\i", wxString::Format("%i", font.GetStyle() == wxFONTSTYLE_ITALIC));
|
SetTag("\\i", wxString::Format("%i", font.GetStyle() == wxFONTSTYLE_ITALIC));
|
||||||
}
|
}
|
||||||
if (font.GetUnderlined() != startfont.GetUnderlined()) {
|
if (font.GetUnderlined() != startfont.GetUnderlined()) {
|
||||||
SetTag(L"\\i", wxString::Format("%i", font.GetUnderlined()));
|
SetTag("\\i", wxString::Format("%i", font.GetUnderlined()));
|
||||||
}
|
}
|
||||||
line->ClearBlocks();
|
line->ClearBlocks();
|
||||||
commitId = -1;
|
commitId = -1;
|
||||||
|
@ -849,20 +849,20 @@ void SubsEditBox::OnColorButton(wxCommandEvent &evt) {
|
||||||
if (!style) style = &defStyle;
|
if (!style) style = &defStyle;
|
||||||
if (id == BUTTON_COLOR1) {
|
if (id == BUTTON_COLOR1) {
|
||||||
color = style->primary.GetWXColor();
|
color = style->primary.GetWXColor();
|
||||||
colorTag = L"\\c";
|
colorTag = "\\c";
|
||||||
alt = L"\\c1";
|
alt = "\\c1";
|
||||||
}
|
}
|
||||||
else if (id == BUTTON_COLOR2) {
|
else if (id == BUTTON_COLOR2) {
|
||||||
color = style->secondary.GetWXColor();
|
color = style->secondary.GetWXColor();
|
||||||
colorTag = L"\\2c";
|
colorTag = "\\2c";
|
||||||
}
|
}
|
||||||
else if (id == BUTTON_COLOR3) {
|
else if (id == BUTTON_COLOR3) {
|
||||||
color = style->outline.GetWXColor();
|
color = style->outline.GetWXColor();
|
||||||
colorTag = L"\\3c";
|
colorTag = "\\3c";
|
||||||
}
|
}
|
||||||
else if (id == BUTTON_COLOR4) {
|
else if (id == BUTTON_COLOR4) {
|
||||||
color = style->shadow.GetWXColor();
|
color = style->shadow.GetWXColor();
|
||||||
colorTag = L"\\4c";
|
colorTag = "\\4c";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -113,65 +113,65 @@ SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxSize wsize, long style, S
|
||||||
|
|
||||||
// Prototypes for call tips
|
// Prototypes for call tips
|
||||||
tipProtoN = -1;
|
tipProtoN = -1;
|
||||||
proto.Add(L"move(x1,y1,x2,y2)");
|
proto.Add("move(x1,y1,x2,y2)");
|
||||||
proto.Add(L"move(x1,y1,x2,y2,startTime,endTime)");
|
proto.Add("move(x1,y1,x2,y2,startTime,endTime)");
|
||||||
proto.Add(L"fn;FontName");
|
proto.Add("fn;FontName");
|
||||||
proto.Add(L"bord;Width");
|
proto.Add("bord;Width");
|
||||||
proto.Add(L"xbord;Width");
|
proto.Add("xbord;Width");
|
||||||
proto.Add(L"ybord;Width");
|
proto.Add("ybord;Width");
|
||||||
proto.Add(L"shad;Depth");
|
proto.Add("shad;Depth");
|
||||||
proto.Add(L"xshad;Depth");
|
proto.Add("xshad;Depth");
|
||||||
proto.Add(L"yshad;Depth");
|
proto.Add("yshad;Depth");
|
||||||
proto.Add(L"be;Strength");
|
proto.Add("be;Strength");
|
||||||
proto.Add(L"blur;Strength");
|
proto.Add("blur;Strength");
|
||||||
proto.Add(L"fscx;Scale");
|
proto.Add("fscx;Scale");
|
||||||
proto.Add(L"fscy;Scale");
|
proto.Add("fscy;Scale");
|
||||||
proto.Add(L"fsp;Spacing");
|
proto.Add("fsp;Spacing");
|
||||||
proto.Add(L"fs;FontSize");
|
proto.Add("fs;FontSize");
|
||||||
proto.Add(L"fe;Encoding");
|
proto.Add("fe;Encoding");
|
||||||
proto.Add(L"frx;Angle");
|
proto.Add("frx;Angle");
|
||||||
proto.Add(L"fry;Angle");
|
proto.Add("fry;Angle");
|
||||||
proto.Add(L"frz;Angle");
|
proto.Add("frz;Angle");
|
||||||
proto.Add(L"fr;Angle");
|
proto.Add("fr;Angle");
|
||||||
proto.Add(L"pbo;Offset");
|
proto.Add("pbo;Offset");
|
||||||
proto.Add(L"clip(command)");
|
proto.Add("clip(command)");
|
||||||
proto.Add(L"clip(scale,command)");
|
proto.Add("clip(scale,command)");
|
||||||
proto.Add(L"clip(x1,y1,x2,y2)");
|
proto.Add("clip(x1,y1,x2,y2)");
|
||||||
proto.Add(L"iclip(command)");
|
proto.Add("iclip(command)");
|
||||||
proto.Add(L"iclip(scale,command)");
|
proto.Add("iclip(scale,command)");
|
||||||
proto.Add(L"iclip(x1,y1,x2,y2)");
|
proto.Add("iclip(x1,y1,x2,y2)");
|
||||||
proto.Add(L"t(acceleration,tags)");
|
proto.Add("t(acceleration,tags)");
|
||||||
proto.Add(L"t(startTime,endTime,tags)");
|
proto.Add("t(startTime,endTime,tags)");
|
||||||
proto.Add(L"t(startTime,endTime,acceleration,tags)");
|
proto.Add("t(startTime,endTime,acceleration,tags)");
|
||||||
proto.Add(L"pos(x,y)");
|
proto.Add("pos(x,y)");
|
||||||
proto.Add(L"p;Exponent");
|
proto.Add("p;Exponent");
|
||||||
proto.Add(L"org(x,y)");
|
proto.Add("org(x,y)");
|
||||||
proto.Add(L"fade(startAlpha,middleAlpha,endAlpha,startIn,endIn,startOut,endOut)");
|
proto.Add("fade(startAlpha,middleAlpha,endAlpha,startIn,endIn,startOut,endOut)");
|
||||||
proto.Add(L"fad(startTime,endTime)");
|
proto.Add("fad(startTime,endTime)");
|
||||||
proto.Add(L"c;Colour");
|
proto.Add("c;Colour");
|
||||||
proto.Add(L"1c;Colour");
|
proto.Add("1c;Colour");
|
||||||
proto.Add(L"2c;Colour");
|
proto.Add("2c;Colour");
|
||||||
proto.Add(L"3c;Colour");
|
proto.Add("3c;Colour");
|
||||||
proto.Add(L"4c;Colour");
|
proto.Add("4c;Colour");
|
||||||
proto.Add(L"alpha;Alpha");
|
proto.Add("alpha;Alpha");
|
||||||
proto.Add(L"1a;Alpha");
|
proto.Add("1a;Alpha");
|
||||||
proto.Add(L"2a;Alpha");
|
proto.Add("2a;Alpha");
|
||||||
proto.Add(L"3a;Alpha");
|
proto.Add("3a;Alpha");
|
||||||
proto.Add(L"4a;Alpha");
|
proto.Add("4a;Alpha");
|
||||||
proto.Add(L"an;Alignment");
|
proto.Add("an;Alignment");
|
||||||
proto.Add(L"a;Alignment");
|
proto.Add("a;Alignment");
|
||||||
proto.Add(L"b;Weight");
|
proto.Add("b;Weight");
|
||||||
proto.Add(L"i;1/0");
|
proto.Add("i;1/0");
|
||||||
proto.Add(L"u;1/0");
|
proto.Add("u;1/0");
|
||||||
proto.Add(L"s;1/0");
|
proto.Add("s;1/0");
|
||||||
proto.Add(L"kf;Duration");
|
proto.Add("kf;Duration");
|
||||||
proto.Add(L"ko;Duration");
|
proto.Add("ko;Duration");
|
||||||
proto.Add(L"k;Duration");
|
proto.Add("k;Duration");
|
||||||
proto.Add(L"K;Duration");
|
proto.Add("K;Duration");
|
||||||
proto.Add(L"q;WrapStyle");
|
proto.Add("q;WrapStyle");
|
||||||
proto.Add(L"r;Style");
|
proto.Add("r;Style");
|
||||||
proto.Add(L"fax;Factor");
|
proto.Add("fax;Factor");
|
||||||
proto.Add(L"fay;Factor");
|
proto.Add("fay;Factor");
|
||||||
|
|
||||||
using namespace std::tr1;
|
using namespace std::tr1;
|
||||||
|
|
||||||
|
@ -289,8 +289,8 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) {
|
||||||
|
|
||||||
// Check if it's a template line
|
// Check if it's a template line
|
||||||
AssDialogue *diag = grid->GetActiveLine();
|
AssDialogue *diag = grid->GetActiveLine();
|
||||||
bool templateLine = diag && diag->Comment && diag->Effect.Lower().StartsWith(_T("template"));
|
bool templateLine = diag && diag->Comment && diag->Effect.Lower().StartsWith("template");
|
||||||
//bool templateCodeLine = diag && diag->Comment && diag->Effect.Lower().StartsWith(_T("code"));
|
//bool templateCodeLine = diag && diag->Comment && diag->Effect.Lower().StartsWith("code");
|
||||||
|
|
||||||
// Template code lines get Lua highlighting instead of ASS highlighting
|
// Template code lines get Lua highlighting instead of ASS highlighting
|
||||||
// This is broken and needs some extra work
|
// This is broken and needs some extra work
|
||||||
|
@ -400,7 +400,7 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) {
|
||||||
numMode = false;
|
numMode = false;
|
||||||
|
|
||||||
// Is \n, \N or \h?
|
// Is \n, \N or \h?
|
||||||
if (curChar == L'\\' && (nextChar == 'n' || nextChar == 'N' || nextChar == 'h')) {
|
if (curChar == '\\' && (nextChar == 'n' || nextChar == 'N' || nextChar == 'h')) {
|
||||||
SetUnicodeStyling(curPos,ran,curStyle);
|
SetUnicodeStyling(curPos,ran,curStyle);
|
||||||
curPos += ran;
|
curPos += ran;
|
||||||
ran = 1;
|
ran = 1;
|
||||||
|
@ -421,7 +421,7 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) {
|
||||||
// Inside
|
// Inside
|
||||||
else if (depth == 1) {
|
else if (depth == 1) {
|
||||||
// Special character
|
// Special character
|
||||||
if (curChar == L'\\' || curChar == '(' || curChar == ')' || curChar == ',') {
|
if (curChar == '\\' || curChar == '(' || curChar == ')' || curChar == ',') {
|
||||||
if (curStyle != 2) {
|
if (curStyle != 2) {
|
||||||
SetUnicodeStyling(curPos,ran,curStyle);
|
SetUnicodeStyling(curPos,ran,curStyle);
|
||||||
curPos += ran;
|
curPos += ran;
|
||||||
|
@ -433,7 +433,7 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) {
|
||||||
|
|
||||||
else {
|
else {
|
||||||
// Number
|
// Number
|
||||||
if (prevChar != L'\\' && (numMode || (curChar >= '0' && curChar <= '9') || curChar == '.' || curChar == '&' || curChar == '+' || curChar == '-' || (curChar == 'H' && prevChar == '&'))) {
|
if (prevChar != '\\' && (numMode || (curChar >= '0' && curChar <= '9') || curChar == '.' || curChar == '&' || curChar == '+' || curChar == '-' || (curChar == 'H' && prevChar == '&'))) {
|
||||||
if (curStyle != 5) {
|
if (curStyle != 5) {
|
||||||
SetUnicodeStyling(curPos,ran,curStyle);
|
SetUnicodeStyling(curPos,ran,curStyle);
|
||||||
curPos += ran;
|
curPos += ran;
|
||||||
|
@ -452,8 +452,8 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) {
|
||||||
|
|
||||||
// Set parameter if it's \fn or \r
|
// Set parameter if it's \fn or \r
|
||||||
int tagLen = 0;
|
int tagLen = 0;
|
||||||
if (text.Mid(curPos,2) == L"fn") tagLen = 2;
|
if (text.Mid(curPos,2) == "fn") tagLen = 2;
|
||||||
else if (text.Mid(curPos,1) == L"r") tagLen = 1;
|
else if (text.Mid(curPos,1) == "r") tagLen = 1;
|
||||||
if (tagLen) {
|
if (tagLen) {
|
||||||
numMode = true;
|
numMode = true;
|
||||||
ran = tagLen-1;
|
ran = tagLen-1;
|
||||||
|
@ -461,17 +461,17 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set drawing mode if it's \p
|
// Set drawing mode if it's \p
|
||||||
if (text.Mid(curPos,1) == L"p") {
|
if (text.Mid(curPos,1) == "p") {
|
||||||
if (curPos+2 < (signed) text.Length()) {
|
if (curPos+2 < (signed) text.Length()) {
|
||||||
// Disable
|
// Disable
|
||||||
wxChar nextNext = text[curPos+2];
|
wxChar nextNext = text[curPos+2];
|
||||||
if ((nextNext == L'\\' || nextNext == '}') && nextChar == '0') drawingMode = false;
|
if ((nextNext == '\\' || nextNext == '}') && nextChar == '0') drawingMode = false;
|
||||||
|
|
||||||
// Enable
|
// Enable
|
||||||
if (nextChar >= '1' && nextChar <= '9') {
|
if (nextChar >= '1' && nextChar <= '9') {
|
||||||
for(int testPos = curPos+2;testPos < (signed) text.Length();testPos++) {
|
for(int testPos = curPos+2;testPos < (signed) text.Length();testPos++) {
|
||||||
nextNext = text[testPos];
|
nextNext = text[testPos];
|
||||||
if (nextNext == L'\\' || nextNext == '}') {
|
if (nextNext == '\\' || nextNext == '}') {
|
||||||
drawingMode = true;
|
drawingMode = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -546,7 +546,7 @@ void SubsTextEditCtrl::UpdateCallTip(wxStyledTextEvent &) {
|
||||||
|
|
||||||
// Not inside parenthesis
|
// Not inside parenthesis
|
||||||
if (inDepth == 0) {
|
if (inDepth == 0) {
|
||||||
if (prevChar == L'\\') {
|
if (prevChar == '\\') {
|
||||||
// Found start
|
// Found start
|
||||||
if (i <= pos) tagStart = i;
|
if (i <= pos) tagStart = i;
|
||||||
|
|
||||||
|
@ -652,7 +652,7 @@ void SubsTextEditCtrl::UpdateCallTip(wxStyledTextEvent &) {
|
||||||
semiProto = false;
|
semiProto = false;
|
||||||
cleanProto = proto[i];
|
cleanProto = proto[i];
|
||||||
if (cleanProto.Freq(';') > 0) {
|
if (cleanProto.Freq(';') > 0) {
|
||||||
cleanProto.Replace(L";","");
|
cleanProto.Replace(";","");
|
||||||
semiProto = true;
|
semiProto = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,9 +746,9 @@ void SubsTextEditCtrl::SetTextTo(wxString text) {
|
||||||
SetEvtHandlerEnabled(false);
|
SetEvtHandlerEnabled(false);
|
||||||
Freeze();
|
Freeze();
|
||||||
|
|
||||||
text.Replace(L"\r\n",L"\\N");
|
text.Replace("\r\n","\\N");
|
||||||
text.Replace(L"\r",L"\\N");
|
text.Replace("\r","\\N");
|
||||||
text.Replace(L"\n",L"\\N");
|
text.Replace("\n","\\N");
|
||||||
|
|
||||||
int from=0,to=0;
|
int from=0,to=0;
|
||||||
GetSelection(&from,&to);
|
GetSelection(&from,&to);
|
||||||
|
@ -808,7 +808,7 @@ void SubsTextEditCtrl::OnContextMenu(wxContextMenuEvent &event) {
|
||||||
|
|
||||||
// Append "add word"
|
// Append "add word"
|
||||||
wxString add_to_dict_text(_("Add \"%s\" to dictionary"));
|
wxString add_to_dict_text(_("Add \"%s\" to dictionary"));
|
||||||
add_to_dict_text.Replace(L"%s", currentWord);
|
add_to_dict_text.Replace("%s", currentWord);
|
||||||
menu.Append(EDIT_MENU_ADD_TO_DICT,add_to_dict_text)->Enable(spellchecker->CanAddWord(currentWord));
|
menu.Append(EDIT_MENU_ADD_TO_DICT,add_to_dict_text)->Enable(spellchecker->CanAddWord(currentWord));
|
||||||
}
|
}
|
||||||
// Spelled right
|
// Spelled right
|
||||||
|
@ -897,7 +897,7 @@ void SubsTextEditCtrl::OnContextMenu(wxContextMenuEvent &event) {
|
||||||
|
|
||||||
// Thesaurus menu
|
// Thesaurus menu
|
||||||
wxString thes_suggestion_text(_("Thesaurus suggestions for \"%s\""));
|
wxString thes_suggestion_text(_("Thesaurus suggestions for \"%s\""));
|
||||||
thes_suggestion_text.Replace(L"%s", currentWord);
|
thes_suggestion_text.Replace("%s", currentWord);
|
||||||
menu.Append(-1,thes_suggestion_text,thesMenu);
|
menu.Append(-1,thes_suggestion_text,thesMenu);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -977,7 +977,7 @@ void SubsTextEditCtrl::OnUseSuggestion(wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stripe suggestion of parenthesis
|
// Stripe suggestion of parenthesis
|
||||||
int pos = suggestion.Find(L"(");
|
int pos = suggestion.Find("(");
|
||||||
if (pos != wxNOT_FOUND) {
|
if (pos != wxNOT_FOUND) {
|
||||||
suggestion = suggestion.Left(pos-1);
|
suggestion = suggestion.Left(pos-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,8 +157,8 @@ void SubtitlesGrid::OnShowColMenu(wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void trim_text(AssDialogue *diag) {
|
static void trim_text(AssDialogue *diag) {
|
||||||
static wxRegEx start(L"^( |\\t|\\\\[nNh])+");
|
static wxRegEx start("^( |\\t|\\\\[nNh])+");
|
||||||
static wxRegEx end(L"( |\\t|\\\\[nNh])+$");
|
static wxRegEx end("( |\\t|\\\\[nNh])+$");
|
||||||
start.ReplaceFirst(&diag->Text, "");
|
start.ReplaceFirst(&diag->Text, "");
|
||||||
end.ReplaceFirst(&diag->Text, "");
|
end.ReplaceFirst(&diag->Text, "");
|
||||||
}
|
}
|
||||||
|
@ -274,12 +274,12 @@ void SubtitlesGrid::InsertLine(AssDialogue *line,int n,bool after,bool update) {
|
||||||
|
|
||||||
void SubtitlesGrid::CopyLines(wxArrayInt target) {
|
void SubtitlesGrid::CopyLines(wxArrayInt target) {
|
||||||
// Prepare text
|
// Prepare text
|
||||||
wxString data = _T("");
|
wxString data = "";
|
||||||
AssDialogue *cur;
|
AssDialogue *cur;
|
||||||
int nrows = target.Count();
|
int nrows = target.Count();
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (int i=0;i<nrows;i++) {
|
for (int i=0;i<nrows;i++) {
|
||||||
if (!first) data += _T("\r\n");
|
if (!first) data += "\r\n";
|
||||||
first = false;
|
first = false;
|
||||||
cur = GetDialogue(target[i]);
|
cur = GetDialogue(target[i]);
|
||||||
data += cur->GetEntryData();
|
data += cur->GetEntryData();
|
||||||
|
@ -323,7 +323,7 @@ void SubtitlesGrid::PasteLines(int n,bool pasteOver) {
|
||||||
// Insert data
|
// Insert data
|
||||||
int inserted = 0;
|
int inserted = 0;
|
||||||
std::vector<bool> pasteOverOptions;
|
std::vector<bool> pasteOverOptions;
|
||||||
wxStringTokenizer token (data,_T("\r\n"),wxTOKEN_STRTOK);
|
wxStringTokenizer token (data,"\r\n",wxTOKEN_STRTOK);
|
||||||
while (token.HasMoreTokens()) {
|
while (token.HasMoreTokens()) {
|
||||||
// Convert data into an AssDialogue
|
// Convert data into an AssDialogue
|
||||||
wxString curdata = token.GetNextToken();
|
wxString curdata = token.GetNextToken();
|
||||||
|
|
|
@ -93,7 +93,7 @@ void SubtitlesPreview::SetStyle(AssStyle const& newStyle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubtitlesPreview::SetText(wxString text) {
|
void SubtitlesPreview::SetText(wxString text) {
|
||||||
wxString newText = L"{\\q2}" + text;
|
wxString newText = "{\\q2}" + text;
|
||||||
if (newText != line->Text) {
|
if (newText != line->Text) {
|
||||||
line->Text = newText;
|
line->Text = newText;
|
||||||
UpdateBitmap();
|
UpdateBitmap();
|
||||||
|
|
|
@ -251,14 +251,14 @@ wxString SubtitleFormat::GetWildcards(int mode) {
|
||||||
if (cur.Count()) {
|
if (cur.Count()) {
|
||||||
// Process entries
|
// Process entries
|
||||||
for (unsigned int i=0;i<cur.Count();i++) {
|
for (unsigned int i=0;i<cur.Count();i++) {
|
||||||
wild = _T("*.") + cur[i];
|
wild = "*." + cur[i];
|
||||||
all.Add(wild);
|
all.Add(wild);
|
||||||
temp1 += wild + _T(",");
|
temp1 += wild + ",";
|
||||||
temp2 += wild + _T(";");
|
temp2 += wild + ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assemble final name
|
// Assemble final name
|
||||||
final += format->GetName() + _T(" (") + temp1.Left(temp1.Length()-1) + _T(")|") + temp2.Left(temp2.Length()-1) + _T("|");
|
final += format->GetName() + " (" + temp1.Left(temp1.Length()-1) + ")|" + temp2.Left(temp2.Length()-1) + "|";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,10 +266,10 @@ wxString SubtitleFormat::GetWildcards(int mode) {
|
||||||
temp1.Clear();
|
temp1.Clear();
|
||||||
temp2.Clear();
|
temp2.Clear();
|
||||||
for (unsigned int i=0;i<all.Count();i++) {
|
for (unsigned int i=0;i<all.Count();i++) {
|
||||||
temp1 += all[i] + _T(",");
|
temp1 += all[i] + ",";
|
||||||
temp2 += all[i] + _T(";");
|
temp2 += all[i] + ";";
|
||||||
}
|
}
|
||||||
final = wxString(_("All Supported Formats")) + _T(" (") + temp1.Left(temp1.Length()-1) + _T(")|") + temp2.Left(temp2.Length()-1) + _T("|") + final.Left(final.Length()-1);
|
final = wxString(_("All Supported Formats")) + " (" + temp1.Left(temp1.Length()-1) + ")|" + temp2.Left(temp2.Length()-1) + "|" + final.Left(final.Length()-1);
|
||||||
|
|
||||||
// Return final list
|
// Return final list
|
||||||
return final;
|
return final;
|
||||||
|
@ -289,9 +289,9 @@ SubtitleFormat::FPSRational SubtitleFormat::AskForFPS(bool showSMPTE) {
|
||||||
bool vidLoaded = context->TimecodesLoaded();
|
bool vidLoaded = context->TimecodesLoaded();
|
||||||
if (vidLoaded) {
|
if (vidLoaded) {
|
||||||
wxString vidFPS;
|
wxString vidFPS;
|
||||||
if (context->FPS().IsVFR()) vidFPS = _T("VFR");
|
if (context->FPS().IsVFR()) vidFPS = "VFR";
|
||||||
else vidFPS = wxString::Format(_T("%.3f"),context->FPS().FPS());
|
else vidFPS = wxString::Format("%.3f",context->FPS().FPS());
|
||||||
choices.Add(wxString::Format(_T("From video (%s)"),vidFPS.c_str()));
|
choices.Add(wxString::Format("From video (%s)",vidFPS.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Standard FPS values
|
// Standard FPS values
|
||||||
|
@ -385,9 +385,9 @@ void SubtitleFormat::ConvertTags(int format,const wxString &lineEnd,bool mergeLi
|
||||||
else if (format == 2) current->ConvertTagsToSRT();
|
else if (format == 2) current->ConvertTagsToSRT();
|
||||||
|
|
||||||
// Replace line breaks
|
// Replace line breaks
|
||||||
current->Text.Replace(_T("\\h"),_T(" "),true);
|
current->Text.Replace("\\h"," ",true);
|
||||||
current->Text.Replace(_T("\\n"),lineEnd,true);
|
current->Text.Replace("\\n",lineEnd,true);
|
||||||
current->Text.Replace(_T("\\N"),lineEnd,true);
|
current->Text.Replace("\\N",lineEnd,true);
|
||||||
if (mergeLineBreaks) {
|
if (mergeLineBreaks) {
|
||||||
while (current->Text.Replace(lineEnd+lineEnd,lineEnd,true)) {};
|
while (current->Text.Replace(lineEnd+lineEnd,lineEnd,true)) {};
|
||||||
}
|
}
|
||||||
|
@ -498,7 +498,7 @@ void SubtitleFormat::RecombineOverlaps() {
|
||||||
newdlg->Start = curdlg->Start;
|
newdlg->Start = curdlg->Start;
|
||||||
newdlg->End = (prevdlg->End < curdlg->End) ? prevdlg->End : curdlg->End;
|
newdlg->End = (prevdlg->End < curdlg->End) ? prevdlg->End : curdlg->End;
|
||||||
// Put an ASS format hard linewrap between lines
|
// Put an ASS format hard linewrap between lines
|
||||||
newdlg->Text = curdlg->Text + _T("\\N") + prevdlg->Text;
|
newdlg->Text = curdlg->Text + "\\N" + prevdlg->Text;
|
||||||
|
|
||||||
InsertLineSortedIntoList(*Line, next, newdlg);
|
InsertLineSortedIntoList(*Line, next, newdlg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,13 +133,13 @@ public:
|
||||||
/// @param filename
|
/// @param filename
|
||||||
/// @param forceEncoding
|
/// @param forceEncoding
|
||||||
///
|
///
|
||||||
virtual void ReadFile(wxString filename,wxString forceEncoding=_T("")) { };
|
virtual void ReadFile(wxString filename,wxString forceEncoding="") { };
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @param filename
|
/// @param filename
|
||||||
/// @param encoding
|
/// @param encoding
|
||||||
///
|
///
|
||||||
virtual void WriteFile(wxString filename,wxString encoding=_T("")) { };
|
virtual void WriteFile(wxString filename,wxString encoding="") { };
|
||||||
|
|
||||||
static SubtitleFormat *GetReader(wxString filename);
|
static SubtitleFormat *GetReader(wxString filename);
|
||||||
static SubtitleFormat *GetWriter(wxString filename);
|
static SubtitleFormat *GetWriter(wxString filename);
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool ASSSubtitleFormat::CanReadFile(wxString filename) {
|
bool ASSSubtitleFormat::CanReadFile(wxString filename) {
|
||||||
return (filename.Right(4).Lower() == _T(".ass") || filename.Right(4).Lower() == _T(".ssa"));
|
return (filename.Right(4).Lower() == ".ass" || filename.Right(4).Lower() == ".ssa");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ bool ASSSubtitleFormat::CanReadFile(wxString filename) {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
wxString ASSSubtitleFormat::GetName() {
|
wxString ASSSubtitleFormat::GetName() {
|
||||||
return _T("Advanced Substation Alpha");
|
return "Advanced Substation Alpha";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ wxString ASSSubtitleFormat::GetName() {
|
||||||
///
|
///
|
||||||
wxArrayString ASSSubtitleFormat::GetReadWildcards() {
|
wxArrayString ASSSubtitleFormat::GetReadWildcards() {
|
||||||
wxArrayString formats;
|
wxArrayString formats;
|
||||||
formats.Add(_T("ass"));
|
formats.Add("ass");
|
||||||
formats.Add(_T("ssa"));
|
formats.Add("ssa");
|
||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@ wxArrayString ASSSubtitleFormat::GetReadWildcards() {
|
||||||
///
|
///
|
||||||
wxArrayString ASSSubtitleFormat::GetWriteWildcards() {
|
wxArrayString ASSSubtitleFormat::GetWriteWildcards() {
|
||||||
wxArrayString formats;
|
wxArrayString formats;
|
||||||
formats.Add(_T("ass"));
|
formats.Add("ass");
|
||||||
formats.Add(_T("ssa"));
|
formats.Add("ssa");
|
||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ void ASSSubtitleFormat::ReadFile(wxString filename,wxString encoding) {
|
||||||
// Reader
|
// Reader
|
||||||
TextFileReader file(filename,encoding);
|
TextFileReader file(filename,encoding);
|
||||||
int version = 1;
|
int version = 1;
|
||||||
if (filename.Right(4).Lower() == _T(".ssa")) version = 0;
|
if (filename.Right(4).Lower() == ".ssa") version = 0;
|
||||||
|
|
||||||
// Parse file
|
// Parse file
|
||||||
wxString curgroup;
|
wxString curgroup;
|
||||||
|
@ -109,27 +109,27 @@ void ASSSubtitleFormat::ReadFile(wxString filename,wxString encoding) {
|
||||||
|
|
||||||
// Make sure that the first non-blank non-comment non-group-header line
|
// Make sure that the first non-blank non-comment non-group-header line
|
||||||
// is really [Script Info]
|
// is really [Script Info]
|
||||||
if (curgroup.IsEmpty() && !wxbuffer.IsEmpty() && wxbuffer[0] != _T(';') && wxbuffer[0] != _T('[')) {
|
if (curgroup.IsEmpty() && !wxbuffer.IsEmpty() && wxbuffer[0] != ';' && wxbuffer[0] != '[') {
|
||||||
curgroup = _T("[Script Info]");
|
curgroup = "[Script Info]";
|
||||||
AddLine(curgroup,curgroup,version,&curgroup);
|
AddLine(curgroup,curgroup,version,&curgroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert v4 styles to v4+ styles
|
// Convert v4 styles to v4+ styles
|
||||||
if (!wxbuffer.IsEmpty() && wxbuffer[0] == _T('[')) {
|
if (!wxbuffer.IsEmpty() && wxbuffer[0] == '[') {
|
||||||
// Ugly hacks to allow intermixed v4 and v4+ style sections
|
// Ugly hacks to allow intermixed v4 and v4+ style sections
|
||||||
wxString low = wxbuffer.Lower();
|
wxString low = wxbuffer.Lower();
|
||||||
if (low == _T("[v4 styles]")) {
|
if (low == "[v4 styles]") {
|
||||||
wxbuffer = _T("[V4+ Styles]");
|
wxbuffer = "[V4+ Styles]";
|
||||||
curgroup = wxbuffer;
|
curgroup = wxbuffer;
|
||||||
version = 0;
|
version = 0;
|
||||||
}
|
}
|
||||||
else if (low == _T("[v4+ styles]")) {
|
else if (low == "[v4+ styles]") {
|
||||||
wxbuffer = _T("[V4+ Styles]");
|
wxbuffer = "[V4+ Styles]";
|
||||||
curgroup = wxbuffer;
|
curgroup = wxbuffer;
|
||||||
version = 1;
|
version = 1;
|
||||||
}
|
}
|
||||||
else if (low == _T("[v4++ styles]")) {
|
else if (low == "[v4++ styles]") {
|
||||||
wxbuffer = _T("[V4+ Styles]");
|
wxbuffer = "[V4+ Styles]";
|
||||||
curgroup = wxbuffer;
|
curgroup = wxbuffer;
|
||||||
version = 2;
|
version = 2;
|
||||||
}
|
}
|
||||||
|
@ -143,13 +143,13 @@ void ASSSubtitleFormat::ReadFile(wxString filename,wxString encoding) {
|
||||||
try {
|
try {
|
||||||
AddLine(wxbuffer,curgroup,version,&curgroup);
|
AddLine(wxbuffer,curgroup,version,&curgroup);
|
||||||
}
|
}
|
||||||
catch (const wchar_t *err) {
|
catch (const char *err) {
|
||||||
Clear();
|
Clear();
|
||||||
throw wxString(_T("Error processing line: ")) + wxbuffer + _T(": ") + wxString(err);
|
throw wxString("Error processing line: ") + wxbuffer + ": " + wxString(err);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
Clear();
|
Clear();
|
||||||
throw wxString(_T("Error processing line: ")) + wxbuffer;
|
throw wxString("Error processing line: ") + wxbuffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ void ASSSubtitleFormat::ReadFile(wxString filename,wxString encoding) {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool ASSSubtitleFormat::CanWriteFile(wxString filename) {
|
bool ASSSubtitleFormat::CanWriteFile(wxString filename) {
|
||||||
return (filename.Right(4).Lower() == _T(".ass") || filename.Right(4).Lower() == _T(".ssa"));
|
return (filename.Right(4).Lower() == ".ass" || filename.Right(4).Lower() == ".ssa");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ bool ASSSubtitleFormat::CanWriteFile(wxString filename) {
|
||||||
void ASSSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
|
void ASSSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
|
||||||
// Open file
|
// Open file
|
||||||
TextFileWriter file(filename,encoding);
|
TextFileWriter file(filename,encoding);
|
||||||
bool ssa = filename.Right(4).Lower() == _T(".ssa");
|
bool ssa = filename.Right(4).Lower() == ".ssa";
|
||||||
|
|
||||||
// Write lines
|
// Write lines
|
||||||
std::list<AssEntry*>::iterator last = Line->end(); --last;
|
std::list<AssEntry*>::iterator last = Line->end(); --last;
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
wxString DVDSubtitleFormat::GetName() {
|
wxString DVDSubtitleFormat::GetName() {
|
||||||
return _T("DVD Subpictures");
|
return "DVD Subpictures";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ wxString DVDSubtitleFormat::GetName() {
|
||||||
///
|
///
|
||||||
wxArrayString DVDSubtitleFormat::GetWriteWildcards() {
|
wxArrayString DVDSubtitleFormat::GetWriteWildcards() {
|
||||||
wxArrayString results;
|
wxArrayString results;
|
||||||
results.Add(_T("sup"));
|
results.Add("sup");
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ wxArrayString DVDSubtitleFormat::GetWriteWildcards() {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool DVDSubtitleFormat::CanWriteFile(wxString filename) {
|
bool DVDSubtitleFormat::CanWriteFile(wxString filename) {
|
||||||
return (filename.Lower().EndsWith(_T(".sup")));
|
return (filename.Lower().EndsWith(".sup"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ void DVDSubtitleFormat::GetSubPictureList(std::vector<SubPicture> &pics) {
|
||||||
provider->DrawSubtitles(dst,time);
|
provider->DrawSubtitles(dst,time);
|
||||||
}
|
}
|
||||||
wxImage img = dst.GetImage();
|
wxImage img = dst.GetImage();
|
||||||
img.SaveFile(_T("test.bmp"));
|
img.SaveFile("test.bmp");
|
||||||
dst.Clear();
|
dst.Clear();
|
||||||
|
|
||||||
// Tesseract test
|
// Tesseract test
|
||||||
|
@ -152,7 +152,7 @@ void DVDSubtitleFormat::GetSubPictureList(std::vector<SubPicture> &pics) {
|
||||||
const EANYCODE_CHAR* ch = &output->text[cur];
|
const EANYCODE_CHAR* ch = &output->text[cur];
|
||||||
unsigned char unistr[8];
|
unsigned char unistr[8];
|
||||||
|
|
||||||
for (int b = 0; b < ch->blanks; ++b) blah += _T(" ");
|
for (int b = 0; b < ch->blanks; ++b) blah += " ";
|
||||||
|
|
||||||
for (j = cur; j < output->count; j++) {
|
for (j = cur; j < output->count; j++) {
|
||||||
const EANYCODE_CHAR* unich = &output->text[j];
|
const EANYCODE_CHAR* unich = &output->text[j];
|
||||||
|
@ -164,7 +164,7 @@ void DVDSubtitleFormat::GetSubPictureList(std::vector<SubPicture> &pics) {
|
||||||
}
|
}
|
||||||
unistr[j - cur] = '\0';
|
unistr[j - cur] = '\0';
|
||||||
blah += wxString((char*)unistr,wxConvUTF8);
|
blah += wxString((char*)unistr,wxConvUTF8);
|
||||||
if (ch->formatting & 64) blah += _T("\n");
|
if (ch->formatting & 64) blah += "\n";
|
||||||
}
|
}
|
||||||
wxLogMessage(blah);
|
wxLogMessage(blah);
|
||||||
*/
|
*/
|
||||||
|
@ -375,7 +375,7 @@ void DVDSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
|
||||||
|
|
||||||
// Open file for writing
|
// Open file for writing
|
||||||
wxFile fp(filename,wxFile::write);
|
wxFile fp(filename,wxFile::write);
|
||||||
if (!fp.IsOpened()) throw _T("Could not open file for writing.");
|
if (!fp.IsOpened()) throw "Could not open file for writing.";
|
||||||
|
|
||||||
// Write each subpicture
|
// Write each subpicture
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
wxString EncoreSubtitleFormat::GetName() {
|
wxString EncoreSubtitleFormat::GetName() {
|
||||||
return _T("Adobe Encore");
|
return "Adobe Encore";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ wxString EncoreSubtitleFormat::GetName() {
|
||||||
///
|
///
|
||||||
wxArrayString EncoreSubtitleFormat::GetWriteWildcards() {
|
wxArrayString EncoreSubtitleFormat::GetWriteWildcards() {
|
||||||
wxArrayString formats;
|
wxArrayString formats;
|
||||||
formats.Add(_T("encore.txt"));
|
formats.Add("encore.txt");
|
||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ wxArrayString EncoreSubtitleFormat::GetWriteWildcards() {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool EncoreSubtitleFormat::CanWriteFile(wxString filename) {
|
bool EncoreSubtitleFormat::CanWriteFile(wxString filename) {
|
||||||
return (filename.Right(11).Lower() == _T(".encore.txt"));
|
return (filename.Right(11).Lower() == ".encore.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,20 +92,20 @@ void EncoreSubtitleFormat::WriteFile(wxString _filename,wxString encoding) {
|
||||||
StripComments();
|
StripComments();
|
||||||
RecombineOverlaps();
|
RecombineOverlaps();
|
||||||
MergeIdentical();
|
MergeIdentical();
|
||||||
ConvertTags(1,_T("\r\n"));
|
ConvertTags(1,"\r\n");
|
||||||
|
|
||||||
// Write lines
|
// Write lines
|
||||||
using std::list;
|
using std::list;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
// Encore wants ; instead of : if we're dealing with NTSC dropframe stuff
|
// Encore wants ; instead of : if we're dealing with NTSC dropframe stuff
|
||||||
FractionalTime ft(fps_rat.smpte_dropframe ? _T(";") : _T(":"), fps_rat.num, fps_rat.den, fps_rat.smpte_dropframe);
|
FractionalTime ft(fps_rat.smpte_dropframe ? ";" : ":", fps_rat.num, fps_rat.den, fps_rat.smpte_dropframe);
|
||||||
|
|
||||||
for (list<AssEntry*>::iterator cur=Line->begin();cur!=Line->end();cur++) {
|
for (list<AssEntry*>::iterator cur=Line->begin();cur!=Line->end();cur++) {
|
||||||
AssDialogue *current = dynamic_cast<AssDialogue*>(*cur);
|
AssDialogue *current = dynamic_cast<AssDialogue*>(*cur);
|
||||||
if (current && !current->Comment) {
|
if (current && !current->Comment) {
|
||||||
++i;
|
++i;
|
||||||
file.WriteLineToFile(wxString::Format(_T("%i %s %s %s"), i, ft.FromAssTime(current->Start).c_str(), ft.FromAssTime(current->End).c_str(), current->Text.c_str()));
|
file.WriteLineToFile(wxString::Format("%i %s %s %s", i, ft.FromAssTime(current->Start).c_str(), ft.FromAssTime(current->End).c_str(), current->Text.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,12 @@
|
||||||
#include "video_context.h"
|
#include "video_context.h"
|
||||||
|
|
||||||
wxString MicroDVDSubtitleFormat::GetName() {
|
wxString MicroDVDSubtitleFormat::GetName() {
|
||||||
return _T("MicroDVD");
|
return "MicroDVD";
|
||||||
}
|
}
|
||||||
|
|
||||||
wxArrayString MicroDVDSubtitleFormat::GetReadWildcards() {
|
wxArrayString MicroDVDSubtitleFormat::GetReadWildcards() {
|
||||||
wxArrayString formats;
|
wxArrayString formats;
|
||||||
formats.Add(_T("sub"));
|
formats.Add("sub");
|
||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,12 +63,12 @@ wxArrayString MicroDVDSubtitleFormat::GetWriteWildcards() {
|
||||||
|
|
||||||
bool MicroDVDSubtitleFormat::CanReadFile(wxString filename) {
|
bool MicroDVDSubtitleFormat::CanReadFile(wxString filename) {
|
||||||
// Return false immediately if extension is wrong
|
// Return false immediately if extension is wrong
|
||||||
if (filename.Right(4).Lower() != _T(".sub")) return false;
|
if (filename.Right(4).Lower() != ".sub") return false;
|
||||||
|
|
||||||
// Since there is an infinity of .sub formats, load first line and check if it's valid
|
// Since there is an infinity of .sub formats, load first line and check if it's valid
|
||||||
TextFileReader file(filename);
|
TextFileReader file(filename);
|
||||||
if (file.HasMoreLines()) {
|
if (file.HasMoreLines()) {
|
||||||
wxRegEx exp(_T("^[\\{\\[]([0-9]+)[\\}\\]][\\{\\[]([0-9]+)[\\}\\]](.*)$"),wxRE_ADVANCED);
|
wxRegEx exp("^[\\{\\[]([0-9]+)[\\}\\]][\\{\\[]([0-9]+)[\\}\\]](.*)$",wxRE_ADVANCED);
|
||||||
return exp.Matches(file.ReadLineFromFile());
|
return exp.Matches(file.ReadLineFromFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,12 +76,12 @@ bool MicroDVDSubtitleFormat::CanReadFile(wxString filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MicroDVDSubtitleFormat::CanWriteFile(wxString filename) {
|
bool MicroDVDSubtitleFormat::CanWriteFile(wxString filename) {
|
||||||
return (filename.Right(4).Lower() == _T(".sub"));
|
return (filename.Right(4).Lower() == ".sub");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MicroDVDSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding) {
|
void MicroDVDSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding) {
|
||||||
TextFileReader file(filename);
|
TextFileReader file(filename);
|
||||||
wxRegEx exp(_T("^[\\{\\[]([0-9]+)[\\}\\]][\\{\\[]([0-9]+)[\\}\\]](.*)$"),wxRE_ADVANCED);
|
wxRegEx exp("^[\\{\\[]([0-9]+)[\\}\\]][\\{\\[]([0-9]+)[\\}\\]](.*)$",wxRE_ADVANCED);
|
||||||
|
|
||||||
LoadDefault(false);
|
LoadDefault(false);
|
||||||
|
|
||||||
|
@ -128,11 +128,11 @@ void MicroDVDSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding)
|
||||||
start = rate->TimeAtFrame(f1,agi::vfr::START);
|
start = rate->TimeAtFrame(f1,agi::vfr::START);
|
||||||
end = rate->TimeAtFrame(f2,agi::vfr::END);
|
end = rate->TimeAtFrame(f2,agi::vfr::END);
|
||||||
|
|
||||||
text.Replace(_T("|"),_T("\\N"));
|
text.Replace("|","\\N");
|
||||||
|
|
||||||
AssDialogue *line = new AssDialogue();
|
AssDialogue *line = new AssDialogue();
|
||||||
line->group = _T("[Events]");
|
line->group = "[Events]";
|
||||||
line->Style = _T("Default");
|
line->Style = "Default";
|
||||||
line->Start.SetMS(start);
|
line->Start.SetMS(start);
|
||||||
line->End.SetMS(end);
|
line->End.SetMS(end);
|
||||||
line->Text = text;
|
line->Text = text;
|
||||||
|
@ -157,13 +157,13 @@ void MicroDVDSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
|
||||||
StripComments();
|
StripComments();
|
||||||
RecombineOverlaps();
|
RecombineOverlaps();
|
||||||
MergeIdentical();
|
MergeIdentical();
|
||||||
ConvertTags(1,_T("|"));
|
ConvertTags(1,"|");
|
||||||
|
|
||||||
TextFileWriter file(filename,encoding);
|
TextFileWriter file(filename,encoding);
|
||||||
|
|
||||||
// Write FPS line
|
// Write FPS line
|
||||||
if (!rate->IsVFR()) {
|
if (!rate->IsVFR()) {
|
||||||
file.WriteLineToFile(wxString::Format(_T("{1}{1}%.6f"),rate->FPS()));
|
file.WriteLineToFile(wxString::Format("{1}{1}%.6f",rate->FPS()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write lines
|
// Write lines
|
||||||
|
@ -174,7 +174,7 @@ void MicroDVDSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
|
||||||
int start = rate->FrameAtTime(current->Start.GetMS(),agi::vfr::START);
|
int start = rate->FrameAtTime(current->Start.GetMS(),agi::vfr::START);
|
||||||
int end = rate->FrameAtTime(current->End.GetMS(),agi::vfr::END);
|
int end = rate->FrameAtTime(current->End.GetMS(),agi::vfr::END);
|
||||||
|
|
||||||
file.WriteLineToFile(wxString::Format(_T("{%i}{%i}%s"),start,end,current->Text.c_str()));
|
file.WriteLineToFile(wxString::Format("{%i}{%i}%s",start,end,current->Text.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,8 @@
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool MKVSubtitleFormat::CanReadFile(wxString filename) {
|
bool MKVSubtitleFormat::CanReadFile(wxString filename) {
|
||||||
if (filename.Right(4).Lower() == _T(".mkv") || filename.Right(4).Lower() == _T(".mks")
|
if (filename.Right(4).Lower() == ".mkv" || filename.Right(4).Lower() == ".mks"
|
||||||
|| filename.Right(4).Lower() == _T(".mka"))
|
|| filename.Right(4).Lower() == ".mka")
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -63,7 +63,7 @@ bool MKVSubtitleFormat::CanReadFile(wxString filename) {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
wxString MKVSubtitleFormat::GetName() {
|
wxString MKVSubtitleFormat::GetName() {
|
||||||
return _T("Matroska");
|
return "Matroska";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,9 +73,9 @@ wxString MKVSubtitleFormat::GetName() {
|
||||||
///
|
///
|
||||||
wxArrayString MKVSubtitleFormat::GetReadWildcards() {
|
wxArrayString MKVSubtitleFormat::GetReadWildcards() {
|
||||||
wxArrayString formats;
|
wxArrayString formats;
|
||||||
formats.Add(_T("mkv"));
|
formats.Add("mkv");
|
||||||
formats.Add(_T("mka"));
|
formats.Add("mka");
|
||||||
formats.Add(_T("mks"));
|
formats.Add("mks");
|
||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ DEFINE_SIMPLE_EXCEPTION(SRTParseError, SubtitleFormatParseError, "subtitle_io/pa
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool SRTSubtitleFormat::CanReadFile(wxString filename) {
|
bool SRTSubtitleFormat::CanReadFile(wxString filename) {
|
||||||
return (filename.Right(4).Lower() == _T(".srt"));
|
return (filename.Right(4).Lower() == ".srt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ bool SRTSubtitleFormat::CanReadFile(wxString filename) {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool SRTSubtitleFormat::CanWriteFile(wxString filename) {
|
bool SRTSubtitleFormat::CanWriteFile(wxString filename) {
|
||||||
return (filename.Right(4).Lower() == _T(".srt"));
|
return (filename.Right(4).Lower() == ".srt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ bool SRTSubtitleFormat::CanWriteFile(wxString filename) {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
wxString SRTSubtitleFormat::GetName() {
|
wxString SRTSubtitleFormat::GetName() {
|
||||||
return _T("SubRip");
|
return "SubRip";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ wxString SRTSubtitleFormat::GetName() {
|
||||||
///
|
///
|
||||||
wxArrayString SRTSubtitleFormat::GetReadWildcards() {
|
wxArrayString SRTSubtitleFormat::GetReadWildcards() {
|
||||||
wxArrayString formats;
|
wxArrayString formats;
|
||||||
formats.Add(_T("srt"));
|
formats.Add("srt");
|
||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ void SRTSubtitleFormat::ReadFile(wxString filename,wxString encoding) {
|
||||||
|
|
||||||
// "hh:mm:ss,fff --> hh:mm:ss,fff" (e.g. "00:00:04,070 --> 00:00:10,04")
|
// "hh:mm:ss,fff --> hh:mm:ss,fff" (e.g. "00:00:04,070 --> 00:00:10,04")
|
||||||
/// @todo: move the full parsing of SRT timestamps here, instead of having it in AssTime
|
/// @todo: move the full parsing of SRT timestamps here, instead of having it in AssTime
|
||||||
wxRegEx timestamp_regex(L"^([0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}) --> ([0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3})");
|
wxRegEx timestamp_regex("^([0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}) --> ([0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3})");
|
||||||
if (!timestamp_regex.IsValid())
|
if (!timestamp_regex.IsValid())
|
||||||
throw agi::InternalError("Parsing SRT: Failed compiling regex", 0);
|
throw agi::InternalError("Parsing SRT: Failed compiling regex", 0);
|
||||||
|
|
||||||
|
@ -166,8 +166,8 @@ found_timestamps:
|
||||||
}
|
}
|
||||||
// create new subtitle
|
// create new subtitle
|
||||||
line = new AssDialogue();
|
line = new AssDialogue();
|
||||||
line->group = L"[Events]";
|
line->group = "[Events]";
|
||||||
line->Style = _T("Default");
|
line->Style = "Default";
|
||||||
line->Comment = false;
|
line->Comment = false;
|
||||||
// this parsing should best be moved out of AssTime
|
// this parsing should best be moved out of AssTime
|
||||||
line->Start.ParseSRT(timestamp_regex.GetMatch(text_line, 1));
|
line->Start.ParseSRT(timestamp_regex.GetMatch(text_line, 1));
|
||||||
|
@ -202,7 +202,7 @@ found_timestamps:
|
||||||
linebreak_debt = 1;
|
linebreak_debt = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
line->Text.Append(L"\\N").Append(text_line);
|
line->Text.Append("\\N").Append(text_line);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5:
|
case 5:
|
||||||
|
@ -225,7 +225,7 @@ found_timestamps:
|
||||||
// assume it's a continuation of the subtitle text
|
// assume it's a continuation of the subtitle text
|
||||||
// resolve our line break debt and append the line text
|
// resolve our line break debt and append the line text
|
||||||
while (linebreak_debt-- > 0)
|
while (linebreak_debt-- > 0)
|
||||||
line->Text.Append(L"\\N");
|
line->Text.Append("\\N");
|
||||||
line->Text.Append(text_line);
|
line->Text.Append(text_line);
|
||||||
state = 4;
|
state = 4;
|
||||||
break;
|
break;
|
||||||
|
@ -264,12 +264,12 @@ void SRTSubtitleFormat::WriteFile(wxString _filename,wxString encoding) {
|
||||||
StripComments();
|
StripComments();
|
||||||
// Tags must be converted in two passes
|
// Tags must be converted in two passes
|
||||||
// First ASS style overrides are converted to SRT but linebreaks are kept
|
// First ASS style overrides are converted to SRT but linebreaks are kept
|
||||||
ConvertTags(2,_T("\\N"),false);
|
ConvertTags(2,"\\N",false);
|
||||||
// Then we can recombine overlaps, this requires ASS style linebreaks
|
// Then we can recombine overlaps, this requires ASS style linebreaks
|
||||||
RecombineOverlaps();
|
RecombineOverlaps();
|
||||||
MergeIdentical();
|
MergeIdentical();
|
||||||
// And finally convert linebreaks
|
// And finally convert linebreaks
|
||||||
ConvertTags(0,_T("\r\n"),false);
|
ConvertTags(0,"\r\n",false);
|
||||||
// Otherwise unclosed overrides might affect lines they shouldn't, see bug #809 for example
|
// Otherwise unclosed overrides might affect lines they shouldn't, see bug #809 for example
|
||||||
|
|
||||||
// Write lines
|
// Write lines
|
||||||
|
@ -279,10 +279,10 @@ void SRTSubtitleFormat::WriteFile(wxString _filename,wxString encoding) {
|
||||||
AssDialogue *current = dynamic_cast<AssDialogue*>(*cur);
|
AssDialogue *current = dynamic_cast<AssDialogue*>(*cur);
|
||||||
if (current && !current->Comment) {
|
if (current && !current->Comment) {
|
||||||
// Write line
|
// Write line
|
||||||
file.WriteLineToFile(wxString::Format(_T("%i"),i));
|
file.WriteLineToFile(wxString::Format("%i",i));
|
||||||
file.WriteLineToFile(current->Start.GetSRTFormated() + _T(" --> ") + current->End.GetSRTFormated());
|
file.WriteLineToFile(current->Start.GetSRTFormated() + " --> " + current->End.GetSRTFormated());
|
||||||
file.WriteLineToFile(current->Text);
|
file.WriteLineToFile(current->Text);
|
||||||
file.WriteLineToFile(_T(""));
|
file.WriteLineToFile("");
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
wxString TranStationSubtitleFormat::GetName() {
|
wxString TranStationSubtitleFormat::GetName() {
|
||||||
return _T("TranStation");
|
return "TranStation";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ wxString TranStationSubtitleFormat::GetName() {
|
||||||
///
|
///
|
||||||
wxArrayString TranStationSubtitleFormat::GetWriteWildcards() {
|
wxArrayString TranStationSubtitleFormat::GetWriteWildcards() {
|
||||||
wxArrayString formats;
|
wxArrayString formats;
|
||||||
formats.Add(_T("transtation.txt"));
|
formats.Add("transtation.txt");
|
||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ wxArrayString TranStationSubtitleFormat::GetWriteWildcards() {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool TranStationSubtitleFormat::CanWriteFile(wxString filename) {
|
bool TranStationSubtitleFormat::CanWriteFile(wxString filename) {
|
||||||
return (filename.Right(16).Lower() == _T(".transtation.txt"));
|
return (filename.Right(16).Lower() == ".transtation.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ void TranStationSubtitleFormat::WriteFile(wxString _filename,wxString encoding)
|
||||||
if (current && !current->Comment) {
|
if (current && !current->Comment) {
|
||||||
// Write text
|
// Write text
|
||||||
file.WriteLineToFile(ConvertLine(current,&fps_rat,(next && !next->Comment) ? next->Start.GetMS() : -1));
|
file.WriteLineToFile(ConvertLine(current,&fps_rat,(next && !next->Comment) ? next->Start.GetMS() : -1));
|
||||||
file.WriteLineToFile(_T(""));
|
file.WriteLineToFile("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// flush last line
|
// flush last line
|
||||||
|
@ -121,7 +121,7 @@ void TranStationSubtitleFormat::WriteFile(wxString _filename,wxString encoding)
|
||||||
file.WriteLineToFile(ConvertLine(next,&fps_rat,-1));
|
file.WriteLineToFile(ConvertLine(next,&fps_rat,-1));
|
||||||
|
|
||||||
// Every file must end with this line
|
// Every file must end with this line
|
||||||
file.WriteLineToFile(_T("SUB["));
|
file.WriteLineToFile("SUB[");
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
ClearCopy();
|
ClearCopy();
|
||||||
|
@ -137,19 +137,19 @@ wxString TranStationSubtitleFormat::ConvertLine(AssDialogue *current, FPSRationa
|
||||||
// Get line data
|
// Get line data
|
||||||
AssStyle *style = GetAssFile()->GetStyle(current->Style);
|
AssStyle *style = GetAssFile()->GetStyle(current->Style);
|
||||||
int valign = 0;
|
int valign = 0;
|
||||||
const wxChar *halign = _T(" "); // default is centered
|
const char *halign = " "; // default is centered
|
||||||
const wxChar *type = _T("N"); // no special style
|
const char *type = "N"; // no special style
|
||||||
if (style) {
|
if (style) {
|
||||||
if (style->alignment >= 4) valign = 4;
|
if (style->alignment >= 4) valign = 4;
|
||||||
if (style->alignment >= 7) valign = 9;
|
if (style->alignment >= 7) valign = 9;
|
||||||
if (style->alignment == 1 || style->alignment == 4 || style->alignment == 7) halign = _T("L");
|
if (style->alignment == 1 || style->alignment == 4 || style->alignment == 7) halign = "L";
|
||||||
if (style->alignment == 3 || style->alignment == 6 || style->alignment == 9) halign = _T("R");
|
if (style->alignment == 3 || style->alignment == 6 || style->alignment == 9) halign = "R";
|
||||||
if (style->italic) type = _T("I");
|
if (style->italic) type = "I";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hack: If an italics-tag (\i1) appears anywhere in the line,
|
// Hack: If an italics-tag (\i1) appears anywhere in the line,
|
||||||
// make it all italics
|
// make it all italics
|
||||||
if (current->Text.Find(_T("\\i1")) != wxNOT_FOUND)type = _T("I");
|
if (current->Text.Find("\\i1") != wxNOT_FOUND) type = "I";
|
||||||
|
|
||||||
// Write header
|
// Write header
|
||||||
AssTime start = current->Start;
|
AssTime start = current->Start;
|
||||||
|
@ -161,15 +161,15 @@ wxString TranStationSubtitleFormat::ConvertLine(AssDialogue *current, FPSRationa
|
||||||
if (nextl_start > 0 && end.GetMS() == nextl_start)
|
if (nextl_start > 0 && end.GetMS() == nextl_start)
|
||||||
end.SetMS(end.GetMS() - ((1000*fps_rat->den)/fps_rat->num));
|
end.SetMS(end.GetMS() - ((1000*fps_rat->den)/fps_rat->num));
|
||||||
|
|
||||||
FractionalTime ft(_T(":"), fps_rat->num, fps_rat->den, fps_rat->smpte_dropframe);
|
FractionalTime ft(":", fps_rat->num, fps_rat->den, fps_rat->smpte_dropframe);
|
||||||
wxString header = wxString::Format(_T("SUB[%i%s%s "),valign,halign,type) + ft.FromAssTime(start) + _T(">") + ft.FromAssTime(end) + _T("]\r\n");
|
wxString header = wxString::Format("SUB[%i%s%s ",valign,halign,type) + ft.FromAssTime(start) + ">" + ft.FromAssTime(end) + "]\r\n";
|
||||||
|
|
||||||
// Process text
|
// Process text
|
||||||
wxString lineEnd = _T("\r\n");
|
wxString lineEnd = "\r\n";
|
||||||
current->StripTags();
|
current->StripTags();
|
||||||
current->Text.Replace(_T("\\h"),_T(" "),true);
|
current->Text.Replace("\\h"," ",true);
|
||||||
current->Text.Replace(_T("\\n"),lineEnd,true);
|
current->Text.Replace("\\n",lineEnd,true);
|
||||||
current->Text.Replace(_T("\\N"),lineEnd,true);
|
current->Text.Replace("\\N",lineEnd,true);
|
||||||
while (current->Text.Replace(lineEnd+lineEnd,lineEnd,true)) {};
|
while (current->Text.Replace(lineEnd+lineEnd,lineEnd,true)) {};
|
||||||
|
|
||||||
return header + current->Text;
|
return header + current->Text;
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
wxString TTXTSubtitleFormat::GetName() {
|
wxString TTXTSubtitleFormat::GetName() {
|
||||||
return _T("MPEG-4 Streaming Text");
|
return "MPEG-4 Streaming Text";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ wxString TTXTSubtitleFormat::GetName() {
|
||||||
///
|
///
|
||||||
wxArrayString TTXTSubtitleFormat::GetReadWildcards() {
|
wxArrayString TTXTSubtitleFormat::GetReadWildcards() {
|
||||||
wxArrayString formats;
|
wxArrayString formats;
|
||||||
formats.Add(_T("ttxt"));
|
formats.Add("ttxt");
|
||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ wxArrayString TTXTSubtitleFormat::GetWriteWildcards() {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool TTXTSubtitleFormat::CanReadFile(wxString filename) {
|
bool TTXTSubtitleFormat::CanReadFile(wxString filename) {
|
||||||
return (filename.Right(5).Lower() == _T(".ttxt"));
|
return (filename.Right(5).Lower() == ".ttxt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ bool TTXTSubtitleFormat::CanReadFile(wxString filename) {
|
||||||
///
|
///
|
||||||
bool TTXTSubtitleFormat::CanWriteFile(wxString filename) {
|
bool TTXTSubtitleFormat::CanWriteFile(wxString filename) {
|
||||||
//return false;
|
//return false;
|
||||||
return (filename.Right(5).Lower() == _T(".ttxt"));
|
return (filename.Right(5).Lower() == ".ttxt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,17 +107,17 @@ void TTXTSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding) {
|
||||||
|
|
||||||
// Load XML document
|
// Load XML document
|
||||||
wxXmlDocument doc;
|
wxXmlDocument doc;
|
||||||
if (!doc.Load(filename)) throw _T("Failed loading TTXT XML file.");
|
if (!doc.Load(filename)) throw "Failed loading TTXT XML file.";
|
||||||
|
|
||||||
// Check root node name
|
// Check root node name
|
||||||
if (doc.GetRoot()->GetName() != _T("TextStream")) throw _T("Invalid TTXT file.");
|
if (doc.GetRoot()->GetName() != "TextStream") throw "Invalid TTXT file.";
|
||||||
|
|
||||||
// Check version
|
// Check version
|
||||||
wxString verStr = doc.GetRoot()->GetAttribute(_T("version"),_T(""));
|
wxString verStr = doc.GetRoot()->GetAttribute("version","");
|
||||||
version = -1;
|
version = -1;
|
||||||
if (verStr == _T("1.0")) version = 0;
|
if (verStr == "1.0") version = 0;
|
||||||
else if (verStr == _T("1.1")) version = 1;
|
else if (verStr == "1.1") version = 1;
|
||||||
else throw wxString(_T("Unknown TTXT version: ") + verStr);
|
else throw wxString("Unknown TTXT version: " + verStr);
|
||||||
|
|
||||||
// Get children
|
// Get children
|
||||||
diag = NULL;
|
diag = NULL;
|
||||||
|
@ -125,12 +125,12 @@ void TTXTSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding) {
|
||||||
int lines = 0;
|
int lines = 0;
|
||||||
while (child) {
|
while (child) {
|
||||||
// Line
|
// Line
|
||||||
if (child->GetName() == _T("TextSample")) {
|
if (child->GetName() == "TextSample") {
|
||||||
if (ProcessLine(child)) lines++;
|
if (ProcessLine(child)) lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
else if (child->GetName() == _T("TextStreamHeader")) {
|
else if (child->GetName() == "TextStreamHeader") {
|
||||||
ProcessHeader(child);
|
ProcessHeader(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,8 +141,8 @@ void TTXTSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding) {
|
||||||
// No lines?
|
// No lines?
|
||||||
if (lines == 0) {
|
if (lines == 0) {
|
||||||
AssDialogue *line = new AssDialogue();
|
AssDialogue *line = new AssDialogue();
|
||||||
line->group = _T("[Events]");
|
line->group = "[Events]";
|
||||||
line->Style = _T("Default");
|
line->Style = "Default";
|
||||||
line->Start.SetMS(0);
|
line->Start.SetMS(0);
|
||||||
line->End.SetMS(5000);
|
line->End.SetMS(5000);
|
||||||
Line->push_back(line);
|
Line->push_back(line);
|
||||||
|
@ -157,7 +157,7 @@ void TTXTSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding) {
|
||||||
///
|
///
|
||||||
bool TTXTSubtitleFormat::ProcessLine(wxXmlNode *node) {
|
bool TTXTSubtitleFormat::ProcessLine(wxXmlNode *node) {
|
||||||
// Get time
|
// Get time
|
||||||
wxString sampleTime = node->GetAttribute(_T("sampleTime"),_T("00:00:00.000"));
|
wxString sampleTime = node->GetAttribute("sampleTime","00:00:00.000");
|
||||||
AssTime time;
|
AssTime time;
|
||||||
time.ParseASS(sampleTime);
|
time.ParseASS(sampleTime);
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ bool TTXTSubtitleFormat::ProcessLine(wxXmlNode *node) {
|
||||||
|
|
||||||
// Get text
|
// Get text
|
||||||
wxString text;
|
wxString text;
|
||||||
if (version == 0) text = node->GetAttribute(_T("text"),_T(""));
|
if (version == 0) text = node->GetAttribute("text","");
|
||||||
else text = node->GetNodeContent();
|
else text = node->GetNodeContent();
|
||||||
|
|
||||||
// Create line
|
// Create line
|
||||||
|
@ -176,8 +176,8 @@ bool TTXTSubtitleFormat::ProcessLine(wxXmlNode *node) {
|
||||||
diag = new AssDialogue();
|
diag = new AssDialogue();
|
||||||
diag->Start.SetMS(time.GetMS());
|
diag->Start.SetMS(time.GetMS());
|
||||||
diag->End.SetMS(36000000-10);
|
diag->End.SetMS(36000000-10);
|
||||||
diag->group = _T("[Events]");
|
diag->group = "[Events]";
|
||||||
diag->Style = _T("Default");
|
diag->Style = "Default";
|
||||||
diag->Comment = false;
|
diag->Comment = false;
|
||||||
|
|
||||||
// Process text for 1.0
|
// Process text for 1.0
|
||||||
|
@ -187,8 +187,8 @@ bool TTXTSubtitleFormat::ProcessLine(wxXmlNode *node) {
|
||||||
bool in = false;
|
bool in = false;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (size_t i=0;i<text.Length();i++) {
|
for (size_t i=0;i<text.Length();i++) {
|
||||||
if (text[i] == _T('\'')) {
|
if (text[i] == '\'') {
|
||||||
if (!in && !first) finalText += _T("\\N");
|
if (!in && !first) finalText += "\\N";
|
||||||
first = false;
|
first = false;
|
||||||
in = !in;
|
in = !in;
|
||||||
}
|
}
|
||||||
|
@ -199,8 +199,8 @@ bool TTXTSubtitleFormat::ProcessLine(wxXmlNode *node) {
|
||||||
|
|
||||||
// Process text for 1.1
|
// Process text for 1.1
|
||||||
else {
|
else {
|
||||||
text.Replace(_T("\r"),_T(""));
|
text.Replace("\r","");
|
||||||
text.Replace(_T("\n"),_T("\\N"));
|
text.Replace("\n","\\N");
|
||||||
diag->Text = text;
|
diag->Text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,8 +234,8 @@ void TTXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
|
||||||
|
|
||||||
// Create XML structure
|
// Create XML structure
|
||||||
wxXmlDocument doc;
|
wxXmlDocument doc;
|
||||||
wxXmlNode *root = new wxXmlNode(NULL,wxXML_ELEMENT_NODE,_T("TextStream"));
|
wxXmlNode *root = new wxXmlNode(NULL,wxXML_ELEMENT_NODE,"TextStream");
|
||||||
root->AddAttribute(_T("version"),_T("1.1"));
|
root->AddAttribute("version","1.1");
|
||||||
doc.SetRoot(root);
|
doc.SetRoot(root);
|
||||||
|
|
||||||
// Create header
|
// Create header
|
||||||
|
@ -251,7 +251,7 @@ void TTXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
|
||||||
WriteLine(root,current);
|
WriteLine(root,current);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
else throw _T("Unexpected line type in TTXT file");
|
else throw "Unexpected line type in TTXT file";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save XML
|
// Save XML
|
||||||
|
@ -269,49 +269,49 @@ void TTXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
|
||||||
///
|
///
|
||||||
void TTXTSubtitleFormat::WriteHeader(wxXmlNode *root) {
|
void TTXTSubtitleFormat::WriteHeader(wxXmlNode *root) {
|
||||||
// Write stream header
|
// Write stream header
|
||||||
wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("TextStreamHeader"));
|
wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE,"TextStreamHeader");
|
||||||
node->AddAttribute(_T("width"),_T("400"));
|
node->AddAttribute("width","400");
|
||||||
node->AddAttribute(_T("height"),_T("60"));
|
node->AddAttribute("height","60");
|
||||||
node->AddAttribute(_T("layer"),_T("0"));
|
node->AddAttribute("layer","0");
|
||||||
node->AddAttribute(_T("translation_x"),_T("0"));
|
node->AddAttribute("translation_x","0");
|
||||||
node->AddAttribute(_T("translation_y"),_T("0"));
|
node->AddAttribute("translation_y","0");
|
||||||
root->AddChild(node);
|
root->AddChild(node);
|
||||||
root = node;
|
root = node;
|
||||||
|
|
||||||
// Write sample description
|
// Write sample description
|
||||||
node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("TextSampleDescription"));
|
node = new wxXmlNode(wxXML_ELEMENT_NODE,"TextSampleDescription");
|
||||||
node->AddAttribute(_T("horizontalJustification"),_T("center"));
|
node->AddAttribute("horizontalJustification","center");
|
||||||
node->AddAttribute(_T("verticalJustification"),_T("bottom"));
|
node->AddAttribute("verticalJustification","bottom");
|
||||||
node->AddAttribute(_T("backColor"),_T("0 0 0 0"));
|
node->AddAttribute("backColor","0 0 0 0");
|
||||||
node->AddAttribute(_T("verticalText"),_T("no"));
|
node->AddAttribute("verticalText","no");
|
||||||
node->AddAttribute(_T("fillTextRegion"),_T("no"));
|
node->AddAttribute("fillTextRegion","no");
|
||||||
node->AddAttribute(_T("continuousKaraoke"),_T("no"));
|
node->AddAttribute("continuousKaraoke","no");
|
||||||
node->AddAttribute(_T("scroll"),_T("None"));
|
node->AddAttribute("scroll","None");
|
||||||
root->AddChild(node);
|
root->AddChild(node);
|
||||||
root = node;
|
root = node;
|
||||||
|
|
||||||
// Write font table
|
// Write font table
|
||||||
node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("FontTable"));
|
node = new wxXmlNode(wxXML_ELEMENT_NODE,"FontTable");
|
||||||
wxXmlNode *subNode = new wxXmlNode(wxXML_ELEMENT_NODE,_T("FontTableEntry"));
|
wxXmlNode *subNode = new wxXmlNode(wxXML_ELEMENT_NODE,"FontTableEntry");
|
||||||
subNode->AddAttribute(_T("fontName"),_T("Sans"));
|
subNode->AddAttribute("fontName","Sans");
|
||||||
subNode->AddAttribute(_T("fontID"),_T("1"));
|
subNode->AddAttribute("fontID","1");
|
||||||
node->AddChild(subNode);
|
node->AddChild(subNode);
|
||||||
root->AddChild(node);
|
root->AddChild(node);
|
||||||
|
|
||||||
// Write text box
|
// Write text box
|
||||||
node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("TextBox"));
|
node = new wxXmlNode(wxXML_ELEMENT_NODE,"TextBox");
|
||||||
node->AddAttribute(_T("top"),_T("0"));
|
node->AddAttribute("top","0");
|
||||||
node->AddAttribute(_T("left"),_T("0"));
|
node->AddAttribute("left","0");
|
||||||
node->AddAttribute(_T("bottom"),_T("60"));
|
node->AddAttribute("bottom","60");
|
||||||
node->AddAttribute(_T("right"),_T("400"));
|
node->AddAttribute("right","400");
|
||||||
root->AddChild(node);
|
root->AddChild(node);
|
||||||
|
|
||||||
// Write style
|
// Write style
|
||||||
node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("Style"));
|
node = new wxXmlNode(wxXML_ELEMENT_NODE,"Style");
|
||||||
node->AddAttribute(_T("styles"),_T("Normal"));
|
node->AddAttribute("styles","Normal");
|
||||||
node->AddAttribute(_T("fontID"),_T("1"));
|
node->AddAttribute("fontID","1");
|
||||||
node->AddAttribute(_T("fontSize"),_T("18"));
|
node->AddAttribute("fontSize","18");
|
||||||
node->AddAttribute(_T("color"),_T("ff ff ff ff"));
|
node->AddAttribute("color","ff ff ff ff");
|
||||||
root->AddChild(node);
|
root->AddChild(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,19 +325,19 @@ void TTXTSubtitleFormat::WriteLine(wxXmlNode *root, AssDialogue *line) {
|
||||||
// If it doesn't start at the end of previous, add blank
|
// If it doesn't start at the end of previous, add blank
|
||||||
wxXmlNode *node,*subNode;
|
wxXmlNode *node,*subNode;
|
||||||
if (prev && prev->End != line->Start) {
|
if (prev && prev->End != line->Start) {
|
||||||
node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("TextSample"));
|
node = new wxXmlNode(wxXML_ELEMENT_NODE,"TextSample");
|
||||||
node->AddAttribute(_T("sampleTime"),_T("0") + prev->End.GetASSFormated(true));
|
node->AddAttribute("sampleTime","0" + prev->End.GetASSFormated(true));
|
||||||
node->AddAttribute(_T("xml:space"),_T("preserve"));
|
node->AddAttribute("xml:space","preserve");
|
||||||
subNode = new wxXmlNode(wxXML_TEXT_NODE,_T(""),_T(""));
|
subNode = new wxXmlNode(wxXML_TEXT_NODE,"","");
|
||||||
node->AddChild(subNode);
|
node->AddChild(subNode);
|
||||||
root->AddChild(node);
|
root->AddChild(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate and insert node
|
// Generate and insert node
|
||||||
node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("TextSample"));
|
node = new wxXmlNode(wxXML_ELEMENT_NODE,"TextSample");
|
||||||
node->AddAttribute(_T("sampleTime"),_T("0") + line->Start.GetASSFormated(true));
|
node->AddAttribute("sampleTime","0" + line->Start.GetASSFormated(true));
|
||||||
node->AddAttribute(_T("xml:space"),_T("preserve"));
|
node->AddAttribute("xml:space","preserve");
|
||||||
subNode = new wxXmlNode(wxXML_TEXT_NODE,_T(""),line->Text);
|
subNode = new wxXmlNode(wxXML_TEXT_NODE,"",line->Text);
|
||||||
node->AddChild(subNode);
|
node->AddChild(subNode);
|
||||||
root->AddChild(node);
|
root->AddChild(node);
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ void TTXTSubtitleFormat::ConvertToTTXT () {
|
||||||
StripComments();
|
StripComments();
|
||||||
RecombineOverlaps();
|
RecombineOverlaps();
|
||||||
MergeIdentical();
|
MergeIdentical();
|
||||||
ConvertTags(1,_T("\r\n"));
|
ConvertTags(1,"\r\n");
|
||||||
|
|
||||||
// Find last line
|
// Find last line
|
||||||
AssTime lastTime;
|
AssTime lastTime;
|
||||||
|
@ -371,8 +371,8 @@ void TTXTSubtitleFormat::ConvertToTTXT () {
|
||||||
AssDialogue *diag = new AssDialogue();
|
AssDialogue *diag = new AssDialogue();
|
||||||
diag->Start.SetMS(lastTime.GetMS());
|
diag->Start.SetMS(lastTime.GetMS());
|
||||||
diag->End.SetMS(lastTime.GetMS()+OPT_GET("Timing/Default Duration")->GetInt());
|
diag->End.SetMS(lastTime.GetMS()+OPT_GET("Timing/Default Duration")->GetInt());
|
||||||
diag->group = _T("[Events]");
|
diag->group = "[Events]";
|
||||||
diag->Style = _T("Default");
|
diag->Style = "Default";
|
||||||
diag->Comment = false;
|
diag->Comment = false;
|
||||||
Line->push_back(diag);
|
Line->push_back(diag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool TXTSubtitleFormat::CanReadFile(wxString filename) {
|
bool TXTSubtitleFormat::CanReadFile(wxString filename) {
|
||||||
return (filename.Right(4).Lower() == _T(".txt"));
|
return (filename.Right(4).Lower() == ".txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ bool TXTSubtitleFormat::CanReadFile(wxString filename) {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool TXTSubtitleFormat::CanWriteFile(wxString filename) {
|
bool TXTSubtitleFormat::CanWriteFile(wxString filename) {
|
||||||
return (filename.Right(4).Lower() == _T(".txt") && filename.Right(11).Lower() != _T(".encore.txt") && filename.Right(16).Lower() != _T(".transtation.txt"));
|
return (filename.Right(4).Lower() == ".txt" && filename.Right(11).Lower() != ".encore.txt" && filename.Right(16).Lower() != ".transtation.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ bool TXTSubtitleFormat::CanWriteFile(wxString filename) {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
wxString TXTSubtitleFormat::GetName() {
|
wxString TXTSubtitleFormat::GetName() {
|
||||||
return _T("Plain-Text");
|
return "Plain-Text";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ wxString TXTSubtitleFormat::GetName() {
|
||||||
///
|
///
|
||||||
wxArrayString TXTSubtitleFormat::GetReadWildcards() {
|
wxArrayString TXTSubtitleFormat::GetReadWildcards() {
|
||||||
wxArrayString formats;
|
wxArrayString formats;
|
||||||
formats.Add(_T("txt"));
|
formats.Add("txt");
|
||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,20 +129,20 @@ void TXTSubtitleFormat::ReadFile(wxString filename,wxString encoding) { using na
|
||||||
if(value.IsEmpty()) continue;
|
if(value.IsEmpty()) continue;
|
||||||
|
|
||||||
// Check if this isn't a timecodes file
|
// Check if this isn't a timecodes file
|
||||||
if (value.StartsWith(_T("# timecode"))) {
|
if (value.StartsWith("# timecode")) {
|
||||||
throw _T("File is a timecode file, cannot load as subtitles.");
|
throw "File is a timecode file, cannot load as subtitles.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read comment data
|
// Read comment data
|
||||||
isComment = false;
|
isComment = false;
|
||||||
if (comment != _T("") && value.Left(comment.Length()) == comment) {
|
if (comment != "" && value.Left(comment.Length()) == comment) {
|
||||||
isComment = true;
|
isComment = true;
|
||||||
value = value.Mid(comment.Length());
|
value = value.Mid(comment.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read actor data
|
// Read actor data
|
||||||
if (!isComment && separator != _T("")) {
|
if (!isComment && separator != "") {
|
||||||
if (value[0] != _T(' ') && value[0] != _T('\t')) {
|
if (value[0] != ' ' && value[0] != '\t') {
|
||||||
int pos = value.Find(separator);
|
int pos = value.Find(separator);
|
||||||
if (pos != wxNOT_FOUND) {
|
if (pos != wxNOT_FOUND) {
|
||||||
actor = value.Left(pos);
|
actor = value.Left(pos);
|
||||||
|
@ -159,12 +159,12 @@ void TXTSubtitleFormat::ReadFile(wxString filename,wxString encoding) { using na
|
||||||
|
|
||||||
// Sets line up
|
// Sets line up
|
||||||
line = new AssDialogue;
|
line = new AssDialogue;
|
||||||
line->group = _T("[Events]");
|
line->group = "[Events]";
|
||||||
line->Style = _T("Default");
|
line->Style = "Default";
|
||||||
if (isComment) line->Actor = _T("");
|
if (isComment) line->Actor = "";
|
||||||
else line->Actor = actor;
|
else line->Actor = actor;
|
||||||
if (value.IsEmpty()) {
|
if (value.IsEmpty()) {
|
||||||
line->Actor = _T("");
|
line->Actor = "";
|
||||||
isComment = true;
|
isComment = true;
|
||||||
}
|
}
|
||||||
line->Comment = isComment;
|
line->Comment = isComment;
|
||||||
|
@ -180,8 +180,8 @@ void TXTSubtitleFormat::ReadFile(wxString filename,wxString encoding) { using na
|
||||||
// No lines?
|
// No lines?
|
||||||
if (lines == 0) {
|
if (lines == 0) {
|
||||||
line = new AssDialogue;
|
line = new AssDialogue;
|
||||||
line->group = _T("[Events]");
|
line->group = "[Events]";
|
||||||
line->Style = _T("Default");
|
line->Style = "Default";
|
||||||
line->Start.SetMS(0);
|
line->Start.SetMS(0);
|
||||||
line->End.SetMS(OPT_GET("Timing/Default Duration")->GetInt());
|
line->End.SetMS(OPT_GET("Timing/Default Duration")->GetInt());
|
||||||
Line->push_back(line);
|
Line->push_back(line);
|
||||||
|
@ -222,11 +222,11 @@ void TXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) { using n
|
||||||
wxString out_line;
|
wxString out_line;
|
||||||
|
|
||||||
if (dia->Comment) {
|
if (dia->Comment) {
|
||||||
out_line = _T("# ");
|
out_line = "# ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (write_actors) {
|
if (write_actors) {
|
||||||
out_line += dia->Actor + _T(": ");
|
out_line += dia->Actor + ": ";
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString out_text;
|
wxString out_text;
|
||||||
|
@ -251,7 +251,7 @@ void TXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) { using n
|
||||||
else {
|
else {
|
||||||
// Not a dialogue line
|
// Not a dialogue line
|
||||||
// TODO: should any non-dia lines cause blank lines in output?
|
// TODO: should any non-dia lines cause blank lines in output?
|
||||||
//file.WriteLineToFile(_T(""));
|
//file.WriteLineToFile("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
bool CanReadFile(wxString filename);
|
bool CanReadFile(wxString filename);
|
||||||
bool CanWriteFile(wxString filename);
|
bool CanWriteFile(wxString filename);
|
||||||
void ReadFile(wxString filename,wxString forceEncoding);
|
void ReadFile(wxString filename,wxString forceEncoding);
|
||||||
void WriteFile(wxString filename, wxString encoding = _T(""));
|
void WriteFile(wxString filename, wxString encoding = "");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
///
|
///
|
||||||
SubtitlesProvider* SubtitlesProviderFactory::GetProvider() {
|
SubtitlesProvider* SubtitlesProviderFactory::GetProvider() {
|
||||||
std::vector<std::string> list = GetClasses(OPT_GET("Subtitle/Provider")->GetString());
|
std::vector<std::string> list = GetClasses(OPT_GET("Subtitle/Provider")->GetString());
|
||||||
if (list.empty()) throw _T("No subtitle providers are available.");
|
if (list.empty()) throw "No subtitle providers are available.";
|
||||||
|
|
||||||
// Get provider
|
// Get provider
|
||||||
wxString error;
|
wxString error;
|
||||||
|
@ -66,9 +66,9 @@ SubtitlesProvider* SubtitlesProviderFactory::GetProvider() {
|
||||||
if (provider) return provider;
|
if (provider) return provider;
|
||||||
}
|
}
|
||||||
catch (agi::UserCancelException const&) { throw; }
|
catch (agi::UserCancelException const&) { throw; }
|
||||||
catch (wxString err) { error += list[i] + _T(" factory: ") + err + _T("\n"); }
|
catch (wxString err) { error += list[i] + " factory: " + err + "\n"; }
|
||||||
catch (const wxChar *err) { error += list[i] + _T(" factory: ") + wxString(err) + _T("\n"); }
|
catch (const char *err) { error += list[i] + " factory: " + wxString(err) + "\n"; }
|
||||||
catch (...) { error += list[i] + _T(" factory: Unknown error\n"); }
|
catch (...) { error += list[i] + " factory: Unknown error\n"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Failed
|
// Failed
|
||||||
|
|
|
@ -78,7 +78,7 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
||||||
if (!renderer) {
|
if (!renderer) {
|
||||||
renderer = csri_renderer_default();
|
renderer = csri_renderer_default();
|
||||||
if (!renderer) {
|
if (!renderer) {
|
||||||
throw _T("No CSRI renderer available, cannot show subtitles. Try installing one or switch to another subtitle provider.");
|
throw "No CSRI renderer available, cannot show subtitles. Try installing one or switch to another subtitle provider.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,9 +92,9 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
||||||
// Open from disk
|
// Open from disk
|
||||||
else {
|
else {
|
||||||
if (tempfile.empty()) {
|
if (tempfile.empty()) {
|
||||||
tempfile = wxFileName::CreateTempFileName(_T("aegisub"));
|
tempfile = wxFileName::CreateTempFileName("aegisub");
|
||||||
wxRemoveFile(tempfile);
|
wxRemoveFile(tempfile);
|
||||||
tempfile += L".ass";
|
tempfile += ".ass";
|
||||||
}
|
}
|
||||||
subs->Save(tempfile,false,false,wxSTRING_ENCODING);
|
subs->Save(tempfile,false,false,wxSTRING_ENCODING);
|
||||||
instance.reset(csri_open_file(renderer,tempfile.utf8_str(),NULL), &csri_close);
|
instance.reset(csri_open_file(renderer,tempfile.utf8_str(),NULL), &csri_close);
|
||||||
|
|
|
@ -125,7 +125,7 @@ static void wait_for_cache_thread(FontConfigCacheThread const * const * const ca
|
||||||
if (!*cache_worker) return;
|
if (!*cache_worker) return;
|
||||||
|
|
||||||
bool canceled;
|
bool canceled;
|
||||||
DialogProgress *progress = new DialogProgress(AegisubApp::Get()->frame, L"", &canceled, L"Caching fonts", 0, 1);
|
DialogProgress *progress = new DialogProgress(AegisubApp::Get()->frame, "", &canceled, "Caching fonts", 0, 1);
|
||||||
progress->Show();
|
progress->Show();
|
||||||
while (*cache_worker) {
|
while (*cache_worker) {
|
||||||
if (canceled) throw agi::UserCancelException("Font caching cancelled");
|
if (canceled) throw agi::UserCancelException("Font caching cancelled");
|
||||||
|
@ -144,7 +144,7 @@ LibassSubtitlesProvider::LibassSubtitlesProvider(std::string) {
|
||||||
// Initialize renderer
|
// Initialize renderer
|
||||||
ass_track = NULL;
|
ass_track = NULL;
|
||||||
ass_renderer = ass_renderer_init(ass_library);
|
ass_renderer = ass_renderer_init(ass_library);
|
||||||
if (!ass_renderer) throw _T("ass_renderer_init failed");
|
if (!ass_renderer) throw "ass_renderer_init failed";
|
||||||
ass_set_font_scale(ass_renderer, 1.);
|
ass_set_font_scale(ass_renderer, 1.);
|
||||||
new FontConfigCacheThread(ass_renderer, &cache_worker);
|
new FontConfigCacheThread(ass_renderer, &cache_worker);
|
||||||
wait_for_cache_thread(&cache_worker);
|
wait_for_cache_thread(&cache_worker);
|
||||||
|
@ -163,12 +163,12 @@ LibassSubtitlesProvider::~LibassSubtitlesProvider() {
|
||||||
void LibassSubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
void LibassSubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
||||||
// Prepare subtitles
|
// Prepare subtitles
|
||||||
std::vector<char> data;
|
std::vector<char> data;
|
||||||
subs->SaveMemory(data,_T("UTF-8"));
|
subs->SaveMemory(data,"UTF-8");
|
||||||
|
|
||||||
// Load file
|
// Load file
|
||||||
if (ass_track) ass_free_track(ass_track);
|
if (ass_track) ass_free_track(ass_track);
|
||||||
ass_track = ass_read_memory(ass_library, &data[0], data.size(),(char *)"UTF-8");
|
ass_track = ass_read_memory(ass_library, &data[0], data.size(),(char *)"UTF-8");
|
||||||
if (!ass_track) throw _T("libass failed to load subtitles.");
|
if (!ass_track) throw "libass failed to load subtitles.";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
/// @param filename File to open
|
/// @param filename File to open
|
||||||
/// @param enc Encoding to use, or empty to autodetect
|
/// @param enc Encoding to use, or empty to autodetect
|
||||||
/// @param trim Whether to trim whitespace from lines read
|
/// @param trim Whether to trim whitespace from lines read
|
||||||
TextFileReader(wxString const& filename,wxString encoding=L"", bool trim=true);
|
TextFileReader(wxString const& filename,wxString encoding="", bool trim=true);
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
~TextFileReader();
|
~TextFileReader();
|
||||||
|
|
||||||
|
|
|
@ -81,9 +81,9 @@ TextFileWriter::~TextFileWriter() {
|
||||||
/// @param addLineBreak
|
/// @param addLineBreak
|
||||||
void TextFileWriter::WriteLineToFile(wxString line, bool addLineBreak) {
|
void TextFileWriter::WriteLineToFile(wxString line, bool addLineBreak) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (addLineBreak) line += L"\r\n";
|
if (addLineBreak) line += "\r\n";
|
||||||
#else
|
#else
|
||||||
if (addLineBreak) line += L"\n";
|
if (addLineBreak) line += "\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// On non-windows this cast does nothing
|
// On non-windows this cast does nothing
|
||||||
|
|
|
@ -74,18 +74,18 @@ wxTextCtrl(parent,id,value,pos,size,TimeEditWindowStyle | style,validator,name)
|
||||||
// Set validator
|
// Set validator
|
||||||
wxTextValidator val(wxFILTER_INCLUDE_CHAR_LIST);
|
wxTextValidator val(wxFILTER_INCLUDE_CHAR_LIST);
|
||||||
wxArrayString includes;
|
wxArrayString includes;
|
||||||
includes.Add(_T("0"));
|
includes.Add("0");
|
||||||
includes.Add(_T("1"));
|
includes.Add("1");
|
||||||
includes.Add(_T("2"));
|
includes.Add("2");
|
||||||
includes.Add(_T("3"));
|
includes.Add("3");
|
||||||
includes.Add(_T("4"));
|
includes.Add("4");
|
||||||
includes.Add(_T("5"));
|
includes.Add("5");
|
||||||
includes.Add(_T("6"));
|
includes.Add("6");
|
||||||
includes.Add(_T("7"));
|
includes.Add("7");
|
||||||
includes.Add(_T("8"));
|
includes.Add("8");
|
||||||
includes.Add(_T("9"));
|
includes.Add("9");
|
||||||
includes.Add(_T("."));
|
includes.Add(".");
|
||||||
includes.Add(_T(":"));
|
includes.Add(":");
|
||||||
val.SetIncludes(includes);
|
val.SetIncludes(includes);
|
||||||
SetValidator(val);
|
SetValidator(val);
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ void TimeEdit::UpdateTime(bool byUser) {
|
||||||
GetSelection(&start,&end);
|
GetSelection(&start,&end);
|
||||||
if (start == end) {
|
if (start == end) {
|
||||||
wxString nextChar = text.Mid(start,1);
|
wxString nextChar = text.Mid(start,1);
|
||||||
if (nextChar == _T(":") || nextChar == _T(".")) {
|
if (nextChar == ":" || nextChar == ".") {
|
||||||
wxString temp = text;
|
wxString temp = text;
|
||||||
text = temp.Left(start-1);
|
text = temp.Left(start-1);
|
||||||
text += nextChar;
|
text += nextChar;
|
||||||
|
|
|
@ -83,7 +83,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
TimeEdit(wxWindow* parent, wxWindowID id, const wxString& value = _T(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr);
|
TimeEdit(wxWindow* parent, wxWindowID id, const wxString& value = "", const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr);
|
||||||
|
|
||||||
void SetByFrame(bool enable);
|
void SetByFrame(bool enable);
|
||||||
void SetTime(AssTime time);
|
void SetTime(AssTime time);
|
||||||
|
|
|
@ -93,8 +93,8 @@ int CountMatches(wxString parent,wxString child) {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
wxString MakeRelativePath(wxString _path,wxString reference) {
|
wxString MakeRelativePath(wxString _path,wxString reference) {
|
||||||
if (_path.IsEmpty()) return _T("");
|
if (_path.IsEmpty()) return "";
|
||||||
if (_path.Left(1) == _T("?")) return _path;
|
if (_path.Left(1) == "?") return _path;
|
||||||
wxFileName path(_path);
|
wxFileName path(_path);
|
||||||
wxFileName refPath(reference);
|
wxFileName refPath(reference);
|
||||||
path.MakeRelativeTo(refPath.GetPath());
|
path.MakeRelativeTo(refPath.GetPath());
|
||||||
|
@ -109,8 +109,8 @@ wxString MakeRelativePath(wxString _path,wxString reference) {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
wxString DecodeRelativePath(wxString _path,wxString reference) {
|
wxString DecodeRelativePath(wxString _path,wxString reference) {
|
||||||
if (_path.IsEmpty()) return _T("");
|
if (_path.IsEmpty()) return "";
|
||||||
if (_path.Left(1) == _T("?")) return _path;
|
if (_path.Left(1) == "?") return _path;
|
||||||
wxFileName path(_path);
|
wxFileName path(_path);
|
||||||
wxFileName refPath(reference);
|
wxFileName refPath(reference);
|
||||||
if (!path.IsAbsolute()) path.MakeAbsolute(refPath.GetPath());
|
if (!path.IsAbsolute()) path.MakeAbsolute(refPath.GetPath());
|
||||||
|
@ -127,7 +127,7 @@ wxString DecodeRelativePath(wxString _path,wxString reference) {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
wxString AegiFloatToString(double value) {
|
wxString AegiFloatToString(double value) {
|
||||||
return wxString::Format(_T("%g"),value);
|
return wxString::Format("%g",value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Int to string
|
/// @brief Int to string
|
||||||
|
@ -135,7 +135,7 @@ wxString AegiFloatToString(double value) {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
wxString AegiIntegerToString(int value) {
|
wxString AegiIntegerToString(int value) {
|
||||||
return wxString::Format(_T("%i"),value);
|
return wxString::Format("%i",value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief There shall be no kiB, MiB stuff here Pretty reading of size
|
/// @brief There shall be no kiB, MiB stuff here Pretty reading of size
|
||||||
|
@ -145,12 +145,12 @@ wxString AegiIntegerToString(int value) {
|
||||||
wxString PrettySize(int bytes) {
|
wxString PrettySize(int bytes) {
|
||||||
// Suffixes
|
// Suffixes
|
||||||
wxArrayString suffix;
|
wxArrayString suffix;
|
||||||
suffix.Add(_T(""));
|
suffix.Add("");
|
||||||
suffix.Add(_T(" kB"));
|
suffix.Add(" kB");
|
||||||
suffix.Add(_T(" MB"));
|
suffix.Add(" MB");
|
||||||
suffix.Add(_T(" GB"));
|
suffix.Add(" GB");
|
||||||
suffix.Add(_T(" TB"));
|
suffix.Add(" TB");
|
||||||
suffix.Add(_T(" PB"));
|
suffix.Add(" PB");
|
||||||
|
|
||||||
// Set size
|
// Set size
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -166,9 +166,9 @@ wxString PrettySize(int bytes) {
|
||||||
|
|
||||||
// Set number of decimal places
|
// Set number of decimal places
|
||||||
wxString final;
|
wxString final;
|
||||||
if (size < 10) final = wxString::Format(_T("%.2f"),size);
|
if (size < 10) final = wxString::Format("%.2f",size);
|
||||||
else if (size < 100) final = wxString::Format(_T("%.1f"),size);
|
else if (size < 100) final = wxString::Format("%.1f",size);
|
||||||
else final = wxString::Format(_T("%.0f"),size);
|
else final = wxString::Format("%.0f",size);
|
||||||
return final + suffix[i];
|
return final + suffix[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,12 +334,12 @@ int AegiStringToInt(const wxString &str,int start,int end) {
|
||||||
for (int pos=start;pos<end;pos++) {
|
for (int pos=start;pos<end;pos++) {
|
||||||
// Get value and check if it's a number
|
// Get value and check if it's a number
|
||||||
int val = (int)(str[pos]);
|
int val = (int)(str[pos]);
|
||||||
if (val == _T(' ') || val == _T('\t')) continue;
|
if (val == ' ' || val == '\t') continue;
|
||||||
if (val == _T('-')) sign = -1;
|
if (val == '-') sign = -1;
|
||||||
if (val < _T('0') || val > _T('9')) break;
|
if (val < '0' || val > '9') break;
|
||||||
|
|
||||||
// Shift value to next decimal place and increment the value just read
|
// Shift value to next decimal place and increment the value just read
|
||||||
value = value * 10 + (val - _T('0'));
|
value = value * 10 + (val - '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
return value*sign;
|
return value*sign;
|
||||||
|
@ -368,19 +368,19 @@ int AegiStringToFix(const wxString &str,size_t decimalPlaces,int start,int end)
|
||||||
for (int pos=start;pos<end;pos++) {
|
for (int pos=start;pos<end;pos++) {
|
||||||
// Get value and check if it's a number
|
// Get value and check if it's a number
|
||||||
int val = (int)(str[pos]);
|
int val = (int)(str[pos]);
|
||||||
if (val == _T(' ') || val == _T('\t')) continue;
|
if (val == ' ' || val == '\t') continue;
|
||||||
if (val == _T('-')) sign = -1;
|
if (val == '-') sign = -1;
|
||||||
|
|
||||||
// Switch to minor
|
// Switch to minor
|
||||||
if (val == _T('.') || val == _T(',')) {
|
if (val == '.' || val == ',') {
|
||||||
if (inMinor) break;
|
if (inMinor) break;
|
||||||
inMinor = true;
|
inMinor = true;
|
||||||
dst = &minor;
|
dst = &minor;
|
||||||
mCount = 0;
|
mCount = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (val < _T('0') || val > _T('9')) break;
|
if (val < '0' || val > '9') break;
|
||||||
*dst = (*dst * 10) + (val - _T('0'));
|
*dst = (*dst * 10) + (val - '0');
|
||||||
mCount++;
|
mCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,12 +432,12 @@ wxIcon BitmapToIcon(wxBitmap iconBmp) {
|
||||||
void RestartAegisub() {
|
void RestartAegisub() {
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
wxStandardPaths stand;
|
wxStandardPaths stand;
|
||||||
wxExecute(_T("\"") + stand.GetExecutablePath() + _T("\""));
|
wxExecute("\"" + stand.GetExecutablePath() + "\"");
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
char *bundle_path = agi::util::OSX_GetBundlePath();
|
char *bundle_path = agi::util::OSX_GetBundlePath();
|
||||||
char *support_path = agi::util::OSX_GetBundleSupportFilesDirectory();
|
char *support_path = agi::util::OSX_GetBundleSupportFilesDirectory();
|
||||||
if (!bundle_path || !support_path) return; // oops
|
if (!bundle_path || !support_path) return; // oops
|
||||||
wxString exec = wxString::Format(_T("\"%s/MacOS/restart-helper\" /usr/bin/open -n \"%s\"'"), wxString(support_path, wxConvUTF8).c_str(), wxString(bundle_path, wxConvUTF8).c_str());
|
wxString exec = wxString::Format("\"%s/MacOS/restart-helper\" /usr/bin/open -n \"%s\"'", wxString(support_path, wxConvUTF8).c_str(), wxString(bundle_path, wxConvUTF8).c_str());
|
||||||
LOG_I("util/restart/exec") << exec;
|
LOG_I("util/restart/exec") << exec;
|
||||||
wxExecute(exec);
|
wxExecute(exec);
|
||||||
free(bundle_path);
|
free(bundle_path);
|
||||||
|
|
|
@ -126,7 +126,7 @@ void VariableData::ResetWith(wxString value) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VARDATA_BOOL:
|
case VARDATA_BOOL:
|
||||||
if (value == _T("1")) Set(true);
|
if (value == "1") Set(true);
|
||||||
else Set(false);
|
else Set(false);
|
||||||
break;
|
break;
|
||||||
case VARDATA_COLOUR: {
|
case VARDATA_COLOUR: {
|
||||||
|
@ -146,74 +146,74 @@ void VariableData::ResetWith(wxString value) {
|
||||||
/// @brief Reads as an int
|
/// @brief Reads as an int
|
||||||
/// @return
|
/// @return
|
||||||
template<> int VariableData::Get<int>() const {
|
template<> int VariableData::Get<int>() const {
|
||||||
if (!value) throw _T("Null parameter");
|
if (!value) throw "Null parameter";
|
||||||
if (type == VARDATA_BOOL) return !!(*value_bool);
|
if (type == VARDATA_BOOL) return !!(*value_bool);
|
||||||
if (type == VARDATA_INT) return *value_int;
|
if (type == VARDATA_INT) return *value_int;
|
||||||
if (type == VARDATA_FLOAT) return (int)(*value_float);
|
if (type == VARDATA_FLOAT) return (int)(*value_float);
|
||||||
if (type == VARDATA_TEXT) return 0;
|
if (type == VARDATA_TEXT) return 0;
|
||||||
throw _T("Wrong parameter type, should be int");
|
throw "Wrong parameter type, should be int";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Reads as a float
|
/// @brief Reads as a float
|
||||||
/// @return
|
/// @return
|
||||||
template<> float VariableData::Get<float>() const {
|
template<> float VariableData::Get<float>() const {
|
||||||
if (!value) throw _T("Null parameter");
|
if (!value) throw "Null parameter";
|
||||||
if (type == VARDATA_FLOAT) return (float)*value_float;
|
if (type == VARDATA_FLOAT) return (float)*value_float;
|
||||||
if (type == VARDATA_INT) return (float)(*value_int);
|
if (type == VARDATA_INT) return (float)(*value_int);
|
||||||
if (type == VARDATA_TEXT) return 0.0f;
|
if (type == VARDATA_TEXT) return 0.0f;
|
||||||
throw _T("Wrong parameter type, should be float");
|
throw "Wrong parameter type, should be float";
|
||||||
}
|
}
|
||||||
template<> double VariableData::Get<double>() const {
|
template<> double VariableData::Get<double>() const {
|
||||||
if (!value) throw _T("Null parameter");
|
if (!value) throw "Null parameter";
|
||||||
if (type == VARDATA_FLOAT) return *value_float;
|
if (type == VARDATA_FLOAT) return *value_float;
|
||||||
if (type == VARDATA_INT) return (float)(*value_int);
|
if (type == VARDATA_INT) return (float)(*value_int);
|
||||||
if (type == VARDATA_TEXT) return 0.0;
|
if (type == VARDATA_TEXT) return 0.0;
|
||||||
throw _T("Wrong parameter type, should be float");
|
throw "Wrong parameter type, should be float";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Reads as a bool
|
/// @brief Reads as a bool
|
||||||
/// @return
|
/// @return
|
||||||
template<> bool VariableData::Get<bool>() const {
|
template<> bool VariableData::Get<bool>() const {
|
||||||
if (!value) throw _T("Null parameter");
|
if (!value) throw "Null parameter";
|
||||||
if (type == VARDATA_BOOL) return *value_bool;
|
if (type == VARDATA_BOOL) return *value_bool;
|
||||||
if (type == VARDATA_INT) return ((*value_int)!=0);
|
if (type == VARDATA_INT) return ((*value_int)!=0);
|
||||||
if (type == VARDATA_FLOAT) return ((*value_float)!=0);
|
if (type == VARDATA_FLOAT) return ((*value_float)!=0);
|
||||||
if (type == VARDATA_TEXT) return false;
|
if (type == VARDATA_TEXT) return false;
|
||||||
throw _T("Wrong parameter type, should be bool");
|
throw "Wrong parameter type, should be bool";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Reads as a colour
|
/// @brief Reads as a colour
|
||||||
/// @return
|
/// @return
|
||||||
template<> wxColour VariableData::Get<wxColour>() const {
|
template<> wxColour VariableData::Get<wxColour>() const {
|
||||||
if (!value) throw _T("Null parameter");
|
if (!value) throw "Null parameter";
|
||||||
if (type == VARDATA_COLOUR) return *value_colour;
|
if (type == VARDATA_COLOUR) return *value_colour;
|
||||||
else if (type == VARDATA_TEXT) {
|
else if (type == VARDATA_TEXT) {
|
||||||
AssColor color;
|
AssColor color;
|
||||||
color.Parse(*value_text);
|
color.Parse(*value_text);
|
||||||
return color.GetWXColor();
|
return color.GetWXColor();
|
||||||
}
|
}
|
||||||
else throw _T("Wrong parameter type, should be colour");
|
else throw "Wrong parameter type, should be colour";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Reads as a block
|
/// @brief Reads as a block
|
||||||
/// @return
|
/// @return
|
||||||
template<> AssDialogueBlockOverride *VariableData::Get<AssDialogueBlockOverride *>() const {
|
template<> AssDialogueBlockOverride *VariableData::Get<AssDialogueBlockOverride *>() const {
|
||||||
if (!value) throw _T("Null parameter");
|
if (!value) throw "Null parameter";
|
||||||
if (type != VARDATA_BLOCK) throw _T("Wrong parameter type, should be block");
|
if (type != VARDATA_BLOCK) throw "Wrong parameter type, should be block";
|
||||||
return *value_block;
|
return *value_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Reads as a string
|
/// @brief Reads as a string
|
||||||
/// @return
|
/// @return
|
||||||
template<> wxString VariableData::Get<wxString>() const {
|
template<> wxString VariableData::Get<wxString>() const {
|
||||||
if (!value) throw _T("Null parameter");
|
if (!value) throw "Null parameter";
|
||||||
if (type != VARDATA_TEXT) {
|
if (type != VARDATA_TEXT) {
|
||||||
if (type == VARDATA_INT) return wxString::Format("%i",*value_int);
|
if (type == VARDATA_INT) return wxString::Format("%i",*value_int);
|
||||||
else if (type == VARDATA_FLOAT) return wxString::Format("%g",*value_float);
|
else if (type == VARDATA_FLOAT) return wxString::Format("%g",*value_float);
|
||||||
else if (type == VARDATA_COLOUR) return wxString::Format("#%02X%02X%02X",value_colour->Red(),value_colour->Green(),value_colour->Blue());
|
else if (type == VARDATA_COLOUR) return wxString::Format("#%02X%02X%02X",value_colour->Red(),value_colour->Green(),value_colour->Blue());
|
||||||
else if (type == VARDATA_BOOL) return *value_bool ? "1" : "0";
|
else if (type == VARDATA_BOOL) return *value_bool ? "1" : "0";
|
||||||
else if (type == VARDATA_BLOCK) return (*value_block)->GetText();
|
else if (type == VARDATA_BLOCK) return (*value_block)->GetText();
|
||||||
else throw _T("Wrong parameter type, should be text");
|
else throw "Wrong parameter type, should be text";
|
||||||
}
|
}
|
||||||
return *value_text;
|
return *value_text;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ VideoContext *VideoContext::Get() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoContext::Reset() {
|
void VideoContext::Reset() {
|
||||||
StandardPaths::SetPathValue(_T("?video"), "");
|
StandardPaths::SetPathValue("?video", "");
|
||||||
|
|
||||||
keyFrames.clear();
|
keyFrames.clear();
|
||||||
keyFramesFilename.clear();
|
keyFramesFilename.clear();
|
||||||
|
@ -186,17 +186,17 @@ void VideoContext::SetVideo(const wxString &filename) {
|
||||||
videoName = filename;
|
videoName = filename;
|
||||||
config::mru->Add("Video", STD_STR(filename));
|
config::mru->Add("Video", STD_STR(filename));
|
||||||
wxFileName fn(filename);
|
wxFileName fn(filename);
|
||||||
StandardPaths::SetPathValue(_T("?video"),fn.GetPath());
|
StandardPaths::SetPathValue("?video",fn.GetPath());
|
||||||
|
|
||||||
// Get frame
|
// Get frame
|
||||||
frame_n = 0;
|
frame_n = 0;
|
||||||
|
|
||||||
// Show warning
|
// Show warning
|
||||||
wxString warning = videoProvider->GetWarning();
|
wxString warning = videoProvider->GetWarning();
|
||||||
if (!warning.empty()) wxMessageBox(warning,_T("Warning"),wxICON_WARNING | wxOK);
|
if (!warning.empty()) wxMessageBox(warning,"Warning",wxICON_WARNING | wxOK);
|
||||||
|
|
||||||
hasSubtitles = false;
|
hasSubtitles = false;
|
||||||
if (filename.Right(4).Lower() == L".mkv") {
|
if (filename.Right(4).Lower() == ".mkv") {
|
||||||
hasSubtitles = MatroskaWrapper::HasSubtitles(filename);
|
hasSubtitles = MatroskaWrapper::HasSubtitles(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,10 +208,10 @@ void VideoContext::SetVideo(const wxString &filename) {
|
||||||
catch (agi::UserCancelException const&) { }
|
catch (agi::UserCancelException const&) { }
|
||||||
catch (agi::FileNotAccessibleError const& err) {
|
catch (agi::FileNotAccessibleError const& err) {
|
||||||
config::mru->Remove("Video", STD_STR(filename));
|
config::mru->Remove("Video", STD_STR(filename));
|
||||||
wxMessageBox(lagi_wxString(err.GetMessage()), L"Error setting video", wxICON_ERROR | wxOK);
|
wxMessageBox(lagi_wxString(err.GetMessage()), "Error setting video", wxICON_ERROR | wxOK);
|
||||||
}
|
}
|
||||||
catch (VideoProviderError const& err) {
|
catch (VideoProviderError const& err) {
|
||||||
wxMessageBox(lagi_wxString(err.GetMessage()), L"Error setting video", wxICON_ERROR | wxOK);
|
wxMessageBox(lagi_wxString(err.GetMessage()), "Error setting video", wxICON_ERROR | wxOK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,29 +295,29 @@ void VideoContext::SaveSnapshot(bool raw) {
|
||||||
wxFileName videoFile(videoName);
|
wxFileName videoFile(videoName);
|
||||||
wxString basepath;
|
wxString basepath;
|
||||||
// Is it a path specifier and not an actual fixed path?
|
// Is it a path specifier and not an actual fixed path?
|
||||||
if (option[0] == _T('?')) {
|
if (option[0] == '?') {
|
||||||
// If dummy video is loaded, we can't save to the video location
|
// If dummy video is loaded, we can't save to the video location
|
||||||
if (option.StartsWith(_T("?video")) && (videoName.Find(_T("?dummy")) != wxNOT_FOUND)) {
|
if (option.StartsWith("?video") && (videoName.Find("?dummy") != wxNOT_FOUND)) {
|
||||||
// So try the script location instead
|
// So try the script location instead
|
||||||
option = _T("?script");
|
option = "?script";
|
||||||
}
|
}
|
||||||
// Find out where the ?specifier points to
|
// Find out where the ?specifier points to
|
||||||
basepath = StandardPaths::DecodePath(option);
|
basepath = StandardPaths::DecodePath(option);
|
||||||
// If where ever that is isn't defined, we can't save there
|
// If where ever that is isn't defined, we can't save there
|
||||||
if ((basepath == _T("\\")) || (basepath == _T("/"))) {
|
if ((basepath == "\\") || (basepath == "/")) {
|
||||||
// So save to the current user's home dir instead
|
// So save to the current user's home dir instead
|
||||||
basepath = wxGetHomeDir();
|
basepath = wxGetHomeDir();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Actual fixed (possibly relative) path, decode it
|
// Actual fixed (possibly relative) path, decode it
|
||||||
else basepath = DecodeRelativePath(option,StandardPaths::DecodePath(_T("?user/")));
|
else basepath = DecodeRelativePath(option,StandardPaths::DecodePath("?user/"));
|
||||||
basepath += _T("/") + videoFile.GetName();
|
basepath += "/" + videoFile.GetName();
|
||||||
|
|
||||||
// Get full path
|
// Get full path
|
||||||
int session_shot_count = 1;
|
int session_shot_count = 1;
|
||||||
wxString path;
|
wxString path;
|
||||||
while (1) {
|
while (1) {
|
||||||
path = basepath + wxString::Format(_T("_%03i_%i.png"),session_shot_count,frame_n);
|
path = basepath + wxString::Format("_%03i_%i.png",session_shot_count,frame_n);
|
||||||
++session_shot_count;
|
++session_shot_count;
|
||||||
wxFileName tryPath(path);
|
wxFileName tryPath(path);
|
||||||
if (!tryPath.FileExists()) break;
|
if (!tryPath.FileExists()) break;
|
||||||
|
@ -500,7 +500,7 @@ void VideoContext::LoadKeyframes(wxString filename) {
|
||||||
config::mru->Remove("Keyframes", STD_STR(filename));
|
config::mru->Remove("Keyframes", STD_STR(filename));
|
||||||
}
|
}
|
||||||
catch (agi::acs::AcsError const&) {
|
catch (agi::acs::AcsError const&) {
|
||||||
wxLogError(L"Could not open file " + filename);
|
wxLogError("Could not open file " + filename);
|
||||||
config::mru->Remove("Keyframes", STD_STR(filename));
|
config::mru->Remove("Keyframes", STD_STR(filename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,11 +531,11 @@ void VideoContext::LoadTimecodes(wxString filename) {
|
||||||
TimecodesOpen(ovrFPS);
|
TimecodesOpen(ovrFPS);
|
||||||
}
|
}
|
||||||
catch (const agi::acs::AcsError&) {
|
catch (const agi::acs::AcsError&) {
|
||||||
wxLogError(L"Could not open file " + filename);
|
wxLogError("Could not open file " + filename);
|
||||||
config::mru->Remove("Timecodes", STD_STR(filename));
|
config::mru->Remove("Timecodes", STD_STR(filename));
|
||||||
}
|
}
|
||||||
catch (const agi::vfr::Error& e) {
|
catch (const agi::vfr::Error& e) {
|
||||||
wxLogError(L"Timecode file parse error: %s", e.GetMessage().c_str());
|
wxLogError("Timecode file parse error: %s", e.GetMessage().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void VideoContext::SaveTimecodes(wxString filename) {
|
void VideoContext::SaveTimecodes(wxString filename) {
|
||||||
|
@ -544,7 +544,7 @@ void VideoContext::SaveTimecodes(wxString filename) {
|
||||||
config::mru->Add("Timecodes", STD_STR(filename));
|
config::mru->Add("Timecodes", STD_STR(filename));
|
||||||
}
|
}
|
||||||
catch(const agi::acs::AcsError&) {
|
catch(const agi::acs::AcsError&) {
|
||||||
wxLogError(L"Could not write to " + filename);
|
wxLogError("Could not write to " + filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void VideoContext::CloseTimecodes() {
|
void VideoContext::CloseTimecodes() {
|
||||||
|
@ -569,13 +569,13 @@ int VideoContext::FrameAtTime(int time, agi::vfr::Time type) const {
|
||||||
|
|
||||||
void VideoContext::OnVideoError(VideoProviderErrorEvent const& err) {
|
void VideoContext::OnVideoError(VideoProviderErrorEvent const& err) {
|
||||||
wxLogError(
|
wxLogError(
|
||||||
L"Failed seeking video. The video file may be corrupt or incomplete.\n"
|
"Failed seeking video. The video file may be corrupt or incomplete.\n"
|
||||||
L"Error message reported: %s",
|
"Error message reported: %s",
|
||||||
lagi_wxString(err.GetMessage()).c_str());
|
lagi_wxString(err.GetMessage()).c_str());
|
||||||
}
|
}
|
||||||
void VideoContext::OnSubtitlesError(SubtitlesProviderErrorEvent const& err) {
|
void VideoContext::OnSubtitlesError(SubtitlesProviderErrorEvent const& err) {
|
||||||
wxLogError(
|
wxLogError(
|
||||||
L"Failed rendering subtitles. Error message reported: %s",
|
"Failed rendering subtitles. Error message reported: %s",
|
||||||
lagi_wxString(err.GetMessage()).c_str());
|
lagi_wxString(err.GetMessage()).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,14 +85,14 @@ int attribList[] = { WX_GL_RGBA , WX_GL_DOUBLEBUFFER, WX_GL_STENCIL_SIZE, 8, 0 }
|
||||||
/// @brief An OpenGL error occurred while uploading or displaying a frame
|
/// @brief An OpenGL error occurred while uploading or displaying a frame
|
||||||
class OpenGlException : public agi::Exception {
|
class OpenGlException : public agi::Exception {
|
||||||
public:
|
public:
|
||||||
OpenGlException(const wxChar *func, int err)
|
OpenGlException(const char *func, int err)
|
||||||
: agi::Exception(STD_STR(wxString::Format("%s failed with error code %d", func, err)))
|
: agi::Exception(STD_STR(wxString::Format("%s failed with error code %d", func, err)))
|
||||||
{ }
|
{ }
|
||||||
const char * GetName() const { return "video/opengl"; }
|
const char * GetName() const { return "video/opengl"; }
|
||||||
Exception * Copy() const { return new OpenGlException(*this); }
|
Exception * Copy() const { return new OpenGlException(*this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define E(cmd) cmd; if (GLenum err = glGetError()) throw OpenGlException(L###cmd, err)
|
#define E(cmd) cmd; if (GLenum err = glGetError()) throw OpenGlException(#cmd, err)
|
||||||
|
|
||||||
VideoDisplay::VideoDisplay(
|
VideoDisplay::VideoDisplay(
|
||||||
VideoBox *box,
|
VideoBox *box,
|
||||||
|
@ -188,16 +188,16 @@ void VideoDisplay::UploadFrameData(FrameReadyEvent &evt) {
|
||||||
}
|
}
|
||||||
catch (const VideoOutInitException& err) {
|
catch (const VideoOutInitException& err) {
|
||||||
wxLogError(
|
wxLogError(
|
||||||
L"Failed to initialize video display. Closing other running "
|
"Failed to initialize video display. Closing other running "
|
||||||
L"programs and updating your video card drivers may fix this.\n"
|
"programs and updating your video card drivers may fix this.\n"
|
||||||
L"Error message reported: %s",
|
"Error message reported: %s",
|
||||||
err.GetMessage().c_str());
|
err.GetMessage().c_str());
|
||||||
con->videoController->Reset();
|
con->videoController->Reset();
|
||||||
}
|
}
|
||||||
catch (const VideoOutRenderException& err) {
|
catch (const VideoOutRenderException& err) {
|
||||||
wxLogError(
|
wxLogError(
|
||||||
L"Could not upload video frame to graphics card.\n"
|
"Could not upload video frame to graphics card.\n"
|
||||||
L"Error message reported: %s",
|
"Error message reported: %s",
|
||||||
err.GetMessage().c_str());
|
err.GetMessage().c_str());
|
||||||
}
|
}
|
||||||
Render();
|
Render();
|
||||||
|
@ -256,29 +256,29 @@ void VideoDisplay::Render() try {
|
||||||
}
|
}
|
||||||
catch (const VideoOutException &err) {
|
catch (const VideoOutException &err) {
|
||||||
wxLogError(
|
wxLogError(
|
||||||
L"An error occurred trying to render the video frame on the screen.\n"
|
"An error occurred trying to render the video frame on the screen.\n"
|
||||||
L"Error message reported: %s",
|
"Error message reported: %s",
|
||||||
err.GetMessage().c_str());
|
err.GetMessage().c_str());
|
||||||
con->videoController->Reset();
|
con->videoController->Reset();
|
||||||
}
|
}
|
||||||
catch (const OpenGlException &err) {
|
catch (const OpenGlException &err) {
|
||||||
wxLogError(
|
wxLogError(
|
||||||
L"An error occurred trying to render visual overlays on the screen.\n"
|
"An error occurred trying to render visual overlays on the screen.\n"
|
||||||
L"Error message reported: %s",
|
"Error message reported: %s",
|
||||||
err.GetMessage().c_str());
|
err.GetMessage().c_str());
|
||||||
con->videoController->Reset();
|
con->videoController->Reset();
|
||||||
}
|
}
|
||||||
catch (const wchar_t *err) {
|
catch (const char *err) {
|
||||||
wxLogError(
|
wxLogError(
|
||||||
L"An error occurred trying to render the video frame on the screen.\n"
|
"An error occurred trying to render the video frame on the screen.\n"
|
||||||
L"Error message reported: %s",
|
"Error message reported: %s",
|
||||||
err);
|
err);
|
||||||
con->videoController->Reset();
|
con->videoController->Reset();
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
wxLogError(
|
wxLogError(
|
||||||
L"An error occurred trying to render the video frame to screen.\n"
|
"An error occurred trying to render the video frame to screen.\n"
|
||||||
L"No further error message given.");
|
"No further error message given.");
|
||||||
con->videoController->Reset();
|
con->videoController->Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ void VideoDisplay::SetZoom(double value) {
|
||||||
}
|
}
|
||||||
void VideoDisplay::SetZoomFromBox(wxCommandEvent &) {
|
void VideoDisplay::SetZoomFromBox(wxCommandEvent &) {
|
||||||
wxString strValue = zoomBox->GetValue();
|
wxString strValue = zoomBox->GetValue();
|
||||||
strValue.EndsWith(L"%", &strValue);
|
strValue.EndsWith("%", &strValue);
|
||||||
double value;
|
double value;
|
||||||
if (strValue.ToDouble(&value)) {
|
if (strValue.ToDouble(&value)) {
|
||||||
zoomValue = value / 100.;
|
zoomValue = value / 100.;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue