diff --git a/src/LogExpert.Core/Classes/Filter/Filter.cs b/src/LogExpert.Core/Classes/Filter/Filter.cs index 80ec7d4b..f716fad9 100644 --- a/src/LogExpert.Core/Classes/Filter/Filter.cs +++ b/src/LogExpert.Core/Classes/Filter/Filter.cs @@ -1,13 +1,8 @@ using LogExpert.Classes.ILogLineColumnizerCallback; using LogExpert.Core.Classes; using LogExpert.Core.Classes.Filter; - using NLog; -using System; -using System.Collections.Generic; -using System.Windows.Forms; - namespace LogExpert.Classes.Filter { internal delegate void FilterFx(FilterParams filterParams, List filterResultLines, List lastFilterResultLines, List filterHitList); diff --git a/src/LogExpert.Core/Classes/Util.cs b/src/LogExpert.Core/Classes/Util.cs index 935f15b1..f4ab307a 100644 --- a/src/LogExpert.Core/Classes/Util.cs +++ b/src/LogExpert.Core/Classes/Util.cs @@ -1,5 +1,4 @@ using LogExpert.Core.Classes.Filter; - using System.Diagnostics; using System.Drawing; using System.Runtime.Versioning; @@ -402,59 +401,6 @@ public static void AssertTrue(bool condition, string msg) } } - [SupportedOSPlatform("windows")] - public string GetWordFromPos(int xPos, string text, Graphics g, Font font) - { - string[] words = text.Split([' ', '.', ':', ';']); - - int index = 0; - - List crList = []; - - for (int i = 0; i < words.Length; ++i) - { - crList.Add(new CharacterRange(index, words[i].Length)); - index += words[i].Length; - } - - CharacterRange[] crArray = [.. crList]; - - StringFormat stringFormat = new(StringFormat.GenericTypographic) - { - Trimming = StringTrimming.None, - FormatFlags = StringFormatFlags.NoClip - }; - - stringFormat.SetMeasurableCharacterRanges(crArray); - - RectangleF rect = new(0, 0, 3000, 20); - Region[] stringRegions = g.MeasureCharacterRanges(text, font, rect, stringFormat); - - bool found = false; - - int y = 0; - - foreach (Region regio in stringRegions) - { - if (regio.IsVisible(xPos, 3, g)) - { - found = true; - break; - } - - y++; - } - - if (found) - { - return words[y]; - } - else - { - return null; - } - } - #endregion #region Private Methods diff --git a/src/LogExpert.Core/Config/ColorMode.cs b/src/LogExpert.Core/Config/ColorMode.cs index 391d16e7..ac7c3690 100644 --- a/src/LogExpert.Core/Config/ColorMode.cs +++ b/src/LogExpert.Core/Config/ColorMode.cs @@ -74,34 +74,5 @@ private static void SetBrightMode() InactiveTabColor = LessBrightBackgroundColor; DarkModeEnabled = false; } - - #region TitleBarDarkMode - [DllImport("dwmapi.dll")] - private static extern int DwmSetWindowAttribute(nint hwnd, int attr, ref int attrValue, int attrSize); - - private const int DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19; - private const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20; - - public static bool UseImmersiveDarkMode(nint handle, bool enabled) - { - - var attribute = DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1; - if (IsWindows10OrGreater(18985)) - { - attribute = DWMWA_USE_IMMERSIVE_DARK_MODE; - } - - int useImmersiveDarkMode = enabled ? 1 : 0; - return DwmSetWindowAttribute(handle, attribute, ref useImmersiveDarkMode, sizeof(int)) == 0; - - } - - private static bool IsWindows10OrGreater(int build = -1) - { - return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= build; - } - - #endregion TitleBarDarkMode - } } diff --git a/src/LogExpert.Core/Entities/FileViewContext.cs b/src/LogExpert.Core/Entities/FileViewContext.cs index 07f4d20f..efcc7577 100644 --- a/src/LogExpert.Core/Entities/FileViewContext.cs +++ b/src/LogExpert.Core/Entities/FileViewContext.cs @@ -2,7 +2,7 @@ namespace LogExpert.Core.Entities { - public class FileViewContext(ILogPaintContext logPaintContext, ILogView logView) + public class FileViewContext(ILogPaintContext logPaintContext, ILogView logView) : IFileViewContext, ILogPaintContext { #region Properties diff --git a/src/LogExpert.Core/Interface/IFileViewContext.cs b/src/LogExpert.Core/Interface/IFileViewContext.cs new file mode 100644 index 00000000..da0b33f3 --- /dev/null +++ b/src/LogExpert.Core/Interface/IFileViewContext.cs @@ -0,0 +1,10 @@ +using LogExpert.Core.Entities; + +namespace LogExpert.Core.Interface +{ + public interface IFileViewContext + { + ILogView LogView { get; } + ILogPaintContext LogPaintContext { get; } + } +} \ No newline at end of file diff --git a/src/LogExpert.Core/Interface/ILogPaintContext.cs b/src/LogExpert.Core/Interface/ILogPaintContext.cs index e123d5f3..2fae38fa 100644 --- a/src/LogExpert.Core/Interface/ILogPaintContext.cs +++ b/src/LogExpert.Core/Interface/ILogPaintContext.cs @@ -1,36 +1,6 @@ -using LogExpert.Core.Classes.Highlight; -using LogExpert.Core.Entities; - -using System.Drawing; - -namespace LogExpert.Core.Interface +namespace LogExpert.Core.Interface { - /// - /// Declares methods that are needed for drawing log lines. Used by PaintHelper. - /// public interface ILogPaintContext { - #region Properties - - Font MonospacedFont { get; } // Font font = new Font("Courier New", this.Preferences.fontSize, FontStyle.Bold); - Font NormalFont { get; } - Font BoldFont { get; } - Color BookmarkColor { get; } - - #endregion - - #region Public methods - - ILogLine GetLogLine(int lineNum); - - IColumn GetCellValue(int rowIndex, int columnIndex); - - Bookmark GetBookmarkForLine(int lineNum); - - HighlightEntry FindHighlightEntry(ITextValue line, bool noWordMatches); - - IList FindHighlightMatches(ITextValue line); - - #endregion } } \ No newline at end of file diff --git a/src/LogExpert.Core/Interface/ISharedToolWindow.cs b/src/LogExpert.Core/Interface/ISharedToolWindow.cs index d8253b19..3178206d 100644 --- a/src/LogExpert.Core/Interface/ISharedToolWindow.cs +++ b/src/LogExpert.Core/Interface/ISharedToolWindow.cs @@ -1,5 +1,4 @@ using LogExpert.Core.Config; -using LogExpert.Core.Entities; namespace LogExpert.Core.Interface { @@ -16,7 +15,7 @@ public interface ISharedToolWindow /// Called when a file becomes the active file (e.g. when user selects a tab). /// /// - void SetCurrentFile(FileViewContext ctx); + void SetCurrentFile(IFileViewContext ctx); /// /// Called whenever the current file has been changed. diff --git a/src/LogExpert.Core/LogExpert.Core.csproj b/src/LogExpert.Core/LogExpert.Core.csproj index e5f95874..0062fbbf 100644 --- a/src/LogExpert.Core/LogExpert.Core.csproj +++ b/src/LogExpert.Core/LogExpert.Core.csproj @@ -8,6 +8,8 @@ true True ..\Solution Items\Key.snk + false + CS8625;CS8603;CS8618;CS8600;CS8603;CS8602;CS8604;CS8622;CS8601; @@ -21,7 +23,6 @@ - diff --git a/src/LogExpert.UI/Controls/LogWindow/LogWindow.cs b/src/LogExpert.UI/Controls/LogWindow/LogWindow.cs index a80a4b71..a3aa74ca 100644 --- a/src/LogExpert.UI/Controls/LogWindow/LogWindow.cs +++ b/src/LogExpert.UI/Controls/LogWindow/LogWindow.cs @@ -14,6 +14,7 @@ using LogExpert.UI.Controls.LogTabWindow; using LogExpert.UI.Dialogs; using LogExpert.UI.Extensions.Forms; +using LogExpert.UI.Interface; using NLog; using WeifenLuo.WinFormsUI.Docking; //using static LogExpert.PluginRegistry.PluginRegistry; //TODO: Adjust the instance name so using static can be used. @@ -21,7 +22,7 @@ namespace LogExpert.UI.Controls.LogWindow { //TODO: Implemented 4 interfaces explicitly. Find them by searcginh: ILogWindow. - internal partial class LogWindow : DockContent, ILogPaintContext, ILogView, ILogWindow + internal partial class LogWindow : DockContent, ILogPaintContextUI, ILogView, ILogWindow { #region Fields diff --git a/src/LogExpert.UI/Controls/LogWindow/TimeSpreadigControl.cs b/src/LogExpert.UI/Controls/LogWindow/TimeSpreadigControl.cs index f5035e25..24f5dca7 100644 --- a/src/LogExpert.UI/Controls/LogWindow/TimeSpreadigControl.cs +++ b/src/LogExpert.UI/Controls/LogWindow/TimeSpreadigControl.cs @@ -1,14 +1,8 @@ -using LogExpert.Classes; -using LogExpert.Core.Classes; +using LogExpert.Core.Classes; using LogExpert.Core.EventArguments; -using LogExpert.UI.Controls.LogWindow; +using LogExpert.UI.Extensions; using NLog; -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Windows.Forms; - namespace LogExpert.UI.Controls.LogWindow { internal partial class TimeSpreadingControl : UserControl diff --git a/src/LogExpert.UI/Dialogs/BookmarkWindow.cs b/src/LogExpert.UI/Dialogs/BookmarkWindow.cs index 328a7366..6259de88 100644 --- a/src/LogExpert.UI/Dialogs/BookmarkWindow.cs +++ b/src/LogExpert.UI/Dialogs/BookmarkWindow.cs @@ -4,14 +4,8 @@ using LogExpert.Core.Interface; using LogExpert.UI.Entities; using LogExpert.UI.Extensions.Forms; - +using LogExpert.UI.Interface; using NLog; - -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Windows.Forms; - using WeifenLuo.WinFormsUI.Docking; namespace LogExpert.Dialogs; @@ -25,7 +19,7 @@ public partial class BookmarkWindow : DockContent, ISharedToolWindow, IBookmarkV private readonly object paintLock = new(); private IBookmarkData bookmarkData; - private ILogPaintContext logPaintContext; + private ILogPaintContextUI logPaintContext; private ILogView logView; #endregion @@ -218,7 +212,7 @@ public void PreferencesChanged(Preferences newPreferences, bool isLoadTime, Sett PreferencesChanged(newPreferences, isLoadTime, flags, null); } - public void SetCurrentFile(FileViewContext ctx) + public void SetCurrentFile(IFileViewContext ctx) { if (ctx != null) { @@ -226,7 +220,7 @@ public void SetCurrentFile(FileViewContext ctx) lock (paintLock) { logView = ctx.LogView; - logPaintContext = ctx.LogPaintContext; + logPaintContext = (ILogPaintContextUI)ctx.LogPaintContext; } SetColumnizer(ctx.LogView.CurrentColumnizer); diff --git a/src/LogExpert.UI/Dialogs/ChooseIconDlg.cs b/src/LogExpert.UI/Dialogs/ChooseIconDlg.cs index bfc8cfad..b88fd6c4 100644 --- a/src/LogExpert.UI/Dialogs/ChooseIconDlg.cs +++ b/src/LogExpert.UI/Dialogs/ChooseIconDlg.cs @@ -1,5 +1,4 @@ -using LogExpert.Core.Classes; - +using LogExpert.UI.Extensions; using System.Runtime.Versioning; namespace LogExpert.UI.Dialogs; diff --git a/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindow.cs b/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindow.cs index 4c4533b9..e7093759 100644 --- a/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindow.cs +++ b/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindow.cs @@ -1,7 +1,9 @@ -using LogExpert.Core.Config; +using LogExpert.Core.Classes; +using LogExpert.Core.Config; using LogExpert.Core.Entities; using LogExpert.Core.Interface; using LogExpert.Dialogs; +using LogExpert.UI.Extensions; using LogExpert.UI.Extensions.Forms; using NLog; using System.Reflection; @@ -159,7 +161,7 @@ public LogTabWindow(string[] fileNames, int instanceNumber, bool showInstanceNum public void ChangeTheme(Control.ControlCollection container) { ColorMode.LoadColorMode(ConfigManager.Settings.Preferences.darkMode); - ColorMode.UseImmersiveDarkMode(Handle, ColorMode.DarkModeEnabled); + Win32.UseImmersiveDarkMode(Handle, ColorMode.DarkModeEnabled); #region ApplyColorToAllControls foreach (Control component in container) diff --git a/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindowPrivate.cs b/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindowPrivate.cs index e27b60db..e293b8c2 100644 --- a/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindowPrivate.cs +++ b/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindowPrivate.cs @@ -9,6 +9,7 @@ using LogExpert.Dialogs; using LogExpert.PluginRegistry.FileSystem; using LogExpert.UI.Dialogs; +using LogExpert.UI.Extensions; using System.ComponentModel; using System.Diagnostics; using System.Runtime.InteropServices; @@ -1000,9 +1001,6 @@ private void SetTabIcons(Preferences preferences) } } - [DllImport("user32.dll", CharSet = CharSet.Auto)] - private static extern bool DestroyIcon(IntPtr handle); - private void SetToolIcon(ToolEntry entry, ToolStripItem item) { Icon icon = Win32.LoadIconFromExe(entry.iconFile, entry.iconIndex); @@ -1018,7 +1016,7 @@ private void SetToolIcon(ToolEntry entry, ToolStripItem item) item.DisplayStyle = ToolStripItemDisplayStyle.Image; } - DestroyIcon(icon.Handle); + Win32.DestroyIcon(icon.Handle); icon.Dispose(); } diff --git a/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindowPublic.cs b/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindowPublic.cs index 147d8275..5bddf768 100644 --- a/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindowPublic.cs +++ b/src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindowPublic.cs @@ -5,6 +5,7 @@ using LogExpert.Core.Interface; using LogExpert.Dialogs; using LogExpert.UI.Entities; +using LogExpert.UI.Extensions; using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; @@ -283,7 +284,7 @@ public void SelectTab(ILogWindow logWindow) public void SetForeground() { - SetForegroundWindow(Handle); + Win32.SetForegroundWindow(Handle); if (WindowState == FormWindowState.Minimized) { if (_wasMaximized) @@ -297,9 +298,6 @@ public void SetForeground() } } - [DllImport("User32.dll")] - public static extern int SetForegroundWindow(IntPtr hWnd); - // called from LogWindow when follow tail was changed public void FollowTailChanged(LogWindow.LogWindow logWindow, bool isEnabled, bool offByTrigger) { diff --git a/src/LogExpert.UI/Dialogs/LogTabWindow/SettingsDialog.cs b/src/LogExpert.UI/Dialogs/LogTabWindow/SettingsDialog.cs index a6bce039..03035118 100644 --- a/src/LogExpert.UI/Dialogs/LogTabWindow/SettingsDialog.cs +++ b/src/LogExpert.UI/Dialogs/LogTabWindow/SettingsDialog.cs @@ -6,14 +6,9 @@ using LogExpert.Core.Interface; using LogExpert.UI.Controls.LogTabWindow; using LogExpert.UI.Dialogs; - -using System; -using System.Collections.Generic; -using System.Drawing; -using System.IO; +using LogExpert.UI.Extensions; using System.Runtime.InteropServices; using System.Text; -using System.Windows.Forms; namespace LogExpert.Dialogs; @@ -61,9 +56,6 @@ public SettingsDialog(Preferences prefs, LogTabWindow logTabWin, int tabToOpen, #region Private Methods - [DllImport("user32.dll", CharSet = CharSet.Auto)] - private static extern bool DestroyIcon(IntPtr handle); - private void FillDialog() { Preferences ??= new Preferences(); @@ -569,7 +561,7 @@ private void DisplayCurrentIcon() { Image image = icon.ToBitmap(); buttonIcon.Image = image; - DestroyIcon(icon.Handle); + Win32.DestroyIcon(icon.Handle); icon.Dispose(); } else diff --git a/src/LogExpert.UI/Entities/PaintHelper.cs b/src/LogExpert.UI/Entities/PaintHelper.cs index 6b7331f4..eeb499e6 100644 --- a/src/LogExpert.UI/Entities/PaintHelper.cs +++ b/src/LogExpert.UI/Entities/PaintHelper.cs @@ -4,6 +4,7 @@ using LogExpert.Core.Interface; using LogExpert.Dialogs; using LogExpert.UI.Controls; +using LogExpert.UI.Interface; using NLog; namespace LogExpert.UI.Entities @@ -29,7 +30,7 @@ internal static class PaintHelper #region Public methods - public static void CellPainting(ILogPaintContext logPaintCtx, BufferedDataGridView gridView, int rowIndex, + public static void CellPainting(ILogPaintContextUI logPaintCtx, BufferedDataGridView gridView, int rowIndex, DataGridViewCellPaintingEventArgs e) { if (rowIndex < 0 || e.ColumnIndex < 0) @@ -293,12 +294,12 @@ public static Rectangle BorderWidths(DataGridViewAdvancedBorderStyle advancedBor #region Private Methods - private static void PaintCell(ILogPaintContext logPaintCtx, DataGridViewCellPaintingEventArgs e, BufferedDataGridView gridView, bool noBackgroundFill, HighlightEntry groundEntry) + private static void PaintCell(ILogPaintContextUI logPaintCtx, DataGridViewCellPaintingEventArgs e, BufferedDataGridView gridView, bool noBackgroundFill, HighlightEntry groundEntry) { PaintHighlightedCell(logPaintCtx, e, gridView, noBackgroundFill, groundEntry); } - private static void PaintHighlightedCell(ILogPaintContext logPaintCtx, DataGridViewCellPaintingEventArgs e, BufferedDataGridView gridView, bool noBackgroundFill, HighlightEntry groundEntry) + private static void PaintHighlightedCell(ILogPaintContextUI logPaintCtx, DataGridViewCellPaintingEventArgs e, BufferedDataGridView gridView, bool noBackgroundFill, HighlightEntry groundEntry) { object value = e.Value ?? string.Empty; diff --git a/src/LogExpert.UI/Extensions/Utils.cs b/src/LogExpert.UI/Extensions/Utils.cs new file mode 100644 index 00000000..f753a1fd --- /dev/null +++ b/src/LogExpert.UI/Extensions/Utils.cs @@ -0,0 +1,57 @@ +namespace LogExpert.UI.Extensions +{ + internal static class Utils + { + public static string GetWordFromPos(int xPos, string text, Graphics g, Font font) + { + string[] words = text.Split([' ', '.', ':', ';']); + + int index = 0; + + List crList = []; + + for (int i = 0; i < words.Length; ++i) + { + crList.Add(new CharacterRange(index, words[i].Length)); + index += words[i].Length; + } + + CharacterRange[] crArray = [.. crList]; + + StringFormat stringFormat = new(StringFormat.GenericTypographic) + { + Trimming = StringTrimming.None, + FormatFlags = StringFormatFlags.NoClip + }; + + stringFormat.SetMeasurableCharacterRanges(crArray); + + RectangleF rect = new(0, 0, 3000, 20); + Region[] stringRegions = g.MeasureCharacterRanges(text, font, rect, stringFormat); + + bool found = false; + + int y = 0; + + foreach (Region regio in stringRegions) + { + if (regio.IsVisible(xPos, 3, g)) + { + found = true; + break; + } + + y++; + } + + if (found) + { + return words[y]; + } + else + { + return null; + } + } + } +} diff --git a/src/LogExpert.Core/Classes/Win32.cs b/src/LogExpert.UI/Extensions/Win32.cs similarity index 57% rename from src/LogExpert.Core/Classes/Win32.cs rename to src/LogExpert.UI/Extensions/Win32.cs index 15134978..b0f9e92e 100644 --- a/src/LogExpert.Core/Classes/Win32.cs +++ b/src/LogExpert.UI/Extensions/Win32.cs @@ -2,10 +2,10 @@ using System.Runtime.InteropServices; using System.Runtime.Versioning; -namespace LogExpert.Core.Classes +namespace LogExpert.UI.Extensions { [SupportedOSPlatform("windows")] - public static class Win32 + internal static partial class Win32 //NativeMethods { #region Fields @@ -13,13 +13,53 @@ public static class Win32 public const long SM_CXHSCROLL = 21; public const long SM_CXVSCROLL = 2; public const long SM_CYHSCROLL = 3; + private const int DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19; + private const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20; #endregion - #region Public methods + #region Library Imports + [LibraryImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static partial bool DestroyIcon(nint hIcon); + + [LibraryImport("User32.dll")] + public static partial int SetForegroundWindow(nint hWnd); + + [LibraryImport("user32.dll")] + public static partial long GetSystemMetricsForDpi(long index); + + [LibraryImport("user32.dll")] + public static partial long GetSystemMetrics(long index); + + [LibraryImport("user32.dll")] + public static partial short GetKeyState(int vKey); + + /* + UINT ExtractIconEx( + LPCTSTR lpszFile, + int nIconIndex, + HICON *phiconLarge, + HICON *phiconSmall, + UINT nIcons + ); + * */ + [LibraryImport("shell32.dll", StringMarshalling = StringMarshalling.Utf16)] + public static partial uint ExtractIconEx( + string fileName, + int iconIndex, + ref nint iconsLarge, + ref nint iconsSmall, + uint numIcons + ); - [DllImport("user32.dll")] - public static extern bool DestroyIcon(nint hIcon); + #region TitleBarDarkMode + [LibraryImport("dwmapi.dll")] + public static partial int DwmSetWindowAttribute(nint hwnd, int attr, ref int attrValue, int attrSize); + #endregion + #endregion + + #region Public methods public static Icon LoadIconFromExe(string fileName, int index) { @@ -43,7 +83,6 @@ public static Icon LoadIconFromExe(string fileName, int index) return null; } - public static Icon[,] ExtractIcons(string fileName) { nint smallIcon = nint.Zero; @@ -83,38 +122,30 @@ public static Icon LoadIconFromExe(string fileName, int index) return result; } - [DllImport("user32.dll")] - public static extern long GetSystemMetricsForDpi(long index); + #endregion + #region Private Methods - [DllImport("user32.dll")] - public static extern long GetSystemMetrics(long index); + public static bool UseImmersiveDarkMode(nint handle, bool enabled) + { - [DllImport("user32.dll")] - public static extern short GetKeyState(int vKey); + var attribute = DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1; + if (IsWindows10OrGreater(18985)) + { + attribute = DWMWA_USE_IMMERSIVE_DARK_MODE; + } - #endregion + int useImmersiveDarkMode = enabled ? 1 : 0; + return DwmSetWindowAttribute(handle, attribute, ref useImmersiveDarkMode, sizeof(int)) == 0; - #region Private Methods + } - /* - UINT ExtractIconEx( - LPCTSTR lpszFile, - int nIconIndex, - HICON *phiconLarge, - HICON *phiconSmall, - UINT nIcons - ); - * */ - - [DllImport("shell32.dll")] - private static extern uint ExtractIconEx(string fileName, - int iconIndex, - ref nint iconsLarge, - ref nint iconsSmall, - uint numIcons - ); + private static bool IsWindows10OrGreater(int build = -1) + { + return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= build; + } + + #endregion TitleBarDarkMode - #endregion } } \ No newline at end of file diff --git a/src/LogExpert.UI/Interface/ILogPaintContextUI.cs b/src/LogExpert.UI/Interface/ILogPaintContextUI.cs new file mode 100644 index 00000000..dcd8ae41 --- /dev/null +++ b/src/LogExpert.UI/Interface/ILogPaintContextUI.cs @@ -0,0 +1,35 @@ +using LogExpert.Core.Classes.Highlight; +using LogExpert.Core.Entities; +using LogExpert.Core.Interface; + +namespace LogExpert.UI.Interface +{ + /// + /// Declares methods that are needed for drawing log lines. Used by PaintHelper. + /// + public interface ILogPaintContextUI : ILogPaintContext + { + #region Properties + + Font MonospacedFont { get; } // Font font = new Font("Courier New", this.Preferences.fontSize, FontStyle.Bold); + Font NormalFont { get; } + Font BoldFont { get; } + Color BookmarkColor { get; } + + #endregion + + #region Public methods + + ILogLine GetLogLine(int lineNum); + + IColumn GetCellValue(int rowIndex, int columnIndex); + + Bookmark GetBookmarkForLine(int lineNum); + + HighlightEntry FindHighlightEntry(ITextValue line, bool noWordMatches); + + IList FindHighlightMatches(ITextValue line); + + #endregion + } +} \ No newline at end of file diff --git a/src/LogExpert.UI/LogExpert.UI.csproj b/src/LogExpert.UI/LogExpert.UI.csproj index 518bb32d..d6b22f11 100644 --- a/src/LogExpert.UI/LogExpert.UI.csproj +++ b/src/LogExpert.UI/LogExpert.UI.csproj @@ -1,14 +1,17 @@  - net8.0-windows - disable - true - enable - false - True + True ..\Solution Items\Key.snk true + false + enable + CS8625;CS8603;CS8618;CS8600;CS8603;CS8602;CS8604;CS8622;CS8601;CS8605; + enable + false + True + net8.0-windows + true @@ -23,7 +26,6 @@ - diff --git a/src/PluginRegistry/LogExpert.PluginRegistry.csproj b/src/PluginRegistry/LogExpert.PluginRegistry.csproj index a63bd451..56a2d733 100644 --- a/src/PluginRegistry/LogExpert.PluginRegistry.csproj +++ b/src/PluginRegistry/LogExpert.PluginRegistry.csproj @@ -7,6 +7,7 @@ enable True ..\Solution Items\Key.snk + CS8600;CS8603;CS8618;