Now allows for BdnXml to have multiple images for each line in a paragraph - thx mboy :)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@686 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-10-02 19:31:34 +00:00
parent 50b4dfd1e2
commit e54a79e1d7
4 changed files with 46 additions and 2572 deletions

View File

@ -709,10 +709,48 @@ namespace Nikse.SubtitleEdit.Forms
{
if (index >= 0 && index < _bdnXmlSubtitle.Paragraphs.Count)
{
string fileName = Path.Combine(Path.GetDirectoryName(_bdnFileName), _bdnXmlSubtitle.Paragraphs[index].Text);
if (File.Exists(fileName))
string[] fileNames = _bdnXmlSubtitle.Paragraphs[index].Text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
var bitmaps = new List<Bitmap>();
int maxWidth = 0;
int totalHeight = 0;
foreach (string fn in fileNames)
{
string fullFileName = Path.Combine(Path.GetDirectoryName(_bdnFileName), fn);
if (File.Exists(fullFileName))
{
var temp = new Bitmap(fullFileName);
if (temp.Width > maxWidth)
maxWidth = temp.Width;
totalHeight += temp.Height;
bitmaps.Add(temp);
}
}
Bitmap b = null;
if (bitmaps.Count > 1)
{
var merged = new Bitmap(maxWidth, totalHeight + 7 * bitmaps.Count);
int y = 0;
for (int k=0; k<bitmaps.Count; k++)
{
Bitmap part = bitmaps[k];
if (checkBoxAutoTransparentBackground.Checked)
part.MakeTransparent();
using (var g = Graphics.FromImage(merged))
g.DrawImage(part, 0, y);
y += part.Height + 7;
part.Dispose();
}
b = merged;
}
else if (bitmaps.Count == 1)
{
b = bitmaps[0];
}
if (b != null)
{
Bitmap b = new Bitmap(fileName);
if (_isSon && checkBoxCustomFourColors.Checked)
{
GetCustomColors(out background, out pattern, out emphasis1, out emphasis2);
@ -2744,7 +2782,7 @@ namespace Nikse.SubtitleEdit.Forms
string fileName = openFileDialog1.FileName;
if (!File.Exists(fileName))
return;
var fi = new FileInfo(fileName);
if (fi.Length > 1024 * 1024 * 10) // max 10 mb
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -102,8 +102,10 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
string start = node.Attributes["InTC"].InnerText;
string end = node.Attributes["OutTC"].InnerText;
string text = node.SelectSingleNode("Graphic").InnerText;
Paragraph p = new Paragraph(text, GetMillisecondsFromTimeCode(start), GetMillisecondsFromTimeCode(end));
StringBuilder textBuilder = new StringBuilder();
foreach (XmlNode graphic in node.SelectNodes("Graphic"))
textBuilder.AppendLine(graphic.InnerText);
Paragraph p = new Paragraph(textBuilder.ToString().Trim(), GetMillisecondsFromTimeCode(start), GetMillisecondsFromTimeCode(end));
if (node.Attributes["Forced"] != null && node.Attributes["Forced"].Value.ToLower() == "true")
p.Forced = true;
subtitle.Paragraphs.Add(p);