mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
parent
87f6ed1fb0
commit
2cd4453ca0
@ -397,6 +397,7 @@ Read more info (web)?</WhisperNotFound>
|
||||
<OnlyChangeAllUppercaseLines>Only change all uppercase lines.</OnlyChangeAllUppercaseLines>
|
||||
<AllUppercase>ALL UPPERCASE</AllUppercase>
|
||||
<AllLowercase>all lowercase</AllLowercase>
|
||||
<ProperCase>Proper Case</ProperCase>
|
||||
</ChangeCasing>
|
||||
<ChangeCasingNames>
|
||||
<Title>Change casing - Names</Title>
|
||||
|
@ -12,6 +12,7 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
public bool FixNormal = true;
|
||||
public bool FixNormalOnlyAllUppercase = false;
|
||||
public bool FixMakeLowercase = false;
|
||||
public bool FixMakeProperCase = false;
|
||||
public bool FixMakeUppercase = false;
|
||||
|
||||
private readonly string _language;
|
||||
@ -271,6 +272,11 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
{
|
||||
text = text.ToLower(subtitleCulture);
|
||||
}
|
||||
else if (FixMakeProperCase)
|
||||
{
|
||||
text = text.ToProperCase();
|
||||
}
|
||||
|
||||
if (original != text)
|
||||
{
|
||||
NoOfLinesChanged++;
|
||||
|
@ -495,6 +495,19 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
return s;
|
||||
}
|
||||
|
||||
public static string ToProperCase(this string input)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(input))
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
var sb = new StringBuilder();
|
||||
var tags = RemoveAndSaveTags(input, sb);
|
||||
var properCaseText = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(sb.ToString());
|
||||
return RestoreSavedTags(properCaseText, tags);
|
||||
}
|
||||
|
||||
public static string ToggleCasing(this string input, string overrideFromStringInit = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(input))
|
||||
|
1161
src/ui/Forms/BatchConvert.Designer.cs
generated
1161
src/ui/Forms/BatchConvert.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -284,6 +284,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
radioButtonFixOnlyNames.Text = LanguageSettings.Current.ChangeCasing.FixOnlyNamesCasing;
|
||||
radioButtonUppercase.Text = LanguageSettings.Current.ChangeCasing.AllUppercase;
|
||||
radioButtonLowercase.Text = LanguageSettings.Current.ChangeCasing.AllLowercase;
|
||||
radioButtonLowercase.Text = LanguageSettings.Current.ChangeCasing.ProperCase;
|
||||
if (Configuration.Settings.Tools.ChangeCasingChoice == "NamesOnly")
|
||||
{
|
||||
radioButtonFixOnlyNames.Checked = true;
|
||||
@ -296,6 +297,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
radioButtonLowercase.Checked = true;
|
||||
}
|
||||
else if (Configuration.Settings.Tools.ChangeCasingChoice == "ProperCase")
|
||||
{
|
||||
radioButtonProperCase.Checked = true;
|
||||
}
|
||||
|
||||
checkBoxFixNames.Checked = Configuration.Settings.Tools.ChangeCasingNormalFixNames;
|
||||
checkBoxOnlyAllUpper.Checked = Configuration.Settings.Tools.ChangeCasingNormalOnlyUppercase;
|
||||
@ -2005,6 +2010,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
FixNormal = radioButtonNormal.Checked,
|
||||
FixMakeUppercase = radioButtonUppercase.Checked,
|
||||
FixMakeLowercase = radioButtonLowercase.Checked,
|
||||
FixMakeProperCase = radioButtonProperCase.Checked,
|
||||
FixNormalOnlyAllUppercase = checkBoxOnlyAllUpper.Checked
|
||||
}.Fix(sub);
|
||||
}
|
||||
@ -2218,6 +2224,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
Configuration.Settings.Tools.ChangeCasingChoice = "Lowercase";
|
||||
}
|
||||
else if (radioButtonProperCase.Checked)
|
||||
{
|
||||
Configuration.Settings.Tools.ChangeCasingChoice = "ProperCase";
|
||||
}
|
||||
|
||||
Configuration.Settings.Tools.ChangeCasingNormalFixNames = checkBoxFixNames.Checked;
|
||||
Configuration.Settings.Tools.ChangeCasingNormalOnlyUppercase = checkBoxOnlyAllUpper.Checked;
|
||||
|
21
src/ui/Forms/ChangeCasing.Designer.cs
generated
21
src/ui/Forms/ChangeCasing.Designer.cs
generated
@ -37,6 +37,7 @@
|
||||
this.radioButtonLowercase = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonUppercase = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonNormal = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonProperCase = new System.Windows.Forms.RadioButton();
|
||||
this.groupBoxChangeCasing.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -45,7 +46,7 @@
|
||||
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.buttonCancel.Location = new System.Drawing.Point(417, 195);
|
||||
this.buttonCancel.Location = new System.Drawing.Point(417, 224);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonCancel.TabIndex = 14;
|
||||
@ -57,7 +58,7 @@
|
||||
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.buttonOK.Location = new System.Drawing.Point(336, 195);
|
||||
this.buttonOK.Location = new System.Drawing.Point(336, 224);
|
||||
this.buttonOK.Name = "buttonOK";
|
||||
this.buttonOK.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonOK.TabIndex = 12;
|
||||
@ -70,6 +71,7 @@
|
||||
this.groupBoxChangeCasing.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.groupBoxChangeCasing.Controls.Add(this.radioButtonProperCase);
|
||||
this.groupBoxChangeCasing.Controls.Add(this.radioButtonFixOnlyNames);
|
||||
this.groupBoxChangeCasing.Controls.Add(this.checkBoxFixNames);
|
||||
this.groupBoxChangeCasing.Controls.Add(this.checkBoxOnlyAllUpper);
|
||||
@ -78,7 +80,7 @@
|
||||
this.groupBoxChangeCasing.Controls.Add(this.radioButtonNormal);
|
||||
this.groupBoxChangeCasing.Location = new System.Drawing.Point(12, 12);
|
||||
this.groupBoxChangeCasing.Name = "groupBoxChangeCasing";
|
||||
this.groupBoxChangeCasing.Size = new System.Drawing.Size(480, 172);
|
||||
this.groupBoxChangeCasing.Size = new System.Drawing.Size(480, 201);
|
||||
this.groupBoxChangeCasing.TabIndex = 12;
|
||||
this.groupBoxChangeCasing.TabStop = false;
|
||||
this.groupBoxChangeCasing.Text = "Change casing to";
|
||||
@ -151,11 +153,21 @@
|
||||
this.radioButtonNormal.UseVisualStyleBackColor = true;
|
||||
this.radioButtonNormal.CheckedChanged += new System.EventHandler(this.RadioButton_CheckedChanged);
|
||||
//
|
||||
// radioButtonProperCase
|
||||
//
|
||||
this.radioButtonProperCase.AutoSize = true;
|
||||
this.radioButtonProperCase.Location = new System.Drawing.Point(11, 165);
|
||||
this.radioButtonProperCase.Name = "radioButtonProperCase";
|
||||
this.radioButtonProperCase.Size = new System.Drawing.Size(79, 17);
|
||||
this.radioButtonProperCase.TabIndex = 14;
|
||||
this.radioButtonProperCase.Text = "Propercase";
|
||||
this.radioButtonProperCase.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ChangeCasing
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(504, 228);
|
||||
this.ClientSize = new System.Drawing.Size(504, 257);
|
||||
this.Controls.Add(this.groupBoxChangeCasing);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonOK);
|
||||
@ -186,5 +198,6 @@
|
||||
private System.Windows.Forms.CheckBox checkBoxOnlyAllUpper;
|
||||
private System.Windows.Forms.CheckBox checkBoxFixNames;
|
||||
private System.Windows.Forms.RadioButton radioButtonFixOnlyNames;
|
||||
private System.Windows.Forms.RadioButton radioButtonProperCase;
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
checkBoxOnlyAllUpper.Text = language.OnlyChangeAllUppercaseLines;
|
||||
radioButtonUppercase.Text = language.AllUppercase;
|
||||
radioButtonLowercase.Text = language.AllLowercase;
|
||||
radioButtonProperCase.Text = language.ProperCase;
|
||||
buttonOK.Text = LanguageSettings.Current.General.Ok;
|
||||
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
|
||||
FixLargeFonts();
|
||||
@ -38,6 +39,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
radioButtonLowercase.Checked = true;
|
||||
}
|
||||
else if (Configuration.Settings.Tools.ChangeCasingChoice == "ProperCase")
|
||||
{
|
||||
radioButtonProperCase.Checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
public int LinesChanged { get; private set; }
|
||||
@ -63,6 +68,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
FixNormal = radioButtonNormal.Checked,
|
||||
FixMakeUppercase = radioButtonUppercase.Checked,
|
||||
FixMakeLowercase = radioButtonLowercase.Checked,
|
||||
FixMakeProperCase = radioButtonProperCase.Checked,
|
||||
FixNormalOnlyAllUppercase = checkBoxOnlyAllUpper.Checked
|
||||
};
|
||||
fixCasing.Fix(subtitle);
|
||||
@ -95,6 +101,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
Configuration.Settings.Tools.ChangeCasingChoice = "Lowercase";
|
||||
}
|
||||
else if (radioButtonProperCase.Checked)
|
||||
{
|
||||
Configuration.Settings.Tools.ChangeCasingChoice = "ProperCase";
|
||||
}
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
@ -568,6 +568,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
OnlyChangeAllUppercaseLines = "Only change all uppercase lines.",
|
||||
AllUppercase = "ALL UPPERCASE",
|
||||
AllLowercase = "all lowercase",
|
||||
ProperCase = "Proper Case",
|
||||
};
|
||||
|
||||
ChangeCasingNames = new LanguageStructure.ChangeCasingNames
|
||||
|
@ -1060,6 +1060,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
case "ChangeCasing/AllLowercase":
|
||||
language.ChangeCasing.AllLowercase = reader.Value;
|
||||
break;
|
||||
case "ChangeCasing/ProperCase":
|
||||
language.ChangeCasing.ProperCase = reader.Value;
|
||||
break;
|
||||
case "ChangeCasingNames/Title":
|
||||
language.ChangeCasingNames.Title = reader.Value;
|
||||
break;
|
||||
|
@ -425,6 +425,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public string OnlyChangeAllUppercaseLines { get; set; }
|
||||
public string AllUppercase { get; set; }
|
||||
public string AllLowercase { get; set; }
|
||||
public string ProperCase { get; set; }
|
||||
}
|
||||
|
||||
public class ChangeCasingNames
|
||||
|
Loading…
Reference in New Issue
Block a user