Minor refact

This commit is contained in:
niksedk 2023-08-18 02:17:52 +02:00
parent 0c67af8bb1
commit 3c8a2859ca
2 changed files with 8 additions and 41 deletions

View File

@ -28,4 +28,5 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Immersive/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Immersive/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Matroska/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Matroska/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nikse/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Nikse/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Purfview/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> <s:Boolean x:Key="/Default/UserDictionary/Words/=Purfview/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tahoma/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -54,43 +54,9 @@ namespace Nikse.SubtitleEdit.Controls
public bool IsOriginalTextColumnVisible => ColumnIndexTextOriginal >= 0; public bool IsOriginalTextColumnVisible => ColumnIndexTextOriginal >= 0;
private string _lineSeparatorString = " || "; private string _lineSeparatorString = " || ";
private Font _subtitleFont = new Font("Tahoma", 8.25F); public string SubtitleFontName { get; set; } = "Tahoma";
public bool SubtitleFontBold { get; set; }
private string _subtitleFontName = "Tahoma"; public int SubtitleFontSize { get; set; } = 8;
public string SubtitleFontName
{
get => _subtitleFontName;
set
{
_subtitleFontName = value;
_subtitleFont = new Font(_subtitleFontName, SubtitleFontSize, GetFontStyle());
}
}
private bool _subtitleFontBold;
public bool SubtitleFontBold
{
get { return _subtitleFontBold; }
set
{
_subtitleFontBold = value;
_subtitleFont = new Font(_subtitleFontName, SubtitleFontSize, GetFontStyle());
}
}
private int _subtitleFontSize = 8;
public int SubtitleFontSize
{
get => _subtitleFontSize;
set
{
_subtitleFontSize = value;
_subtitleFont = new Font(_subtitleFontName, SubtitleFontSize, GetFontStyle());
}
}
public bool UseSyntaxColoring { get; set; } public bool UseSyntaxColoring { get; set; }
private Settings _settings; private Settings _settings;
@ -190,7 +156,7 @@ namespace Nikse.SubtitleEdit.Controls
if (!string.IsNullOrEmpty(settings.General.SubtitleFontName)) if (!string.IsNullOrEmpty(settings.General.SubtitleFontName))
{ {
_subtitleFontName = settings.General.SubtitleFontName; SubtitleFontName = settings.General.SubtitleFontName;
} }
SubtitleFontBold = settings.General.SubtitleListViewFontBold; SubtitleFontBold = settings.General.SubtitleListViewFontBold;
@ -1283,7 +1249,7 @@ namespace Nikse.SubtitleEdit.Controls
Items.Clear(); Items.Clear();
var x = ListViewItemSorter; var x = ListViewItemSorter;
ListViewItemSorter = null; ListViewItemSorter = null;
var font = new Font(_subtitleFontName, SubtitleFontSize, GetFontStyle()); var font = new Font(SubtitleFontName, SubtitleFontSize, GetFontStyle());
var items = new ListViewItem[paragraphs.Count]; var items = new ListViewItem[paragraphs.Count];
for (var index = 0; index < paragraphs.Count; index++) for (var index = 0; index < paragraphs.Count; index++)
{ {
@ -1325,7 +1291,7 @@ namespace Nikse.SubtitleEdit.Controls
var x = ListViewItemSorter; var x = ListViewItemSorter;
ListViewItemSorter = null; ListViewItemSorter = null;
var items = new ListViewItem[paragraphs.Count]; var items = new ListViewItem[paragraphs.Count];
var font = new Font(_subtitleFontName, SubtitleFontSize, GetFontStyle()); var font = new Font(SubtitleFontName, SubtitleFontSize, GetFontStyle());
for (var index = 0; index < paragraphs.Count; index++) for (var index = 0; index < paragraphs.Count; index++)
{ {
var paragraph = paragraphs[index]; var paragraph = paragraphs[index];