Show selected length in text box - thx Stefan :)

This commit is contained in:
niksedk 2023-02-21 19:48:47 +01:00
parent 2ace6dcda7
commit 3c53ddee2f
3 changed files with 171 additions and 147 deletions

View File

@ -2067,149 +2067,7 @@ namespace Nikse.SubtitleEdit.Forms
DvdSubtitleLanguage.Language.NotSpecified = LanguageSettings.Current.LanguageNames.NotSpecified;
DvdSubtitleLanguage.Language.UnknownCodeX = LanguageSettings.Current.LanguageNames.UnknownCodeX;
DvdSubtitleLanguage.Language.CultureName = LanguageSettings.Current.General.CultureName;
DvdSubtitleLanguage.Language.LanguageNames = new Dictionary<string, string>
{
{ "aa", LanguageSettings.Current.LanguageNames.aaName },
{ "ab", LanguageSettings.Current.LanguageNames.abName },
{ "af", LanguageSettings.Current.LanguageNames.afName },
{ "am", LanguageSettings.Current.LanguageNames.amName },
{ "ar", LanguageSettings.Current.LanguageNames.arName },
{ "as", LanguageSettings.Current.LanguageNames.asName },
{ "ay", LanguageSettings.Current.LanguageNames.ayName },
{ "az", LanguageSettings.Current.LanguageNames.azName },
{ "ba", LanguageSettings.Current.LanguageNames.baName },
{ "be", LanguageSettings.Current.LanguageNames.beName },
{ "bg", LanguageSettings.Current.LanguageNames.bgName },
{ "bh", LanguageSettings.Current.LanguageNames.bhName },
{ "bi", LanguageSettings.Current.LanguageNames.biName },
{ "bn", LanguageSettings.Current.LanguageNames.bnName },
{ "bo", LanguageSettings.Current.LanguageNames.boName },
{ "br", LanguageSettings.Current.LanguageNames.brName },
{ "ca", LanguageSettings.Current.LanguageNames.caName },
{ "co", LanguageSettings.Current.LanguageNames.coName },
{ "cs", LanguageSettings.Current.LanguageNames.csName },
{ "cy", LanguageSettings.Current.LanguageNames.cyName },
{ "da", LanguageSettings.Current.LanguageNames.daName },
{ "de", LanguageSettings.Current.LanguageNames.deName },
{ "dz", LanguageSettings.Current.LanguageNames.dzName },
{ "el", LanguageSettings.Current.LanguageNames.elName },
{ "en", LanguageSettings.Current.LanguageNames.enName },
{ "eo", LanguageSettings.Current.LanguageNames.eoName },
{ "es", LanguageSettings.Current.LanguageNames.esName },
{ "et", LanguageSettings.Current.LanguageNames.etName },
{ "eu", LanguageSettings.Current.LanguageNames.euName },
{ "fa", LanguageSettings.Current.LanguageNames.faName },
{ "fi", LanguageSettings.Current.LanguageNames.fiName },
{ "fj", LanguageSettings.Current.LanguageNames.fjName },
{ "fo", LanguageSettings.Current.LanguageNames.foName },
{ "fr", LanguageSettings.Current.LanguageNames.frName },
{ "fy", LanguageSettings.Current.LanguageNames.fyName },
{ "ga", LanguageSettings.Current.LanguageNames.gaName },
{ "gd", LanguageSettings.Current.LanguageNames.gdName },
{ "gl", LanguageSettings.Current.LanguageNames.glName },
{ "gn", LanguageSettings.Current.LanguageNames.gnName },
{ "gu", LanguageSettings.Current.LanguageNames.guName },
{ "ha", LanguageSettings.Current.LanguageNames.haName },
{ "he", LanguageSettings.Current.LanguageNames.heName },
{ "hi", LanguageSettings.Current.LanguageNames.hiName },
{ "hr", LanguageSettings.Current.LanguageNames.hrName },
{ "hu", LanguageSettings.Current.LanguageNames.huName },
{ "hy", LanguageSettings.Current.LanguageNames.hyName },
{ "ia", LanguageSettings.Current.LanguageNames.iaName },
{ "id", LanguageSettings.Current.LanguageNames.idName },
{ "ie", LanguageSettings.Current.LanguageNames.ieName },
{ "ik", LanguageSettings.Current.LanguageNames.ikName },
{ "is", LanguageSettings.Current.LanguageNames.isName },
{ "it", LanguageSettings.Current.LanguageNames.itName },
{ "iu", LanguageSettings.Current.LanguageNames.iuName },
{ "ja", LanguageSettings.Current.LanguageNames.jaName },
{ "jv", LanguageSettings.Current.LanguageNames.jvName },
{ "ka", LanguageSettings.Current.LanguageNames.kaName },
{ "kk", LanguageSettings.Current.LanguageNames.kkName },
{ "kl", LanguageSettings.Current.LanguageNames.klName },
{ "km", LanguageSettings.Current.LanguageNames.kmName },
{ "kn", LanguageSettings.Current.LanguageNames.knName },
{ "ko", LanguageSettings.Current.LanguageNames.koName },
{ "ks", LanguageSettings.Current.LanguageNames.ksName },
{ "ku", LanguageSettings.Current.LanguageNames.kuName },
{ "ky", LanguageSettings.Current.LanguageNames.kyName },
{ "la", LanguageSettings.Current.LanguageNames.laName },
{ "lb", LanguageSettings.Current.LanguageNames.lbName },
{ "ln", LanguageSettings.Current.LanguageNames.lnName },
{ "lo", LanguageSettings.Current.LanguageNames.loName },
{ "lt", LanguageSettings.Current.LanguageNames.ltName },
{ "lv", LanguageSettings.Current.LanguageNames.lvName },
{ "mg", LanguageSettings.Current.LanguageNames.mgName },
{ "mi", LanguageSettings.Current.LanguageNames.miName },
{ "mk", LanguageSettings.Current.LanguageNames.mkName },
{ "ml", LanguageSettings.Current.LanguageNames.mlName },
{ "mn", LanguageSettings.Current.LanguageNames.mnName },
{ "mo", LanguageSettings.Current.LanguageNames.moName },
{ "mr", LanguageSettings.Current.LanguageNames.mrName },
{ "ms", LanguageSettings.Current.LanguageNames.msName },
{ "mt", LanguageSettings.Current.LanguageNames.mtName },
{ "my", LanguageSettings.Current.LanguageNames.myName },
{ "na", LanguageSettings.Current.LanguageNames.naName },
{ "ne", LanguageSettings.Current.LanguageNames.neName },
{ "nl", LanguageSettings.Current.LanguageNames.nlName },
{ "no", LanguageSettings.Current.LanguageNames.noName },
{ "oc", LanguageSettings.Current.LanguageNames.ocName },
{ "om", LanguageSettings.Current.LanguageNames.omName },
{ "or", LanguageSettings.Current.LanguageNames.orName },
{ "pa", LanguageSettings.Current.LanguageNames.paName },
{ "pl", LanguageSettings.Current.LanguageNames.plName },
{ "ps", LanguageSettings.Current.LanguageNames.psName },
{ "pt", LanguageSettings.Current.LanguageNames.ptName },
{ "qu", LanguageSettings.Current.LanguageNames.quName },
{ "rm", LanguageSettings.Current.LanguageNames.rmName },
{ "rn", LanguageSettings.Current.LanguageNames.rnName },
{ "ro", LanguageSettings.Current.LanguageNames.roName },
{ "ru", LanguageSettings.Current.LanguageNames.ruName },
{ "rw", LanguageSettings.Current.LanguageNames.rwName },
{ "sa", LanguageSettings.Current.LanguageNames.saName },
{ "sd", LanguageSettings.Current.LanguageNames.sdName },
{ "sg", LanguageSettings.Current.LanguageNames.sgName },
{ "sh", LanguageSettings.Current.LanguageNames.shName },
{ "si", LanguageSettings.Current.LanguageNames.siName },
{ "sk", LanguageSettings.Current.LanguageNames.skName },
{ "sl", LanguageSettings.Current.LanguageNames.slName },
{ "sm", LanguageSettings.Current.LanguageNames.smName },
{ "sn", LanguageSettings.Current.LanguageNames.snName },
{ "so", LanguageSettings.Current.LanguageNames.soName },
{ "sq", LanguageSettings.Current.LanguageNames.sqName },
{ "sr", LanguageSettings.Current.LanguageNames.srName },
{ "ss", LanguageSettings.Current.LanguageNames.ssName },
{ "st", LanguageSettings.Current.LanguageNames.stName },
{ "su", LanguageSettings.Current.LanguageNames.suName },
{ "sv", LanguageSettings.Current.LanguageNames.svName },
{ "sw", LanguageSettings.Current.LanguageNames.swName },
{ "ta", LanguageSettings.Current.LanguageNames.taName },
{ "te", LanguageSettings.Current.LanguageNames.teName },
{ "tg", LanguageSettings.Current.LanguageNames.tgName },
{ "th", LanguageSettings.Current.LanguageNames.thName },
{ "ti", LanguageSettings.Current.LanguageNames.tiName },
{ "tk", LanguageSettings.Current.LanguageNames.tkName },
{ "tl", LanguageSettings.Current.LanguageNames.tlName },
{ "tn", LanguageSettings.Current.LanguageNames.tnName },
{ "to", LanguageSettings.Current.LanguageNames.toName },
{ "tr", LanguageSettings.Current.LanguageNames.trName },
{ "ts", LanguageSettings.Current.LanguageNames.tsName },
{ "tt", LanguageSettings.Current.LanguageNames.ttName },
{ "tw", LanguageSettings.Current.LanguageNames.twName },
{ "ug", LanguageSettings.Current.LanguageNames.ugName },
{ "uk", LanguageSettings.Current.LanguageNames.ukName },
{ "ur", LanguageSettings.Current.LanguageNames.urName },
{ "uz", LanguageSettings.Current.LanguageNames.uzName },
{ "vi", LanguageSettings.Current.LanguageNames.viName },
{ "vo", LanguageSettings.Current.LanguageNames.voName },
{ "wo", LanguageSettings.Current.LanguageNames.woName },
{ "xh", LanguageSettings.Current.LanguageNames.xhName },
{ "yi", LanguageSettings.Current.LanguageNames.yiName },
{ "yo", LanguageSettings.Current.LanguageNames.yoName },
{ "za", LanguageSettings.Current.LanguageNames.zaName },
{ "zh", LanguageSettings.Current.LanguageNames.zhName },
{ "zu", LanguageSettings.Current.LanguageNames.zuName },
};
DvdSubtitleLanguage.Language.LanguageNames = DvdSubtitleLanguages.GetLanguages();
DvdSubtitleLanguage.Initialize();
}
@ -8775,9 +8633,9 @@ namespace Nikse.SubtitleEdit.Forms
toolStripMenuItemPreview.Visible = formatType == typeof(WebVTT) &&
!string.IsNullOrEmpty(_videoFileName) &&
(_videoFileName.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase) ||
_videoFileName.EndsWith(".m4v", StringComparison.OrdinalIgnoreCase) ||
_videoFileName.EndsWith(".mov", StringComparison.OrdinalIgnoreCase) ||
(_videoFileName.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase) ||
_videoFileName.EndsWith(".m4v", StringComparison.OrdinalIgnoreCase) ||
_videoFileName.EndsWith(".mov", StringComparison.OrdinalIgnoreCase) ||
_videoFileName.EndsWith(".webm", StringComparison.OrdinalIgnoreCase)) &&
IsSubtitleLoaded;
@ -15414,7 +15272,7 @@ namespace Nikse.SubtitleEdit.Forms
SetEncoding(Encoding.UTF8);
ShowStatus(_language.SubtitleImportedFromMatroskaFile);
_subtitle.Renumber();
if (fileName.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase) ||
if (fileName.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase) ||
fileName.EndsWith(".m4v", StringComparison.OrdinalIgnoreCase))
{
_fileName = fileName.Substring(0, fileName.Length - 4) + GetCurrentSubtitleFormat().Extension;
@ -29982,6 +29840,17 @@ namespace Nikse.SubtitleEdit.Forms
totalL = " " + string.Format(_languageGeneral.TotalLengthX, totalLength);
}
if (textBox.SelectionLength > 0)
{
var len = textBox.SelectedText.CountCharacters(false);
if (len > 0)
{
lineTotal.Text = textBox.SelectionLength.ToString(CultureInfo.InvariantCulture) + totalL;
lineTotal.Left = textBox.Left + (textBox.Width - lineTotal.Width);
return;
}
}
if (lineBreakPos < 0 || pos <= lineBreakPos)
{
lineTotal.Text = "1," + (pos + 1) + totalL;

View File

@ -0,0 +1,154 @@
using System.Collections.Generic;
namespace Nikse.SubtitleEdit.Logic
{
public static class DvdSubtitleLanguages
{
public static Dictionary<string, string> GetLanguages()
{
return new Dictionary<string, string>
{
{ "aa", LanguageSettings.Current.LanguageNames.aaName },
{ "ab", LanguageSettings.Current.LanguageNames.abName },
{ "af", LanguageSettings.Current.LanguageNames.afName },
{ "am", LanguageSettings.Current.LanguageNames.amName },
{ "ar", LanguageSettings.Current.LanguageNames.arName },
{ "as", LanguageSettings.Current.LanguageNames.asName },
{ "ay", LanguageSettings.Current.LanguageNames.ayName },
{ "az", LanguageSettings.Current.LanguageNames.azName },
{ "ba", LanguageSettings.Current.LanguageNames.baName },
{ "be", LanguageSettings.Current.LanguageNames.beName },
{ "bg", LanguageSettings.Current.LanguageNames.bgName },
{ "bh", LanguageSettings.Current.LanguageNames.bhName },
{ "bi", LanguageSettings.Current.LanguageNames.biName },
{ "bn", LanguageSettings.Current.LanguageNames.bnName },
{ "bo", LanguageSettings.Current.LanguageNames.boName },
{ "br", LanguageSettings.Current.LanguageNames.brName },
{ "ca", LanguageSettings.Current.LanguageNames.caName },
{ "co", LanguageSettings.Current.LanguageNames.coName },
{ "cs", LanguageSettings.Current.LanguageNames.csName },
{ "cy", LanguageSettings.Current.LanguageNames.cyName },
{ "da", LanguageSettings.Current.LanguageNames.daName },
{ "de", LanguageSettings.Current.LanguageNames.deName },
{ "dz", LanguageSettings.Current.LanguageNames.dzName },
{ "el", LanguageSettings.Current.LanguageNames.elName },
{ "en", LanguageSettings.Current.LanguageNames.enName },
{ "eo", LanguageSettings.Current.LanguageNames.eoName },
{ "es", LanguageSettings.Current.LanguageNames.esName },
{ "et", LanguageSettings.Current.LanguageNames.etName },
{ "eu", LanguageSettings.Current.LanguageNames.euName },
{ "fa", LanguageSettings.Current.LanguageNames.faName },
{ "fi", LanguageSettings.Current.LanguageNames.fiName },
{ "fj", LanguageSettings.Current.LanguageNames.fjName },
{ "fo", LanguageSettings.Current.LanguageNames.foName },
{ "fr", LanguageSettings.Current.LanguageNames.frName },
{ "fy", LanguageSettings.Current.LanguageNames.fyName },
{ "ga", LanguageSettings.Current.LanguageNames.gaName },
{ "gd", LanguageSettings.Current.LanguageNames.gdName },
{ "gl", LanguageSettings.Current.LanguageNames.glName },
{ "gn", LanguageSettings.Current.LanguageNames.gnName },
{ "gu", LanguageSettings.Current.LanguageNames.guName },
{ "ha", LanguageSettings.Current.LanguageNames.haName },
{ "he", LanguageSettings.Current.LanguageNames.heName },
{ "hi", LanguageSettings.Current.LanguageNames.hiName },
{ "hr", LanguageSettings.Current.LanguageNames.hrName },
{ "hu", LanguageSettings.Current.LanguageNames.huName },
{ "hy", LanguageSettings.Current.LanguageNames.hyName },
{ "ia", LanguageSettings.Current.LanguageNames.iaName },
{ "id", LanguageSettings.Current.LanguageNames.idName },
{ "ie", LanguageSettings.Current.LanguageNames.ieName },
{ "ik", LanguageSettings.Current.LanguageNames.ikName },
{ "is", LanguageSettings.Current.LanguageNames.isName },
{ "it", LanguageSettings.Current.LanguageNames.itName },
{ "iu", LanguageSettings.Current.LanguageNames.iuName },
{ "ja", LanguageSettings.Current.LanguageNames.jaName },
{ "jv", LanguageSettings.Current.LanguageNames.jvName },
{ "ka", LanguageSettings.Current.LanguageNames.kaName },
{ "kk", LanguageSettings.Current.LanguageNames.kkName },
{ "kl", LanguageSettings.Current.LanguageNames.klName },
{ "km", LanguageSettings.Current.LanguageNames.kmName },
{ "kn", LanguageSettings.Current.LanguageNames.knName },
{ "ko", LanguageSettings.Current.LanguageNames.koName },
{ "ks", LanguageSettings.Current.LanguageNames.ksName },
{ "ku", LanguageSettings.Current.LanguageNames.kuName },
{ "ky", LanguageSettings.Current.LanguageNames.kyName },
{ "la", LanguageSettings.Current.LanguageNames.laName },
{ "lb", LanguageSettings.Current.LanguageNames.lbName },
{ "ln", LanguageSettings.Current.LanguageNames.lnName },
{ "lo", LanguageSettings.Current.LanguageNames.loName },
{ "lt", LanguageSettings.Current.LanguageNames.ltName },
{ "lv", LanguageSettings.Current.LanguageNames.lvName },
{ "mg", LanguageSettings.Current.LanguageNames.mgName },
{ "mi", LanguageSettings.Current.LanguageNames.miName },
{ "mk", LanguageSettings.Current.LanguageNames.mkName },
{ "ml", LanguageSettings.Current.LanguageNames.mlName },
{ "mn", LanguageSettings.Current.LanguageNames.mnName },
{ "mo", LanguageSettings.Current.LanguageNames.moName },
{ "mr", LanguageSettings.Current.LanguageNames.mrName },
{ "ms", LanguageSettings.Current.LanguageNames.msName },
{ "mt", LanguageSettings.Current.LanguageNames.mtName },
{ "my", LanguageSettings.Current.LanguageNames.myName },
{ "na", LanguageSettings.Current.LanguageNames.naName },
{ "ne", LanguageSettings.Current.LanguageNames.neName },
{ "nl", LanguageSettings.Current.LanguageNames.nlName },
{ "no", LanguageSettings.Current.LanguageNames.noName },
{ "oc", LanguageSettings.Current.LanguageNames.ocName },
{ "om", LanguageSettings.Current.LanguageNames.omName },
{ "or", LanguageSettings.Current.LanguageNames.orName },
{ "pa", LanguageSettings.Current.LanguageNames.paName },
{ "pl", LanguageSettings.Current.LanguageNames.plName },
{ "ps", LanguageSettings.Current.LanguageNames.psName },
{ "pt", LanguageSettings.Current.LanguageNames.ptName },
{ "qu", LanguageSettings.Current.LanguageNames.quName },
{ "rm", LanguageSettings.Current.LanguageNames.rmName },
{ "rn", LanguageSettings.Current.LanguageNames.rnName },
{ "ro", LanguageSettings.Current.LanguageNames.roName },
{ "ru", LanguageSettings.Current.LanguageNames.ruName },
{ "rw", LanguageSettings.Current.LanguageNames.rwName },
{ "sa", LanguageSettings.Current.LanguageNames.saName },
{ "sd", LanguageSettings.Current.LanguageNames.sdName },
{ "sg", LanguageSettings.Current.LanguageNames.sgName },
{ "sh", LanguageSettings.Current.LanguageNames.shName },
{ "si", LanguageSettings.Current.LanguageNames.siName },
{ "sk", LanguageSettings.Current.LanguageNames.skName },
{ "sl", LanguageSettings.Current.LanguageNames.slName },
{ "sm", LanguageSettings.Current.LanguageNames.smName },
{ "sn", LanguageSettings.Current.LanguageNames.snName },
{ "so", LanguageSettings.Current.LanguageNames.soName },
{ "sq", LanguageSettings.Current.LanguageNames.sqName },
{ "sr", LanguageSettings.Current.LanguageNames.srName },
{ "ss", LanguageSettings.Current.LanguageNames.ssName },
{ "st", LanguageSettings.Current.LanguageNames.stName },
{ "su", LanguageSettings.Current.LanguageNames.suName },
{ "sv", LanguageSettings.Current.LanguageNames.svName },
{ "sw", LanguageSettings.Current.LanguageNames.swName },
{ "ta", LanguageSettings.Current.LanguageNames.taName },
{ "te", LanguageSettings.Current.LanguageNames.teName },
{ "tg", LanguageSettings.Current.LanguageNames.tgName },
{ "th", LanguageSettings.Current.LanguageNames.thName },
{ "ti", LanguageSettings.Current.LanguageNames.tiName },
{ "tk", LanguageSettings.Current.LanguageNames.tkName },
{ "tl", LanguageSettings.Current.LanguageNames.tlName },
{ "tn", LanguageSettings.Current.LanguageNames.tnName },
{ "to", LanguageSettings.Current.LanguageNames.toName },
{ "tr", LanguageSettings.Current.LanguageNames.trName },
{ "ts", LanguageSettings.Current.LanguageNames.tsName },
{ "tt", LanguageSettings.Current.LanguageNames.ttName },
{ "tw", LanguageSettings.Current.LanguageNames.twName },
{ "ug", LanguageSettings.Current.LanguageNames.ugName },
{ "uk", LanguageSettings.Current.LanguageNames.ukName },
{ "ur", LanguageSettings.Current.LanguageNames.urName },
{ "uz", LanguageSettings.Current.LanguageNames.uzName },
{ "vi", LanguageSettings.Current.LanguageNames.viName },
{ "vo", LanguageSettings.Current.LanguageNames.voName },
{ "wo", LanguageSettings.Current.LanguageNames.woName },
{ "xh", LanguageSettings.Current.LanguageNames.xhName },
{ "yi", LanguageSettings.Current.LanguageNames.yiName },
{ "yo", LanguageSettings.Current.LanguageNames.yoName },
{ "za", LanguageSettings.Current.LanguageNames.zaName },
{ "zh", LanguageSettings.Current.LanguageNames.zhName },
{ "zu", LanguageSettings.Current.LanguageNames.zuName },
};
}
}
}

View File

@ -1382,6 +1382,7 @@
<Compile Include="Logic\CpsLineLength.cs" />
<Compile Include="Logic\CurrentLanguage.cs" />
<Compile Include="Logic\DarkTheme.cs" />
<Compile Include="Logic\DvdSubtitleLanguages.cs" />
<Compile Include="Logic\FileTypeAssociations.cs" />
<Compile Include="Logic\FindReplaceDialogHelper.cs" />
<Compile Include="Logic\FontHelper.cs" />