[MSPAINT] Improve Undo/Redo handling of selection (#6035)

Consistent behavior of the application.
- Add ShiftPtStack and BuildMaskFromPtStack
  helper functions.
- Move some codes of selectionModel to
  mouse.cpp.
CORE-19226
This commit is contained in:
Katayama Hirofumi MZ 2023-11-25 13:44:31 +09:00 committed by GitHub
parent ab0119c61f
commit b8598e095d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 134 additions and 205 deletions

View file

@ -648,9 +648,9 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
LRESULT CCanvasWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (wParam == VK_ESCAPE && ::GetCapture() == m_hWnd)
if (wParam == VK_ESCAPE)
{
cancelDrawing();
OnEndDraw(TRUE);
::ReleaseCapture();
m_nMouseDownMsg = 0;
m_hitCanvasSizeBox = HIT_NONE;
@ -698,19 +698,10 @@ LRESULT CCanvasWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
return 0;
}
VOID CCanvasWindow::cancelDrawing()
VOID CCanvasWindow::OnEndDraw(BOOL bCancel)
{
selectionModel.ClearColorImage();
selectionModel.ClearMaskImage();
m_drawing = FALSE;
toolsModel.OnEndDraw(TRUE);
Invalidate(FALSE);
}
VOID CCanvasWindow::finishDrawing()
{
toolsModel.OnEndDraw(FALSE);
m_drawing = FALSE;
toolsModel.OnEndDraw(bCancel);
Invalidate(FALSE);
}