[MSPAINT] s/pointSP/s_pointSP/ and s/pointStack/s_pointStack/

CORE-18867
This commit is contained in:
Katayama Hirofumi MZ 2023-06-22 07:28:15 +09:00
parent 3fa6d74a01
commit ec53d42278
3 changed files with 51 additions and 51 deletions

View file

@ -11,8 +11,8 @@
#include "precomp.h" #include "precomp.h"
INT ToolBase::pointSP = 0; INT ToolBase::s_pointSP = 0;
POINT ToolBase::pointStack[256] = { { 0 } }; POINT ToolBase::s_pointStack[256] = { { 0 } };
/* FUNCTIONS ********************************************************/ /* FUNCTIONS ********************************************************/
@ -65,7 +65,7 @@ void updateLast(LONG x, LONG y)
void ToolBase::reset() void ToolBase::reset()
{ {
pointSP = 0; s_pointSP = 0;
g_ptStart.x = g_ptStart.y = g_ptEnd.x = g_ptEnd.y = -1; g_ptStart.x = g_ptStart.y = g_ptEnd.x = g_ptEnd.y = -1;
selectionModel.ResetPtStack(); selectionModel.ResetPtStack();
if (selectionModel.m_bShow) if (selectionModel.m_bShow)
@ -675,17 +675,17 @@ struct BezierTool : ToolBase
return; return;
COLORREF rgb = (m_bLeftButton ? m_fg : m_bg); COLORREF rgb = (m_bLeftButton ? m_fg : m_bg);
switch (pointSP) switch (s_pointSP)
{ {
case 1: case 1:
Line(hdc, pointStack[0].x, pointStack[0].y, pointStack[1].x, pointStack[1].y, rgb, Line(hdc, s_pointStack[0].x, s_pointStack[0].y, s_pointStack[1].x, s_pointStack[1].y, rgb,
toolsModel.GetLineWidth()); toolsModel.GetLineWidth());
break; break;
case 2: case 2:
Bezier(hdc, pointStack[0], pointStack[2], pointStack[2], pointStack[1], rgb, toolsModel.GetLineWidth()); Bezier(hdc, s_pointStack[0], s_pointStack[2], s_pointStack[2], s_pointStack[1], rgb, toolsModel.GetLineWidth());
break; break;
case 3: case 3:
Bezier(hdc, pointStack[0], pointStack[2], pointStack[3], pointStack[1], rgb, toolsModel.GetLineWidth()); Bezier(hdc, s_pointStack[0], s_pointStack[2], s_pointStack[3], s_pointStack[1], rgb, toolsModel.GetLineWidth());
break; break;
} }
} }
@ -697,15 +697,15 @@ struct BezierTool : ToolBase
if (!m_bDrawing) if (!m_bDrawing)
{ {
m_bDrawing = TRUE; m_bDrawing = TRUE;
pointStack[pointSP].x = pointStack[pointSP + 1].x = x; s_pointStack[s_pointSP].x = s_pointStack[s_pointSP + 1].x = x;
pointStack[pointSP].y = pointStack[pointSP + 1].y = y; s_pointStack[s_pointSP].y = s_pointStack[s_pointSP + 1].y = y;
++pointSP; ++s_pointSP;
} }
else else
{ {
++pointSP; ++s_pointSP;
pointStack[pointSP].x = x; s_pointStack[s_pointSP].x = x;
pointStack[pointSP].y = y; s_pointStack[s_pointSP].y = y;
} }
imageModel.NotifyImageChanged(); imageModel.NotifyImageChanged();
@ -713,16 +713,16 @@ struct BezierTool : ToolBase
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
{ {
pointStack[pointSP].x = x; s_pointStack[s_pointSP].x = x;
pointStack[pointSP].y = y; s_pointStack[s_pointSP].y = y;
imageModel.NotifyImageChanged(); imageModel.NotifyImageChanged();
} }
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
{ {
pointStack[pointSP].x = x; s_pointStack[s_pointSP].x = x;
pointStack[pointSP].y = y; s_pointStack[s_pointSP].y = y;
if (pointSP >= 3) if (s_pointSP >= 3)
{ {
OnFinishDraw(); OnFinishDraw();
return; return;
@ -777,13 +777,13 @@ struct ShapeTool : ToolBase
void OnDrawOverlayOnImage(HDC hdc) void OnDrawOverlayOnImage(HDC hdc)
{ {
if (pointSP <= 0) if (s_pointSP <= 0)
return; return;
if (m_bLeftButton) if (m_bLeftButton)
Poly(hdc, pointStack, pointSP + 1, m_fg, m_bg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle(), m_bClosed, FALSE); Poly(hdc, s_pointStack, s_pointSP + 1, m_fg, m_bg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle(), m_bClosed, FALSE);
else else
Poly(hdc, pointStack, pointSP + 1, m_bg, m_fg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle(), m_bClosed, FALSE); Poly(hdc, s_pointStack, s_pointSP + 1, m_bg, m_fg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle(), m_bClosed, FALSE);
} }
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
@ -791,23 +791,23 @@ struct ShapeTool : ToolBase
m_bLeftButton = bLeftButton; m_bLeftButton = bLeftButton;
m_bClosed = FALSE; m_bClosed = FALSE;
if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0)) if ((s_pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y, x, y); roundTo8Directions(s_pointStack[s_pointSP - 1].x, s_pointStack[s_pointSP - 1].y, x, y);
pointStack[pointSP].x = x; s_pointStack[s_pointSP].x = x;
pointStack[pointSP].y = y; s_pointStack[s_pointSP].y = y;
if (pointSP && bDoubleClick) if (s_pointSP && bDoubleClick)
{ {
OnFinishDraw(); OnFinishDraw();
return; return;
} }
if (pointSP == 0) if (s_pointSP == 0)
{ {
pointSP++; s_pointSP++;
pointStack[pointSP].x = x; s_pointStack[s_pointSP].x = x;
pointStack[pointSP].y = y; s_pointStack[s_pointSP].y = y;
} }
imageModel.NotifyImageChanged(); imageModel.NotifyImageChanged();
@ -815,35 +815,35 @@ struct ShapeTool : ToolBase
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
{ {
if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0)) if ((s_pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y, x, y); roundTo8Directions(s_pointStack[s_pointSP - 1].x, s_pointStack[s_pointSP - 1].y, x, y);
pointStack[pointSP].x = x; s_pointStack[s_pointSP].x = x;
pointStack[pointSP].y = y; s_pointStack[s_pointSP].y = y;
imageModel.NotifyImageChanged(); imageModel.NotifyImageChanged();
} }
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
{ {
if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0)) if ((s_pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y, x, y); roundTo8Directions(s_pointStack[s_pointSP - 1].x, s_pointStack[s_pointSP - 1].y, x, y);
m_bClosed = FALSE; m_bClosed = FALSE;
if (nearlyEqualPoints(x, y, pointStack[0].x, pointStack[0].y)) if (nearlyEqualPoints(x, y, s_pointStack[0].x, s_pointStack[0].y))
{ {
OnFinishDraw(); OnFinishDraw();
return; return;
} }
else else
{ {
pointSP++; s_pointSP++;
pointStack[pointSP].x = x; s_pointStack[s_pointSP].x = x;
pointStack[pointSP].y = y; s_pointStack[s_pointSP].y = y;
} }
if (pointSP == _countof(pointStack)) if (s_pointSP == _countof(s_pointStack))
pointSP--; s_pointSP--;
imageModel.NotifyImageChanged(); imageModel.NotifyImageChanged();
} }
@ -855,9 +855,9 @@ struct ShapeTool : ToolBase
void OnFinishDraw() override void OnFinishDraw() override
{ {
if (pointSP) if (s_pointSP)
{ {
--pointSP; --s_pointSP;
m_bClosed = TRUE; m_bClosed = TRUE;
imageModel.PushImageForUndo(); imageModel.PushImageForUndo();
@ -865,7 +865,7 @@ struct ShapeTool : ToolBase
} }
m_bClosed = FALSE; m_bClosed = FALSE;
pointSP = 0; s_pointSP = 0;
ToolBase::OnFinishDraw(); ToolBase::OnFinishDraw();
} }

View file

@ -36,8 +36,8 @@ struct ToolBase
TOOLTYPE m_tool; TOOLTYPE m_tool;
HDC m_hdc; HDC m_hdc;
COLORREF m_fg, m_bg; COLORREF m_fg, m_bg;
static INT pointSP; static INT s_pointSP;
static POINT pointStack[256]; static POINT s_pointStack[256];
ToolBase(TOOLTYPE tool) : m_tool(tool), m_hdc(NULL) { } ToolBase(TOOLTYPE tool) : m_tool(tool), m_hdc(NULL) { }
virtual ~ToolBase() { } virtual ~ToolBase() { }

View file

@ -422,7 +422,7 @@ BOOL CMainWindow::CanUndo() const
return (BOOL)textEditWindow.SendMessage(EM_CANUNDO); return (BOOL)textEditWindow.SendMessage(EM_CANUNDO);
if (selectionModel.m_bShow && toolsModel.IsSelection()) if (selectionModel.m_bShow && toolsModel.IsSelection())
return TRUE; return TRUE;
if (ToolBase::pointSP != 0) if (ToolBase::s_pointSP != 0)
return TRUE; return TRUE;
return imageModel.CanUndo(); return imageModel.CanUndo();
} }
@ -431,7 +431,7 @@ BOOL CMainWindow::CanRedo() const
{ {
if (toolsModel.GetActiveTool() == TOOL_TEXT && ::IsWindowVisible(textEditWindow)) if (toolsModel.GetActiveTool() == TOOL_TEXT && ::IsWindowVisible(textEditWindow))
return FALSE; // There is no "WM_REDO" in EDIT control return FALSE; // There is no "WM_REDO" in EDIT control
if (ToolBase::pointSP != 0) if (ToolBase::s_pointSP != 0)
return TRUE; return TRUE;
return imageModel.CanRedo(); return imageModel.CanRedo();
} }
@ -696,7 +696,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
break; break;
} }
} }
if (ToolBase::pointSP != 0) // drawing something? if (ToolBase::s_pointSP != 0) // drawing something?
{ {
canvasWindow.cancelDrawing(); canvasWindow.cancelDrawing();
break; break;
@ -709,7 +709,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
// There is no "WM_REDO" in EDIT control // There is no "WM_REDO" in EDIT control
break; break;
} }
if (ToolBase::pointSP != 0) // drawing something? if (ToolBase::s_pointSP != 0) // drawing something?
{ {
canvasWindow.finishDrawing(); canvasWindow.finishDrawing();
break; break;