Skip to content

Open view: collapsible recent comparison list - #3673

Open
regular-hopper-user wants to merge 2 commits into
WinMerge:masterfrom
regular-hopper-user:pr/recent-comparison-view
Open

regular-hopper-user wants to merge 2 commits into
WinMerge:masterfrom
regular-hopper-user:pr/recent-comparison-view

Conversation

@regular-hopper-user

Copy link
Copy Markdown
Contributor

Summary

Builds on #3663: its commit is included here until that PR is merged. Only the last commit ("Open view: collapsible recent comparison list") belongs to this PR.

The Select Files or Folders view gets a "Show recent comparisons" check box next to Save Project. Checked, the recent comparisons (MruHelper::GetRecentCompares: the jump list where Windows keeps its history, otherwise WinMerge's own list) appear in a list between the buttons and the status line, so Compare and Cancel stay where they are. Unchecked, which is the default, the view keeps its current size.

  • Columns: comparison name and its command line parameters (shown as stored, so filling the list never touches the file system). Up to Settings/RecentCompareMax entries.
  • Enter or double-click opens the selected comparison with its original options (CMainFrame::OpenRecentCompare, now also used by File > Recent Files or Folders).
  • The list is refreshed when the view becomes active.
  • The expanded state is kept in Settings/ShowRecentCompares (default off).
  • The status line is not in the dynamic layout, so expanding moves it down by the list height and collapsing moves it back; width changes keep working through the dynamic layout.
  • Control IDs 1698 and 1699 (1696 and 1697 are used in File compare: options for ignored changes, missing lines and cursor display #3664).

The new strings are not in the translation files yet.

Testing

x64 Release build, isolated instance (/inifile, registry unchanged):

  1. start without arguments: collapsed, view size and button positions as before
  2. check the box: a list with 2 rows below the buttons, status line moved down, Compare unchanged; widening the window keeps the layout
  3. double-click a row: that comparison opens; the expanded state is kept after a restart
  4. Enter on a selected row: that comparison opens
  5. uncheck the box: the view is back to the collapsed size
  6. frame made narrower while expanded: the list follows the width, the status line stays below it

File > Recent Files or Folders is filled from the Windows jump list
(IApplicationDocumentLists). Windows keeps no jump list history before
Windows 7, when the user has turned off "Show recently opened items"
(Start_TrackDocs=0) or when the NoRecentDocsHistory policy is set. The menu
then stays empty and there is no way to reopen a previous comparison.

- JumpList::IsRecentDocsTrackingEnabled() tells whether Windows keeps the
  history. It is read each time, so a changed Windows setting applies at
  once.
- Where Windows keeps the history nothing changes: the menu uses the jump
  list and WinMerge stores nothing.
- Otherwise WinMerge stores the recent comparisons itself and the menu reads
  them. Entries are added where the jump list entry is created
  (AddToRecentDocs), so every comparison type is recorded.
- Storage (profile section "Recent Compare List"): one value per comparison,
  named after a hash of its command line parameters and holding
  "<last opened time><TAB><title><TAB><parameters>". Adding a comparison
  writes only its own value (opening it again updates the time), and the
  list is always read from the registry or ini file, not from the options
  loaded in the process. So several WinMerge instances never overwrite each
  other's entries, and no half-written state can empty the list. Only the
  oldest entries beyond the maximum are removed.
- New COptionsMgr::ReadStoredSection() reads the string values of a section
  from the registry (CRegOptionsMgr) or the ini file (CIniOptionsMgr) after
  the pending writes of the process.
- New option Settings/RecentCompareMax (default 20, 0-128).
- The menu shows at most as many items as its command ID range
  (ID_MRU_FIRST..ID_MRU_LAST) allows; Settings/MRUMax allows more.
- Options > Shell "Clear all recent items" also clears the own list.
The Select Files or Folders view gets a "Show recent comparisons" check box
next to Save Project. Checked, a list of the recent comparisons
(MruHelper::GetRecentCompares: the Windows jump list or WinMerge's own list)
appears between the buttons and the status line, so Compare and Cancel stay
where they are. Unchecked (the default), the view keeps its previous size.

- Columns: comparison name and its command line parameters (the paths and
  options it was opened with, shown as stored, so filling the list never
  touches the file system). Up to Settings/RecentCompareMax entries.
- Enter or double-click opens the selected comparison with its original
  options (CMainFrame::OpenRecentCompare, now also used by File > Recent
  Files or Folders).
- The list is refreshed when the view becomes active.
- The expanded state is kept in Settings/ShowRecentCompares (default off).
- The status line is not in the dynamic layout, so expanding moves it down
  by the list height and collapsing moves it back; width changes keep working
  through the dynamic layout.

Builds on "Keep an own recent comparison list where the jump list keeps no
history".
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.

1 participant