X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/af0531a5a8d930312bfbdb7e9c0703f95ea0b55b..806f9e8330691d64966af62d35e6b3d88f30471e:/src/stc/stc.cpp.in diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index 7735fd6109..592e6da131 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -15,15 +15,28 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// -#include +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif -#include -#include -#include -#include -#include +#if wxUSE_STC #include "wx/stc/stc.h" + +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif // WX_PRECOMP + +#include + +#include "wx/tokenzr.h" +#include "wx/mstream.h" +#include "wx/image.h" +#include "wx/file.h" + #include "ScintillaWX.h" //---------------------------------------------------------------------- @@ -96,6 +109,7 @@ DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM ) DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK ) DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK ) DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK ) +DEFINE_EVENT_TYPE( wxEVT_STC_AUTOCOMP_SELECTION ) @@ -157,9 +171,7 @@ bool wxStyledTextCtrl::Create(wxWindow *parent, long style, const wxString& name) { -#ifdef __WXMAC__ style |= wxVSCROLL | wxHSCROLL; -#endif if (!wxControl::Create(parent, id, pos, size, style | wxWANTS_CHARS | wxCLIP_CHILDREN, wxDefaultValidator, name)) @@ -178,7 +190,7 @@ bool wxStyledTextCtrl::Create(wxWindow *parent, SetCodePage(wxSTC_CP_UTF8); #endif - SetBestFittingSize(size); + SetInitialSize(size); // Reduces flicker on GTK+/X11 SetBackgroundStyle(wxBG_STYLE_CUSTOM); @@ -301,7 +313,7 @@ void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) { bool bold = font.GetWeight() == wxBOLD; bool italic = font.GetStyle() != wxNORMAL; bool under = font.GetUnderlined(); - wxFontEncoding encoding = font.GetDefaultEncoding(); + wxFontEncoding encoding = font.GetEncoding(); StyleSetFontAttr(styleNum, size, faceName, bold, italic, under, encoding); } @@ -402,6 +414,14 @@ void wxStyledTextCtrl::StyleSetCharacterSet(int style, int characterSet) case wxSTC_CHARSET_THAI: encoding = wxFONTENCODING_ISO8859_11; break; + + case wxSTC_CHARSET_CYRILLIC: + encoding = wxFONTENCODING_ISO8859_5; + break; + + case wxSTC_CHARSET_8859_15: + encoding = wxFONTENCODING_ISO8859_15;; + break; } // We just have Scintilla track the wxFontEncoding for us. It gets used @@ -747,6 +767,13 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { #endif bool skip = ((ctrl || alt) && ! (ctrl && alt)); +#if wxUSE_UNICODE + // apparently if we don't do this, Unicode keys pressed after non-char + // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989) + if (m_lastKeyDownConsumed && evt.GetUnicodeKey() > 255) + m_lastKeyDownConsumed = false; +#endif + if (!m_lastKeyDownConsumed && !skip) { #if wxUSE_UNICODE int key = evt.GetUnicodeKey(); @@ -845,12 +872,7 @@ 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)); + evt.SetText(stc2wx(text, length)); } @@ -928,10 +950,18 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetEventType(wxEVT_STC_PAINTED); break; + case SCN_AUTOCSELECTION: + evt.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION); + evt.SetListType(scn.listType); + SetEventText(evt, scn.text, strlen(scn.text)); + evt.SetPosition(scn.lParam); + break; + case SCN_USERLISTSELECTION: evt.SetEventType(wxEVT_STC_USERLISTSELECTION); evt.SetListType(scn.listType); SetEventText(evt, scn.text, strlen(scn.text)); + evt.SetPosition(scn.lParam); break; case SCN_URIDROPPED: @@ -966,7 +996,7 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { case SCN_CALLTIPCLICK: evt.SetEventType(wxEVT_STC_CALLTIP_CLICK); break; - + default: return; } @@ -1043,11 +1073,4 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event): //---------------------------------------------------------------------- //---------------------------------------------------------------------- - - - - - - - - +#endif // wxUSE_STC