From 0b9dfbc00e0251cdabc4c1a8d5c67bf28e8b28b2 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 30 Mar 2002 01:19:59 +0000 Subject: [PATCH] Give access to m_lastKeydownConsumed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/stc/stc.h | 5 +++ contrib/src/stc/ScintillaWX.cpp | 51 ++++++++++++-------------- contrib/src/stc/stc.cpp | 3 -- contrib/src/stc/stc.cpp.in | 3 -- contrib/src/stc/stc.h.in | 5 +++ include/wx/stc/stc.h | 5 +++ src/stc/ScintillaWX.cpp | 51 ++++++++++++-------------- src/stc/stc.cpp | 3 -- src/stc/stc.cpp.in | 3 -- src/stc/stc.h.in | 5 +++ wxPython/contrib/stc/msw/stc_.cpp | 61 +++++++++++++++++++++++++++++++ wxPython/contrib/stc/msw/stc_.py | 6 +++ 12 files changed, 135 insertions(+), 66 deletions(-) diff --git a/contrib/include/wx/stc/stc.h b/contrib/include/wx/stc/stc.h index 1149ea620d..ab01bf1887 100644 --- a/contrib/include/wx/stc/stc.h +++ b/contrib/include/wx/stc/stc.h @@ -1799,6 +1799,11 @@ public: // Set the horizontal scrollbar to use instead of the ont that's built-in. void SetHScrollBar(wxScrollBar* bar) { m_hScrollBar = bar; } + // Can be used to prevent the EVT_CHAR handler from adding the char + bool GetLastKeydownProcessed() { return m_lastKeyDownConsumed; } + void SetLastKeydownProcessed(bool val) { m_lastKeyDownConsumed = val; } + + //---------------------------------------------------------------------- diff --git a/contrib/src/stc/ScintillaWX.cpp b/contrib/src/stc/ScintillaWX.cpp index 6cf99b3412..f7336a7196 100644 --- a/contrib/src/stc/ScintillaWX.cpp +++ b/contrib/src/stc/ScintillaWX.cpp @@ -510,33 +510,30 @@ int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* cons #endif switch (key) { - case WXK_DOWN: key = SCK_DOWN; break; - case WXK_UP: key = SCK_UP; break; - case WXK_LEFT: key = SCK_LEFT; break; - case WXK_RIGHT: key = SCK_RIGHT; break; - case WXK_HOME: key = SCK_HOME; break; - case WXK_END: key = SCK_END; break; - case WXK_PRIOR: key = SCK_PRIOR; break; - case WXK_NEXT: key = SCK_NEXT; break; - case WXK_DELETE: key = SCK_DELETE; break; - case WXK_INSERT: key = SCK_INSERT; break; - case WXK_ESCAPE: key = SCK_ESCAPE; break; - case WXK_BACK: key = SCK_BACK; break; - case WXK_TAB: key = SCK_TAB; break; - case WXK_RETURN: key = SCK_RETURN; break; - case WXK_ADD: - case WXK_NUMPAD_ADD: - key = SCK_ADD; break; - case WXK_SUBTRACT: - case WXK_NUMPAD_SUBTRACT: - key = SCK_SUBTRACT; break; - case WXK_DIVIDE: - case WXK_NUMPAD_DIVIDE: - key = SCK_DIVIDE; break; - case WXK_CONTROL: key = 0; break; - case WXK_ALT: key = 0; break; - case WXK_SHIFT: key = 0; break; - case WXK_MENU: key = 0; break; + case WXK_DOWN: key = SCK_DOWN; break; + case WXK_UP: key = SCK_UP; break; + case WXK_LEFT: key = SCK_LEFT; break; + case WXK_RIGHT: key = SCK_RIGHT; break; + case WXK_HOME: key = SCK_HOME; break; + case WXK_END: key = SCK_END; break; + case WXK_PRIOR: key = SCK_PRIOR; break; + case WXK_NEXT: key = SCK_NEXT; break; + case WXK_DELETE: key = SCK_DELETE; break; + case WXK_INSERT: key = SCK_INSERT; break; + case WXK_ESCAPE: key = SCK_ESCAPE; break; + case WXK_BACK: key = SCK_BACK; break; + case WXK_TAB: key = SCK_TAB; break; + case WXK_RETURN: key = SCK_RETURN; break; + case WXK_ADD: // fall through + case WXK_NUMPAD_ADD: key = SCK_ADD; break; + case WXK_SUBTRACT: // fall through + case WXK_NUMPAD_SUBTRACT: key = SCK_SUBTRACT; break; + case WXK_DIVIDE: // fall through + case WXK_NUMPAD_DIVIDE: key = SCK_DIVIDE; break; + case WXK_CONTROL: key = 0; break; + case WXK_ALT: key = 0; break; + case WXK_SHIFT: key = 0; break; + case WXK_MENU: key = 0; break; } int rv = KeyDown(key, shift, ctrl, alt, consumed); diff --git a/contrib/src/stc/stc.cpp b/contrib/src/stc/stc.cpp index 24d1220b5d..6c468c320f 100644 --- a/contrib/src/stc/stc.cpp +++ b/contrib/src/stc/stc.cpp @@ -1920,9 +1920,6 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) { void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { int key = evt.GetKeyCode(); - // AltGr keys??? - // \|@#¬[]{}?£$~ ã,õ,Ã,Õ, ñ, Ñ - // On (some?) non-US keyboards the AltGr key is required to enter some // common characters. It comes to us as both Alt and Ctrl down so we need // to let the char through in that case, otherwise if only ctrl or only diff --git a/contrib/src/stc/stc.cpp.in b/contrib/src/stc/stc.cpp.in index 0e46fcf507..f6c30c0896 100644 --- a/contrib/src/stc/stc.cpp.in +++ b/contrib/src/stc/stc.cpp.in @@ -370,9 +370,6 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) { void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { int key = evt.GetKeyCode(); - // AltGr keys??? - // \|@#¬[]{}?£$~ ã,õ,Ã,Õ, ñ, Ñ - // On (some?) non-US keyboards the AltGr key is required to enter some // common characters. It comes to us as both Alt and Ctrl down so we need // to let the char through in that case, otherwise if only ctrl or only diff --git a/contrib/src/stc/stc.h.in b/contrib/src/stc/stc.h.in index 2a1d1314a5..f7b01cb837 100644 --- a/contrib/src/stc/stc.h.in +++ b/contrib/src/stc/stc.h.in @@ -149,6 +149,11 @@ public: // Set the horizontal scrollbar to use instead of the ont that's built-in. void SetHScrollBar(wxScrollBar* bar) { m_hScrollBar = bar; } + // Can be used to prevent the EVT_CHAR handler from adding the char + bool GetLastKeydownProcessed() { return m_lastKeyDownConsumed; } + void SetLastKeydownProcessed(bool val) { m_lastKeyDownConsumed = val; } + + //---------------------------------------------------------------------- diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index 1149ea620d..ab01bf1887 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -1799,6 +1799,11 @@ public: // Set the horizontal scrollbar to use instead of the ont that's built-in. void SetHScrollBar(wxScrollBar* bar) { m_hScrollBar = bar; } + // Can be used to prevent the EVT_CHAR handler from adding the char + bool GetLastKeydownProcessed() { return m_lastKeyDownConsumed; } + void SetLastKeydownProcessed(bool val) { m_lastKeyDownConsumed = val; } + + //---------------------------------------------------------------------- diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index 6cf99b3412..f7336a7196 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -510,33 +510,30 @@ int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* cons #endif switch (key) { - case WXK_DOWN: key = SCK_DOWN; break; - case WXK_UP: key = SCK_UP; break; - case WXK_LEFT: key = SCK_LEFT; break; - case WXK_RIGHT: key = SCK_RIGHT; break; - case WXK_HOME: key = SCK_HOME; break; - case WXK_END: key = SCK_END; break; - case WXK_PRIOR: key = SCK_PRIOR; break; - case WXK_NEXT: key = SCK_NEXT; break; - case WXK_DELETE: key = SCK_DELETE; break; - case WXK_INSERT: key = SCK_INSERT; break; - case WXK_ESCAPE: key = SCK_ESCAPE; break; - case WXK_BACK: key = SCK_BACK; break; - case WXK_TAB: key = SCK_TAB; break; - case WXK_RETURN: key = SCK_RETURN; break; - case WXK_ADD: - case WXK_NUMPAD_ADD: - key = SCK_ADD; break; - case WXK_SUBTRACT: - case WXK_NUMPAD_SUBTRACT: - key = SCK_SUBTRACT; break; - case WXK_DIVIDE: - case WXK_NUMPAD_DIVIDE: - key = SCK_DIVIDE; break; - case WXK_CONTROL: key = 0; break; - case WXK_ALT: key = 0; break; - case WXK_SHIFT: key = 0; break; - case WXK_MENU: key = 0; break; + case WXK_DOWN: key = SCK_DOWN; break; + case WXK_UP: key = SCK_UP; break; + case WXK_LEFT: key = SCK_LEFT; break; + case WXK_RIGHT: key = SCK_RIGHT; break; + case WXK_HOME: key = SCK_HOME; break; + case WXK_END: key = SCK_END; break; + case WXK_PRIOR: key = SCK_PRIOR; break; + case WXK_NEXT: key = SCK_NEXT; break; + case WXK_DELETE: key = SCK_DELETE; break; + case WXK_INSERT: key = SCK_INSERT; break; + case WXK_ESCAPE: key = SCK_ESCAPE; break; + case WXK_BACK: key = SCK_BACK; break; + case WXK_TAB: key = SCK_TAB; break; + case WXK_RETURN: key = SCK_RETURN; break; + case WXK_ADD: // fall through + case WXK_NUMPAD_ADD: key = SCK_ADD; break; + case WXK_SUBTRACT: // fall through + case WXK_NUMPAD_SUBTRACT: key = SCK_SUBTRACT; break; + case WXK_DIVIDE: // fall through + case WXK_NUMPAD_DIVIDE: key = SCK_DIVIDE; break; + case WXK_CONTROL: key = 0; break; + case WXK_ALT: key = 0; break; + case WXK_SHIFT: key = 0; break; + case WXK_MENU: key = 0; break; } int rv = KeyDown(key, shift, ctrl, alt, consumed); diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 24d1220b5d..6c468c320f 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -1920,9 +1920,6 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) { void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { int key = evt.GetKeyCode(); - // AltGr keys??? - // \|@#¬[]{}?£$~ ã,õ,Ã,Õ, ñ, Ñ - // On (some?) non-US keyboards the AltGr key is required to enter some // common characters. It comes to us as both Alt and Ctrl down so we need // to let the char through in that case, otherwise if only ctrl or only diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index 0e46fcf507..f6c30c0896 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -370,9 +370,6 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) { void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { int key = evt.GetKeyCode(); - // AltGr keys??? - // \|@#¬[]{}?£$~ ã,õ,Ã,Õ, ñ, Ñ - // On (some?) non-US keyboards the AltGr key is required to enter some // common characters. It comes to us as both Alt and Ctrl down so we need // to let the char through in that case, otherwise if only ctrl or only diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in index 2a1d1314a5..f7b01cb837 100644 --- a/src/stc/stc.h.in +++ b/src/stc/stc.h.in @@ -149,6 +149,11 @@ public: // Set the horizontal scrollbar to use instead of the ont that's built-in. void SetHScrollBar(wxScrollBar* bar) { m_hScrollBar = bar; } + // Can be used to prevent the EVT_CHAR handler from adding the char + bool GetLastKeydownProcessed() { return m_lastKeyDownConsumed; } + void SetLastKeydownProcessed(bool val) { m_lastKeyDownConsumed = val; } + + //---------------------------------------------------------------------- diff --git a/wxPython/contrib/stc/msw/stc_.cpp b/wxPython/contrib/stc/msw/stc_.cpp index 87c57954e8..ed6e85e081 100644 --- a/wxPython/contrib/stc/msw/stc_.cpp +++ b/wxPython/contrib/stc/msw/stc_.cpp @@ -9129,6 +9129,65 @@ static PyObject *_wrap_wxStyledTextCtrl_SetHScrollBar(PyObject *self, PyObject * return _resultobj; } +#define wxStyledTextCtrl_GetLastKeydownProcessed(_swigobj) (_swigobj->GetLastKeydownProcessed()) +static PyObject *_wrap_wxStyledTextCtrl_GetLastKeydownProcessed(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetLastKeydownProcessed",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLastKeydownProcessed. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxStyledTextCtrl_GetLastKeydownProcessed(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetLastKeydownProcessed(_swigobj,_swigarg0) (_swigobj->SetLastKeydownProcessed(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetLastKeydownProcessed(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + bool _arg1; + PyObject * _argo0 = 0; + int tempbool1; + char *_kwnames[] = { "self","val", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetLastKeydownProcessed",_kwnames,&_argo0,&tempbool1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetLastKeydownProcessed. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxStyledTextCtrl_SetLastKeydownProcessed(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + static void *SwigwxStyledTextEventTowxCommandEvent(void *ptr) { wxStyledTextEvent *src; wxCommandEvent *dest; @@ -10555,6 +10614,8 @@ static PyMethodDef stc_cMethods[] = { { "wxStyledTextEvent_SetPosition", (PyCFunction) _wrap_wxStyledTextEvent_SetPosition, METH_VARARGS | METH_KEYWORDS }, { "delete_wxStyledTextEvent", (PyCFunction) _wrap_delete_wxStyledTextEvent, METH_VARARGS | METH_KEYWORDS }, { "new_wxStyledTextEvent", (PyCFunction) _wrap_new_wxStyledTextEvent, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetLastKeydownProcessed", (PyCFunction) _wrap_wxStyledTextCtrl_SetLastKeydownProcessed, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLastKeydownProcessed", (PyCFunction) _wrap_wxStyledTextCtrl_GetLastKeydownProcessed, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_SetHScrollBar", (PyCFunction) _wrap_wxStyledTextCtrl_SetHScrollBar, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_SetVScrollBar", (PyCFunction) _wrap_wxStyledTextCtrl_SetVScrollBar, METH_VARARGS | METH_KEYWORDS }, { "wxStyledTextCtrl_SendMsg", (PyCFunction) _wrap_wxStyledTextCtrl_SendMsg, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/contrib/stc/msw/stc_.py b/wxPython/contrib/stc/msw/stc_.py index a7a8e8718a..26ec754ee3 100644 --- a/wxPython/contrib/stc/msw/stc_.py +++ b/wxPython/contrib/stc/msw/stc_.py @@ -981,6 +981,12 @@ class wxStyledTextCtrlPtr(wxControlPtr): def SetHScrollBar(self, *_args, **_kwargs): val = apply(stc_c.wxStyledTextCtrl_SetHScrollBar,(self,) + _args, _kwargs) return val + def GetLastKeydownProcessed(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLastKeydownProcessed,(self,) + _args, _kwargs) + return val + def SetLastKeydownProcessed(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetLastKeydownProcessed,(self,) + _args, _kwargs) + return val def __repr__(self): return "" % (self.this,) class wxStyledTextCtrl(wxStyledTextCtrlPtr): -- 2.45.2