Fixed tab-order + localizaation of "Statistics" window

This commit is contained in:
niksedk 2015-02-27 21:35:41 +01:00
parent ec1aec91fe
commit bbf09733e5
6 changed files with 28 additions and 20 deletions

View File

@ -1835,6 +1835,7 @@ can edit in same subtitle file (collaboration)</Information>
<CharactersPerSecondMinimum>Characters/sec - minimum: {0:0.000}</CharactersPerSecondMinimum>
<CharactersPerSecondMaximum>Characters/sec - maximum: {0:0.000}</CharactersPerSecondMaximum>
<CharactersPerSecondAverage>Characters/sec - average: {0:0.000}</CharactersPerSecondAverage>
<Export>Export...</Export>
</Statistics>
<SubStationAlphaProperties>
<Title>Advanced Sub Station Alpha properties</Title>

View File

@ -1,6 +1,6 @@
namespace Nikse.SubtitleEdit.Forms
{
partial class Statistics
sealed partial class Statistics
{
/// <summary>
/// Required designer variable.
@ -48,7 +48,7 @@
this.buttonOK.Location = new System.Drawing.Point(642, 632);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 21);
this.buttonOK.TabIndex = 2;
this.buttonOK.TabIndex = 3;
this.buttonOK.Text = "&OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
@ -100,7 +100,7 @@
this.labelMostUsedLines.Location = new System.Drawing.Point(329, 27);
this.labelMostUsedLines.Name = "labelMostUsedLines";
this.labelMostUsedLines.Size = new System.Drawing.Size(80, 13);
this.labelMostUsedLines.TabIndex = 6;
this.labelMostUsedLines.TabIndex = 2;
this.labelMostUsedLines.Text = "Most used lines";
//
// labelMostUsedWords
@ -109,7 +109,7 @@
this.labelMostUsedWords.Location = new System.Drawing.Point(6, 27);
this.labelMostUsedWords.Name = "labelMostUsedWords";
this.labelMostUsedWords.Size = new System.Drawing.Size(87, 13);
this.labelMostUsedWords.TabIndex = 5;
this.labelMostUsedWords.TabIndex = 0;
this.labelMostUsedWords.Text = "Most used words";
//
// textBoxMostUsedLines
@ -123,7 +123,7 @@
this.textBoxMostUsedLines.ReadOnly = true;
this.textBoxMostUsedLines.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBoxMostUsedLines.Size = new System.Drawing.Size(367, 183);
this.textBoxMostUsedLines.TabIndex = 1;
this.textBoxMostUsedLines.TabIndex = 3;
//
// textBoxMostUsedWords
//
@ -135,14 +135,14 @@
this.textBoxMostUsedWords.ReadOnly = true;
this.textBoxMostUsedWords.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBoxMostUsedWords.Size = new System.Drawing.Size(320, 183);
this.textBoxMostUsedWords.TabIndex = 0;
this.textBoxMostUsedWords.TabIndex = 1;
//
// buttonExport
//
this.buttonExport.Location = new System.Drawing.Point(561, 632);
this.buttonExport.Location = new System.Drawing.Point(534, 632);
this.buttonExport.Name = "buttonExport";
this.buttonExport.Size = new System.Drawing.Size(75, 23);
this.buttonExport.TabIndex = 7;
this.buttonExport.Size = new System.Drawing.Size(102, 23);
this.buttonExport.TabIndex = 2;
this.buttonExport.Text = "Export";
this.buttonExport.UseVisualStyleBackColor = true;
this.buttonExport.Click += new System.EventHandler(this.buttonExport_Click);

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
using Nikse.SubtitleEdit.Core;
@ -9,7 +10,7 @@ using Nikse.SubtitleEdit.Logic.SubtitleFormats;
namespace Nikse.SubtitleEdit.Forms
{
public partial class Statistics : PositionAndSizeForm
public sealed partial class Statistics : PositionAndSizeForm
{
private Subtitle _subtitle;
private SubtitleFormat _format;
@ -17,7 +18,7 @@ namespace Nikse.SubtitleEdit.Forms
private string _mostUsedLines;
private string _general;
private string _mostUsedWords;
const string writeFormat = @"File generated by: Subtitle Edit
const string WriteFormat = @"File generated by: Subtitle Edit
http://www.nikse.dk/subtitleedit/
https://github.com/SubtitleEdit/subtitleedit
============================= General =============================
@ -42,6 +43,7 @@ https://github.com/SubtitleEdit/subtitleedit
groupBoxMostUsed.Text = _l.MostUsed;
labelMostUsedWords.Text = _l.MostUsedWords;
labelMostUsedLines.Text = _l.MostUsedLines;
buttonExport.Text = _l.Export;
buttonOK.Text = Configuration.Settings.Language.General.Ok;
FixLargeFonts();
@ -54,11 +56,11 @@ https://github.com/SubtitleEdit/subtitleedit
}
CalculateMostUsedWords();
{
this.textBoxMostUsedWords.Text = _mostUsedWords;
textBoxMostUsedWords.Text = _mostUsedWords;
}
CalculateMostUsedLines();
{
this.textBoxMostUsedLines.Text = _mostUsedLines;
textBoxMostUsedLines.Text = _mostUsedLines;
}
}
@ -155,8 +157,8 @@ https://github.com/SubtitleEdit/subtitleedit
private void FixLargeFonts()
{
Graphics graphics = this.CreateGraphics();
SizeF textSize = graphics.MeasureString(buttonOK.Text, this.Font);
Graphics graphics = CreateGraphics();
SizeF textSize = graphics.MeasureString(buttonOK.Text, Font);
if (textSize.Height > buttonOK.Height - 4)
{
int newButtonHeight = (int)(textSize.Height + 7 + 0.5);
@ -168,7 +170,7 @@ https://github.com/SubtitleEdit/subtitleedit
if (e.KeyCode == Keys.Escape)
DialogResult = DialogResult.Cancel;
else if (e.KeyData == (Keys.Control | Keys.C))
Clipboard.SetText(string.Format(writeFormat, _general, _mostUsedWords, _mostUsedLines), TextDataFormat.UnicodeText);
Clipboard.SetText(string.Format(WriteFormat, _general, _mostUsedWords, _mostUsedLines), TextDataFormat.UnicodeText);
}
private static void MostUsedWordsAdd(Dictionary<string, string> hashtable, string lastLine)
@ -217,7 +219,7 @@ https://github.com/SubtitleEdit/subtitleedit
{
int hits = int.Parse(hashtable[s]);
hits++;
hashtable[s] = hits.ToString();
hashtable[s] = hits.ToString(CultureInfo.InvariantCulture);
}
else if (s.Length > 1)
{
@ -259,7 +261,7 @@ https://github.com/SubtitleEdit/subtitleedit
{
int hits = int.Parse(hashtable[s]);
hits++;
hashtable[s] = hits.ToString();
hashtable[s] = hits.ToString(CultureInfo.InvariantCulture);
}
else if (s.Length > 0)
{
@ -351,10 +353,10 @@ https://github.com/SubtitleEdit/subtitleedit
private void buttonExport_Click(object sender, EventArgs e)
{
var saveFile = new SaveFileDialog { Filter = "Text files (*.txt)|*.txt|NFO files (*.nfo)|*.nfo" };
if (saveFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
if (saveFile.ShowDialog() == DialogResult.OK)
{
string fileName = saveFile.FileName;
var statistic = string.Format(writeFormat, _general, _mostUsedWords, _mostUsedLines);
var statistic = string.Format(WriteFormat, _general, _mostUsedWords, _mostUsedLines);
System.IO.File.WriteAllText(fileName, statistic);
}
}

View File

@ -2132,6 +2132,7 @@ can edit in same subtitle file (collaboration)",
CharactersPerSecondMinimum = "Characters/sec - minimum: {0:0.000}",
CharactersPerSecondMaximum = "Characters/sec - maximum: {0:0.000}",
CharactersPerSecondAverage = "Characters/sec - average: {0:0.000}",
Export = "Export...",
};
SubStationAlphaProperties = new LanguageStructure.SubStationAlphaProperties

View File

@ -4938,6 +4938,9 @@ namespace Nikse.SubtitleEdit.Logic
case "Statistics/CharactersPerSecondAverage":
language.Statistics.CharactersPerSecondAverage = reader.Value;
break;
case "Statistics/Export":
language.Statistics.Export = reader.Value;
break;
case "SubStationAlphaProperties/Title":
language.SubStationAlphaProperties.Title = reader.Value;
break;

View File

@ -2023,6 +2023,7 @@
public string CharactersPerSecondMinimum { get; set; }
public string CharactersPerSecondMaximum { get; set; }
public string CharactersPerSecondAverage { get; set; }
public string Export { get; set; }
}
public class SubStationAlphaProperties