8 skipped lines |
9 | | 9 | | // Author: Robin Dunn |
|
|
11 | | 11 | | // Created: 13-Jan-2000 |
|
12 | | // RCS-ID: $Id: ScintillaWX.cpp,v 1.85 2005/08/23 16:02:48 ABX Exp $ | | 12 | | // RCS-ID: $Id: ScintillaWX.cpp,v 1.85.2.1 2006/03/12 06:03:52 RD Exp $ |
13 | | 13 | | // Copyright: (c) 2000 by Total Control Software |
|
14 | | 14 | | // Licence: wxWindows license |
|
15 | | 15 | | ///////////////////////////////////////////////////////////////////////////// |
|
|
17 | | #include <wx/wx.h> | | 17 | | #include "wx/wx.h" |
18 | | #include <wx/textbuf.h> | | 18 | | #include "wx/textbuf.h" |
19 | | #include <wx/dataobj.h> | | 19 | | #include "wx/dataobj.h" |
20 | | #include <wx/clipbrd.h> | | 20 | | #include "wx/clipbrd.h" |
21 | | #include <wx/dnd.h> | | 21 | | #include "wx/dnd.h" |
|
23 | | 23 | | #include "ScintillaWX.h" |
|
24 | | 24 | | #include "ExternalLexer.h" |
|
2 skipped lines |
|
|
|
30 | | #include <wx/msw/private.h> | | 30 | | #include "wx/msw/private.h" |
|
|
33 | | 33 | | //---------------------------------------------------------------------- |
|
15 skipped lines |
|
|
51 | | 51 | | #if wxUSE_DRAG_AND_DROP |
|
| | 52 | | class wxStartDragTimer : public wxTimer { |
| | 53 | | public: |
| | 54 | | wxStartDragTimer(ScintillaWX* swx) { |
| | 55 | | this->swx = swx; |
| | 56 | | } |
5 skipped lines |
| | 62 | | private: |
| | 63 | | ScintillaWX* swx; |
| | 64 | | }; |
| | 65 | | |
| | 66 | | |
52 | | 67 | | bool wxSTCDropTarget::OnDropText(wxCoord x, wxCoord y, const wxString& data) { |
|
53 | | 68 | | return swx->DoDropText(x, y, data); |
|
|
9 skipped lines |
64 | | 79 | | void wxSTCDropTarget::OnLeave() { |
|
65 | | 80 | | swx->DoDragLeave(); |
|
|
67 | | #endif | | 82 | | #endif // wxUSE_DRAG_AND_DROP |
|
|
70 | | 85 | | #if wxUSE_POPUPWIN && wxSTC_USE_POPUP |
|
126 skipped lines |
197 | | 212 | | sysCaretWidth = 0; |
|
198 | | 213 | | sysCaretHeight = 0; |
|
|
| | 215 | | #if wxUSE_DRAG_AND_DROP |
| | 216 | | startDragTimer = new wxStartDragTimer(this); |
| | 217 | | #endif // wxUSE_DRAG_AND_DROP |
|
|
|
203 | | 221 | | ScintillaWX::~ScintillaWX() { |
|
| | 222 | | #if wxUSE_DRAG_AND_DROP |
| | 223 | | delete startDragTimer; |
| | 224 | | #endif // wxUSE_DRAG_AND_DROP |
|
|
|
7 skipped lines |
214 | | 235 | | dropTarget = new wxSTCDropTarget; |
|
215 | | 236 | | dropTarget->SetScintilla(this); |
|
216 | | 237 | | stc->SetDropTarget(dropTarget); |
|
217 | | #endif | | 238 | | #endif // wxUSE_DRAG_AND_DROP |
|
219 | | 240 | | vs.extraFontFlag = false; // UseAntiAliasing |
|
|
12 skipped lines |
|
234 | | 255 | | void ScintillaWX::StartDrag() { |
|
235 | | 256 | | #if wxUSE_DRAG_AND_DROP |
|
| | 257 | | // We defer the starting of the DnD, otherwise the LeftUp of a normal |
| | 258 | | // click could be lost and the STC will think it is doing a DnD when the |
| | 259 | | // user just wanted a normal click. |
| | 260 | | startDragTimer->Start(200, true); |
| | 261 | | #endif // wxUSE_DRAG_AND_DROP |
| | 262 | | } |
| | 263 | | |
| | 264 | | void ScintillaWX::DoStartDrag() { |
| | 265 | | #if wxUSE_DRAG_AND_DROP |
236 | | 266 | | wxString dragText = stc2wx(drag.s, drag.len); |
|
|
238 | | 268 | | // Send an event to allow the drag text to be changed |
|
6 skipped lines |
245 | | 275 | | stc->GetEventHandler()->ProcessEvent(evt); |
|
246 | | 276 | | dragText = evt.GetDragText(); |
|
|
248 | | if (dragText.Length()) { | | 278 | | if (dragText.length()) { |
249 | | 279 | | wxDropSource source(stc); |
|
250 | | 280 | | wxTextDataObject data(dragText); |
|
251 | | 281 | | wxDragResult result; |
|
6 skipped lines |
258 | | 288 | | inDragDrop = false; |
|
259 | | 289 | | SetDragPosition(invalidPosition); |
|
|
261 | | #endif | | 291 | | #endif // wxUSE_DRAG_AND_DROP |
|
|
|
413 skipped lines |
678 | | 708 | | PRectangle rcClient = GetClientRectangle(); |
|
679 | | 709 | | paintingAllText = rcPaint.Contains(rcClient); |
|
|
681 | | dc->BeginDrawing(); | | |
682 | | 711 | | ClipChildren(*dc, rcPaint); |
|
683 | | 712 | | Paint(surfaceWindow, rcPaint); |
|
|
4 skipped lines |
|
|
691 | | 720 | | paintState = notPainting; |
|
692 | | dc->EndDrawing(); | | |
|
|
|
103 skipped lines |
|
|
801 | | 829 | | void ScintillaWX::DoLeftButtonUp(Point pt, unsigned int curTime, bool ctrl) { |
|
| | 830 | | #if wxUSE_DRAG_AND_DROP |
| | 831 | | if (startDragTimer->IsRunning()) { |
| | 832 | | startDragTimer->Stop(); |
| | 833 | | SetEmptySelection(PositionFromLocation(pt)); |
| | 834 | | } |
| | 835 | | #endif // wxUSE_DRAG_AND_DROP |
802 | | 836 | | ButtonUp(pt, curTime, ctrl); |
|
|
|
196 skipped lines |
1001 | | 1035 | | void ScintillaWX::DoDragLeave() { |
|
1002 | | 1036 | | SetDragPosition(invalidPosition); |
|
|
1004 | | #endif | | 1038 | | #endif // wxUSE_DRAG_AND_DROP |
1005 | | 1039 | | //---------------------------------------------------------------------- |
|
|
1007 | | 1041 | | // Force the whole window to be repainted |
|
50 skipped lines |