Added STCDLLEXPORT so wxSTC could be built and used as a DLL.

Fixed DoAddChar handling in unicode mode to translate the char to UTF8
if needed.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17420 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-10-02 00:15:07 +00:00
parent f50b6e1d9b
commit ce500334d8
5 changed files with 42 additions and 12 deletions

View File

@@ -24,6 +24,12 @@
#include <wx/wx.h>
#include <wx/dnd.h>
#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

View File

@@ -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...

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -24,6 +24,12 @@
#include <wx/wx.h>
#include <wx/dnd.h>
#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