mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 19:22:53 +01:00
Add "add new no-break-after-list" - thx lambdacore12 :)
Related to #7745
This commit is contained in:
parent
284592b1e9
commit
f6f7f77d5c
@ -847,6 +847,7 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
namespace Nikse.SubtitleEdit.Forms.Options
|
||||
{
|
||||
sealed partial class DoNotBreakAfterListEdit
|
||||
{
|
||||
@ -33,12 +33,13 @@
|
||||
this.radioButtonText = new System.Windows.Forms.RadioButton();
|
||||
this.buttonRemoveNoBreakAfter = new System.Windows.Forms.Button();
|
||||
this.listBoxNoBreakAfter = new System.Windows.Forms.ListBox();
|
||||
this.textBoxNoBreakAfter = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
||||
this.buttonAddNoBreakAfter = new System.Windows.Forms.Button();
|
||||
this.comboBoxDictionaries = new Nikse.SubtitleEdit.Controls.NikseComboBox();
|
||||
this.labelLanguage = new System.Windows.Forms.Label();
|
||||
this.buttonOK = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonNew = new System.Windows.Forms.Button();
|
||||
this.comboBoxDictionaries = new Nikse.SubtitleEdit.Controls.NikseComboBox();
|
||||
this.textBoxNoBreakAfter = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
||||
this.groupBoxNamesIgonoreLists.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -56,7 +57,7 @@
|
||||
this.groupBoxNamesIgonoreLists.Location = new System.Drawing.Point(12, 54);
|
||||
this.groupBoxNamesIgonoreLists.Name = "groupBoxNamesIgonoreLists";
|
||||
this.groupBoxNamesIgonoreLists.Size = new System.Drawing.Size(313, 304);
|
||||
this.groupBoxNamesIgonoreLists.TabIndex = 2;
|
||||
this.groupBoxNamesIgonoreLists.TabIndex = 3;
|
||||
this.groupBoxNamesIgonoreLists.TabStop = false;
|
||||
//
|
||||
// radioButtonRegEx
|
||||
@ -66,7 +67,7 @@
|
||||
this.radioButtonRegEx.Location = new System.Drawing.Point(83, 279);
|
||||
this.radioButtonRegEx.Name = "radioButtonRegEx";
|
||||
this.radioButtonRegEx.Size = new System.Drawing.Size(115, 17);
|
||||
this.radioButtonRegEx.TabIndex = 5;
|
||||
this.radioButtonRegEx.TabIndex = 21;
|
||||
this.radioButtonRegEx.Text = "Regular expression";
|
||||
this.radioButtonRegEx.UseVisualStyleBackColor = true;
|
||||
this.radioButtonRegEx.CheckedChanged += new System.EventHandler(this.RadioButtonCheckedChanged);
|
||||
@ -79,7 +80,7 @@
|
||||
this.radioButtonText.Location = new System.Drawing.Point(6, 279);
|
||||
this.radioButtonText.Name = "radioButtonText";
|
||||
this.radioButtonText.Size = new System.Drawing.Size(46, 17);
|
||||
this.radioButtonText.TabIndex = 4;
|
||||
this.radioButtonText.TabIndex = 20;
|
||||
this.radioButtonText.TabStop = true;
|
||||
this.radioButtonText.Text = "Text";
|
||||
this.radioButtonText.UseVisualStyleBackColor = true;
|
||||
@ -107,36 +108,17 @@
|
||||
this.listBoxNoBreakAfter.TabIndex = 0;
|
||||
this.listBoxNoBreakAfter.SelectedIndexChanged += new System.EventHandler(this.listBoxNames_SelectedIndexChanged);
|
||||
//
|
||||
// textBoxNoBreakAfter
|
||||
//
|
||||
this.textBoxNoBreakAfter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.textBoxNoBreakAfter.Location = new System.Drawing.Point(6, 250);
|
||||
this.textBoxNoBreakAfter.Name = "textBoxNoBreakAfter";
|
||||
this.textBoxNoBreakAfter.Size = new System.Drawing.Size(218, 20);
|
||||
this.textBoxNoBreakAfter.TabIndex = 2;
|
||||
this.textBoxNoBreakAfter.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBoxNoBreakAfter_KeyDown);
|
||||
//
|
||||
// buttonAddNoBreakAfter
|
||||
//
|
||||
this.buttonAddNoBreakAfter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.buttonAddNoBreakAfter.Location = new System.Drawing.Point(230, 248);
|
||||
this.buttonAddNoBreakAfter.Name = "buttonAddNoBreakAfter";
|
||||
this.buttonAddNoBreakAfter.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonAddNoBreakAfter.TabIndex = 3;
|
||||
this.buttonAddNoBreakAfter.TabIndex = 11;
|
||||
this.buttonAddNoBreakAfter.Text = "Add";
|
||||
this.buttonAddNoBreakAfter.UseVisualStyleBackColor = true;
|
||||
this.buttonAddNoBreakAfter.Click += new System.EventHandler(this.buttonAddNames_Click);
|
||||
//
|
||||
// comboBoxDictionaries
|
||||
//
|
||||
this.comboBoxDictionaries.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxDictionaries.FormattingEnabled = true;
|
||||
this.comboBoxDictionaries.Location = new System.Drawing.Point(12, 27);
|
||||
this.comboBoxDictionaries.Name = "comboBoxDictionaries";
|
||||
this.comboBoxDictionaries.Size = new System.Drawing.Size(224, 21);
|
||||
this.comboBoxDictionaries.TabIndex = 1;
|
||||
this.comboBoxDictionaries.SelectedIndexChanged += new System.EventHandler(this.comboBoxDictionaries_SelectedIndexChanged);
|
||||
//
|
||||
// labelLanguage
|
||||
//
|
||||
this.labelLanguage.AutoSize = true;
|
||||
@ -153,7 +135,7 @@
|
||||
this.buttonOK.Location = new System.Drawing.Point(166, 369);
|
||||
this.buttonOK.Name = "buttonOK";
|
||||
this.buttonOK.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonOK.TabIndex = 3;
|
||||
this.buttonOK.TabIndex = 99;
|
||||
this.buttonOK.Text = "&OK";
|
||||
this.buttonOK.UseVisualStyleBackColor = true;
|
||||
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
|
||||
@ -166,15 +148,60 @@
|
||||
this.buttonCancel.Location = new System.Drawing.Point(250, 369);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonCancel.TabIndex = 4;
|
||||
this.buttonCancel.TabIndex = 100;
|
||||
this.buttonCancel.Text = "C&ancel";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonNew
|
||||
//
|
||||
this.buttonNew.Location = new System.Drawing.Point(242, 27);
|
||||
this.buttonNew.Name = "buttonNew";
|
||||
this.buttonNew.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonNew.TabIndex = 2;
|
||||
this.buttonNew.Text = "New...";
|
||||
this.buttonNew.UseVisualStyleBackColor = true;
|
||||
this.buttonNew.Click += new System.EventHandler(this.buttonNew_Click);
|
||||
//
|
||||
// comboBoxDictionaries
|
||||
//
|
||||
this.comboBoxDictionaries.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.comboBoxDictionaries.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.comboBoxDictionaries.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179)))));
|
||||
this.comboBoxDictionaries.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120)))));
|
||||
this.comboBoxDictionaries.ButtonForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.comboBoxDictionaries.ButtonForeColorDown = System.Drawing.Color.Orange;
|
||||
this.comboBoxDictionaries.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
|
||||
this.comboBoxDictionaries.DropDownHeight = 400;
|
||||
this.comboBoxDictionaries.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxDictionaries.DropDownWidth = 224;
|
||||
this.comboBoxDictionaries.FormattingEnabled = true;
|
||||
this.comboBoxDictionaries.Location = new System.Drawing.Point(12, 27);
|
||||
this.comboBoxDictionaries.MaxLength = 32767;
|
||||
this.comboBoxDictionaries.Name = "comboBoxDictionaries";
|
||||
this.comboBoxDictionaries.SelectedIndex = -1;
|
||||
this.comboBoxDictionaries.SelectedItem = null;
|
||||
this.comboBoxDictionaries.SelectedText = "";
|
||||
this.comboBoxDictionaries.Size = new System.Drawing.Size(224, 21);
|
||||
this.comboBoxDictionaries.TabIndex = 1;
|
||||
this.comboBoxDictionaries.UsePopupWindow = false;
|
||||
this.comboBoxDictionaries.SelectedIndexChanged += new System.EventHandler(this.comboBoxDictionaries_SelectedIndexChanged);
|
||||
//
|
||||
// textBoxNoBreakAfter
|
||||
//
|
||||
this.textBoxNoBreakAfter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.textBoxNoBreakAfter.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
|
||||
this.textBoxNoBreakAfter.Location = new System.Drawing.Point(6, 250);
|
||||
this.textBoxNoBreakAfter.Name = "textBoxNoBreakAfter";
|
||||
this.textBoxNoBreakAfter.Size = new System.Drawing.Size(218, 20);
|
||||
this.textBoxNoBreakAfter.TabIndex = 10;
|
||||
this.textBoxNoBreakAfter.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBoxNoBreakAfter_KeyDown);
|
||||
//
|
||||
// DoNotBreakAfterListEdit
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(337, 402);
|
||||
this.Controls.Add(this.buttonNew);
|
||||
this.Controls.Add(this.buttonOK);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.comboBoxDictionaries);
|
||||
@ -210,5 +237,6 @@
|
||||
private System.Windows.Forms.Button buttonCancel;
|
||||
private System.Windows.Forms.RadioButton radioButtonRegEx;
|
||||
private System.Windows.Forms.RadioButton radioButtonText;
|
||||
private System.Windows.Forms.Button buttonNew;
|
||||
}
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using MessageBox = Nikse.SubtitleEdit.Forms.SeMsgBox.MessageBox;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
namespace Nikse.SubtitleEdit.Forms.Options
|
||||
{
|
||||
public sealed partial class DoNotBreakAfterListEdit : Form
|
||||
{
|
||||
@ -24,6 +24,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
Text = LanguageSettings.Current.Settings.UseDoNotBreakAfterList;
|
||||
labelLanguage.Text = LanguageSettings.Current.ChooseLanguage.Language;
|
||||
buttonNew.Text = LanguageSettings.Current.ExportCustomText.New;
|
||||
buttonRemoveNoBreakAfter.Text = LanguageSettings.Current.DvdSubRip.Remove;
|
||||
buttonAddNoBreakAfter.Text = LanguageSettings.Current.DvdSubRip.Add;
|
||||
radioButtonText.Text = LanguageSettings.Current.General.Text;
|
||||
@ -32,19 +33,35 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
|
||||
|
||||
radioButtonRegEx.Left = radioButtonText.Left + radioButtonText.Width + 10;
|
||||
InitLanguages(string.Empty);
|
||||
}
|
||||
|
||||
private void InitLanguages(string selectTwoLetterCode)
|
||||
{
|
||||
var idx = 0;
|
||||
foreach (string fileName in Directory.GetFiles(Configuration.DictionariesDirectory, "*_NoBreakAfterList.xml"))
|
||||
_languages.Clear();
|
||||
comboBoxDictionaries.Items.Clear();
|
||||
foreach (var fileName in Directory.GetFiles(Configuration.DictionariesDirectory, "*_NoBreakAfterList.xml"))
|
||||
{
|
||||
try
|
||||
{
|
||||
string s = Path.GetFileName(fileName);
|
||||
string languageId = s.Substring(0, s.IndexOf('_'));
|
||||
var s = Path.GetFileName(fileName);
|
||||
var languageId = s.Substring(0, s.IndexOf('_'));
|
||||
var ci = CultureInfo.GetCultureInfoByIetfLanguageTag(languageId);
|
||||
comboBoxDictionaries.Items.Add(ci.EnglishName + " (" + ci.NativeName + ")");
|
||||
if ((Configuration.Settings.WordLists.LastLanguage ?? "en-US").StartsWith(languageId, StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
if (!string.IsNullOrEmpty(selectTwoLetterCode))
|
||||
{
|
||||
if (ci.TwoLetterISOLanguageName == selectTwoLetterCode)
|
||||
{
|
||||
idx = _languages.Count;
|
||||
}
|
||||
}
|
||||
else if ((Configuration.Settings.WordLists.LastLanguage ?? "en-US").StartsWith(languageId, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
idx = _languages.Count;
|
||||
}
|
||||
|
||||
_languages.Add(fileName);
|
||||
}
|
||||
catch
|
||||
@ -52,6 +69,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
if (comboBoxDictionaries.Items.Count > 0 && idx < comboBoxDictionaries.Items.Count)
|
||||
{
|
||||
comboBoxDictionaries.SelectedIndex = idx;
|
||||
@ -242,5 +260,24 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var form = new DoNotBreakAfterListNew())
|
||||
{
|
||||
var dr = form.ShowDialog();
|
||||
if (dr != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var fileName = Path.Combine(Configuration.DictionariesDirectory, form.ChosenLanguage.TwoLetterISOLanguageName + "_NoBreakAfterList.xml");
|
||||
if (!File.Exists(fileName))
|
||||
{
|
||||
File.WriteAllText(fileName, "<NoBreakAfterList><Item>Dr</Item><Item>Dr.</Item><Item>Mr.</Item><Item>Mrs.</Item><Item>Ms.</Item></NoBreakAfterList>");
|
||||
}
|
||||
|
||||
InitLanguages(form.ChosenLanguage.TwoLetterISOLanguageName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
123
src/ui/Forms/Options/DoNotBreakAfterListNew.Designer.cs
generated
Normal file
123
src/ui/Forms/Options/DoNotBreakAfterListNew.Designer.cs
generated
Normal file
@ -0,0 +1,123 @@
|
||||
namespace Nikse.SubtitleEdit.Forms.Options
|
||||
{
|
||||
sealed partial class DoNotBreakAfterListNew
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonOK = new System.Windows.Forms.Button();
|
||||
this.labelChooseLanguage = new System.Windows.Forms.Label();
|
||||
this.comboBoxDictionaries = new Nikse.SubtitleEdit.Controls.NikseComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
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(361, 175);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(75, 24);
|
||||
this.buttonCancel.TabIndex = 53;
|
||||
this.buttonCancel.Text = "C&ancel";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
|
||||
//
|
||||
// buttonOK
|
||||
//
|
||||
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.buttonOK.Location = new System.Drawing.Point(280, 175);
|
||||
this.buttonOK.Name = "buttonOK";
|
||||
this.buttonOK.Size = new System.Drawing.Size(75, 24);
|
||||
this.buttonOK.TabIndex = 52;
|
||||
this.buttonOK.Text = "&OK";
|
||||
this.buttonOK.UseVisualStyleBackColor = true;
|
||||
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
|
||||
//
|
||||
// labelChooseLanguage
|
||||
//
|
||||
this.labelChooseLanguage.AutoSize = true;
|
||||
this.labelChooseLanguage.Location = new System.Drawing.Point(12, 22);
|
||||
this.labelChooseLanguage.Name = "labelChooseLanguage";
|
||||
this.labelChooseLanguage.Size = new System.Drawing.Size(90, 13);
|
||||
this.labelChooseLanguage.TabIndex = 55;
|
||||
this.labelChooseLanguage.Text = "Choose language";
|
||||
//
|
||||
// comboBoxDictionaries
|
||||
//
|
||||
this.comboBoxDictionaries.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.comboBoxDictionaries.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.comboBoxDictionaries.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179)))));
|
||||
this.comboBoxDictionaries.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120)))));
|
||||
this.comboBoxDictionaries.ButtonForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.comboBoxDictionaries.ButtonForeColorDown = System.Drawing.Color.Orange;
|
||||
this.comboBoxDictionaries.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
|
||||
this.comboBoxDictionaries.DropDownHeight = 400;
|
||||
this.comboBoxDictionaries.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxDictionaries.DropDownWidth = 224;
|
||||
this.comboBoxDictionaries.FormattingEnabled = true;
|
||||
this.comboBoxDictionaries.Location = new System.Drawing.Point(12, 38);
|
||||
this.comboBoxDictionaries.MaxLength = 32767;
|
||||
this.comboBoxDictionaries.Name = "comboBoxDictionaries";
|
||||
this.comboBoxDictionaries.SelectedIndex = -1;
|
||||
this.comboBoxDictionaries.SelectedItem = null;
|
||||
this.comboBoxDictionaries.SelectedText = "";
|
||||
this.comboBoxDictionaries.Size = new System.Drawing.Size(224, 21);
|
||||
this.comboBoxDictionaries.TabIndex = 54;
|
||||
this.comboBoxDictionaries.UsePopupWindow = false;
|
||||
//
|
||||
// DoNotBreakAfterListNew
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(448, 211);
|
||||
this.Controls.Add(this.labelChooseLanguage);
|
||||
this.Controls.Add(this.comboBoxDictionaries);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonOK);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.KeyPreview = true;
|
||||
this.Name = "DoNotBreakAfterListNew";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "DoNotBreakAfterListNew";
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.DoNotBreakAfterListNew_KeyDown);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button buttonCancel;
|
||||
private System.Windows.Forms.Button buttonOK;
|
||||
private Controls.NikseComboBox comboBoxDictionaries;
|
||||
private System.Windows.Forms.Label labelChooseLanguage;
|
||||
}
|
||||
}
|
85
src/ui/Forms/Options/DoNotBreakAfterListNew.cs
Normal file
85
src/ui/Forms/Options/DoNotBreakAfterListNew.cs
Normal file
@ -0,0 +1,85 @@
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms.Options
|
||||
{
|
||||
public sealed partial class DoNotBreakAfterListNew : Form
|
||||
{
|
||||
private readonly List<CultureInfo> _languages = new List<CultureInfo>();
|
||||
public CultureInfo ChosenLanguage { get; set; }
|
||||
|
||||
public DoNotBreakAfterListNew()
|
||||
{
|
||||
UiUtil.PreInitialize(this);
|
||||
InitializeComponent();
|
||||
UiUtil.FixFonts(this);
|
||||
|
||||
Text = LanguageSettings.Current.ExportCustomText.New;
|
||||
labelChooseLanguage.Text = LanguageSettings.Current.AudioToText.ChooseLanguage;
|
||||
buttonOK.Text = LanguageSettings.Current.General.Ok;
|
||||
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
|
||||
|
||||
var existingLanguages = new List<string>();
|
||||
foreach (var fileName in Directory.GetFiles(Configuration.DictionariesDirectory, "*_NoBreakAfterList.xml"))
|
||||
{
|
||||
try
|
||||
{
|
||||
var s = Path.GetFileName(fileName);
|
||||
var languageId = s.Substring(0, s.IndexOf('_'));
|
||||
existingLanguages.Add(languageId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
var lookup = new HashSet<string>();
|
||||
comboBoxDictionaries.Items.Clear();
|
||||
comboBoxDictionaries.BeginUpdate();
|
||||
foreach (var l in Utilities.GetSubtitleLanguageCultures(false))
|
||||
{
|
||||
if (l.IsNeutralCulture && l.TwoLetterISOLanguageName.Length == 2 && !lookup.Contains(l.TwoLetterISOLanguageName))
|
||||
{
|
||||
lookup.Add(l.TwoLetterISOLanguageName);
|
||||
if (!existingLanguages.Contains(l.TwoLetterISOLanguageName))
|
||||
{
|
||||
comboBoxDictionaries.Items.Add(l.DisplayName);
|
||||
_languages.Add(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
comboBoxDictionaries.EndUpdate();
|
||||
}
|
||||
|
||||
private void DoNotBreakAfterListNew_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Escape)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBoxDictionaries.SelectedIndex <= 0)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
return;
|
||||
}
|
||||
|
||||
ChosenLanguage = _languages[comboBoxDictionaries.SelectedIndex];
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
}
|
||||
}
|
120
src/ui/Forms/Options/DoNotBreakAfterListNew.resx
Normal file
120
src/ui/Forms/Options/DoNotBreakAfterListNew.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -448,6 +448,12 @@
|
||||
<Compile Include="Forms\Options\DefaultLanguagesChooser.Designer.cs">
|
||||
<DependentUpon>DefaultLanguagesChooser.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Options\DoNotBreakAfterListNew.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Options\DoNotBreakAfterListNew.Designer.cs">
|
||||
<DependentUpon>DoNotBreakAfterListNew.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Options\SettingsCustomContinuationStyle.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -542,10 +548,10 @@
|
||||
<Compile Include="Forms\DCinema\DCinemaPropertiesSmpte.Designer.cs">
|
||||
<DependentUpon>DCinemaPropertiesSmpte.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\DoNotBreakAfterListEdit.cs">
|
||||
<Compile Include="Forms\Options\DoNotBreakAfterListEdit.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\DoNotBreakAfterListEdit.Designer.cs">
|
||||
<Compile Include="Forms\Options\DoNotBreakAfterListEdit.Designer.cs">
|
||||
<DependentUpon>DoNotBreakAfterListEdit.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\About.cs">
|
||||
@ -1794,6 +1800,9 @@
|
||||
<EmbeddedResource Include="Forms\Options\DefaultLanguagesChooser.resx">
|
||||
<DependentUpon>DefaultLanguagesChooser.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Options\DoNotBreakAfterListNew.resx">
|
||||
<DependentUpon>DoNotBreakAfterListNew.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Options\SettingsCustomContinuationStyle.resx">
|
||||
<DependentUpon>SettingsCustomContinuationStyle.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@ -1839,7 +1848,7 @@
|
||||
<EmbeddedResource Include="Forms\DCinema\DCinemaPropertiesSmpte.resx">
|
||||
<DependentUpon>DCinemaPropertiesSmpte.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\DoNotBreakAfterListEdit.resx">
|
||||
<EmbeddedResource Include="Forms\Options\DoNotBreakAfterListEdit.resx">
|
||||
<DependentUpon>DoNotBreakAfterListEdit.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\About.resx">
|
||||
|
Loading…
Reference in New Issue
Block a user