OSDN Git Service

#1651: Feature request: Allow pasting when editing caption of pages
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sat, 7 Jan 2023 23:55:46 +0000 (08:55 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sat, 7 Jan 2023 23:55:46 +0000 (08:55 +0900)
Src/FilepathEdit.cpp
Src/FilepathEdit.h

index f7b79c5..56d7358 100644 (file)
@@ -34,6 +34,10 @@ BEGIN_MESSAGE_MAP(CFilepathEdit, CEdit)
        ON_WM_KILLFOCUS()
        ON_WM_LBUTTONDOWN()
        ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
+       ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
+       ON_COMMAND(ID_EDIT_CUT, OnEditCut)
+       ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
+       ON_COMMAND(ID_EDIT_SELECT_ALL, OnEditSelectAll)
        ON_COMMAND_RANGE(ID_EDITOR_COPY_PATH, ID_EDITOR_SELECT_FILE, OnContextMenuSelected)
 END_MESSAGE_MAP()
 
@@ -217,8 +221,13 @@ void CFilepathEdit::CustomCopy(size_t iBegin, size_t iEnd /*=-1*/)
 /**
  * @brief Format the context menu.
  */
-void CFilepathEdit::OnContextMenu(CWnd*, CPoint point)
+void CFilepathEdit::OnContextMenu(CWnd* pWnd, CPoint point)
 {
+       if (m_bInEditing)
+       {
+               __super::OnContextMenu(pWnd, point);
+       }
+       else
        {
                if (!m_bActive)
                        SetFocus();
@@ -383,6 +392,26 @@ void CFilepathEdit::OnEditCopy()
                SetSel(nStartChar, nEndChar);
 }
 
+void CFilepathEdit::OnEditPaste()
+{
+       Paste();
+}
+
+void CFilepathEdit::OnEditCut()
+{
+       Cut();
+}
+
+void CFilepathEdit::OnEditUndo()
+{
+       Undo();
+}
+
+void CFilepathEdit::OnEditSelectAll()
+{
+       SetSel(0, -1);
+}
+
 void CFilepathEdit::OnContextMenuSelected(UINT nID)
 {
        // compute the beginning of the text to copy (in OriginalText)
index 15d924f..1cb3c09 100644 (file)
@@ -45,6 +45,10 @@ protected:
        afx_msg void OnKillFocus(CWnd* pNewWnd);
        afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
        afx_msg void OnEditCopy();
+       afx_msg void OnEditPaste();
+       afx_msg void OnEditCut();
+       afx_msg void OnEditUndo();
+       afx_msg void OnEditSelectAll();
        afx_msg void OnContextMenuSelected(UINT nID);
        HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
        DECLARE_MESSAGE_MAP();