]> git.saurik.com Git - wxWidgets.git/blame - src/stc/ScintillaWX.cpp
cleanup
[wxWidgets.git] / src / stc / ScintillaWX.cpp
CommitLineData
9ce192d4
RD
1////////////////////////////////////////////////////////////////////////////
2// Name: ScintillaWX.cxx
be5a51fb 3// Purpose: A wxWidgets implementation of Scintilla. A class derived
9ce192d4
RD
4// from ScintillaBase that uses the "wx platform" defined in
5// PlatformWX.cxx This class is one end of a bridge between
6// the wx world and the Scintilla world. It needs a peer
7// object of type wxStyledTextCtrl to function.
8//
9// Author: Robin Dunn
10//
11// Created: 13-Jan-2000
12// RCS-ID: $Id$
13// Copyright: (c) 2000 by Total Control Software
14// Licence: wxWindows license
15/////////////////////////////////////////////////////////////////////////////
16
54429bb3
RD
17// For compilers that support precompilation, includes "wx.h".
18#include "wx/wxprec.h"
19
20#ifdef __BORLANDC__
21 #pragma hdrstop
22#endif
23
29825f5f 24#if wxUSE_STC
54429bb3
RD
25
26#ifndef WX_PRECOMP
29825f5f
PC
27 #include "wx/scrolbar.h"
28 #include "wx/menu.h"
6420b4c5 29 #include "wx/timer.h"
54429bb3
RD
30#endif // WX_PRECOMP
31
d6655166
WS
32#include "wx/textbuf.h"
33#include "wx/dataobj.h"
34#include "wx/clipbrd.h"
35#include "wx/dnd.h"
f9ee2e27 36
9ce192d4 37#include "ScintillaWX.h"
e14d10b0 38#include "ExternalLexer.h"
9ce192d4 39#include "wx/stc/stc.h"
ea88e9bc 40#include "wx/stc/private.h"
1a2fb4cd 41#include "PlatWX.h"
9ce192d4 42
249b31b5
WS
43#ifdef __WXMSW__
44 // GetHwndOf()
d6655166 45 #include "wx/msw/private.h"
249b31b5
WS
46#endif
47
9ce192d4
RD
48//----------------------------------------------------------------------
49// Helper classes
50
51class wxSTCTimer : public wxTimer {
52public:
53 wxSTCTimer(ScintillaWX* swx) {
291b0f5b 54 m_swx = swx;
9ce192d4
RD
55 }
56
57 void Notify() {
291b0f5b 58 m_swx->DoTick();
9ce192d4
RD
59 }
60
61private:
291b0f5b 62 ScintillaWX* m_swx;
9ce192d4
RD
63};
64
65
1bc32508 66#if wxUSE_DRAG_AND_DROP
466c166f
RD
67class wxStartDragTimer : public wxTimer {
68public:
69 wxStartDragTimer(ScintillaWX* swx) {
291b0f5b 70 m_swx = swx;
466c166f
RD
71 }
72
73 void Notify() {
291b0f5b 74 m_swx->DoStartDrag();
466c166f
RD
75 }
76
77private:
291b0f5b 78 ScintillaWX* m_swx;
466c166f
RD
79};
80
81
9ce192d4 82bool wxSTCDropTarget::OnDropText(wxCoord x, wxCoord y, const wxString& data) {
291b0f5b 83 return m_swx->DoDropText(x, y, data);
9ce192d4
RD
84}
85
86wxDragResult wxSTCDropTarget::OnEnter(wxCoord x, wxCoord y, wxDragResult def) {
291b0f5b 87 return m_swx->DoDragEnter(x, y, def);
9ce192d4
RD
88}
89
90wxDragResult wxSTCDropTarget::OnDragOver(wxCoord x, wxCoord y, wxDragResult def) {
291b0f5b 91 return m_swx->DoDragOver(x, y, def);
9ce192d4
RD
92}
93
94void wxSTCDropTarget::OnLeave() {
291b0f5b 95 m_swx->DoDragLeave();
9ce192d4 96}
f402150f 97#endif // wxUSE_DRAG_AND_DROP
9ce192d4
RD
98
99
9c46ea66 100#if wxUSE_POPUPWIN && wxSTC_USE_POPUP
819850ff 101#include "wx/popupwin.h"
769a9cb2
RD
102#define wxSTCCallTipBase wxPopupWindow
103#define param2 wxBORDER_NONE // popup's 2nd param is flags
104#else
819850ff 105#include "wx/frame.h"
67879c5b 106#define wxSTCCallTipBase wxFrame
9e730a78 107#define param2 -1 // wxWindow's 2nd param is ID
769a9cb2
RD
108#endif
109
819850ff 110#include "wx/dcbuffer.h"
8a793194 111
769a9cb2 112class wxSTCCallTip : public wxSTCCallTipBase {
f6bcfd97 113public:
67879c5b
RD
114 wxSTCCallTip(wxWindow* parent, CallTip* ct, ScintillaWX* swx) :
115#if wxUSE_POPUPWIN && wxSTC_USE_POPUP
116 wxSTCCallTipBase(parent, wxBORDER_NONE),
117#else
118 wxSTCCallTipBase(parent, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize,
119 wxFRAME_NO_TASKBAR
120 | wxFRAME_FLOAT_ON_PARENT
121 | wxBORDER_NONE
122#ifdef __WXMAC__
123 | wxPOPUP_WINDOW
124#endif
125 ),
126#endif
7e126a07 127 m_ct(ct), m_swx(swx), m_cx(wxDefaultCoord), m_cy(wxDefaultCoord)
f6bcfd97 128 {
f6bcfd97
BP
129 }
130
ef08ab52 131 ~wxSTCCallTip() {
8a793194
RD
132#if wxUSE_POPUPWIN && wxSTC_USE_POPUP && defined(__WXGTK__)
133 wxRect rect = GetRect();
ee8bee6c
RD
134 rect.x = m_cx;
135 rect.y = m_cy;
8a793194
RD
136 GetParent()->Refresh(false, &rect);
137#endif
ef08ab52
RD
138 }
139
7e126a07 140 bool AcceptsFocus() const { return false; }
9e730a78 141
67879c5b
RD
142 void OnPaint(wxPaintEvent& WXUNUSED(evt))
143 {
8a793194 144 wxBufferedPaintDC dc(this);
1a2fb4cd 145 Surface* surfaceWindow = Surface::Allocate();
9e730a78 146 surfaceWindow->Init(&dc, m_ct->wDraw.GetID());
1a2fb4cd 147 m_ct->PaintCT(surfaceWindow);
9e730a78 148 surfaceWindow->Release();
1a2fb4cd 149 delete surfaceWindow;
f6bcfd97
BP
150 }
151
67879c5b
RD
152 void OnFocus(wxFocusEvent& event)
153 {
267484bc
RD
154 GetParent()->SetFocus();
155 event.Skip();
156 }
157
67879c5b
RD
158 void OnLeftDown(wxMouseEvent& event)
159 {
9e730a78
RD
160 wxPoint pt = event.GetPosition();
161 Point p(pt.x, pt.y);
162 m_ct->MouseClick(p);
163 m_swx->CallTipClick();
164 }
165
769a9cb2
RD
166 virtual void DoSetSize(int x, int y,
167 int width, int height,
67879c5b
RD
168 int sizeFlags = wxSIZE_AUTO)
169 {
170 // convert coords to screen coords since we're a top-level window
7e126a07 171 if (x != wxDefaultCoord) {
ee8bee6c 172 m_cx = x;
769a9cb2 173 GetParent()->ClientToScreen(&x, NULL);
ee8bee6c 174 }
7e126a07 175 if (y != wxDefaultCoord) {
ee8bee6c 176 m_cy = y;
769a9cb2 177 GetParent()->ClientToScreen(NULL, &y);
ee8bee6c 178 }
769a9cb2
RD
179 wxSTCCallTipBase::DoSetSize(x, y, width, height, sizeFlags);
180 }
769a9cb2 181
67879c5b
RD
182#if wxUSE_POPUPWIN && wxSTC_USE_POPUP
183#else
184 virtual bool Show( bool show = true )
185 {
186 // Although we're a frame, we always want the parent to be active, so
187 // raise it whenever we get shown.
188 bool rv = wxSTCCallTipBase::Show(show);
189 if (rv && show)
190 {
191 wxTopLevelWindow *frame = wxDynamicCast(
192 wxGetTopLevelParent(GetParent()), wxTopLevelWindow);
193 if (frame)
194 frame->Raise();
195 }
196 return rv;
197 }
198#endif
199
200 wxPoint GetMyPosition()
201 {
ee8bee6c
RD
202 return wxPoint(m_cx, m_cy);
203 }
7e126a07 204
769a9cb2 205private:
9e730a78
RD
206 CallTip* m_ct;
207 ScintillaWX* m_swx;
ee8bee6c 208 int m_cx, m_cy;
f6bcfd97
BP
209 DECLARE_EVENT_TABLE()
210};
211
769a9cb2 212BEGIN_EVENT_TABLE(wxSTCCallTip, wxSTCCallTipBase)
f6bcfd97 213 EVT_PAINT(wxSTCCallTip::OnPaint)
267484bc 214 EVT_SET_FOCUS(wxSTCCallTip::OnFocus)
9c46ea66 215 EVT_LEFT_DOWN(wxSTCCallTip::OnLeftDown)
f6bcfd97 216END_EVENT_TABLE()
9ce192d4 217
769a9cb2 218
610c50a2
RD
219//----------------------------------------------------------------------
220
c54e5eb0 221#if wxUSE_DATAOBJ
610c50a2
RD
222static wxTextFileType wxConvertEOLMode(int scintillaMode)
223{
224 wxTextFileType type;
7e126a07 225
610c50a2
RD
226 switch (scintillaMode) {
227 case wxSTC_EOL_CRLF:
228 type = wxTextFileType_Dos;
229 break;
7e126a07 230
610c50a2
RD
231 case wxSTC_EOL_CR:
232 type = wxTextFileType_Mac;
233 break;
7e126a07 234
610c50a2
RD
235 case wxSTC_EOL_LF:
236 type = wxTextFileType_Unix;
237 break;
7e126a07 238
610c50a2
RD
239 default:
240 type = wxTextBuffer::typeDefault;
241 break;
242 }
243 return type;
244}
c54e5eb0 245#endif // wxUSE_DATAOBJ
7e126a07 246
610c50a2 247
9ce192d4
RD
248//----------------------------------------------------------------------
249// Constructor/Destructor
250
251
252ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) {
9e730a78 253 capturedMouse = false;
b0d0494f 254 focusEvent = false;
9ce192d4 255 wMain = win;
9ce192d4 256 stc = win;
37d62433 257 wheelRotation = 0;
9ce192d4 258 Initialise();
68985f0e
RD
259#ifdef __WXMSW__
260 sysCaretBitmap = 0;
261 sysCaretWidth = 0;
262 sysCaretHeight = 0;
263#endif
466c166f
RD
264#if wxUSE_DRAG_AND_DROP
265 startDragTimer = new wxStartDragTimer(this);
f402150f 266#endif // wxUSE_DRAG_AND_DROP
9ce192d4
RD
267}
268
269
270ScintillaWX::~ScintillaWX() {
f402150f 271#if wxUSE_DRAG_AND_DROP
466c166f 272 delete startDragTimer;
f402150f
WS
273#endif // wxUSE_DRAG_AND_DROP
274 Finalise();
9ce192d4
RD
275}
276
277//----------------------------------------------------------------------
278// base class virtuals
279
280
281void ScintillaWX::Initialise() {
282 //ScintillaBase::Initialise();
1bc32508 283#if wxUSE_DRAG_AND_DROP
9eb662e9
RD
284 dropTarget = new wxSTCDropTarget;
285 dropTarget->SetScintilla(this);
286 stc->SetDropTarget(dropTarget);
f402150f 287#endif // wxUSE_DRAG_AND_DROP
0eaf23ed
RD
288#ifdef __WXMAC__
289 vs.extraFontFlag = false; // UseAntiAliasing
290#else
291 vs.extraFontFlag = true; // UseAntiAliasing
292#endif
9ce192d4
RD
293}
294
295
296void ScintillaWX::Finalise() {
297 ScintillaBase::Finalise();
8e54aaed
RD
298 SetTicking(false);
299 SetIdle(false);
d429e187 300 DestroySystemCaret();
9ce192d4
RD
301}
302
303
304void ScintillaWX::StartDrag() {
1bc32508 305#if wxUSE_DRAG_AND_DROP
466c166f
RD
306 // We defer the starting of the DnD, otherwise the LeftUp of a normal
307 // click could be lost and the STC will think it is doing a DnD when the
308 // user just wanted a normal click.
5a86739d 309 startDragTimer->Start(200, true);
f402150f 310#endif // wxUSE_DRAG_AND_DROP
466c166f
RD
311}
312
313void ScintillaWX::DoStartDrag() {
f402150f 314#if wxUSE_DRAG_AND_DROP
0c5b83b0 315 wxString dragText = stc2wx(drag.s, drag.len);
a29a241f
RD
316
317 // Send an event to allow the drag text to be changed
318 wxStyledTextEvent evt(wxEVT_STC_START_DRAG, stc->GetId());
319 evt.SetEventObject(stc);
320 evt.SetDragText(dragText);
7e126a07 321 evt.SetDragAllowMove(true);
a29a241f
RD
322 evt.SetPosition(wxMin(stc->GetSelectionStart(),
323 stc->GetSelectionEnd()));
324 stc->GetEventHandler()->ProcessEvent(evt);
325 dragText = evt.GetDragText();
326
f402150f 327 if (dragText.length()) {
5fa4613c 328 wxDropSource source(stc);
a29a241f
RD
329 wxTextDataObject data(dragText);
330 wxDragResult result;
331
332 source.SetData(data);
7e126a07 333 dropWentOutside = true;
a29a241f
RD
334 result = source.DoDragDrop(evt.GetDragAllowMove());
335 if (result == wxDragMove && dropWentOutside)
336 ClearSelection();
7e126a07 337 inDragDrop = false;
a29a241f
RD
338 SetDragPosition(invalidPosition);
339 }
f402150f 340#endif // wxUSE_DRAG_AND_DROP
9ce192d4
RD
341}
342
343
8e54aaed
RD
344bool ScintillaWX::SetIdle(bool on) {
345 if (idler.state != on) {
346 // connect or disconnect the EVT_IDLE handler
7e126a07
WS
347 if (on)
348 stc->Connect(wxID_ANY, wxEVT_IDLE,
5f9eb69c 349 (wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) &wxStyledTextCtrl::OnIdle);
8e54aaed 350 else
7e126a07 351 stc->Disconnect(wxID_ANY, wxEVT_IDLE,
5f9eb69c 352 (wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) &wxStyledTextCtrl::OnIdle);
8e54aaed
RD
353 idler.state = on;
354 }
355 return idler.state;
356}
357
7e126a07 358
9ce192d4
RD
359void ScintillaWX::SetTicking(bool on) {
360 wxSTCTimer* steTimer;
361 if (timer.ticking != on) {
362 timer.ticking = on;
363 if (timer.ticking) {
364 steTimer = new wxSTCTimer(this);
365 steTimer->Start(timer.tickSize);
1a2fb4cd 366 timer.tickerID = steTimer;
9ce192d4
RD
367 } else {
368 steTimer = (wxSTCTimer*)timer.tickerID;
369 steTimer->Stop();
370 delete steTimer;
371 timer.tickerID = 0;
372 }
373 }
374 timer.ticksToWait = caret.period;
375}
376
377
378void ScintillaWX::SetMouseCapture(bool on) {
8e54aaed 379 if (mouseDownCaptures) {
134d7051 380 if (on && !capturedMouse)
8e54aaed 381 stc->CaptureMouse();
134d7051 382 else if (!on && capturedMouse && stc->HasCapture())
8e54aaed 383 stc->ReleaseMouse();
134d7051 384 capturedMouse = on;
8e54aaed 385 }
9ce192d4
RD
386}
387
388
389bool ScintillaWX::HaveMouseCapture() {
9e730a78 390 return capturedMouse;
9ce192d4
RD
391}
392
393
394void ScintillaWX::ScrollText(int linesToMove) {
395 int dy = vs.lineHeight * (linesToMove);
5fa4613c
RD
396 stc->ScrollWindow(0, dy);
397 stc->Update();
9ce192d4
RD
398}
399
400void ScintillaWX::SetVerticalScrollPos() {
5fa4613c
RD
401 if (stc->m_vScrollBar == NULL) { // Use built-in scrollbar
402 stc->SetScrollPos(wxVERTICAL, topLine);
403 }
404 else { // otherwise use the one that's been given to us
405 stc->m_vScrollBar->SetThumbPosition(topLine);
406 }
9ce192d4
RD
407}
408
409void ScintillaWX::SetHorizontalScrollPos() {
5fa4613c
RD
410 if (stc->m_hScrollBar == NULL) { // Use built-in scrollbar
411 stc->SetScrollPos(wxHORIZONTAL, xOffset);
412 }
413 else { // otherwise use the one that's been given to us
414 stc->m_hScrollBar->SetThumbPosition(xOffset);
415 }
9ce192d4
RD
416}
417
1bc54e32 418
a834585d 419const int H_SCROLL_STEP = 20;
9ce192d4
RD
420
421bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
422 bool modified = false;
9ce192d4 423
1bc54e32
RD
424 int vertEnd = nMax;
425 if (!verticalScrollBarVisible)
426 vertEnd = 0;
427
a834585d 428 // Check the vertical scrollbar
5fa4613c
RD
429 if (stc->m_vScrollBar == NULL) { // Use built-in scrollbar
430 int sbMax = stc->GetScrollRange(wxVERTICAL);
431 int sbThumb = stc->GetScrollThumb(wxVERTICAL);
432 int sbPos = stc->GetScrollPos(wxVERTICAL);
1bc54e32
RD
433 if (sbMax != vertEnd || sbThumb != nPage) {
434 stc->SetScrollbar(wxVERTICAL, sbPos, nPage, vertEnd+1);
5fa4613c
RD
435 modified = true;
436 }
437 }
438 else { // otherwise use the one that's been given to us
439 int sbMax = stc->m_vScrollBar->GetRange();
440 int sbPage = stc->m_vScrollBar->GetPageSize();
441 int sbPos = stc->m_vScrollBar->GetThumbPosition();
1bc54e32
RD
442 if (sbMax != vertEnd || sbPage != nPage) {
443 stc->m_vScrollBar->SetScrollbar(sbPos, nPage, vertEnd+1, nPage);
5fa4613c
RD
444 modified = true;
445 }
9ce192d4
RD
446 }
447
5fa4613c 448
a834585d
RD
449 // Check the horizontal scrollbar
450 PRectangle rcText = GetTextRectangle();
451 int horizEnd = scrollWidth;
452 if (horizEnd < 0)
453 horizEnd = 0;
454 if (!horizontalScrollBarVisible || (wrapState != eWrapNone))
455 horizEnd = 0;
456 int pageWidth = rcText.Width();
457
458 if (stc->m_hScrollBar == NULL) { // Use built-in scrollbar
459 int sbMax = stc->GetScrollRange(wxHORIZONTAL);
460 int sbThumb = stc->GetScrollThumb(wxHORIZONTAL);
461 int sbPos = stc->GetScrollPos(wxHORIZONTAL);
462 if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
1bc54e32 463 stc->SetScrollbar(wxHORIZONTAL, sbPos, pageWidth, horizEnd);
a834585d
RD
464 modified = true;
465 if (scrollWidth < pageWidth) {
466 HorizontalScrollTo(0);
5fa4613c
RD
467 }
468 }
a834585d
RD
469 }
470 else { // otherwise use the one that's been given to us
471 int sbMax = stc->m_hScrollBar->GetRange();
472 int sbThumb = stc->m_hScrollBar->GetPageSize();
473 int sbPos = stc->m_hScrollBar->GetThumbPosition();
474 if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
1bc54e32 475 stc->m_hScrollBar->SetScrollbar(sbPos, pageWidth, horizEnd, pageWidth);
a834585d
RD
476 modified = true;
477 if (scrollWidth < pageWidth) {
478 HorizontalScrollTo(0);
5fa4613c 479 }
3928c4fd 480 }
9ce192d4 481 }
a834585d 482
9ce192d4
RD
483 return modified;
484}
485
486
487void ScintillaWX::NotifyChange() {
488 stc->NotifyChange();
489}
490
491
492void ScintillaWX::NotifyParent(SCNotification scn) {
493 stc->NotifyParent(&scn);
494}
495
496
b0d0494f
RD
497// This method is overloaded from ScintillaBase in order to prevent the
498// AutoComplete window from being destroyed when it gets the focus. There is
499// a side effect that the AutoComp will also not be destroyed when switching
500// to another window, but I think that is okay.
501void ScintillaWX::CancelModes() {
502 if (! focusEvent)
503 AutoCompleteCancel();
504 ct.CallTipCancel();
505 Editor::CancelModes();
506}
507
508
9ce192d4
RD
509
510void ScintillaWX::Copy() {
511 if (currentPos != anchor) {
b8b0e402
RD
512 SelectionText st;
513 CopySelectionRange(&st);
e14d10b0 514 CopyToClipboard(st);
9ce192d4
RD
515 }
516}
517
518
519void ScintillaWX::Paste() {
520 pdoc->BeginUndoAction();
521 ClearSelection();
522
c54e5eb0 523#if wxUSE_DATAOBJ
9ce192d4 524 wxTextDataObject data;
7e126a07 525 bool gotData = false;
9ce192d4 526
e5abfc48 527 wxTheClipboard->UsePrimarySelection(false);
45c6a927 528 if (wxTheClipboard->Open()) {
45c6a927
RD
529 gotData = wxTheClipboard->GetData(data);
530 wxTheClipboard->Close();
531 }
e26c0634 532 if (gotData) {
610c50a2
RD
533 wxString text = wxTextBuffer::Translate(data.GetText(),
534 wxConvertEOLMode(pdoc->eolMode));
535 wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
1c930beb 536
e968f108
RD
537#if wxUSE_UNICODE
538 // free up the old character buffer in case the text is real big
539 data.SetText(wxEmptyString);
540 text = wxEmptyString;
541#endif
542 int len = strlen(buf);
10ef30eb 543 pdoc->InsertString(currentPos, buf, len);
9ce192d4
RD
544 SetEmptySelection(currentPos + len);
545 }
c54e5eb0 546#endif // wxUSE_DATAOBJ
9ce192d4
RD
547
548 pdoc->EndUndoAction();
549 NotifyChange();
550 Redraw();
551}
552
553
e14d10b0 554void ScintillaWX::CopyToClipboard(const SelectionText& st) {
c54e5eb0 555#if wxUSE_CLIPBOARD
e5abfc48 556 wxTheClipboard->UsePrimarySelection(false);
e14d10b0 557 if (wxTheClipboard->Open()) {
98719eab 558 wxString text = wxTextBuffer::Translate(stc2wx(st.s, st.len-1));
e14d10b0
RD
559 wxTheClipboard->SetData(new wxTextDataObject(text));
560 wxTheClipboard->Close();
561 }
c54e5eb0
WS
562#else
563 wxUnusedVar(st);
564#endif // wxUSE_CLIPBOARD
e14d10b0
RD
565}
566
567
9ce192d4 568bool ScintillaWX::CanPaste() {
c54e5eb0 569#if wxUSE_CLIPBOARD
7e126a07 570 bool canPaste = false;
45c6a927 571 bool didOpen;
9ce192d4 572
0b887a21 573 if (Editor::CanPaste()) {
e5abfc48 574 wxTheClipboard->UsePrimarySelection(false);
88a8b04e
RD
575 didOpen = !wxTheClipboard->IsOpened();
576 if ( didOpen )
0b887a21 577 wxTheClipboard->Open();
45c6a927 578
0b887a21 579 if (wxTheClipboard->IsOpened()) {
0b887a21
RD
580 canPaste = wxTheClipboard->IsSupported(wxUSE_UNICODE ? wxDF_UNICODETEXT : wxDF_TEXT);
581 if (didOpen)
582 wxTheClipboard->Close();
583 }
6ba338ec 584 }
9ce192d4 585 return canPaste;
c54e5eb0
WS
586#else
587 return false;
588#endif // wxUSE_CLIPBOARD
9ce192d4
RD
589}
590
591void ScintillaWX::CreateCallTipWindow(PRectangle) {
9e730a78
RD
592 if (! ct.wCallTip.Created() ) {
593 ct.wCallTip = new wxSTCCallTip(stc, &ct, this);
594 ct.wDraw = ct.wCallTip;
595 }
9ce192d4
RD
596}
597
598
599void ScintillaWX::AddToPopUp(const char *label, int cmd, bool enabled) {
600 if (!label[0])
1a2fb4cd 601 ((wxMenu*)popup.GetID())->AppendSeparator();
9ce192d4 602 else
1e545382 603 ((wxMenu*)popup.GetID())->Append(cmd, wxGetTranslation(stc2wx(label)));
9ce192d4
RD
604
605 if (!enabled)
1a2fb4cd 606 ((wxMenu*)popup.GetID())->Enable(cmd, enabled);
9ce192d4
RD
607}
608
609
e5abfc48
RD
610// This is called by the Editor base class whenever something is selected.
611// For wxGTK we can put this text in the primary selection and then other apps
612// can paste with the middle button.
9ce192d4 613void ScintillaWX::ClaimSelection() {
2b5f62a0
VZ
614#ifdef __WXGTK__
615 // Put the selected text in the PRIMARY selection
616 if (currentPos != anchor) {
617 SelectionText st;
618 CopySelectionRange(&st);
e5abfc48 619 wxTheClipboard->UsePrimarySelection(true);
2b5f62a0 620 if (wxTheClipboard->Open()) {
2b5f62a0
VZ
621 wxString text = stc2wx(st.s, st.len);
622 wxTheClipboard->SetData(new wxTextDataObject(text));
2b5f62a0
VZ
623 wxTheClipboard->Close();
624 }
e5abfc48 625 wxTheClipboard->UsePrimarySelection(false);
2b5f62a0
VZ
626 }
627#endif
9ce192d4
RD
628}
629
630
d429e187
RD
631void ScintillaWX::UpdateSystemCaret() {
632#ifdef __WXMSW__
633 if (hasFocus) {
634 if (HasCaretSizeChanged()) {
635 DestroySystemCaret();
636 CreateSystemCaret();
637 }
638 Point pos = LocationFromPosition(currentPos);
639 ::SetCaretPos(pos.x, pos.y);
640 }
641#endif
642}
643
644
645bool ScintillaWX::HasCaretSizeChanged() {
646#ifdef __WXMSW__
647 if (( (0 != vs.caretWidth) && (sysCaretWidth != vs.caretWidth) )
648 || (0 != vs.lineHeight) && (sysCaretHeight != vs.lineHeight)) {
649 return true;
650 }
651#endif
652 return false;
653}
654
655bool ScintillaWX::CreateSystemCaret() {
656#ifdef __WXMSW__
657 sysCaretWidth = vs.caretWidth;
658 if (0 == sysCaretWidth) {
659 sysCaretWidth = 1;
660 }
661 sysCaretHeight = vs.lineHeight;
662 int bitmapSize = (((sysCaretWidth + 15) & ~15) >> 3) * sysCaretHeight;
663 char *bits = new char[bitmapSize];
664 memset(bits, 0, bitmapSize);
665 sysCaretBitmap = ::CreateBitmap(sysCaretWidth, sysCaretHeight, 1,
666 1, reinterpret_cast<BYTE *>(bits));
667 delete [] bits;
668 BOOL retval = ::CreateCaret(GetHwndOf(stc), sysCaretBitmap,
669 sysCaretWidth, sysCaretHeight);
670 ::ShowCaret(GetHwndOf(stc));
671 return retval != 0;
672#else
673 return false;
674#endif
675}
676
677bool ScintillaWX::DestroySystemCaret() {
678#ifdef __WXMSW__
679 ::HideCaret(GetHwndOf(stc));
680 BOOL retval = ::DestroyCaret();
681 if (sysCaretBitmap) {
682 ::DeleteObject(sysCaretBitmap);
683 sysCaretBitmap = 0;
684 }
685 return retval != 0;
686#else
687 return false;
688#endif
689}
690
691
692//----------------------------------------------------------------------
693
694
80dc1dd3 695sptr_t ScintillaWX::DefWndProc(unsigned int /*iMessage*/, uptr_t /*wParam*/, sptr_t /*lParam*/) {
9ce192d4
RD
696 return 0;
697}
698
80dc1dd3 699sptr_t ScintillaWX::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
fdec65df
RD
700 switch (iMessage) {
701 case SCI_CALLTIPSHOW: {
702 // NOTE: This is copied here from scintilla/src/ScintillaBase.cxx
9e730a78
RD
703 // because of the little tweak that needs done below for wxGTK.
704 // When updating new versions double check that this is still
705 // needed, and that any new code there is copied here too.
706 Point pt = LocationFromPosition(wParam);
707 char* defn = reinterpret_cast<char *>(lParam);
fdec65df 708 AutoCompleteCancel();
9e730a78
RD
709 pt.y += vs.lineHeight;
710 PRectangle rc = ct.CallTipStart(currentPos, pt,
711 defn,
712 vs.styles[STYLE_DEFAULT].fontName,
713 vs.styles[STYLE_DEFAULT].sizeZoomed,
a33203cb
RD
714 CodePage(),
715 vs.styles[STYLE_DEFAULT].characterSet,
9e730a78
RD
716 wMain);
717 // If the call-tip window would be out of the client
718 // space, adjust so it displays above the text.
719 PRectangle rcClient = GetClientRectangle();
720 if (rc.bottom > rcClient.bottom) {
fdec65df 721#ifdef __WXGTK__
9e730a78 722 int offset = int(vs.lineHeight * 1.25) + rc.Height();
fdec65df 723#else
9e730a78 724 int offset = vs.lineHeight + rc.Height();
fdec65df 725#endif
9e730a78
RD
726 rc.top -= offset;
727 rc.bottom -= offset;
fdec65df 728 }
9e730a78
RD
729 // Now display the window.
730 CreateCallTipWindow(rc);
731 ct.wCallTip.SetPositionRelative(rc, wMain);
732 ct.wCallTip.Show();
fdec65df 733 break;
9e730a78 734 }
fdec65df 735
e14d10b0 736#ifdef SCI_LEXER
7e126a07 737 case SCI_LOADLEXERLIBRARY:
e14d10b0
RD
738 LexerManager::GetInstance()->Load((const char*)lParam);
739 break;
740#endif
719493e1 741
fdec65df
RD
742 default:
743 return ScintillaBase::WndProc(iMessage, wParam, lParam);
744 }
745 return 0;
9ce192d4
RD
746}
747
748
749
750//----------------------------------------------------------------------
751// Event delegates
752
753void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
754
755 paintState = painting;
1a2fb4cd 756 Surface* surfaceWindow = Surface::Allocate();
9e730a78
RD
757 surfaceWindow->Init(dc, wMain.GetID());
758 rcPaint = PRectangleFromwxRect(rect);
759 PRectangle rcClient = GetClientRectangle();
760 paintingAllText = rcPaint.Contains(rcClient);
761
9e730a78 762 ClipChildren(*dc, rcPaint);
1a2fb4cd 763 Paint(surfaceWindow, rcPaint);
9e730a78 764
1a2fb4cd 765 delete surfaceWindow;
9ce192d4 766 if (paintState == paintAbandoned) {
cadea444
RD
767 // Painting area was insufficient to cover new styling or brace
768 // highlight positions
ab0f5fa6 769 FullPaint();
9ce192d4
RD
770 }
771 paintState = notPainting;
772}
773
774
775void ScintillaWX::DoHScroll(int type, int pos) {
776 int xPos = xOffset;
a834585d
RD
777 PRectangle rcText = GetTextRectangle();
778 int pageWidth = rcText.Width() * 2 / 3;
5fa4613c 779 if (type == wxEVT_SCROLLWIN_LINEUP || type == wxEVT_SCROLL_LINEUP)
9ce192d4 780 xPos -= H_SCROLL_STEP;
5fa4613c 781 else if (type == wxEVT_SCROLLWIN_LINEDOWN || type == wxEVT_SCROLL_LINEDOWN)
9ce192d4 782 xPos += H_SCROLL_STEP;
5fa4613c 783 else if (type == wxEVT_SCROLLWIN_PAGEUP || type == wxEVT_SCROLL_PAGEUP)
a834585d
RD
784 xPos -= pageWidth;
785 else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN) {
786 xPos += pageWidth;
787 if (xPos > scrollWidth - rcText.Width()) {
788 xPos = scrollWidth - rcText.Width();
789 }
790 }
5fa4613c 791 else if (type == wxEVT_SCROLLWIN_TOP || type == wxEVT_SCROLL_TOP)
9ce192d4 792 xPos = 0;
5fa4613c 793 else if (type == wxEVT_SCROLLWIN_BOTTOM || type == wxEVT_SCROLL_BOTTOM)
a834585d 794 xPos = scrollWidth;
5fa4613c 795 else if (type == wxEVT_SCROLLWIN_THUMBTRACK || type == wxEVT_SCROLL_THUMBTRACK)
9ce192d4 796 xPos = pos;
ce1ecc6d 797
9ce192d4
RD
798 HorizontalScrollTo(xPos);
799}
800
801void ScintillaWX::DoVScroll(int type, int pos) {
802 int topLineNew = topLine;
5fa4613c 803 if (type == wxEVT_SCROLLWIN_LINEUP || type == wxEVT_SCROLL_LINEUP)
9ce192d4 804 topLineNew -= 1;
5fa4613c 805 else if (type == wxEVT_SCROLLWIN_LINEDOWN || type == wxEVT_SCROLL_LINEDOWN)
9ce192d4 806 topLineNew += 1;
5fa4613c 807 else if (type == wxEVT_SCROLLWIN_PAGEUP || type == wxEVT_SCROLL_PAGEUP)
9ce192d4 808 topLineNew -= LinesToScroll();
5fa4613c 809 else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN)
9ce192d4 810 topLineNew += LinesToScroll();
5fa4613c 811 else if (type == wxEVT_SCROLLWIN_TOP || type == wxEVT_SCROLL_TOP)
9ce192d4 812 topLineNew = 0;
5fa4613c 813 else if (type == wxEVT_SCROLLWIN_BOTTOM || type == wxEVT_SCROLL_BOTTOM)
9ce192d4 814 topLineNew = MaxScrollPos();
5fa4613c 815 else if (type == wxEVT_SCROLLWIN_THUMBTRACK || type == wxEVT_SCROLL_THUMBTRACK)
9ce192d4 816 topLineNew = pos;
ce1ecc6d 817
9ce192d4
RD
818 ScrollTo(topLineNew);
819}
820
9b9337da
RD
821void ScintillaWX::DoMouseWheel(int rotation, int delta,
822 int linesPerAction, int ctrlDown,
823 bool isPageScroll ) {
37d62433
RD
824 int topLineNew = topLine;
825 int lines;
826
65ec6247
RD
827 if (ctrlDown) { // Zoom the fonts if Ctrl key down
828 if (rotation < 0) {
829 KeyCommand(SCI_ZOOMIN);
830 }
831 else {
832 KeyCommand(SCI_ZOOMOUT);
833 }
834 }
835 else { // otherwise just scroll the window
91f580b2
RD
836 if ( !delta )
837 delta = 120;
65ec6247
RD
838 wheelRotation += rotation;
839 lines = wheelRotation / delta;
840 wheelRotation -= lines * delta;
841 if (lines != 0) {
9b9337da
RD
842 if (isPageScroll)
843 lines = lines * LinesOnScreen(); // lines is either +1 or -1
844 else
845 lines *= linesPerAction;
65ec6247
RD
846 topLineNew -= lines;
847 ScrollTo(topLineNew);
848 }
37d62433
RD
849 }
850}
851
852
88a8b04e 853void ScintillaWX::DoSize(int WXUNUSED(width), int WXUNUSED(height)) {
1a2fb4cd 854 ChangeSize();
9ce192d4
RD
855}
856
857void ScintillaWX::DoLoseFocus(){
b0d0494f 858 focusEvent = true;
65ec6247 859 SetFocusState(false);
b0d0494f 860 focusEvent = false;
d429e187 861 DestroySystemCaret();
9ce192d4
RD
862}
863
864void ScintillaWX::DoGainFocus(){
b0d0494f 865 focusEvent = true;
65ec6247 866 SetFocusState(true);
b0d0494f 867 focusEvent = false;
d429e187
RD
868 DestroySystemCaret();
869 CreateSystemCaret();
9ce192d4
RD
870}
871
872void ScintillaWX::DoSysColourChange() {
873 InvalidateStyleData();
874}
875
2b5f62a0 876void ScintillaWX::DoLeftButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) {
9ce192d4
RD
877 ButtonDown(pt, curTime, shift, ctrl, alt);
878}
879
2b5f62a0 880void ScintillaWX::DoLeftButtonUp(Point pt, unsigned int curTime, bool ctrl) {
4d02625c 881 ButtonUp(pt, curTime, ctrl);
466c166f
RD
882#if wxUSE_DRAG_AND_DROP
883 if (startDragTimer->IsRunning()) {
884 startDragTimer->Stop();
4d02625c 885 SetDragPosition(invalidPosition);
f402150f 886 SetEmptySelection(PositionFromLocation(pt));
4d02625c 887 ShowCaretAtCurrentPosition();
466c166f 888 }
f402150f 889#endif // wxUSE_DRAG_AND_DROP
9ce192d4
RD
890}
891
2b5f62a0 892void ScintillaWX::DoLeftButtonMove(Point pt) {
9ce192d4
RD
893 ButtonMove(pt);
894}
895
2b5f62a0 896#ifdef __WXGTK__
88a8b04e 897void ScintillaWX::DoMiddleButtonUp(Point pt) {
2b5f62a0
VZ
898 // Set the current position to the mouse click point and
899 // then paste in the PRIMARY selection, if any. wxGTK only.
900 int newPos = PositionFromLocation(pt);
8e54aaed 901 MovePositionTo(newPos, noSel, true);
2b5f62a0
VZ
902
903 pdoc->BeginUndoAction();
904 wxTextDataObject data;
7e126a07 905 bool gotData = false;
e5abfc48 906 wxTheClipboard->UsePrimarySelection(true);
2b5f62a0 907 if (wxTheClipboard->Open()) {
2b5f62a0 908 gotData = wxTheClipboard->GetData(data);
2b5f62a0
VZ
909 wxTheClipboard->Close();
910 }
e5abfc48 911 wxTheClipboard->UsePrimarySelection(false);
2b5f62a0 912 if (gotData) {
610c50a2
RD
913 wxString text = wxTextBuffer::Translate(data.GetText(),
914 wxConvertEOLMode(pdoc->eolMode));
915 wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
2b5f62a0
VZ
916 int len = strlen(buf);
917 pdoc->InsertString(currentPos, buf, len);
918 SetEmptySelection(currentPos + len);
919 }
920 pdoc->EndUndoAction();
921 NotifyChange();
922 Redraw();
923
924 ShowCaretAtCurrentPosition();
925 EnsureCaretVisible();
2b5f62a0 926}
88a8b04e
RD
927#else
928void ScintillaWX::DoMiddleButtonUp(Point WXUNUSED(pt)) {
929}
930#endif
2b5f62a0 931
9ce192d4 932
10ef30eb 933void ScintillaWX::DoAddChar(int key) {
2b5f62a0 934#if wxUSE_UNICODE
fdec65df 935 wxChar wszChars[2];
c8b75e94 936 wszChars[0] = (wxChar)key;
fdec65df
RD
937 wszChars[1] = 0;
938 wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(wszChars);
2b5f62a0
VZ
939 AddCharUTF((char*)buf.data(), strlen(buf));
940#else
c8b75e94 941 AddChar((char)key);
2b5f62a0 942#endif
9ce192d4
RD
943}
944
2b5f62a0 945
5fd656d5
RD
946int ScintillaWX::DoKeyDown(const wxKeyEvent& evt, bool* consumed)
947{
948 int key = evt.GetKeyCode();
949 bool shift = evt.ShiftDown(),
950 ctrl = evt.ControlDown(),
951 alt = evt.AltDown();
249b31b5 952
443eb93a 953 if (ctrl && key >= 1 && key <= 26 && key != WXK_BACK)
39178e3b 954 key += 'A' - 1;
39178e3b 955
d134f170 956 switch (key) {
0b9dfbc0
RD
957 case WXK_DOWN: key = SCK_DOWN; break;
958 case WXK_UP: key = SCK_UP; break;
959 case WXK_LEFT: key = SCK_LEFT; break;
960 case WXK_RIGHT: key = SCK_RIGHT; break;
961 case WXK_HOME: key = SCK_HOME; break;
962 case WXK_END: key = SCK_END; break;
5bd24f72
RD
963 case WXK_PAGEUP: key = SCK_PRIOR; break;
964 case WXK_PAGEDOWN: key = SCK_NEXT; break;
340515d3
RD
965 case WXK_NUMPAD_DOWN: key = SCK_DOWN; break;
966 case WXK_NUMPAD_UP: key = SCK_UP; break;
967 case WXK_NUMPAD_LEFT: key = SCK_LEFT; break;
968 case WXK_NUMPAD_RIGHT: key = SCK_RIGHT; break;
969 case WXK_NUMPAD_HOME: key = SCK_HOME; break;
970 case WXK_NUMPAD_END: key = SCK_END; break;
5bd24f72
RD
971 case WXK_NUMPAD_PAGEUP: key = SCK_PRIOR; break;
972 case WXK_NUMPAD_PAGEDOWN: key = SCK_NEXT; break;
e64481bf
RD
973 case WXK_NUMPAD_DELETE: key = SCK_DELETE; break;
974 case WXK_NUMPAD_INSERT: key = SCK_INSERT; break;
0b9dfbc0
RD
975 case WXK_DELETE: key = SCK_DELETE; break;
976 case WXK_INSERT: key = SCK_INSERT; break;
977 case WXK_ESCAPE: key = SCK_ESCAPE; break;
978 case WXK_BACK: key = SCK_BACK; break;
979 case WXK_TAB: key = SCK_TAB; break;
21334a46 980 case WXK_NUMPAD_ENTER: // fall through
0b9dfbc0
RD
981 case WXK_RETURN: key = SCK_RETURN; break;
982 case WXK_ADD: // fall through
983 case WXK_NUMPAD_ADD: key = SCK_ADD; break;
984 case WXK_SUBTRACT: // fall through
985 case WXK_NUMPAD_SUBTRACT: key = SCK_SUBTRACT; break;
986 case WXK_DIVIDE: // fall through
987 case WXK_NUMPAD_DIVIDE: key = SCK_DIVIDE; break;
988 case WXK_CONTROL: key = 0; break;
989 case WXK_ALT: key = 0; break;
990 case WXK_SHIFT: key = 0; break;
991 case WXK_MENU: key = 0; break;
d134f170
RD
992 }
993
88a8b04e 994#ifdef __WXMAC__
5fd656d5 995 if ( evt.MetaDown() ) {
88a8b04e
RD
996 // check for a few common Mac Meta-key combos and remap them to Ctrl
997 // for Scintilla
998 switch ( key ) {
999 case 'Z': // Undo
1000 case 'X': // Cut
1001 case 'C': // Copy
1002 case 'V': // Paste
1003 case 'A': // Select All
1004 ctrl = true;
1005 break;
dd9b0a54
RD
1006 }
1007 }
88a8b04e 1008#endif
7e126a07 1009
d6582821 1010 int rv = KeyDown(key, shift, ctrl, alt, consumed);
0122b7e3 1011
d6582821
RD
1012 if (key)
1013 return rv;
1014 else
1015 return 1;
9ce192d4
RD
1016}
1017
1018
1019void ScintillaWX::DoCommand(int ID) {
1020 Command(ID);
1021}
1022
1023
1024void ScintillaWX::DoContextMenu(Point pt) {
752cd08c
RD
1025 if (displayPopupMenu)
1026 ContextMenu(pt);
9ce192d4
RD
1027}
1028
f6bcfd97
BP
1029void ScintillaWX::DoOnListBox() {
1030 AutoCompleteCompleted();
1031}
9ce192d4 1032
7e126a07 1033
8e54aaed
RD
1034void ScintillaWX::DoOnIdle(wxIdleEvent& evt) {
1035
1036 if ( Idle() )
1037 evt.RequestMore();
1038 else
1039 SetIdle(false);
1040}
7e126a07 1041
9ce192d4
RD
1042//----------------------------------------------------------------------
1043
1bc32508 1044#if wxUSE_DRAG_AND_DROP
9ce192d4
RD
1045bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
1046 SetDragPosition(invalidPosition);
a29a241f 1047
610c50a2
RD
1048 wxString text = wxTextBuffer::Translate(data,
1049 wxConvertEOLMode(pdoc->eolMode));
7e126a07 1050
a29a241f
RD
1051 // Send an event to allow the drag details to be changed
1052 wxStyledTextEvent evt(wxEVT_STC_DO_DROP, stc->GetId());
1053 evt.SetEventObject(stc);
1054 evt.SetDragResult(dragResult);
1055 evt.SetX(x);
1056 evt.SetY(y);
1057 evt.SetPosition(PositionFromLocation(Point(x,y)));
610c50a2 1058 evt.SetDragText(text);
a29a241f
RD
1059 stc->GetEventHandler()->ProcessEvent(evt);
1060
1061 dragResult = evt.GetDragResult();
1062 if (dragResult == wxDragMove || dragResult == wxDragCopy) {
1063 DropAt(evt.GetPosition(),
0c5b83b0 1064 wx2stc(evt.GetDragText()),
a29a241f 1065 dragResult == wxDragMove,
7e126a07
WS
1066 false); // TODO: rectangular?
1067 return true;
a29a241f 1068 }
7e126a07 1069 return false;
9ce192d4
RD
1070}
1071
1072
88a8b04e 1073wxDragResult ScintillaWX::DoDragEnter(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResult def) {
b8b0e402
RD
1074 dragResult = def;
1075 return dragResult;
9ce192d4
RD
1076}
1077
1078
1079wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
1080 SetDragPosition(PositionFromLocation(Point(x, y)));
a29a241f
RD
1081
1082 // Send an event to allow the drag result to be changed
1083 wxStyledTextEvent evt(wxEVT_STC_DRAG_OVER, stc->GetId());
1084 evt.SetEventObject(stc);
1085 evt.SetDragResult(def);
1086 evt.SetX(x);
1087 evt.SetY(y);
1088 evt.SetPosition(PositionFromLocation(Point(x,y)));
1089 stc->GetEventHandler()->ProcessEvent(evt);
1090
1091 dragResult = evt.GetDragResult();
b8b0e402 1092 return dragResult;
9ce192d4
RD
1093}
1094
1095
1096void ScintillaWX::DoDragLeave() {
1097 SetDragPosition(invalidPosition);
1098}
f402150f 1099#endif // wxUSE_DRAG_AND_DROP
9ce192d4
RD
1100//----------------------------------------------------------------------
1101
cadea444 1102// Force the whole window to be repainted
ab0f5fa6 1103void ScintillaWX::FullPaint() {
719493e1 1104#ifndef __WXMAC__
cadea444 1105 stc->Refresh(false);
719493e1 1106#endif
cadea444 1107 stc->Update();
9ce192d4
RD
1108}
1109
1110
1111void ScintillaWX::DoScrollToLine(int line) {
1112 ScrollTo(line);
1113}
1114
1115
1116void ScintillaWX::DoScrollToColumn(int column) {
1117 HorizontalScrollTo(column * vs.spaceWidth);
1118}
1119
382fe640
RD
1120// wxGTK doesn't appear to need this explicit clipping code any longer, but I
1121// will leave it here commented out for a while just in case...
1122void ScintillaWX::ClipChildren(wxDC& WXUNUSED(dc), PRectangle WXUNUSED(rect))
1123{
1124// wxRegion rgn(wxRectFromPRectangle(rect));
1125// if (ac.Active()) {
1126// wxRect childRect = ((wxWindow*)ac.lb->GetID())->GetRect();
1127// rgn.Subtract(childRect);
1128// }
1129// if (ct.inCallTipMode) {
1130// wxSTCCallTip* tip = (wxSTCCallTip*)ct.wCallTip.GetID();
1131// wxRect childRect = tip->GetRect();
1132// #if wxUSE_POPUPWIN && wxSTC_USE_POPUP
1133// childRect.SetPosition(tip->GetMyPosition());
1134// #endif
1135// rgn.Subtract(childRect);
1136// }
1137// dc.SetClippingRegion(rgn);
88a8b04e 1138}
9ce192d4 1139
d1558f3d
RD
1140
1141void ScintillaWX::SetUseAntiAliasing(bool useAA) {
1142 vs.extraFontFlag = useAA;
1143 InvalidateStyleRedraw();
1144}
1145
1146bool ScintillaWX::GetUseAntiAliasing() {
1147 return vs.extraFontFlag;
1148}
7e126a07 1149
9ce192d4
RD
1150//----------------------------------------------------------------------
1151//----------------------------------------------------------------------
29825f5f
PC
1152
1153#endif // wxUSE_STC