X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/64a3ee5fd2926c3e5341af2e4d62925fddb90c43..80d2803f703d1b238f42725504f08266ef02defe:/src/stc/stc.cpp diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 2594133bfc..3fde7ae05d 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -26,7 +26,7 @@ // If we don't do something like this, then the linker tends to "optimize" // them away. (eric@sourcegear.com) -int wxForceScintillaLexers(void) +static int wxForceScintillaLexers(void) { extern LexerModule lmCPP; extern LexerModule lmHTML; @@ -39,6 +39,7 @@ int wxForceScintillaLexers(void) extern LexerModule lmPython; extern LexerModule lmSQL; extern LexerModule lmVB; + extern LexerModule lmLua; if ( &lmCPP @@ -52,14 +53,11 @@ int wxForceScintillaLexers(void) && &lmPython && &lmSQL && &lmVB + && &lmLua ) { return 1; } - else - { - return 0; - } } //---------------------------------------------------------------------- @@ -75,13 +73,19 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl) EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp) EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp) EVT_CHAR (wxStyledTextCtrl::OnChar) + EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown) EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus) EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus) EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged) EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground) EVT_MENU_RANGE (-1, -1, wxStyledTextCtrl::OnMenu) + EVT_LISTBOX_DCLICK (-1, wxStyledTextCtrl::OnListBox) END_EVENT_TABLE() + +IMPLEMENT_CLASS(wxStyledTextCtrl, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent) + //---------------------------------------------------------------------- // Constructor and Destructor @@ -111,7 +115,7 @@ wxStyledTextCtrl::~wxStyledTextCtrl() { //---------------------------------------------------------------------- -inline long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) { +long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) { return m_swx->WndProc(msg, wp, lp); } @@ -123,16 +127,17 @@ inline long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) { wxString wxStyledTextCtrl::GetText() { wxString text; int len = GetTextLength(); - char* buff = text.GetWriteBuf(len); + char* buff = text.GetWriteBuf(len+1); - SendMsg(WM_GETTEXT, len, (long)buff); + SendMsg(SCI_GETTEXT, len, (long)buff); + buff[len] = 0; text.UngetWriteBuf(); return text; } bool wxStyledTextCtrl::SetText(const wxString& text) { - return SendMsg(WM_SETTEXT, 0, (long)text.c_str()) != 0; + return SendMsg(SCI_SETTEXT, 0, (long)text.c_str()) != 0; } @@ -141,20 +146,20 @@ wxString wxStyledTextCtrl::GetLine(int line) { int len = GetLineLength(line); char* buff = text.GetWriteBuf(len+1); - *((WORD*)buff) = len+1; - SendMsg(EM_GETLINE, line, (long)buff); + SendMsg(SCI_GETLINE, line, (long)buff); + buff[len] = 0; text.UngetWriteBuf(); return text; } void wxStyledTextCtrl::ReplaceSelection(const wxString& text) { - SendMsg(EM_REPLACESEL, 0, (long)text.c_str()); + SendMsg(SCI_REPLACESEL, 0, (long)text.c_str()); } void wxStyledTextCtrl::SetReadOnly(bool readOnly) { - SendMsg(EM_SETREADONLY, (long)readOnly); + SendMsg(SCI_SETREADONLY, (long)readOnly); m_readOnly = readOnly; } @@ -167,18 +172,18 @@ bool wxStyledTextCtrl::GetReadOnly() { void wxStyledTextCtrl::GetTextRange(int startPos, int endPos, char* buff) { - TEXTRANGE tr; + TextRange tr; tr.lpstrText = buff; tr.chrg.cpMin = startPos; tr.chrg.cpMax = endPos; - SendMsg(EM_GETTEXTRANGE, 0, (long)&tr); + SendMsg(SCI_GETTEXTRANGE, 0, (long)&tr); } wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) { wxString text; int len = endPos - startPos; - char* buff = text.GetWriteBuf(len); + char* buff = text.GetWriteBuf(len+1); GetTextRange(startPos, endPos, buff); text.UngetWriteBuf(); return text; @@ -186,7 +191,7 @@ wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) { void wxStyledTextCtrl::GetStyledTextRange(int startPos, int endPos, char* buff) { - TEXTRANGE tr; + TextRange tr; tr.lpstrText = buff; tr.chrg.cpMin = startPos; tr.chrg.cpMax = endPos; @@ -197,7 +202,7 @@ void wxStyledTextCtrl::GetStyledTextRange(int startPos, int endPos, char* buff) wxString wxStyledTextCtrl::GetStyledTextRange(int startPos, int endPos) { wxString text; int len = endPos - startPos; - char* buff = text.GetWriteBuf(len*2); + char* buff = text.GetWriteBuf(len*2+1); GetStyledTextRange(startPos, endPos, buff); text.UngetWriteBuf(len*2); return text; @@ -249,27 +254,27 @@ int wxStyledTextCtrl::GetStyleBits() { void wxStyledTextCtrl::Cut() { - SendMsg(WM_CUT); + SendMsg(SCI_CUT); } void wxStyledTextCtrl::Copy() { - SendMsg(WM_COPY); + SendMsg(SCI_COPY); } void wxStyledTextCtrl::Paste() { - SendMsg(WM_PASTE); + SendMsg(SCI_PASTE); } bool wxStyledTextCtrl::CanPaste() { - return SendMsg(EM_CANPASTE) != 0; + return SendMsg(SCI_CANPASTE) != 0; } void wxStyledTextCtrl::ClearClipbrd() { - SendMsg(WM_CLEAR); + SendMsg(SCI_CLEAR); } @@ -278,17 +283,17 @@ void wxStyledTextCtrl::ClearClipbrd() { // Undo and Redo void wxStyledTextCtrl::Undo() { - SendMsg(WM_UNDO); + SendMsg(SCI_UNDO); } bool wxStyledTextCtrl::CanUndo() { - return SendMsg(EM_CANUNDO) != 0; + return SendMsg(SCI_CANUNDO) != 0; } void wxStyledTextCtrl::EmptyUndoBuffer() { - SendMsg(EM_EMPTYUNDOBUFFER); + SendMsg(SCI_EMPTYUNDOBUFFER); } @@ -332,12 +337,14 @@ void wxStyledTextCtrl::EndUndoAction() { void wxStyledTextCtrl::GetSelection(int* startPos, int* endPos) { - SendMsg(EM_GETSEL, (long)startPos, (long)endPos); +// SendMsg(EM_GETSEL, (long)startPos, (long)endPos); + *startPos = SendMsg(SCI_GETSELECTIONSTART); + *endPos = SendMsg(SCI_GETSELECTIONEND); } void wxStyledTextCtrl::SetSelection(int startPos, int endPos) { - SendMsg(EM_SETSEL, startPos, endPos); + SendMsg(SCI_SETSEL, startPos, endPos); } @@ -348,16 +355,16 @@ wxString wxStyledTextCtrl::GetSelectedText() { GetSelection(&start, &end); int len = end - start; - char* buff = text.GetWriteBuf(len); + char* buff = text.GetWriteBuf(len+1); - SendMsg(EM_GETSELTEXT, 0, (long)buff); + SendMsg(SCI_GETSELTEXT, 0, (long)buff); text.UngetWriteBuf(); return text; } void wxStyledTextCtrl::HideSelection(bool hide) { - SendMsg(EM_HIDESELECTION, hide); + SendMsg(SCI_HIDESELECTION, hide); } @@ -367,46 +374,32 @@ bool wxStyledTextCtrl::GetHideSelection() { int wxStyledTextCtrl::GetTextLength() { - return SendMsg(WM_GETTEXTLENGTH); + return SendMsg(SCI_GETTEXTLENGTH); } int wxStyledTextCtrl::GetFirstVisibleLine() { - return SendMsg(EM_GETFIRSTVISIBLELINE); + return SendMsg(SCI_GETFIRSTVISIBLELINE); } int wxStyledTextCtrl::GetLineCount() { - return SendMsg(EM_GETLINECOUNT); + return SendMsg(SCI_GETLINECOUNT); } bool wxStyledTextCtrl::GetModified() { - return SendMsg(EM_GETMODIFY) != 0; -} - - -wxRect wxStyledTextCtrl::GetRect() { - PRectangle pr; - SendMsg(EM_GETRECT, 0, (long)&pr); - - wxRect rect = wxRectFromPRectangle(pr); - return rect; + return SendMsg(SCI_GETMODIFY) != 0; } int wxStyledTextCtrl::GetLineFromPos(int pos) { - return SendMsg(EM_LINEFROMCHAR, pos); + return SendMsg(SCI_LINEFROMPOSITION, pos); } int wxStyledTextCtrl::GetLineStartPos(int line) { - return SendMsg(EM_LINEINDEX, line); -} - - -int wxStyledTextCtrl::GetLineLengthAtPos(int pos) { - return SendMsg(EM_LINELENGTH, pos); + return SendMsg(SCI_POSITIONFROMLINE, line); } @@ -426,7 +419,7 @@ wxString wxStyledTextCtrl::GetCurrentLineText(int* linePos) { int len = GetLineLength(GetCurrentLine()); char* buff = text.GetWriteBuf(len+1); - int pos = SendMsg(SCI_GETCURLINE, len+1, (long)buff); + int pos = SendMsg(SCI_GETCURLINE, len, (long)buff); text.UngetWriteBuf(); if (linePos) @@ -437,23 +430,14 @@ wxString wxStyledTextCtrl::GetCurrentLineText(int* linePos) { int wxStyledTextCtrl::PositionFromPoint(wxPoint pt) { - Point spt(pt.x, pt.y); - long rv = SendMsg(EM_CHARFROMPOS, 0, (long)&spt); - return LOWORD(rv); -} - - -int wxStyledTextCtrl::LineFromPoint(wxPoint pt) { - Point spt(pt.x, pt.y); - long rv = SendMsg(EM_CHARFROMPOS, 0, (long)&spt); - return HIWORD(rv); + return SendMsg(SCI_POSITIONFROMPOINT, pt.x, pt.y); } wxPoint wxStyledTextCtrl::PointFromPosition(int pos) { - Point pt; - SendMsg(EM_POSFROMCHAR, pos, (long)&pt); - return wxPoint(pt.x, pt.y); + int x = SendMsg(SCI_POINTXFROMPOSITION, 0, pos); + int y = SendMsg(SCI_POINTYFROMPOSITION, 0, pos); + return wxPoint(x, y); } @@ -505,7 +489,7 @@ void wxStyledTextCtrl::PageMove(int cmdKey, bool extendSelection) { void wxStyledTextCtrl::ScrollBy(int columnDelta, int lineDelta) { - SendMsg(EM_LINESCROLL, columnDelta, lineDelta); + SendMsg(SCI_LINESCROLL, columnDelta, lineDelta); } void wxStyledTextCtrl::ScrollToLine(int line) { @@ -519,7 +503,7 @@ void wxStyledTextCtrl::ScrollToColumn(int column) { void wxStyledTextCtrl::EnsureCaretVisible() { - SendMsg(EM_SCROLLCARET); + SendMsg(SCI_SCROLLCARET); } @@ -528,29 +512,45 @@ void wxStyledTextCtrl::SetCaretPolicy(int policy, int slop) { } -int wxStyledTextCtrl::GetSelectionType() { - return SendMsg(EM_SELECTIONTYPE); +int wxStyledTextCtrl::GetLinesOnScreen() { + return SendMsg(SCI_LINESONSCREEN); +} + + +bool wxStyledTextCtrl::IsSelectionRectangle() { + return SendMsg(SCI_SELECTIONISRECTANGLE) != 0; +} + + +void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool use) { + SendMsg(SCI_SETHSCROLLBAR, use); +} + + +bool wxStyledTextCtrl::GetUseHorizontalScrollBar() { + return SendMsg(SCI_GETHSCROLLBAR) != 0; } + //---------------------------------------------------------------------- // Searching int wxStyledTextCtrl::FindText(int minPos, int maxPos, - const wxString& text, - bool caseSensitive, bool wholeWord) { - FINDTEXTEX ft; + const wxString& text, + bool caseSensitive, bool wholeWord) { + TextToFind ft; int flags = 0; - flags |= caseSensitive ? FR_MATCHCASE : 0; - flags |= wholeWord ? FR_WHOLEWORD : 0; + flags |= caseSensitive ? SCFIND_MATCHCASE : 0; + flags |= wholeWord ? SCFIND_WHOLEWORD : 0; ft.chrg.cpMin = minPos; ft.chrg.cpMax = maxPos; ft.lpstrText = (char*)text.c_str(); - return SendMsg(EM_FINDTEXT, flags, (long)&ft); + return SendMsg(SCI_FINDTEXT, flags, (long)&ft); } @@ -561,8 +561,8 @@ void wxStyledTextCtrl::SearchAnchor() { int wxStyledTextCtrl::SearchNext(const wxString& text, bool caseSensitive, bool wholeWord) { int flags = 0; - flags |= caseSensitive ? FR_MATCHCASE : 0; - flags |= wholeWord ? FR_WHOLEWORD : 0; + flags |= caseSensitive ? SCFIND_MATCHCASE : 0; + flags |= wholeWord ? SCFIND_WHOLEWORD : 0; return SendMsg(SCI_SEARCHNEXT, flags, (long)text.c_str()); } @@ -570,8 +570,8 @@ int wxStyledTextCtrl::SearchNext(const wxString& text, bool caseSensitive, bool int wxStyledTextCtrl::SearchPrev(const wxString& text, bool caseSensitive, bool wholeWord) { int flags = 0; - flags |= caseSensitive ? FR_MATCHCASE : 0; - flags |= wholeWord ? FR_WHOLEWORD : 0; + flags |= caseSensitive ? SCFIND_MATCHCASE : 0; + flags |= wholeWord ? SCFIND_WHOLEWORD : 0; return SendMsg(SCI_SEARCHPREV, flags, (long)text.c_str()); } @@ -640,6 +640,16 @@ void wxStyledTextCtrl::SetStyleBytes(int length, char* styleBytes) { } +void wxStyledTextCtrl::SetLineState(int line, int value) { + SendMsg(SCI_SETLINESTATE, line, value); +} + + +int wxStyledTextCtrl::GetLineState(int line) { + return SendMsg(SCI_GETLINESTATE, line); +} + + //---------------------------------------------------------------------- // Style Definition @@ -688,6 +698,7 @@ void wxStyledTextCtrl::StyleResetDefault() { // face:[facename] sets the font face name to use // size:[num] sets the font size in points // eol turns on eol filling +// underline turns on underlining // void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) { @@ -705,6 +716,9 @@ void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) { else if (option == "italic") StyleSetItalic(styleNum, true); + else if (option == "underline") + StyleSetUnderline(styleNum, true); + else if (option == "eol") StyleSetEOLFilled(styleNum, true); @@ -741,18 +755,21 @@ void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) { wxString faceName = font.GetFaceName(); bool bold = font.GetWeight() == wxBOLD; bool italic = font.GetStyle() != wxNORMAL; + bool under = font.GetUnderlined(); - StyleSetFontAttr(styleNum, size, faceName, bold, italic); + StyleSetFontAttr(styleNum, size, faceName, bold, italic, under); } void wxStyledTextCtrl::StyleSetFontAttr(int styleNum, int size, const wxString& faceName, - bool bold, bool italic) { + bool bold, bool italic, + bool underline) { StyleSetSize(styleNum, size); StyleSetFaceName(styleNum, faceName); StyleSetBold(styleNum, bold); StyleSetItalic(styleNum, italic); + StyleSetUnderline(styleNum, underline); } @@ -781,33 +798,33 @@ void wxStyledTextCtrl::StyleSetEOLFilled(int styleNum, bool fillEOL) { } +void wxStyledTextCtrl::StyleSetUnderline(int styleNum, bool underline) { + SendMsg(SCI_STYLESETUNDERLINE, styleNum, underline); +} + + //---------------------------------------------------------------------- // Margins in the edit area int wxStyledTextCtrl::GetLeftMargin() { - return LOWORD(SendMsg(EM_GETMARGINS)); + return SendMsg(SCI_GETMARGINLEFT); } int wxStyledTextCtrl::GetRightMargin() { - return HIWORD(SendMsg(EM_GETMARGINS)); + return SendMsg(SCI_GETMARGINRIGHT); } void wxStyledTextCtrl::SetMargins(int left, int right) { int flag = 0; - int val = 0; if (right != -1) { - flag |= EC_RIGHTMARGIN; - val = right << 16; + SendMsg(SCI_SETMARGINRIGHT, 0, right); } if (left != -1) { - flag |= EC_LEFTMARGIN; - val |= (left & 0xffff); + SendMsg(SCI_SETMARGINLEFT, 0, left); } - - SendMsg(EM_SETMARGINS, flag, val); } @@ -871,7 +888,7 @@ void wxStyledTextCtrl::SetSelectionBackground(const wxColour& colour) { void wxStyledTextCtrl::SetCaretForeground(const wxColour& colour) { - SendMsg(SCI_SETCARETFORE, 0, wxColourAsLong(colour)); + SendMsg(SCI_SETCARETFORE, wxColourAsLong(colour)); } @@ -900,11 +917,41 @@ void wxStyledTextCtrl::SetTabWidth(int numChars) { } +void wxStyledTextCtrl::SetIndent(int numChars) { + SendMsg(SCI_SETINDENT, numChars); +} + + +void wxStyledTextCtrl::SetUseTabs(bool usetabs) { + SendMsg(SCI_SETUSETABS, usetabs); +} + + +void wxStyledTextCtrl::SetLineIndentation(int line, int indentation) { + SendMsg(SCI_SETLINEINDENTATION, line, indentation); +} + + +int wxStyledTextCtrl:: GetLineIndentation(int line) { + return SendMsg(SCI_GETLINEINDENTATION, line); +} + + +int wxStyledTextCtrl::GetLineIndentationPos(int line) { + return SendMsg(SCI_GETLINEINDENTPOSITION, line); +} + + void wxStyledTextCtrl::SetWordChars(const wxString& wordChars) { SendMsg(SCI_SETTABWIDTH, 0, (long)wordChars.c_str()); } +void wxStyledTextCtrl::SetUsePop(bool usepopup) { + SendMsg(SCI_USEPOPUP, usepopup); +} + + //---------------------------------------------------------------------- // Brace highlighting @@ -1009,7 +1056,7 @@ int wxStyledTextCtrl::IndicatorGetStyle(int indicNum) { void wxStyledTextCtrl::IndicatorSetColour(int indicNum, const wxColour& colour) { - SendMsg(SCI_INDICSETSTYLE, indicNum, wxColourAsLong(colour)); + SendMsg(SCI_INDICSETFORE, indicNum, wxColourAsLong(colour)); } @@ -1048,6 +1095,21 @@ void wxStyledTextCtrl::AutoCompStopChars(const wxString& stopChars) { } +void wxStyledTextCtrl::AutoCompSetSeparator(char separator) { + SendMsg(SCI_AUTOCSETSEPARATOR, separator); +} + + +char wxStyledTextCtrl::AutoCompGetSeparator() { + return SendMsg(SCI_AUTOCGETSEPARATOR); +} + + +void wxStyledTextCtrl::AutoCompSelect(const wxString& stringtoselect) { + SendMsg(SCI_AUTOCSELECT, (long)stringtoselect.c_str()); +} + + //---------------------------------------------------------------------- // Call tips @@ -1084,6 +1146,8 @@ void wxStyledTextCtrl::CallTipSetBackground(const wxColour& colour) { //---------------------------------------------------------------------- // Key bindings +#define MAKELONG(a, b) ((a) | ((b) << 16)) + void wxStyledTextCtrl::CmdKeyAssign(int key, int modifiers, int cmd) { SendMsg(SCI_ASSIGNCMDKEY, MAKELONG(key, modifiers), cmd); } @@ -1116,7 +1180,7 @@ wxStyledTextCtrl::FormatRange(bool doDraw, wxDC* target, // Why does it use two? Can they be the same? wxRect renderRect, wxRect pageRect) { - FORMATRANGE fr; + RangeToFormat fr; fr.hdc = draw; fr.hdcTarget = target; @@ -1131,7 +1195,7 @@ wxStyledTextCtrl::FormatRange(bool doDraw, fr.chrg.cpMin = startPos; fr.chrg.cpMax = endPos; - return SendMsg(EM_FORMATRANGE, doDraw, (long)&fr); + return SendMsg(SCI_FORMATRANGE, doDraw, (long)&fr); } @@ -1171,8 +1235,8 @@ int wxStyledTextCtrl::GetFoldLevel(int line) { } -int wxStyledTextCtrl::GetLastChild(int line) { - return SendMsg(SCI_GETLASTCHILD, line); +int wxStyledTextCtrl::GetLastChild(int line, int level) { + return SendMsg(SCI_GETLASTCHILD, line, level); } @@ -1196,8 +1260,8 @@ bool wxStyledTextCtrl::GetLineVisible(int line) { } -void wxStyledTextCtrl::SetFoldExpanded(int line) { - SendMsg(SCI_SETFOLDEXPANDED, line); +void wxStyledTextCtrl::SetFoldExpanded(int line, bool expanded) { + SendMsg(SCI_SETFOLDEXPANDED, line, expanded); } @@ -1216,6 +1280,33 @@ void wxStyledTextCtrl::EnsureVisible(int line) { } +void wxStyledTextCtrl::SetFoldFlags(int flags) { + SendMsg(SCI_SETFOLDFLAGS, flags); +} + + +//---------------------------------------------------------------------- +// Zooming + +void wxStyledTextCtrl::ZoomIn() { + SendMsg(SCI_ZOOMIN); +} + + +void wxStyledTextCtrl::ZoomOut() { + SendMsg(SCI_ZOOMOUT); +} + + +void wxStyledTextCtrl::SetZoom(int zoom) { + SendMsg(SCI_SETZOOM, zoom); +} + + +int wxStyledTextCtrl::GetZoom() { + return SendMsg(SCI_GETZOOM); +} + //---------------------------------------------------------------------- // Long Lines @@ -1274,6 +1365,18 @@ void wxStyledTextCtrl::SetKeywords(int keywordSet, const wxString& keywordLi +//---------------------------------------------------------------------- +// Event mask for Modified Event + +void wxStyledTextCtrl::SetModEventMask(int mask) { + SendMsg(SCI_SETMODEVENTMASK, mask); +} + + +//int wxStyledTextCtrl::GetModEventMask() { +// return SendMsg(SCI_GETMODEVENTMASK); +//} + //---------------------------------------------------------------------- // Event handlers @@ -1320,20 +1423,23 @@ void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) { } void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { - int processed = 0; long key = evt.KeyCode(); if ((key > WXK_ESCAPE) && (key != WXK_DELETE) && (key < 255) && !evt.ControlDown() && !evt.AltDown()) { m_swx->DoAddChar(key); - processed = true; } else { - key = toupper(key); - processed = m_swx->DoKeyDown(key, evt.ShiftDown(), - evt.ControlDown(), evt.AltDown()); + evt.Skip(); } +} + +void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) { + long key = evt.KeyCode(); + key = toupper(key); + int processed = m_swx->DoKeyDown(key, evt.ShiftDown(), + evt.ControlDown(), evt.AltDown()); if (! processed) evt.Skip(); } @@ -1361,9 +1467,15 @@ void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) { } +void wxStyledTextCtrl::OnListBox(wxCommandEvent& evt) { + m_swx->DoOnListBox(); +} + + //---------------------------------------------------------------------- // Turn notifications from Scintilla into events + void wxStyledTextCtrl::NotifyChange() { wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId()); GetEventHandler()->ProcessEvent(evt); @@ -1417,7 +1529,8 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetModifiers(scn.modifiers); if (eventType == wxEVT_STC_MODIFIED) { evt.SetModificationType(scn.modificationType); - evt.SetText(scn.text); + if (scn.text) + evt.SetText(wxString(scn.text, scn.length)); evt.SetLength(scn.length); evt.SetLinesAdded(scn.linesAdded); evt.SetLine(scn.line);