merged 2.4 branch into the trunk

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18040 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-12-04 14:11:26 +00:00
parent 59a944cb63
commit 2b5f62a0b2
1057 changed files with 37805 additions and 24034 deletions

View File

@@ -9,13 +9,13 @@ top_srcdir = @top_srcdir@/..
top_builddir = ../../..
scintilla_dir = $(top_srcdir)/contrib/src/stc/scintilla
libsrc_dir = contrib/src/stc@PATH_IFS@$(scintilla_dir)/src
libsrc_dir = contrib/src/stc/scintilla/src:$(top_srcdir)/contrib/src/stc
TARGET_LIBNAME=libstc
TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_stc-@WX_RELEASE@
LIBVERSION_CURRENT=1
LIBVERSION_REVISION=0
LIBVERSION_AGE=0
LIBVERSION_CURRENT=@WX_CURRENT@
LIBVERSION_REVISION=@WX_REVISION@
LIBVERSION_AGE=@WX_AGE@
HEADER_PATH=$(top_srcdir)/contrib/include/wx
HEADER_SUBDIR=stc

View File

@@ -804,7 +804,7 @@ void ListBox::Clear() {
}
void ListBox::Append(char *s) {
GETLB(id)->Append(s);
GETLB(id)->Append(stc2wx(s));
}
int ListBox::Length() {

View File

@@ -338,7 +338,7 @@ void ScintillaWX::Copy() {
SelectionText st;
CopySelectionRange(&st);
if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection();
wxTheClipboard->UsePrimarySelection(FALSE);
wxString text = stc2wx(st.s, st.len);
wxTheClipboard->SetData(new wxTextDataObject(text));
wxTheClipboard->Close();
@@ -355,7 +355,7 @@ void ScintillaWX::Paste() {
bool gotData = FALSE;
if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection();
wxTheClipboard->UsePrimarySelection(FALSE);
gotData = wxTheClipboard->GetData(data);
wxTheClipboard->Close();
}
@@ -380,7 +380,7 @@ bool ScintillaWX::CanPaste() {
wxTheClipboard->Open();
if (wxTheClipboard->IsOpened()) {
wxTheClipboard->UsePrimarySelection();
wxTheClipboard->UsePrimarySelection(FALSE);
canPaste = wxTheClipboard->IsSupported(wxUSE_UNICODE ? wxDF_UNICODETEXT : wxDF_TEXT);
if (didOpen)
wxTheClipboard->Close();
@@ -405,8 +405,22 @@ void ScintillaWX::AddToPopUp(const char *label, int cmd, bool enabled) {
}
// This is called by the Editor base class whenever something is selected
void ScintillaWX::ClaimSelection() {
#ifdef __WXGTK__
// Put the selected text in the PRIMARY selection
if (currentPos != anchor) {
SelectionText st;
CopySelectionRange(&st);
if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection(TRUE);
wxString text = stc2wx(st.s, st.len);
wxTheClipboard->SetData(new wxTextDataObject(text));
wxTheClipboard->UsePrimarySelection(FALSE);
wxTheClipboard->Close();
}
}
#endif
}
@@ -547,23 +561,64 @@ void ScintillaWX::DoSysColourChange() {
InvalidateStyleData();
}
void ScintillaWX::DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) {
void ScintillaWX::DoLeftButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) {
ButtonDown(pt, curTime, shift, ctrl, alt);
}
void ScintillaWX::DoButtonUp(Point pt, unsigned int curTime, bool ctrl) {
void ScintillaWX::DoLeftButtonUp(Point pt, unsigned int curTime, bool ctrl) {
ButtonUp(pt, curTime, ctrl);
}
void ScintillaWX::DoButtonMove(Point pt) {
void ScintillaWX::DoLeftButtonMove(Point pt) {
ButtonMove(pt);
}
void ScintillaWX::DoMiddleButtonUp(Point pt) {
#ifdef __WXGTK__
// Set the current position to the mouse click point and
// then paste in the PRIMARY selection, if any. wxGTK only.
int newPos = PositionFromLocation(pt);
MovePositionTo(newPos, 0, 1);
pdoc->BeginUndoAction();
wxTextDataObject data;
bool gotData = FALSE;
if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection(TRUE);
gotData = wxTheClipboard->GetData(data);
wxTheClipboard->UsePrimarySelection(FALSE);
wxTheClipboard->Close();
}
if (gotData) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(data.GetText());
int len = strlen(buf);
pdoc->InsertString(currentPos, buf, len);
SetEmptySelection(currentPos + len);
}
pdoc->EndUndoAction();
NotifyChange();
Redraw();
ShowCaretAtCurrentPosition();
EnsureCaretVisible();
#endif
}
void ScintillaWX::DoAddChar(int key) {
#if wxUSE_UNICODE
char ansiChars[3];
ansiChars[0] = key;
ansiChars[1] = 0;
wxString uniChar(ansiChars, wxConvLocal);
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

@@ -122,9 +122,10 @@ public:
void DoLoseFocus();
void DoGainFocus();
void DoSysColourChange();
void DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
void DoButtonUp(Point pt, unsigned int curTime, bool ctrl);
void DoButtonMove(Point pt);
void DoLeftButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
void DoLeftButtonUp(Point pt, unsigned int curTime, bool ctrl);
void DoLeftButtonMove(Point pt);
void DoMiddleButtonUp(Point pt);
void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown, bool isPageScroll);
void DoAddChar(int key);
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);

View File

@@ -36,7 +36,13 @@ valPrefixes = [('SCI_', ''),
]
# Message function values that should have a CMD_ constant as well
cmdValues = [ (2300, 2350), 2011, 2013, (2176, 2180) ]
cmdValues = [ (2300, 2349),
2011,
2013,
(2176, 2180),
(2390, 2393),
(2395, 2396),
]
# Map some generic typenames to wx types, using return value syntax
@@ -420,6 +426,54 @@ methodOverrideMap = {
0),
'GetDocPointer' : (0,
'void* %s();',
'''void* %s() {
return (void*)SendMsg(%s);''',
0),
'SetDocPointer' : (0,
'void %s(void* docPointer);',
'''void %s(void* docPointer) {
SendMsg(%s, 0, (long)docPointer);''',
0),
'CreateDocument' : (0,
'void* %s();',
'''void* %s() {
return (void*)SendMsg(%s);''',
0),
'AddRefDocument' : (0,
'void %s(void* docPointer);',
'''void %s(void* docPointer) {
SendMsg(%s, 0, (long)docPointer);''',
0),
'ReleaseDocument' : (0,
'void %s(void* docPointer);',
'''void %s(void* docPointer) {
SendMsg(%s, 0, (long)docPointer);''',
0),
'SetCodePage' : (0,
0,
'''void %s(int codePage) {
#if wxUSE_UNICODE
wxASSERT_MSG(codePage == wxSTC_CP_UTF8,
wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
#else
wxASSERT_MSG(codePage != wxSTC_CP_UTF8,
wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
#endif
SendMsg(%s, codePage);''',
("Set the code page used to interpret the bytes of the document as characters.",) ),
'GrabFocus' : (None, 0, 0, 0),
'SetFocus' : ('SetSTCFocus', 0, 0, 0),
'GetFocus' : ('GetSTCFocus', 0, 0, 0),
# Remove all methods that are key commands since they can be
# executed with CmdKeyExecute
@@ -470,53 +524,6 @@ methodOverrideMap = {
'DeleteBackNotLine' : (None, 0, 0, 0),
'GetDocPointer' : (0,
'void* %s();',
'''void* %s() {
return (void*)SendMsg(%s);''',
0),
'SetDocPointer' : (0,
'void %s(void* docPointer);',
'''void %s(void* docPointer) {
SendMsg(%s, 0, (long)docPointer);''',
0),
'CreateDocument' : (0,
'void* %s();',
'''void* %s() {
return (void*)SendMsg(%s);''',
0),
'AddRefDocument' : (0,
'void %s(void* docPointer);',
'''void %s(void* docPointer) {
SendMsg(%s, 0, (long)docPointer);''',
0),
'ReleaseDocument' : (0,
'void %s(void* docPointer);',
'''void %s(void* docPointer) {
SendMsg(%s, 0, (long)docPointer);''',
0),
'SetCodePage' : (0,
0,
'''void %s(int codePage) {
#if wxUSE_UNICODE
wxASSERT_MSG(codePage == wxSTC_CP_UTF8,
wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
#else
wxASSERT_MSG(codePage != wxSTC_CP_UTF8,
wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
#endif
SendMsg(%s, codePage);''',
("Set the code page used to interpret the bytes of the document as characters.",) ),
'GrabFocus' : (None, 0, 0, 0),
'SetFocus' : ('SetSTCFocus', 0, 0, 0),
'GetFocus' : ('GetSTCFocus', 0, 0, 0),
'' : ('', 0, 0, 0),
@@ -529,6 +536,7 @@ def processIface(iface, h_tmplt, cpp_tmplt, h_dest, cpp_dest):
curDocStrings = []
values = []
methods = []
cmds = []
# parse iface file
fi = FileInput(iface)
@@ -547,7 +555,7 @@ def processIface(iface, h_tmplt, cpp_tmplt, h_dest, cpp_dest):
curDocStrings = []
elif op == 'fun ' or op == 'set ' or op == 'get ':
parseFun(line[4:], methods, curDocStrings, values)
parseFun(line[4:], methods, curDocStrings, cmds)
curDocStrings = []
elif op == 'cat ':
@@ -570,6 +578,7 @@ def processIface(iface, h_tmplt, cpp_tmplt, h_dest, cpp_dest):
# process templates
data = {}
data['VALUES'] = processVals(values)
data['CMDS'] = processVals(cmds)
defs, imps = processMethods(methods)
data['METHOD_DEFS'] = defs
data['METHOD_IMPS'] = imps
@@ -747,10 +756,10 @@ def parseFun(line, methods, docs, values):
param1 = parseParam(param1)
param2 = parseParam(param2)
# Special case. For the key command functionss we want a value defined too
# Special case. For the key command functions we want a value defined too
num = string.atoi(number)
for v in cmdValues:
if (type(v) == type(()) and v[0] <= num < v[1]) or v == num:
if (type(v) == type(()) and v[0] <= num <= v[1]) or v == num:
parseVal('CMD_%s=%s' % (string.upper(name), number), values, docs)
#if retType == 'void' and not param1 and not param2:

View File

@@ -369,7 +369,11 @@ public:
*/
inline char *StringDup(
const char *s, ///< The string to duplicate
SString::lenpos_t len=SString::measure_length) ///< The length of memory to allocate. Optional.
/* gcc 2.96 doesn't seem to like this syntax: gives
'non-local function uses anonymous type'
SString::lenpos_t len=SString::measure_length) ///< The length of memory to allocate. Optional.
*/
SString::lenpos_t len=0xffffffffU) ///< The length of memory to allocate. Optional.
{
return SString::StringAllocate(s, len);
}

View File

@@ -1130,14 +1130,14 @@ fun void DeleteBackNotLine=2344(,)
# Move caret to first position on display line.
fun void HomeDisplay=2345(,)
# Move caret to first position on display line extending selection to
# Move caret to first position on display line extending selection to
# new caret position.
fun void HomeDisplayExtend=2346(,)
# Move caret to last position on display line.
fun void LineEndDisplay=2347(,)
# Move caret to last position on display line extending selection to new
# Move caret to last position on display line extending selection to new
# caret position.
fun void LineEndDisplayExtend=2348(,)

View File

@@ -70,7 +70,7 @@ void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
}
if (ac.Active()) {
AutoCompleteCharacterAdded(s[0]);
// For fill ups add the character after the autocompletion has
// For fill ups add the character after the autocompletion has
// triggered so containers see the key so can display a calltip.
if (isFillUp) {
Editor::AddCharUTF(s, len, treatAsDBCS);
@@ -317,6 +317,7 @@ void ScintillaBase::AutoCompleteCompleted() {
scn.nmhdr.code = SCN_USERLISTSELECTION;
scn.message = 0;
scn.wParam = listType;
scn.listType = listType;
scn.lParam = 0;
scn.text = userListSelected.c_str();
NotifyParent(scn);

View File

@@ -90,10 +90,8 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
EVT_SCROLL (wxStyledTextCtrl::OnScroll)
EVT_SIZE (wxStyledTextCtrl::OnSize)
EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown)
#if defined(__WXMSW__) || defined(__WXMAC__)
// Let Scintilla see the double click as a second click
EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown)
#endif
EVT_MOTION (wxStyledTextCtrl::OnMouseMove)
EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp)
#if defined(__WXGTK__) || defined(__WXMAC__)
@@ -102,6 +100,7 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu)
#endif
EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel)
EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp)
EVT_CHAR (wxStyledTextCtrl::OnChar)
EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown)
EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus)
@@ -1478,7 +1477,7 @@ void wxStyledTextCtrl::HomeDisplay() {
SendMsg(2345, 0, 0);
}
// Move caret to first position on display line extending selection to
// Move caret to first position on display line extending selection to
// new caret position.
void wxStyledTextCtrl::HomeDisplayExtend() {
SendMsg(2346, 0, 0);
@@ -1489,7 +1488,7 @@ void wxStyledTextCtrl::LineEndDisplay() {
SendMsg(2347, 0, 0);
}
// Move caret to last position on display line extending selection to new
// Move caret to last position on display line extending selection to new
// caret position.
void wxStyledTextCtrl::LineEndDisplayExtend() {
SendMsg(2348, 0, 0);
@@ -1959,18 +1958,18 @@ void wxStyledTextCtrl::OnSize(wxSizeEvent& evt) {
void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent& evt) {
SetFocus();
wxPoint pt = evt.GetPosition();
m_swx->DoButtonDown(Point(pt.x, pt.y), m_stopWatch.Time(),
m_swx->DoLeftButtonDown(Point(pt.x, pt.y), m_stopWatch.Time(),
evt.ShiftDown(), evt.ControlDown(), evt.AltDown());
}
void wxStyledTextCtrl::OnMouseMove(wxMouseEvent& evt) {
wxPoint pt = evt.GetPosition();
m_swx->DoButtonMove(Point(pt.x, pt.y));
m_swx->DoLeftButtonMove(Point(pt.x, pt.y));
}
void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent& evt) {
wxPoint pt = evt.GetPosition();
m_swx->DoButtonUp(Point(pt.x, pt.y), m_stopWatch.Time(),
m_swx->DoLeftButtonUp(Point(pt.x, pt.y), m_stopWatch.Time(),
evt.ControlDown());
}
@@ -1981,6 +1980,11 @@ void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
}
void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent& evt) {
wxPoint pt = evt.GetPosition();
m_swx->DoMiddleButtonUp(Point(pt.x, pt.y));
}
void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
wxPoint pt = evt.GetPosition();
ScreenToClient(&pt.x, &pt.y);
@@ -1998,8 +2002,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 +2010,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;
}
@@ -2076,6 +2081,20 @@ void wxStyledTextCtrl::NotifyChange() {
GetEventHandler()->ProcessEvent(evt);
}
static void SetEventText(wxStyledTextEvent& evt, const char* text,
size_t length) {
if(!text) return;
// The unicode conversion MUST have a null byte to terminate the
// string so move it into a buffer first and give it one.
wxMemoryBuffer buf(length+1);
buf.AppendData((void*)text, length);
buf.AppendByte(0);
evt.SetText(stc2wx(buf));
}
void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
SCNotification& scn = *_scn;
wxStyledTextEvent evt(0, GetId());
@@ -2121,14 +2140,7 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
case SCN_MODIFIED:
evt.SetEventType(wxEVT_STC_MODIFIED);
evt.SetModificationType(scn.modificationType);
if (scn.text) {
// The unicode conversion MUST have a null byte to terminate the
// string so move it into a buffer first and give it one.
wxMemoryBuffer buf(scn.length+1);
buf.AppendData((void*)scn.text, scn.length);
buf.AppendByte(0);
evt.SetText(stc2wx(buf));
}
SetEventText(evt, scn.text, scn.length);
evt.SetLength(scn.length);
evt.SetLinesAdded(scn.linesAdded);
evt.SetLine(scn.line);
@@ -2160,12 +2172,12 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
case SCN_USERLISTSELECTION:
evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
evt.SetListType(scn.listType);
evt.SetText(scn.text);
SetEventText(evt, scn.text, strlen(scn.text));
break;
case SCN_URIDROPPED:
evt.SetEventType(wxEVT_STC_URIDROPPED);
evt.SetText(scn.text);
SetEventText(evt, scn.text, strlen(scn.text));
break;
case SCN_DWELLSTART:

View File

@@ -90,10 +90,8 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
EVT_SCROLL (wxStyledTextCtrl::OnScroll)
EVT_SIZE (wxStyledTextCtrl::OnSize)
EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown)
#if defined(__WXMSW__) || defined(__WXMAC__)
// Let Scintilla see the double click as a second click
EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown)
#endif
EVT_MOTION (wxStyledTextCtrl::OnMouseMove)
EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp)
#if defined(__WXGTK__) || defined(__WXMAC__)
@@ -102,6 +100,7 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu)
#endif
EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel)
EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp)
EVT_CHAR (wxStyledTextCtrl::OnChar)
EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown)
EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus)
@@ -337,18 +336,18 @@ void wxStyledTextCtrl::OnSize(wxSizeEvent& evt) {
void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent& evt) {
SetFocus();
wxPoint pt = evt.GetPosition();
m_swx->DoButtonDown(Point(pt.x, pt.y), m_stopWatch.Time(),
m_swx->DoLeftButtonDown(Point(pt.x, pt.y), m_stopWatch.Time(),
evt.ShiftDown(), evt.ControlDown(), evt.AltDown());
}
void wxStyledTextCtrl::OnMouseMove(wxMouseEvent& evt) {
wxPoint pt = evt.GetPosition();
m_swx->DoButtonMove(Point(pt.x, pt.y));
m_swx->DoLeftButtonMove(Point(pt.x, pt.y));
}
void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent& evt) {
wxPoint pt = evt.GetPosition();
m_swx->DoButtonUp(Point(pt.x, pt.y), m_stopWatch.Time(),
m_swx->DoLeftButtonUp(Point(pt.x, pt.y), m_stopWatch.Time(),
evt.ControlDown());
}
@@ -359,6 +358,11 @@ void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
}
void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent& evt) {
wxPoint pt = evt.GetPosition();
m_swx->DoMiddleButtonUp(Point(pt.x, pt.y));
}
void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
wxPoint pt = evt.GetPosition();
ScreenToClient(&pt.x, &pt.y);
@@ -376,8 +380,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 +388,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;
}
@@ -454,6 +459,20 @@ void wxStyledTextCtrl::NotifyChange() {
GetEventHandler()->ProcessEvent(evt);
}
static void SetEventText(wxStyledTextEvent& evt, const char* text,
size_t length) {
if(!text) return;
// The unicode conversion MUST have a null byte to terminate the
// string so move it into a buffer first and give it one.
wxMemoryBuffer buf(length+1);
buf.AppendData((void*)text, length);
buf.AppendByte(0);
evt.SetText(stc2wx(buf));
}
void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
SCNotification& scn = *_scn;
wxStyledTextEvent evt(0, GetId());
@@ -499,14 +518,7 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
case SCN_MODIFIED:
evt.SetEventType(wxEVT_STC_MODIFIED);
evt.SetModificationType(scn.modificationType);
if (scn.text) {
// The unicode conversion MUST have a null byte to terminate the
// string so move it into a buffer first and give it one.
wxMemoryBuffer buf(scn.length+1);
buf.AppendData((void*)scn.text, scn.length);
buf.AppendByte(0);
evt.SetText(stc2wx(buf));
}
SetEventText(evt, scn.text, scn.length);
evt.SetLength(scn.length);
evt.SetLinesAdded(scn.linesAdded);
evt.SetLine(scn.line);
@@ -538,12 +550,12 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
case SCN_USERLISTSELECTION:
evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
evt.SetListType(scn.listType);
evt.SetText(scn.text);
SetEventText(evt, scn.text, strlen(scn.text));
break;
case SCN_URIDROPPED:
evt.SetEventType(wxEVT_STC_URIDROPPED);
evt.SetText(scn.text);
SetEventText(evt, scn.text, strlen(scn.text));
break;
case SCN_DWELLSTART:

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?
@@ -38,6 +44,12 @@
%(VALUES)s
//-----------------------------------------
// Commands that can be bound to keystrokes
%(CMDS)s
// END of generated section
//----------------------------------------------------------------------
@@ -45,8 +57,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
//----------------------------------------------------------------------
@@ -175,6 +190,7 @@ private:
void OnMouseMove(wxMouseEvent& evt);
void OnMouseLeftUp(wxMouseEvent& evt);
void OnMouseRightUp(wxMouseEvent& evt);
void OnMouseMiddleUp(wxMouseEvent& evt);
void OnContextMenu(wxContextMenuEvent& evt);
void OnMouseWheel(wxMouseEvent& evt);
void OnChar(wxKeyEvent& evt);
@@ -210,7 +226,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