Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add One-Hand mice wheel scroll diff and merge #2435

Merged
merged 4 commits into from
Sep 17, 2024

Conversation

lededev
Copy link
Contributor

@lededev lededev commented Sep 17, 2024

The current version of WinMerge primarily supports two-handed operation. While toolbar buttons can be used with one hand, constantly shifting your gaze between the main text and the toolbar is inefficient. Some users, such as those with disabilities or those who have one hand occupied (e.g., during a phone call or while drinking), need to operate common functions efficiently with one hand.

This code introduces the following one-handed operations:

Hold the right mouse button and roll the mouse wheel up: equivalent to Alt+Up
Hold the right mouse button and roll the mouse wheel down: equivalent to Alt+Down
Hold the right mouse button and roll the mouse wheel left: equivalent to Alt+Left
Hold the right mouse button and roll the mouse wheel right: equivalent to Alt+Right

Note: If you have any global mouse stroke/gesture app running, add WinMergeU.exe to its ignore list for these shortcuts to take effect. Alternatively, you can use your global mouse gesture program to customize more functions and ignore this built-in feature.

For users who prefer using the left hand for the keyboard and the right hand for the mouse, the following shortcuts are added:

Alt + roll the mouse wheel up: equivalent to Alt+Up
Alt + roll the mouse wheel down: equivalent to Alt+Down
Alt + roll the mouse wheel left: equivalent to Alt+Left
Alt + roll the mouse wheel right: equivalent to Alt+Right
Ctrl + Alt + roll the mouse wheel left: equivalent to Ctrl+Alt+Left
Ctrl + Alt + roll the mouse wheel right: equivalent to Ctrl+Alt+Right

Additionally, for users whose mice lack horizontal scroll wheels, an alternative mode is provided:

Alt + Shift + scroll the mouse wheel up: equivalent to Alt+Left
Alt + Shift + scroll the mouse wheel down: equivalent to Alt+Right
Ctrl + Alt + Shift + scroll the mouse wheel up: equivalent to Ctrl+Alt+Left
Ctrl + Alt + Shift + scroll the mouse wheel down: equivalent to Ctrl+Alt+Right

User Tips: To keep the user interface and menus simple, these shortcuts are not added to the menu items. Only the floating tooltip text of the toolbar button shows these new shortcuts in multiple lines.

f20240917T174813

Language Translation Restrictions: The floating prompt text of the MFC CToolBar is limited to 256 UNICODE characters. Therefore, the translation context for these shortcut keys must be limited to this number of characters, as extra characters will be truncated and cannot be displayed. To reduce the number of words, you can use UNICODE characters such as emojis and direction symbols (⏬⏫🔼🔽▶️◀️) to replace text descriptions, as these symbols only take up one UNICODE character.

@sdottaka
Copy link
Member

Thank you for the PR.

I feel that the tooltip display is a little difficult to understand and has lost consistency with other displays. Would it be okay to delete some parts as shown below and modify it to include them in the manual instead?

Next Difference |Alt+Down\nRightButton+ScrollDown\nAlt+ScrollDown

Next Difference (Alt+Down / Right Button+Wheel Down)

@lededev
Copy link
Contributor Author

lededev commented Sep 17, 2024

@sdottaka 80 characters show all info in English is difficult. If you use ( 2 characters start, / 3 characters as delimiter. Text descripton need more shorten, less understand. And I find Merge.rc can not be UNICODE, must ANSI code.

STRINGTABLE
BEGIN
    ID_MICE_PREVDIFF        "\nPrevious Difference |Alt+Up\nRightButton+ScrollUp\nAlt+ScrollUp"
    ID_MICE_NEXTDIFF        "\nNext Difference |Alt+Down\nRightButton+ScrollDown\nAlt+ScrollDown"
    ID_MICE_L2R             "\nCopy to Right |Alt+Right\nRightBtn+ScrollRight\nAlt+ScrollR\nAlt+Shift+ScrollDn"
    ID_MICE_R2L             "\nCopy to Left |Alt+Left\nRightBtn+ScrollLeft\nAlt+ScrollLeft\nAlt+Shift+ScrollUp"
    ID_MICE_L2RNEXT         "\nCopy to Right and Advance |Ctrl+Alt+Right\nCtrl+Alt+ScrollR\nCtrl+Alt+Shift+SDn"
    ID_MICE_R2LNEXT         "\nCopy to Left and Advance |Ctrl+Alt+Left\nCtrl+Alt+ScrollL\nCtrl+Alt+Shift+SUp"
END

In Chinese, 80 characters is no problem using ( and / as delimiter, it has a greater information density.

msgid "\nPrevious Difference |Alt+Up\nRightButton+ScrollUp\nAlt+ScrollUp"
msgstr "\n上一处差异 (Alt+Up)\n(鼠标右键+滚轮上滚)\n(Alt+滚轮上滚)"

msgid "\nNext Difference |Alt+Down\nRightButton+ScrollDown\nAlt+ScrollDown"
msgstr "\n下一处差异 (Alt+Down)\n(鼠标右键+滚轮下滚)\n(Alt+滚轮下滚)"

msgid "\nCopy to Right |Alt+Right\nRightBtn+ScrollRight\nAlt+ScrollR\nAlt+Shift+ScrollDn"
msgstr "\n复制到右侧 (Alt+Right)\n(鼠标右键+滚轮右滚)\n(Alt+滚轮右滚)\n(Alt+Shift+滚轮下滚)"

msgid "\nCopy to Left |Alt+Left\nRightBtn+ScrollLeft\nAlt+ScrollLeft\nAlt+Shift+ScrollUp"
msgstr "\n复制到左侧 (Alt+Left)\n(鼠标右键+滚轮左滚)\n(Alt+滚轮左滚)\n(Alt+Shift+滚轮上滚)"

msgid "\nCopy to Right and Advance |Ctrl+Alt+Right\nCtrl+Alt+ScrollR\nCtrl+Alt+Shift+SDn"
msgstr "\n复制到右侧再到下一处差异 (Ctrl+Alt+Right)\n(Ctrl+Alt+滚轮右滚)\n(Ctrl+Alt+Shift+滚轮下滚)"

msgid "\nCopy to Left and Advance |Ctrl+Alt+Left\nCtrl+Alt+ScrollL\nCtrl+Alt+Shift+SUp"
msgstr "\n复制到左侧再到下一处差异 (Ctrl+Alt+Left)\n(Ctrl+Alt+滚轮左滚)\n(Ctrl+Alt+Shift+滚轮上滚)"

image
So in English the trade-off was between reducing the text description or reducing the separators, and I chose the latter.

@lededev
Copy link
Contributor Author

lededev commented Sep 17, 2024

If there is someone can rewrite the MFC/ATL CommCtrl.h szText 80 UNICODE characters limit, or a reimpliment tooltips class, without 80 UNICODE characters limit, it will be easy to show full usage information in all Languages.

typedef struct tagNMTTDISPINFOW {
    NMHDR hdr;
    LPWSTR lpszText;
    WCHAR szText[80];
    HINSTANCE hinst;
    UINT uFlags;
    LPARAM lParam;
} NMTTDISPINFOW, *LPNMTTDISPINFOW;

@lededev
Copy link
Contributor Author

lededev commented Sep 17, 2024

English 78 chars, with only \n 1 char as separator. If use / 3 chars as separator, you need shorten text.
image

@lededev
Copy link
Contributor Author

lededev commented Sep 17, 2024

I am not English user, it is OK to me reduce tooltip information, for a better display layout, anyway, in Chinese it can fully presented.
You may change them to any form you like.

@lededev
Copy link
Contributor Author

lededev commented Sep 17, 2024

I use smart pointer extend tooltip text length from 80 to 256 characters. Now all Languages have enough length.
image

@sdottaka sdottaka merged commit 23f72ad into WinMerge:master Sep 17, 2024
3 checks passed
@sdottaka
Copy link
Member

For simplicity's sake, I wanted to have just two displays, one for keyboard operations and one for mouse operations, but I merged them for now.

This added operation doesn't work in the folder comparison window, image comparison window, etc., so later I may change the tooltip display depending on the active window.

@sdottaka sdottaka added this to the v2.16.43 milestone Sep 17, 2024
@lededev
Copy link
Contributor Author

lededev commented Sep 17, 2024

OK, I suggest providing complete usage information in at least one place on the software, because I've noticed that very few Windows users read the manual.

sdottaka added a commit that referenced this pull request Sep 17, 2024
sdottaka added a commit that referenced this pull request Sep 18, 2024
sdottaka added a commit that referenced this pull request Oct 8, 2024
…Down and other commands now work not only in the editor but also in other windows.
sdottaka added a commit that referenced this pull request Oct 12, 2024
sdottaka added a commit that referenced this pull request Oct 12, 2024
sdottaka added a commit that referenced this pull request Oct 13, 2024
lededev pushed a commit to lededev/winmerge that referenced this pull request Oct 13, 2024
lededev pushed a commit to lededev/winmerge that referenced this pull request Oct 13, 2024
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