]> git.saurik.com Git - wxWidgets.git/commitdiff
don't interfere with Scintilla drag-and-drop (#9088)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 14 Jun 2008 02:21:55 +0000 (02:21 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 14 Jun 2008 02:21:55 +0000 (02:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54204 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/stc/ScintillaWX.cpp
src/stc/ScintillaWX.h

index 62524ee92833d986d6ac563aabd112390a5fb45b..b68bde05d30cccff3badc7f658844e2716f2782b 100644 (file)
@@ -64,21 +64,6 @@ private:
 
 
 #if wxUSE_DRAG_AND_DROP
-class wxStartDragTimer : public wxTimer {
-public:
-    wxStartDragTimer(ScintillaWX* swx) {
-        m_swx = swx;
-    }
-
-    void Notify() {
-        m_swx->DoStartDrag();
-    }
-
-private:
-    ScintillaWX* m_swx;
-};
-
-
 bool wxSTCDropTarget::OnDropText(wxCoord x, wxCoord y, const wxString& data) {
     return m_swx->DoDropText(x, y, data);
 }
@@ -260,16 +245,10 @@ ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) {
     sysCaretWidth = 0;
     sysCaretHeight = 0;
 #endif
-#if wxUSE_DRAG_AND_DROP
-    startDragTimer = new wxStartDragTimer(this);
-#endif // wxUSE_DRAG_AND_DROP
 }
 
 
 ScintillaWX::~ScintillaWX() {
-#if wxUSE_DRAG_AND_DROP
-    delete startDragTimer;
-#endif // wxUSE_DRAG_AND_DROP
     Finalise();
 }
 
@@ -301,15 +280,6 @@ void ScintillaWX::Finalise() {
 
 
 void ScintillaWX::StartDrag() {
-#if wxUSE_DRAG_AND_DROP
-    // We defer the starting of the DnD, otherwise the LeftUp of a normal
-    // click could be lost and the STC will think it is doing a DnD when the
-    // user just wanted a normal click.
-    startDragTimer->Start(200, true);
-#endif // wxUSE_DRAG_AND_DROP
-}
-
-void ScintillaWX::DoStartDrag() {
 #if wxUSE_DRAG_AND_DROP
     wxString dragText = stc2wx(drag.s, drag.len);
 
@@ -330,6 +300,7 @@ void ScintillaWX::DoStartDrag() {
 
         source.SetData(data);
         dropWentOutside = true;
+        inDragDrop = ddDragging;
         result = source.DoDragDrop(evt.GetDragAllowMove());
         if (result == wxDragMove && dropWentOutside)
             ClearSelection();
@@ -878,14 +849,6 @@ void ScintillaWX::DoLeftButtonDown(Point pt, unsigned int curTime, bool shift, b
 
 void ScintillaWX::DoLeftButtonUp(Point pt, unsigned int curTime, bool ctrl) {
     ButtonUp(pt, curTime, ctrl);
-#if wxUSE_DRAG_AND_DROP
-    if (startDragTimer->IsRunning()) {
-        startDragTimer->Stop();
-        SetDragPosition(invalidPosition);
-        SetEmptySelection(PositionFromLocation(pt));
-        ShowCaretAtCurrentPosition();
-    }
-#endif // wxUSE_DRAG_AND_DROP
 }
 
 void ScintillaWX::DoLeftButtonMove(Point pt) {
index 66345d16d27ae8dc8675af75f7fadeb056f76cc0..576229389b994ff54e4e649ca77ee31709827dbe 100644 (file)
@@ -148,7 +148,6 @@ public:
     int  DoKeyDown(const wxKeyEvent& event, bool* consumed);
     void DoTick() { Tick(); }
     void DoOnIdle(wxIdleEvent& evt);
-    void DoStartDrag();
 
 #if wxUSE_DRAG_AND_DROP
     bool DoDropText(long x, long y, const wxString& data);
@@ -180,7 +179,6 @@ private:
 #if wxUSE_DRAG_AND_DROP
     wxSTCDropTarget*    dropTarget;
     wxDragResult        dragResult;
-    wxTimer*            startDragTimer;
 #endif
 
     int                 wheelRotation;