I fixed a bug (other helped on tracking it down) in wxScintilla that might interest you, the DnD of wxScintilla was not functioning in my IDE (CodeLite) under GTK: selecting a portion of text and then moving it around with the mouse was not working under Linux, nor selecting portion of text holding down the control and then moving the text (for copy operation).
To fix this matter, I modified the following function, you can simply use it as is:
( I am sorry for not sending you a patch file, but my source file of wxScintilla are modified by me and I believe they don't match C::B ones)Codevoid ScintillaWX::StartDrag() {
#if wxUSE_DRAG_AND_DROP
#if wxVERSION_NUMBER >= 2800 && defined(__WXGTK__)
// For recent wxGTKs, DnD won't work if we delay with the timer, so go there direct
DoStartDrag();
#else
startDragTimer->Start (200, true);
#endif // wxVERSION_NUMBER >= 2701 && defined(__WXGTK20__)
#endif
}
In addition, to make the DnD a single operation (that is, that you will be able to undo it in a single Ctrl-Z) you will need to modify the function:
void ScintillaWX::DoStartDrag()Codevoid ScintillaWX::DoStartDrag() {
#if wxUSE_DRAG_AND_DROP
...
sci->GetEventHandler()->ProcessEvent (evt);
pdoc->BeginUndoAction(); // <--- Add this line here
..
pdoc->EndUndoAction(); // <--- And before the end of the function
#endif
}
Change the method GetDragAllowMove() of class wxScintillaEvent to always return wxDrag_DefaultMove like this (wxscintilla.h, around line 3493):Codebool GetDragAllowMove() { return wxDrag_DefaultMove; }
Next, in void ScintillaWX::DoStartDrag() (ScintillaWX.cpp, around line 308):
change this:Codeintoresult = source.DoDragDrop(evt.GetDragAllowMove());
Coderesult = source.DoDragDrop(wxDrag_DefaultMove);
While we are fixing bugs for Code::Blocks :D, I saw another post about 'copy/paste flaky' http://forums.codeblocks.org/index.php/topic,8890.0.html (http://forums.codeblocks.org/index.php/topic,8890.0.html) under KDE ;) - this is a real bug and not just the imagination of that user... I got 8 reports of that bug from users using codelite all under KDE - I experienced it myself (I am using Kubuntu 8.04 64bit KDE), to fix it (the hack is a bit ugly, but all the users that reported that bug, reported it is gone for good):
Modify ScintillaWX::Copy to become this (just copy paste it):Codevoid ScintillaWX::Copy() {
if (currentPos != anchor) {
SelectionText st;
CopySelectionRange(&st);
#ifdef __WXGTK__
for(int i=0; i<5; i++) {
//wxPrintf(wxT("Copying to clipboard %ld\n"), i);
CopyToClipboard(st);
}
#else
CopyToClipboard(st);
#endif
}
}
Kinda funny fix, but it fixes the problem