don't interfere with Scintilla drag-and-drop (#9088)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54204 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -64,21 +64,6 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#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) {
|
bool wxSTCDropTarget::OnDropText(wxCoord x, wxCoord y, const wxString& data) {
|
||||||
return m_swx->DoDropText(x, y, data);
|
return m_swx->DoDropText(x, y, data);
|
||||||
}
|
}
|
||||||
@@ -260,16 +245,10 @@ ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) {
|
|||||||
sysCaretWidth = 0;
|
sysCaretWidth = 0;
|
||||||
sysCaretHeight = 0;
|
sysCaretHeight = 0;
|
||||||
#endif
|
#endif
|
||||||
#if wxUSE_DRAG_AND_DROP
|
|
||||||
startDragTimer = new wxStartDragTimer(this);
|
|
||||||
#endif // wxUSE_DRAG_AND_DROP
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ScintillaWX::~ScintillaWX() {
|
ScintillaWX::~ScintillaWX() {
|
||||||
#if wxUSE_DRAG_AND_DROP
|
|
||||||
delete startDragTimer;
|
|
||||||
#endif // wxUSE_DRAG_AND_DROP
|
|
||||||
Finalise();
|
Finalise();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,15 +280,6 @@ void ScintillaWX::Finalise() {
|
|||||||
|
|
||||||
|
|
||||||
void ScintillaWX::StartDrag() {
|
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
|
#if wxUSE_DRAG_AND_DROP
|
||||||
wxString dragText = stc2wx(drag.s, drag.len);
|
wxString dragText = stc2wx(drag.s, drag.len);
|
||||||
|
|
||||||
@@ -330,6 +300,7 @@ void ScintillaWX::DoStartDrag() {
|
|||||||
|
|
||||||
source.SetData(data);
|
source.SetData(data);
|
||||||
dropWentOutside = true;
|
dropWentOutside = true;
|
||||||
|
inDragDrop = ddDragging;
|
||||||
result = source.DoDragDrop(evt.GetDragAllowMove());
|
result = source.DoDragDrop(evt.GetDragAllowMove());
|
||||||
if (result == wxDragMove && dropWentOutside)
|
if (result == wxDragMove && dropWentOutside)
|
||||||
ClearSelection();
|
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) {
|
void ScintillaWX::DoLeftButtonUp(Point pt, unsigned int curTime, bool ctrl) {
|
||||||
ButtonUp(pt, curTime, 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) {
|
void ScintillaWX::DoLeftButtonMove(Point pt) {
|
||||||
|
@@ -148,7 +148,6 @@ public:
|
|||||||
int DoKeyDown(const wxKeyEvent& event, bool* consumed);
|
int DoKeyDown(const wxKeyEvent& event, bool* consumed);
|
||||||
void DoTick() { Tick(); }
|
void DoTick() { Tick(); }
|
||||||
void DoOnIdle(wxIdleEvent& evt);
|
void DoOnIdle(wxIdleEvent& evt);
|
||||||
void DoStartDrag();
|
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
bool DoDropText(long x, long y, const wxString& data);
|
bool DoDropText(long x, long y, const wxString& data);
|
||||||
@@ -180,7 +179,6 @@ private:
|
|||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
wxSTCDropTarget* dropTarget;
|
wxSTCDropTarget* dropTarget;
|
||||||
wxDragResult dragResult;
|
wxDragResult dragResult;
|
||||||
wxTimer* startDragTimer;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int wheelRotation;
|
int wheelRotation;
|
||||||
|
Reference in New Issue
Block a user