X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8e5ec9cc58bc1508aadf5bc2387609b245358a74..bcbd69875f4e9149eb22d922f94d99e307fdd280:/src/stc/stc.cpp.in diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index 9b9825a9db..a859ec1a47 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -150,8 +150,11 @@ void wxStyledTextCtrl::Create(wxWindow *parent, long style, const wxString& name) { +#ifdef __WXMAC__ + style |= wxVSCROLL | wxHSCROLL; +#endif wxControl::Create(parent, id, pos, size, - style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN, + style | wxWANTS_CHARS | wxCLIP_CHILDREN, wxDefaultValidator, name); #ifdef LINK_LEXERS @@ -353,9 +356,12 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename) if (len > 0) { #if wxUSE_UNICODE - wxMemoryBuffer buffer(len); + wxMemoryBuffer buffer(len+1); success = (file.Read(buffer.GetData(), len) == len); - contents = wxString(buffer, *wxConvCurrent); + if (success) { + ((char*)buffer.GetData())[len] = 0; + contents = wxString(buffer, *wxConvCurrent, len); + } #else wxString buffer; success = (file.Read(wxStringBuffer(buffer, len), len) == len); @@ -389,6 +395,14 @@ bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) { #endif +void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA) { + m_swx->SetUseAntiAliasing(useAA); +} + +bool wxStyledTextCtrl::GetUseAntiAliasing() { + return m_swx->GetUseAntiAliasing(); +} + //---------------------------------------------------------------------- // Event handlers @@ -454,6 +468,14 @@ void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent& evt) { void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) { wxPoint pt = evt.GetPosition(); ScreenToClient(&pt.x, &pt.y); + /* + Show context menu at event point if it's within the window, + or at caret location if not + */ + wxHitTest ht = this->HitTest(pt); + if (ht != wxHT_WINDOW_INSIDE) { + pt = this->PointFromPosition(this->GetCurrentPos()); + } m_swx->DoContextMenu(Point(pt.x, pt.y)); } @@ -481,7 +503,7 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { // printf("OnChar key:%%d consumed:%%d ctrl:%%d alt:%%d skip:%%d\n", // key, m_lastKeyDownConsumed, ctrl, alt, skip); - if ( (key <= WXK_START || key > WXK_NUMPAD_DIVIDE) && + if ( (key <= WXK_START || key > WXK_COMMAND) && !m_lastKeyDownConsumed && !skip) { m_swx->DoAddChar(key); return; @@ -507,13 +529,15 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) { } -void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& WXUNUSED(evt)) { +void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) { m_swx->DoLoseFocus(); + evt.Skip(); } -void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& WXUNUSED(evt)) { +void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) { m_swx->DoGainFocus(); + evt.Skip(); } @@ -538,6 +562,11 @@ void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) { } +void wxStyledTextCtrl::OnIdle(wxIdleEvent& evt) { + m_swx->DoOnIdle(evt); +} + + //---------------------------------------------------------------------- // Turn notifications from Scintilla into events