Separate vertical margins in bd sup editor - thx von Suppé :)

to top/bottom
This commit is contained in:
niksedk 2022-03-30 14:49:06 +02:00
parent fc2afbf307
commit 2c25feacc6
4 changed files with 76 additions and 36 deletions

View File

@ -280,7 +280,8 @@ namespace Nikse.SubtitleEdit.Core.Common
public string ExportPenLineJoin { get; set; }
public Color BinEditBackgroundColor { get; set; }
public Color BinEditImageBackgroundColor { get; set; }
public int BinEditVerticalMargin { get; set; }
public int BinEditTopMargin { get; set; }
public int BinEditBottomMargin { get; set; }
public int BinEditLeftMargin { get; set; }
public int BinEditRightMargin { get; set; }
public bool FixCommonErrorsFixOverlapAllowEqualEndStart { get; set; }
@ -495,7 +496,8 @@ namespace Nikse.SubtitleEdit.Core.Common
ExportLastBorderWidth = 4;
BinEditBackgroundColor = Color.Black;
BinEditImageBackgroundColor = Color.Blue;
BinEditVerticalMargin = 10;
BinEditTopMargin = 10;
BinEditBottomMargin = 10;
BinEditLeftMargin = 10;
BinEditRightMargin = 10;
BridgeGapMilliseconds = 100;
@ -5210,10 +5212,16 @@ $HorzAlign = Center
settings.Tools.BinEditImageBackgroundColor = Color.FromArgb(int.Parse(subNode.InnerText, CultureInfo.InvariantCulture));
}
subNode = node.SelectSingleNode("BinEditVerticalMargin");
subNode = node.SelectSingleNode("BinEditTopMargin");
if (subNode != null)
{
settings.Tools.BinEditVerticalMargin = Convert.ToInt32(subNode.InnerText, CultureInfo.InvariantCulture);
settings.Tools.BinEditTopMargin = Convert.ToInt32(subNode.InnerText, CultureInfo.InvariantCulture);
}
subNode = node.SelectSingleNode("BinEditBottomMargin");
if (subNode != null)
{
settings.Tools.BinEditBottomMargin = Convert.ToInt32(subNode.InnerText, CultureInfo.InvariantCulture);
}
subNode = node.SelectSingleNode("BinEditLeftMargin");
@ -9681,7 +9689,8 @@ $HorzAlign = Center
textWriter.WriteElementString("MusicSymbolStyle", settings.Tools.MusicSymbolStyle);
textWriter.WriteElementString("BinEditBackgroundColor", settings.Tools.BinEditBackgroundColor.ToArgb().ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("BinEditImageBackgroundColor", settings.Tools.BinEditImageBackgroundColor.ToArgb().ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("BinEditVerticalMargin", settings.Tools.BinEditVerticalMargin.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("BinEditTopMargin", settings.Tools.BinEditTopMargin.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("BinEditBottomMargin", settings.Tools.BinEditBottomMargin.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("BinEditLeftMargin", settings.Tools.BinEditLeftMargin.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("BinEditRightMargin", settings.Tools.BinEditRightMargin.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("BridgeGapMilliseconds", settings.Tools.BridgeGapMilliseconds.ToString(CultureInfo.InvariantCulture));

View File

@ -2940,7 +2940,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
{
var index = subtitleListView1.SelectedIndices[i];
var extra = _extra[index];
extra.Y = Configuration.Settings.Tools.BinEditVerticalMargin;
extra.Y = Configuration.Settings.Tools.BinEditTopMargin;
if (index == idx)
{
@ -2964,7 +2964,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
var index = subtitleListView1.SelectedIndices[i];
var extra = _extra[index];
var bmp = extra.Bitmap != null ? (Bitmap)extra.Bitmap.Clone() : GetBitmap(_binSubtitles[index]);
extra.Y = (int)Math.Round(numericUpDownScreenHeight.Value - bmp.Height - Configuration.Settings.Tools.BinEditVerticalMargin);
extra.Y = (int)Math.Round(numericUpDownScreenHeight.Value - bmp.Height - Configuration.Settings.Tools.BinEditBottomMargin);
if (index == idx)
{
@ -3275,15 +3275,15 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
{
case ContentAlignment.BottomLeft:
extra.X = Configuration.Settings.Tools.BinEditLeftMargin;
extra.Y = (int)Math.Round(numericUpDownScreenHeight.Value - bmp.Height - Configuration.Settings.Tools.BinEditVerticalMargin);
extra.Y = (int)Math.Round(numericUpDownScreenHeight.Value - bmp.Height - Configuration.Settings.Tools.BinEditBottomMargin);
break;
case ContentAlignment.BottomCenter:
extra.X = (int)Math.Round((numericUpDownScreenWidth.Value - bmp.Width) / 2.0m);
extra.Y = (int)Math.Round(numericUpDownScreenHeight.Value - bmp.Height - Configuration.Settings.Tools.BinEditVerticalMargin);
extra.Y = (int)Math.Round(numericUpDownScreenHeight.Value - bmp.Height - Configuration.Settings.Tools.BinEditBottomMargin);
break;
case ContentAlignment.BottomRight:
extra.X = (int)Math.Round(numericUpDownScreenWidth.Value - bmp.Width - Configuration.Settings.Tools.BinEditRightMargin);
extra.Y = (int)Math.Round(numericUpDownScreenHeight.Value - bmp.Height - Configuration.Settings.Tools.BinEditVerticalMargin);
extra.Y = (int)Math.Round(numericUpDownScreenHeight.Value - bmp.Height - Configuration.Settings.Tools.BinEditBottomMargin);
break;
case ContentAlignment.MiddleLeft:
extra.X = Configuration.Settings.Tools.BinEditLeftMargin;
@ -3299,15 +3299,15 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
break;
case ContentAlignment.TopLeft:
extra.X = Configuration.Settings.Tools.BinEditLeftMargin;
extra.Y = Configuration.Settings.Tools.BinEditVerticalMargin;
extra.Y = Configuration.Settings.Tools.BinEditTopMargin;
break;
case ContentAlignment.TopCenter:
extra.X = (int)Math.Round((numericUpDownScreenWidth.Value - bmp.Width) / 2.0m);
extra.Y = Configuration.Settings.Tools.BinEditVerticalMargin;
extra.Y = Configuration.Settings.Tools.BinEditTopMargin;
break;
case ContentAlignment.TopRight:
extra.X = (int)Math.Round(numericUpDownScreenWidth.Value - bmp.Width - Configuration.Settings.Tools.BinEditRightMargin);
extra.Y = Configuration.Settings.Tools.BinEditVerticalMargin;
extra.Y = Configuration.Settings.Tools.BinEditTopMargin;
break;
}
}

View File

@ -34,20 +34,23 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
this.panelImageBackgroundColor = new System.Windows.Forms.Panel();
this.buttonImageBackgroundColor = new System.Windows.Forms.Button();
this.groupBoxMargins = new System.Windows.Forms.GroupBox();
this.numericUpDownMarginVertical = new System.Windows.Forms.NumericUpDown();
this.numericUpDownMarginTop = new System.Windows.Forms.NumericUpDown();
this.numericUpDownMarginRight = new System.Windows.Forms.NumericUpDown();
this.numericUpDownMarginLeft = new System.Windows.Forms.NumericUpDown();
this.labelMarginVertical = new System.Windows.Forms.Label();
this.labelMarginTop = new System.Windows.Forms.Label();
this.labelMarginRight = new System.Windows.Forms.Label();
this.labelMarginLeft = new System.Windows.Forms.Label();
this.groupBoxColors = new System.Windows.Forms.GroupBox();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.numericUpDownMarginBottom = new System.Windows.Forms.NumericUpDown();
this.labelMarginBottom = new System.Windows.Forms.Label();
this.groupBoxMargins.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMarginVertical)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMarginTop)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMarginRight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMarginLeft)).BeginInit();
this.groupBoxColors.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMarginBottom)).BeginInit();
this.SuspendLayout();
//
// panelBackgroundColor
@ -90,10 +93,12 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
//
// groupBoxMargins
//
this.groupBoxMargins.Controls.Add(this.numericUpDownMarginVertical);
this.groupBoxMargins.Controls.Add(this.numericUpDownMarginBottom);
this.groupBoxMargins.Controls.Add(this.labelMarginBottom);
this.groupBoxMargins.Controls.Add(this.numericUpDownMarginTop);
this.groupBoxMargins.Controls.Add(this.numericUpDownMarginRight);
this.groupBoxMargins.Controls.Add(this.numericUpDownMarginLeft);
this.groupBoxMargins.Controls.Add(this.labelMarginVertical);
this.groupBoxMargins.Controls.Add(this.labelMarginTop);
this.groupBoxMargins.Controls.Add(this.labelMarginRight);
this.groupBoxMargins.Controls.Add(this.labelMarginLeft);
this.groupBoxMargins.Location = new System.Drawing.Point(7, 134);
@ -103,17 +108,17 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
this.groupBoxMargins.TabStop = false;
this.groupBoxMargins.Text = "Margins";
//
// numericUpDownMarginVertical
// numericUpDownMarginTop
//
this.numericUpDownMarginVertical.Location = new System.Drawing.Point(188, 33);
this.numericUpDownMarginVertical.Maximum = new decimal(new int[] {
this.numericUpDownMarginTop.Location = new System.Drawing.Point(188, 33);
this.numericUpDownMarginTop.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.numericUpDownMarginVertical.Name = "numericUpDownMarginVertical";
this.numericUpDownMarginVertical.Size = new System.Drawing.Size(44, 20);
this.numericUpDownMarginVertical.TabIndex = 5;
this.numericUpDownMarginTop.Name = "numericUpDownMarginTop";
this.numericUpDownMarginTop.Size = new System.Drawing.Size(44, 20);
this.numericUpDownMarginTop.TabIndex = 5;
//
// numericUpDownMarginRight
//
@ -139,14 +144,14 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
this.numericUpDownMarginLeft.Size = new System.Drawing.Size(44, 20);
this.numericUpDownMarginLeft.TabIndex = 1;
//
// labelMarginVertical
// labelMarginTop
//
this.labelMarginVertical.AutoSize = true;
this.labelMarginVertical.Location = new System.Drawing.Point(185, 16);
this.labelMarginVertical.Name = "labelMarginVertical";
this.labelMarginVertical.Size = new System.Drawing.Size(42, 13);
this.labelMarginVertical.TabIndex = 4;
this.labelMarginVertical.Text = "Vertical";
this.labelMarginTop.AutoSize = true;
this.labelMarginTop.Location = new System.Drawing.Point(185, 16);
this.labelMarginTop.Name = "labelMarginTop";
this.labelMarginTop.Size = new System.Drawing.Size(26, 13);
this.labelMarginTop.TabIndex = 4;
this.labelMarginTop.Text = "Top";
//
// labelMarginRight
//
@ -204,6 +209,27 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// numericUpDownMarginBottom
//
this.numericUpDownMarginBottom.Location = new System.Drawing.Point(274, 33);
this.numericUpDownMarginBottom.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.numericUpDownMarginBottom.Name = "numericUpDownMarginBottom";
this.numericUpDownMarginBottom.Size = new System.Drawing.Size(44, 20);
this.numericUpDownMarginBottom.TabIndex = 7;
//
// labelMarginBottom
//
this.labelMarginBottom.AutoSize = true;
this.labelMarginBottom.Location = new System.Drawing.Point(271, 16);
this.labelMarginBottom.Name = "labelMarginBottom";
this.labelMarginBottom.Size = new System.Drawing.Size(40, 13);
this.labelMarginBottom.TabIndex = 6;
this.labelMarginBottom.Text = "Bottom";
//
// BinEditSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -225,10 +251,11 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.BinEditSettings_KeyDown);
this.groupBoxMargins.ResumeLayout(false);
this.groupBoxMargins.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMarginVertical)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMarginTop)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMarginRight)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMarginLeft)).EndInit();
this.groupBoxColors.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMarginBottom)).EndInit();
this.ResumeLayout(false);
}
@ -240,14 +267,16 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
private System.Windows.Forms.Panel panelImageBackgroundColor;
private System.Windows.Forms.Button buttonImageBackgroundColor;
private System.Windows.Forms.GroupBox groupBoxMargins;
private System.Windows.Forms.NumericUpDown numericUpDownMarginVertical;
private System.Windows.Forms.NumericUpDown numericUpDownMarginTop;
private System.Windows.Forms.NumericUpDown numericUpDownMarginRight;
private System.Windows.Forms.NumericUpDown numericUpDownMarginLeft;
private System.Windows.Forms.Label labelMarginVertical;
private System.Windows.Forms.Label labelMarginTop;
private System.Windows.Forms.Label labelMarginRight;
private System.Windows.Forms.Label labelMarginLeft;
private System.Windows.Forms.GroupBox groupBoxColors;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.NumericUpDown numericUpDownMarginBottom;
private System.Windows.Forms.Label labelMarginBottom;
}
}

View File

@ -18,7 +18,8 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
numericUpDownMarginLeft.Value = Configuration.Settings.Tools.BinEditLeftMargin;
numericUpDownMarginRight.Value = Configuration.Settings.Tools.BinEditRightMargin;
numericUpDownMarginVertical.Value = Configuration.Settings.Tools.BinEditVerticalMargin;
numericUpDownMarginTop.Value = Configuration.Settings.Tools.BinEditTopMargin;
numericUpDownMarginBottom.Value = Configuration.Settings.Tools.BinEditBottomMargin;
UiUtil.FixLargeFonts(this, buttonOK);
Text = LanguageSettings.Current.Settings.Title;
@ -33,7 +34,8 @@ namespace Nikse.SubtitleEdit.Forms.BinaryEdit
Configuration.Settings.Tools.BinEditLeftMargin = (int)numericUpDownMarginLeft.Value;
Configuration.Settings.Tools.BinEditRightMargin = (int)numericUpDownMarginRight.Value;
Configuration.Settings.Tools.BinEditVerticalMargin = (int)numericUpDownMarginVertical.Value;
Configuration.Settings.Tools.BinEditTopMargin = (int)numericUpDownMarginTop.Value;
Configuration.Settings.Tools.BinEditBottomMargin = (int)numericUpDownMarginBottom.Value;
DialogResult = DialogResult.OK;
}