https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cc3b53fef9892ea30b655…
commit cc3b53fef9892ea30b655e851a27cd1f4a2e0898
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sat Mar 18 08:09:26 2023 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Sat Mar 18 08:09:26 2023 +0900
[MSPAINT] Encapsulation: hCurFill, hCurColor etc.
CORE-18867
---
base/applications/mspaint/globalvar.h | 6 ------
base/applications/mspaint/imgarea.cpp | 25 +++++++++++++++++--------
base/applications/mspaint/imgarea.h | 8 ++++++++
base/applications/mspaint/main.cpp | 12 ------------
4 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/base/applications/mspaint/globalvar.h
b/base/applications/mspaint/globalvar.h
index aa144275968..b0099e571f5 100644
--- a/base/applications/mspaint/globalvar.h
+++ b/base/applications/mspaint/globalvar.h
@@ -36,12 +36,6 @@ extern OPENFILENAME sfn;
extern HICON hNontranspIcon;
extern HICON hTranspIcon;
-extern HCURSOR hCurFill;
-extern HCURSOR hCurColor;
-extern HCURSOR hCurZoom;
-extern HCURSOR hCurPen;
-extern HCURSOR hCurAirbrush;
-
extern HINSTANCE hProgInstance;
extern TCHAR filepathname[1000];
diff --git a/base/applications/mspaint/imgarea.cpp
b/base/applications/mspaint/imgarea.cpp
index 1d8b05024ce..aa116dcc8c1 100644
--- a/base/applications/mspaint/imgarea.cpp
+++ b/base/applications/mspaint/imgarea.cpp
@@ -8,12 +8,21 @@
* Katayama Hirofumi MZ
*/
-/* INCLUDES *********************************************************/
-
#include "precomp.h"
/* FUNCTIONS ********************************************************/
+LRESULT CImgAreaWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
bHandled)
+{
+ m_hCurFill = LoadIcon(hProgInstance, MAKEINTRESOURCE(IDC_FILL));
+ m_hCurColor = LoadIcon(hProgInstance, MAKEINTRESOURCE(IDC_COLOR));
+ m_hCurZoom = LoadIcon(hProgInstance, MAKEINTRESOURCE(IDC_ZOOM));
+ m_hCurPen = LoadIcon(hProgInstance, MAKEINTRESOURCE(IDC_PEN));
+ m_hCurAirbrush = LoadIcon(hProgInstance, MAKEINTRESOURCE(IDC_AIRBRUSH));
+
+ return 0;
+}
+
void CImgAreaWindow::drawZoomFrame(int mouseX, int mouseY)
{
HDC hdc;
@@ -115,22 +124,22 @@ LRESULT CImgAreaWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM
lParam, BOO
switch (toolsModel.GetActiveTool())
{
case TOOL_FILL:
- SetCursor(hCurFill);
+ ::SetCursor(m_hCurFill);
break;
case TOOL_COLOR:
- SetCursor(hCurColor);
+ ::SetCursor(m_hCurColor);
break;
case TOOL_ZOOM:
- SetCursor(hCurZoom);
+ ::SetCursor(m_hCurZoom);
break;
case TOOL_PEN:
- SetCursor(hCurPen);
+ ::SetCursor(m_hCurPen);
break;
case TOOL_AIRBRUSH:
- SetCursor(hCurAirbrush);
+ ::SetCursor(m_hCurAirbrush);
break;
default:
- SetCursor(LoadCursor(NULL, IDC_CROSS));
+ ::SetCursor(::LoadCursor(NULL, IDC_CROSS));
}
return 0;
}
diff --git a/base/applications/mspaint/imgarea.h b/base/applications/mspaint/imgarea.h
index 306c94088e9..d7b44e5c4af 100644
--- a/base/applications/mspaint/imgarea.h
+++ b/base/applications/mspaint/imgarea.h
@@ -42,9 +42,17 @@ public:
MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
MESSAGE_HANDLER(WM_CTLCOLOREDIT, OnCtlColorEdit)
+ MESSAGE_HANDLER(WM_CREATE, OnCreate)
END_MSG_MAP()
private:
+ HCURSOR m_hCurFill;
+ HCURSOR m_hCurColor;
+ HCURSOR m_hCurZoom;
+ HCURSOR m_hCurPen;
+ HCURSOR m_hCurAirbrush;
+
+ LRESULT OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnEraseBkGnd(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
diff --git a/base/applications/mspaint/main.cpp b/base/applications/mspaint/main.cpp
index a1f11a87af9..bd83e56a04a 100644
--- a/base/applications/mspaint/main.cpp
+++ b/base/applications/mspaint/main.cpp
@@ -35,12 +35,6 @@ OPENFILENAME sfn;
HICON hNontranspIcon;
HICON hTranspIcon;
-HCURSOR hCurFill;
-HCURSOR hCurColor;
-HCURSOR hCurZoom;
-HCURSOR hCurPen;
-HCURSOR hCurAirbrush;
-
HINSTANCE hProgInstance;
TCHAR filepathname[1000];
@@ -204,12 +198,6 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR
lpszArgument
hTranspIcon =
(HICON) LoadImage(hThisInstance, MAKEINTRESOURCE(IDI_TRANSPARENT), IMAGE_ICON,
40, 30, LR_DEFAULTCOLOR);
- hCurFill = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_FILL));
- hCurColor = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_COLOR));
- hCurZoom = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_ZOOM));
- hCurPen = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_PEN));
- hCurAirbrush = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_AIRBRUSH));
-
RECT toolBoxContainerPos = {2, 2, 2 + 52, 2 + 350};
toolBoxContainer.Create(hwnd, toolBoxContainerPos, NULL, WS_CHILD | WS_VISIBLE);
/* creating the tool settings child window */