[MSPAINT] Improve CMiniatureWindow (#5337)

- Save the position and size of the miniature window.
- Improve drawing of the miniature window.
- Sync with the canvas.
CORE-18867
This commit is contained in:
Katayama Hirofumi MZ 2023-06-14 18:51:40 +09:00 committed by GitHub
parent 113656563a
commit bfd42c67a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 86 additions and 34 deletions

View file

@ -78,11 +78,13 @@ void ToolBase::reset()
void ToolBase::OnCancelDraw()
{
reset();
imageModel.NotifyImageChanged();
}
void ToolBase::OnFinishDraw()
{
reset();
imageModel.NotifyImageChanged();
}
void ToolBase::beginEvent()
@ -151,15 +153,12 @@ struct FreeSelTool : ToolBase
selectionModel.ResetPtStack();
selectionModel.m_bShow = FALSE;
}
canvasWindow.Invalidate(FALSE);
imageModel.NotifyImageChanged();
}
}
void OnFinishDraw() override
{
if (m_bLeftButton)
canvasWindow.Invalidate(FALSE);
m_bLeftButton = FALSE;
ToolBase::OnFinishDraw();
}
@ -214,15 +213,12 @@ struct RectSelTool : ToolBase
if (start.x == x && start.y == y)
imageModel.Undo(TRUE);
selectionModel.m_bShow = !selectionModel.m_rc.IsRectEmpty();
canvasWindow.Invalidate(FALSE);
imageModel.NotifyImageChanged();
}
}
void OnFinishDraw() override
{
if (m_bLeftButton)
canvasWindow.Invalidate(FALSE);
m_bLeftButton = FALSE;
ToolBase::OnFinishDraw();
}
@ -253,11 +249,13 @@ struct GenericDrawTool : ToolBase
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
{
draw(bLeftButton, x, y);
imageModel.NotifyImageChanged();
}
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
{
draw(bLeftButton, x, y);
imageModel.NotifyImageChanged();
}
void OnCancelDraw() override
@ -574,6 +572,7 @@ struct BezierTool : ToolBase
pointSP++;
if (pointSP == 4)
pointSP = 0;
imageModel.NotifyImageChanged();
}
void OnCancelDraw() override
@ -649,6 +648,7 @@ struct ShapeTool : ToolBase
else
{
draw(bLeftButton, x, y, bDoubleClick);
imageModel.NotifyImageChanged();
}
}