[MSPAINT] Improve Undo/Redo and finishing tool (#4324)

- Fix Undo/Redo mechanism.
- Finish drawing when the tool is to be chanaged and when the file is to be saved.
- Add ToolBase::OnFinishDraw to virtualize finishing drawing.
- Extend bClearRedo parameter to ImageModel::Undo.
- Add ImageModel::DrawSelectionBackground and ImageModel::DeleteSelection methods.
- Fix some WM_PAINT message handling.
CORE-17969
This commit is contained in:
Katayama Hirofumi MZ 2022-01-30 12:05:23 +09:00 committed by GitHub
parent c5b029d0fc
commit 0839711566
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 313 additions and 151 deletions

View file

@ -33,12 +33,11 @@ LRESULT CToolSettingsWindow::OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam,
LRESULT CToolSettingsWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
PAINTSTRUCT ps;
RECT rect1 = { 0, 0, 42, 66 };
RECT rect2 = { 0, 70, 42, 136 };
DefWindowProc(WM_PAINT, wParam, lParam);
HDC hdc = GetDC();
HDC hdc = BeginPaint(&ps);
DrawEdge(hdc, &rect1, BDR_SUNKENOUTER, (toolsModel.GetActiveTool() == TOOL_ZOOM) ? BF_RECT : BF_RECT | BF_MIDDLE);
DrawEdge(hdc, &rect2, (toolsModel.GetActiveTool() >= TOOL_RECT) ? BDR_SUNKENOUTER : 0, BF_RECT | BF_MIDDLE);
switch (toolsModel.GetActiveTool())
@ -181,7 +180,7 @@ LRESULT CToolSettingsWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BO
case TOOL_PEN:
break;
}
ReleaseDC(hdc);
EndPaint(&ps);
return 0;
}