Skip to content
Open
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
67 changes: 58 additions & 9 deletions src/LogExpert.UI/Controls/LogWindow/LogWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ internal partial class LogWindow : DockContent, ILogPaintContextUI, ILogView, IL
#region Fields

private const int PROGRESS_BAR_MODULO = 1000;
private const int FILTER_ADVANCED_SPLITTER_DISTANCE = 110;
private const int FILTER_PANEL2_CONTROL_GAP = 6;
private const int FILTER_ADVANCED_PANEL_BOTTOM_MARGIN = 1;
private const int FILTER_INPUT_PANEL_BOTTOM_MARGIN = 1;
private const int FILTER_PANEL2_CONTROL_GAP = 7;
private const int MINIMUM_FILTER_TEXT_BOX_WIDTH = 100;
private const int WAIT_TIME = 500;
private const int OVERSCAN = 20;
private const int COLUMN_FINDER_HEIGHT = 28;
Expand Down Expand Up @@ -196,6 +198,7 @@ public LogWindow (ILogWindowCoordinator logWindowCoordinator, string fileName, b
InitializeComponent();

SetResources();
SetFilterInputPanelHeight();

CreateDefaultViewStyle();

Expand Down Expand Up @@ -247,17 +250,15 @@ public LogWindow (ILogWindowCoordinator logWindowCoordinator, string fileName, b

filterComboBox.DropDownHeight = filterComboBox.ItemHeight * configManager.Settings.Preferences.MaximumFilterEntriesDisplayed;

// Keep Panel2 wide enough that "Show advanced..." (btnAdvanced, the rightmost left-anchored
// control) never overlaps the right-anchored filter-count label when the text filter grows.
filterSplitContainer.Panel2MinSize = FilterSplitterLayout.RequiredPanel2Width(btnAdvanced.Right, lblFilterCount.Width, FILTER_PANEL2_CONTROL_GAP);
LayoutFilterControls();
AutoResizeFilterBox();

filterRegexCheckBox.Checked = _filterParams.IsRegex;
filterCaseSensitiveCheckBox.Checked = _filterParams.IsCaseSensitive;
filterTailCheckBox.Checked = _filterParams.IsFilterTail;

splitContainerLogWindow.Panel2Collapsed = true;
advancedFilterSplitContainer.SplitterDistance = FILTER_ADVANCED_SPLITTER_DISTANCE;
SetAdvancedFilterSplitterDistance();

_timeShiftSyncTask = Task.Factory.StartNew(SyncTimestampDisplayWorker, _cts.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);
_tailFollowEngine = new TailFollowEngine(this);
Expand Down Expand Up @@ -724,6 +725,10 @@ protected override string GetPersistString ()
protected override void OnDpiChangedAfterParent (EventArgs e)
{
base.OnDpiChangedAfterParent(e);
LayoutFilterControls();
AutoResizeFilterBox();
SetFilterInputPanelHeight();
SetAdvancedFilterSplitterDistance();
ApplyMarkerPreferences();
}

Expand Down Expand Up @@ -877,6 +882,10 @@ private void OnLogWindowLoad (object sender, EventArgs e)
var lastColumnWidth = Preferences.LastColumnWidth;

PreferencesChanged(Preferences.Font, setLastColumnWidth, lastColumnWidth, true, SettingsFlags.GuiOrColors);
LayoutFilterControls();
AutoResizeFilterBox();
SetFilterInputPanelHeight();
SetAdvancedFilterSplitterDistance();
}

[SupportedOSPlatform("windows")]
Expand Down Expand Up @@ -2404,7 +2413,7 @@ private void OnFreeThisWindowFromTimeSyncToolStripMenuItemClick (object sender,
[SupportedOSPlatform("windows")]
private void OnSplitContainerSplitterMoved (object sender, SplitterEventArgs e)
{
advancedFilterSplitContainer.SplitterDistance = FILTER_ADVANCED_SPLITTER_DISTANCE;
SetAdvancedFilterSplitterDistance();
}

[SupportedOSPlatform("windows")]
Expand Down Expand Up @@ -5203,10 +5212,50 @@ private void ShowAdvancedFilterPanel (bool show)
}

advancedFilterSplitContainer.Panel1Collapsed = !show;
advancedFilterSplitContainer.SplitterDistance = FILTER_ADVANCED_SPLITTER_DISTANCE;
SetAdvancedFilterSplitterDistance();
_showAdvanced = show;
}

private void SetAdvancedFilterSplitterDistance ()
{
var contentBottom = pnlProFilter.Controls.Cast<Control>().Max(control => control.Bottom);
advancedFilterSplitContainer.SplitterDistance = pnlProFilter.Top + contentBottom + FILTER_ADVANCED_PANEL_BOTTOM_MARGIN;
}

private void SetFilterInputPanelHeight ()
{
var contentBottom = filterSplitContainer.Panel1.Controls.Cast<Control>()
.Concat(filterSplitContainer.Panel2.Controls.Cast<Control>())
.Max(control => control.Bottom);
pnlFilterInput.Height = contentBottom + FILTER_INPUT_PANEL_BOTTOM_MARGIN;
advancedBackPanel.Top = pnlFilterInput.Bottom;
}

private void LayoutFilterControls ()
{
// Keep gaps in screen pixels so high-DPI scaling enlarges controls, not empty space between them.
var gap = FILTER_PANEL2_CONTROL_GAP;
var nextLeft = btnfilterSearch.Right + gap;
lblTextFilter.AutoSize = true;
var filterComboBoxRight = filterComboBox.Right;
filterComboBox.Left = lblTextFilter.Right + gap;
filterComboBox.Width = filterComboBoxRight - filterComboBox.Left;
filterSplitContainer.Panel1MinSize = filterComboBox.Left + MINIMUM_FILTER_TEXT_BOX_WIDTH;

foreach (var checkBox in new[] { filterCaseSensitiveCheckBox, filterRegexCheckBox, filterTailCheckBox, syncFilterCheckBox })
{
checkBox.Left = nextLeft;
checkBox.Top = btnfilterSearch.Top + (btnfilterSearch.Height - checkBox.Height) / 2;
nextLeft = checkBox.Right + gap;
}

lblTextFilter.Top = filterCaseSensitiveCheckBox.Top + (filterCaseSensitiveCheckBox.Height - lblTextFilter.Height) / 2;
btnAdvanced.Left = nextLeft;

// Keep Panel2 wide enough that the rightmost left-anchored control never overlaps the filter-count label.
filterSplitContainer.Panel2MinSize = FilterSplitterLayout.RequiredPanel2Width(btnAdvanced.Right, lblFilterCount.Width, gap);
}

[SupportedOSPlatform("windows")]
private void CheckForAdvancedButtonDirty ()
{
Expand Down Expand Up @@ -8183,4 +8232,4 @@ public void RefreshLogView ()

/// <summary>Line navigation waiting for the load's first visibility scan.</summary>
private readonly record struct PendingNavigation (Action Navigate, bool IsTimeSyncFollow);
}
}
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.

6 changes: 0 additions & 6 deletions src/setup/GeneratedFiles.iss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Source: "{#ReleaseFolder}\LogExpert.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\LogExpert.PluginRegistry.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\LogExpert.Resources.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\LogExpert.UI.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\Microsoft.Win32.SystemEvents.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\NAudio.Asio.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\NAudio.Core.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\NAudio.dll"; DestDir: "{app}"; Flags: ignoreversion
Expand All @@ -29,12 +28,7 @@ Source: "{#ReleaseFolder}\Newtonsoft.Json.dll"; DestDir: "{app}"; Flags: ignorev
Source: "{#ReleaseFolder}\NLog.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\NuGet.Versioning.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\System.CommandLine.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\System.Drawing.Common.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\System.Formats.Nrbf.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\System.Numerics.Tensors.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\System.Private.Windows.Core.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\System.Private.Windows.GdiPlus.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\System.Resources.Extensions.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\Vanara.Core.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\Vanara.PInvoke.ComCtl32.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleaseFolder}\Vanara.PInvoke.Cryptography.dll"; DestDir: "{app}"; Flags: ignoreversion
Expand Down
Loading