https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bc19bbe4083cd66a7745e…
commit bc19bbe4083cd66a7745ea0671b74edb9353d238
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Mon Jun 19 18:59:00 2023 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Mon Jun 19 18:59:00 2023 +0900
[MSPAINT] Add CMainWindow::CanPaste
CORE-18867
---
base/applications/mspaint/winproc.cpp | 16 +++++++++++-----
base/applications/mspaint/winproc.h | 1 +
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/base/applications/mspaint/winproc.cpp
b/base/applications/mspaint/winproc.cpp
index e80f8572dc2..41829b84b8f 100644
--- a/base/applications/mspaint/winproc.cpp
+++ b/base/applications/mspaint/winproc.cpp
@@ -436,6 +436,16 @@ BOOL CMainWindow::CanRedo() const
return imageModel.CanRedo();
}
+BOOL CMainWindow::CanPaste() const
+{
+ if (toolsModel.GetActiveTool() == TOOL_TEXT &&
::IsWindowVisible(textEditWindow))
+ return ::IsClipboardFormatAvailable(CF_UNICODETEXT);
+
+ return (::IsClipboardFormatAvailable(CF_ENHMETAFILE) ||
+ ::IsClipboardFormatAvailable(CF_DIB) ||
+ ::IsClipboardFormatAvailable(CF_BITMAP));
+}
+
LRESULT CMainWindow::OnInitMenuPopup(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
bHandled)
{
HMENU menu = (HMENU)wParam;
@@ -465,11 +475,7 @@ LRESULT CMainWindow::OnInitMenuPopup(UINT nMsg, WPARAM wParam, LPARAM
lParam, BO
ENABLED_IF(textShown ? hasTextSel : trueSelection));
EnableMenuItem(menu, IDM_EDITINVERTSELECTION, ENABLED_IF(trueSelection));
EnableMenuItem(menu, IDM_EDITCOPYTO, ENABLED_IF(trueSelection));
- EnableMenuItem(menu, IDM_EDITPASTE,
- ENABLED_IF(textShown ? ::IsClipboardFormatAvailable(CF_UNICODETEXT) :
- (::IsClipboardFormatAvailable(CF_ENHMETAFILE) ||
- ::IsClipboardFormatAvailable(CF_DIB) ||
- ::IsClipboardFormatAvailable(CF_BITMAP))));
+ EnableMenuItem(menu, IDM_EDITPASTE, ENABLED_IF(CanPaste()));
//
// View menu
diff --git a/base/applications/mspaint/winproc.h b/base/applications/mspaint/winproc.h
index 7984057184d..075c0735ba7 100644
--- a/base/applications/mspaint/winproc.h
+++ b/base/applications/mspaint/winproc.h
@@ -37,6 +37,7 @@ public:
VOID TrackPopupMenu(POINT ptScreen, INT iSubMenu);
BOOL CanUndo() const;
BOOL CanRedo() const;
+ BOOL CanPaste() const;
private:
HMENU m_hMenu;