Repository navigation
Add F11 compact mode that hides menu, tabs, toolbar and status bar - #740
mfkeeq199458 wants to merge 4 commits into
Conversation
mfkeeq199458
commented
Oct 22, 2026
- F11 toggles compact mode and ESC leaves it; the title bar stays visible so the window remains draggable
- Inactive log windows are hidden and restored by their remembered dock state
- The bookmark tool window is hidden and restored through IToolWindowCoordinator
- GuiState updates are only replayed while the source window is still the current one
- Includes the en/zh resource strings for the new menu item
- F11 toggles compact mode and ESC leaves it; the title bar stays visible so the window remains draggable - Inactive log windows are hidden and restored by their remembered dock state - The bookmark tool window is hidden and restored through IToolWindowCoordinator - GuiState updates are only replayed while the source window is still the current one - Includes the en/zh resource strings for the new menu item
Hirogen
left a comment
There was a problem hiding this comment.
Review
Thanks for this, compact mode is a nice addition. The basic toggle works: F11 and ESC are handled in ProcessCmdKey, so they work whatever has focus, and the toolbar and status bar go back to how they were before. There are a few problems around sessions and dock state, plus some changes that affect normal mode, that I'd like fixed before merging.
Bugs
Sessions while in compact mode
- Saving a session in compact mode writes the hidden log windows and the bookmark window as
DockState.Hidden. When that session is loaded later, those tabs come back hidden. - Loading a session in compact mode:
RestoreLayout→LoadFromXmlshows every document again.- The tab strip comes back while compact mode still thinks it is on.
_compactHiddenWindowsno longer matches the windows on screen._bookmarkWindowHiddenForCompactModestays set afterDestroyBookmarkWindow/InitToolWindows. So leaving compact mode shows the new bookmark window whatever the loaded layout said.
The simplest fix is to leave compact mode before saving or loading a session, the same way FormClosing already does.
Dock state restore
- After Ctrl+Tab to a window, its remembered dock state is replaced with
Documentwhen it is hidden again. A window that was floating before compact mode comes back docked. ShowCompactModeWindowonly maps Hidden and Float to Document. A window set to auto-hide stays collapsed while the current document is hidden, which leaves the document area empty.RestoreWindowsHiddenForCompactModeshows the windows again in the order they were hidden. That will probably change the tab order after leaving compact mode.
GuiState replay
_lastGuiStateSource == null || _lastGuiStateSource == CurrentLogWindowalso replays a state when the sender is unknown, which goes against the rule in the description.- When the replay is skipped, nothing recalculates the toolbar. While in compact mode,
UpdateGuiStateran with the timestamp control forced off, so the timestamp drag control can stay hidden for a window that supports it. _lastGuiStateSourceis never cleared when a window closes, so a closed LogWindow stays referenced until the next GUI state update.
Changes outside compact mode
"Close other tabs" and "Save session" now use GetAllWindows().Where(w => w.DockState != DockState.Unknown) instead of GetAllWindowsFromDockPanel(). That changes how they behave in normal mode too, and the description doesn't mention it. If it's needed, please explain why in the description. Otherwise please revert it.
- The same filter, with nearly the same comment, appears in both handlers. If it stays, it belongs on
TabController. TabControlleralready has a close-all-except-one method, so the handler duplicates that as well.
Structure
-
About 280 lines of compact-mode state and logic go straight into
LogTabWindow. The rest of this behaviour already sits in services undersrc/LogExpert.UI/Services/:TabController,ToolWindowCoordinatorandMenuToolbarController. ACompactModeControllerthere would fit, and it could be tested. -
The
_compact*fields always travel together: mode, status strip and toolbar visibility, document style, and hidden windows. A small state type would hold them. -
The "Hidden → Document" dock-state mapping appears three times, each with different rules:
RestoreWindowsHiddenForCompactModemaps Hidden only.ShowCompactModeWindowmaps Hidden and Float.ToolWindowCoordinatormaps Hidden and Unknown.
One shared helper would keep them consistent.
-
SwitchCompactModeTabrepeats the next/previous index logic that_tabController.SwitchToNext/PreviousWindowalready has.
Tests
There are no tests. ToolWindowCoordinatorTests and TabControllerTests already exist in src/LogExpert.UI.Tests/Services/. Please at least cover HideForCompactMode / RestoreAfterCompactMode and the close-other-tabs / save-session change.
Smaller points
Resources.de.resxdoesn't have the two new keys, so German users see English text.- The tooltip in the designer ends with "Leave with ESC." but the resx value has no full stop.
_logger.Error("…" + ex.Message, ex)builds the message by joining strings. The rest of the file uses_logger.Error(ex, "…").- In compact mode, ESC is used to leave compact mode before the log window sees it, so ESC can't cancel a search there. That seems like an acceptable trade-off; just noting it.
- ESC only works when the main form has focus. It does nothing from a floating window.
Leave compact mode before a session is saved or loaded: written from inside the mode, the layout recorded the hidden log windows and the bookmark window as DockState.Hidden, and loading it showed every document again while the mode still believed it was on. Snapshot the dock states on entry and never refresh them while the mode is active. A float shown temporarily in the document area comes back as a float, and an auto-hide window is displayed in the document area instead of staying collapsed with an empty pane. Reset the bookmark window's compact-mode flag when the tool window is created or destroyed, so a session load that recreates it does not resurrect the old state. Replay the last GUI state only while it came from the active window, and ask the current window to publish its state again otherwise, so the timestamp control does not stay hidden. Drop the source reference when a window closes. Session save and "close other tabs" now query TabController.GetPlacedWindows() instead of GetAllWindowsFromDockPanel(). The latter only enumerates a pane's DisplayingContents, so a window hidden with Control.Hide() drops out of it (3 -> 2 after Hide()), which dropped hidden files from saved sessions and left hidden tabs open on "close other tabs". Placed windows are the tracked windows whose DockState is not Unknown; a window a layout restore has not placed yet stays excluded. Move the compact-mode state and transitions into CompactModeController under Services/, with the dock-state rules in CompactDockStates, and cover them with tests next to the existing service tests.