aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--win32/ScintillaWin.cxx57
2 files changed, 37 insertions, 24 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 7a4b5b9bc..8f2a6206c 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -588,6 +588,10 @@
This is a private interface but could be used by independent platform layers
and was exposed by ScintillaDocument in the Qt implementation of ScintillaEdit.
</li>
+ <li>
+ On Win32 implement horizontal scrolling mouse wheel.
+ <a href="https://sourceforge.net/p/scintilla/feature-requests/1450/">Feature #1450</a>.
+ </li>
</ul>
<h3>
<a href="https://www.scintilla.org/scintilla530.zip">Release 5.3.0</a>
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 24f70dce9..9f1cbe53f 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -1533,6 +1533,7 @@ sptr_t ScintillaWin::MouseMessage(unsigned int iMessage, uptr_t wParam, sptr_t l
return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam);
case WM_MOUSEWHEEL:
+ case WM_MOUSEHWHEEL:
if (!mouseWheelCaptures) {
// if the mouse wheel is not captured, test if the mouse
// pointer is over the editor window and if not, don't
@@ -1557,33 +1558,40 @@ sptr_t ScintillaWin::MouseMessage(unsigned int iMessage, uptr_t wParam, sptr_t l
if (wParam & MK_SHIFT) {
return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam);
}
- // Either SCROLL or ZOOM. We handle the wheel steppings calculation
- wheelDelta -= GET_WHEEL_DELTA_WPARAM(wParam);
- if (std::abs(wheelDelta) >= WHEEL_DELTA && linesPerScroll > 0) {
- Sci::Line linesToScroll = linesPerScroll;
- if (linesPerScroll == WHEEL_PAGESCROLL)
- linesToScroll = LinesOnScreen() - 1;
- if (linesToScroll == 0) {
- linesToScroll = 1;
- }
- linesToScroll *= (wheelDelta / WHEEL_DELTA);
- if (wheelDelta >= 0)
- wheelDelta = wheelDelta % WHEEL_DELTA;
- else
- wheelDelta = -(-wheelDelta % WHEEL_DELTA);
-
- if (wParam & MK_CONTROL) {
- // Zoom! We play with the font sizes in the styles.
- // Number of steps/line is ignored, we just care if sizing up or down
- if (linesToScroll < 0) {
- KeyCommand(Message::ZoomIn);
+ if (iMessage == WM_MOUSEWHEEL) {
+ // Either SCROLL vertically or ZOOM. We handle the wheel steppings calculation
+ wheelDelta -= GET_WHEEL_DELTA_WPARAM(wParam);
+ if (std::abs(wheelDelta) >= WHEEL_DELTA && linesPerScroll > 0) {
+ Sci::Line linesToScroll = linesPerScroll;
+ if (linesPerScroll == WHEEL_PAGESCROLL)
+ linesToScroll = LinesOnScreen() - 1;
+ if (linesToScroll == 0) {
+ linesToScroll = 1;
+ }
+ linesToScroll *= (wheelDelta / WHEEL_DELTA);
+ if (wheelDelta >= 0)
+ wheelDelta = wheelDelta % WHEEL_DELTA;
+ else
+ wheelDelta = -(-wheelDelta % WHEEL_DELTA);
+
+ if (wParam & MK_CONTROL) {
+ // Zoom! We play with the font sizes in the styles.
+ // Number of steps/line is ignored, we just care if sizing up or down
+ if (linesToScroll < 0) {
+ KeyCommand(Message::ZoomIn);
+ } else {
+ KeyCommand(Message::ZoomOut);
+ }
} else {
- KeyCommand(Message::ZoomOut);
+ // Scroll
+ ScrollTo(topLine + linesToScroll);
}
- } else {
- // Scroll
- ScrollTo(topLine + linesToScroll);
}
+ } else { // WM_MOUSEHWHEEL (horizontal scrolling)
+ SCROLLINFO sci { sizeof(sci), SIF_POS | SIF_RANGE, 0, 0, 0, 0, 0 };
+ GetScrollInfo(SB_HORZ, &sci);
+ sci.nPos -= GET_WHEEL_DELTA_WPARAM(wParam);
+ HorizontalScrollTo(std::clamp(sci.nPos, sci.nMin, sci.nMax));
}
return 0;
}
@@ -1987,6 +1995,7 @@ sptr_t ScintillaWin::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
case WM_MOUSEMOVE:
case WM_MOUSELEAVE:
case WM_MOUSEWHEEL:
+ case WM_MOUSEHWHEEL:
return MouseMessage(msg, wParam, lParam);
case WM_SETCURSOR: