Patch #890 2006-03-03 15:19

pecan

Clipboard blocked by main.cpp updateUI routine
Download
890-Clipboard_block.patch (2.3 KB)
Category
 
Status
Accepted
Close date
2006-03-07 09:30
Assigned to
 
Index: src/src/main.cpp
===================================================================
--- src/src/main.cpp    (revision 2112)
+++ src/src/main.cpp    (working copy)
@@ -2633,12 +2633,15 @@
         hasSel = eb->HasSelection();
         canPaste = eb->CanPaste();
     }
-
-    mbar->Enable(idEditUndo, eb && canUndo);
-    mbar->Enable(idEditRedo, eb && canRedo);
-    mbar->Enable(idEditCut, eb && hasSel);
-    mbar->Enable(idEditCopy, eb && hasSel);
-    mbar->Enable(idEditPaste, eb && canPaste);
+    // Dont block other routines from using copy/paste menu                 //pecan 2006/3/3
+    wxWindow* pFocused = wxWindow::FindFocus();                             //pecan 2006/3/3
+    if (pFocused && ed && (pFocused == ed->GetControl()) ) {                //pecan 2006/3/3
+        mbar->Enable(idEditUndo, eb && canUndo);
+        mbar->Enable(idEditRedo, eb && canRedo);
+        mbar->Enable(idEditCut, eb && hasSel);
+        mbar->Enable(idEditCopy, eb && hasSel);
+        mbar->Enable(idEditPaste, eb && canPaste);
+    }                                                                       //pecan 2006/3/3
     mbar->Enable(idEditSwapHeaderSource, ed);
     mbar->Enable(idEditGotoMatchingBrace, ed);
     mbar->Enable(idEditHighlightMode, ed);
@@ -2679,14 +2682,17 @@
         mbar->Check(idEditEncodingUnicode32LE, ed && ed->GetEncoding() == wxFONTENCODING_UTF32LE);
     }
 
-    if (m_pToolbar)
-    {
-        m_pToolbar->EnableTool(idEditUndo, eb && canUndo);
-        m_pToolbar->EnableTool(idEditRedo, eb && canRedo);
-        m_pToolbar->EnableTool(idEditCut, eb && hasSel);
-        m_pToolbar->EnableTool(idEditCopy, eb && hasSel);
-        m_pToolbar->EnableTool(idEditPaste, eb && canPaste);
-    }
+    // Dont block other routines from using copy/paste tools                //pecan 2006/3/3
+    if (pFocused && ed && (pFocused == ed->GetControl()) ) {                //pecan 2006/3/3
+        if (m_pToolbar)
+        {
+            m_pToolbar->EnableTool(idEditUndo, eb && canUndo);
+            m_pToolbar->EnableTool(idEditRedo, eb && canRedo);
+            m_pToolbar->EnableTool(idEditCut, eb && hasSel);
+            m_pToolbar->EnableTool(idEditCopy, eb && hasSel);
+            m_pToolbar->EnableTool(idEditPaste, eb && canPaste);
+        }
+    }                                                                       //pecan 2006/03/3
 
     event.Skip();
 }
pecan 2006-03-03 21:00

Am uploading a revised patch to include enabling the

tool bar cut and paste tools as well as the menu items.

thanks

pecan

mandrav 2006-03-07 09:30

Please respect the coding style of the surrounding code next time :)

I had to manually change

if (...) {

}

to

if (...)

{

}