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