X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/42a4299bb35c18dfce9478221ab0af3b7e2e5360..06a32e049c1bad9249079ad2e91659303424a774:/src/stc/stc.cpp?ds=inline diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 15f1fcac53..c9b08e945c 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -47,7 +47,15 @@ #include "wx/tokenzr.h" #include "wx/mstream.h" #include "wx/image.h" -#include "wx/ffile.h" +#if wxUSE_FFILE + #include "wx/ffile.h" +#elif wxUSE_FILE + #include "wx/ffile.h" +#endif + +#ifdef __WXGTK__ + #include "wx/dcbuffer.h" +#endif #include "ScintillaWX.h" @@ -126,6 +134,7 @@ wxDEFINE_EVENT( wxEVT_STC_INDICATOR_CLICK, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_INDICATOR_RELEASE, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CANCELLED, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxStyledTextEvent ); +wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_RELEASE_CLICK, wxStyledTextEvent ); @@ -278,6 +287,12 @@ void wxStyledTextCtrl::ClearAll() SendMsg(2004, 0, 0); } +// Delete a range of text in the document. +void wxStyledTextCtrl::DeleteRange(int pos, int deleteLength) +{ + SendMsg(2645, pos, deleteLength); +} + // Set all style bytes to 0, remove all folding information. void wxStyledTextCtrl::ClearDocumentStyle() { @@ -544,6 +559,18 @@ void wxStyledTextCtrl::MarkerSetBackground(int markerNumber, const wxColour& bac SendMsg(2042, markerNumber, wxColourAsLong(back)); } +// Set the background colour used for a particular marker number when its folding block is selected. +void wxStyledTextCtrl::MarkerSetBackgroundSelected(int markerNumber, const wxColour& back) +{ + SendMsg(2292, markerNumber, wxColourAsLong(back)); +} + +// Enable/disable highlight for current folding bloc (smallest one that contains the caret) +void wxStyledTextCtrl::MarkerEnableHighlight(bool enabled) +{ + SendMsg(2293, enabled, 0); +} + // Add a marker to a line, returning an ID which can be used to find or delete the marker. int wxStyledTextCtrl::MarkerAdd(int line, int markerNumber) { @@ -568,7 +595,8 @@ int wxStyledTextCtrl::MarkerGet(int line) return SendMsg(2046, line, 0); } -// Find the next line after lineStart that includes a marker in mask. +// Find the next line at or after lineStart that includes a marker in mask. +// Return -1 when no more lines. int wxStyledTextCtrl::MarkerNext(int lineStart, int markerMask) { return SendMsg(2047, lineStart, markerMask); @@ -657,6 +685,18 @@ bool wxStyledTextCtrl::GetMarginSensitive(int margin) const return SendMsg(2247, margin, 0) != 0; } +// Set the cursor shown when the mouse is inside a margin. +void wxStyledTextCtrl::SetMarginCursor(int margin, int cursor) +{ + SendMsg(2248, margin, cursor); +} + +// Retrieve the cursor shown in a margin. +int wxStyledTextCtrl::GetMarginCursor(int margin) const +{ + return SendMsg(2249, margin, 0); +} + // Clear all the styles and make equivalent to the global default style. void wxStyledTextCtrl::StyleClearAll() { @@ -810,6 +850,30 @@ void wxStyledTextCtrl::StyleSetCase(int style, int caseForce) SendMsg(2060, style, caseForce); } +// Set the size of characters of a style. Size is in points multiplied by 100. +void wxStyledTextCtrl::StyleSetSizeFractional(int style, int caseForce) +{ + SendMsg(2061, style, caseForce); +} + +// Get the size of characters of a style in points multiplied by 100 +int wxStyledTextCtrl::StyleGetSizeFractional(int style) const +{ + return SendMsg(2062, style, 0); +} + +// Set the weight of characters of a style. +void wxStyledTextCtrl::StyleSetWeight(int style, int weight) +{ + SendMsg(2063, style, weight); +} + +// Get the weight of characters of a style. +int wxStyledTextCtrl::StyleGetWeight(int style) const +{ + return SendMsg(2064, style, 0); +} + // Set a style to be a hotspot or not. void wxStyledTextCtrl::StyleSetHotSpot(int style, bool hotspot) { @@ -904,6 +968,20 @@ void wxStyledTextCtrl::SetWordChars(const wxString& characters) SendMsg(2077, 0, (sptr_t)(const char*)wx2stc(characters)); } +// Get the set of characters making up words for when moving or selecting by word. +wxString wxStyledTextCtrl::GetWordChars() const { + int msg = 2646; + int len = SendMsg(msg, 0, (sptr_t)NULL); + if (!len) return wxEmptyString; + + wxMemoryBuffer mbuf(len+1); + char* buf = (char*)mbuf.GetWriteBuf(len+1); + SendMsg(msg, 0, (sptr_t)buf); + mbuf.UngetWriteBuf(len); + mbuf.AppendByte(0); + return stc2wx(buf); +} + // Start a sequence of actions that is undone and redone as a unit. // May be nested. void wxStyledTextCtrl::BeginUndoAction() @@ -1286,6 +1364,12 @@ int wxStyledTextCtrl::GetColumn(int pos) const return SendMsg(2129, pos, 0); } +// Count characters between two positions. +int wxStyledTextCtrl::CountCharacters(int startPos, int endPos) +{ + return SendMsg(2633, startPos, endPos); +} + // Show or hide the horizontal scroll bar. void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show) { @@ -1378,6 +1462,12 @@ int wxStyledTextCtrl::GetSelectionEnd() const return SendMsg(2145, 0, 0); } +// Set caret to a position, while removing any existing selection. +void wxStyledTextCtrl::SetEmptySelection(int pos) +{ + SendMsg(2556, pos, 0); +} + // Sets the print magnification added to the point size of each style for printing. void wxStyledTextCtrl::SetPrintMagnification(int magnification) { @@ -1794,6 +1884,12 @@ void wxStyledTextCtrl::CallTipUseStyle(int tabSize) SendMsg(2212, tabSize, 0); } +// Set position of calltip, above or below text. +void wxStyledTextCtrl::CallTipSetPosition(bool above) +{ + SendMsg(2213, above, 0); +} + // Find the display line of a document line taking hidden lines into account. int wxStyledTextCtrl::VisibleFromDocLine(int line) { @@ -1856,6 +1952,12 @@ bool wxStyledTextCtrl::GetLineVisible(int line) const return SendMsg(2228, line, 0) != 0; } +// Are all lines visible? +bool wxStyledTextCtrl::GetAllLinesVisible() const +{ + return SendMsg(2236, 0, 0) != 0; +} + // Show the children of a header line. void wxStyledTextCtrl::SetFoldExpanded(int line, bool expanded) { @@ -2103,6 +2205,32 @@ void wxStyledTextCtrl::SetFirstVisibleLine(int lineDisplay) SendMsg(2613, lineDisplay, 0); } +// Change the effect of pasting when there are multiple selections. +void wxStyledTextCtrl::SetMultiPaste(int multiPaste) +{ + SendMsg(2614, multiPaste, 0); +} + +// Retrieve the effect of pasting when there are multiple selections.. +int wxStyledTextCtrl::GetMultiPaste() const +{ + return SendMsg(2615, 0, 0); +} + +// Retrieve the value of a tag from a regular expression search. +wxString wxStyledTextCtrl::GetTag(int tagNumber) const { + int msg = 2616; + int len = SendMsg(msg, tagNumber, (sptr_t)NULL); + if (!len) return wxEmptyString; + + wxMemoryBuffer mbuf(len+1); + char* buf = (char*)mbuf.GetWriteBuf(len+1); + SendMsg(msg, tagNumber, (sptr_t)buf); + mbuf.UngetWriteBuf(len); + mbuf.AppendByte(0); + return stc2wx(buf); +} + // Make the target range start and end be the same as the selection range start and end. void wxStyledTextCtrl::TargetFromSelection() { @@ -2497,12 +2625,24 @@ void wxStyledTextCtrl::BraceHighlight(int pos1, int pos2) SendMsg(2351, pos1, pos2); } +// Use specified indicator to highlight matching braces instead of changing their style. +void wxStyledTextCtrl::BraceHighlightIndicator(bool useBraceHighlightIndicator, int indicator) +{ + SendMsg(2498, useBraceHighlightIndicator, indicator); +} + // Highlight the character at a position indicating there is no matching brace. void wxStyledTextCtrl::BraceBadLight(int pos) { SendMsg(2352, pos, 0); } +// Use specified indicator to highlight non matching brace instead of changing its style. +void wxStyledTextCtrl::BraceBadLightIndicator(bool useBraceBadLightIndicator, int indicator) +{ + SendMsg(2499, useBraceBadLightIndicator, indicator); +} + // Find the position of a matching brace or INVALID_POSITION if no match. int wxStyledTextCtrl::BraceMatch(int pos) { @@ -2756,7 +2896,7 @@ void wxStyledTextCtrl::DelLineRight() SendMsg(2396, 0, 0); } -// Get and Set the xOffset (ie, horizonal scroll position). +// Get and Set the xOffset (ie, horizontal scroll position). void wxStyledTextCtrl::SetXOffset(int newOffset) { SendMsg(2397, newOffset, 0); @@ -2772,7 +2912,7 @@ void wxStyledTextCtrl::ChooseCaretX() SendMsg(2399, 0, 0); } -// Set the way the caret is kept visible when going sideway. +// Set the way the caret is kept visible when going sideways. // The exclusion zone is given in pixels. void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy, int caretSlop) { @@ -3028,6 +3168,41 @@ void wxStyledTextCtrl::SetWhitespaceChars(const wxString& characters) SendMsg(2443, 0, (sptr_t)(const char*)wx2stc(characters)); } +// Get the set of characters making up whitespace for when moving or selecting by word. +wxString wxStyledTextCtrl::GetWhitespaceChars() const { + int msg = 2647; + int len = SendMsg(msg, 0, (sptr_t)NULL); + if (!len) return wxEmptyString; + + wxMemoryBuffer mbuf(len+1); + char* buf = (char*)mbuf.GetWriteBuf(len+1); + SendMsg(msg, 0, (sptr_t)buf); + mbuf.UngetWriteBuf(len); + mbuf.AppendByte(0); + return stc2wx(buf); +} + +// Set the set of characters making up punctuation characters +// Should be called after SetWordChars. +void wxStyledTextCtrl::SetPunctuationChars(const wxString& characters) +{ + SendMsg(2648, 0, (sptr_t)(const char*)wx2stc(characters)); +} + +// Get the set of characters making up punctuation characters +wxString wxStyledTextCtrl::GetPunctuationChars() const { + int msg = 2649; + int len = SendMsg(msg, 0, (sptr_t)NULL); + if (!len) return wxEmptyString; + + wxMemoryBuffer mbuf(len+1); + char* buf = (char*)mbuf.GetWriteBuf(len+1); + SendMsg(msg, 0, (sptr_t)buf); + mbuf.UngetWriteBuf(len); + mbuf.AppendByte(0); + return stc2wx(buf); +} + // Reset the set of characters for whitespace and word characters to the defaults. void wxStyledTextCtrl::SetCharsDefault() { @@ -3035,11 +3210,23 @@ void wxStyledTextCtrl::SetCharsDefault() } // Get currently selected item position in the auto-completion list -int wxStyledTextCtrl::AutoCompGetCurrent() +int wxStyledTextCtrl::AutoCompGetCurrent() const { return SendMsg(2445, 0, 0); } +// Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. +void wxStyledTextCtrl::AutoCompSetCaseInsensitiveBehaviour(int behaviour) +{ + SendMsg(2634, behaviour, 0); +} + +// Get auto-completion case insensitive behaviour. +int wxStyledTextCtrl::AutoCompGetCaseInsensitiveBehaviour() const +{ + return SendMsg(2635, 0, 0); +} + // Enlarge the document to a particular size of text bytes. void wxStyledTextCtrl::Allocate(int bytes) { @@ -3054,13 +3241,13 @@ int wxStyledTextCtrl::FindColumn(int line, int column) } // Can the caret preferred x position only be changed by explicit movement commands? -bool wxStyledTextCtrl::GetCaretSticky() const +int wxStyledTextCtrl::GetCaretSticky() const { - return SendMsg(2457, 0, 0) != 0; + return SendMsg(2457, 0, 0); } // Stop the caret preferred x position changing when the user types. -void wxStyledTextCtrl::SetCaretSticky(bool useCaretStickyBehaviour) +void wxStyledTextCtrl::SetCaretSticky(int useCaretStickyBehaviour) { SendMsg(2458, useCaretStickyBehaviour, 0); } @@ -3131,7 +3318,7 @@ void wxStyledTextCtrl::SetIndicatorValue(int value) SendMsg(2502, value, 0); } -// Get the current indicator vaue +// Get the current indicator value int wxStyledTextCtrl::GetIndicatorValue() const { return SendMsg(2503, 0, 0); @@ -3193,10 +3380,24 @@ void wxStyledTextCtrl::CopyAllowLine() // Compact the document buffer and return a read-only pointer to the // characters in the document. -const char* wxStyledTextCtrl::GetCharacterPointer() { +const char* wxStyledTextCtrl::GetCharacterPointer() const { return (const char*)SendMsg(2520, 0, 0); } +// Return a read-only pointer to a range of characters in the document. +// May move the gap so that the range is contiguous, but will only move up +// to rangeLength bytes. +const char* wxStyledTextCtrl::GetRangePointer(int position, int rangeLength) const { + return (const char*)SendMsg(2643, position, rangeLength); +} + +// Return a position which, to avoid performance costs, should not be within +// the range of a call to GetRangePointer. +int wxStyledTextCtrl::GetGapPosition() const +{ + return SendMsg(2644, 0, 0); +} + // Always interpret keyboard input as Unicode void wxStyledTextCtrl::SetKeysUnicode(bool keysUnicode) { @@ -3221,6 +3422,18 @@ int wxStyledTextCtrl::IndicatorGetAlpha(int indicator) const return SendMsg(2524, indicator, 0); } +// Set the alpha outline colour of the given indicator. +void wxStyledTextCtrl::IndicatorSetOutlineAlpha(int indicator, int alpha) +{ + SendMsg(2558, indicator, alpha); +} + +// Get the alpha outline colour of the given indicator. +int wxStyledTextCtrl::IndicatorGetOutlineAlpha(int indicator) const +{ + return SendMsg(2559, indicator, 0); +} + // Set extra ascent for each line void wxStyledTextCtrl::SetExtraAscent(int extraAscent) { @@ -3319,6 +3532,18 @@ int wxStyledTextCtrl::MarginGetStyleOffset() const return SendMsg(2538, 0, 0); } +// Set the margin options. +void wxStyledTextCtrl::SetMarginOptions(int marginOptions) +{ + SendMsg(2539, marginOptions, 0); +} + +// Get the margin options. +int wxStyledTextCtrl::GetMarginOptions() const +{ + return SendMsg(2557, 0, 0); +} + // Set the annotation text for a line void wxStyledTextCtrl::AnnotationSetText(int line, const wxString& text) { @@ -3664,6 +3889,103 @@ void wxStyledTextCtrl::SwapMainAnchorCaret() SendMsg(2607, 0, 0); } +// Indicate that the internal state of a lexer has changed over a range and therefore +// there may be a need to redraw. +int wxStyledTextCtrl::ChangeLexerState(int start, int end) +{ + return SendMsg(2617, start, end); +} + +// Find the next line at or after lineStart that is a contracted fold header line. +// Return -1 when no more lines. +int wxStyledTextCtrl::ContractedFoldNext(int lineStart) +{ + return SendMsg(2618, lineStart, 0); +} + +// Centre current line in window. +void wxStyledTextCtrl::VerticalCentreCaret() +{ + SendMsg(2619, 0, 0); +} + +// Move the selected lines up one line, shifting the line above after the selection +void wxStyledTextCtrl::MoveSelectedLinesUp() +{ + SendMsg(2620, 0, 0); +} + +// Move the selected lines down one line, shifting the line below before the selection +void wxStyledTextCtrl::MoveSelectedLinesDown() +{ + SendMsg(2621, 0, 0); +} + +// Set the identifier reported as idFrom in notification messages. +void wxStyledTextCtrl::SetIdentifier(int identifier) +{ + SendMsg(2622, identifier, 0); +} + +// Get the identifier. +int wxStyledTextCtrl::GetIdentifier() const +{ + return SendMsg(2623, 0, 0); +} + +// Set the width for future RGBA image data. +void wxStyledTextCtrl::RGBAImageSetWidth(int width) +{ + SendMsg(2624, width, 0); +} + +// Set the height for future RGBA image data. +void wxStyledTextCtrl::RGBAImageSetHeight(int height) +{ + SendMsg(2625, height, 0); +} + +// Define a marker from RGBA data. +// It has the width and height from RGBAImageSetWidth/Height +void wxStyledTextCtrl::MarkerDefineRGBAImage(int markerNumber, const unsigned char* pixels) { + SendMsg(2626, markerNumber, (sptr_t)pixels); +} + +// Register an RGBA image for use in autocompletion lists. +// It has the width and height from RGBAImageSetWidth/Height +void wxStyledTextCtrl::RegisterRGBAImage(int type, const unsigned char* pixels) { + SendMsg(2627, type, (sptr_t)pixels); +} + +// Scroll to start of document. +void wxStyledTextCtrl::ScrollToStart() +{ + SendMsg(2628, 0, 0); +} + +// Scroll to end of document. +void wxStyledTextCtrl::ScrollToEnd() +{ + SendMsg(2629, 0, 0); +} + +// Set the technology used. +void wxStyledTextCtrl::SetTechnology(int technology) +{ + SendMsg(2630, technology, 0); +} + +// Get the tech. +int wxStyledTextCtrl::GetTechnology() const +{ + return SendMsg(2631, 0, 0); +} + +// Create an ILoader*. +void* wxStyledTextCtrl::CreateLoader(int bytes) const { + return (void*)(sptr_t)SendMsg(2632, bytes); +} + // Start notifying the container of all key presses and commands. void wxStyledTextCtrl::StartRecord() { @@ -3752,6 +4074,59 @@ int wxStyledTextCtrl::GetStyleBitsNeeded() const return SendMsg(4011, 0, 0); } +// For private communication between an application and a known lexer. +void* wxStyledTextCtrl::PrivateLexerCall(int operation, void* pointer) { + return (void*)(sptr_t)SendMsg(4013, operation, (sptr_t)pointer); +} + +// Retrieve a '\n' separated list of properties understood by the current lexer. +wxString wxStyledTextCtrl::PropertyNames() const { + int msg = 4014; + int len = SendMsg(msg, 0, (sptr_t)NULL); + if (!len) return wxEmptyString; + + wxMemoryBuffer mbuf(len+1); + char* buf = (char*)mbuf.GetWriteBuf(len+1); + SendMsg(msg, 0, (sptr_t)buf); + mbuf.UngetWriteBuf(len); + mbuf.AppendByte(0); + return stc2wx(buf); +} + +// Retrieve the type of a property. +int wxStyledTextCtrl::PropertyType(const wxString& name) +{ + return SendMsg(4015, (sptr_t)(const char*)wx2stc(name), 0); +} + +// Describe a property. +wxString wxStyledTextCtrl::DescribeProperty(const wxString& name) const { + int msg = 4016; + int len = SendMsg(msg, (sptr_t)(const char*)wx2stc(name), (sptr_t)NULL); + if (!len) return wxEmptyString; + + wxMemoryBuffer mbuf(len+1); + char* buf = (char*)mbuf.GetWriteBuf(len+1); + SendMsg(msg, (sptr_t)(const char*)wx2stc(name), (sptr_t)buf); + mbuf.UngetWriteBuf(len); + mbuf.AppendByte(0); + return stc2wx(buf); +} + +// Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. +wxString wxStyledTextCtrl::DescribeKeyWordSets() const { + int msg = 4017; + int len = SendMsg(msg, 0, (sptr_t)NULL); + if (!len) return wxEmptyString; + + wxMemoryBuffer mbuf(len+1); + char* buf = (char*)mbuf.GetWriteBuf(len+1); + SendMsg(msg, 0, (sptr_t)buf); + mbuf.UngetWriteBuf(len); + mbuf.AppendByte(0); + return stc2wx(buf); +} + //}}} //---------------------------------------------------------------------- @@ -4005,58 +4380,114 @@ void wxStyledTextCtrl::ScrollToColumn(int column) { } -#if wxUSE_TEXTCTRL -bool wxStyledTextCtrl::DoSaveFile(const wxString& filename, int fileType) +void wxStyledTextCtrl::DoSetValue(const wxString& value, int flags) { - bool ok = wxTextAreaBase::DoSaveFile(filename, fileType); -#else -bool wxStyledTextCtrl::SaveFile(const wxString& filename) + if ( flags & SetValue_SelectionOnly ) + ReplaceSelection(value); + else + SetText(value); + + // We don't send wxEVT_COMMAND_TEXT_UPDATED anyhow, so ignore the + // SetValue_SendEvent bit of the flags +} + +bool +wxStyledTextCtrl::DoSaveFile(const wxString& filename, int WXUNUSED(fileType)) { +#if wxUSE_FFILE || wxUSE_FILE + #if wxUSE_FFILE - wxFFile file(filename, wxT("w")); - bool ok = file.IsOpened() && file.Write(GetValue(), *wxConvCurrent); -#else - bool ok = false; -#endif // wxUSE_FFILE + // Take care to use "b" to ensure that possibly non-native EOLs in the file + // contents are not mangled when saving it. + wxFFile file(filename, wxS("wb")); +#elif wxUSE_FILE + wxFile file(filename, wxFile::write); #endif - if (ok) + + if ( file.IsOpened() && file.Write(GetValue(), *wxConvCurrent) ) { SetSavePoint(); + + return true; } - return ok; + +#endif // !wxUSE_FFILE && !wxUSE_FILE + + return false; } -#if wxUSE_TEXTCTRL -bool wxStyledTextCtrl::DoLoadFile(const wxString& filename, int fileType) -{ - bool ok = wxTextAreaBase::DoLoadFile(filename, fileType); -#else -bool wxStyledTextCtrl::LoadFile(const wxString& filename) +bool +wxStyledTextCtrl::DoLoadFile(const wxString& filename, int WXUNUSED(fileType)) { +#if wxUSE_FFILE || wxUSE_FILE + #if wxUSE_FFILE - wxFFile file(filename); - bool ok = file.IsOpened(); - if (ok) + // As above, we want to read the real EOLs from the file, e.g. without + // translating them to just LFs under Windows, so that the original CR LF + // are preserved when it's written back. + wxFFile file(filename, wxS("rb")); +#else + wxFile file(filename); +#endif + + if ( file.IsOpened() ) { wxString text; - ok = file.ReadAll(&text, *wxConvCurrent); - if (ok) + if ( file.ReadAll(&text, *wxConvCurrent) ) { + // Detect the EOL: we use just the first line because there is not + // much we can do if the file uses inconsistent EOLs anyhow, we'd + // need to ask the user about the one we should really use and we + // don't currently provide a way to do it. + // + // We also only check for Unix and DOS EOLs but not classic Mac + // CR-only one as it's obsolete by now. + const wxString::size_type posLF = text.find('\n'); + if ( posLF != wxString::npos ) + { + // Set EOL mode to ensure that the new lines inserted into the + // text use the same EOLs as the existing ones. + if ( posLF > 0 && text[posLF - 1] == '\r' ) + SetEOLMode(wxSTC_EOL_CRLF); + else + SetEOLMode(wxSTC_EOL_LF); + } + //else: Use the default EOL for the current platform. + SetValue(text); + EmptyUndoBuffer(); + SetSavePoint(); + + return true; } } -#else - bool ok = false; -#endif // wxUSE_FFILE -#endif - if (ok) - { - EmptyUndoBuffer(); - SetSavePoint(); - } - return ok; +#endif // !wxUSE_FFILE && !wxUSE_FILE + + return false; +} + +// If we don't derive from wxTextAreaBase, we need to implement these methods +// ourselves, otherwise we already inherit them. +#if !wxUSE_TEXTCTRL + +bool wxStyledTextCtrl::SaveFile(const wxString& filename) +{ + if ( filename.empty() ) + return false; + + return DoSaveFile(filename, wxTEXT_TYPE_ANY); +} + +bool wxStyledTextCtrl::LoadFile(const wxString& filename) +{ + if ( filename.empty() ) + return false; + + return DoLoadFile(filename, wxTEXT_TYPE_ANY); } +#endif // !wxUSE_TEXTCTRL + #if wxUSE_DRAG_AND_DROP wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) { return m_swx->DoDragOver(x, y, def); @@ -4077,6 +4508,9 @@ bool wxStyledTextCtrl::GetUseAntiAliasing() { return m_swx->GetUseAntiAliasing(); } +void wxStyledTextCtrl::AnnotationClearLine(int line) { + SendMsg(SCI_ANNOTATIONSETTEXT, line, (sptr_t)NULL); +} @@ -4182,7 +4616,11 @@ void wxStyledTextCtrl::AppendTextRaw(const char* text, int length) // Event handlers void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) { +#ifdef __WXGTK__ + wxBufferedPaintDC dc(this); +#else wxPaintDC dc(this); +#endif m_swx->DoPaint(&dc, GetUpdateRegion().GetBox()); } @@ -4426,10 +4864,12 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { case SCN_DOUBLECLICK: evt.SetEventType(wxEVT_STC_DOUBLECLICK); + evt.SetLine(scn.line); break; case SCN_UPDATEUI: evt.SetEventType(wxEVT_STC_UPDATEUI); + evt.SetUpdated(scn.updated); break; case SCN_MODIFIED: @@ -4441,6 +4881,8 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetLine(scn.line); evt.SetFoldLevelNow(scn.foldLevelNow); evt.SetFoldLevelPrev(scn.foldLevelPrev); + evt.SetToken(scn.token); + evt.SetAnnotationLinesAdded(scn.annotationLinesAdded); break; case SCN_MACRORECORD: @@ -4527,6 +4969,10 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetEventType(wxEVT_STC_AUTOCOMP_CHAR_DELETED); break; + case SCN_HOTSPOTRELEASECLICK: + evt.SetEventType(wxEVT_STC_HOTSPOT_RELEASE_CLICK); + break; + default: return; } @@ -4558,6 +5004,10 @@ wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id) m_listType = 0; m_x = 0; m_y = 0; + m_token = 0; + m_annotationLinesAdded = 0; + m_updated = 0; + #if wxUSE_DRAG_AND_DROP m_dragFlags = wxDrag_CopyOnly; m_dragResult = wxDragNone; @@ -4593,6 +5043,10 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event): m_x = event.m_x; m_y = event.m_y; + m_token = event.m_token; + m_annotationLinesAdded = event.m_annotationLinesAdded; + m_updated = event.m_updated; + #if wxUSE_DRAG_AND_DROP m_dragText = event.m_dragText; m_dragFlags = event.m_dragFlags; @@ -4605,7 +5059,7 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event): /*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo() { - return wxVersionInfo("Scintilla", 2, 3, 0, "Scintilla 2.03"); + return wxVersionInfo("Scintilla", 3, 21, 0, "Scintilla 3.21"); } #endif // wxUSE_STC