]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/stc/ScintillaWX.cpp
Fix test broken by change in package name from PyCrust to py.
[wxWidgets.git] / contrib / src / stc / ScintillaWX.cpp
index 26e966cf36e90d6ba10fc83cdec3268daef8f740..f1ebd651172fc32612edf5cf1010a9ea1d8ad2ec 100644 (file)
@@ -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;
+}
 //----------------------------------------------------------------------
 //----------------------------------------------------------------------