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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 42 additions & 3 deletions Src/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2649,18 +2649,57 @@ BOOL CMainFrame::OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult)

if (nID != 0) // will be zero on a separator
{
// check replace mice scrolling multiline tooltips
const static std::unordered_map<UINT, UINT> miceShortcut =
{
{ID_PREVDIFF, ID_MICE_PREVDIFF}
,{ID_NEXTDIFF, ID_MICE_NEXTDIFF}
,{ID_L2R, ID_MICE_L2R}
,{ID_R2L, ID_MICE_R2L}
,{ID_L2RNEXT, ID_MICE_L2RNEXT}
,{ID_R2LNEXT, ID_MICE_R2LNEXT}
};
auto mID = miceShortcut.find(nID);
if (mID != miceShortcut.end())
{
nID = mID->second;

static bool firstCall = true;
if (firstCall)
{
firstCall = false;
// Setup multiline tooltips
LONG_PTR dwStyle = ::GetWindowLongPtr(pNMHDR->hwndFrom, GWL_EXSTYLE);
dwStyle |= TTS_NOPREFIX;
::SetWindowLongPtr(pNMHDR->hwndFrom, GWL_EXSTYLE, dwStyle);
::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 1024);
}
}

strFullText = theApp.LoadString(static_cast<UINT>(nID));
// don't handle the message if no string resource found
if (strFullText.empty())
return FALSE;

// this is the command id, not the button index
AfxExtractSubString(strTipText, strFullText.c_str(), 1, '\n');
// skip first position of newline character, accept multiline
const auto newline1st = strFullText.find(_T("\n"));
if (newline1st == String::npos)
return FALSE;
strTipText = strFullText.substr(newline1st + 1).c_str();
}
if (pNMHDR->code == TTN_NEEDTEXTA)
_wcstombsz(pTTTA->szText, strTipText, static_cast<ULONG>(std::size(pTTTA->szText)));
{
m_upszLongTextA.reset(new CHAR[256]);
pTTTA->lpszText = m_upszLongTextA.get();
_wcstombsz(pTTTA->lpszText, strTipText, 256);
}
else
lstrcpyn(pTTTW->szText, strTipText, static_cast<int>(std::size(pTTTW->szText)));
{
m_upszLongTextW.reset(new WCHAR[256]);
pTTTW->lpszText = m_upszLongTextW.get();
lstrcpyn(pTTTW->lpszText, strTipText, 256);
}
*pResult = 0;

// bring the tooltip window above other popup windows
Expand Down
2 changes: 2 additions & 0 deletions Src/MainFrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,4 +446,6 @@ class CMainFrame : public CMDIFrameWnd
void LoadToolbarImages();
HMENU NewMenu( int view, int ID );
bool CompareFilesIfFilesAreLarge(IDirDoc* pDirDoc, int nFiles, const FileLocation ifileloc[]);
std::unique_ptr<WCHAR[]> m_upszLongTextW;
std::unique_ptr<CHAR[]> m_upszLongTextA;
};
12 changes: 11 additions & 1 deletion Src/Merge.rc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Microsoft Visual C++ generated resource script.
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

Expand Down Expand Up @@ -4520,6 +4520,16 @@ BEGIN
IDS_COPY_GRANULARITY_Character "Character"
END

STRINGTABLE
BEGIN
ID_MICE_PREVDIFF "\nPrevious Difference (Alt+Up)\n(Right Button+Wheel Up)\n(Alt+Wheel Up)"
ID_MICE_NEXTDIFF "\nNext Difference (Alt+Down)\n(Right Button+Wheel Down)\n(Alt+Wheel Down)"
ID_MICE_L2R "\nCopy to Right (Alt+Right)\n(Right Button+Wheel Right)\n(Alt+Wheel Right\nAlt+Shift+Wheel Down"
ID_MICE_R2L "\nCopy to Left (Alt+Left)\n(Right Button+Wheel Left\n(Alt+Wheel Left)\n(Alt+Shift+Wheel Up)"
ID_MICE_L2RNEXT "\nCopy to Right and Advance (Ctrl+Alt+Right)\n(Ctrl+Alt+Wheel Right)\n(Ctrl+Alt+Shift+Wheel Down)"
ID_MICE_R2LNEXT "\nCopy to Left and Advance (Ctrl+Alt+Left)\n(Ctrl+Alt+Wheel Left)\n(Ctrl+Alt+Shift+Wheel Up)"
END

#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion Src/MergeAppLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


/* File created by MIDL compiler version 8.01.0628 */
/* at Tue Jan 19 12:14:07 2038
/* at Tue Jan 19 11:14:07 2038
*/
/* Compiler settings for MergeAppLib.idl:
Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0628
Expand Down
133 changes: 133 additions & 0 deletions Src/MergeEditView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ IMPLEMENT_DYNCREATE(CMergeEditView, CCrystalEditViewEx)

CMergeEditView::CMergeEditView()
: m_bCurrentLineIsDiff(false)
, m_bIgnoreRBUp(false)
, m_nThisPane(0)
, m_nThisGroup(0)
, m_bDetailView(false)
Expand Down Expand Up @@ -2881,6 +2882,12 @@ void CMergeEditView::OnUpdateEditReplace(CCmdUI* pCmdUI)
*/
void CMergeEditView::OnContextMenu(CWnd* pWnd, CPoint point)
{
if (m_bIgnoreRBUp)
{
m_bIgnoreRBUp = false;
return;
}

CRect rect;
GetClientRect(rect);
ClientToScreen(rect);
Expand Down Expand Up @@ -4264,6 +4271,77 @@ void CMergeEditView::OnUpdateChangeScheme(CCmdUI* pCmdUI)
*/
BOOL CMergeEditView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
if (GetKeyState(VK_MENU) & 0x8000)
{
// When hold Alt key, use nFlags to check MK_CONTROL MK_SHIFT holding got problem, Use GetKeyState() instead.
const auto bShiftDown = GetKeyState(VK_SHIFT) & 0x8000;
const auto bControlDown = GetKeyState(VK_CONTROL) & 0x8000;
// zDelta > 0 scrool up, < 0 scrool down
if (zDelta > 0)
{
// Check Shift key hold for mice without HWheel function
if (bShiftDown && bControlDown)
{
// Alt+Ctrl+Shift+ScrollUp as Alt+Ctrl+Left
OnR2LNext();
return TRUE;
}
else if (bShiftDown)
{
// Alt+Shift+ScrollUp as Alt+Left
OnR2l();
return TRUE;
}
else if (nFlags == 0)
{
// Alt+ScrollUp as Alt+Up
OnPrevdiff();
return TRUE;
}
}
else if (zDelta < 0)
{
// Check Shift key hold for mice without HWheel function
if (bShiftDown && bControlDown)
{
// Alt+Ctrl+Shift+ScrollDown as Alt+Ctrl+Right
OnL2RNext();
return TRUE;
}
else if (bShiftDown)
{
// Alt+Shift+ScrollDown as Alt+Right
OnL2r();
return TRUE;
}
else if (nFlags == 0)
{
// Alt+ScrollDown as Alt+Down
OnNextdiff();
return TRUE;
}
}
}

// Hold mice right button for One-handed operation
if (nFlags == MK_RBUTTON)
{
if (zDelta > 0)
{
// RButton+ScrollUp as Alt+Up
OnPrevdiff();
m_bIgnoreRBUp = true;
return TRUE;
}
else if (zDelta < 0)
{
// RButton+ScrollDown as Alt+Down
OnNextdiff();
m_bIgnoreRBUp = true;
return TRUE;
}
}

if ( nFlags == MK_CONTROL )
{
short amount = zDelta < 0 ? -1: 1;
Expand Down Expand Up @@ -4302,6 +4380,61 @@ BOOL CMergeEditView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
*/
void CMergeEditView::OnMouseHWheel(UINT nFlags, short zDelta, CPoint pt)
{
if (GetKeyState(VK_MENU) & 0x8000)
{
const auto bControlDown = GetKeyState(VK_CONTROL) & 0x8000;
// zDelta > 0 scrool right, < 0 scrool left
if (zDelta > 0)
{
if (bControlDown)
{
// Alt+Ctrl+HScrollRight as Alt+Ctrl+Right
OnL2RNext();
return;
}
else if (nFlags == 0)
{
// Alt+HScrollRight as Alt+Right
OnL2r();
return;
}
}
else if (zDelta < 0)
{
if (bControlDown)
{
// Alt+Ctrl+HScrollLeft as Alt+Ctrl+Left
OnR2LNext();
return;
}
else if (nFlags == 0)
{
// Alt+HScrollLeft as Alt+Left
OnR2l();
return;
}
}
}

// Hold mice right button for One-handed operation
if (nFlags == MK_RBUTTON)
{
if (zDelta > 0)
{
// RButton+ScrollRight as Alt+Right
OnL2r();
m_bIgnoreRBUp = true;
return;
}
else if (zDelta < 0)
{
// RButton+ScrollLeft as Alt+Left
OnR2l();
m_bIgnoreRBUp = true;
return;
}
}

SCROLLINFO si = { sizeof SCROLLINFO };
si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;

Expand Down
1 change: 1 addition & 0 deletions Src/MergeEditView.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class CMergeEditView : public CGhostTextView
COLORSETTINGS m_cachedColors; /**< Cached color settings */

bool m_bCurrentLineIsDiff; /**< `true` if cursor is in diff line */
bool m_bIgnoreRBUp;

// Attributes
public:
Expand Down
6 changes: 6 additions & 0 deletions Src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -1022,9 +1022,15 @@
#define ID_COPY_LINES_FROM_RIGHT 33264
#define ID_LINES_L2R 33265
#define ID_LINES_R2L 33266
#define ID_MICE_PREVDIFF 33267
#define ID_MICE_NEXTDIFF 33268
#define ID_MICE_L2R 33269
#define ID_MICE_R2L 33270
#define ID_SEL_DIFF_COPY_L 33271
#define ID_SEL_DIFF_COPY_M 33272
#define ID_SEL_DIFF_COPY_R 33273
#define ID_MICE_L2RNEXT 33274
#define ID_MICE_R2LNEXT 33275
#define ID_TABBAR_AUTO_MAXWIDTH 33351
#define ID_IMG_VIEWDIFFERENCES 33353
#define ID_IMG_ZOOM_25 33354
Expand Down
78 changes: 39 additions & 39 deletions Translations/TranslationsStatus.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
# Translations Status

Status from **2024-09-15**:
Status from **2024-09-18**:

## WinMerge

| Language | Total | Translated | Fuzzy | Untranslated | Complete | Last Update |
|:---------------------|------:|-----------:|------:|-------------:|---------:|:-----------:|
| Arabic | 1395 | 895 | 0 | 500 | 64 % | 2019-12-30 |
| Basque | 1395 | 638 | 0 | 757 | 45 % | 2013-02-03 |
| Brazilian | 1395 | 1392 | 0 | 3 | 99 % | 2024-07-30 |
| Bulgarian | 1395 | 1078 | 0 | 317 | 77 % | 2023-11-14 |
| Catalan | 1395 | 1328 | 0 | 67 | 95 % | |
| ChineseSimplified | 1395 | 1392 | 0 | 3 | 99 % | |
| ChineseTraditional | 1395 | 1293 | 0 | 102 | 92 % | 2022-02-19 |
| Corsican | 1395 | 1389 | 0 | 6 | 99 % | 2024-06-21 |
| Croatian | 1395 | 630 | 1 | 764 | 45 % | 2009-02-13 |
| Czech | 1395 | 605 | 0 | 790 | 43 % | |
| Danish | 1395 | 639 | 0 | 756 | 45 % | 2013-01-13 |
| Dutch | 1395 | 1280 | 0 | 115 | 91 % | 2023-05-02 |
| English | 1395 | 1395 | 0 | 0 | 100 % | 2024-09-15 |
| Finnish | 1395 | 1185 | 0 | 210 | 84 % | |
| French | 1395 | 1392 | 0 | 3 | 99 % | 2024-08-01 |
| Galician | 1395 | 1317 | 0 | 78 | 94 % | 2023-11-24 |
| German | 1395 | 1342 | 0 | 53 | 96 % | 2023-08-08 |
| Greek | 1395 | 605 | 0 | 790 | 43 % | |
| Hungarian | 1395 | 1392 | 0 | 3 | 99 % | 2021-03-15 |
| Italian | 1395 | 1392 | 0 | 3 | 99 % | 2024-07-27 |
| Japanese | 1395 | 1392 | 0 | 3 | 99 % | 2024-07-27 |
| Korean | 1395 | 1392 | 0 | 3 | 99 % | 2024-09-13 |
| Lithuanian | 1395 | 1343 | 0 | 52 | 96 % | 2024-07-24 |
| Norwegian | 1395 | 730 | 0 | 665 | 52 % | |
| Persian | 1395 | 641 | 0 | 754 | 45 % | 2013-08-15 |
| Polish | 1395 | 1355 | 0 | 40 | 97 % | 2023-11-28 |
| Portuguese | 1395 | 1392 | 0 | 3 | 99 % | 2024-08-17 |
| Romanian | 1395 | 1306 | 0 | 89 | 93 % | 2023-11-07 |
| Russian | 1395 | 1318 | 0 | 77 | 94 % | 2023-04-27 |
| Serbian | 1395 | 632 | 0 | 763 | 45 % | |
| Sinhala | 1395 | 563 | 58 | 774 | 44 % | 2010-12-12 |
| Slovak | 1395 | 1184 | 0 | 211 | 84 % | 2022-02-17 |
| Slovenian | 1395 | 1320 | 0 | 75 | 94 % | 2024-01-28 |
| Spanish | 1395 | 1317 | 0 | 78 | 94 % | 2023-11-24 |
| Swedish | 1395 | 1232 | 2 | 161 | 88 % | 2023-02-08 |
| Tamil | 1395 | 1218 | 0 | 177 | 87 % | 2023-07-24 |
| Turkish | 1395 | 1326 | 0 | 69 | 95 % | 2023-10-28 |
| Ukrainian | 1395 | 708 | 0 | 687 | 50 % | 2009-06-13 |
| Arabic | 1401 | 895 | 0 | 506 | 63 % | 2019-12-30 |
| Basque | 1401 | 638 | 0 | 763 | 45 % | 2013-02-03 |
| Brazilian | 1401 | 1395 | 0 | 6 | 99 % | 2024-09-16 |
| Bulgarian | 1401 | 1078 | 0 | 323 | 76 % | 2023-11-14 |
| Catalan | 1401 | 1328 | 0 | 73 | 94 % | |
| ChineseSimplified | 1401 | 1400 | 0 | 1 | 99 % | |
| ChineseTraditional | 1401 | 1298 | 0 | 103 | 92 % | 2022-02-19 |
| Corsican | 1401 | 1389 | 0 | 12 | 99 % | 2024-06-21 |
| Croatian | 1401 | 630 | 1 | 770 | 45 % | 2009-02-13 |
| Czech | 1401 | 605 | 0 | 796 | 43 % | |
| Danish | 1401 | 639 | 0 | 762 | 45 % | 2013-01-13 |
| Dutch | 1401 | 1280 | 0 | 121 | 91 % | 2023-05-02 |
| English | 1401 | 1401 | 0 | 0 | 100 % | 2024-09-18 |
| Finnish | 1401 | 1185 | 0 | 216 | 84 % | |
| French | 1401 | 1392 | 0 | 9 | 99 % | 2024-08-01 |
| Galician | 1401 | 1317 | 0 | 84 | 94 % | 2023-11-24 |
| German | 1401 | 1342 | 0 | 59 | 95 % | 2023-08-08 |
| Greek | 1401 | 605 | 0 | 796 | 43 % | |
| Hungarian | 1401 | 1395 | 0 | 6 | 99 % | 2021-03-15 |
| Italian | 1401 | 1392 | 0 | 9 | 99 % | 2024-07-27 |
| Japanese | 1401 | 1392 | 0 | 9 | 99 % | 2024-07-27 |
| Korean | 1401 | 1392 | 0 | 9 | 99 % | 2024-09-13 |
| Lithuanian | 1401 | 1343 | 0 | 58 | 95 % | 2024-07-24 |
| Norwegian | 1401 | 730 | 0 | 671 | 52 % | |
| Persian | 1401 | 641 | 0 | 760 | 45 % | 2013-08-15 |
| Polish | 1401 | 1355 | 0 | 46 | 96 % | 2023-11-28 |
| Portuguese | 1401 | 1392 | 0 | 9 | 99 % | 2024-08-17 |
| Romanian | 1401 | 1306 | 0 | 95 | 93 % | 2023-11-07 |
| Russian | 1401 | 1318 | 0 | 83 | 94 % | 2023-04-27 |
| Serbian | 1401 | 632 | 0 | 769 | 45 % | |
| Sinhala | 1401 | 563 | 58 | 780 | 44 % | 2010-12-12 |
| Slovak | 1401 | 1184 | 0 | 217 | 84 % | 2022-02-17 |
| Slovenian | 1401 | 1320 | 0 | 81 | 94 % | 2024-01-28 |
| Spanish | 1401 | 1317 | 0 | 84 | 94 % | 2023-11-24 |
| Swedish | 1401 | 1232 | 2 | 167 | 88 % | 2023-02-08 |
| Tamil | 1401 | 1218 | 0 | 183 | 86 % | 2023-07-24 |
| Turkish | 1401 | 1326 | 0 | 75 | 94 % | 2023-10-28 |
| Ukrainian | 1401 | 708 | 0 | 693 | 50 % | 2009-06-13 |

## ShellExtension

Expand Down
18 changes: 18 additions & 0 deletions Translations/WinMerge/Arabic.po
Original file line number Diff line number Diff line change
Expand Up @@ -4236,6 +4236,24 @@ msgstr ""
msgid "Character"
msgstr ""

msgid "\nPrevious Difference (Alt+Up)\n(Right Button+Wheel Up)\n(Alt+Wheel Up)"
msgstr ""

msgid "\nNext Difference (Alt+Down)\n(Right Button+Wheel Down)\n(Alt+Wheel Down)"
msgstr ""

msgid "\nCopy to Right (Alt+Right)\n(Right Button+Wheel Right)\n(Alt+Wheel Right\nAlt+Shift+Wheel Down"
msgstr ""

msgid "\nCopy to Left (Alt+Left)\n(Right Button+Wheel Left\n(Alt+Wheel Left)\n(Alt+Shift+Wheel Up)"
msgstr ""

msgid "\nCopy to Right and Advance (Ctrl+Alt+Right)\n(Ctrl+Alt+Wheel Right)\n(Ctrl+Alt+Shift+Wheel Down)"
msgstr ""

msgid "\nCopy to Left and Advance (Ctrl+Alt+Left)\n(Ctrl+Alt+Wheel Left)\n(Ctrl+Alt+Shift+Wheel Up)"
msgstr ""

msgid "Prettification"
msgstr ""

Expand Down
Loading
Loading