92
92
class wxSCICallTip : public wxSCICallTipBase {
94
wxSCICallTip(wxWindow* parent, CallTip* ct, ScintillaWX* swx)
95
: wxSCICallTipBase(parent, param2),
96
m_ct(ct), m_swx(swx), m_cx(-1), m_cy(-1)
94
wxSCICallTip(wxWindow* parent, CallTip* ct, ScintillaWX* swx)
95
: wxSCICallTipBase(parent, param2),
96
m_ct(ct), m_swx(swx), m_cx(-1), m_cy(-1) {
101
100
#if wxUSE_POPUPWIN && wxSCI_USE_POPUP && defined(__WXGTK__)
102
wxRect rect = GetRect();
105
GetParent()->Refresh(false, &rect);
101
wxRect rect = GetRect();
104
GetParent()->Refresh(false, &rect);
109
bool AcceptsFocus() const { return false; }
111
void OnPaint(wxPaintEvent& WXUNUSED(evt)) {
112
wxBufferedPaintDC dc(this);
113
Surface* surfaceWindow = Surface::Allocate();
114
surfaceWindow->Init(&dc, m_ct->wDraw.GetID());
115
m_ct->PaintCT(surfaceWindow);
116
surfaceWindow->Release();
117
delete surfaceWindow;
120
void OnFocus(wxFocusEvent& event) {
121
GetParent()->SetFocus();
125
void OnLeftDown(wxMouseEvent& event) {
126
wxPoint pt = event.GetPosition();
129
m_swx->CallTipClick();
108
bool AcceptsFocus() const {
112
void OnPaint(wxPaintEvent& WXUNUSED(evt)) {
113
wxBufferedPaintDC dc(this);
114
Surface* surfaceWindow = Surface::Allocate();
115
surfaceWindow->Init(&dc, m_ct->wDraw.GetID());
116
m_ct->PaintCT(surfaceWindow);
117
surfaceWindow->Release();
118
delete surfaceWindow;
121
void OnFocus(wxFocusEvent& event) {
122
GetParent()->SetFocus();
126
void OnLeftDown(wxMouseEvent& event) {
127
wxPoint pt = event.GetPosition();
130
m_swx->CallTipClick();
132
133
#if wxUSE_POPUPWIN && wxSCI_USE_POPUP
133
virtual void DoSetSize(int x, int y,
134
int width, int height,
135
int sizeFlags = wxSIZE_AUTO) {
138
GetParent()->ClientToScreen(&x, NULL);
142
GetParent()->ClientToScreen(NULL, &y);
144
wxSCICallTipBase::DoSetSize(x, y, width, height, sizeFlags);
134
virtual void DoSetSize(int x, int y,
135
int width, int height,
136
int sizeFlags = wxSIZE_AUTO) {
139
GetParent()->ClientToScreen(&x, NULL);
143
GetParent()->ClientToScreen(NULL, &y);
145
wxSCICallTipBase::DoSetSize(x, y, width, height, sizeFlags);
148
wxPoint GetMyPosition() {
149
return wxPoint(m_cx, m_cy);
149
wxPoint GetMyPosition() {
150
return wxPoint(m_cx, m_cy);
156
DECLARE_EVENT_TABLE()
157
DECLARE_EVENT_TABLE()
159
160
BEGIN_EVENT_TABLE(wxSCICallTip, wxSCICallTipBase)
160
EVT_PAINT(wxSCICallTip::OnPaint)
161
EVT_SET_FOCUS(wxSCICallTip::OnFocus)
162
EVT_LEFT_DOWN(wxSCICallTip::OnLeftDown)
161
EVT_PAINT(wxSCICallTip::OnPaint)
162
EVT_SET_FOCUS(wxSCICallTip::OnFocus)
163
EVT_LEFT_DOWN(wxSCICallTip::OnLeftDown)
163
164
END_EVENT_TABLE()
166
167
//----------------------------------------------------------------------
168
169
#if wxUSE_DATAOBJ
169
static wxTextFileType wxConvertEOLMode(int scintillaMode)
173
switch (scintillaMode) {
175
type = wxTextFileType_Dos;
179
type = wxTextFileType_Mac;
183
type = wxTextFileType_Unix;
187
type = wxTextBuffer::typeDefault;
170
static wxTextFileType wxConvertEOLMode(int scintillaMode) {
173
switch (scintillaMode) {
175
type = wxTextFileType_Dos;
179
type = wxTextFileType_Mac;
183
type = wxTextFileType_Unix;
187
type = wxTextBuffer::typeDefault;
192
192
#endif // wxUSE_DATAOBJ
195
static int wxCountLines(const char* text, int scintillaMode)
199
switch (scintillaMode) {
213
while (text[i] != 0) {
214
if (text[i] == eolchar) {
195
static int wxCountLines(const char* text, int scintillaMode) {
198
switch (scintillaMode) {
212
while (text[i] != 0) {
213
if (text[i] == eolchar) {
223
222
//----------------------------------------------------------------------
285
284
// For recent wxGTKs, DnD won't work if we delay with the timer, so go there direct
288
startDragTimer->Start (200, true);
287
startDragTimer->Start (200, true);
289
288
#endif // wxVERSION_NUMBER >= 2701 && defined(__WXGTK20__)
293
292
void ScintillaWX::DoStartDrag() {
294
293
#if wxUSE_DRAG_AND_DROP
295
wxString dragText = sci2wx (drag.s, drag.len);
294
wxString dragText = sci2wx (drag.s, drag.len);
297
// Send an event to allow the drag text to be changed
298
wxScintillaEvent evt(wxEVT_SCI_START_DRAG, sci->GetId());
299
evt.SetEventObject (sci);
300
evt.SetDragText (dragText);
301
evt.SetDragAllowMove (true);
302
evt.SetPosition (wxMin(sci->GetSelectionStart(), sci->GetSelectionEnd()));
303
sci->GetEventHandler()->ProcessEvent (evt);
296
// Send an event to allow the drag text to be changed
297
wxScintillaEvent evt(wxEVT_SCI_START_DRAG, sci->GetId());
298
evt.SetEventObject (sci);
299
evt.SetDragText (dragText);
300
evt.SetDragAllowMove (true);
301
evt.SetPosition (wxMin(sci->GetSelectionStart(), sci->GetSelectionEnd()));
302
sci->GetEventHandler()->ProcessEvent (evt);
305
304
pdoc->BeginUndoAction();
306
dragText = evt.GetDragText();
307
dragRectangle = drag.rectangular;
308
if (dragText.Length()) {
309
wxDropSource source(sci);
310
wxTextDataObject data(dragText);
311
source.SetData(data);
305
dragText = evt.GetDragText();
306
dragRectangle = drag.rectangular;
307
if (dragText.Length()) {
308
wxDropSource source(sci);
309
wxTextDataObject data(dragText);
310
source.SetData(data);
313
inDragDrop = ddDragging;
314
source.DoDragDrop(wxDrag_DefaultMove);
316
SetDragPosition (SelectionPosition(invalidPosition));
312
inDragDrop = ddDragging;
313
source.DoDragDrop(wxDrag_DefaultMove);
315
SetDragPosition (SelectionPosition(invalidPosition));
318
317
pdoc->EndUndoAction();
323
322
bool ScintillaWX::SetIdle(bool on) {
324
if (idler.state != on) {
325
// connect or disconnect the EVT_IDLE handler
327
sci->Connect(wxID_ANY, wxEVT_IDLE,
328
(wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) &wxScintilla::OnIdle);
330
sci->Disconnect(wxID_ANY, wxEVT_IDLE,
331
(wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) &wxScintilla::OnIdle);
323
if (idler.state != on) {
324
// connect or disconnect the EVT_IDLE handler
326
sci->Connect(wxID_ANY, wxEVT_IDLE,
327
(wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) &wxScintilla::OnIdle);
329
sci->Disconnect(wxID_ANY, wxEVT_IDLE,
330
(wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) &wxScintilla::OnIdle);
338
337
void ScintillaWX::SetTicking(bool on) {
339
wxSCITimer* stiTimer;
340
if (timer.ticking != on) {
343
stiTimer = new wxSCITimer(this);
344
stiTimer->Start(timer.tickSize);
345
timer.tickerID = stiTimer;
347
stiTimer = (wxSCITimer*)timer.tickerID;
353
timer.ticksToWait = caret.period;
338
wxSCITimer* stiTimer;
339
if (timer.ticking != on) {
342
stiTimer = new wxSCITimer(this);
343
stiTimer->Start(timer.tickSize);
344
timer.tickerID = stiTimer;
346
stiTimer = (wxSCITimer*)timer.tickerID;
352
timer.ticksToWait = caret.period;
357
356
void ScintillaWX::SetMouseCapture(bool on) {
358
if (mouseDownCaptures) {
359
if (on && !capturedMouse)
361
else if (!on && capturedMouse && sci->HasCapture())
357
if (mouseDownCaptures) {
358
if (on && !capturedMouse)
360
else if (!on && capturedMouse && sci->HasCapture())
368
367
bool ScintillaWX::HaveMouseCapture() {
369
return capturedMouse;
368
return capturedMouse;
373
372
void ScintillaWX::ScrollText(int linesToMove) {
374
int dy = vs.lineHeight * (linesToMove);
375
sci->ScrollWindow(0, dy);
373
int dy = vs.lineHeight * (linesToMove);
374
sci->ScrollWindow(0, dy);
379
378
void ScintillaWX::SetVerticalScrollPos() {
380
if (sci->m_vScrollBar == NULL) { // Use built-in scrollbar
381
sci->SetScrollPos(wxVERTICAL, topLine);
383
else { // otherwise use the one that's been given to us
384
sci->m_vScrollBar->SetThumbPosition(topLine);
379
if (sci->m_vScrollBar == NULL) { // Use built-in scrollbar
380
sci->SetScrollPos(wxVERTICAL, topLine);
381
} else { // otherwise use the one that's been given to us
382
sci->m_vScrollBar->SetThumbPosition(topLine);
388
386
void ScintillaWX::SetHorizontalScrollPos() {
389
if (sci->m_hScrollBar == NULL) { // Use built-in scrollbar
390
sci->SetScrollPos(wxHORIZONTAL, xOffset);
392
else { // otherwise use the one that's been given to us
393
sci->m_hScrollBar->SetThumbPosition(xOffset);
387
if (sci->m_hScrollBar == NULL) { // Use built-in scrollbar
388
sci->SetScrollPos(wxHORIZONTAL, xOffset);
389
} else { // otherwise use the one that's been given to us
390
sci->m_hScrollBar->SetThumbPosition(xOffset);
398
395
const int H_SCROLL_STEP = 20;
400
397
bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
401
bool modified = false;
404
if (!verticalScrollBarVisible)
407
// Check the vertical scrollbar
408
if (sci->m_vScrollBar == NULL) { // Use built-in scrollbar
409
int sbMax = sci->GetScrollRange(wxVERTICAL);
410
int sbThumb = sci->GetScrollThumb(wxVERTICAL);
411
int sbPos = sci->GetScrollPos(wxVERTICAL);
412
if (sbMax != vertEnd || sbThumb != nPage) {
413
sci->SetScrollbar(wxVERTICAL, sbPos, nPage, vertEnd+1);
417
else { // otherwise use the one that's been given to us
418
int sbMax = sci->m_vScrollBar->GetRange();
419
int sbPage = sci->m_vScrollBar->GetPageSize();
420
int sbPos = sci->m_vScrollBar->GetThumbPosition();
421
if (sbMax != vertEnd || sbPage != nPage) {
422
sci->m_vScrollBar->SetScrollbar(sbPos, nPage, vertEnd+1, nPage);
428
// Check the horizontal scrollbar
429
PRectangle rcText = GetTextRectangle();
430
int horizEnd = scrollWidth;
433
if (!horizontalScrollBarVisible || (wrapState != eWrapNone))
435
int pageWidth = rcText.Width();
437
if (sci->m_hScrollBar == NULL) { // Use built-in scrollbar
438
int sbMax = sci->GetScrollRange(wxHORIZONTAL);
439
int sbThumb = sci->GetScrollThumb(wxHORIZONTAL);
440
int sbPos = sci->GetScrollPos(wxHORIZONTAL);
441
if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
442
sci->SetScrollbar(wxHORIZONTAL, sbPos, pageWidth, horizEnd);
444
if (scrollWidth < pageWidth) {
445
HorizontalScrollTo(0);
449
else { // otherwise use the one that's been given to us
450
int sbMax = sci->m_hScrollBar->GetRange();
451
int sbThumb = sci->m_hScrollBar->GetPageSize();
452
int sbPos = sci->m_hScrollBar->GetThumbPosition();
453
if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
454
sci->m_hScrollBar->SetScrollbar(sbPos, pageWidth, horizEnd, pageWidth);
456
if (scrollWidth < pageWidth) {
457
HorizontalScrollTo(0);
398
bool modified = false;
401
if (!verticalScrollBarVisible)
404
// Check the vertical scrollbar
405
if (sci->m_vScrollBar == NULL) { // Use built-in scrollbar
406
int sbMax = sci->GetScrollRange(wxVERTICAL);
407
int sbThumb = sci->GetScrollThumb(wxVERTICAL);
408
int sbPos = sci->GetScrollPos(wxVERTICAL);
409
if (sbMax != vertEnd || sbThumb != nPage) {
410
sci->SetScrollbar(wxVERTICAL, sbPos, nPage, vertEnd+1);
413
} else { // otherwise use the one that's been given to us
414
int sbMax = sci->m_vScrollBar->GetRange();
415
int sbPage = sci->m_vScrollBar->GetPageSize();
416
int sbPos = sci->m_vScrollBar->GetThumbPosition();
417
if (sbMax != vertEnd || sbPage != nPage) {
418
sci->m_vScrollBar->SetScrollbar(sbPos, nPage, vertEnd+1, nPage);
424
// Check the horizontal scrollbar
425
PRectangle rcText = GetTextRectangle();
426
int horizEnd = scrollWidth;
429
if (!horizontalScrollBarVisible || (wrapState != eWrapNone))
431
int pageWidth = rcText.Width();
433
if (sci->m_hScrollBar == NULL) { // Use built-in scrollbar
434
int sbMax = sci->GetScrollRange(wxHORIZONTAL);
435
int sbThumb = sci->GetScrollThumb(wxHORIZONTAL);
436
int sbPos = sci->GetScrollPos(wxHORIZONTAL);
437
if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
438
sci->SetScrollbar(wxHORIZONTAL, sbPos, pageWidth, horizEnd);
440
if (scrollWidth < pageWidth) {
441
HorizontalScrollTo(0);
444
} else { // otherwise use the one that's been given to us
445
int sbMax = sci->m_hScrollBar->GetRange();
446
int sbThumb = sci->m_hScrollBar->GetPageSize();
447
int sbPos = sci->m_hScrollBar->GetThumbPosition();
448
if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
449
sci->m_hScrollBar->SetScrollbar(sbPos, pageWidth, horizEnd, pageWidth);
451
if (scrollWidth < pageWidth) {
452
HorizontalScrollTo(0);
466
461
void ScintillaWX::NotifyChange() {
471
466
void ScintillaWX::NotifyParent(SCNotification scn) {
472
sci->NotifyParent(&scn);
467
sci->NotifyParent(&scn);
478
473
// a side effect that the AutoComp will also not be destroyed when switching
479
474
// to another window, but I think that is okay.
480
475
void ScintillaWX::CancelModes() {
482
AutoCompleteCancel();
484
Editor::CancelModes();
477
AutoCompleteCancel();
479
Editor::CancelModes();
488
483
void ScintillaWX::Copy() {
489
if ( !sel.Empty() ) {
491
CopySelectionRange(&st);
484
if ( !sel.Empty() ) {
486
CopySelectionRange(&st);
493
488
for(int i=0; i<5; i++) {
494
489
//wxPrintf(wxT("Copying to clipboard %ld\n"), i);
504
499
void ScintillaWX::Paste() {
505
pdoc->BeginUndoAction();
500
pdoc->BeginUndoAction();
508
503
#if wxUSE_DATAOBJ
509
wxTextDataObject data;
514
bool rectangular = false;
516
wxTheClipboard->UsePrimarySelection(false);
517
if (wxTheClipboard->Open()) {
518
wxCustomDataObject selData(wxDataFormat(wxString(wxT("application/x-cbrectdata"))));
519
bool gotRectData = wxTheClipboard->GetData(selData);
521
if (gotRectData && selData.GetSize()>1) {
522
const char* rectBuf = (const char*)selData.GetData();
523
rectangular = rectBuf[0] == (char)1;
524
len = selData.GetDataSize()-1;
525
char* buffer = new char[len];
526
memcpy (buffer, rectBuf+1, len);
527
textString = sci2wx(buffer, len);
530
bool gotData = wxTheClipboard->GetData(data);
532
textString = wxTextBuffer::Translate (data.GetText(),
533
wxConvertEOLMode(pdoc->eolMode));
536
data.SetText(wxEmptyString); // free the data object content
537
wxTheClipboard->Close();
540
buf = (wxWX2MBbuf)wx2sci(textString);
543
int caretMain = sel.MainCaret();
545
SelectionPosition selStart = sel.Range(sel.Main()).Start();
546
int newLine = pdoc->LineFromPosition (caretMain) + wxCountLines (buf, pdoc->eolMode);
547
int newCol = pdoc->GetColumn(caretMain);
548
PasteRectangular (selStart, buf, len);
549
newPos = pdoc->FindColumn (newLine, newCol);
551
pdoc->InsertString (caretMain, buf, len);
552
newPos = caretMain + len;
554
SetEmptySelection (newPos);
504
wxTextDataObject data;
509
bool rectangular = false;
511
wxTheClipboard->UsePrimarySelection(false);
512
if (wxTheClipboard->Open()) {
513
wxCustomDataObject selData(wxDataFormat(wxString(wxT("application/x-cbrectdata"))));
514
bool gotRectData = wxTheClipboard->GetData(selData);
516
if (gotRectData && selData.GetSize()>1) {
517
const char* rectBuf = (const char*)selData.GetData();
518
rectangular = rectBuf[0] == (char)1;
519
len = selData.GetDataSize()-1;
520
char* buffer = new char[len];
521
memcpy (buffer, rectBuf+1, len);
522
textString = sci2wx(buffer, len);
525
bool gotData = wxTheClipboard->GetData(data);
527
textString = wxTextBuffer::Translate (data.GetText(),
528
wxConvertEOLMode(pdoc->eolMode));
531
data.SetText(wxEmptyString); // free the data object content
532
wxTheClipboard->Close();
535
// Check to see if the Copy() command inserted a '\r\n' at the begining of the textString
536
bool allowCopyLines(false);
538
buf = (wxWX2MBbuf)wx2sci(textString);
541
// Eran: Allow copy-line to be inserted at the begining of the next line instead
542
// of at the current caret position
543
if(len > 0 && buf.data()[len-1] == '\n') {
544
allowCopyLines = true;
548
int caretMain = sel.MainCaret();
550
SelectionPosition selStart = sel.Range(sel.Main()).Start();
551
int newLine = pdoc->LineFromPosition (caretMain) + wxCountLines (buf, pdoc->eolMode);
552
int newCol = pdoc->GetColumn(caretMain);
553
PasteRectangular (selStart, buf, len);
554
newPos = pdoc->FindColumn (newLine, newCol);
556
bool allowCopyLineSuccess(false);
558
// copied text ends with \r\n OR \n
559
int lineNum = pdoc->LineFromPosition(caretMain);
560
if(lineNum != wxNOT_FOUND) {
561
int where = pdoc->LineStart(lineNum);
562
if(where != wxNOT_FOUND) {
563
pdoc->InsertString(where, buf, len);
564
newPos = where + len;
566
allowCopyLineSuccess = true;
571
if(!allowCopyLineSuccess) {
572
// Simple copy paste block
573
pdoc->InsertString (caretMain, buf, len);
574
newPos = caretMain + len;
577
SetEmptySelection (newPos);
555
578
#endif // wxUSE_DATAOBJ
557
pdoc->EndUndoAction();
580
pdoc->EndUndoAction();
563
586
void ScintillaWX::CopyToClipboard (const SelectionText& st) {
564
587
#if wxUSE_CLIPBOARD
565
wxTheClipboard->UsePrimarySelection(false);
588
wxTheClipboard->UsePrimarySelection(false);
566
589
if (wxTheClipboard->Open()) {
567
wxString text = wxTextBuffer::Translate (sci2wx(st.s, st.len-1));
569
// composite object will hold "plain text" for pasting in other programs and a custom
570
// object for local use that remembers what kind of selection was made (stream or
572
wxDataObjectComposite* obj = new wxDataObjectComposite();
573
wxCustomDataObject* rectData = new wxCustomDataObject (wxDataFormat(wxString(wxT("application/x-cbrectdata"))));
575
char* buffer = new char[st.len+1];
576
buffer[0] = (st.rectangular)? (char)1 : (char)0;
577
memcpy (buffer+1, st.s, st.len);
578
rectData->SetData (st.len+1, buffer);
581
obj->Add (rectData, true);
582
obj->Add (new wxTextDataObject (text));
583
wxTheClipboard->SetData (obj);
584
wxTheClipboard->Close();
590
wxString text = wxTextBuffer::Translate (sci2wx(st.s, st.len-1));
592
// composite object will hold "plain text" for pasting in other programs and a custom
593
// object for local use that remembers what kind of selection was made (stream or
595
wxDataObjectComposite* obj = new wxDataObjectComposite();
596
wxCustomDataObject* rectData = new wxCustomDataObject (wxDataFormat(wxString(wxT("application/x-cbrectdata"))));
598
char* buffer = new char[st.len+1];
599
buffer[0] = (st.rectangular)? (char)1 : (char)0;
600
memcpy (buffer+1, st.s, st.len);
601
rectData->SetData (st.len+1, buffer);
604
obj->Add (rectData, true);
605
obj->Add (new wxTextDataObject (text));
606
wxTheClipboard->SetData (obj);
607
wxTheClipboard->Close();
588
611
#endif // wxUSE_CLIPBOARD
592
615
bool ScintillaWX::CanPaste() {
593
wxTheClipboard->UsePrimarySelection(false);
616
wxTheClipboard->UsePrimarySelection(false);
594
617
#if wxUSE_CLIPBOARD
595
bool canPaste = false;
598
if (Editor::CanPaste()) {
599
didOpen = !wxTheClipboard->IsOpened();
601
wxTheClipboard->Open();
603
if (wxTheClipboard->IsOpened()) {
604
canPaste = wxTheClipboard->IsSupported(wxUSE_UNICODE ? wxDF_UNICODETEXT : wxDF_TEXT);
606
wxTheClipboard->Close();
618
bool canPaste = false;
621
if (Editor::CanPaste()) {
622
didOpen = !wxTheClipboard->IsOpened();
624
wxTheClipboard->Open();
626
if (wxTheClipboard->IsOpened()) {
627
canPaste = wxTheClipboard->IsSupported(wxUSE_UNICODE ? wxDF_UNICODETEXT : wxDF_TEXT);
629
wxTheClipboard->Close();
612
635
#endif // wxUSE_CLIPBOARD
615
638
void ScintillaWX::CreateCallTipWindow(PRectangle) {
616
if (! ct.wCallTip.Created() ) {
617
ct.wCallTip = new wxSCICallTip(sci, &ct, this);
618
ct.wDraw = ct.wCallTip;
639
if (! ct.wCallTip.Created() ) {
640
ct.wCallTip = new wxSCICallTip(sci, &ct, this);
641
ct.wDraw = ct.wCallTip;
623
646
void ScintillaWX::AddToPopUp(const char *label, int cmd, bool enabled) {
625
((wxMenu*)popup.GetID())->AppendSeparator();
627
((wxMenu*)popup.GetID())->Append(cmd, wxGetTranslation(sci2wx(label)));
648
((wxMenu*)popup.GetID())->AppendSeparator();
650
((wxMenu*)popup.GetID())->Append(cmd, wxGetTranslation(sci2wx(label)));
630
((wxMenu*)popup.GetID())->Enable(cmd, enabled);
653
((wxMenu*)popup.GetID())->Enable(cmd, enabled);
672
695
bool ScintillaWX::HasCaretSizeChanged() {
674
697
#if !wxCHECK_VERSION(2, 5, 0)
677
if (( (0 != vs.caretWidth) && (sysCaretWidth != vs.caretWidth) )
678
|| (0 != vs.lineHeight) && (sysCaretHeight != vs.lineHeight)) {
700
if (( (0 != vs.caretWidth) && (sysCaretWidth != vs.caretWidth) )
701
|| (0 != vs.lineHeight) && (sysCaretHeight != vs.lineHeight)) {
686
709
bool ScintillaWX::CreateSystemCaret() {
688
711
#if !wxCHECK_VERSION(2, 5, 0)
691
sysCaretWidth = vs.caretWidth;
692
if (0 == sysCaretWidth) {
695
sysCaretHeight = vs.lineHeight;
696
int bitmapSize = (((sysCaretWidth + 15) & ~15) >> 3) * sysCaretHeight;
697
char *bits = new char[bitmapSize];
698
memset(bits, 0, bitmapSize);
699
sysCaretBitmap = ::CreateBitmap(sysCaretWidth, sysCaretHeight, 1,
700
1, reinterpret_cast<BYTE *>(bits));
702
BOOL retval = ::CreateCaret(GetHwndOf(sci), sysCaretBitmap,
703
sysCaretWidth, sysCaretHeight);
704
::ShowCaret(GetHwndOf(sci));
714
sysCaretWidth = vs.caretWidth;
715
if (0 == sysCaretWidth) {
718
sysCaretHeight = vs.lineHeight;
719
int bitmapSize = (((sysCaretWidth + 15) & ~15) >> 3) * sysCaretHeight;
720
char *bits = new char[bitmapSize];
721
memset(bits, 0, bitmapSize);
722
sysCaretBitmap = ::CreateBitmap(sysCaretWidth, sysCaretHeight, 1,
723
1, reinterpret_cast<BYTE *>(bits));
725
BOOL retval = ::CreateCaret(GetHwndOf(sci), sysCaretBitmap,
726
sysCaretWidth, sysCaretHeight);
727
::ShowCaret(GetHwndOf(sci));
712
735
bool ScintillaWX::DestroySystemCaret() {
714
737
#if !wxCHECK_VERSION(2, 5, 0)
717
::HideCaret(GetHwndOf(sci));
718
BOOL retval = ::DestroyCaret();
719
if (sysCaretBitmap) {
720
::DeleteObject(sysCaretBitmap);
740
::HideCaret(GetHwndOf(sci));
741
BOOL retval = ::DestroyCaret();
742
if (sysCaretBitmap) {
743
::DeleteObject(sysCaretBitmap);
731
754
//----------------------------------------------------------------------
733
756
long ScintillaWX::DefWndProc(unsigned int /*iMessage*/, unsigned long /*wParam*/, long /*lParam*/) {
737
760
long ScintillaWX::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
739
case SCI_CALLTIPSHOW: {
740
// NOTE: This is copied here from scintilla/src/ScintillaBase.cxx
741
// because of the little tweak that needs done below for wxGTK.
742
// When updating new versions double check that this is still
743
// needed, and that any new code there is copied here too.
744
Point pt = LocationFromPosition(wParam);
745
char* defn = reinterpret_cast<char *>(lParam);
746
AutoCompleteCancel();
747
pt.y += vs.lineHeight;
749
int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT;
750
PRectangle rc = ct.CallTipStart(sel.MainCaret(), pt,
752
vs.styles[ctStyle].fontName,
753
vs.styles[ctStyle].sizeZoomed,
755
vs.styles[ctStyle].characterSet,
757
// If the call-tip window would be out of the client
758
// space, adjust so it displays above the text.
759
PRectangle rcClient = GetClientRectangle();
760
if (rc.bottom > rcClient.bottom) {
762
case SCI_CALLTIPSHOWEXT: {
763
Point pt = LocationFromPosition(wParam);
764
char* defn = reinterpret_cast<char *>(lParam);
765
AutoCompleteCancel();
767
// If container knows about STYLE_CALLTIP then use it in place of the
768
// STYLE_DEFAULT for the face name, size and character set. Also use it
769
// for the foreground and background colour.
770
int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT;
772
PRectangle rc = ct.CallTipStart(sel.MainCaret(), pt,
774
vs.styles[ctStyle].fontName,
775
vs.styles[ctStyle].sizeZoomed,
777
vs.styles[ctStyle].characterSet,
779
int tipHeight = rc.Height();
780
int tipWidth = rc.Width();
784
rc.top = sci->m_ccPoint.y;
785
rc.bottom = rc.top + h;
787
// Adjust the X coordinates of the tip
788
rc.left = sci->m_ccPoint.x + 250;
789
rc.right = rc.left + tipWidth;
790
rc.top = sci->m_ccPoint.y;
791
rc.bottom = rc.top + tipHeight;
793
// If the call-tip window would be out of the client
794
// space, adjust so it displays above the text.
796
// Convert the cilent position to screen position
797
// and perform all calculations based on screen size
798
// once done, convert the result back to client coords
801
if(hh == -1 || ww == -1)
802
::wxDisplaySize(&ww, &hh);
804
wxRect rr = wxRectFromPRectangle(rc);
805
wxPoint parentPt = sci->ClientToScreen(rr.GetLeftTop());
806
wxPoint parentCCBoxPt = sci->ClientToScreen(sci->m_ccPoint);
808
rr.SetTopLeft( parentPt );
810
/////////////////////////////////////////////////////////
812
/////////////////////////////////////////////////////////
814
if (rr.GetBottom() > hh) {
815
int offset = (rr.GetBottom()- hh);
823
if(rr.GetRight() > ww) {
824
int fallbackX = rr.x;
825
rr.x = parentCCBoxPt.x;
829
// moving the tip to the left is not good also
835
// Convert the 'rr' into Client Coords
836
wxPoint clientPt = sci->ScreenToClient(rr.GetTopLeft());
837
rr.SetTopLeft( clientPt );
838
rc = PRectangle(rr.GetLeft(), rr.GetTop(), rr.GetRight()+1, rr.GetBottom()+1);
840
if(sci->m_isTipBgDark) {
841
ct.colourDoxyHighlight = ColourAllocated( ColourDesired(0, 255, 0).AsLong() );
842
ct.colourDivider = ColourAllocated( ColourDesired(255, 255, 255).AsLong() );
845
// Now display the window.
846
CreateCallTipWindow(rc);
847
ct.wCallTip.SetPositionRelative(rc, wMain);
851
case SCI_CALLTIPSHOW: {
852
// NOTE: This is copied here from scintilla/src/ScintillaBase.cxx
853
// because of the little tweak that needs done below for wxGTK.
854
// When updating new versions double check that this is still
855
// needed, and that any new code there is copied here too.
856
Point pt = LocationFromPosition(wParam);
857
char* defn = reinterpret_cast<char *>(lParam);
858
AutoCompleteCancel();
859
pt.y += vs.lineHeight;
861
int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT;
862
PRectangle rc = ct.CallTipStart(sel.MainCaret(), pt,
864
vs.styles[ctStyle].fontName,
865
vs.styles[ctStyle].sizeZoomed,
867
vs.styles[ctStyle].characterSet,
869
// If the call-tip window would be out of the client
870
// space, adjust so it displays above the text.
871
PRectangle rcClient = GetClientRectangle();
872
if (rc.bottom > rcClient.bottom) {
762
int offset = int(vs.lineHeight * 1.25) + rc.Height();
874
int offset = int(vs.lineHeight * 1.25) + rc.Height();
764
int offset = vs.lineHeight + rc.Height();
876
int offset = vs.lineHeight + rc.Height();
769
// Now display the window.
770
CreateCallTipWindow(rc);
771
ct.wCallTip.SetPositionRelative(rc, wMain);
777
case SCI_LOADLEXERLIBRARY:
778
LexerManager::GetInstance()->Load((const char*)lParam);
782
return ScintillaBase::WndProc(iMessage, wParam, lParam);
881
// Now display the window.
882
CreateCallTipWindow(rc);
883
ct.wCallTip.SetPositionRelative(rc, wMain);
889
case SCI_LOADLEXERLIBRARY:
890
LexerManager::GetInstance()->Load((const char*)lParam);
894
return ScintillaBase::WndProc(iMessage, wParam, lParam);
792
904
void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
794
paintState = painting;
795
Surface* surfaceWindow = Surface::Allocate();
796
surfaceWindow->Init(dc, wMain.GetID());
797
rcPaint = PRectangleFromwxRect(rect);
798
PRectangle rcClient = GetClientRectangle();
799
paintingAllText = rcPaint.Contains(rcClient);
801
ClipChildren(*dc, rcPaint);
802
Paint(surfaceWindow, rcPaint);
804
delete surfaceWindow;
805
if (paintState == paintAbandoned) {
806
// Painting area was insufficient to cover new styling or brace
807
// highlight positions
810
paintState = notPainting;
906
paintState = painting;
907
Surface* surfaceWindow = Surface::Allocate();
908
surfaceWindow->Init(dc, wMain.GetID());
909
rcPaint = PRectangleFromwxRect(rect);
910
PRectangle rcClient = GetClientRectangle();
911
paintingAllText = rcPaint.Contains(rcClient);
913
ClipChildren(*dc, rcPaint);
914
Paint(surfaceWindow, rcPaint);
916
delete surfaceWindow;
917
if (paintState == paintAbandoned) {
918
// Painting area was insufficient to cover new styling or brace
919
// highlight positions
922
paintState = notPainting;
814
926
void ScintillaWX::DoHScroll(int type, int pos) {
816
PRectangle rcText = GetTextRectangle();
817
int pageWidth = rcText.Width() * 2 / 3;
818
if (type == wxEVT_SCROLLWIN_LINEUP || type == wxEVT_SCROLL_LINEUP)
819
xPos -= H_SCROLL_STEP;
820
else if (type == wxEVT_SCROLLWIN_LINEDOWN || type == wxEVT_SCROLL_LINEDOWN)
821
xPos += H_SCROLL_STEP;
822
else if (type == wxEVT_SCROLLWIN_PAGEUP || type == wxEVT_SCROLL_PAGEUP)
824
else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN) {
826
if (xPos > scrollWidth - rcText.Width()) {
827
xPos = scrollWidth - rcText.Width();
830
else if (type == wxEVT_SCROLLWIN_TOP || type == wxEVT_SCROLL_TOP)
832
else if (type == wxEVT_SCROLLWIN_BOTTOM || type == wxEVT_SCROLL_BOTTOM)
834
else if (type == wxEVT_SCROLLWIN_THUMBTRACK || type == wxEVT_SCROLL_THUMBTRACK)
928
PRectangle rcText = GetTextRectangle();
929
int pageWidth = rcText.Width() * 2 / 3;
930
if (type == wxEVT_SCROLLWIN_LINEUP || type == wxEVT_SCROLL_LINEUP)
931
xPos -= H_SCROLL_STEP;
932
else if (type == wxEVT_SCROLLWIN_LINEDOWN || type == wxEVT_SCROLL_LINEDOWN)
933
xPos += H_SCROLL_STEP;
934
else if (type == wxEVT_SCROLLWIN_PAGEUP || type == wxEVT_SCROLL_PAGEUP)
936
else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN) {
938
if (xPos > scrollWidth - rcText.Width()) {
939
xPos = scrollWidth - rcText.Width();
941
} else if (type == wxEVT_SCROLLWIN_TOP || type == wxEVT_SCROLL_TOP)
943
else if (type == wxEVT_SCROLLWIN_BOTTOM || type == wxEVT_SCROLL_BOTTOM)
945
else if (type == wxEVT_SCROLLWIN_THUMBTRACK || type == wxEVT_SCROLL_THUMBTRACK)
837
HorizontalScrollTo(xPos);
948
HorizontalScrollTo(xPos);
840
951
void ScintillaWX::DoVScroll(int type, int pos) {
841
int topLineNew = topLine;
842
if (type == wxEVT_SCROLLWIN_LINEUP || type == wxEVT_SCROLL_LINEUP)
844
else if (type == wxEVT_SCROLLWIN_LINEDOWN || type == wxEVT_SCROLL_LINEDOWN)
846
else if (type == wxEVT_SCROLLWIN_PAGEUP || type == wxEVT_SCROLL_PAGEUP)
847
topLineNew -= LinesToScroll();
848
else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN)
849
topLineNew += LinesToScroll();
850
else if (type == wxEVT_SCROLLWIN_TOP || type == wxEVT_SCROLL_TOP)
852
else if (type == wxEVT_SCROLLWIN_BOTTOM || type == wxEVT_SCROLL_BOTTOM)
853
topLineNew = MaxScrollPos();
854
else if (type == wxEVT_SCROLLWIN_THUMBTRACK || type == wxEVT_SCROLL_THUMBTRACK)
952
int topLineNew = topLine;
953
if (type == wxEVT_SCROLLWIN_LINEUP || type == wxEVT_SCROLL_LINEUP)
955
else if (type == wxEVT_SCROLLWIN_LINEDOWN || type == wxEVT_SCROLL_LINEDOWN)
957
else if (type == wxEVT_SCROLLWIN_PAGEUP || type == wxEVT_SCROLL_PAGEUP)
958
topLineNew -= LinesToScroll();
959
else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN)
960
topLineNew += LinesToScroll();
961
else if (type == wxEVT_SCROLLWIN_TOP || type == wxEVT_SCROLL_TOP)
963
else if (type == wxEVT_SCROLLWIN_BOTTOM || type == wxEVT_SCROLL_BOTTOM)
964
topLineNew = MaxScrollPos();
965
else if (type == wxEVT_SCROLLWIN_THUMBTRACK || type == wxEVT_SCROLL_THUMBTRACK)
857
ScrollTo(topLineNew);
968
ScrollTo(topLineNew);
860
971
void ScintillaWX::DoMouseWheel(int rotation, int delta,
861
972
int linesPerAction, int ctrlDown,
862
973
bool isPageScroll ) {
863
int topLineNew = topLine;
974
int topLineNew = topLine;
866
if (ctrlDown) { // Zoom the fonts if Ctrl key down
868
KeyCommand(SCI_ZOOMIN);
871
KeyCommand(SCI_ZOOMOUT);
874
else { // otherwise just scroll the window
877
wheelRotation += rotation;
878
lines = wheelRotation / delta;
879
wheelRotation -= lines * delta;
882
lines = lines * LinesOnScreen(); // lines is either +1 or -1
884
lines *= linesPerAction;
886
ScrollTo(topLineNew);
977
if (ctrlDown) { // Zoom the fonts if Ctrl key down
979
KeyCommand(SCI_ZOOMIN);
981
KeyCommand(SCI_ZOOMOUT);
983
} else { // otherwise just scroll the window
986
wheelRotation += rotation;
987
lines = wheelRotation / delta;
988
wheelRotation -= lines * delta;
991
lines = lines * LinesOnScreen(); // lines is either +1 or -1
993
lines *= linesPerAction;
995
ScrollTo(topLineNew);
892
1001
void ScintillaWX::DoSize(int WXUNUSED(width), int WXUNUSED(height)) {
896
void ScintillaWX::DoLoseFocus(){
898
SetFocusState(false);
900
DestroySystemCaret();
903
void ScintillaWX::DoGainFocus(){
907
DestroySystemCaret();
1005
void ScintillaWX::DoLoseFocus() {
1007
SetFocusState(false);
1009
DestroySystemCaret();
1012
void ScintillaWX::DoGainFocus() {
1014
SetFocusState(true);
1016
DestroySystemCaret();
1017
CreateSystemCaret();
911
1020
void ScintillaWX::DoSysColourChange() {
912
InvalidateStyleData();
1021
InvalidateStyleData();
915
1024
void ScintillaWX::DoLeftButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) {
916
ButtonDown(pt, curTime, shift, ctrl, alt);
1025
ButtonDown(pt, curTime, shift, ctrl, alt);
919
1028
void ScintillaWX::DoLeftButtonUp(Point pt, unsigned int curTime, bool ctrl) {
920
ButtonUp(pt, curTime, ctrl);
1029
ButtonUp(pt, curTime, ctrl);
921
1030
#if wxUSE_DRAG_AND_DROP
922
if (startDragTimer->IsRunning()) {
923
startDragTimer->Stop();
924
SetDragPosition(SelectionPosition(invalidPosition));
925
SetEmptySelection(PositionFromLocation(pt));
926
ShowCaretAtCurrentPosition();
1031
if (startDragTimer->IsRunning()) {
1032
startDragTimer->Stop();
1033
SetDragPosition(SelectionPosition(invalidPosition));
1034
SetEmptySelection(PositionFromLocation(pt));
1035
ShowCaretAtCurrentPosition();
931
1040
void ScintillaWX::DoLeftButtonMove(Point pt) {
935
1044
#ifdef __WXGTK__
936
1045
void ScintillaWX::DoMiddleButtonUp(Point pt) {
937
// Set the current position to the mouse click point and
938
// then paste in the PRIMARY selection, if any. wxGTK only.
939
int newPos = PositionFromLocation(pt);
940
MovePositionTo(newPos, Selection::noSel, true);
942
pdoc->BeginUndoAction();
943
wxTextDataObject data;
944
bool gotData = false;
945
wxTheClipboard->UsePrimarySelection(true);
946
if (wxTheClipboard->Open()) {
947
gotData = wxTheClipboard->GetData(data);
948
wxTheClipboard->Close();
950
wxTheClipboard->UsePrimarySelection(false);
952
wxString text = wxTextBuffer::Translate (data.GetText(),
953
wxConvertEOLMode(pdoc->eolMode));
954
data.SetText(wxEmptyString); // free the data object content
955
wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(text);
956
int len = strlen(buf);
957
pdoc->InsertString(sel.MainCaret(), buf, len);
958
SetEmptySelection(sel.MainCaret() + len);
960
pdoc->EndUndoAction();
964
ShowCaretAtCurrentPosition();
965
EnsureCaretVisible();
1046
// Set the current position to the mouse click point and
1047
// then paste in the PRIMARY selection, if any. wxGTK only.
1048
int newPos = PositionFromLocation(pt);
1049
MovePositionTo(newPos, Selection::noSel, true);
1051
pdoc->BeginUndoAction();
1052
wxTextDataObject data;
1053
bool gotData = false;
1054
wxTheClipboard->UsePrimarySelection(true);
1055
if (wxTheClipboard->Open()) {
1056
gotData = wxTheClipboard->GetData(data);
1057
wxTheClipboard->Close();
1059
wxTheClipboard->UsePrimarySelection(false);
1061
wxString text = wxTextBuffer::Translate (data.GetText(),
1062
wxConvertEOLMode(pdoc->eolMode));
1063
data.SetText(wxEmptyString); // free the data object content
1064
wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(text);
1065
int len = strlen(buf);
1066
pdoc->InsertString(sel.MainCaret(), buf, len);
1067
SetEmptySelection(sel.MainCaret() + len);
1069
pdoc->EndUndoAction();
1073
ShowCaretAtCurrentPosition();
1074
EnsureCaretVisible();
968
1077
void ScintillaWX::DoMiddleButtonUp(Point WXUNUSED(pt)) {
973
1082
void ScintillaWX::DoAddChar(int key) {
974
1083
#if wxUSE_UNICODE
976
wszChars[0] = (wxChar)key;
978
wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(wszChars);
979
AddCharUTF((char*)buf.data(), strlen(buf));
1085
wszChars[0] = (wxChar)key;
1087
wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(wszChars);
1088
AddCharUTF((char*)buf.data(), strlen(buf));
986
int ScintillaWX::DoKeyDown(const wxKeyEvent& evt, bool* consumed)
988
int key = evt.GetKeyCode();
989
bool shift = evt.ShiftDown(),
990
ctrl = evt.ControlDown(),
993
if (ctrl && key >= 1 && key <= 26 && key != WXK_BACK)
997
case WXK_DOWN: // fall through
998
case WXK_NUMPAD_DOWN: key = SCK_DOWN; break;
999
case WXK_UP: // fall through
1000
case WXK_NUMPAD_UP: key = SCK_UP; break;
1001
case WXK_LEFT: // fall through
1002
case WXK_NUMPAD_LEFT: key = SCK_LEFT; break;
1003
case WXK_RIGHT: // fall through
1004
case WXK_NUMPAD_RIGHT: key = SCK_RIGHT; break;
1005
case WXK_HOME: // fall through
1006
case WXK_NUMPAD_HOME: key = SCK_HOME; break;
1007
case WXK_END: // fall through
1008
case WXK_NUMPAD_END: key = SCK_END; break;
1009
#if !wxCHECK_VERSION(2, 7, 0)
1010
case WXK_PRIOR: // fall through
1011
case WXK_NUMPAD_PRIOR: // fall through
1013
case WXK_PAGEUP: // fall through
1014
case WXK_NUMPAD_PAGEUP: key = SCK_PRIOR; break;
1015
#if !wxCHECK_VERSION(2, 7, 0)
1016
case WXK_NEXT: // fall through
1017
case WXK_NUMPAD_NEXT: // fall through
1019
case WXK_PAGEDOWN: // fall through
1020
case WXK_NUMPAD_PAGEDOWN: key = SCK_NEXT; break;
1095
int ScintillaWX::DoKeyDown(const wxKeyEvent& evt, bool* consumed) {
1096
int key = evt.GetKeyCode();
1097
bool shift = evt.ShiftDown(),
1098
ctrl = evt.ControlDown(),
1099
alt = evt.AltDown();
1101
if (ctrl && key >= 1 && key <= 26 && key != WXK_BACK)
1105
case WXK_DOWN: // fall through
1106
case WXK_NUMPAD_DOWN:
1109
case WXK_UP: // fall through
1113
case WXK_LEFT: // fall through
1114
case WXK_NUMPAD_LEFT:
1117
case WXK_RIGHT: // fall through
1118
case WXK_NUMPAD_RIGHT:
1121
case WXK_HOME: // fall through
1122
case WXK_NUMPAD_HOME:
1125
case WXK_END: // fall through
1126
case WXK_NUMPAD_END:
1129
#if !wxCHECK_VERSION(2, 7, 0)
1130
case WXK_PRIOR: // fall through
1131
case WXK_NUMPAD_PRIOR: // fall through
1133
case WXK_PAGEUP: // fall through
1134
case WXK_NUMPAD_PAGEUP:
1137
#if !wxCHECK_VERSION(2, 7, 0)
1138
case WXK_NEXT: // fall through
1139
case WXK_NUMPAD_NEXT: // fall through
1141
case WXK_PAGEDOWN: // fall through
1142
case WXK_NUMPAD_PAGEDOWN:
1022
1146
case WXK_NUMPAD_DELETE: //fall through
1024
case WXK_DELETE: key = SCK_DELETE; break;
1027
1153
case WXK_NUMPAD_INSERT://fall through
1029
case WXK_INSERT: key = SCK_INSERT; break;
1030
case WXK_ESCAPE: key = SCK_ESCAPE; break;
1031
case WXK_BACK: key = SCK_BACK; break;
1032
case WXK_TAB: key = SCK_TAB; break;
1033
case WXK_RETURN: // fall through
1034
case WXK_NUMPAD_ENTER: key = SCK_RETURN; break;
1035
case WXK_ADD: // fall through
1036
case WXK_NUMPAD_ADD: key = SCK_ADD; break;
1037
case WXK_SUBTRACT: // fall through
1038
case WXK_NUMPAD_SUBTRACT: key = SCK_SUBTRACT; break;
1039
case WXK_DIVIDE: // fall through
1040
case WXK_NUMPAD_DIVIDE: key = SCK_DIVIDE; break;
1041
case WXK_CONTROL: key = 0; break;
1042
case WXK_ALT: key = 0; break;
1043
case WXK_SHIFT: key = 0; break;
1044
case WXK_MENU: key = 0; break;
1167
case WXK_RETURN: // fall through
1168
case WXK_NUMPAD_ENTER:
1171
case WXK_ADD: // fall through
1172
case WXK_NUMPAD_ADD:
1175
case WXK_SUBTRACT: // fall through
1176
case WXK_NUMPAD_SUBTRACT:
1179
case WXK_DIVIDE: // fall through
1180
case WXK_NUMPAD_DIVIDE:
1047
1197
#ifdef __WXMAC__
1048
if ( evt.MetaDown() ) {
1049
// check for a few common Mac Meta-key combos and remap them to Ctrl
1056
case 'A': // Select All
1198
if ( evt.MetaDown() ) {
1199
// check for a few common Mac Meta-key combos and remap them to Ctrl
1206
case 'A': // Select All
1063
int rv = KeyDown(key, shift, ctrl, alt, consumed);
1213
int rv = KeyDown(key, shift, ctrl, alt, consumed);
1072
1222
void ScintillaWX::DoCommand(int ID) {
1077
1227
void ScintillaWX::DoContextMenu(Point pt) {
1078
if (displayPopupMenu)
1228
if (displayPopupMenu)
1082
1232
void ScintillaWX::DoOnListBox() {
1083
AutoCompleteCompleted();
1233
AutoCompleteCompleted();
1087
1237
void ScintillaWX::DoOnIdle(wxIdleEvent& evt) {
1095
1245
//----------------------------------------------------------------------
1097
1247
#if wxUSE_DRAG_AND_DROP
1098
1248
bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
1099
SetDragPosition(SelectionPosition(invalidPosition));
1101
wxString text = wxTextBuffer::Translate (data, wxConvertEOLMode(pdoc->eolMode));
1103
// Send an event to allow the drag details to be changed
1104
wxScintillaEvent evt(wxEVT_SCI_DO_DROP, sci->GetId());
1105
evt.SetEventObject(sci);
1106
evt.SetDragResult(dragResult);
1109
evt.SetPosition(PositionFromLocation(Point(x,y)));
1110
evt.SetDragText(text);
1111
sci->GetEventHandler()->ProcessEvent(evt);
1113
dragResult = evt.GetDragResult();
1114
if (dragResult == wxDragMove || dragResult == wxDragCopy) {
1115
DropAt( SelectionPosition(evt.GetPosition()),
1116
wx2sci(evt.GetDragText()),
1117
dragResult == wxDragMove,
1249
SetDragPosition(SelectionPosition(invalidPosition));
1251
wxString text = wxTextBuffer::Translate (data, wxConvertEOLMode(pdoc->eolMode));
1253
// Send an event to allow the drag details to be changed
1254
wxScintillaEvent evt(wxEVT_SCI_DO_DROP, sci->GetId());
1255
evt.SetEventObject(sci);
1256
evt.SetDragResult(dragResult);
1259
evt.SetPosition(PositionFromLocation(Point(x,y)));
1260
evt.SetDragText(text);
1261
sci->GetEventHandler()->ProcessEvent(evt);
1263
dragResult = evt.GetDragResult();
1264
if (dragResult == wxDragMove || dragResult == wxDragCopy) {
1265
DropAt( SelectionPosition(evt.GetPosition()),
1266
wx2sci(evt.GetDragText()),
1267
dragResult == wxDragMove,
1125
1275
wxDragResult ScintillaWX::DoDragEnter(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResult def) {
1131
1281
wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
1132
SetDragPosition(SelectionPosition( PositionFromLocation(Point(x, y)) ) );
1134
// Send an event to allow the drag result to be changed
1135
wxScintillaEvent evt(wxEVT_SCI_DRAG_OVER, sci->GetId());
1136
evt.SetEventObject(sci);
1137
evt.SetDragResult(def);
1140
evt.SetPosition(PositionFromLocation(Point(x,y)));
1141
sci->GetEventHandler()->ProcessEvent(evt);
1143
dragResult = evt.GetDragResult();
1282
SetDragPosition(SelectionPosition( PositionFromLocation(Point(x, y)) ) );
1284
// Send an event to allow the drag result to be changed
1285
wxScintillaEvent evt(wxEVT_SCI_DRAG_OVER, sci->GetId());
1286
evt.SetEventObject(sci);
1287
evt.SetDragResult(def);
1290
evt.SetPosition(PositionFromLocation(Point(x,y)));
1291
sci->GetEventHandler()->ProcessEvent(evt);
1293
dragResult = evt.GetDragResult();
1148
1298
void ScintillaWX::DoDragLeave() {
1149
SetDragPosition(SelectionPosition(invalidPosition));
1299
SetDragPosition(SelectionPosition(invalidPosition));
1152
1302
//----------------------------------------------------------------------