Skip to content

Add F11 compact mode that hides menu, tabs, toolbar and status bar - #740

Closed
mfkeeq199458 wants to merge 4 commits into
LogExperts:Developmentfrom
mfkeeq199458:feature/f11-compact-mode
Closed

mfkeeq199458 wants to merge 4 commits into
LogExperts:Developmentfrom
mfkeeq199458:feature/f11-compact-mode

Conversation

@mfkeeq199458

Copy link
Copy Markdown
Contributor
  • 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

mfkeeq199458 and others added 2 commits October 22, 2026 14:09
- 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 Hirogen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 → LoadFromXml shows every document again.
    • The tab strip comes back while compact mode still thinks it is on.
    • _compactHiddenWindows no longer matches the windows on screen.
    • _bookmarkWindowHiddenForCompactMode stays set after DestroyBookmarkWindow / 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 Document when it is hidden again. A window that was floating before compact mode comes back docked.
  • ShowCompactModeWindow only 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.
  • RestoreWindowsHiddenForCompactMode shows 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 == CurrentLogWindow also 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, UpdateGuiState ran with the timestamp control forced off, so the timestamp drag control can stay hidden for a window that supports it.
  • _lastGuiStateSource is 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.
  • TabController already 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 under src/LogExpert.UI/Services/: TabController, ToolWindowCoordinator and MenuToolbarController. A CompactModeController there 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:

    • RestoreWindowsHiddenForCompactMode maps Hidden only.
    • ShowCompactModeWindow maps Hidden and Float.
    • ToolWindowCoordinator maps Hidden and Unknown.

    One shared helper would keep them consistent.

  • SwitchCompactModeTab repeats the next/previous index logic that _tabController.SwitchToNext/PreviousWindow already 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.resx doesn'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.

mfkeeq199458 and others added 2 commits October 23, 2026 00:37
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.
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