mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Work on WebVTT styles
This commit is contained in:
parent
19b678a459
commit
1821d78f64
@ -33,6 +33,7 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
{
|
||||
styleOn = false;
|
||||
AddStyle(result, currentStyle);
|
||||
currentStyle = new StringBuilder();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -309,7 +310,7 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
|
||||
public static string AddStyleToHeader(string header, WebVttStyle style)
|
||||
{
|
||||
var rawStyle = "::cue(." + style.Name + ") { " + GetCssProperties(style) + " }";
|
||||
var rawStyle = "::cue(." + style.Name.RemoveChar('.') + ") { " + GetCssProperties(style) + " }";
|
||||
|
||||
if (string.IsNullOrEmpty(header))
|
||||
{
|
||||
@ -343,7 +344,7 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static string GetCssProperties(WebVttStyle style)
|
||||
public static string GetCssProperties(WebVttStyle style)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@ -391,6 +392,23 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
sb.Append("text-decoration:line-through; ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(style.FontName))
|
||||
{
|
||||
sb.Append($"font-family:{style.FontName}; ");
|
||||
}
|
||||
|
||||
if (style.FontSize.HasValue && style.FontSize > 0)
|
||||
{
|
||||
sb.Append($"font-size:{style.FontSize}px; ");
|
||||
}
|
||||
|
||||
if (style.ShadowColor.HasValue && style.ShadowWidth.HasValue && style.ShadowWidth > 0)
|
||||
{
|
||||
var colorString = Utilities.ColorToHexWithTransparency(style.ShadowColor.Value);
|
||||
var widthString = "{style.ShadowWidth.Value.ToString(CultureInfo.InvariantCulture)} px";
|
||||
sb.Append($"text-shadow: {colorString} {widthString}");
|
||||
}
|
||||
|
||||
return sb.ToString().TrimEnd(' ', ';');
|
||||
}
|
||||
|
||||
|
@ -15,5 +15,33 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
public bool? StrikeThrough { get; set; }
|
||||
public decimal? ShadowWidth { get; set; }
|
||||
public Color? ShadowColor { get; set; }
|
||||
|
||||
public WebVttStyle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public WebVttStyle(WebVttStyle style)
|
||||
{
|
||||
Name = style.Name;
|
||||
FontName = style.FontName;
|
||||
FontSize = style.FontSize;
|
||||
Color = style.Color;
|
||||
BackgroundColor = style.BackgroundColor;
|
||||
Bold = style.Bold;
|
||||
Underline = style.Underline;
|
||||
StrikeThrough = style.StrikeThrough;
|
||||
ShadowWidth = style.ShadowWidth;
|
||||
ShadowColor = style.ShadowColor;
|
||||
Underline = style.Underline;
|
||||
ShadowWidth = style.ShadowWidth;
|
||||
StrikeThrough = style.StrikeThrough;
|
||||
ShadowWidth = style.ShadowWidth;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return WebVttHelper.GetCssProperties(this);
|
||||
}
|
||||
}
|
||||
}
|
22
src/ui/Forms/Assa/AssaStyles.Designer.cs
generated
22
src/ui/Forms/Assa/AssaStyles.Designer.cs
generated
@ -38,8 +38,8 @@
|
||||
this.columnHeaderOutline = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.contextMenuStripFile = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.removeAndReplaceWithToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItemRemoveAll = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.removeAndReplaceWithToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.addToStorageToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
|
||||
@ -272,7 +272,7 @@
|
||||
this.toolStripMenuItemImport,
|
||||
this.toolStripMenuItemExport});
|
||||
this.contextMenuStripFile.Name = "contextMenuStrip1";
|
||||
this.contextMenuStripFile.Size = new System.Drawing.Size(216, 314);
|
||||
this.contextMenuStripFile.Size = new System.Drawing.Size(216, 292);
|
||||
this.contextMenuStripFile.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripFile_Opening);
|
||||
//
|
||||
// deleteToolStripMenuItem
|
||||
@ -283,13 +283,6 @@
|
||||
this.deleteToolStripMenuItem.Text = "Remove";
|
||||
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.buttonRemove_Click);
|
||||
//
|
||||
// removeAndReplaceWithToolStripMenuItem
|
||||
//
|
||||
this.removeAndReplaceWithToolStripMenuItem.Name = "removeAndReplaceWithToolStripMenuItem";
|
||||
this.removeAndReplaceWithToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
|
||||
this.removeAndReplaceWithToolStripMenuItem.Text = "Replace with...";
|
||||
this.removeAndReplaceWithToolStripMenuItem.Click += new System.EventHandler(this.buttonRemoveAndReplaceWith_Click);
|
||||
//
|
||||
// toolStripMenuItemRemoveAll
|
||||
//
|
||||
this.toolStripMenuItemRemoveAll.Name = "toolStripMenuItemRemoveAll";
|
||||
@ -297,6 +290,13 @@
|
||||
this.toolStripMenuItemRemoveAll.Text = "Remove all";
|
||||
this.toolStripMenuItemRemoveAll.Click += new System.EventHandler(this.buttonRemoveAll_Click);
|
||||
//
|
||||
// removeAndReplaceWithToolStripMenuItem
|
||||
//
|
||||
this.removeAndReplaceWithToolStripMenuItem.Name = "removeAndReplaceWithToolStripMenuItem";
|
||||
this.removeAndReplaceWithToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
|
||||
this.removeAndReplaceWithToolStripMenuItem.Text = "Replace with...";
|
||||
this.removeAndReplaceWithToolStripMenuItem.Click += new System.EventHandler(this.buttonRemoveAndReplaceWith_Click);
|
||||
//
|
||||
// toolStripSeparator4
|
||||
//
|
||||
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
||||
@ -1217,6 +1217,7 @@
|
||||
this.groupBoxStorage.Controls.Add(this.buttonAddToFile);
|
||||
this.groupBoxStorage.Controls.Add(this.buttonStorageExport);
|
||||
this.groupBoxStorage.Controls.Add(this.buttonStorageImport);
|
||||
this.groupBoxStorage.Controls.Add(this.labelDuplicateStyleNames);
|
||||
this.groupBoxStorage.Controls.Add(this.buttonStorageCopy);
|
||||
this.groupBoxStorage.Controls.Add(this.buttonStorageRemoveAll);
|
||||
this.groupBoxStorage.Controls.Add(this.buttonStorageAdd);
|
||||
@ -1619,7 +1620,7 @@
|
||||
this.labelDuplicateStyleNames.AutoSize = true;
|
||||
this.labelDuplicateStyleNames.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelDuplicateStyleNames.ForeColor = System.Drawing.Color.Firebrick;
|
||||
this.labelDuplicateStyleNames.Location = new System.Drawing.Point(12, 648);
|
||||
this.labelDuplicateStyleNames.Location = new System.Drawing.Point(494, 102);
|
||||
this.labelDuplicateStyleNames.Name = "labelDuplicateStyleNames";
|
||||
this.labelDuplicateStyleNames.Size = new System.Drawing.Size(154, 13);
|
||||
this.labelDuplicateStyleNames.TabIndex = 10;
|
||||
@ -1630,7 +1631,6 @@
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1064, 670);
|
||||
this.Controls.Add(this.labelDuplicateStyleNames);
|
||||
this.Controls.Add(this.buttonApply);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Controls.Add(this.labelStatus);
|
||||
|
@ -2306,7 +2306,7 @@ namespace Nikse.SubtitleEdit.Forms.Assa
|
||||
|
||||
private void UpdateCurrentFileButtonsState()
|
||||
{
|
||||
bool oneOrMoreSelected = listViewStyles.SelectedItems.Count > 0;
|
||||
var oneOrMoreSelected = listViewStyles.SelectedItems.Count > 0;
|
||||
buttonRemove.Enabled = oneOrMoreSelected;
|
||||
buttonCopy.Enabled = oneOrMoreSelected;
|
||||
buttonAddStyleToStorage.Enabled = oneOrMoreSelected;
|
||||
|
@ -30861,16 +30861,15 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else if (formatType == typeof(WebVTT) || formatType == typeof(WebVTTFileWithLineNumber))
|
||||
{
|
||||
using (var styles = new WebVttStyleManager(_subtitle))
|
||||
using (var styles = new WebVttStyleManager(_subtitle, FirstSelectedIndex))
|
||||
{
|
||||
if (styles.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
if (_subtitle.Header != styles.Header)
|
||||
{
|
||||
MakeHistoryForUndo(styles.Text);
|
||||
_subtitle.Header = styles.Header;
|
||||
}
|
||||
|
||||
_subtitle.Header = styles.Header;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
303
src/ui/Forms/VTT/WebVttStyleManager.Designer.cs
generated
303
src/ui/Forms/VTT/WebVttStyleManager.Designer.cs
generated
@ -39,25 +39,32 @@
|
||||
this.columnHeaderName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderFontName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderFontSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderItalic = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderForeColor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderBackgroundColor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderUseCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderPrimaryColor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderOutline = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.groupBoxProperties = new System.Windows.Forms.GroupBox();
|
||||
this.groupBoxAfter = new System.Windows.Forms.GroupBox();
|
||||
this.labelAfter = new System.Windows.Forms.Label();
|
||||
this.groupBoxBefore = new System.Windows.Forms.GroupBox();
|
||||
this.labelBefore = new System.Windows.Forms.Label();
|
||||
this.textBoxStyleName = new System.Windows.Forms.TextBox();
|
||||
this.labelStyleName = new System.Windows.Forms.Label();
|
||||
this.groupBoxPreview = new System.Windows.Forms.GroupBox();
|
||||
this.pictureBoxPreview = new System.Windows.Forms.PictureBox();
|
||||
this.groupBoxFont = new System.Windows.Forms.GroupBox();
|
||||
this.panelBackColor = new System.Windows.Forms.Panel();
|
||||
this.buttonBackColor = new System.Windows.Forms.Button();
|
||||
this.checkBoxShadowEnabled = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxBackgroundColorEnabled = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxColorEnabled = new System.Windows.Forms.CheckBox();
|
||||
this.panelShadowColor = new System.Windows.Forms.Panel();
|
||||
this.buttonShadowColor = new System.Windows.Forms.Button();
|
||||
this.numericUpDownShadowWidth = new System.Windows.Forms.NumericUpDown();
|
||||
this.panelSecondaryColor = new System.Windows.Forms.Panel();
|
||||
this.panelBackgroundColor = new System.Windows.Forms.Panel();
|
||||
this.labelShadow = new System.Windows.Forms.Label();
|
||||
this.buttonSecondaryColor = new System.Windows.Forms.Button();
|
||||
this.buttonBackgroundColor = new System.Windows.Forms.Button();
|
||||
this.panelPrimaryColor = new System.Windows.Forms.Panel();
|
||||
this.checkBoxStrikeout = new System.Windows.Forms.CheckBox();
|
||||
this.buttonPrimaryColor = new System.Windows.Forms.Button();
|
||||
this.buttonPickAttachmentFont = new System.Windows.Forms.Button();
|
||||
this.checkBoxFontUnderline = new System.Windows.Forms.CheckBox();
|
||||
this.numericUpDownFontSize = new System.Windows.Forms.NumericUpDown();
|
||||
this.checkBoxFontItalic = new System.Windows.Forms.CheckBox();
|
||||
@ -68,10 +75,11 @@
|
||||
this.buttonApply = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonOK = new System.Windows.Forms.Button();
|
||||
this.checkBoxColorEnabled = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxBackgroundColorEnabled = new System.Windows.Forms.CheckBox();
|
||||
this.labelDuplicateStyleNames = new System.Windows.Forms.Label();
|
||||
this.groupBoxStyles.SuspendLayout();
|
||||
this.groupBoxProperties.SuspendLayout();
|
||||
this.groupBoxAfter.SuspendLayout();
|
||||
this.groupBoxBefore.SuspendLayout();
|
||||
this.groupBoxPreview.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPreview)).BeginInit();
|
||||
this.groupBoxFont.SuspendLayout();
|
||||
@ -127,6 +135,7 @@
|
||||
this.buttonCopy.TabIndex = 6;
|
||||
this.buttonCopy.Text = "Copy";
|
||||
this.buttonCopy.UseVisualStyleBackColor = true;
|
||||
this.buttonCopy.Click += new System.EventHandler(this.buttonCopy_Click);
|
||||
//
|
||||
// buttonRemoveAll
|
||||
//
|
||||
@ -138,6 +147,7 @@
|
||||
this.buttonRemoveAll.TabIndex = 7;
|
||||
this.buttonRemoveAll.Text = "Remove all";
|
||||
this.buttonRemoveAll.UseVisualStyleBackColor = true;
|
||||
this.buttonRemoveAll.Click += new System.EventHandler(this.buttonRemoveAll_Click);
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
@ -149,6 +159,7 @@
|
||||
this.buttonAdd.TabIndex = 2;
|
||||
this.buttonAdd.Text = "New";
|
||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
|
||||
//
|
||||
// buttonRemove
|
||||
//
|
||||
@ -160,6 +171,7 @@
|
||||
this.buttonRemove.TabIndex = 3;
|
||||
this.buttonRemove.Text = "Remove";
|
||||
this.buttonRemove.UseVisualStyleBackColor = true;
|
||||
this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click);
|
||||
//
|
||||
// listViewStyles
|
||||
//
|
||||
@ -170,9 +182,10 @@
|
||||
this.columnHeaderName,
|
||||
this.columnHeaderFontName,
|
||||
this.columnHeaderFontSize,
|
||||
this.columnHeaderUseCount,
|
||||
this.columnHeaderPrimaryColor,
|
||||
this.columnHeaderOutline});
|
||||
this.columnHeaderItalic,
|
||||
this.columnHeaderForeColor,
|
||||
this.columnHeaderBackgroundColor,
|
||||
this.columnHeaderUseCount});
|
||||
this.listViewStyles.FullRowSelect = true;
|
||||
this.listViewStyles.HideSelection = false;
|
||||
this.listViewStyles.Location = new System.Drawing.Point(6, 19);
|
||||
@ -181,6 +194,7 @@
|
||||
this.listViewStyles.TabIndex = 0;
|
||||
this.listViewStyles.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewStyles.View = System.Windows.Forms.View.Details;
|
||||
this.listViewStyles.SelectedIndexChanged += new System.EventHandler(this.listViewStyles_SelectedIndexChanged);
|
||||
//
|
||||
// columnHeaderName
|
||||
//
|
||||
@ -190,32 +204,38 @@
|
||||
// columnHeaderFontName
|
||||
//
|
||||
this.columnHeaderFontName.Text = "Font name";
|
||||
this.columnHeaderFontName.Width = 128;
|
||||
this.columnHeaderFontName.Width = 122;
|
||||
//
|
||||
// columnHeaderFontSize
|
||||
//
|
||||
this.columnHeaderFontSize.Text = "Font size";
|
||||
this.columnHeaderFontSize.Width = 80;
|
||||
//
|
||||
// columnHeaderItalic
|
||||
//
|
||||
this.columnHeaderItalic.Text = "Italic";
|
||||
//
|
||||
// columnHeaderForeColor
|
||||
//
|
||||
this.columnHeaderForeColor.Text = "BG";
|
||||
this.columnHeaderForeColor.Width = 70;
|
||||
//
|
||||
// columnHeaderBackgroundColor
|
||||
//
|
||||
this.columnHeaderBackgroundColor.Text = "Text";
|
||||
this.columnHeaderBackgroundColor.Width = 55;
|
||||
//
|
||||
// columnHeaderUseCount
|
||||
//
|
||||
this.columnHeaderUseCount.Text = "Used#";
|
||||
//
|
||||
// columnHeaderPrimaryColor
|
||||
//
|
||||
this.columnHeaderPrimaryColor.Text = "Primary";
|
||||
this.columnHeaderPrimaryColor.Width = 70;
|
||||
//
|
||||
// columnHeaderOutline
|
||||
//
|
||||
this.columnHeaderOutline.Text = "Outline";
|
||||
this.columnHeaderOutline.Width = 55;
|
||||
//
|
||||
// groupBoxProperties
|
||||
//
|
||||
this.groupBoxProperties.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBoxProperties.Controls.Add(this.groupBoxAfter);
|
||||
this.groupBoxProperties.Controls.Add(this.groupBoxBefore);
|
||||
this.groupBoxProperties.Controls.Add(this.textBoxStyleName);
|
||||
this.groupBoxProperties.Controls.Add(this.labelStyleName);
|
||||
this.groupBoxProperties.Controls.Add(this.groupBoxPreview);
|
||||
@ -227,6 +247,46 @@
|
||||
this.groupBoxProperties.TabStop = false;
|
||||
this.groupBoxProperties.Text = "Properties";
|
||||
//
|
||||
// groupBoxAfter
|
||||
//
|
||||
this.groupBoxAfter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBoxAfter.Controls.Add(this.labelAfter);
|
||||
this.groupBoxAfter.Location = new System.Drawing.Point(249, 259);
|
||||
this.groupBoxAfter.Name = "groupBoxAfter";
|
||||
this.groupBoxAfter.Size = new System.Drawing.Size(229, 136);
|
||||
this.groupBoxAfter.TabIndex = 12;
|
||||
this.groupBoxAfter.TabStop = false;
|
||||
this.groupBoxAfter.Text = "After";
|
||||
//
|
||||
// labelAfter
|
||||
//
|
||||
this.labelAfter.AutoSize = true;
|
||||
this.labelAfter.Location = new System.Drawing.Point(6, 16);
|
||||
this.labelAfter.Name = "labelAfter";
|
||||
this.labelAfter.Size = new System.Drawing.Size(51, 13);
|
||||
this.labelAfter.TabIndex = 1;
|
||||
this.labelAfter.Text = "labelAfter";
|
||||
//
|
||||
// groupBoxBefore
|
||||
//
|
||||
this.groupBoxBefore.Controls.Add(this.labelBefore);
|
||||
this.groupBoxBefore.Location = new System.Drawing.Point(10, 259);
|
||||
this.groupBoxBefore.Name = "groupBoxBefore";
|
||||
this.groupBoxBefore.Size = new System.Drawing.Size(233, 136);
|
||||
this.groupBoxBefore.TabIndex = 11;
|
||||
this.groupBoxBefore.TabStop = false;
|
||||
this.groupBoxBefore.Text = "Before";
|
||||
//
|
||||
// labelBefore
|
||||
//
|
||||
this.labelBefore.AutoSize = true;
|
||||
this.labelBefore.Location = new System.Drawing.Point(7, 20);
|
||||
this.labelBefore.Name = "labelBefore";
|
||||
this.labelBefore.Size = new System.Drawing.Size(60, 13);
|
||||
this.labelBefore.TabIndex = 0;
|
||||
this.labelBefore.Text = "labelBefore";
|
||||
//
|
||||
// textBoxStyleName
|
||||
//
|
||||
this.textBoxStyleName.Location = new System.Drawing.Point(49, 22);
|
||||
@ -249,9 +309,9 @@
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBoxPreview.Controls.Add(this.pictureBoxPreview);
|
||||
this.groupBoxPreview.Location = new System.Drawing.Point(7, 335);
|
||||
this.groupBoxPreview.Location = new System.Drawing.Point(7, 401);
|
||||
this.groupBoxPreview.Name = "groupBoxPreview";
|
||||
this.groupBoxPreview.Size = new System.Drawing.Size(472, 258);
|
||||
this.groupBoxPreview.Size = new System.Drawing.Size(472, 192);
|
||||
this.groupBoxPreview.TabIndex = 7;
|
||||
this.groupBoxPreview.TabStop = false;
|
||||
this.groupBoxPreview.Text = "Preview";
|
||||
@ -261,7 +321,7 @@
|
||||
this.pictureBoxPreview.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureBoxPreview.Location = new System.Drawing.Point(3, 16);
|
||||
this.pictureBoxPreview.Name = "pictureBoxPreview";
|
||||
this.pictureBoxPreview.Size = new System.Drawing.Size(466, 239);
|
||||
this.pictureBoxPreview.Size = new System.Drawing.Size(466, 173);
|
||||
this.pictureBoxPreview.TabIndex = 0;
|
||||
this.pictureBoxPreview.TabStop = false;
|
||||
//
|
||||
@ -269,18 +329,18 @@
|
||||
//
|
||||
this.groupBoxFont.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBoxFont.Controls.Add(this.checkBoxShadowEnabled);
|
||||
this.groupBoxFont.Controls.Add(this.checkBoxBackgroundColorEnabled);
|
||||
this.groupBoxFont.Controls.Add(this.checkBoxColorEnabled);
|
||||
this.groupBoxFont.Controls.Add(this.panelBackColor);
|
||||
this.groupBoxFont.Controls.Add(this.buttonBackColor);
|
||||
this.groupBoxFont.Controls.Add(this.panelShadowColor);
|
||||
this.groupBoxFont.Controls.Add(this.buttonShadowColor);
|
||||
this.groupBoxFont.Controls.Add(this.numericUpDownShadowWidth);
|
||||
this.groupBoxFont.Controls.Add(this.panelSecondaryColor);
|
||||
this.groupBoxFont.Controls.Add(this.panelBackgroundColor);
|
||||
this.groupBoxFont.Controls.Add(this.labelShadow);
|
||||
this.groupBoxFont.Controls.Add(this.buttonSecondaryColor);
|
||||
this.groupBoxFont.Controls.Add(this.buttonBackgroundColor);
|
||||
this.groupBoxFont.Controls.Add(this.panelPrimaryColor);
|
||||
this.groupBoxFont.Controls.Add(this.checkBoxStrikeout);
|
||||
this.groupBoxFont.Controls.Add(this.buttonPrimaryColor);
|
||||
this.groupBoxFont.Controls.Add(this.buttonPickAttachmentFont);
|
||||
this.groupBoxFont.Controls.Add(this.checkBoxFontUnderline);
|
||||
this.groupBoxFont.Controls.Add(this.numericUpDownFontSize);
|
||||
this.groupBoxFont.Controls.Add(this.checkBoxFontItalic);
|
||||
@ -290,27 +350,64 @@
|
||||
this.groupBoxFont.Controls.Add(this.labelFontName);
|
||||
this.groupBoxFont.Location = new System.Drawing.Point(7, 51);
|
||||
this.groupBoxFont.Name = "groupBoxFont";
|
||||
this.groupBoxFont.Size = new System.Drawing.Size(472, 278);
|
||||
this.groupBoxFont.Size = new System.Drawing.Size(472, 202);
|
||||
this.groupBoxFont.TabIndex = 2;
|
||||
this.groupBoxFont.TabStop = false;
|
||||
this.groupBoxFont.Text = "Font";
|
||||
//
|
||||
// panelBackColor
|
||||
// checkBoxShadowEnabled
|
||||
//
|
||||
this.panelBackColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panelBackColor.Location = new System.Drawing.Point(371, 138);
|
||||
this.panelBackColor.Name = "panelBackColor";
|
||||
this.panelBackColor.Size = new System.Drawing.Size(21, 20);
|
||||
this.panelBackColor.TabIndex = 7;
|
||||
this.checkBoxShadowEnabled.AutoSize = true;
|
||||
this.checkBoxShadowEnabled.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.checkBoxShadowEnabled.Location = new System.Drawing.Point(282, 119);
|
||||
this.checkBoxShadowEnabled.Name = "checkBoxShadowEnabled";
|
||||
this.checkBoxShadowEnabled.Size = new System.Drawing.Size(65, 17);
|
||||
this.checkBoxShadowEnabled.TabIndex = 11;
|
||||
this.checkBoxShadowEnabled.Text = "Enabled";
|
||||
this.checkBoxShadowEnabled.UseVisualStyleBackColor = true;
|
||||
this.checkBoxShadowEnabled.CheckedChanged += new System.EventHandler(this.checkBoxShadowEnabled_CheckedChanged);
|
||||
//
|
||||
// buttonBackColor
|
||||
// checkBoxBackgroundColorEnabled
|
||||
//
|
||||
this.buttonBackColor.Location = new System.Drawing.Point(282, 137);
|
||||
this.buttonBackColor.Name = "buttonBackColor";
|
||||
this.buttonBackColor.Size = new System.Drawing.Size(84, 23);
|
||||
this.buttonBackColor.TabIndex = 6;
|
||||
this.buttonBackColor.Text = "Shadow";
|
||||
this.buttonBackColor.UseVisualStyleBackColor = true;
|
||||
this.checkBoxBackgroundColorEnabled.AutoSize = true;
|
||||
this.checkBoxBackgroundColorEnabled.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.checkBoxBackgroundColorEnabled.Location = new System.Drawing.Point(135, 119);
|
||||
this.checkBoxBackgroundColorEnabled.Name = "checkBoxBackgroundColorEnabled";
|
||||
this.checkBoxBackgroundColorEnabled.Size = new System.Drawing.Size(65, 17);
|
||||
this.checkBoxBackgroundColorEnabled.TabIndex = 10;
|
||||
this.checkBoxBackgroundColorEnabled.Text = "Enabled";
|
||||
this.checkBoxBackgroundColorEnabled.UseVisualStyleBackColor = true;
|
||||
this.checkBoxBackgroundColorEnabled.CheckedChanged += new System.EventHandler(this.checkBoxBackgroundColorEnabled_CheckedChanged);
|
||||
//
|
||||
// checkBoxColorEnabled
|
||||
//
|
||||
this.checkBoxColorEnabled.AutoSize = true;
|
||||
this.checkBoxColorEnabled.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.checkBoxColorEnabled.Location = new System.Drawing.Point(16, 119);
|
||||
this.checkBoxColorEnabled.Name = "checkBoxColorEnabled";
|
||||
this.checkBoxColorEnabled.Size = new System.Drawing.Size(65, 17);
|
||||
this.checkBoxColorEnabled.TabIndex = 9;
|
||||
this.checkBoxColorEnabled.Text = "Enabled";
|
||||
this.checkBoxColorEnabled.UseVisualStyleBackColor = true;
|
||||
this.checkBoxColorEnabled.CheckedChanged += new System.EventHandler(this.checkBoxColorEnabled_CheckedChanged);
|
||||
//
|
||||
// panelShadowColor
|
||||
//
|
||||
this.panelShadowColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panelShadowColor.Location = new System.Drawing.Point(371, 143);
|
||||
this.panelShadowColor.Name = "panelShadowColor";
|
||||
this.panelShadowColor.Size = new System.Drawing.Size(21, 20);
|
||||
this.panelShadowColor.TabIndex = 7;
|
||||
this.panelShadowColor.Click += new System.EventHandler(this.panelShadowColor_Click);
|
||||
//
|
||||
// buttonShadowColor
|
||||
//
|
||||
this.buttonShadowColor.Location = new System.Drawing.Point(282, 142);
|
||||
this.buttonShadowColor.Name = "buttonShadowColor";
|
||||
this.buttonShadowColor.Size = new System.Drawing.Size(84, 23);
|
||||
this.buttonShadowColor.TabIndex = 6;
|
||||
this.buttonShadowColor.Text = "Shadow";
|
||||
this.buttonShadowColor.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownShadowWidth
|
||||
//
|
||||
@ -320,50 +417,53 @@
|
||||
0,
|
||||
0,
|
||||
65536});
|
||||
this.numericUpDownShadowWidth.Location = new System.Drawing.Point(286, 166);
|
||||
this.numericUpDownShadowWidth.Location = new System.Drawing.Point(286, 171);
|
||||
this.numericUpDownShadowWidth.Name = "numericUpDownShadowWidth";
|
||||
this.numericUpDownShadowWidth.Size = new System.Drawing.Size(52, 20);
|
||||
this.numericUpDownShadowWidth.TabIndex = 2;
|
||||
//
|
||||
// panelSecondaryColor
|
||||
// panelBackgroundColor
|
||||
//
|
||||
this.panelSecondaryColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panelSecondaryColor.Location = new System.Drawing.Point(242, 138);
|
||||
this.panelSecondaryColor.Name = "panelSecondaryColor";
|
||||
this.panelSecondaryColor.Size = new System.Drawing.Size(21, 20);
|
||||
this.panelSecondaryColor.TabIndex = 3;
|
||||
this.panelBackgroundColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panelBackgroundColor.Location = new System.Drawing.Point(242, 143);
|
||||
this.panelBackgroundColor.Name = "panelBackgroundColor";
|
||||
this.panelBackgroundColor.Size = new System.Drawing.Size(21, 20);
|
||||
this.panelBackgroundColor.TabIndex = 3;
|
||||
this.panelBackgroundColor.Click += new System.EventHandler(this.panelBackgroundColor_Click);
|
||||
//
|
||||
// labelShadow
|
||||
//
|
||||
this.labelShadow.AutoSize = true;
|
||||
this.labelShadow.Location = new System.Drawing.Point(344, 168);
|
||||
this.labelShadow.Location = new System.Drawing.Point(344, 173);
|
||||
this.labelShadow.Name = "labelShadow";
|
||||
this.labelShadow.Size = new System.Drawing.Size(46, 13);
|
||||
this.labelShadow.TabIndex = 2;
|
||||
this.labelShadow.Text = "Shadow";
|
||||
//
|
||||
// buttonSecondaryColor
|
||||
// buttonBackgroundColor
|
||||
//
|
||||
this.buttonSecondaryColor.Location = new System.Drawing.Point(135, 137);
|
||||
this.buttonSecondaryColor.Name = "buttonSecondaryColor";
|
||||
this.buttonSecondaryColor.Size = new System.Drawing.Size(101, 23);
|
||||
this.buttonSecondaryColor.TabIndex = 2;
|
||||
this.buttonSecondaryColor.Text = "Background";
|
||||
this.buttonSecondaryColor.UseVisualStyleBackColor = true;
|
||||
this.buttonBackgroundColor.Location = new System.Drawing.Point(135, 142);
|
||||
this.buttonBackgroundColor.Name = "buttonBackgroundColor";
|
||||
this.buttonBackgroundColor.Size = new System.Drawing.Size(101, 23);
|
||||
this.buttonBackgroundColor.TabIndex = 2;
|
||||
this.buttonBackgroundColor.Text = "Background";
|
||||
this.buttonBackgroundColor.UseVisualStyleBackColor = true;
|
||||
this.buttonBackgroundColor.Click += new System.EventHandler(this.buttonBackgroundColor_Click);
|
||||
//
|
||||
// panelPrimaryColor
|
||||
//
|
||||
this.panelPrimaryColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panelPrimaryColor.Location = new System.Drawing.Point(100, 138);
|
||||
this.panelPrimaryColor.Location = new System.Drawing.Point(100, 143);
|
||||
this.panelPrimaryColor.Name = "panelPrimaryColor";
|
||||
this.panelPrimaryColor.Size = new System.Drawing.Size(21, 20);
|
||||
this.panelPrimaryColor.TabIndex = 1;
|
||||
this.panelPrimaryColor.Click += new System.EventHandler(this.panelPrimaryColor_Click);
|
||||
//
|
||||
// checkBoxStrikeout
|
||||
//
|
||||
this.checkBoxStrikeout.AutoSize = true;
|
||||
this.checkBoxStrikeout.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Strikeout, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.checkBoxStrikeout.Location = new System.Drawing.Point(246, 62);
|
||||
this.checkBoxStrikeout.Location = new System.Drawing.Point(246, 59);
|
||||
this.checkBoxStrikeout.Name = "checkBoxStrikeout";
|
||||
this.checkBoxStrikeout.Size = new System.Drawing.Size(68, 17);
|
||||
this.checkBoxStrikeout.TabIndex = 8;
|
||||
@ -372,27 +472,19 @@
|
||||
//
|
||||
// buttonPrimaryColor
|
||||
//
|
||||
this.buttonPrimaryColor.Location = new System.Drawing.Point(14, 137);
|
||||
this.buttonPrimaryColor.Location = new System.Drawing.Point(14, 142);
|
||||
this.buttonPrimaryColor.Name = "buttonPrimaryColor";
|
||||
this.buttonPrimaryColor.Size = new System.Drawing.Size(80, 23);
|
||||
this.buttonPrimaryColor.TabIndex = 0;
|
||||
this.buttonPrimaryColor.Text = "&Color";
|
||||
this.buttonPrimaryColor.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonPickAttachmentFont
|
||||
//
|
||||
this.buttonPickAttachmentFont.Location = new System.Drawing.Point(267, 17);
|
||||
this.buttonPickAttachmentFont.Name = "buttonPickAttachmentFont";
|
||||
this.buttonPickAttachmentFont.Size = new System.Drawing.Size(24, 23);
|
||||
this.buttonPickAttachmentFont.TabIndex = 2;
|
||||
this.buttonPickAttachmentFont.Text = "...";
|
||||
this.buttonPickAttachmentFont.UseVisualStyleBackColor = true;
|
||||
this.buttonPrimaryColor.Click += new System.EventHandler(this.buttonPrimaryColor_Click);
|
||||
//
|
||||
// checkBoxFontUnderline
|
||||
//
|
||||
this.checkBoxFontUnderline.AutoSize = true;
|
||||
this.checkBoxFontUnderline.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.checkBoxFontUnderline.Location = new System.Drawing.Point(169, 62);
|
||||
this.checkBoxFontUnderline.Location = new System.Drawing.Point(169, 59);
|
||||
this.checkBoxFontUnderline.Name = "checkBoxFontUnderline";
|
||||
this.checkBoxFontUnderline.Size = new System.Drawing.Size(71, 17);
|
||||
this.checkBoxFontUnderline.TabIndex = 7;
|
||||
@ -411,12 +503,13 @@
|
||||
this.numericUpDownFontSize.Name = "numericUpDownFontSize";
|
||||
this.numericUpDownFontSize.Size = new System.Drawing.Size(51, 20);
|
||||
this.numericUpDownFontSize.TabIndex = 4;
|
||||
this.numericUpDownFontSize.ValueChanged += new System.EventHandler(this.numericUpDownFontSize_ValueChanged);
|
||||
//
|
||||
// checkBoxFontItalic
|
||||
//
|
||||
this.checkBoxFontItalic.AutoSize = true;
|
||||
this.checkBoxFontItalic.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.checkBoxFontItalic.Location = new System.Drawing.Point(90, 62);
|
||||
this.checkBoxFontItalic.Location = new System.Drawing.Point(90, 59);
|
||||
this.checkBoxFontItalic.Name = "checkBoxFontItalic";
|
||||
this.checkBoxFontItalic.Size = new System.Drawing.Size(48, 17);
|
||||
this.checkBoxFontItalic.TabIndex = 6;
|
||||
@ -427,7 +520,7 @@
|
||||
//
|
||||
this.checkBoxFontBold.AutoSize = true;
|
||||
this.checkBoxFontBold.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.checkBoxFontBold.Location = new System.Drawing.Point(13, 62);
|
||||
this.checkBoxFontBold.Location = new System.Drawing.Point(13, 59);
|
||||
this.checkBoxFontBold.Name = "checkBoxFontBold";
|
||||
this.checkBoxFontBold.Size = new System.Drawing.Size(51, 17);
|
||||
this.checkBoxFontBold.TabIndex = 5;
|
||||
@ -441,6 +534,7 @@
|
||||
this.comboBoxFontName.Name = "comboBoxFontName";
|
||||
this.comboBoxFontName.Size = new System.Drawing.Size(188, 21);
|
||||
this.comboBoxFontName.TabIndex = 1;
|
||||
this.comboBoxFontName.TextChanged += new System.EventHandler(this.comboBoxFontName_TextChanged);
|
||||
//
|
||||
// labelFontSize
|
||||
//
|
||||
@ -470,6 +564,7 @@
|
||||
this.buttonApply.TabIndex = 4;
|
||||
this.buttonApply.Text = "&Apply";
|
||||
this.buttonApply.UseVisualStyleBackColor = true;
|
||||
this.buttonApply.Click += new System.EventHandler(this.buttonApply_Click);
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
@ -493,40 +588,33 @@
|
||||
this.buttonOK.TabIndex = 5;
|
||||
this.buttonOK.Text = "&OK";
|
||||
this.buttonOK.UseVisualStyleBackColor = true;
|
||||
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
|
||||
//
|
||||
// checkBoxColorEnabled
|
||||
// labelDuplicateStyleNames
|
||||
//
|
||||
this.checkBoxColorEnabled.AutoSize = true;
|
||||
this.checkBoxColorEnabled.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.checkBoxColorEnabled.Location = new System.Drawing.Point(16, 114);
|
||||
this.checkBoxColorEnabled.Name = "checkBoxColorEnabled";
|
||||
this.checkBoxColorEnabled.Size = new System.Drawing.Size(65, 17);
|
||||
this.checkBoxColorEnabled.TabIndex = 9;
|
||||
this.checkBoxColorEnabled.Text = "Enabled";
|
||||
this.checkBoxColorEnabled.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxBackgroundColorEnabled
|
||||
//
|
||||
this.checkBoxBackgroundColorEnabled.AutoSize = true;
|
||||
this.checkBoxBackgroundColorEnabled.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.checkBoxBackgroundColorEnabled.Location = new System.Drawing.Point(135, 114);
|
||||
this.checkBoxBackgroundColorEnabled.Name = "checkBoxBackgroundColorEnabled";
|
||||
this.checkBoxBackgroundColorEnabled.Size = new System.Drawing.Size(65, 17);
|
||||
this.checkBoxBackgroundColorEnabled.TabIndex = 10;
|
||||
this.checkBoxBackgroundColorEnabled.Text = "Enabled";
|
||||
this.checkBoxBackgroundColorEnabled.UseVisualStyleBackColor = true;
|
||||
this.labelDuplicateStyleNames.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.labelDuplicateStyleNames.AutoSize = true;
|
||||
this.labelDuplicateStyleNames.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelDuplicateStyleNames.ForeColor = System.Drawing.Color.Firebrick;
|
||||
this.labelDuplicateStyleNames.Location = new System.Drawing.Point(5, 632);
|
||||
this.labelDuplicateStyleNames.Name = "labelDuplicateStyleNames";
|
||||
this.labelDuplicateStyleNames.Size = new System.Drawing.Size(154, 13);
|
||||
this.labelDuplicateStyleNames.TabIndex = 11;
|
||||
this.labelDuplicateStyleNames.Text = "labelDuplicateStyleNames";
|
||||
//
|
||||
// WebVttStyleManager
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1110, 654);
|
||||
this.Controls.Add(this.labelDuplicateStyleNames);
|
||||
this.Controls.Add(this.buttonApply);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonOK);
|
||||
this.Controls.Add(this.groupBoxProperties);
|
||||
this.Controls.Add(this.groupBoxStyles);
|
||||
this.KeyPreview = true;
|
||||
this.MinimumSize = new System.Drawing.Size(1100, 680);
|
||||
this.Name = "WebVttStyleManager";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
@ -535,6 +623,10 @@
|
||||
this.groupBoxStyles.ResumeLayout(false);
|
||||
this.groupBoxProperties.ResumeLayout(false);
|
||||
this.groupBoxProperties.PerformLayout();
|
||||
this.groupBoxAfter.ResumeLayout(false);
|
||||
this.groupBoxAfter.PerformLayout();
|
||||
this.groupBoxBefore.ResumeLayout(false);
|
||||
this.groupBoxBefore.PerformLayout();
|
||||
this.groupBoxPreview.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPreview)).EndInit();
|
||||
this.groupBoxFont.ResumeLayout(false);
|
||||
@ -542,6 +634,7 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownShadowWidth)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFontSize)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@ -559,24 +652,23 @@
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderFontName;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderFontSize;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderUseCount;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderPrimaryColor;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderOutline;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderForeColor;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderBackgroundColor;
|
||||
private System.Windows.Forms.GroupBox groupBoxProperties;
|
||||
private System.Windows.Forms.NumericUpDown numericUpDownShadowWidth;
|
||||
private System.Windows.Forms.Label labelShadow;
|
||||
private System.Windows.Forms.TextBox textBoxStyleName;
|
||||
private System.Windows.Forms.Label labelStyleName;
|
||||
private System.Windows.Forms.Panel panelBackColor;
|
||||
private System.Windows.Forms.Button buttonBackColor;
|
||||
private System.Windows.Forms.Panel panelSecondaryColor;
|
||||
private System.Windows.Forms.Button buttonSecondaryColor;
|
||||
private System.Windows.Forms.Panel panelShadowColor;
|
||||
private System.Windows.Forms.Button buttonShadowColor;
|
||||
private System.Windows.Forms.Panel panelBackgroundColor;
|
||||
private System.Windows.Forms.Button buttonBackgroundColor;
|
||||
private System.Windows.Forms.Panel panelPrimaryColor;
|
||||
private System.Windows.Forms.Button buttonPrimaryColor;
|
||||
private System.Windows.Forms.GroupBox groupBoxPreview;
|
||||
private System.Windows.Forms.PictureBox pictureBoxPreview;
|
||||
private System.Windows.Forms.GroupBox groupBoxFont;
|
||||
private System.Windows.Forms.CheckBox checkBoxStrikeout;
|
||||
private System.Windows.Forms.Button buttonPickAttachmentFont;
|
||||
private System.Windows.Forms.CheckBox checkBoxFontUnderline;
|
||||
private System.Windows.Forms.NumericUpDown numericUpDownFontSize;
|
||||
private System.Windows.Forms.CheckBox checkBoxFontItalic;
|
||||
@ -589,5 +681,12 @@
|
||||
private System.Windows.Forms.Button buttonOK;
|
||||
private System.Windows.Forms.CheckBox checkBoxColorEnabled;
|
||||
private System.Windows.Forms.CheckBox checkBoxBackgroundColorEnabled;
|
||||
private System.Windows.Forms.GroupBox groupBoxAfter;
|
||||
private System.Windows.Forms.GroupBox groupBoxBefore;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderItalic;
|
||||
private System.Windows.Forms.Label labelAfter;
|
||||
private System.Windows.Forms.Label labelBefore;
|
||||
private System.Windows.Forms.CheckBox checkBoxShadowEnabled;
|
||||
private System.Windows.Forms.Label labelDuplicateStyleNames;
|
||||
}
|
||||
}
|
@ -1,23 +1,611 @@
|
||||
using System;
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms.VTT
|
||||
{
|
||||
public partial class WebVttStyleManager : Form
|
||||
{
|
||||
public string Header { get; set; }
|
||||
private readonly List<WebVttStyle> _webVttStyles;
|
||||
private readonly List<WebVttStyle> _originalWebVttStyles;
|
||||
private WebVttStyle _currentStyle;
|
||||
private readonly Subtitle _subtitle;
|
||||
private string _startName;
|
||||
private string _editedName;
|
||||
private bool _doUpdate;
|
||||
|
||||
public WebVttStyleManager(Subtitle subtitle)
|
||||
public WebVttStyleManager(Subtitle subtitle, int index)
|
||||
{
|
||||
UiUtil.PreInitialize(this);
|
||||
InitializeComponent();
|
||||
UiUtil.FixFonts(this);
|
||||
UiUtil.FixLargeFonts(this, buttonOK);
|
||||
|
||||
_subtitle = subtitle;
|
||||
_webVttStyles = WebVttHelper.GetStyles(subtitle);
|
||||
_originalWebVttStyles = WebVttHelper.GetStyles(subtitle);
|
||||
Header = subtitle.Header;
|
||||
InitializeStylesListView(_subtitle.GetParagraphOrDefault(index)?.Extra);
|
||||
CheckDuplicateStyles();
|
||||
|
||||
var fontNames = new List<string>();
|
||||
foreach (var x in FontFamily.Families)
|
||||
{
|
||||
fontNames.Add(x.Name);
|
||||
}
|
||||
comboBoxFontName.Items.Clear();
|
||||
comboBoxFontName.Items.AddRange(fontNames.ToArray<object>());
|
||||
}
|
||||
|
||||
private void InitializeStylesListView(string currentStyleName)
|
||||
{
|
||||
listViewStyles.Items.Clear();
|
||||
foreach (var style in _webVttStyles)
|
||||
{
|
||||
AddStyle(listViewStyles, style, _subtitle);
|
||||
}
|
||||
|
||||
if (listViewStyles.Items.Count > 0)
|
||||
{
|
||||
listViewStyles.Items[0].Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void AddStyle(ListView lv, WebVttStyle style, Subtitle subtitle)
|
||||
{
|
||||
AddStyle(lv, style, subtitle, lv.Items.Count);
|
||||
}
|
||||
|
||||
public static void AddStyle(ListView lv, WebVttStyle style, Subtitle subtitle, int insertAt)
|
||||
{
|
||||
// Style name - 0
|
||||
var item = new ListViewItem(style.Name.Trim().TrimStart('.'))
|
||||
{
|
||||
Checked = true,
|
||||
UseItemStyleForSubItems = false
|
||||
};
|
||||
|
||||
// Font name - 1
|
||||
var subItem = new ListViewItem.ListViewSubItem(item, string.IsNullOrEmpty(style.FontName) ? "- " : style.FontName);
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
// Font size - 2
|
||||
subItem = new ListViewItem.ListViewSubItem(item, style.FontSize.HasValue ? style.FontSize.HasValue.ToString(CultureInfo.InvariantCulture) : "-");
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
// Italic - 3
|
||||
subItem = new ListViewItem.ListViewSubItem(item, style.Italic.HasValue && style.Italic.Value ? LanguageSettings.Current.General.Yes : "-");
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
// Background color - 4
|
||||
subItem = new ListViewItem.ListViewSubItem(item, string.Empty) { BackColor = style.BackgroundColor.HasValue ? style.BackgroundColor.Value : UiUtil.BackColor };
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
// Color - 5
|
||||
subItem = new ListViewItem.ListViewSubItem(item, string.Empty)
|
||||
{
|
||||
BackColor = style.Color ?? UiUtil.BackColor,
|
||||
Text = LanguageSettings.Current.General.Text,
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
var fontStyle = FontStyle.Regular;
|
||||
if (style.Bold.HasValue && style.Bold == true)
|
||||
{
|
||||
fontStyle |= FontStyle.Bold;
|
||||
}
|
||||
if (style.Italic.HasValue && style.Italic == true)
|
||||
{
|
||||
fontStyle |= FontStyle.Italic;
|
||||
}
|
||||
if (style.Underline.HasValue && style.Underline == true)
|
||||
{
|
||||
fontStyle |= FontStyle.Underline;
|
||||
}
|
||||
if (style.StrikeThrough.HasValue && style.StrikeThrough == true)
|
||||
{
|
||||
fontStyle |= FontStyle.Strikeout;
|
||||
}
|
||||
subItem.Font = new Font(style.FontName, subItem.Font.Size, fontStyle);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignored
|
||||
}
|
||||
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
|
||||
// Use count
|
||||
var count = 0;
|
||||
foreach (var p in subtitle.Paragraphs)
|
||||
{
|
||||
if (p.Text.Contains(style.Name + ".", StringComparison.Ordinal) ||
|
||||
p.Text.Contains(style.Name + ">", StringComparison.Ordinal))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
subItem = new ListViewItem.ListViewSubItem(item, count.ToString());
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
lv.Items.Insert(insertAt, item);
|
||||
}
|
||||
|
||||
private void listViewStyles_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewStyles.SelectedItems.Count == 1)
|
||||
{
|
||||
var styleName = "." + listViewStyles.SelectedItems[0].Text;
|
||||
_startName = styleName;
|
||||
_editedName = null;
|
||||
var style = _webVttStyles.FirstOrDefault(p => p.Name == styleName);
|
||||
SetControlsFromStyle(style);
|
||||
_doUpdate = true;
|
||||
groupBoxProperties.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
groupBoxProperties.Enabled = false;
|
||||
_doUpdate = false;
|
||||
_startName = null;
|
||||
_currentStyle = null;
|
||||
pictureBoxPreview.Image?.Dispose();
|
||||
pictureBoxPreview.Image = new Bitmap(1, 1);
|
||||
}
|
||||
|
||||
UpdateCurrentFileButtonsState();
|
||||
}
|
||||
|
||||
private void SetControlsFromStyle(WebVttStyle style)
|
||||
{
|
||||
_currentStyle = style;
|
||||
|
||||
textBoxStyleName.Text = style.Name.RemoveChar('.');
|
||||
textBoxStyleName.BackColor = listViewStyles.BackColor;
|
||||
comboBoxFontName.Text = style.FontName;
|
||||
|
||||
checkBoxFontItalic.Checked = style.Italic.HasValue && style.Italic.Value;
|
||||
checkBoxFontBold.Checked = style.Bold.HasValue && style.Bold.Value;
|
||||
checkBoxFontUnderline.Checked = style.Underline.HasValue && style.Underline.Value;
|
||||
checkBoxStrikeout.Checked = style.StrikeThrough.HasValue && style.StrikeThrough.Value;
|
||||
|
||||
if (style.FontSize.HasValue && style.FontSize > 0 && style.FontSize <= numericUpDownFontSize.Maximum)
|
||||
{
|
||||
numericUpDownFontSize.Value = style.FontSize.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
numericUpDownFontSize.Value = 0;
|
||||
}
|
||||
|
||||
if (style.Color.HasValue)
|
||||
{
|
||||
panelPrimaryColor.BackColor = style.Color.Value;
|
||||
checkBoxColorEnabled.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
checkBoxColorEnabled.Checked = false;
|
||||
panelPrimaryColor.BackColor = Color.Transparent;
|
||||
}
|
||||
|
||||
if (style.BackgroundColor.HasValue)
|
||||
{
|
||||
panelBackgroundColor.BackColor = style.BackgroundColor.Value;
|
||||
checkBoxBackgroundColorEnabled.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
checkBoxBackgroundColorEnabled.Checked = false;
|
||||
panelBackgroundColor.BackColor = Color.Transparent;
|
||||
}
|
||||
|
||||
if (style.ShadowColor.HasValue)
|
||||
{
|
||||
panelBackgroundColor.BackColor = style.ShadowColor.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
panelShadowColor.BackColor = Color.Transparent;
|
||||
}
|
||||
|
||||
if (style.ShadowWidth.HasValue && style.ShadowWidth >= 0 && style.ShadowWidth <= numericUpDownShadowWidth.Maximum)
|
||||
{
|
||||
numericUpDownShadowWidth.Value = style.ShadowWidth.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
numericUpDownShadowWidth.Value = 0;
|
||||
}
|
||||
|
||||
var beforeStyle = _originalWebVttStyles.FirstOrDefault(p => p.Name == style.Name);
|
||||
if (beforeStyle == null)
|
||||
{
|
||||
labelBefore.Text = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
labelBefore.Text = style.ToString().Replace("; ", ";" + Environment.NewLine);
|
||||
}
|
||||
|
||||
UpdateRawBeforeStyle();
|
||||
}
|
||||
|
||||
private void UpdateRawBeforeStyle()
|
||||
{
|
||||
if (_currentStyle == null)
|
||||
{
|
||||
labelAfter.Text = string.Empty;
|
||||
labelBefore.Text = string.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
labelAfter.Text = _currentStyle.ToString().Replace("; ", ";" + Environment.NewLine);
|
||||
}
|
||||
|
||||
private void UpdateCurrentFileButtonsState()
|
||||
{
|
||||
var oneOrMoreSelected = listViewStyles.SelectedItems.Count > 0;
|
||||
buttonRemove.Enabled = oneOrMoreSelected;
|
||||
buttonCopy.Enabled = oneOrMoreSelected;
|
||||
}
|
||||
|
||||
private void panelPrimaryColor_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var colorChooser = new ColorChooser { Color = panelPrimaryColor.BackColor })
|
||||
{
|
||||
if (colorChooser.ShowDialog() != DialogResult.OK || _currentStyle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
checkBoxColorEnabled.Checked = true;
|
||||
panelPrimaryColor.BackColor = colorChooser.Color;
|
||||
_currentStyle.Color = colorChooser.Color;
|
||||
listViewStyles.SelectedItems[0].SubItems[5].BackColor = colorChooser.Color;
|
||||
UpdateRawBeforeStyle();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonPrimaryColor_Click(object sender, EventArgs e)
|
||||
{
|
||||
panelPrimaryColor_Click(null, null);
|
||||
}
|
||||
|
||||
private void panelBackgroundColor_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var colorChooser = new ColorChooser { Color = panelBackgroundColor.BackColor })
|
||||
{
|
||||
if (colorChooser.ShowDialog() != DialogResult.OK || _currentStyle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
checkBoxBackgroundColorEnabled.Checked = true;
|
||||
panelBackgroundColor.BackColor = colorChooser.Color;
|
||||
_currentStyle.BackgroundColor = colorChooser.Color;
|
||||
listViewStyles.SelectedItems[0].SubItems[4].BackColor = colorChooser.Color;
|
||||
UpdateRawBeforeStyle();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonBackgroundColor_Click(object sender, EventArgs e)
|
||||
{
|
||||
panelBackgroundColor_Click(null, null);
|
||||
}
|
||||
|
||||
private void panelShadowColor_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var colorChooser = new ColorChooser { Color = panelShadowColor.BackColor })
|
||||
{
|
||||
if (colorChooser.ShowDialog() != DialogResult.OK || _currentStyle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
checkBoxShadowEnabled.Checked = true;
|
||||
panelShadowColor.BackColor = colorChooser.Color;
|
||||
_currentStyle.ShadowColor = colorChooser.Color;
|
||||
}
|
||||
|
||||
UpdateRawBeforeStyle();
|
||||
}
|
||||
|
||||
private void checkBoxColorEnabled_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_doUpdate || _currentStyle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var checkBox = (CheckBox)sender;
|
||||
if (checkBox.Checked)
|
||||
{
|
||||
_currentStyle.Color = panelPrimaryColor.BackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentStyle.Color = null;
|
||||
}
|
||||
|
||||
listViewStyles.SelectedItems[0].SubItems[5].BackColor = _currentStyle.Color ?? UiUtil.BackColor;
|
||||
UpdateRawBeforeStyle();
|
||||
}
|
||||
|
||||
private void checkBoxBackgroundColorEnabled_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_doUpdate || _currentStyle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var checkBox = (CheckBox)sender;
|
||||
if (checkBox.Checked)
|
||||
{
|
||||
_currentStyle.BackgroundColor = panelBackgroundColor.BackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentStyle.BackgroundColor = null;
|
||||
}
|
||||
|
||||
listViewStyles.SelectedItems[0].SubItems[4].BackColor = _currentStyle.BackgroundColor ?? UiUtil.BackColor;
|
||||
UpdateRawBeforeStyle();
|
||||
}
|
||||
|
||||
private void checkBoxShadowEnabled_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_doUpdate || _currentStyle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var checkBox = (CheckBox)sender;
|
||||
if (checkBox.Checked)
|
||||
{
|
||||
_currentStyle.ShadowColor = panelBackgroundColor.BackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentStyle.ShadowColor = null;
|
||||
}
|
||||
|
||||
UpdateRawBeforeStyle();
|
||||
}
|
||||
|
||||
private void comboBoxFontName_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_doUpdate || _currentStyle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(comboBoxFontName.Text))
|
||||
{
|
||||
_currentStyle.FontName = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentStyle.FontName = comboBoxFontName.Text;
|
||||
}
|
||||
|
||||
listViewStyles.SelectedItems[0].SubItems[1].Text = comboBoxFontName.Text;
|
||||
UpdateRawBeforeStyle();
|
||||
}
|
||||
|
||||
private void numericUpDownFontSize_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_doUpdate || _currentStyle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (numericUpDownFontSize.Value == 0)
|
||||
{
|
||||
_currentStyle.FontSize = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentStyle.FontSize = numericUpDownFontSize.Value;
|
||||
}
|
||||
|
||||
listViewStyles.SelectedItems[0].SubItems[2].Text = _currentStyle.FontSize == null ? "-" : numericUpDownFontSize.Value.ToString();
|
||||
UpdateRawBeforeStyle();
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var style = new WebVttStyle { Name = GetStyleName() };
|
||||
_webVttStyles.Add(style);
|
||||
AddStyle(listViewStyles, style, _subtitle);
|
||||
|
||||
foreach (ListViewItem listViewItem in listViewStyles.Items)
|
||||
{
|
||||
listViewItem.Selected = false;
|
||||
}
|
||||
listViewStyles.Items[listViewStyles.Items.Count - 1].Selected = true;
|
||||
listViewStyles.EnsureVisible(listViewStyles.Items.Count - 1);
|
||||
|
||||
CheckDuplicateStyles();
|
||||
}
|
||||
|
||||
private string GetStyleName()
|
||||
{
|
||||
const string baseName = ".new";
|
||||
var name = baseName;
|
||||
var count = 2;
|
||||
while (_webVttStyles.Any(p => p.Name == name))
|
||||
{
|
||||
name = baseName + " " + count;
|
||||
count++;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
private void buttonOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetHeader();
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
private void SetHeader()
|
||||
{
|
||||
var header = _subtitle.Header ?? string.Empty;
|
||||
if (!header.StartsWith("WEBVTT"))
|
||||
{
|
||||
header = "WEBVTT";
|
||||
}
|
||||
|
||||
var styleOn = false;
|
||||
var sb = new StringBuilder();
|
||||
foreach (var line in header.SplitToLines())
|
||||
{
|
||||
if (line == "STYLE")
|
||||
{
|
||||
styleOn = true;
|
||||
}
|
||||
else if (styleOn)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
else if (line == string.Empty && styleOn)
|
||||
{
|
||||
styleOn = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine(line);
|
||||
}
|
||||
}
|
||||
|
||||
var sbStyles = new StringBuilder();
|
||||
sbStyles.AppendLine("STYLE");
|
||||
foreach (var style in _webVttStyles)
|
||||
{
|
||||
var rawStyle = "::cue(." + style.Name.RemoveChar('.') + ") { " + WebVttHelper.GetCssProperties(style) + " }";
|
||||
sbStyles.AppendLine(rawStyle);
|
||||
}
|
||||
|
||||
header = sb.ToString().Trim() + Environment.NewLine + Environment.NewLine + sbStyles.ToString();
|
||||
Header = header;
|
||||
}
|
||||
|
||||
private void buttonApply_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetHeader();
|
||||
_subtitle.Header = Header;
|
||||
}
|
||||
|
||||
private void buttonRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewStyles.SelectedItems.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var askText = listViewStyles.SelectedItems.Count > 1 ?
|
||||
string.Format(LanguageSettings.Current.Main.DeleteXLinesPrompt, listViewStyles.SelectedItems.Count) :
|
||||
LanguageSettings.Current.Main.DeleteOneLinePrompt;
|
||||
|
||||
if (Configuration.Settings.General.PromptDeleteLines &&
|
||||
MessageBox.Show(askText, string.Empty, MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (ListViewItem selectedItem in listViewStyles.SelectedItems)
|
||||
{
|
||||
var name = selectedItem.Text;
|
||||
listViewStyles.Items.RemoveAt(listViewStyles.SelectedItems[0].Index);
|
||||
_webVttStyles.RemoveAll(p => p.Name == name);
|
||||
}
|
||||
|
||||
if (listViewStyles.Items.Count == 0)
|
||||
{
|
||||
InitializeStylesListView(string.Empty);
|
||||
}
|
||||
|
||||
CheckDuplicateStyles();
|
||||
}
|
||||
|
||||
private void CheckDuplicateStyles()
|
||||
{
|
||||
labelDuplicateStyleNames.Text = string.Empty;
|
||||
var duplicateStyles = new List<string>();
|
||||
foreach (var style in _webVttStyles)
|
||||
{
|
||||
if (_webVttStyles.Count(p => p.Name == style.Name) > 1 && !duplicateStyles.Contains(style.Name))
|
||||
{
|
||||
duplicateStyles.Add(style.Name);
|
||||
}
|
||||
}
|
||||
|
||||
if (duplicateStyles.Count > 0)
|
||||
{
|
||||
labelDuplicateStyleNames.Text = string.Format(LanguageSettings.Current.SubStationAlphaStyles.DuplicateStyleNames, string.Join(", ", duplicateStyles));
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonRemoveAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
var askText = listViewStyles.Items.Count == 1 ?
|
||||
LanguageSettings.Current.Main.DeleteOneLinePrompt :
|
||||
string.Format(LanguageSettings.Current.Main.DeleteXLinesPrompt, listViewStyles.Items.Count);
|
||||
|
||||
if (MessageBox.Show(askText, string.Empty, MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
listViewStyles.Items.Clear();
|
||||
_webVttStyles.Clear();
|
||||
InitializeStylesListView(string.Empty);
|
||||
CheckDuplicateStyles();
|
||||
}
|
||||
|
||||
private void buttonCopy_Click(object sender, EventArgs e)
|
||||
{
|
||||
var selectionCount = listViewStyles.SelectedItems.Count;
|
||||
if (selectionCount <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (ListViewItem selectedItem in listViewStyles.SelectedItems)
|
||||
{
|
||||
var styleName = selectedItem.Text;
|
||||
var oldStyle = _currentStyle;
|
||||
var style = new WebVttStyle(oldStyle) { Name = "." + string.Format(LanguageSettings.Current.SubStationAlphaStyles.CopyOfY, styleName.RemoveChar('.')) }; // Copy constructor
|
||||
|
||||
if (_webVttStyles.FirstOrDefault(p=>p.Name == style.Name) != null)
|
||||
{
|
||||
var count = 2;
|
||||
var doRepeat = true;
|
||||
while (doRepeat)
|
||||
{
|
||||
style.Name = "." + string.Format(LanguageSettings.Current.SubStationAlphaStyles.CopyXOfY, count, styleName.RemoveChar('.'));
|
||||
doRepeat = _webVttStyles.FirstOrDefault(p => p.Name == style.Name) != null;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
_doUpdate = false;
|
||||
AddStyle(listViewStyles, style, _subtitle);
|
||||
_webVttStyles.Add(style);
|
||||
_doUpdate = true;
|
||||
}
|
||||
CheckDuplicateStyles();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user