mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 19:52:48 +01:00
[AdjustDisplayDuration] - Update
This commit is contained in:
parent
ad907ac803
commit
a22e462d4b
@ -8,6 +8,10 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
public sealed partial class AdjustDisplayDuration : PositionAndSizeForm
|
public sealed partial class AdjustDisplayDuration : PositionAndSizeForm
|
||||||
{
|
{
|
||||||
|
private const string Sec = "seconds";
|
||||||
|
private const string Per = "percent";
|
||||||
|
private const string Recal = "recalc";
|
||||||
|
|
||||||
public string AdjustValue
|
public string AdjustValue
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -15,34 +19,16 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
if (radioButtonPercent.Checked)
|
if (radioButtonPercent.Checked)
|
||||||
return numericUpDownPercent.Value.ToString(CultureInfo.InvariantCulture);
|
return numericUpDownPercent.Value.ToString(CultureInfo.InvariantCulture);
|
||||||
if (radioButtonAutoRecalculate.Checked)
|
if (radioButtonAutoRecalculate.Checked)
|
||||||
return radioButtonAutoRecalculate.Text + ", " + labelMaxCharsPerSecond.Text + ": " + numericUpDownMaxCharsSec.Value; // TODO: Make language string with string.Format
|
return $"{radioButtonAutoRecalculate.Text}, {labelMaxCharsPerSecond.Text}: {numericUpDownMaxCharsSec.Value}";
|
||||||
return numericUpDownSeconds.Value.ToString(CultureInfo.InvariantCulture);
|
return numericUpDownSeconds.Value.ToString(CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AdjustUsingPercent
|
public bool AdjustUsingPercent => radioButtonPercent.Checked;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return radioButtonPercent.Checked;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AdjustUsingSeconds
|
public bool AdjustUsingSeconds => radioButtonSeconds.Checked;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return radioButtonSeconds.Checked;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public decimal MaxCharactersPerSecond
|
public decimal MaxCharactersPerSecond => numericUpDownMaxCharsSec.Value;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return numericUpDownMaxCharsSec.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AdjustDisplayDuration()
|
public AdjustDisplayDuration()
|
||||||
{
|
{
|
||||||
@ -51,13 +37,13 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
UiUtil.FixFonts(this);
|
UiUtil.FixFonts(this);
|
||||||
Icon = Properties.Resources.SubtitleEditFormIcon;
|
Icon = Properties.Resources.SubtitleEditFormIcon;
|
||||||
|
|
||||||
if (Configuration.Settings.Tools.AdjustDurationSeconds >= numericUpDownSeconds.Minimum &&
|
decimal adjustSeconds = Configuration.Settings.Tools.AdjustDurationSeconds;
|
||||||
Configuration.Settings.Tools.AdjustDurationSeconds <= numericUpDownSeconds.Maximum)
|
if (adjustSeconds >= numericUpDownSeconds.Minimum && adjustSeconds <= numericUpDownSeconds.Maximum)
|
||||||
numericUpDownSeconds.Value = Configuration.Settings.Tools.AdjustDurationSeconds;
|
numericUpDownSeconds.Value = adjustSeconds;
|
||||||
|
|
||||||
if (Configuration.Settings.Tools.AdjustDurationPercent >= numericUpDownPercent.Minimum &&
|
int adjustPerscent = Configuration.Settings.Tools.AdjustDurationPercent;
|
||||||
Configuration.Settings.Tools.AdjustDurationPercent <= numericUpDownPercent.Maximum)
|
if (adjustPerscent >= numericUpDownPercent.Minimum && adjustPerscent <= numericUpDownPercent.Maximum)
|
||||||
numericUpDownPercent.Value = Configuration.Settings.Tools.AdjustDurationPercent;
|
numericUpDownPercent.Value = adjustPerscent;
|
||||||
|
|
||||||
numericUpDownMaxCharsSec.Value = (decimal)Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds;
|
numericUpDownMaxCharsSec.Value = (decimal)Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds;
|
||||||
|
|
||||||
@ -75,17 +61,17 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
|
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
|
||||||
FixLargeFonts();
|
FixLargeFonts();
|
||||||
|
|
||||||
if (Configuration.Settings.Tools.AdjustDurationLast == "seconds")
|
switch (Configuration.Settings.Tools.AdjustDurationLast)
|
||||||
{
|
{
|
||||||
radioButtonSeconds.Checked = true;
|
case Sec:
|
||||||
}
|
radioButtonSeconds.Checked = true;
|
||||||
else if (Configuration.Settings.Tools.AdjustDurationLast == "percent")
|
break;
|
||||||
{
|
case Per:
|
||||||
radioButtonPercent.Checked = true;
|
radioButtonPercent.Checked = true;
|
||||||
}
|
break;
|
||||||
else if (Configuration.Settings.Tools.AdjustDurationLast == "recalc")
|
case Recal:
|
||||||
{
|
radioButtonAutoRecalculate.Checked = true;
|
||||||
radioButtonAutoRecalculate.Checked = true;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,24 +95,9 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
private void FixEnabled()
|
private void FixEnabled()
|
||||||
{
|
{
|
||||||
if (radioButtonPercent.Checked)
|
numericUpDownPercent.Enabled = radioButtonPercent.Checked;
|
||||||
{
|
numericUpDownSeconds.Enabled = radioButtonSeconds.Checked;
|
||||||
numericUpDownPercent.Enabled = true;
|
numericUpDownMaxCharsSec.Enabled = radioButtonAutoRecalculate.Checked;
|
||||||
numericUpDownSeconds.Enabled = false;
|
|
||||||
numericUpDownMaxCharsSec.Enabled = false;
|
|
||||||
}
|
|
||||||
else if (radioButtonSeconds.Checked)
|
|
||||||
{
|
|
||||||
numericUpDownPercent.Enabled = false;
|
|
||||||
numericUpDownSeconds.Enabled = true;
|
|
||||||
numericUpDownMaxCharsSec.Enabled = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
numericUpDownPercent.Enabled = false;
|
|
||||||
numericUpDownSeconds.Enabled = false;
|
|
||||||
numericUpDownMaxCharsSec.Enabled = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RadioButtonSecondsCheckedChanged(object sender, EventArgs e)
|
private void RadioButtonSecondsCheckedChanged(object sender, EventArgs e)
|
||||||
@ -141,25 +112,20 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
if (radioButtonSeconds.Checked)
|
if (radioButtonSeconds.Checked)
|
||||||
{
|
{
|
||||||
Configuration.Settings.Tools.AdjustDurationLast = "seconds";
|
Configuration.Settings.Tools.AdjustDurationLast = Sec;
|
||||||
}
|
}
|
||||||
else if (radioButtonPercent.Checked)
|
else if (radioButtonPercent.Checked)
|
||||||
{
|
{
|
||||||
Configuration.Settings.Tools.AdjustDurationLast = "percent";
|
Configuration.Settings.Tools.AdjustDurationLast = Per;
|
||||||
}
|
}
|
||||||
else if (radioButtonAutoRecalculate.Checked)
|
else if (radioButtonAutoRecalculate.Checked)
|
||||||
{
|
{
|
||||||
Configuration.Settings.Tools.AdjustDurationLast = "recalc";
|
Configuration.Settings.Tools.AdjustDurationLast = Recal;
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void radioButtonAutoRecalculate_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
FixEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HideRecalculate()
|
public void HideRecalculate()
|
||||||
{
|
{
|
||||||
if (radioButtonAutoRecalculate.Checked)
|
if (radioButtonAutoRecalculate.Checked)
|
||||||
|
Loading…
Reference in New Issue
Block a user