From 30a9bdc17c45ed0219c34a909956a543d565a69b Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Sun, 20 Jul 2008 13:34:42 +0000 Subject: [PATCH] Implement/fix #751 and update changelog a bit. Originally committed to SVN as r2270. --- aegisub/changelog.txt | 2 ++ aegisub/subtitle_format_transtation.cpp | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/aegisub/changelog.txt b/aegisub/changelog.txt index 7a84e34ab..c035a2dae 100644 --- a/aegisub/changelog.txt +++ b/aegisub/changelog.txt @@ -4,6 +4,7 @@ Please visit http://aegisub.net to download latest version = 2.2.0 - 2008.xx.xx =========================== - New Aegisub logo. (amz) +- Icon redrawn and new high-resolution versions produced. (jfs) - The Automation 4 system has been introduced. This means lots of changes. (jfs) o The Lua engine is now based on Lua 5.1, which means a few new language features. o A Ruby 1.9-based scripting engine has been added (Pomyk) @@ -98,6 +99,7 @@ Please visit http://aegisub.net to download latest version o Added very basic reading support for MPEG-4 Streaming Text (TTXT) subtitles. (amz) o Added full read-write support for MicroDVD subtitles (the most common .sub format). (amz) o Added support for writing Adobe Encore subtitles, both PAL and NTSC. (amz) + o Added support for writing TranStation subtitle format. (amz/jfs) - Changes to main menu: o There are now new options, and most were moved around to have better organization. (amz/jfs) o General tweaks changes, such as better icons, and fixing of flickering and slowness. (amz) diff --git a/aegisub/subtitle_format_transtation.cpp b/aegisub/subtitle_format_transtation.cpp index 79170b475..6cf260078 100644 --- a/aegisub/subtitle_format_transtation.cpp +++ b/aegisub/subtitle_format_transtation.cpp @@ -92,8 +92,8 @@ void TranStationSubtitleFormat::WriteFile(wxString _filename,wxString encoding) // Get line data AssStyle *style = GetAssFile()->GetStyle(current->Style); int valign = 0; - wxChar *halign = _T("C"); - wxChar *type = _T("N"); + wxChar *halign = _T(" "); // default is centered + wxChar *type = _T("N"); // no special style if (style) { if (style->alignment >= 4) valign = 4; if (style->alignment >= 7) valign = 9; @@ -102,16 +102,18 @@ void TranStationSubtitleFormat::WriteFile(wxString _filename,wxString encoding) if (style->italic) type = _T("I"); } + // Hack: If an italics-tag (\i1) appears anywhere in the line, + // make it all italics + if (current->Text.Find(_T("\i1")) != wxNOT_FOUND)type = _T("I"); + // Write header AssTime start = current->Start; AssTime end = current->End; - // Subtract one frame duration from end time, since it is inclusive + // Subtract half a frame duration from end time, since it is inclusive // and we otherwise run the risk of having two lines overlap in a // frame, when they should run right into each other. - printf("Before adjusting end: %d fps=%f to subtract=%d\n", end.GetMS(), fps, (int)(500.0/fps)); end.SetMS(end.GetMS() - (int)(500.0/fps)); - printf("After adjusting end: %d\n", end.GetMS()); - wxString header = wxString::Format(_T("SUB[ %i%s%s "),valign,halign,type) + start.GetSMPTE(fps) + _T(">") + end.GetSMPTE(fps) + _T("]"); + wxString header = wxString::Format(_T("SUB[%i%s%s "),valign,halign,type) + start.GetSMPTE(fps) + _T(">") + end.GetSMPTE(fps) + _T("]"); file.WriteLineToFile(header); // Process text @@ -128,6 +130,9 @@ void TranStationSubtitleFormat::WriteFile(wxString _filename,wxString encoding) } } + // Every file must end with this line + file.WriteLineToFile(_T("SUB[")); + // Clean up ClearCopy(); }