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
SetInitialSize(size);
// Reduces flicker on GTK+/X11
- SetBackgroundStyle(wxBG_STYLE_CUSTOM);
+ SetBackgroundStyle(wxBG_STYLE_PAINT);
// Make sure it can take the focus
SetCanFocus(true);
-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)
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);
}
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;
}
}
m_listType = 0;
m_x = 0;
m_y = 0;
- m_dragAllowMove = false;
#if wxUSE_DRAG_AND_DROP
+ m_dragFlags = wxDrag_CopyOnly;
m_dragResult = wxDragNone;
#endif
}
m_x = event.m_x;
m_y = event.m_y;
- m_dragText = event.m_dragText;
- m_dragAllowMove =event.m_dragAllowMove;
#if wxUSE_DRAG_AND_DROP
+ m_dragText = event.m_dragText;
+ m_dragFlags = event.m_dragFlags;
m_dragResult = event.m_dragResult;
#endif
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
+/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
+{
+ return wxVersionInfo("Scintilla", 2, 3, 0, "Scintilla 2.03");
+}
+
#endif // wxUSE_STC