Skip to content

Conversation

@Hirogen
Copy link
Collaborator

@Hirogen Hirogen commented Jan 16, 2026

This pull request refactors the tab management logic in the LogTabWindow class to use a new TabController abstraction, replacing direct manipulation of the _logWindowList and dockPanel contents. This change centralizes tab/window operations, simplifies event handling, and improves code maintainability. Additionally, extension methods for clipboard text formatting have been moved and modernized.

Tab management refactor:

  • Introduced a TabController to handle all tab/window operations in LogTabWindow, replacing direct use of _logWindowList and dockPanel.Contents. All window addition, removal, activation, and iteration now go through TabController. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]
  • Added event handler methods (OnTabControllerWindowAdded, OnTabControllerWindowRemoved, OnTabControllerWindowActivated, OnTabControllerWindowClosing) to respond to tab/window events, improving separation of concerns and encapsulation.

Code cleanup and modernization:

  • Removed the obsolete _logWindowList and related locking logic throughout LogTabWindow, simplifying window tracking and concurrency management. [1] [2] [3] [4] [5] [6] [7]
  • Updated methods such as SwitchTab, SelectTab, GetListOfOpenFiles, SaveLastOpenFilesList, FindWindowForFile, and RemoveLogWindow to use the new TabController API. [1] [2] [3] [4] [5] [6]

Extension methods update:

  • Moved ToClipBoardText extension methods for ILogLine and ILogLineMemory from LogLineExtensions.cs to a new Extensions.cs file, using the new C# extension syntax and namespace. [1] [2]

Minor code improvements:

  • Added and updated comments/documentation for several methods to clarify their purpose and usage. [1] [2] [3]
  • Minor formatting and whitespace adjustments in various files for readability. [1] [2] [3]

These changes make tab/window management more robust and maintainable, and modernize extension method usage.

_ = BeginInvoke(new SetTabIconDelegate(SetTabIcon), logWindow, icon);
}
var data = logWindow.Tag as LogWindowData;
var icon = GetLedIcon(data.LedState.DiffSum, data);
private void OnTabControllerWindowActivated (object sender, WindowActivatedEventArgs e)
{
var newWindow = e.Window;
var previousWindow = e.PreviousWindow;
{
lock (_logWindowList)
var logWindow = e.Window;
var title = e.Title;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants