Repository navigation
Conversation
A clip can be pinned (never auto deleted) again by clicking the pin button that shows up on the hovered row. It uses the slot the never-auto-delete star has always been drawn in, so a pinned clip shows one solid star and the text does not move; the pin is drawn faded while it is only offered by the hover. Clicking it writes lDontAutoDelete through SetClipPinned, the symbol text of a row comes from the shared GetRowSymbols.
A row has one height for every clip, so text longer than a single line was cut off at the right. The text now wraps to fill the lines the row height covers and is clipped at the bottom; a clip that needs fewer lines stays vertically centered like before. The text is also kept inside the part of the row that is really visible, the strip the list holds for its scroll bar is not part of it.
The entry that deletes every clip that is not pinned looked like the harmless entries next to it. Windows draws its menus itself and cannot color a single entry, so this one is switched to owner draw and painted by the app with the menu font and the system colors windows uses for the entries around it. The text still comes from the language file. A menu that holds an owner drawn entry is drawn by Windows the classic way, so this menu no longer follows the modern style.
This branch has not been deployed
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.
Three small usability changes to the quick paste window, in three commits on top of
a80fd35.Summary
f2da01e7457d437ac0162No new dependencies, no new settings, no resource or language file changes. All of it is Win32 / MFC code in
src.1. Pin button (
f2da01e)Clicking the pin button of the hovered row pins the clip (never auto deleted), clicking it again unpins it. Nothing else about the row changes.
opacityargument onCGdiImageDrawer::Draw(GDI+ color matrix).CQPasteWnd::PreTranslateMessagebefore the list sees it, and the matchingWM_LBUTTONUPis swallowed, so the action configured for "click on a clip" does not run. The hit test uses the button rectangle recorded while that row was painted.lDontAutoDeleteis written throughSetClipPinned, so the state survives a restart. Pinning is the existing mechanism - no new column, no schema change.GetRowSymbols, used by both the list painting andGetDispInfo, which had the same logic copied in two places.2. Clip text wraps inside the row (
7457d43)A list view has one height for every row, so text longer than one line used to be cut off at the right. The text now wraps (
DT_WORDBREAK) to fill the lines the row height already covers, and is clipped at the bottom when it needs more. A clip that needs fewer lines than the row has is measured withDT_CALCRECTand stays vertically centered, exactly as before.The visible width of the text is also limited to the part of the row that really belongs to the list - the strip the list keeps for its scroll bar is inside the client rectangle but is not part of the list, so text no longer runs under it (
CQListCtrl::GetVisibleRight).How many lines are shown is decided by the existing "Text lines per clip" setting, which is what sizes the rows.
3. Red warning on the delete-all-clips entry (
7ac0162)The entry that permanently deletes every clip that is not pinned looked exactly like the harmless entries next to it. Windows draws its menus itself and cannot color a single entry, so this one entry is switched to owner draw and painted by the application:
COLOR_MENU, selectionCOLOR_HIGHLIGHT, selected textCOLOR_HIGHLIGHTTEXT, disabled textCOLOR_GRAYTEXT, unselected textRGB(200, 0, 0)- the system colors Windows uses for the entries around it, and the menu font fromSPI_GETNONCLIENTMETRICS.UpdateRightClickMenu, so the language files stay untouched.WM_DRAWITEM/WM_MEASUREITEMare forwarded to the base class for anything that is notODT_MENU, which keeps the existing MFC list reflection (row height messages) working.Reviewer note - the one visible side effect: a menu that contains an owner drawn entry is drawn by Windows in the classic style, so this menu (the "Menu" button in the lower right of the quick paste window) no longer follows the modern style: its rows, indents and background change. That affects only this menu - the right click menu and the tray menu are untouched. It is a Windows behavior and cannot be avoided while that single entry is colored. If that is not acceptable, the entry has to stay in the regular color.
The other thing that used to exist in the popup - "delete clips that are not pinned" - already has an entry there (
DeleteNonUsedClips), so this PR only marks it as dangerous and adds no code for it.Testing
msbuild CP_Main_10.sln /p:Configuration=Release /p:Platform=x64(what CI runs); each of the three commits builds on its own.COLOR_MENU.Known limitations