From 3c8a2859ca13d847ad5ebaf652d963a35f0eb54f Mon Sep 17 00:00:00 2001 From: niksedk Date: Fri, 18 Aug 2023 02:17:52 +0200 Subject: [PATCH] Minor refact --- SubtitleEdit.sln.DotSettings | 3 +- src/ui/Controls/SubtitleListView.cs | 46 ++++------------------------- 2 files changed, 8 insertions(+), 41 deletions(-) diff --git a/SubtitleEdit.sln.DotSettings b/SubtitleEdit.sln.DotSettings index 486100f59..4ca162d2b 100644 --- a/SubtitleEdit.sln.DotSettings +++ b/SubtitleEdit.sln.DotSettings @@ -28,4 +28,5 @@ True True True - True \ No newline at end of file + True + True \ No newline at end of file diff --git a/src/ui/Controls/SubtitleListView.cs b/src/ui/Controls/SubtitleListView.cs index 46afd468d..17a1d56d0 100644 --- a/src/ui/Controls/SubtitleListView.cs +++ b/src/ui/Controls/SubtitleListView.cs @@ -54,43 +54,9 @@ namespace Nikse.SubtitleEdit.Controls public bool IsOriginalTextColumnVisible => ColumnIndexTextOriginal >= 0; private string _lineSeparatorString = " || "; - private Font _subtitleFont = new Font("Tahoma", 8.25F); - - private string _subtitleFontName = "Tahoma"; - - 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 string SubtitleFontName { get; set; } = "Tahoma"; + public bool SubtitleFontBold { get; set; } + public int SubtitleFontSize { get; set; } = 8; public bool UseSyntaxColoring { get; set; } private Settings _settings; @@ -190,7 +156,7 @@ namespace Nikse.SubtitleEdit.Controls if (!string.IsNullOrEmpty(settings.General.SubtitleFontName)) { - _subtitleFontName = settings.General.SubtitleFontName; + SubtitleFontName = settings.General.SubtitleFontName; } SubtitleFontBold = settings.General.SubtitleListViewFontBold; @@ -1283,7 +1249,7 @@ namespace Nikse.SubtitleEdit.Controls Items.Clear(); var x = ListViewItemSorter; ListViewItemSorter = null; - var font = new Font(_subtitleFontName, SubtitleFontSize, GetFontStyle()); + var font = new Font(SubtitleFontName, SubtitleFontSize, GetFontStyle()); var items = new ListViewItem[paragraphs.Count]; for (var index = 0; index < paragraphs.Count; index++) { @@ -1325,7 +1291,7 @@ namespace Nikse.SubtitleEdit.Controls var x = ListViewItemSorter; ListViewItemSorter = null; 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++) { var paragraph = paragraphs[index];