https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1183e797b4c9e7fe97a78…
commit 1183e797b4c9e7fe97a78b7f3dfd2922a0598eff
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Oct 12 22:59:17 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Oct 12 22:59:17 2023 +0900
[MSPAINT] Reset scroll position in some situations (#5789)
In some situations, the scroll position should be reset.
- Add CCanvasWindow::resetScrollPos method.
- Reset the scroll position on loading a file.
- Reset the scroll position on mirroring/rotating
the image.
CORE-19094
---
base/applications/mspaint/canvas.cpp | 6 ++++++
base/applications/mspaint/canvas.h | 1 +
base/applications/mspaint/dib.cpp | 1 +
base/applications/mspaint/winproc.cpp | 1 +
4 files changed, 9 insertions(+)
diff --git a/base/applications/mspaint/canvas.cpp b/base/applications/mspaint/canvas.cpp
index 17eb2610ae2..680acd6fe56 100644
--- a/base/applications/mspaint/canvas.cpp
+++ b/base/applications/mspaint/canvas.cpp
@@ -199,6 +199,12 @@ VOID CCanvasWindow::updateScrollInfo()
SetScrollInfo(SB_VERT, &si);
}
+VOID CCanvasWindow::resetScrollPos()
+{
+ SetScrollPos(SB_HORZ, 0);
+ SetScrollPos(SB_VERT, 0);
+}
+
LRESULT CCanvasWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
bHandled)
{
if (m_hWnd)
diff --git a/base/applications/mspaint/canvas.h b/base/applications/mspaint/canvas.h
index 19920018214..193d7603abd 100644
--- a/base/applications/mspaint/canvas.h
+++ b/base/applications/mspaint/canvas.h
@@ -43,6 +43,7 @@ public:
VOID cancelDrawing();
VOID finishDrawing();
VOID updateScrollInfo();
+ VOID resetScrollPos();
VOID ImageToCanvas(POINT& pt);
VOID ImageToCanvas(RECT& rc);
diff --git a/base/applications/mspaint/dib.cpp b/base/applications/mspaint/dib.cpp
index 10f4511c5c7..7b458138618 100644
--- a/base/applications/mspaint/dib.cpp
+++ b/base/applications/mspaint/dib.cpp
@@ -241,6 +241,7 @@ HBITMAP InitializeImage(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL
isFile)
HBITMAP SetBitmapAndInfo(HBITMAP hBitmap, LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL
isFile)
{
// update image
+ canvasWindow.resetScrollPos();
imageModel.PushImageForUndo(hBitmap);
imageModel.ClearHistory();
diff --git a/base/applications/mspaint/winproc.cpp
b/base/applications/mspaint/winproc.cpp
index b0330b4292d..58bf4a98909 100644
--- a/base/applications/mspaint/winproc.cpp
+++ b/base/applications/mspaint/winproc.cpp
@@ -921,6 +921,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM
lParam, BOOL& bH
case IDM_IMAGEROTATEMIRROR:
{
CWaitCursor waitCursor;
+ canvasWindow.resetScrollPos();
switch (mirrorRotateDialog.DoModal(mainWindow.m_hWnd))
{
case 1: /* flip horizontally */