Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/LogExpert.Core/Classes/Highlight/HighlightMatchEntry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace LogExpert.Core.Classes.Highlight;

/// <summary>
/// Class for storing word-wise highlight matches. Used for colouring different matches on one line.
/// </summary>
public class HighlightMatchEntry
{
#region Properties

public HighlightEntry HighlightEntry { get; set; }

public int StartPos { get; set; }

public int Length { get; set; }

#endregion

#region Public methods

public override string ToString ()
{
return $"{HighlightEntry.SearchText}/{StartPos}/{Length}";
}

#endregion
}
26 changes: 0 additions & 26 deletions src/LogExpert.Core/Classes/Highlight/HilightMatchEntry.cs

This file was deleted.

15 changes: 7 additions & 8 deletions src/LogExpert.Core/Config/ColorMode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Drawing;
using System.Runtime.InteropServices;
using System.Drawing;

namespace LogExpert.Core.Config;

Expand All @@ -10,8 +9,8 @@ public static class ColorMode
private static readonly Color BrightBookmarkDefaultSystemColor = SystemColors.Control; // Important: only supports SystemColors
private static readonly Color LessBrightBackgroundColor = Color.FromArgb(208, 205, 206);
private static readonly Color BrightBackgroundColor = Color.FromArgb(221, 221, 221);
private static readonly Color BrighterBackgroundColor = Color.FromArgb(253, 253, 253);
private static readonly Color BrightForeColor = Color.FromArgb(0, 0, 0);
private static readonly Color BrighterBackgroundColor = Color.White;
private static readonly Color BrightForeColor = Color.Black;

// Dark Theme
// https://paletton.com/#uid=15-0u0k005U0670008J003Y003Y
Expand All @@ -20,7 +19,7 @@ public static class ColorMode
private static readonly Color LessDarkBackgroundColor = Color.FromArgb(67, 67, 67);
private static readonly Color DarkBackgroundColor = Color.FromArgb(45, 45, 45);
private static readonly Color DarkerBackgroundColor = Color.FromArgb(30, 30, 30);
private static readonly Color DarkForeColor = Color.FromArgb(255, 255, 255);
private static readonly Color DarkForeColor = Color.White;

// Default
public static Color BackgroundColor = BrightBackgroundColor;
Expand All @@ -35,7 +34,7 @@ public static class ColorMode

public static bool DarkModeEnabled;

public static void LoadColorMode(bool darkMode)
public static void LoadColorMode (bool darkMode)
{
if (darkMode)
{
Expand All @@ -47,7 +46,7 @@ public static void LoadColorMode(bool darkMode)
}
}

private static void SetDarkMode()
private static void SetDarkMode ()
{
BackgroundColor = DarkBackgroundColor;
ForeColor = DarkForeColor;
Expand All @@ -61,7 +60,7 @@ private static void SetDarkMode()
DarkModeEnabled = true;
}

private static void SetBrightMode()
private static void SetBrightMode ()
{
BackgroundColor = BrightBackgroundColor;
ForeColor = BrightForeColor;
Expand Down
10 changes: 5 additions & 5 deletions src/LogExpert.Core/Interface/ISharedToolWindow.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using LogExpert.Core.Config;
using LogExpert.Core.Config;

namespace LogExpert.Core.Interface;

Expand All @@ -15,16 +15,16 @@ public interface ISharedToolWindow
/// Called when a file becomes the active file (e.g. when user selects a tab).
/// </summary>
/// <param name="ctx"></param>
void SetCurrentFile(IFileViewContext ctx);
void SetCurrentFile (IFileViewContext ctx);

/// <summary>
/// Called whenever the current file has been changed.
/// </summary>
void FileChanged();
void FileChanged ();

void SetColumnizer(ILogLineColumnizer columnizer);
void SetColumnizer (ILogLineColumnizer columnizer);

void PreferencesChanged(Preferences newPreferences, bool isLoadTime, SettingsFlags flags);
void PreferencesChanged (string fontName, float fontSize, bool setLastColumnWidth, int lastColumnWidth, SettingsFlags flags);

#endregion
}
56 changes: 28 additions & 28 deletions src/LogExpert.UI/Controls/BufferedDataGridView.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions src/LogExpert.UI/Controls/BufferedDataGridView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ internal partial class BufferedDataGridView : DataGridView
{
#region Fields

private static readonly ILogger _logger = LogManager.GetCurrentClassLogger();
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
private readonly Brush _brush;

private readonly Color _bubbleColor = Color.FromArgb(160, 250, 250, 00);
private readonly Color _bubbleColor = Color.FromArgb(160, 250, 250, 0);
private readonly Font _font = new("Arial", 10);

private readonly SortedList<int, BookmarkOverlay> _overlayList = [];
Expand Down Expand Up @@ -230,9 +230,11 @@ private void PaintOverlays (PaintEventArgs e)

base.OnPaint(args);

StringFormat format = new();
format.LineAlignment = StringAlignment.Center;
format.Alignment = StringAlignment.Near;
StringFormat format = new()
{
LineAlignment = StringAlignment.Center,
Alignment = StringAlignment.Near
};

myBuffer.Graphics.SetClip(DisplayRectangle, CombineMode.Intersect);

Expand All @@ -247,8 +249,7 @@ private void PaintOverlays (PaintEventArgs e)
foreach (BookmarkOverlay overlay in _overlayList.Values)
{
SizeF textSize = myBuffer.Graphics.MeasureString(overlay.Bookmark.Text, _font, 300);
Rectangle rectBubble = new(overlay.Position,
new Size((int)textSize.Width, (int)textSize.Height));
Rectangle rectBubble = new(overlay.Position, new Size((int)textSize.Width, (int)textSize.Height));
rectBubble.Offset(60, -(rectBubble.Height + 40));
rectBubble.Inflate(3, 3);
rectBubble.Location += overlay.Bookmark.OverlayOffset;
Expand All @@ -264,7 +265,7 @@ private void PaintOverlays (PaintEventArgs e)

if (_logger.IsDebugEnabled)
{
_logger.Debug("ClipRgn: {0},{1},{2},{3}", myBuffer.Graphics.ClipBounds.Left, myBuffer.Graphics.ClipBounds.Top, myBuffer.Graphics.ClipBounds.Width, myBuffer.Graphics.ClipBounds.Height);
_logger.Debug($"ClipRgn: {myBuffer.Graphics.ClipBounds.Left},{myBuffer.Graphics.ClipBounds.Top},{myBuffer.Graphics.ClipBounds.Width},{myBuffer.Graphics.ClipBounds.Height}");
}
}
}
Expand Down
36 changes: 12 additions & 24 deletions src/LogExpert.UI/Controls/LogWindow/LogWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ internal partial class LogWindow : DockContent, ILogPaintContextUI, ILogView, IL
private const int SPREAD_MAX = 99;
private const int PROGRESS_BAR_MODULO = 1000;
private const int FILTER_ADVANCED_SPLITTER_DISTANCE = 150;
private static readonly ILogger _logger = LogManager.GetCurrentClassLogger();
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();

private readonly Image _advancedButtonImage;

private readonly object _bookmarkLock = new();
private readonly BookmarkDataProvider _bookmarkProvider = new();

private readonly IList<IBackgroundProcessCancelHandler> _cancelHandlerList = new List<IBackgroundProcessCancelHandler>();
private readonly IList<IBackgroundProcessCancelHandler> _cancelHandlerList = [];

private readonly object _currentColumnizerLock = new();

private readonly object _currentHighlightGroupLock = new();

private readonly EventWaitHandle _externaLoadingFinishedEvent = new ManualResetEvent(false);

private readonly IList<FilterPipe> _filterPipeList = new List<FilterPipe>();
private readonly IList<FilterPipe> _filterPipeList = [];
private readonly Dictionary<Control, bool> _freezeStateMap = [];
private readonly GuiStateArgs _guiStateArgs = new();

Expand Down Expand Up @@ -141,10 +141,11 @@ public LogWindow (LogTabWindow.LogTabWindow parent, string fileName, bool isTemp
{
SuspendLayout();

//HighDPI Functionality must be called before all UI Elements are initialized, to make sure they work as intended
AutoScaleDimensions = new SizeF(96F, 96F);
AutoScaleMode = AutoScaleMode.Dpi;

InitializeComponent(); //TODO: Move this to be the first line of the constructor?
InitializeComponent();

CreateDefaultViewStyle();

Expand Down Expand Up @@ -210,15 +211,9 @@ public LogWindow (LogTabWindow.LogTabWindow parent, string fileName, bool isTemp

_timeShiftSyncTask = new Task(SyncTimestampDisplayWorker, cts.Token);
_timeShiftSyncTask.Start();
//_timeShiftSyncThread = new Thread(SyncTimestampDisplayWorker);
//_timeShiftSyncThread.IsBackground = true;
//_timeShiftSyncThread.Start();

_logEventHandlerTask = new Task(LogEventWorker, cts.Token);
_logEventHandlerTask.Start();
//_logEventHandlerThread = new Thread(LogEventWorker);
//_logEventHandlerThread.IsBackground = true;
//_logEventHandlerThread.Start();

//this.filterUpdateThread = new Thread(new ThreadStart(this.FilterUpdateWorker));
//this.filterUpdateThread.Start();
Expand Down Expand Up @@ -355,7 +350,7 @@ public void ChangeTheme (Control.ControlCollection container)

for (var y = 0; y < filterContextMenuStrip.Items.Count; y++)
{
var item = filterContextMenuStrip.Items[y];
ToolStripItem item = filterContextMenuStrip.Items[y];
item.ForeColor = ColorMode.ForeColor;
item.BackColor = ColorMode.MenuBackgroundColor;
}
Expand Down Expand Up @@ -482,26 +477,17 @@ public bool IsMultiFile

internal FilterPipe FilterPipe { get; set; }

public string Title
{
get
{
if (IsTempFile)
{
return TempTitleName;
}

return FileName;
}
}
public string Title => IsTempFile
? TempTitleName
: FileName;

public ColumnizerCallback ColumnizerCallbackObject { get; }

public bool ForcePersistenceLoading { get; set; }

public string ForcedPersistenceFileName { get; set; }

public Preferences Preferences => ConfigManager.Settings.Preferences;
public Preferences Preferences => _parentLogTabWin.Preferences;

public string GivenFileName { get; set; }

Expand Down Expand Up @@ -601,11 +587,13 @@ internal void ChangeMultifileMask ()
internal void ToggleColumnFinder (bool show, bool setFocus)
{
_guiStateArgs.ColumnFinderVisible = show;

if (show)
{
columnComboBox.AutoCompleteMode = AutoCompleteMode.Suggest;
columnComboBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
columnComboBox.AutoCompleteCustomSource = [.. CurrentColumnizer.GetColumnNames()];

if (setFocus)
{
columnComboBox.Focus();
Expand Down
2 changes: 1 addition & 1 deletion src/LogExpert.UI/Controls/LogWindow/LogWindow.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ protected void OnDeRegisterCancelHandler (IBackgroundProcessCancelHandler handle
[SupportedOSPlatform("windows")]
private void OnLogWindowLoad (object sender, EventArgs e)
{
PreferencesChanged(_parentLogTabWin.Preferences, true, SettingsFlags.GuiOrColors);
var setLastColumnWidth = _parentLogTabWin.Preferences.SetLastColumnWidth;
var lastColumnWidth = _parentLogTabWin.Preferences.LastColumnWidth;
var fontName = _parentLogTabWin.Preferences.FontName;
var fontSize = _parentLogTabWin.Preferences.FontSize;

PreferencesChanged(fontName, fontSize, setLastColumnWidth, lastColumnWidth, true, SettingsFlags.GuiOrColors);
}

[SupportedOSPlatform("windows")]
Expand Down
Loading
Loading