From 676184202dbb8fd7a5c0818adac1db295eed2278 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 16 Oct 2010 18:11:06 +0000 Subject: [PATCH] Restore text drag-and-drop in wxSTC broken by Scintilla 2 update. Drag and drop in wxStyledTextCtrl was broken, apparently since upgrade to Scintilla 2. Restore it by using the correct wxDrag_XXX constants instead of boolean values in the code for wxEVT_STC_START_DRAG events generation. Closes #11709. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65827 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + include/wx/stc/stc.h | 6 +++--- src/stc/ScintillaWX.cpp | 2 +- src/stc/stc.cpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index da88a04816..8d0d252577 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -416,6 +416,7 @@ All (GUI): - Consistency fixes for keyboard events across all major ports. - Added EVT_RIBBONBAR_TAB_LEFT_DCLICK event (snowleopard). - Fix display of right aligned columns in wxGenericListCtrl (jl). +- Restore text drag-and-drop in wxSTC broken by Scintilla 2 update (Jens Lody). MSW: diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index 288bf35528..ecce1ba3c6 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -4326,7 +4326,7 @@ public: void SetX(int val) { m_x = val; } void SetY(int val) { m_y = val; } void SetDragText(const wxString& val) { m_dragText = val; } - void SetDragAllowMove(bool val) { m_dragAllowMove = val; } + void SetDragAllowMove(int val) { m_dragAllowMove = val; } #ifdef STC_USE_DND void SetDragResult(wxDragResult val) { m_dragResult = val; } #endif @@ -4349,7 +4349,7 @@ public: int GetX() const { return m_x; } int GetY() const { return m_y; } wxString GetDragText() { return m_dragText; } - bool GetDragAllowMove() { return m_dragAllowMove; } + int GetDragAllowMove() { return m_dragAllowMove; } #ifdef STC_USE_DND wxDragResult GetDragResult() { return m_dragResult; } #endif @@ -4387,7 +4387,7 @@ private: int m_y; wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP - bool m_dragAllowMove; // wxEVT_STC_START_DRAG + int m_dragAllowMove; // wxEVT_STC_START_DRAG #if wxUSE_DRAG_AND_DROP wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index b8a5352844..8ede8b4cf8 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -283,7 +283,7 @@ void ScintillaWX::StartDrag() { wxStyledTextEvent evt(wxEVT_STC_START_DRAG, stc->GetId()); evt.SetEventObject(stc); evt.SetDragText(dragText); - evt.SetDragAllowMove(true); + evt.SetDragAllowMove(wxDrag_DefaultMove); evt.SetPosition(wxMin(stc->GetSelectionStart(), stc->GetSelectionEnd())); stc->GetEventHandler()->ProcessEvent(evt); diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 2d393f8985..34d804cab5 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -4573,7 +4573,7 @@ wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id) m_listType = 0; m_x = 0; m_y = 0; - m_dragAllowMove = false; + m_dragAllowMove = wxDrag_CopyOnly; #if wxUSE_DRAG_AND_DROP m_dragResult = wxDragNone; #endif -- 2.45.2