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