Patch #1704 2006-12-08 12:45

dje

cbStyledTextCtrl context menu event management improvement
Download
1704-cbStyledTextCt.patch (1.0 KB)
Category
Application::Bugfix
Status
Accepted
Close date
2007-02-22 14:04
Assigned to
 
Index: cbeditor.cpp
===================================================================
--- cbeditor.cpp    (revision 3343)
+++ cbeditor.cpp    (working copy)
@@ -102,14 +102,20 @@
 
 void cbStyledTextCtrl::OnContextMenu(wxContextMenuEvent& event)
 {
-    if (m_pParent)
-    {
-        /*  or use noeditor to handle "contect menu" key?
-         */
-        const bool is_right_click = event.GetPosition()!=wxDefaultPosition;
-        const wxPoint mp(is_right_click ? event.GetPosition() : wxDefaultPosition);
-        reinterpret_cast<cbEditor*>(m_pParent)->DisplayContextMenu(mp,mtEditorManager); //pecan 2006/03/22
-    }
+    if ( m_pParent != NULL )
+    {
+        cbEditor* pParent = dynamic_cast<cbEditor*>(m_pParent);
+        if ( pParent != NULL )
+        {
+            const bool is_right_click = event.GetPosition()!=wxDefaultPosition;
+            const wxPoint mp(is_right_click ? event.GetPosition() : wxDefaultPosition);
+            pParent->DisplayContextMenu(mp,mtEditorManager);
+        }
+        else
+        {
+            event.Skip();
+        }
+    }
 }
 
 void cbStyledTextCtrl::OnGPM(wxMouseEvent& event)
dje 2007-01-04 22:40

Hi !

I'd like to release a new wonderful plugin that requires this patch.

Do I have to assign it ? (if yes, how ?)

Thanks,

Dje

mandrav 2007-02-22 14:04

Applied.