Some fixes for new "Count" in "Find" dialog (tabstop order + don't count empty string + text for one match)

This commit is contained in:
niksedk 2015-09-18 20:04:37 +02:00
parent 500e93336e
commit 97366246c2
9 changed files with 22 additions and 14 deletions

View File

@ -495,7 +495,8 @@ Note: Do check free disk space.</WaveFileMalformed>
<RegularExpression>Regular e&amp;xpression</RegularExpression>
<WholeWord>Whole word</WholeWord>
<Count>Count</Count>
<XNumberOfMatches>{0} matches</XNumberOfMatches>
<XNumberOfMatches>{0:#,##0} matches</XNumberOfMatches>
<OneMatch>One match</OneMatch>
</FindDialog>
<FindSubtitleLine>
<Title>Find subtitle line</Title>

View File

@ -673,7 +673,8 @@ namespace Nikse.SubtitleEdit.Core
RegularExpression = "Regular e&xpression",
WholeWord = "Whole word",
Count = "Count",
XNumberOfMatches = "{0} matches"
XNumberOfMatches = "{0:#,##0} matches",
OneMatch = "One match"
};
FindSubtitleLine = new LanguageStructure.FindSubtitleLine

View File

@ -1276,6 +1276,9 @@ namespace Nikse.SubtitleEdit.Core
case "FindDialog/XNumberOfMatches":
language.FindDialog.XNumberOfMatches = reader.Value;
break;
case "FindDialog/OneMatch":
language.FindDialog.OneMatch = reader.Value;
break;
case "FindSubtitleLine/Title":
language.FindSubtitleLine.Title = reader.Value;
break;

View File

@ -553,6 +553,7 @@
public string WholeWord { get; set; }
public string Count { get; set; }
public string XNumberOfMatches { get; set; }
public string OneMatch { get; set; }
}
public class FindSubtitleLine

View File

@ -61,7 +61,7 @@
// buttonCancel
//
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(207, 36);
this.buttonCancel.Location = new System.Drawing.Point(207, 67);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 21);
this.buttonCancel.TabIndex = 3;
@ -114,10 +114,10 @@
//
// buttonCount
//
this.buttonCount.Location = new System.Drawing.Point(207, 63);
this.buttonCount.Location = new System.Drawing.Point(207, 38);
this.buttonCount.Name = "buttonCount";
this.buttonCount.Size = new System.Drawing.Size(75, 23);
this.buttonCount.TabIndex = 10;
this.buttonCount.TabIndex = 2;
this.buttonCount.Text = "Count";
this.buttonCount.UseVisualStyleBackColor = true;
this.buttonCount.Click += new System.EventHandler(this.buttonCount_Click);
@ -137,7 +137,7 @@
this.checkBoxWholeWord.Location = new System.Drawing.Point(12, 40);
this.checkBoxWholeWord.Name = "checkBoxWholeWord";
this.checkBoxWholeWord.Size = new System.Drawing.Size(83, 17);
this.checkBoxWholeWord.TabIndex = 12;
this.checkBoxWholeWord.TabIndex = 4;
this.checkBoxWholeWord.Text = "Whole word";
this.checkBoxWholeWord.UseVisualStyleBackColor = true;
//

View File

@ -1,9 +1,9 @@
using Nikse.SubtitleEdit.Core;
using Nikse.SubtitleEdit.Core.Enums;
using System;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Nikse.SubtitleEdit.Core.Enums;
namespace Nikse.SubtitleEdit.Forms
{
@ -188,13 +188,15 @@ namespace Nikse.SubtitleEdit.Forms
private void buttonCount_Click(object sender, EventArgs e)
{
var count = 0;
if (FindText.Length > 0)
if (FindText.Length == 0)
{
count = GetFindDialogHelper(0).FindCount(_subtitle, checkBoxWholeWord.Checked);
labelCount.Text = string.Empty;
return;
}
var count = GetFindDialogHelper(0).FindCount(_subtitle, checkBoxWholeWord.Checked);
labelCount.ForeColor = count > 0 ? Color.Blue : Color.Red;
labelCount.Text = string.Format(Configuration.Settings.Language.FindDialog.XNumberOfMatches, count);
labelCount.Text = count == 1 ? Configuration.Settings.Language.FindDialog.OneMatch : string.Format(Configuration.Settings.Language.FindDialog.XNumberOfMatches, count);
}
}
}

View File

@ -494,7 +494,7 @@ Ist genügend Plattenspeicherplatz verfügbar?</WaveFileMalformed>
<RegularExpression>Regulärer &amp;Ausdruck</RegularExpression>
<WholeWord>Nur ganze Wörter</WholeWord>
<Count>Zählen</Count>
<XNumberOfMatches>{0} Treffer</XNumberOfMatches>
<XNumberOfMatches>{0:#,##0} Treffer</XNumberOfMatches>
</FindDialog>
<FindSubtitleLine>
<Title>Untertitel Text suchen</Title>

View File

@ -495,7 +495,7 @@ Note: Vérifiez l'espace disque disponible.</WaveFileMalformed>
<RegularExpression>Expression régulière</RegularExpression>
<WholeWord>Mot entier uniquement</WholeWord>
<Count>Compter</Count>
<XNumberOfMatches>{0} résultats</XNumberOfMatches>
<XNumberOfMatches>{0:#,##0} résultats</XNumberOfMatches>
</FindDialog>
<FindSubtitleLine>
<Title>Chercher la ligne de sous-titre</Title>

View File

@ -494,7 +494,7 @@ Is er voldoende beschikbare ruimte op de harde schijf?</WaveFileMalformed>
<RegularExpression>Reguliere e&amp;xpressie</RegularExpression>
<WholeWord>Losse woorden</WholeWord>
<Count>Tellen</Count>
<XNumberOfMatches>{0} treffers</XNumberOfMatches>
<XNumberOfMatches>{0:#,##0} treffers</XNumberOfMatches>
</FindDialog>
<FindSubtitleLine>
<Title>Ondertiteltekst zoeken</Title>