diff --git a/contrib/include/wx/stc/stc.h b/contrib/include/wx/stc/stc.h index 640eac8baf..3e056fc85d 100644 --- a/contrib/include/wx/stc/stc.h +++ b/contrib/include/wx/stc/stc.h @@ -24,6 +24,12 @@ #include #include +#ifdef STCISDLL +#define STCDLLEXPORT WXDLLEXPORT +#else +#define STCDLLEXPORT +#endif + //---------------------------------------------------------------------- // Should a wxPopupWindow be used for the call tips and autocomplete windows? @@ -873,8 +879,11 @@ class ScintillaWX; // forward declare class WordList; struct SCNotification; - -extern const wxChar* wxSTCNameStr; +#ifndef SWIG +extern STCDLLEXPORT const wxChar* wxSTCNameStr; +class STCDLLEXPORT wxStyledTextCtrl; +class STCDLLEXPORT wxStyledTextEvent; +#endif //---------------------------------------------------------------------- @@ -1968,7 +1977,7 @@ private: //---------------------------------------------------------------------- -// SWIG can't handle "#if" type of conditionals, onlu "#ifdef" +// SWIG can't handle "#if" type of conditionals, only "#ifdef" #ifdef SWIG #define STC_USE_DND 1 #else diff --git a/contrib/src/stc/ScintillaWX.cpp b/contrib/src/stc/ScintillaWX.cpp index f1c0e43a0a..b5b7116670 100644 --- a/contrib/src/stc/ScintillaWX.cpp +++ b/contrib/src/stc/ScintillaWX.cpp @@ -561,9 +561,19 @@ void ScintillaWX::DoButtonMove(Point pt) { void ScintillaWX::DoAddChar(int key) { +#if wxUSE_UNICODE + char ansiChars[3]; + ansiChars[0] = key; + ansiChars[1] = 0; + wxString uniChar(ansiChars); + wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(uniChar); + AddCharUTF((char*)buf.data(), strlen(buf)); +#else AddChar(key); +#endif } + int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed) { #if defined(__WXGTK__) || defined(__WXMAC__) // Ctrl chars (A-Z) end up with the wrong keycode on wxGTK... diff --git a/contrib/src/stc/stc.cpp b/contrib/src/stc/stc.cpp index d675e8da9d..4bf4e54ec2 100644 --- a/contrib/src/stc/stc.cpp +++ b/contrib/src/stc/stc.cpp @@ -1998,8 +1998,6 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) { void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { - int key = evt.GetKeyCode(); - // 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 @@ -2008,10 +2006,13 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { bool alt = evt.AltDown(); bool skip = ((ctrl || alt) && ! (ctrl && alt)); + int key = evt.GetKeyCode(); + // printf("OnChar key:%d consumed:%d ctrl:%d alt:%d skip:%d\n", // key, m_lastKeyDownConsumed, ctrl, alt, skip); - if (key <= WXK_START && /*key >= 32 &&*/ !m_lastKeyDownConsumed && !skip) { + if ( (key <= WXK_START || key > WXK_NUMPAD_DIVIDE) && + !m_lastKeyDownConsumed && !skip) { m_swx->DoAddChar(key); return; } diff --git a/contrib/src/stc/stc.cpp.in b/contrib/src/stc/stc.cpp.in index 3e1b761faf..afced34940 100644 --- a/contrib/src/stc/stc.cpp.in +++ b/contrib/src/stc/stc.cpp.in @@ -376,8 +376,6 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) { void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { - int key = evt.GetKeyCode(); - // 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 @@ -386,10 +384,13 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { bool alt = evt.AltDown(); bool skip = ((ctrl || alt) && ! (ctrl && alt)); + int key = evt.GetKeyCode(); + // printf("OnChar key:%%d consumed:%%d ctrl:%%d alt:%%d skip:%%d\n", // key, m_lastKeyDownConsumed, ctrl, alt, skip); - if (key <= WXK_START && /*key >= 32 &&*/ !m_lastKeyDownConsumed && !skip) { + if ( (key <= WXK_START || key > WXK_NUMPAD_DIVIDE) && + !m_lastKeyDownConsumed && !skip) { m_swx->DoAddChar(key); return; } diff --git a/contrib/src/stc/stc.h.in b/contrib/src/stc/stc.h.in index 157a7bfc23..c819805c3c 100644 --- a/contrib/src/stc/stc.h.in +++ b/contrib/src/stc/stc.h.in @@ -24,6 +24,12 @@ #include #include +#ifdef STCISDLL +#define STCDLLEXPORT WXDLLEXPORT +#else +#define STCDLLEXPORT +#endif + //---------------------------------------------------------------------- // Should a wxPopupWindow be used for the call tips and autocomplete windows? @@ -45,8 +51,11 @@ class ScintillaWX; // forward declare class WordList; struct SCNotification; - -extern const wxChar* wxSTCNameStr; +#ifndef SWIG +extern STCDLLEXPORT const wxChar* wxSTCNameStr; +class STCDLLEXPORT wxStyledTextCtrl; +class STCDLLEXPORT wxStyledTextEvent; +#endif //---------------------------------------------------------------------- @@ -210,7 +219,7 @@ private: //---------------------------------------------------------------------- -// SWIG can't handle "#if" type of conditionals, onlu "#ifdef" +// SWIG can't handle "#if" type of conditionals, only "#ifdef" #ifdef SWIG #define STC_USE_DND 1 #else