[MSPAINT] Use CF_DIB instead of CF_BITMAP (#5349)

CF_BITMAP is not recommended format for copying. In fact, Win10 won't accept it.
- Use CF_DIB clipboard format instead of CF_BITMAP in copying.
- Use CF_ENHMETAFILE, CF_DIB, or CF_BITMAP in pasting.
- Add BitmapToClipboardDIB, BitmapFromClipboardDIB, and BitmapFromHEMF helper functions to dib.cpp.
- Re-enable paste by fixing the bug that is embugged in the previous commit.
- Enable Cut, Copy, Paste, and Delete on text editing box by modifying OnInitMenuPopup.
- Add IDS_CANTPASTE resource string to show message on paste failure.
CORE-18867
This commit is contained in:
Katayama Hirofumi MZ 2023-06-18 19:48:20 +09:00 committed by GitHub
parent aaa0cb6724
commit 9f56e67bc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 320 additions and 45 deletions

View file

@ -547,7 +547,6 @@ struct TextTool : ToolBase
// Draw the text
INT style = (toolsModel.IsBackgroundTransparent() ? 0 : 1);
imageModel.PushImageForUndo();
Text(hdc, rc.left, rc.top, rc.right, rc.bottom, m_fg, m_bg, szText,
textEditWindow.GetFont(), style);
}
@ -568,12 +567,11 @@ struct TextTool : ToolBase
BOOL bTextBoxShown = ::IsWindowVisible(textEditWindow);
if (bTextBoxShown && textEditWindow.GetWindowTextLength() > 0)
{
imageModel.PushImageForUndo();
draw(m_hdc);
if (selectionModel.m_rc.IsRectEmpty())
if (::IsRectEmpty(&selectionModel.m_rc))
{
textEditWindow.ShowWindow(SW_HIDE);
textEditWindow.SetWindowText(NULL);
quit();
return;
}
}
@ -613,6 +611,7 @@ struct TextTool : ToolBase
void OnFinishDraw() override
{
imageModel.PushImageForUndo();
draw(m_hdc);
quit();
ToolBase::OnFinishDraw();