Remember the splitter position in image compare - #39
Merged
Merged
Conversation
CalcChildImgWindowRect() rebuilt an equal split on every layout, so a dragged splitter was lost on the next WM_SIZE. Store the position in CImgMergeWindow and consult it when laying out two panes. m_splitterPosition holds the size of whichever pane is smaller, signed: positive anchors the first pane to the near edge, negative anchors the second to the far edge. This keeps a narrow pane narrow on either side of the splitter when the window is resized. Expose it through IImgMergeWindow so a host can persist it. The new methods are appended so the existing vtable order is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Member
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs WinMerge/winmerge#3591
CalcChildImgWindowRect()rebuilds an equal split on every layout, so a dragged splitter is discarded on the nextWM_SIZE. This stores the position inCImgMergeWindowand consults it when laying out two panes.m_splitterPositionholds the size of whichever pane is smaller, signed: positive sizes the first pane from the near edge, negative sizes the second from the far edge. Anchoring the first pane unconditionally would preserve a narrow strip only on the left; a narrow right-hand pane would grow on resize.CalcSplitterPosition()reproduces the boundsMoveSplitter()already enforces, so a restored layout equals the dragged one. The clamp is returned rather than written back, because the window is laid out once during creation before it has its final size. Windows too small to give both panes 32px fall back to the equal split.SetHorizontalSplit()clears the value when the orientation changes, so a width is never applied as a height.Two panes only; three-pane compare is unchanged.
GetSplitterPosition()/SetSplitterPosition()are appended toIImgMergeWindow, leaving the existing vtable order unchanged.Alternatives, if you would prefer them: a fraction of the window instead of pixels; anchoring the first pane instead of the smaller one; a per-orientation pair of values instead of clearing on toggle; a position per splitter for three-pane.
Built and tested on Windows 11 x64, VS Build Tools 2026, Release, in both the standalone app and a WinMerge build carrying the matching options change. Position kept across resize, maximize/restore, reopening a comparison and restart, with the narrow pane on either side. Default centred layout is unchanged when the splitter has never been dragged. 32px minimum kept.