mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
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:
parent
50b4dfd1e2
commit
e54a79e1d7
@ -709,10 +709,48 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
if (index >= 0 && index < _bdnXmlSubtitle.Paragraphs.Count)
|
if (index >= 0 && index < _bdnXmlSubtitle.Paragraphs.Count)
|
||||||
{
|
{
|
||||||
string fileName = Path.Combine(Path.GetDirectoryName(_bdnFileName), _bdnXmlSubtitle.Paragraphs[index].Text);
|
string[] fileNames = _bdnXmlSubtitle.Paragraphs[index].Text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||||
if (File.Exists(fileName))
|
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)
|
if (_isSon && checkBoxCustomFourColors.Checked)
|
||||||
{
|
{
|
||||||
GetCustomColors(out background, out pattern, out emphasis1, out emphasis2);
|
GetCustomColors(out background, out pattern, out emphasis1, out emphasis2);
|
||||||
@ -2744,7 +2782,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
string fileName = openFileDialog1.FileName;
|
string fileName = openFileDialog1.FileName;
|
||||||
if (!File.Exists(fileName))
|
if (!File.Exists(fileName))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var fi = new FileInfo(fileName);
|
var fi = new FileInfo(fileName);
|
||||||
if (fi.Length > 1024 * 1024 * 10) // max 10 mb
|
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
@ -102,8 +102,10 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
|||||||
{
|
{
|
||||||
string start = node.Attributes["InTC"].InnerText;
|
string start = node.Attributes["InTC"].InnerText;
|
||||||
string end = node.Attributes["OutTC"].InnerText;
|
string end = node.Attributes["OutTC"].InnerText;
|
||||||
string text = node.SelectSingleNode("Graphic").InnerText;
|
StringBuilder textBuilder = new StringBuilder();
|
||||||
Paragraph p = new Paragraph(text, GetMillisecondsFromTimeCode(start), GetMillisecondsFromTimeCode(end));
|
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")
|
if (node.Attributes["Forced"] != null && node.Attributes["Forced"].Value.ToLower() == "true")
|
||||||
p.Forced = true;
|
p.Forced = true;
|
||||||
subtitle.Paragraphs.Add(p);
|
subtitle.Paragraphs.Add(p);
|
||||||
|
Loading…
Reference in New Issue
Block a user