X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ccec90930cfc38bd4347a97f46481242d9fd23cd..96c9640205933ad0673d5af2c96af0816c50160c:/src/stc/stc.cpp.in diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index f5c8d79620..70f3646ae9 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -199,7 +199,7 @@ bool wxStyledTextCtrl::Create(wxWindow *parent, m_swx = new ScintillaWX(this); m_stopWatch.Start(); m_lastKeyDownConsumed = false; - m_lastWheelTimestamp = 0; + m_timeToBlockWheelEventsUntil = 0; m_vScrollBar = NULL; m_hScrollBar = NULL; #if wxUSE_UNICODE @@ -210,7 +210,7 @@ bool wxStyledTextCtrl::Create(wxWindow *parent, SetInitialSize(size); // Reduces flicker on GTK+/X11 - SetBackgroundStyle(wxBG_STYLE_CUSTOM); + SetBackgroundStyle(wxBG_STYLE_PAINT); // Make sure it can take the focus SetCanFocus(true); @@ -586,9 +586,11 @@ bool wxStyledTextCtrl::GetUseAntiAliasing() { -void wxStyledTextCtrl::AddTextRaw(const char* text) +void wxStyledTextCtrl::AddTextRaw(const char* text, int length) { - SendMsg(SCI_ADDTEXT, strlen(text), (sptr_t)text); + if (length == -1) + length = strlen(text); + SendMsg(SCI_ADDTEXT, length, (sptr_t)text); } void wxStyledTextCtrl::InsertTextRaw(int pos, const char* text) @@ -676,9 +678,11 @@ wxCharBuffer wxStyledTextCtrl::GetTextRaw() return buf; } -void wxStyledTextCtrl::AppendTextRaw(const char* text) +void wxStyledTextCtrl::AppendTextRaw(const char* text, int length) { - SendMsg(SCI_APPENDTEXT, strlen(text), (sptr_t)text); + if (length == -1) + length = strlen(text); + SendMsg(SCI_APPENDTEXT, length, (sptr_t)text); } @@ -764,18 +768,24 @@ void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) { void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) { - // prevent having an event queue with wheel events that cannot be processed - // reasonably fast (see ticket #9057) - if ( m_lastWheelTimestamp <= evt.GetTimestamp() ) + // Prevent having an event queue with wheel events that cannot be processed + // reasonably fast (see ticket #9057) by ignoring all of them that happen + // during the time interval corresponding to the time it took us to handle + // the last one. + // + // Notice the use of TimeInMicro() instead of Time() to avoid overflow in + // long running programs. + if ( m_timeToBlockWheelEventsUntil <= m_stopWatch.TimeInMicro() ) { - m_lastWheelTimestamp = m_stopWatch.Time(); + const wxLongLong beforeMouseWheel = m_stopWatch.TimeInMicro(); m_swx->DoMouseWheel(evt.GetWheelRotation(), evt.GetWheelDelta(), evt.GetLinesPerAction(), evt.ControlDown(), evt.IsPageScroll()); - m_lastWheelTimestamp = m_stopWatch.Time() - m_lastWheelTimestamp; - m_lastWheelTimestamp += evt.GetTimestamp(); + const wxLongLong afterMouseWheel = m_stopWatch.TimeInMicro(); + m_timeToBlockWheelEventsUntil = afterMouseWheel; + m_timeToBlockWheelEventsUntil += afterMouseWheel - beforeMouseWheel; } } @@ -1120,7 +1130,7 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event): /*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo() { - return wxVersionInfo("Scintilla", 2, 3); + return wxVersionInfo("Scintilla", 2, 3, 0, "Scintilla 2.03"); } #endif // wxUSE_STC