X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/657dbfccd617711db443ec25f84ab918698814b8..65136283847d6fa6cae889d9f4748d1912a37f8d:/contrib/src/stc/ScintillaWX.cpp?ds=sidebyside diff --git a/contrib/src/stc/ScintillaWX.cpp b/contrib/src/stc/ScintillaWX.cpp index 26e966cf36..f1ebd65117 100644 --- a/contrib/src/stc/ScintillaWX.cpp +++ b/contrib/src/stc/ScintillaWX.cpp @@ -85,7 +85,7 @@ public: bool AcceptsFocus() const { return FALSE; } - void OnPaint(wxPaintEvent& evt) { + void OnPaint(wxPaintEvent& WXUNUSED(evt)) { wxPaintDC dc(this); Surface* surfaceWindow = Surface::Allocate(); surfaceWindow->Init(&dc, m_ct->wDraw.GetID()); @@ -146,7 +146,7 @@ ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) { ScintillaWX::~ScintillaWX() { - SetTicking(false); + Finalise(); } //---------------------------------------------------------------------- @@ -160,11 +160,14 @@ void ScintillaWX::Initialise() { dropTarget->SetScintilla(this); stc->SetDropTarget(dropTarget); #endif + vs.extraFontFlag = true; } void ScintillaWX::Finalise() { ScintillaBase::Finalise(); + SetTicking(false); + SetIdle(false); } @@ -199,6 +202,21 @@ void ScintillaWX::StartDrag() { } +bool ScintillaWX::SetIdle(bool on) { + if (idler.state != on) { + // connect or disconnect the EVT_IDLE handler + if (on) + stc->Connect(-1, wxEVT_IDLE, + (wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) &wxStyledTextCtrl::OnIdle); + else + stc->Disconnect(-1, wxEVT_IDLE, + (wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) &wxStyledTextCtrl::OnIdle); + idler.state = on; + } + return idler.state; +} + + void ScintillaWX::SetTicking(bool on) { wxSTCTimer* steTimer; if (timer.ticking != on) { @@ -219,11 +237,13 @@ void ScintillaWX::SetTicking(bool on) { void ScintillaWX::SetMouseCapture(bool on) { - if (on && !capturedMouse) - stc->CaptureMouse(); - else if (!on && capturedMouse && stc->HasCapture()) - stc->ReleaseMouse(); - capturedMouse = on; + if (mouseDownCaptures) { + if (on && !capturedMouse) + stc->CaptureMouse(); + else if (!on && capturedMouse && stc->HasCapture()) + stc->ReleaseMouse(); + capturedMouse = on; + } } @@ -652,7 +672,7 @@ void ScintillaWX::DoMiddleButtonUp(Point pt) { // Set the current position to the mouse click point and // then paste in the PRIMARY selection, if any. wxGTK only. int newPos = PositionFromLocation(pt); - MovePositionTo(newPos, 0, 1); + MovePositionTo(newPos, noSel, true); pdoc->BeginUndoAction(); wxTextDataObject data; @@ -775,6 +795,15 @@ void ScintillaWX::DoOnListBox() { AutoCompleteCompleted(); } + +void ScintillaWX::DoOnIdle(wxIdleEvent& evt) { + + if ( Idle() ) + evt.RequestMore(); + else + SetIdle(false); +} + //---------------------------------------------------------------------- #if wxUSE_DRAG_AND_DROP @@ -879,5 +908,15 @@ void ScintillaWX::ClipChildren(wxDC& WXUNUSED(dc), PRectangle WXUNUSED(rect)) { } #endif + +void ScintillaWX::SetUseAntiAliasing(bool useAA) { + vs.extraFontFlag = useAA; + InvalidateStyleRedraw(); +} + +bool ScintillaWX::GetUseAntiAliasing() { + return vs.extraFontFlag; +} + //---------------------------------------------------------------------- //----------------------------------------------------------------------