Added optional column "Region" for TTML 1.0

This commit is contained in:
Nikolaj Olsson 2017-04-26 18:51:34 +02:00
parent f20645bc25
commit 3e7c32a25d
12 changed files with 304 additions and 52 deletions

View File

@ -27,6 +27,7 @@
<CharsPerSec>Chars/sec</CharsPerSec>
<WordsPerMin>Words/min</WordsPerMin>
<Actor>Actor</Actor>
<Region>Region</Region>
<NumberSymbol>#</NumberSymbol>
<Number>Number</Number>
<Text>Text</Text>
@ -1072,6 +1073,7 @@ Note: Do check free disk space.</WaveFileMalformed>
<SetActor>Set actor</SetActor>
<SubStationAlphaStyles>Sub Station Alpha styles...</SubStationAlphaStyles>
<AdvancedSubStationAlphaStyles>Advanced Sub Station Alpha styles...</AdvancedSubStationAlphaStyles>
<TimedTextSetRegion>Timed Text - set region</TimedTextSetRegion>
<TimedTextSetStyle>Timed Text - set style</TimedTextSetStyle>
<TimedTextStyles>Timed Text styles...</TimedTextStyles>
<TimedTextSetLanguage>Timed Text - set language</TimedTextSetLanguage>

View File

@ -140,6 +140,7 @@ namespace Nikse.SubtitleEdit.Core
CharsPerSec = "Chars/sec",
WordsPerMin = "Words/min",
Actor = "Actor",
Region = "Region",
NumberSymbol = "#",
Number = "Number",
Text = "Text",
@ -1574,6 +1575,7 @@ namespace Nikse.SubtitleEdit.Core
AdvancedSubStationAlphaStyles = "Advanced Sub Station Alpha styles...",
SubStationAlphaStyles = "Sub Station Alpha styles...",
TimedTextStyles = "Timed Text styles...",
TimedTextSetRegion = "Timed Text - set region",
TimedTextSetStyle = "Timed Text - set style",
TimedTextSetLanguage = "Timed Text - set language",
SamiSetStyle = "Sami - set class",

View File

@ -130,6 +130,9 @@ namespace Nikse.SubtitleEdit.Core
case "General/Actor":
language.General.Actor = reader.Value;
break;
case "General/Region":
language.General.Region = reader.Value;
break;
case "General/NumberSymbol":
language.General.NumberSymbol = reader.Value;
break;
@ -3628,6 +3631,9 @@ namespace Nikse.SubtitleEdit.Core
case "Main/Menu/ContextMenu/AdvancedSubStationAlphaStyles":
language.Main.Menu.ContextMenu.AdvancedSubStationAlphaStyles = reader.Value;
break;
case "Main/Menu/ContextMenu/TimedTextSetRegion":
language.Main.Menu.ContextMenu.TimedTextSetRegion = reader.Value;
break;
case "Main/Menu/ContextMenu/TimedTextSetStyle":
language.Main.Menu.ContextMenu.TimedTextSetStyle = reader.Value;
break;

View File

@ -31,6 +31,7 @@
public string CharsPerSec { get; set; }
public string WordsPerMin { get; set; }
public string Actor { get; set; }
public string Region { get; set; }
public string NumberSymbol { get; set; }
public string Number { get; set; }
public string Text { get; set; }
@ -1438,6 +1439,7 @@
public string SetActor { get; set; }
public string SubStationAlphaStyles { get; set; }
public string AdvancedSubStationAlphaStyles { get; set; }
public string TimedTextSetRegion { get; set; }
public string TimedTextSetStyle { get; set; }
public string TimedTextStyles { get; set; }
public string TimedTextSetLanguage { get; set; }

View File

@ -31,6 +31,7 @@ namespace Nikse.SubtitleEdit.Core
public bool IsComment { get; set; }
public string Actor { get; set; }
public string Region { get; set; }
public string MarginL { get; set; }
public string MarginR { get; set; }
@ -81,6 +82,7 @@ namespace Nikse.SubtitleEdit.Core
Extra = paragraph.Extra;
IsComment = paragraph.IsComment;
Actor = paragraph.Actor;
Region = paragraph.Region;
MarginL = paragraph.MarginL;
MarginR = paragraph.MarginR;
MarginV = paragraph.MarginV;

View File

@ -106,6 +106,7 @@ namespace Nikse.SubtitleEdit.Core
public bool ListViewShowColumnCharsPerSec { get; set; }
public bool ListViewShowColumnWordsPerMin { get; set; }
public bool ListViewShowColumnActor { get; set; }
public bool ListViewShowColumnRegion { get; set; }
public bool SplitAdvanced { get; set; }
public string SplitOutputFolder { get; set; }
public int SplitNumberOfParts { get; set; }
@ -592,6 +593,7 @@ namespace Nikse.SubtitleEdit.Core
public int ListViewCpsWidth { get; set; }
public int ListViewWpmWidth { get; set; }
public int ListViewActorWidth { get; set; }
public int ListViewRegionWidth { get; set; }
public int ListViewTextWidth { get; set; }
public string VlcWaveTranscodeSettings { get; set; }
public string VlcLocation { get; set; }
@ -1634,6 +1636,9 @@ namespace Nikse.SubtitleEdit.Core
subNode = node.SelectSingleNode("ListViewActorWidth");
if (subNode != null)
settings.General.ListViewActorWidth = Convert.ToInt32(subNode.InnerText.Trim());
subNode = node.SelectSingleNode("ListViewRegionWidth");
if (subNode != null)
settings.General.ListViewRegionWidth = Convert.ToInt32(subNode.InnerText.Trim());
subNode = node.SelectSingleNode("ListViewTextWidth");
if (subNode != null)
settings.General.ListViewTextWidth = Convert.ToInt32(subNode.InnerText.Trim());
@ -1802,6 +1807,9 @@ namespace Nikse.SubtitleEdit.Core
subNode = node.SelectSingleNode("ListViewShowColumnActor");
if (subNode != null)
settings.Tools.ListViewShowColumnActor = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("ListViewShowColumnRegion");
if (subNode != null)
settings.Tools.ListViewShowColumnRegion = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("SplitAdvanced");
if (subNode != null)
settings.Tools.SplitAdvanced = Convert.ToBoolean(subNode.InnerText);
@ -3180,7 +3188,7 @@ namespace Nikse.SubtitleEdit.Core
textWriter.WriteElementString("ListViewCpsWidth", settings.General.ListViewCpsWidth.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ListViewWpmWidth", settings.General.ListViewWpmWidth.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ListViewActorWidth", settings.General.ListViewActorWidth.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ListViewTextWidth", settings.General.ListViewTextWidth.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ListViewRegionWidth", settings.General.ListViewRegionWidth.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("VlcWaveTranscodeSettings", settings.General.VlcWaveTranscodeSettings);
textWriter.WriteElementString("VlcLocation", settings.General.VlcLocation);
textWriter.WriteElementString("VlcLocationRelative", settings.General.VlcLocationRelative);
@ -3239,6 +3247,7 @@ namespace Nikse.SubtitleEdit.Core
textWriter.WriteElementString("ListViewShowColumnCharsPerSec", settings.Tools.ListViewShowColumnCharsPerSec.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ListViewShowColumnWordsPerMin", settings.Tools.ListViewShowColumnWordsPerMin.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ListViewShowColumnActor", settings.Tools.ListViewShowColumnActor.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ListViewShowColumnRegion", settings.Tools.ListViewShowColumnRegion.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("SplitAdvanced", settings.Tools.SplitAdvanced.ToString());
textWriter.WriteElementString("SplitOutputFolder", settings.Tools.SplitOutputFolder);
textWriter.WriteElementString("SplitNumberOfParts", settings.Tools.SplitNumberOfParts.ToString(CultureInfo.InvariantCulture));

View File

@ -90,6 +90,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
new JsonType8(),
new JsonType9(),
new JsonType10(),
new JsonType11(),
new Lrc(),
new MacSub(),
new MediaTransData(),

View File

@ -251,6 +251,12 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
if (div == null)
div = xml.DocumentElement.SelectSingleNode("//ttml:body", nsmgr).FirstChild;
if (div == null)
{
div = xml.CreateElement("div");
body.AppendChild(div);
}
int no = 0;
var headerStyles = GetStylesFromHeader(ToUtf8XmlString(xml));
var regions = GetRegionsFromHeader(ToUtf8XmlString(xml));
@ -375,6 +381,11 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
string text = p.Text.RemoveControlCharactersButWhiteSpace();
string region = GetEffect(p, "region");
if (p != null && !string.IsNullOrEmpty(p.Region) && regions.Contains(region))
{
region = p.Region;
}
if (string.IsNullOrEmpty(region))
{
if (text.StartsWith("{\\an1}", StringComparison.Ordinal) && AddDefaultRegionIfNotExists(xml, "bottomLeft"))
@ -595,8 +606,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
XmlDocument defaultXml = new XmlDocument();
defaultXml.LoadXml(new TimedText10().ToText(new Subtitle(), "tt"));
XmlNode regionNode = defaultXml.DocumentElement
.SelectSingleNode(string.Format("ttml:head//ttml:region[@xml:id='{0}']", region), nsmgr);
XmlNode regionNode = defaultXml.DocumentElement.SelectSingleNode(string.Format("ttml:head//ttml:region[@xml:id='{0}']", region), nsmgr);
if (regionNode == null)
{
@ -714,6 +724,17 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
p.Language = lang;
}
// Region
string regionP = LookupForAttribute("xml:region", node, nsmgr);
if (regionP == null)
{
regionP = LookupForAttribute("region", node, nsmgr);
}
if (regionP != null)
{
p.Region = regionP;
}
// Saving attibutes
List<string> effectsToSave = new List<string>();
effectsToSave.Add("xml:space");

View File

@ -18,6 +18,7 @@ namespace Nikse.SubtitleEdit.Controls
CharactersPerSeconds,
WordsPerMinute,
Actor,
Region,
Text,
TextAlternate,
Extra,
@ -38,6 +39,7 @@ namespace Nikse.SubtitleEdit.Controls
public int ColumnIndexCps = -1;
public int ColumnIndexWpm = -1;
public int ColumnIndexActor = -1;
public int ColumnIndexRegion = -1;
public int ColumnIndexText = -1;
public int ColumnIndexTextAlternate = -1;
public int ColumnIndexExtra = -1;
@ -137,6 +139,10 @@ namespace Nikse.SubtitleEdit.Controls
if (idx >= 0)
Columns[idx].Text = general.Actor;
idx = GetColumnIndex(SubtitleColumn.Region);
if (idx >= 0)
Columns[idx].Text = general.Region;
idx = GetColumnIndex(SubtitleColumn.Text);
if (idx >= 0)
Columns[idx].Text = general.Text;
@ -187,6 +193,10 @@ namespace Nikse.SubtitleEdit.Controls
if (idx >= 0)
Columns[idx].Width = _settings.General.ListViewActorWidth;
idx = GetColumnIndex(SubtitleColumn.Region);
if (idx >= 0)
Columns[idx].Width = _settings.General.ListViewRegionWidth;
idx = GetColumnIndex(SubtitleColumn.Text);
if (idx >= 0)
Columns[idx].Width = _settings.General.ListViewTextWidth;
@ -260,6 +270,9 @@ namespace Nikse.SubtitleEdit.Controls
case SubtitleColumn.Actor:
Columns.Add(new ColumnHeader { Width = 80 });
break;
case SubtitleColumn.Region:
Columns.Add(new ColumnHeader { Width = 60 });
break;
case SubtitleColumn.Text:
Columns.Add(new ColumnHeader { Width = 300 });
break;
@ -300,6 +313,7 @@ namespace Nikse.SubtitleEdit.Controls
ColumnIndexCps = GetColumnIndex(SubtitleColumn.CharactersPerSeconds);
ColumnIndexWpm = GetColumnIndex(SubtitleColumn.WordsPerMinute);
ColumnIndexActor = GetColumnIndex(SubtitleColumn.Actor);
ColumnIndexRegion = GetColumnIndex(SubtitleColumn.Region);
ColumnIndexText = GetColumnIndex(SubtitleColumn.Text);
ColumnIndexTextAlternate = GetColumnIndex(SubtitleColumn.TextAlternate);
ColumnIndexExtra = GetColumnIndex(SubtitleColumn.Extra);
@ -415,6 +429,10 @@ namespace Nikse.SubtitleEdit.Controls
{
Configuration.Settings.General.ListViewActorWidth = Columns[ColumnIndexActor].Width;
}
else if (e.ColumnIndex == ColumnIndexRegion)
{
Configuration.Settings.General.ListViewRegionWidth = Columns[ColumnIndexRegion].Width;
}
if (e.ColumnIndex == ColumnIndexText)
{
Configuration.Settings.General.ListViewTextWidth = Columns[ColumnIndexText].Width;
@ -481,6 +499,13 @@ namespace Nikse.SubtitleEdit.Controls
Columns[actorIdx].Width = 80;
}
var regionIdx = GetColumnIndex(SubtitleColumn.Region);
if (regionIdx >= 0)
{
Columns[regionIdx].Width = 60;
Columns[regionIdx].Width = 60;
}
int w = 0;
for (int index = 0; index < SubtitleColumns.Count; index++)
{
@ -560,6 +585,8 @@ namespace Nikse.SubtitleEdit.Controls
cw = 70;
else if (column == SubtitleColumn.Actor)
cw = 70;
else if (column == SubtitleColumn.Region)
cw = 60;
else if (column != SubtitleColumn.Number)
cw = 120;
Columns[index].Width = cw;
@ -844,6 +871,53 @@ namespace Nikse.SubtitleEdit.Controls
}
}
public void ShowRegionColumn(string title)
{
if (GetColumnIndex(SubtitleColumn.Region) == -1)
{
var ch = new ColumnHeader { Text = title };
if (ColumnIndexActor >= 0)
{
SubtitleColumns.Insert(ColumnIndexActor + 1, SubtitleColumn.Region);
Columns.Insert(ColumnIndexActor + 1, ch);
}
else if (ColumnIndexWpm >= 0)
{
SubtitleColumns.Insert(ColumnIndexWpm + 1, SubtitleColumn.Region);
Columns.Insert(ColumnIndexWpm + 1, ch);
}
else if (ColumnIndexCps >= 0)
{
SubtitleColumns.Insert(ColumnIndexCps + 1, SubtitleColumn.Region);
Columns.Insert(ColumnIndexCps + 1, ch);
}
else if (ColumnIndexDuration >= 0)
{
SubtitleColumns.Insert(ColumnIndexDuration + 1, SubtitleColumn.Region);
Columns.Insert(ColumnIndexDuration + 1, ch);
}
else if (ColumnIndexEnd >= 0)
{
SubtitleColumns.Insert(ColumnIndexEnd + 1, SubtitleColumn.Region);
Columns.Insert(ColumnIndexEnd + 1, ch);
}
else if (ColumnIndexStart >= 0)
{
SubtitleColumns.Insert(ColumnIndexStart + 1, SubtitleColumn.Region);
Columns.Insert(ColumnIndexStart + 1, ch);
}
else
{
SubtitleColumns.Add(SubtitleColumn.Region);
Columns.Add(ch);
}
UpdateColumnIndexes();
Columns[ColumnIndexRegion].Width = 80;
Columns[ColumnIndexRegion].Width = 80;
AutoSizeAllColumns(null);
}
}
public void HideColumn(SubtitleColumn column)
{
var idx = GetColumnIndex(column);
@ -1095,6 +1169,9 @@ namespace Nikse.SubtitleEdit.Controls
case SubtitleColumn.Actor:
item.SubItems.Add(paragraph.Actor);
break;
case SubtitleColumn.Region:
item.SubItems.Add(paragraph.Region);
break;
case SubtitleColumn.Text:
item.SubItems.Add(paragraph.Text.Replace(Environment.NewLine, _lineSeparatorString));
break;
@ -1234,6 +1311,8 @@ namespace Nikse.SubtitleEdit.Controls
item.SubItems[ColumnIndexDuration].Text = paragraph.Duration.ToShortDisplayString();
if (ColumnIndexActor >= 0)
item.SubItems[ColumnIndexActor].Text = paragraph.Actor;
if (ColumnIndexRegion >= 0)
item.SubItems[ColumnIndexRegion].Text = paragraph.Region;
if (ColumnIndexText >= 0)
item.SubItems[ColumnIndexText].Text = paragraph.Text.Replace(Environment.NewLine, _lineSeparatorString);
UpdateCpsAndWpm(item, paragraph);

View File

@ -250,6 +250,7 @@
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStripListview = new System.Windows.Forms.ContextMenuStrip(this.components);
this.setStylesForSelectedLinesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.setActorForSelectedLinesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemAssStyles = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemSetLanguage = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemWebVTT = new System.Windows.Forms.ToolStripMenuItem();
@ -472,7 +473,7 @@
this.imageListPlayRate = new System.Windows.Forms.ImageList(this.components);
this.timerTextUndo = new System.Windows.Forms.Timer(this.components);
this.timerAlternateTextUndo = new System.Windows.Forms.Timer(this.components);
this.setActorForSelectedLinesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemSetRegion = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
@ -2305,6 +2306,7 @@
this.setStylesForSelectedLinesToolStripMenuItem,
this.setActorForSelectedLinesToolStripMenuItem,
this.toolStripMenuItemAssStyles,
this.toolStripMenuItemSetRegion,
this.toolStripMenuItemSetLanguage,
this.toolStripMenuItemWebVTT,
this.toolStripMenuItemDelete,
@ -2344,7 +2346,7 @@
this.changeCasingForSelectedLinesToolStripMenuItem,
this.toolStripMenuItemSaveSelectedLines});
this.contextMenuStripListview.Name = "contextMenuStripListview";
this.contextMenuStripListview.Size = new System.Drawing.Size(285, 848);
this.contextMenuStripListview.Size = new System.Drawing.Size(285, 870);
this.contextMenuStripListview.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.MenuClosed);
this.contextMenuStripListview.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripListviewOpening);
this.contextMenuStripListview.Opened += new System.EventHandler(this.MenuOpened);
@ -2355,6 +2357,12 @@
this.setStylesForSelectedLinesToolStripMenuItem.Size = new System.Drawing.Size(284, 22);
this.setStylesForSelectedLinesToolStripMenuItem.Text = "ASS: Set styles for selected lines...";
//
// setActorForSelectedLinesToolStripMenuItem
//
this.setActorForSelectedLinesToolStripMenuItem.Name = "setActorForSelectedLinesToolStripMenuItem";
this.setActorForSelectedLinesToolStripMenuItem.Size = new System.Drawing.Size(284, 22);
this.setActorForSelectedLinesToolStripMenuItem.Text = "ASS: Set styles for selected lines...";
//
// toolStripMenuItemAssStyles
//
this.toolStripMenuItemAssStyles.Name = "toolStripMenuItemAssStyles";
@ -4589,11 +4597,11 @@
this.timerAlternateTextUndo.Interval = 700;
this.timerAlternateTextUndo.Tick += new System.EventHandler(this.TimerAlternateTextUndoTick);
//
// setActorForSelectedLinesToolStripMenuItem
// toolStripMenuItemSetRegion
//
this.setActorForSelectedLinesToolStripMenuItem.Name = "setActorForSelectedLinesToolStripMenuItem";
this.setActorForSelectedLinesToolStripMenuItem.Size = new System.Drawing.Size(284, 22);
this.setActorForSelectedLinesToolStripMenuItem.Text = "ASS: Set styles for selected lines...";
this.toolStripMenuItemSetRegion.Name = "toolStripMenuItemSetRegion";
this.toolStripMenuItemSetRegion.Size = new System.Drawing.Size(284, 22);
this.toolStripMenuItemSetRegion.Text = "Timed text - set region";
//
// Main
//
@ -5111,5 +5119,6 @@
private System.Windows.Forms.ToolStripButton toolStripButtonNetflixQualityCheck;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemEdl;
private System.Windows.Forms.ToolStripMenuItem setActorForSelectedLinesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSetRegion;
}
}

View File

@ -3845,6 +3845,15 @@ namespace Nikse.SubtitleEdit.Forms
SubtitleListview1.HideColumn(SubtitleListView.SubtitleColumn.Actor);
}
if (formatType == typeof(TimedText10) && Configuration.Settings.Tools.ListViewShowColumnRegion)
{
SubtitleListview1.ShowRegionColumn(Configuration.Settings.Language.General.Region);
}
else
{
SubtitleListview1.HideColumn(SubtitleListView.SubtitleColumn.Region);
}
if (format.HasStyleSupport)
{
var styles = new List<string>();
@ -6316,10 +6325,34 @@ namespace Nikse.SubtitleEdit.Forms
cm.Items.Add(contextMenuStripLvHeaderActorToolStripMenuItem);
}
if (formatType == typeof(TimedText10))
{
// REGION
var contextMenuStripLvHeaderRegionToolStripMenuItem = new ToolStripMenuItem(Configuration.Settings.Language.General.Region);
contextMenuStripLvHeaderRegionToolStripMenuItem.CheckOnClick = true;
contextMenuStripLvHeaderRegionToolStripMenuItem.Checked = Configuration.Settings.Tools.ListViewShowColumnRegion;
contextMenuStripLvHeaderRegionToolStripMenuItem.Click += (sender2, e2) =>
{
SubtitleListview1.BeginUpdate();
Configuration.Settings.Tools.ListViewShowColumnRegion = contextMenuStripLvHeaderRegionToolStripMenuItem.Checked;
if (Configuration.Settings.Tools.ListViewShowColumnRegion)
SubtitleListview1.ShowRegionColumn(Configuration.Settings.Language.General.Region);
else
SubtitleListview1.HideColumn(SubtitleListView.SubtitleColumn.Region);
SaveSubtitleListviewIndices();
UiUtil.InitializeSubtitleFont(SubtitleListview1);
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
RestoreSubtitleListviewIndices();
SubtitleListview1.EndUpdate();
};
cm.Items.Add(contextMenuStripLvHeaderRegionToolStripMenuItem);
}
cm.Show(SubtitleListview1, coordinates);
return;
}
toolStripMenuItemSetRegion.Visible = false;
toolStripMenuItemSetLanguage.Visible = false;
var actors = new List<string>();
if ((formatType == typeof(AdvancedSubStationAlpha) || formatType == typeof(SubStationAlpha)) && SubtitleListview1.SelectedItems.Count > 0)
@ -6377,6 +6410,39 @@ namespace Nikse.SubtitleEdit.Forms
toolStripMenuItemAssStyles.Visible = true;
setStylesForSelectedLinesToolStripMenuItem.Text = _language.Menu.ContextMenu.TimedTextSetStyle;
// regions
if (string.IsNullOrEmpty(_subtitle.Header) || !_subtitle.Header.Contains("http://www.w3.org/ns/ttml"))
{
_subtitle.Header = new TimedText10().ToText(_subtitle, string.Empty);
}
var regions = TimedText10.GetRegionsFromHeader(_subtitle.Header);
toolStripMenuItemSetRegion.DropDownItems.Clear();
toolStripMenuItemSetRegion.Text = _language.Menu.ContextMenu.TimedTextSetRegion;
if (regions.Count > 0)
{
toolStripMenuItemSetRegion.Visible = true;
foreach (var region in regions)
{
toolStripMenuItemSetRegion.DropDownItems.Add(region, null, SetRegionClick);
}
toolStripMenuItemSetRegion.DropDownItems.Add("-");
var clear = new ToolStripMenuItem(Configuration.Settings.Language.DvdSubRip.Clear);
toolStripMenuItemSetRegion.DropDownItems.Add(clear);
clear.Click += (sender2, e2) =>
{
MakeHistoryForUndo("Set region: " + Configuration.Settings.Language.DvdSubRip.Clear);
foreach (int index in SubtitleListview1.SelectedIndices)
{
_subtitle.Paragraphs[index].Region = null;
SubtitleListview1.SetTimeAndText(index, _subtitle.Paragraphs[index]);
}
};
}
else
{
toolStripMenuItemSetRegion.Visible = false;
}
// languages
var languages = TimedText10.GetUsedLanguages(_subtitle);
toolStripMenuItemSetLanguage.DropDownItems.Clear();
@ -6424,6 +6490,22 @@ namespace Nikse.SubtitleEdit.Forms
}
}
};
if (languages.Count > 0)
{
var clearLanguage = new ToolStripMenuItem(Configuration.Settings.Language.DvdSubRip.Clear);
toolStripMenuItemSetLanguage.DropDownItems.Add(clearLanguage);
clearLanguage.Click += (sender2, e2) =>
{
MakeHistoryForUndo("Set language: " + Configuration.Settings.Language.DvdSubRip.Clear);
foreach (int index in SubtitleListview1.SelectedIndices)
{
_subtitle.Paragraphs[index].Language = null;
_subtitle.Paragraphs[index].Extra = TimedText10.SetExtra(_subtitle.Paragraphs[index]);
SubtitleListview1.SetTimeAndText(index, _subtitle.Paragraphs[index]);
}
};
}
}
else if ((formatType == typeof(Sami) || formatType == typeof(SamiModern)) && SubtitleListview1.SelectedItems.Count > 0)
{
@ -6629,6 +6711,20 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void SetRegionClick(object sender, EventArgs e)
{
string region = (sender as ToolStripItem).Text;
if (!string.IsNullOrEmpty(region))
{
MakeHistoryForUndo("Set region: " + region);
foreach (int index in SubtitleListview1.SelectedIndices)
{
_subtitle.Paragraphs[index].Region = region;
SubtitleListview1.SetTimeAndText(index, _subtitle.Paragraphs[index]);
}
}
}
private void AddLanguageClick(object sender, EventArgs e)
{
string lang = (sender as ToolStripItem).Text;
@ -6974,6 +7070,13 @@ namespace Nikse.SubtitleEdit.Forms
{
if (styles.Count > 0)
newParagraph.Style = style;
var c = _subtitle.GetParagraphOrDefault(firstSelectedIndex);
if (c != null)
{
newParagraph.Style = c.Style;
newParagraph.Region = c.Region;
newParagraph.Language = c.Language;
}
newParagraph.Extra = TimedText10.SetExtra(newParagraph);
}
}
@ -7082,6 +7185,13 @@ namespace Nikse.SubtitleEdit.Forms
{
if (styles.Count > 0)
newParagraph.Style = style;
var c = _subtitle.GetParagraphOrDefault(FirstSelectedIndex);
if (c != null)
{
newParagraph.Style = c.Style;
newParagraph.Region = c.Region;
newParagraph.Language = c.Language;
}
newParagraph.Extra = TimedText10.SetExtra(newParagraph);
}
}
@ -16169,6 +16279,18 @@ namespace Nikse.SubtitleEdit.Forms
index++;
}
if (format.GetType() == typeof(TimedText10) || format.GetType() == typeof(ItunesTimedText))
{
var c = _subtitle.GetParagraphOrDefault(index);
if (c != null)
{
newParagraph.Style = c.Style;
newParagraph.Region = c.Region;
newParagraph.Language = c.Language;
newParagraph.Extra = TimedText10.SetExtra(newParagraph);
}
}
MakeHistoryForUndo(_language.BeforeInsertLine);
// create and insert

View File

@ -370,31 +370,31 @@
<data name="toolStripButtonRemoveTextForHi.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQ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/L2cj9cvBFLlqYPaabZDmfitN0XUN3JmbW3weOku/acrCZqAaCOQOMjI68S
0fNBKp8IQFnQUEi/L55qRCUCzrwWy1pXQlrPteWRj0Ce6Nir7tqdh+/19c0latMDDQDjWJbF+vhg/NVO
u4Rrb3/Fo9nR5573Pud+az7nfmfRBM2ex7kiI313umwS3th0UFp+cBecConeeIDHZG4IcvoU4oMYHFxC
toSHgYHfZ5epD/BXKwh3PgYN1lwsO8u5ItL3NKdB5M+Mp3LHN7zBcFCibnGkpLM+u/3crWJ1pzVfZbVS
54D3zBmj6/W3JxzhM1BauHTiv3/Nqcy/juIkW0MDWgqnnuw2826vqXO/Nofzyjdx/z56xHHj40EEme/P
G5xz0TLOGR3DhV2QNABcREQUBG9DEx+Aa3kUd+9EP3f/1JkA3f1xiBtznOO8Tfv4bLgKijiPw/Eu2Roa
UO0IAB2A5zoRB+Dt6P4okH5/xQeR8HP4a+CWqvRq2LNBLKmx0eKTfcZexysHdz0epXiA/DJ8bYlHJrv5
RPs9TqgHVUkSMRs6eo8N59FrFYSLZzVTNooRjP/ojpHWbsa1+IPRSYPwy52p0uOYF8RseKiptVUnpv5f
C48TglBXHsm5zbILRlPkbr4j/DVBafSNZQ88G3PruYyMl4i56QG3nCLfak5O153GvS/NZK/gwYohJXw3
YNhgMN1S5Jtv23vNz3YcEfEfOz0tMIkk2UUAAAAASUVORK5CYII=
</value>
</data>
<data name="toolStripButtonVisualSync.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -462,20 +462,20 @@
<data name="toolStripButtonNetflixQualityCheck.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAALhSURBVFhHtZfLa9RQFMavTnKT6DTvLgW3unDt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A+w
sbcQLI1iRFDIggloCCY+kt0lCIrBYBXCKiiYIIm42XkIFmITEXxkPGe5s9zcOQEzs/PBV91z5vz2nDkz
s2w/rRtemphBzj3FOcNDSLU1O6V8lTGFh/yfXukOCRDr/gIPIUUVRx8YYAkAtgw/B9Azgz9d3T7Gw3Ki
iqMPDLCg2bvLGt2FyPQneFhOVHF0IYA5xUp7RBcSPfj+gbERHrpHVHF0IYCmaqUrmpsHAIf62CUeukdU
cXQhAEycrlkkQGK4m3DRwzx8ILlw5sIAUzCGjk6vZKw553j4QHLhzIUBHsEYZhSbBAiNYJmHDyQXzlwY
AH2jNppuEA8mWMndSHVO8pS+xKKiSwFMKqPpokp3ITL8KZ7Sl1hUdCmAGbgPbkIXPlMraTo/N9nIGE+r
BgDXcRwAXuzzYIqN4ApPY08gViycuRQA+jYA3AFDwV8yQKI6X+DBpGHefeiWmJe5NACuI3YhMr25HAA4
MpwLmHcXYsS8zKUBcB37AIp3igTQgzeYdx1iFokxlAZA4zriWaL5qxRET3FPIyTetHLuUABwHfEsVIPz
FAB8KzxFAIyTc4cCgL8Mz1bgYonphzIAfivgPYCdws0Rc4cCgBflxywy3MsyAPolrCp2YbYKADQ/ZiGz
vJ7p/JABtuFhhQ+thjSGoQOgEiNoyADoluqkEwAh5lUC0NW84/hCkgE+QhdwHR8KY6gEABUb/nMZAD0L
r/B7whgqAwiPuGcpgLfwEXNLGENlAKBDkRlsUBANWNt5PoYqAVhs+hcpgNfwQYvvEMyrFOAdY/VED77J
ACHcjJN8DJUCoGIzGJcB0M9gJR/DGKoHYO5RWMnfMsAn6MIDGEPlACj4yzYvA6Bb8D1ZAKC+067Vu23V
Xmup1lJTs6abqn2NH5Pa1rwTa5q92oE/Le9V9+u6ae9sQVc6ZvCXBmDsH7Zlsso4CCj0AAAAAElFTkSu
QmCC
</value>
</data>
<data name="toolStripButtonSettings.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -665,9 +665,6 @@
<metadata name="toolStripWaveControls.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>650, 56</value>
</metadata>
<metadata name="toolStripWaveControls.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>650, 56</value>
</metadata>
<data name="toolStripButtonWaveformZoomOut.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@ -774,7 +771,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
CAAAAk1TRnQBSQFMAgEBAgEAAcABIwHAASMBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAAcgBIwHIASMBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA