- Generates undo entry when changing layer via the edit box.

- Adds SetLayer entry in LanguageStructure.MainControls
- Only shows layer input control for ASSA files.
This commit is contained in:
JonSchram 2023-06-16 16:05:11 -04:00
commit 24cefe7f2b
5 changed files with 25 additions and 7 deletions

View File

@ -1474,6 +1474,7 @@ To use an API key, go to "Options -> Settings -> Tools" to enter your Goog
<Next>Next &gt;</Next>
<AutoBreak>Auto &amp;br</AutoBreak>
<Unbreak>Unbreak</Unbreak>
<SetLayer>Set layer</SetLayer>
</Controls>
<VideoControls>
<Translate>Translate</Translate>

View File

@ -4583,7 +4583,7 @@ namespace Nikse.SubtitleEdit.Forms
this.numericUpDownLayer.Name = "numericUpDownLayer";
this.numericUpDownLayer.Size = new System.Drawing.Size(37, 20);
this.numericUpDownLayer.TabIndex = 46;
this.numericUpDownLayer.ValueChanged += new System.EventHandler(this.numericUpDownLayer_ValueChanged);
this.numericUpDownLayer.ValueChanged += new System.EventHandler(this.NumericUpDownLayer_ValueChanged);
//
// labelLayer
//

View File

@ -10768,7 +10768,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void numericUpDownLayer_ValueChanged(object sender, EventArgs e)
private void NumericUpDownLayer_ValueChanged(object sender, EventArgs e)
{
var idx = _subtitleListViewIndex;
var p = _subtitle.GetParagraphOrDefault(idx);
@ -10777,7 +10777,14 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
p.Layer = (int)numericUpDownLayer.Value;
var format = GetCurrentSubtitleFormat();
bool isAssa = format.GetType() == typeof(AdvancedSubStationAlpha);
if (isAssa)
{
int layer = (int)numericUpDownLayer.Value;
MakeHistoryForUndo(LanguageSettings.Current.Main.Controls.SetLayer + ": " + layer);
p.Layer = layer;
}
}
public Point GetPositionInForm(Control ctrl)
@ -12917,9 +12924,17 @@ namespace Nikse.SubtitleEdit.Forms
textBoxListViewText.Text = p.Text;
textBoxListViewText.TextChanged += TextBoxListViewTextTextChanged;
_listViewTextUndoLast = p.Text;
numericUpDownLayer.ValueChanged -= numericUpDownLayer_ValueChanged;
numericUpDownLayer.Value = p.Layer;
numericUpDownLayer.ValueChanged += numericUpDownLayer_ValueChanged;
var format = GetCurrentSubtitleFormat();
bool isAssa = format.GetType() == typeof(AdvancedSubStationAlpha);
numericUpDownLayer.Visible = isAssa;
labelLayer.Visible = isAssa;
if (isAssa)
{
numericUpDownLayer.ValueChanged -= NumericUpDownLayer_ValueChanged;
numericUpDownLayer.Value = p.Layer;
numericUpDownLayer.ValueChanged += NumericUpDownLayer_ValueChanged;
}
timeUpDownStartTime.MaskedTextBox.TextChanged -= MaskedTextBoxTextChanged;
timeUpDownStartTime.TimeCode = p.StartTime;

View File

@ -2040,7 +2040,8 @@ namespace Nikse.SubtitleEdit.Logic
Previous = "< Prev",
Next = "Next >",
AutoBreak = "Auto &br",
Unbreak = "Unbreak"
Unbreak = "Unbreak",
SetLayer = "Set Layer"
},
VideoControls = new LanguageStructure.Main.MainVideoControls

View File

@ -1898,6 +1898,7 @@ namespace Nikse.SubtitleEdit.Logic
public string Next { get; set; }
public string AutoBreak { get; set; }
public string Unbreak { get; set; }
public string SetLayer { get; set; }
}
public class MainVideoControls