~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/sdk/wxscintilla/src/wxscintilla.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
// Author:      Robin Dunn
11
11
//
12
12
// Created:     13-Jan-2000
13
 
// RCS-ID:      $Id: wxscintilla.cpp 4043 2007-06-02 06:03:13Z rickg22 $
 
13
// RCS-ID:      $Id: wxscintilla.cpp 6163 2010-02-15 11:15:27Z mortenmacfly $
14
14
// Copyright:   (c) 2004 wxCode
15
15
// Licence:     wxWindows
16
16
/////////////////////////////////////////////////////////////////////////////
17
 
 
 
17
#include <limits>
18
18
#include <ctype.h>
19
19
 
20
20
#include "ScintillaWX.h"
26
26
#include <wx/image.h>
27
27
#include <wx/file.h>
28
28
 
 
29
#ifdef __WXGTK__
 
30
    #include <wx/dcbuffer.h>
 
31
#endif
29
32
 
30
33
//----------------------------------------------------------------------
31
34
 
32
 
const wxChar* wxSCINameStr = _T("SCIwindow");
 
35
const wxChar* wxSCINameStr = wxT("SCIwindow");
33
36
 
34
37
#ifdef MAKELONG
35
38
#undef MAKELONG
38
41
#define MAKELONG(a, b) ((a) | ((b) << 16))
39
42
 
40
43
 
41
 
static long wxColourAsLong(const wxColour& co) {
 
44
static long wxColourAsLong(const wxColour& co)
 
45
{
42
46
    return (((long)co.Blue()  << 16) |
43
47
            ((long)co.Green() <<  8) |
44
48
            ((long)co.Red()));
45
49
}
46
50
 
47
 
static wxColour wxColourFromLong(long c) {
 
51
static wxColour wxColourFromLong(long c)
 
52
{
48
53
    wxColour clr;
49
54
    clr.Set((unsigned char)(c & 0xff),
50
55
            (unsigned char)((c >> 8) & 0xff),
53
58
}
54
59
 
55
60
 
56
 
static wxColour wxColourFromSpec(const wxString& spec) {
 
61
static wxColour wxColourFromSpec(const wxString& spec)
 
62
{
57
63
    // spec should be a colour name or "#RRGGBB"
58
 
    if (spec.GetChar(0) == _T('#')) {
 
64
    if (spec.GetChar(0) == wxT('#')) {
59
65
 
60
66
        long red, green, blue;
61
67
        red = green = blue = 0;
62
68
        spec.Mid(1,2).ToLong(&red,   16);
63
69
        spec.Mid(3,2).ToLong(&green, 16);
64
70
        spec.Mid(5,2).ToLong(&blue,  16);
65
 
        return wxColour((unsigned char)red, (unsigned char)green, (unsigned char)blue);
66
 
    }else{
 
71
        return wxColour((unsigned char)red,
 
72
                        (unsigned char)green,
 
73
                        (unsigned char)blue);
 
74
    }
 
75
    else
67
76
        return wxColour(spec);
68
 
    }
69
77
}
70
78
 
71
79
//----------------------------------------------------------------------
95
103
DEFINE_EVENT_TYPE( wxEVT_SCI_HOTSPOT_CLICK )
96
104
DEFINE_EVENT_TYPE( wxEVT_SCI_HOTSPOT_DCLICK )
97
105
DEFINE_EVENT_TYPE( wxEVT_SCI_CALLTIP_CLICK )
98
 
 
 
106
DEFINE_EVENT_TYPE( wxEVT_SCI_AUTOCOMP_SELECTION )
 
107
DEFINE_EVENT_TYPE( wxEVT_SCI_INDICATOR_CLICK )
 
108
DEFINE_EVENT_TYPE( wxEVT_SCI_INDICATOR_RELEASE )
 
109
DEFINE_EVENT_TYPE( wxEVT_SCI_AUTOCOMP_CANCELLED )
 
110
DEFINE_EVENT_TYPE( wxEVT_SCI_AUTOCOMP_CHARDELETED )
 
111
DEFINE_EVENT_TYPE( wxEVT_SCI_SETFOCUS )
 
112
DEFINE_EVENT_TYPE( wxEVT_SCI_KILLFOCUS )
99
113
 
100
114
 
101
115
BEGIN_EVENT_TABLE(wxScintilla, wxControl)
142
156
                          const wxPoint& pos,
143
157
                          const wxSize& size,
144
158
                          long style,
145
 
                          const wxString& name) {
 
159
                          const wxString& name)
 
160
{
146
161
    m_swx = NULL;
147
 
    Create (parent, id, pos, size, style, name);
 
162
    Create(parent, id, pos, size, style, name);
148
163
}
149
164
 
150
165
 
153
168
                          const wxPoint& pos,
154
169
                          const wxSize& size,
155
170
                          long style,
156
 
                          const wxString& name) {
 
171
                          const wxString& name)
 
172
{
157
173
#ifdef __WXMAC__
158
174
    style |= wxVSCROLL | wxHSCROLL;
159
175
#endif
160
176
    if (!wxControl::Create (parent, id, pos, size,
161
177
                            style | wxWANTS_CHARS | wxCLIP_CHILDREN,
162
178
                            wxDefaultValidator, name)) {
 
179
        wxSafeShowMessage(wxT("wxScintilla"),wxT("Could not create a new wxControl instance."));
163
180
        return false;
164
181
    }
165
182
 
167
184
    Scintilla_LinkLexers();
168
185
#endif
169
186
    m_swx = new ScintillaWX(this);
 
187
    if (!m_swx)
 
188
        wxSafeShowMessage(wxT("wxScintilla"),wxT("Could not create a new ScintillaWX instance."));
170
189
    m_stopWatch.Start();
171
 
    m_lastKeyDownConsumed = FALSE;
 
190
    m_lastKeyDownConsumed = false;
 
191
    // we need this here, because wxEvent::GetTimestamp() returns negative values on some systems
 
192
    // and therefore blocks mousewheel events. Big thanks to DrewBoo
 
193
    m_lastWheelTimestamp = std::numeric_limits<long>::min();
172
194
    m_vScrollBar = NULL;
173
195
    m_hScrollBar = NULL;
174
196
#if wxUSE_UNICODE
176
198
    SetCodePage(wxSCI_CP_UTF8);
177
199
#endif
178
200
 
179
 
#if wxCHECK_VERSION(2, 5, 0)
180
 
    // Reduces flicker on GTK+/X11
181
 
    SetBackgroundStyle(wxBG_STYLE_CUSTOM);
182
201
    #if wxVERSION_NUMBER >= 2800
183
202
        SetInitialSize(size);
184
203
    #else
185
204
        SetBestFittingSize(size);
186
205
    #endif
187
 
#endif
188
 
    return false;
 
206
 
 
207
    // Reduces flicker on GTK+/X11
 
208
    SetBackgroundStyle(wxBG_STYLE_CUSTOM);
 
209
 
 
210
    // FIXME: back-port from wx29 (svn) to wx289
 
211
//    // Make sure it can take the focus
 
212
//    SetCanFocus(true);
 
213
 
 
214
    return true;
189
215
}
190
216
 
191
 
wxScintilla::~wxScintilla() {
 
217
 
 
218
wxScintilla::~wxScintilla()
 
219
{
192
220
    delete m_swx;
 
221
    m_swx = 0;
193
222
}
194
223
 
195
224
 
196
225
//----------------------------------------------------------------------
197
226
// Send message to Scintilla
198
 
long wxScintilla::SendMsg (int msg, long wp, long lp) {
199
 
    return m_swx->WndProc (msg, wp, lp);
 
227
wxIntPtr wxScintilla::SendMsg (int msg, wxUIntPtr wp, wxIntPtr lp) const
 
228
{
 
229
    return m_swx->WndProc(msg, wp, lp);
200
230
}
201
231
 
202
232
//----------------------------------------------------------------------
203
233
 
204
234
// Set the vertical scrollbar to use instead of the ont that's built-in.
205
 
void wxScintilla::SetVScrollBar (wxScrollBar* bar) {
 
235
void wxScintilla::SetVScrollBar (wxScrollBar* bar)
 
236
{
206
237
    m_vScrollBar = bar;
207
238
    if (bar != NULL) {
208
239
        // ensure that the built-in scrollbar is not visible
210
241
    }
211
242
}
212
243
 
 
244
 
213
245
// Set the horizontal scrollbar to use instead of the ont that's built-in.
214
 
void wxScintilla::SetHScrollBar (wxScrollBar* bar) {
 
246
void wxScintilla::SetHScrollBar (wxScrollBar* bar)
 
247
{
215
248
    m_hScrollBar = bar;
216
249
    if (bar != NULL) {
217
250
        // ensure that the built-in scrollbar is not visible
225
258
//       this file.  Edit wxscintilla.cpp.in or gen_iface.py instead and regenerate.
226
259
 
227
260
// Add text to the document at current position.
228
 
void wxScintilla::AddText (const wxString& text) {
 
261
void wxScintilla::AddText (const wxString& text)
 
262
{
229
263
    wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(text);
230
 
    SendMsg (SCI_ADDTEXT, strlen(buf), (long)(const char*)buf);
 
264
    SendMsg(SCI_ADDTEXT, strlen(buf), (sptr_t)(const char*)buf);
231
265
}
232
266
 
233
267
// Add text to the document w/length parameter, this allows for binary data to be added.
234
 
void wxScintilla::AddText (const int length, const wxString& text) {
 
268
void wxScintilla::AddText (const int length, const wxString& text)
 
269
{
235
270
    wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(text);
236
 
    SendMsg (SCI_ADDTEXT, length, (long)(const char*)buf);
 
271
    SendMsg(SCI_ADDTEXT, length, (sptr_t)(const char*)buf);
237
272
}
238
273
 
239
274
// Add array of cells to document.
240
 
void wxScintilla::AddStyledText (const wxMemoryBuffer& data) {
241
 
    SendMsg (SCI_ADDSTYLEDTEXT, data.GetDataLen(), (long)data.GetData());
 
275
void wxScintilla::AddStyledText (const wxMemoryBuffer& data)
 
276
{
 
277
    SendMsg(SCI_ADDSTYLEDTEXT, data.GetDataLen(), (sptr_t)data.GetData());
242
278
}
243
279
 
244
280
// Insert string at a position.
245
 
void wxScintilla::InsertText (int pos, const wxString& text) {
246
 
    SendMsg (SCI_INSERTTEXT, pos, (long)(const char*)wx2sci(text));
 
281
void wxScintilla::InsertText (int pos, const wxString& text)
 
282
{
 
283
    SendMsg(SCI_INSERTTEXT, pos, (sptr_t)(const char*)wx2sci(text));
247
284
}
248
285
 
249
286
// Delete all text in the document.
250
 
void wxScintilla::ClearAll() {
251
 
    SendMsg (SCI_CLEARALL, 0, 0);
 
287
void wxScintilla::ClearAll()
 
288
{
 
289
    SendMsg(SCI_CLEARALL, 0, 0);
252
290
}
253
291
 
254
292
// Set all style bytes to 0, remove all folding information.
255
 
void wxScintilla::ClearDocumentStyle() {
256
 
    SendMsg (SCI_CLEARDOCUMENTSTYLE, 0, 0);
 
293
void wxScintilla::ClearDocumentStyle()
 
294
{
 
295
    SendMsg(SCI_CLEARDOCUMENTSTYLE, 0, 0);
257
296
}
258
297
 
259
 
// Returns the number of characters in the document.
260
 
int wxScintilla::GetLength() {
261
 
    return SendMsg (SCI_GETLENGTH, 0, 0);
 
298
// Returns the number of bytes in the document.
 
299
int wxScintilla::GetLength() const
 
300
{
 
301
    return SendMsg(SCI_GETLENGTH, 0, 0);
262
302
}
263
303
 
264
304
// Returns the character byte at the position.
265
 
int wxScintilla::GetCharAt (int pos) {
266
 
    return (unsigned char)SendMsg (SCI_GETCHARAT, pos, 0);
 
305
int wxScintilla::GetCharAt (int pos) const
 
306
{
 
307
    return (unsigned char)SendMsg(SCI_GETCHARAT, pos, 0);
267
308
}
268
309
 
269
310
// Returns the position of the caret.
270
 
int wxScintilla::GetCurrentPos() {
271
 
    return SendMsg (SCI_GETCURRENTPOS, 0, 0);
 
311
int wxScintilla::GetCurrentPos() const
 
312
{
 
313
    return SendMsg(SCI_GETCURRENTPOS, 0, 0);
272
314
}
273
315
 
274
316
// Returns the position of the opposite end of the selection to the caret.
275
 
int wxScintilla::GetAnchor() {
276
 
    return SendMsg (SCI_GETANCHOR, 0, 0);
 
317
int wxScintilla::GetAnchor() const
 
318
{
 
319
    return SendMsg(SCI_GETANCHOR, 0, 0);
277
320
}
278
321
 
279
322
// Returns the style byte at the position.
280
 
int wxScintilla::GetStyleAt (int pos) {
281
 
    return (unsigned char)SendMsg (SCI_GETSTYLEAT, pos, 0);
 
323
int wxScintilla::GetStyleAt (int pos) const
 
324
{
 
325
    return (unsigned char)SendMsg(SCI_GETSTYLEAT, pos, 0);
282
326
}
283
327
 
284
328
// Redoes the next action on the undo history.
285
 
void wxScintilla::Redo() {
286
 
    SendMsg (SCI_REDO, 0, 0);
 
329
void wxScintilla::Redo()
 
330
{
 
331
    SendMsg(SCI_REDO, 0, 0);
287
332
}
288
333
 
289
334
// Choose between collecting actions into the undo
290
335
// history and discarding them.
291
 
void wxScintilla::SetUndoCollection (bool collectUndo) {
292
 
    SendMsg (SCI_SETUNDOCOLLECTION, collectUndo, 0);
 
336
void wxScintilla::SetUndoCollection (bool collectUndo)
 
337
{
 
338
    SendMsg(SCI_SETUNDOCOLLECTION, collectUndo, 0);
 
339
}
 
340
 
 
341
// Choose between collecting actions into the changes
 
342
// history and discarding them.
 
343
void wxScintilla::SetChangeCollection (bool collectChange)
 
344
{
 
345
    SendMsg(SCI_SETCHANGECOLLECTION, collectChange, 0);
 
346
}
 
347
 
 
348
    // Find a changed line, if fromLine > toLine search is performed backwards.
 
349
int wxScintilla::FindChangedLine (const int fromLine, const int toLine) const
 
350
{
 
351
    return SendMsg(SCI_GETCHANGEDLINE, fromLine, toLine);
293
352
}
294
353
 
295
354
// Select all the text in the document.
296
 
void wxScintilla::SelectAll() {
297
 
    SendMsg (SCI_SELECTALL, 0, 0);
 
355
void wxScintilla::SelectAll()
 
356
{
 
357
    SendMsg(SCI_SELECTALL, 0, 0);
298
358
}
299
359
 
300
360
// Remember the current position in the undo history as the position
301
361
// at which the document was saved.
302
 
void wxScintilla::SetSavePoint() {
303
 
    SendMsg (SCI_SETSAVEPOINT, 0, 0);
 
362
void wxScintilla::SetSavePoint()
 
363
{
 
364
    SendMsg(SCI_SETSAVEPOINT, 0, 0);
304
365
}
305
366
 
306
367
// Retrieve a buffer of cells.
307
 
wxMemoryBuffer wxScintilla::GetStyledText (int startPos, int endPos) {
 
368
wxMemoryBuffer wxScintilla::GetStyledText (int startPos, int endPos)
 
369
{
308
370
        wxMemoryBuffer buf;
309
371
        if (endPos < startPos) {
310
372
            int temp = startPos;
317
379
        tr.lpstrText = (char*)buf.GetWriteBuf(len*2+1);
318
380
        tr.chrg.cpMin = startPos;
319
381
        tr.chrg.cpMax = endPos;
320
 
        len = SendMsg (SCI_GETSTYLEDTEXT, 0, (long)&tr);
 
382
        len = SendMsg(SCI_GETSTYLEDTEXT, 0, (sptr_t)&tr);
321
383
        buf.UngetWriteBuf(len);
322
384
        return buf;
323
385
}
324
386
 
325
387
// Are there any redoable actions in the undo history?
326
 
bool wxScintilla::CanRedo() {
327
 
    return SendMsg (SCI_CANREDO, 0, 0) != 0;
 
388
bool wxScintilla::CanRedo() const
 
389
{
 
390
    return SendMsg(SCI_CANREDO, 0, 0) != 0;
328
391
}
329
392
 
330
393
// Retrieve the line number at which a particular marker is located.
331
 
int wxScintilla::MarkerLineFromHandle (int handle) {
332
 
    return SendMsg (SCI_MARKERLINEFROMHANDLE, handle, 0);
 
394
int wxScintilla::MarkerLineFromHandle (int handle)
 
395
{
 
396
    return SendMsg(SCI_MARKERLINEFROMHANDLE, handle, 0);
333
397
}
334
398
 
335
399
// Delete a marker.
336
 
void wxScintilla::MarkerDeleteHandle (int handle) {
337
 
    SendMsg (SCI_MARKERDELETEHANDLE, handle, 0);
 
400
void wxScintilla::MarkerDeleteHandle (int handle)
 
401
{
 
402
    SendMsg(SCI_MARKERDELETEHANDLE, handle, 0);
338
403
}
339
404
 
340
405
// Is undo history being collected?
341
 
bool wxScintilla::GetUndoCollection() {
342
 
    return SendMsg (SCI_GETUNDOCOLLECTION, 0, 0) != 0;
 
406
bool wxScintilla::GetUndoCollection() const
 
407
{
 
408
    return SendMsg(SCI_GETUNDOCOLLECTION, 0, 0) != 0;
343
409
}
344
410
 
345
411
// Are white space characters currently visible?
346
412
// Returns one of SCWS_* constants.
347
 
int wxScintilla::GetViewWhiteSpace() {
348
 
    return SendMsg (SCI_GETVIEWWS, 0, 0);
 
413
int wxScintilla::GetViewWhiteSpace() const
 
414
{
 
415
    return SendMsg(SCI_GETVIEWWS, 0, 0);
349
416
}
350
417
 
351
418
// Make white space characters invisible, always visible or visible outside indentation.
352
 
void wxScintilla::SetViewWhiteSpace (int viewWS) {
353
 
    SendMsg (SCI_SETVIEWWS, viewWS, 0);
 
419
void wxScintilla::SetViewWhiteSpace (int viewWS)
 
420
{
 
421
    SendMsg(SCI_SETVIEWWS, viewWS, 0);
354
422
}
355
423
 
356
424
// Find the position from a point within the window.
357
 
int wxScintilla::PositionFromPoint (wxPoint pt) {
358
 
        return SendMsg (SCI_POSITIONFROMPOINT, pt.x, pt.y);
 
425
int wxScintilla::PositionFromPoint (wxPoint pt) const
 
426
{
 
427
    return SendMsg(SCI_POSITIONFROMPOINT, pt.x, pt.y);
359
428
}
360
429
 
361
430
// Find the position from a point within the window but return
362
431
// INVALID_POSITION if not close to text.
363
 
int wxScintilla::PositionFromPointClose (int x, int y) {
364
 
    return SendMsg (SCI_POSITIONFROMPOINTCLOSE, x, y);
 
432
int wxScintilla::PositionFromPointClose (int x, int y)
 
433
{
 
434
    return SendMsg(SCI_POSITIONFROMPOINTCLOSE, x, y);
365
435
}
366
436
 
367
437
// Set caret to start of a line and ensure it is visible.
368
 
void wxScintilla::GotoLine (int line) {
369
 
    SendMsg (SCI_GOTOLINE, line, 0);
 
438
void wxScintilla::GotoLine (int line)
 
439
{
 
440
    SendMsg(SCI_GOTOLINE, line, 0);
370
441
}
371
442
 
372
443
// Set caret to a position and ensure it is visible.
373
 
void wxScintilla::GotoPos (int pos) {
374
 
    SendMsg (SCI_GOTOPOS, pos, 0);
 
444
void wxScintilla::GotoPos (int pos)
 
445
{
 
446
    SendMsg(SCI_GOTOPOS, pos, 0);
375
447
}
376
448
 
377
449
// Set the selection anchor to a position. The anchor is the opposite
378
450
// end of the selection from the caret.
379
 
void wxScintilla::SetAnchor (int posAnchor) {
380
 
    SendMsg (SCI_SETANCHOR, posAnchor, 0);
 
451
void wxScintilla::SetAnchor (int posAnchor)
 
452
{
 
453
    SendMsg(SCI_SETANCHOR, posAnchor, 0);
381
454
}
382
455
 
383
456
// Retrieve the text of the line containing the caret.
384
457
// Returns the index of the caret on the line.
385
 
wxString wxScintilla::GetCurLine (int* linePos) {
386
 
    int len = LineLength(GetCurrentLine());
387
 
    if (!len) {
388
 
        if (linePos) *linePos = 0;
389
 
        return wxEmptyString;
390
 
    }
391
 
    wxMemoryBuffer mbuf(len+1);
392
 
    char* buf = (char*)mbuf.GetWriteBuf(len+1);
393
 
    int pos = SendMsg (SCI_GETCURLINE, len+1, (long)buf);
394
 
    mbuf.UngetWriteBuf(len);
395
 
    mbuf.AppendByte(0);
396
 
    if (linePos) *linePos = pos;
397
 
    return sci2wx(buf);
 
458
wxString wxScintilla::GetCurLine(int* linePos)
 
459
{
 
460
        int len = LineLength(GetCurrentLine());
 
461
        if (!len) {
 
462
            if (linePos)  *linePos = 0;
 
463
            return wxEmptyString;
 
464
        }
 
465
 
 
466
        wxMemoryBuffer mbuf(len+1);
 
467
        char* buf = (char*)mbuf.GetWriteBuf(len+1);
 
468
 
 
469
        int pos = SendMsg(SCI_GETCURLINE, len+1, (sptr_t)buf);
 
470
        mbuf.UngetWriteBuf(len);
 
471
        mbuf.AppendByte(0);
 
472
        if (linePos)  *linePos = pos;
 
473
        return sci2wx(buf);
398
474
}
399
475
 
400
476
// Retrieve the position of the last correctly styled character.
401
 
int wxScintilla::GetEndStyled() {
402
 
    return SendMsg (SCI_GETENDSTYLED, 0, 0);
 
477
int wxScintilla::GetEndStyled() const
 
478
{
 
479
    return SendMsg(SCI_GETENDSTYLED, 0, 0);
403
480
}
404
481
 
405
482
// Convert all line endings in the document to one mode.
406
 
void wxScintilla::ConvertEOLs (int eolMode) {
407
 
    SendMsg (SCI_CONVERTEOLS, eolMode, 0);
 
483
void wxScintilla::ConvertEOLs (int eolMode)
 
484
{
 
485
    SendMsg(SCI_CONVERTEOLS, eolMode, 0);
408
486
}
409
487
 
410
488
// Retrieve the current end of line mode - one of CRLF, CR, or LF.
411
 
int wxScintilla::GetEOLMode() {
412
 
    return SendMsg (SCI_GETEOLMODE, 0, 0);
 
489
int wxScintilla::GetEOLMode() const
 
490
{
 
491
    return SendMsg(SCI_GETEOLMODE, 0, 0);
413
492
}
414
493
 
415
494
// Set the current end of line mode.
416
 
void wxScintilla::SetEOLMode (int eolMode) {
417
 
    SendMsg (SCI_SETEOLMODE, eolMode, 0);
 
495
void wxScintilla::SetEOLMode (int eolMode)
 
496
{
 
497
    SendMsg(SCI_SETEOLMODE, eolMode, 0);
418
498
}
419
499
 
420
500
// Set the current styling position to pos and the styling mask to mask.
421
501
// The styling mask can be used to protect some bits in each styling byte from modification.
422
 
void wxScintilla::StartStyling (int pos, int mask) {
423
 
    SendMsg (SCI_STARTSTYLING, pos, mask);
 
502
void wxScintilla::StartStyling (int pos, int mask)
 
503
{
 
504
    SendMsg(SCI_STARTSTYLING, pos, mask);
424
505
}
425
506
 
426
507
// Change style from current styling position for length characters to a style
427
508
// and move the current styling position to after this newly styled segment.
428
 
void wxScintilla::SetStyling (int length, int style) {
429
 
    SendMsg (SCI_SETSTYLING, length, style);
 
509
void wxScintilla::SetStyling (int length, int style)
 
510
{
 
511
    SendMsg(SCI_SETSTYLING, length, style);
430
512
}
431
513
 
432
514
// Is drawing done first into a buffer or direct to the screen?
433
 
bool wxScintilla::GetBufferedDraw() {
434
 
    return SendMsg (SCI_GETBUFFEREDDRAW, 0, 0) != 0;
 
515
bool wxScintilla::GetBufferedDraw() const
 
516
{
 
517
    return SendMsg(SCI_GETBUFFEREDDRAW, 0, 0) != 0;
435
518
}
436
519
 
437
520
// If drawing is buffered then each line of text is drawn into a bitmap buffer
438
521
// before drawing it to the screen to avoid flicker.
439
 
void wxScintilla::SetBufferedDraw (bool buffered) {
440
 
    SendMsg (SCI_SETBUFFEREDDRAW, buffered, 0);
 
522
void wxScintilla::SetBufferedDraw (bool buffered)
 
523
{
 
524
    SendMsg(SCI_SETBUFFEREDDRAW, buffered, 0);
441
525
}
442
526
 
443
527
// Change the visible size of a tab to be a multiple of the width of a space character.
444
 
void wxScintilla::SetTabWidth (int tabWidth) {
445
 
    SendMsg (SCI_SETTABWIDTH, tabWidth, 0);
 
528
void wxScintilla::SetTabWidth (int tabWidth)
 
529
{
 
530
    SendMsg(SCI_SETTABWIDTH, tabWidth, 0);
446
531
}
447
532
 
448
533
// Retrieve the visible size of a tab.
449
 
int wxScintilla::GetTabWidth() {
450
 
    return SendMsg (SCI_GETTABWIDTH, 0, 0);
 
534
int wxScintilla::GetTabWidth() const
 
535
{
 
536
    return SendMsg(SCI_GETTABWIDTH, 0, 0);
451
537
}
452
538
 
453
539
// Set the code page used to interpret the bytes of the document as characters.
454
 
void wxScintilla::SetCodePage (int codePage) {
 
540
void wxScintilla::SetCodePage (int codePage)
 
541
{
455
542
#if wxUSE_UNICODE
456
543
    wxASSERT_MSG (codePage == wxSCI_CP_UTF8,
457
 
                  _T("Only wxSCI_CP_UTF8 may be used when wxUSE_UNICODE is on."));
 
544
                  wxT("Only wxSCI_CP_UTF8 may be used when wxUSE_UNICODE is on."));
458
545
#else
459
546
    wxASSERT_MSG (codePage != wxSCI_CP_UTF8,
460
 
                  _T("wxSCI_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
 
547
                  wxT("wxSCI_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
461
548
#endif
462
549
    SendMsg(SCI_SETCODEPAGE, codePage);
463
550
}
466
553
 
467
554
// Set the symbol used for a particular marker number,
468
555
// and optionally the fore and background colours.
469
 
void wxScintilla::MarkerDefine (int markerNumber, int markerSymbol) {
470
 
    SendMsg (SCI_MARKERDEFINE, markerNumber, markerSymbol);
 
556
void wxScintilla::MarkerDefine (int markerNumber, int markerSymbol,
 
557
                const wxColour& foreground,
 
558
                const wxColour& background)
 
559
{
 
560
    SendMsg(SCI_MARKERDEFINE, markerNumber, markerSymbol);
 
561
    if (foreground.Ok())
 
562
        MarkerSetForeground(markerNumber, foreground);
 
563
    if (background.Ok())
 
564
        MarkerSetBackground(markerNumber, background);
471
565
}
472
566
 
473
567
// Set the foreground colour used for a particular marker number.
474
 
void wxScintilla::MarkerSetForeground (int markerNumber, const wxColour& fore) {
475
 
    SendMsg (SCI_MARKERSETFORE, markerNumber, wxColourAsLong(fore));
 
568
void wxScintilla::MarkerSetForeground (int markerNumber, const wxColour& fore)
 
569
{
 
570
    SendMsg(SCI_MARKERSETFORE, markerNumber, wxColourAsLong(fore));
476
571
}
477
572
 
478
573
// Set the background colour used for a particular marker number.
479
 
void wxScintilla::MarkerSetBackground (int markerNumber, const wxColour& back) {
480
 
    SendMsg (SCI_MARKERSETBACK, markerNumber, wxColourAsLong(back));
 
574
void wxScintilla::MarkerSetBackground (int markerNumber, const wxColour& back)
 
575
{
 
576
    SendMsg(SCI_MARKERSETBACK, markerNumber, wxColourAsLong(back));
481
577
}
482
578
 
483
579
// Add a marker to a line, returning an ID which can be used to find or delete the marker.
484
 
int wxScintilla::MarkerAdd (int line, int markerNumber) {
485
 
    return SendMsg (SCI_MARKERADD, line, markerNumber);
 
580
int wxScintilla::MarkerAdd (int line, int markerNumber)
 
581
{
 
582
    return SendMsg(SCI_MARKERADD, line, markerNumber);
486
583
}
487
584
 
488
585
// Delete a marker from a line.
489
 
void wxScintilla::MarkerDelete (int line, int markerNumber) {
490
 
    SendMsg (SCI_MARKERDELETE, line, markerNumber);
 
586
void wxScintilla::MarkerDelete (int line, int markerNumber)
 
587
{
 
588
    SendMsg(SCI_MARKERDELETE, line, markerNumber);
491
589
}
492
590
 
493
591
// Delete all markers with a particular number from all lines.
494
 
void wxScintilla::MarkerDeleteAll (int markerNumber) {
495
 
    SendMsg (SCI_MARKERDELETEALL, markerNumber, 0);
 
592
void wxScintilla::MarkerDeleteAll (int markerNumber)
 
593
{
 
594
    SendMsg(SCI_MARKERDELETEALL, markerNumber, 0);
496
595
}
497
596
 
498
597
// Get a bit mask of all the markers set on a line.
499
 
int wxScintilla::MarkerGet (int line) {
500
 
    return SendMsg (SCI_MARKERGET, line, 0);
 
598
int wxScintilla::MarkerGet (int line)
 
599
{
 
600
    return SendMsg(SCI_MARKERGET, line, 0);
501
601
}
502
602
 
503
603
// Find the next line after lineStart that includes a marker in mask.
504
 
int wxScintilla::MarkerNext (int lineStart, int markerMask) {
505
 
    return SendMsg (SCI_MARKERNEXT, lineStart, markerMask);
 
604
int wxScintilla::MarkerNext (int lineStart, int markerMask)
 
605
{
 
606
    return SendMsg(SCI_MARKERNEXT, lineStart, markerMask);
506
607
}
507
608
 
508
609
// Find the previous line before lineStart that includes a marker in mask.
509
 
int wxScintilla::MarkerPrevious (int lineStart, int markerMask) {
510
 
    return SendMsg (SCI_MARKERPREVIOUS, lineStart, markerMask);
 
610
int wxScintilla::MarkerPrevious (int lineStart, int markerMask)
 
611
{
 
612
    return SendMsg(SCI_MARKERPREVIOUS, lineStart, markerMask);
511
613
}
512
614
 
513
615
// Define a marker from a bitmap
514
 
void wxScintilla::MarkerDefineBitmap (int markerNumber, const wxBitmap& bmp) {
515
 
    // convert bmp to a xpm in a string
516
 
    wxMemoryOutputStream strm;
517
 
    wxImage img = bmp.ConvertToImage();
518
 
#if wxCHECK_VERSION(2, 5, 0)
519
 
    if (img.HasAlpha()) img.ConvertAlphaToMask();
520
 
#endif
521
 
    img.SaveFile(strm, wxBITMAP_TYPE_XPM);
522
 
    size_t len = strm.GetSize();
523
 
    char* buff = new char[len+1];
524
 
    strm.CopyTo(buff, len);
525
 
    buff[len] = 0;
526
 
    SendMsg (SCI_MARKERDEFINEPIXMAP, markerNumber, (long)buff);
527
 
    delete [] buff;
 
616
void wxScintilla::MarkerDefineBitmap (int markerNumber, const wxBitmap& bmp)
 
617
{
 
618
        // convert bmp to a xpm in a string
 
619
        wxMemoryOutputStream strm;
 
620
        wxImage img = bmp.ConvertToImage();
 
621
        if (img.HasAlpha())
 
622
            img.ConvertAlphaToMask();
 
623
        img.SaveFile(strm, wxBITMAP_TYPE_XPM);
 
624
        size_t len = strm.GetSize();
 
625
        char* buff = new char[len+1];
 
626
        strm.CopyTo(buff, len);
 
627
        buff[len] = 0;
 
628
        SendMsg(SCI_MARKERDEFINEPIXMAP, markerNumber, (sptr_t)buff);
 
629
        delete [] buff;
 
630
 
528
631
}
529
632
 
530
633
// Add a set of markers to a line.
531
 
void wxScintilla::MarkerAddSet (int line, int markerSet) {
532
 
    SendMsg (SCI_MARKERADDSET, line, markerSet);
 
634
void wxScintilla::MarkerAddSet (int line, int set)
 
635
{
 
636
    SendMsg(SCI_MARKERADDSET, line, set);
 
637
}
 
638
 
 
639
// Set the alpha used for a marker that is drawn in the text area, not the margin.
 
640
void wxScintilla::MarkerSetAlpha (int markerNumber, int alpha)
 
641
{
 
642
    SendMsg(SCI_MARKERSETALPHA, markerNumber, alpha);
533
643
}
534
644
 
535
645
// Set a margin to be either numeric or symbolic.
536
 
void wxScintilla::SetMarginType (int margin, int marginType) {
537
 
    SendMsg (SCI_SETMARGINTYPEN, margin, marginType);
 
646
void wxScintilla::SetMarginType (int margin, int marginType)
 
647
{
 
648
    SendMsg(SCI_SETMARGINTYPEN, margin, marginType);
538
649
}
539
650
 
540
651
// Retrieve the type of a margin.
541
 
int wxScintilla::GetMarginType (int margin) {
542
 
    return SendMsg (SCI_GETMARGINTYPEN, margin, 0);
 
652
int wxScintilla::GetMarginType (int margin) const
 
653
{
 
654
    return SendMsg(SCI_GETMARGINTYPEN, margin, 0);
543
655
}
544
656
 
545
657
// Set the width of a margin to a width expressed in pixels.
546
 
void wxScintilla::SetMarginWidth (int margin, int pixels) {
547
 
    SendMsg (SCI_SETMARGINWIDTHN, margin, pixels);
 
658
void wxScintilla::SetMarginWidth (int margin, int pixelWidth)
 
659
{
 
660
    SendMsg(SCI_SETMARGINWIDTHN, margin, pixelWidth);
548
661
}
549
662
 
550
663
// Retrieve the width of a margin in pixels.
551
 
int wxScintilla::GetMarginWidth (int margin) {
552
 
    return SendMsg (SCI_GETMARGINWIDTHN, margin, 0);
 
664
int wxScintilla::GetMarginWidth (int margin) const
 
665
{
 
666
    return SendMsg(SCI_GETMARGINWIDTHN, margin, 0);
553
667
}
554
668
 
555
669
// Set a mask that determines which markers are displayed in a margin.
556
 
void wxScintilla::SetMarginMask (int margin, int mask) {
557
 
    SendMsg (SCI_SETMARGINMASKN, margin, mask);
 
670
void wxScintilla::SetMarginMask (int margin, int mask)
 
671
{
 
672
    SendMsg(SCI_SETMARGINMASKN, margin, mask);
558
673
}
559
674
 
560
675
// Retrieve the marker mask of a margin.
561
 
int wxScintilla::GetMarginMask (int margin) {
562
 
    return SendMsg (SCI_GETMARGINMASKN, margin, 0);
 
676
int wxScintilla::GetMarginMask (int margin) const
 
677
{
 
678
    return SendMsg(SCI_GETMARGINMASKN, margin, 0);
563
679
}
564
680
 
565
681
// Make a margin sensitive or insensitive to mouse clicks.
566
 
void wxScintilla::SetMarginSensitive (int margin, bool sensitive) {
567
 
    SendMsg (SCI_SETMARGINSENSITIVEN, margin, sensitive);
 
682
void wxScintilla::SetMarginSensitive (int margin, bool sensitive)
 
683
{
 
684
    SendMsg(SCI_SETMARGINSENSITIVEN, margin, sensitive);
568
685
}
569
686
 
570
687
// Retrieve the mouse click sensitivity of a margin.
571
 
bool wxScintilla::GetMarginSensitive (int margin) {
572
 
    return SendMsg (SCI_GETMARGINSENSITIVEN, margin, 0) != 0;
 
688
bool wxScintilla::GetMarginSensitive (int margin) const
 
689
{
 
690
    return SendMsg(SCI_GETMARGINSENSITIVEN, margin, 0) != 0;
573
691
}
574
692
 
575
693
// Clear all the styles and make equivalent to the global default style.
576
 
void wxScintilla::StyleClearAll() {
577
 
    SendMsg (SCI_STYLECLEARALL, 0, 0);
 
694
void wxScintilla::StyleClearAll()
 
695
{
 
696
    SendMsg(SCI_STYLECLEARALL, 0, 0);
578
697
}
579
698
 
580
699
// Set the foreground colour of a style.
581
 
void wxScintilla::StyleSetForeground (int style, const wxColour& fore) {
582
 
    SendMsg (SCI_STYLESETFORE, style, wxColourAsLong(fore));
 
700
void wxScintilla::StyleSetForeground (int style, const wxColour& fore)
 
701
{
 
702
    SendMsg(SCI_STYLESETFORE, style, wxColourAsLong(fore));
583
703
}
584
704
 
585
705
// Set the background colour of a style.
586
 
void wxScintilla::StyleSetBackground (int style, const wxColour& back) {
587
 
    SendMsg (SCI_STYLESETBACK, style, wxColourAsLong(back));
 
706
void wxScintilla::StyleSetBackground (int style, const wxColour& back)
 
707
{
 
708
    SendMsg(SCI_STYLESETBACK, style, wxColourAsLong(back));
588
709
}
589
710
 
590
711
// Set a style to be bold or not.
591
 
void wxScintilla::StyleSetBold (int style, bool bold) {
592
 
    SendMsg (SCI_STYLESETBOLD, style, bold);
 
712
void wxScintilla::StyleSetBold (int style, bool bold)
 
713
{
 
714
    SendMsg(SCI_STYLESETBOLD, style, bold);
593
715
}
594
716
 
595
717
// Set a style to be italic or not.
596
 
void wxScintilla::StyleSetItalic (int style, bool italic) {
597
 
    SendMsg (SCI_STYLESETITALIC, style, italic);
 
718
void wxScintilla::StyleSetItalic (int style, bool italic)
 
719
{
 
720
    SendMsg(SCI_STYLESETITALIC, style, italic);
598
721
}
599
722
 
600
723
// Set the size of characters of a style.
601
 
void wxScintilla::StyleSetSize (int style, int sizePoints) {
602
 
    SendMsg (SCI_STYLESETSIZE, style, sizePoints);
 
724
void wxScintilla::StyleSetSize (int style, int sizePoints)
 
725
{
 
726
    SendMsg(SCI_STYLESETSIZE, style, sizePoints);
603
727
}
604
728
 
605
729
// Set the font of a style.
606
 
void wxScintilla::StyleSetFaceName (int style, const wxString& fontName) {
607
 
    SendMsg (SCI_STYLESETFONT, style, (long)(const char*)wx2sci(fontName));
 
730
void wxScintilla::StyleSetFaceName (int style, const wxString& fontName)
 
731
{
 
732
    SendMsg(SCI_STYLESETFONT, style, (sptr_t)(const char*)wx2sci(fontName));
608
733
}
609
734
 
610
735
// Set a style to have its end of line filled or not.
611
 
void wxScintilla::StyleSetEOLFilled (int style, bool filled) {
612
 
    SendMsg (SCI_STYLESETEOLFILLED, style, filled);
 
736
void wxScintilla::StyleSetEOLFilled (int style, bool filled)
 
737
{
 
738
    SendMsg(SCI_STYLESETEOLFILLED, style, filled);
613
739
}
614
740
 
615
741
// Reset the default style to its state at startup
616
 
void wxScintilla::StyleResetDefault() {
617
 
    SendMsg (SCI_STYLERESETDEFAULT, 0, 0);
 
742
void wxScintilla::StyleResetDefault()
 
743
{
 
744
    SendMsg(SCI_STYLERESETDEFAULT, 0, 0);
618
745
}
619
746
 
620
747
// Set a style to be underlined or not.
621
 
void wxScintilla::StyleSetUnderline (int style, bool underline) {
622
 
    SendMsg (SCI_STYLESETUNDERLINE, style, underline);
 
748
void wxScintilla::StyleSetUnderline (int style, bool underline)
 
749
{
 
750
    SendMsg(SCI_STYLESETUNDERLINE, style, underline);
 
751
}
 
752
 
 
753
// Get the foreground colour of a style.
 
754
wxColour wxScintilla::StyleGetForeground(int style) const
 
755
{
 
756
    long c = SendMsg(SCI_STYLEGETFORE, style, 0);
 
757
    return wxColourFromLong(c);
 
758
}
 
759
 
 
760
// Get the background colour of a style.
 
761
wxColour wxScintilla::StyleGetBackground(int style) const
 
762
{
 
763
    long c = SendMsg(SCI_STYLEGETBACK, style, 0);
 
764
    return wxColourFromLong(c);
 
765
}
 
766
 
 
767
// Get is a style bold or not.
 
768
bool wxScintilla::StyleGetBold(int style) const
 
769
{
 
770
    return SendMsg(SCI_STYLEGETBOLD, style, 0) != 0;
 
771
}
 
772
 
 
773
// Get is a style italic or not.
 
774
bool wxScintilla::StyleGetItalic(int style) const
 
775
{
 
776
    return SendMsg(SCI_STYLEGETITALIC, style, 0) != 0;
 
777
}
 
778
 
 
779
// Get the size of characters of a style.
 
780
int wxScintilla::StyleGetSize(int style) const
 
781
{
 
782
    return SendMsg(SCI_STYLEGETSIZE, style, 0);
 
783
}
 
784
 
 
785
// Get the font facename of a style
 
786
wxString wxScintilla::StyleGetFaceName(int style)
 
787
{
 
788
     long msg = SCI_STYLEGETFONT;
 
789
     long len = SendMsg(msg, style, 0);
 
790
     wxMemoryBuffer mbuf(len+1);
 
791
     char* buf = (char*)mbuf.GetWriteBuf(len+1);
 
792
     SendMsg(msg, style, (sptr_t)buf);
 
793
     mbuf.UngetWriteBuf(len);
 
794
     mbuf.AppendByte(0);
 
795
     return sci2wx(buf);
 
796
}
 
797
 
 
798
// Get is a style to have its end of line filled or not.
 
799
bool wxScintilla::StyleGetEOLFilled(int style) const
 
800
{
 
801
    return SendMsg(SCI_STYLEGETEOLFILLED, style, 0) != 0;
 
802
}
 
803
 
 
804
// Get is a style underlined or not.
 
805
bool wxScintilla::StyleGetUnderline(int style) const
 
806
{
 
807
    return SendMsg(SCI_STYLEGETUNDERLINE, style, 0) != 0;
 
808
}
 
809
 
 
810
// Get is a style mixed case, or to force upper or lower case.
 
811
int wxScintilla::StyleGetCase(int style) const
 
812
{
 
813
    return SendMsg(SCI_STYLEGETCASE, style, 0);
 
814
}
 
815
 
 
816
// Get the character get of the font in a style.
 
817
int wxScintilla::StyleGetCharacterSet(int style) const
 
818
{
 
819
    return SendMsg(SCI_STYLEGETCHARACTERSET, style, 0);
 
820
}
 
821
 
 
822
// Get is a style visible or not.
 
823
bool wxScintilla::StyleGetVisible(int style) const
 
824
{
 
825
    return SendMsg(SCI_STYLEGETVISIBLE, style, 0) != 0;
 
826
}
 
827
 
 
828
// Get is a style changeable or not (read only).
 
829
// Experimental feature, currently buggy.
 
830
bool wxScintilla::StyleGetChangeable(int style) const
 
831
{
 
832
    return SendMsg(SCI_STYLEGETCHANGEABLE, style, 0) != 0;
 
833
}
 
834
 
 
835
// Get is a style a hotspot or not.
 
836
bool wxScintilla::StyleGetHotSpot(int style) const
 
837
{
 
838
    return SendMsg(SCI_STYLEGETHOTSPOT, style, 0) != 0;
623
839
}
624
840
 
625
841
// Set a style to be mixed case, or to force upper or lower case.
626
 
void wxScintilla::StyleSetCase (int style, int caseMode) {
627
 
    SendMsg (SCI_STYLESETCASE, style, caseMode);
 
842
void wxScintilla::StyleSetCase (int style, int caseForce)
 
843
{
 
844
    SendMsg(SCI_STYLESETCASE, style, caseForce);
628
845
}
629
846
 
630
847
// Set a style to be a hotspot or not.
631
 
void wxScintilla::StyleSetHotSpot (int style, bool hotspot) {
632
 
    SendMsg (SCI_STYLESETHOTSPOT, style, hotspot);
633
 
}
634
 
 
635
 
// Set the foreground colour of the selection and whether to use this setting.
636
 
void wxScintilla::SetSelForeground (bool useSetting, const wxColour& fore) {
637
 
    SendMsg (SCI_SETSELFORE, useSetting, wxColourAsLong(fore));
638
 
}
639
 
 
640
 
// Set the background colour of the selection and whether to use this setting.
641
 
void wxScintilla::SetSelBackground (bool useSetting, const wxColour& back) {
642
 
    SendMsg (SCI_SETSELBACK, useSetting, wxColourAsLong(back));
 
848
void wxScintilla::StyleSetHotSpot (int style, bool hotspot)
 
849
{
 
850
    SendMsg(SCI_STYLESETHOTSPOT, style, hotspot);
 
851
}
 
852
 
 
853
// Set the foreground colour of the main and additional selections and whether to use this setting.
 
854
void wxScintilla::SetSelForeground(bool useSetting, const wxColour& fore)
 
855
{
 
856
    SendMsg(SCI_SETSELFORE, useSetting, wxColourAsLong(fore));
 
857
}
 
858
 
 
859
// Set the background colour of the main and additional selections and whether to use this setting.
 
860
void wxScintilla::SetSelBackground(bool useSetting, const wxColour& back)
 
861
{
 
862
    SendMsg(SCI_SETSELBACK, useSetting, wxColourAsLong(back));
 
863
}
 
864
 
 
865
// Get the alpha of the selection.
 
866
int wxScintilla::GetSelAlpha () const
 
867
{
 
868
    return SendMsg(SCI_GETSELALPHA, 0, 0);
 
869
}
 
870
 
 
871
// Set the alpha of the selection.
 
872
void wxScintilla::SetSelAlpha (int alpha)
 
873
{
 
874
    SendMsg(SCI_SETSELALPHA, alpha, 0);
 
875
}
 
876
 
 
877
// Is the selection end of line filled?
 
878
bool wxScintilla::GetSelEOLFilled() const
 
879
{
 
880
    return SendMsg(SCI_GETSELEOLFILLED, 0, 0) != 0;
 
881
}
 
882
 
 
883
// Set the selection to have its end of line filled or not.
 
884
void wxScintilla::SetSelEOLFilled(bool filled)
 
885
{
 
886
    SendMsg(SCI_SETSELEOLFILLED, filled, 0);
643
887
}
644
888
 
645
889
// Set the foreground colour of the caret.
646
 
void wxScintilla::SetCaretForeground (const wxColour& fore) {
647
 
    SendMsg (SCI_SETCARETFORE, wxColourAsLong(fore), 0);
 
890
void wxScintilla::SetCaretForeground (const wxColour& fore)
 
891
{
 
892
    SendMsg(SCI_SETCARETFORE, wxColourAsLong(fore), 0);
648
893
}
649
894
 
650
895
// When key+modifier combination km is pressed perform msg.
651
 
void wxScintilla::CmdKeyAssign (int key, int modifiers, int cmd) {
652
 
    SendMsg (SCI_ASSIGNCMDKEY, MAKELONG(key, modifiers), cmd);
 
896
void wxScintilla::CmdKeyAssign (int key, int modifiers, int cmd)
 
897
{
 
898
    SendMsg(SCI_ASSIGNCMDKEY, MAKELONG(key, modifiers), cmd);
653
899
}
654
900
 
655
901
// When key+modifier combination km is pressed do nothing.
656
 
void wxScintilla::CmdKeyClear (int key, int modifiers) {
657
 
    SendMsg (SCI_CLEARCMDKEY, MAKELONG(key, modifiers));
 
902
void wxScintilla::CmdKeyClear (int key, int modifiers)
 
903
{
 
904
    SendMsg(SCI_CLEARCMDKEY, MAKELONG(key, modifiers));
658
905
}
659
906
 
660
907
// Drop all key mappings.
661
 
void wxScintilla::CmdKeyClearAll() {
662
 
    SendMsg (SCI_CLEARALLCMDKEYS, 0, 0);
 
908
void wxScintilla::CmdKeyClearAll()
 
909
{
 
910
    SendMsg(SCI_CLEARALLCMDKEYS, 0, 0);
663
911
}
664
912
 
665
913
// Set the styles for a segment of the document.
666
 
void wxScintilla::SetStyleBytes (int length, char* styleBytes) {
667
 
    SendMsg (SCI_SETSTYLINGEX, length, (long)styleBytes);
 
914
void wxScintilla::SetStyleBytes (int length, char* styleBytes)
 
915
{
 
916
    SendMsg(SCI_SETSTYLINGEX, length, (sptr_t)styleBytes);
668
917
}
669
918
 
670
919
// Set a style to be visible or not.
671
 
void wxScintilla::StyleSetVisible (int style, bool visible) {
672
 
    SendMsg (SCI_STYLESETVISIBLE, style, visible);
 
920
void wxScintilla::StyleSetVisible (int style, bool visible)
 
921
{
 
922
    SendMsg(SCI_STYLESETVISIBLE, style, visible);
673
923
}
674
924
 
675
925
// Get the time in milliseconds that the caret is on and off.
676
 
int wxScintilla::GetCaretPeriod() {
677
 
    return SendMsg (SCI_GETCARETPERIOD, 0, 0);
 
926
int wxScintilla::GetCaretPeriod() const
 
927
{
 
928
    return SendMsg(SCI_GETCARETPERIOD, 0, 0);
678
929
}
679
930
 
680
931
// Get the time in milliseconds that the caret is on and off. 0 = steady on.
681
 
void wxScintilla::SetCaretPeriod (int milliseconds) {
682
 
    SendMsg (SCI_SETCARETPERIOD, milliseconds, 0);
 
932
void wxScintilla::SetCaretPeriod (int periodMilliseconds)
 
933
{
 
934
    SendMsg(SCI_SETCARETPERIOD, periodMilliseconds, 0);
683
935
}
684
936
 
685
937
// Set the set of characters making up words for when moving or selecting by word.
686
 
// First sets deaults like SetCharsDefault.
687
 
void wxScintilla::SetWordChars (const wxString& characters) {
688
 
    SendMsg (SCI_SETWORDCHARS, 0, (long)(const char*)wx2sci(characters));
 
938
// First sets defaults like SetCharsDefault.
 
939
void wxScintilla::SetWordChars (const wxString& characters)
 
940
{
 
941
    SendMsg(SCI_SETWORDCHARS, 0, (sptr_t)(const char*)wx2sci(characters));
689
942
}
690
943
 
691
944
// Start a sequence of actions that is undone and redone as a unit.
692
945
// May be nested.
693
 
void wxScintilla::BeginUndoAction() {
694
 
    SendMsg (SCI_BEGINUNDOACTION, 0, 0);
 
946
void wxScintilla::BeginUndoAction()
 
947
{
 
948
    SendMsg(SCI_BEGINUNDOACTION, 0, 0);
695
949
}
696
950
 
697
951
// End a sequence of actions that is undone and redone as a unit.
698
 
void wxScintilla::EndUndoAction() {
699
 
    SendMsg (SCI_ENDUNDOACTION, 0, 0);
 
952
void wxScintilla::EndUndoAction()
 
953
{
 
954
    SendMsg(SCI_ENDUNDOACTION, 0, 0);
700
955
}
701
956
 
702
957
// Set an indicator to plain, squiggle or TT.
703
 
void wxScintilla::IndicatorSetStyle (int indic, int style) {
704
 
    SendMsg (SCI_INDICSETSTYLE, indic, style);
 
958
void wxScintilla::IndicatorSetStyle (int indic, int style)
 
959
{
 
960
    SendMsg(SCI_INDICSETSTYLE, indic, style);
705
961
}
706
962
 
707
963
// Retrieve the style of an indicator.
708
 
int wxScintilla::IndicatorGetStyle (int indic) {
709
 
    return SendMsg (SCI_INDICGETSTYLE, indic, 0);
 
964
int wxScintilla::IndicatorGetStyle (int indic) const
 
965
{
 
966
    return SendMsg(SCI_INDICGETSTYLE, indic, 0);
710
967
}
711
968
 
712
969
// Set the foreground colour of an indicator.
713
 
void wxScintilla::IndicatorSetForeground (int indic, const wxColour& fore) {
714
 
    SendMsg (SCI_INDICSETFORE, indic, wxColourAsLong(fore));
 
970
void wxScintilla::IndicatorSetForeground (int indic, const wxColour& fore)
 
971
{
 
972
    SendMsg(SCI_INDICSETFORE, indic, wxColourAsLong(fore));
715
973
}
716
974
 
717
975
// Retrieve the foreground colour of an indicator.
718
 
wxColour wxScintilla::IndicatorGetForeground (int indic) {
719
 
    long colour = SendMsg (SCI_INDICGETFORE, indic, 0);
720
 
    return wxColourFromLong(colour);
 
976
wxColour wxScintilla::IndicatorGetForeground (int indic) const
 
977
{
 
978
    long c = SendMsg(SCI_INDICGETFORE, indic, 0);
 
979
    return wxColourFromLong(c);
 
980
}
 
981
 
 
982
// Set an indicator to draw under text or over(default).
 
983
void wxScintilla::IndicatorSetUnder(int indic, bool under)
 
984
{
 
985
    SendMsg(SCI_INDICSETUNDER, indic, under);
 
986
}
 
987
 
 
988
// Retrieve whether indicator drawn under or over text.
 
989
bool wxScintilla::IndicatorGetUnder(int indic) const
 
990
{
 
991
    return SendMsg(SCI_INDICGETUNDER, indic, 0) != 0;
721
992
}
722
993
 
723
994
// Set the foreground colour of all whitespace and whether to use this setting.
724
 
void wxScintilla::SetWhitespaceForeground (bool useSetting, const wxColour& fore) {
725
 
    SendMsg (SCI_SETWHITESPACEFORE, useSetting, wxColourAsLong(fore));
 
995
void wxScintilla::SetWhitespaceForeground (bool useSetting, const wxColour& fore)
 
996
{
 
997
    SendMsg(SCI_SETWHITESPACEFORE, useSetting, wxColourAsLong(fore));
726
998
}
727
999
 
728
1000
// Set the background colour of all whitespace and whether to use this setting.
729
 
void wxScintilla::SetWhitespaceBackground (bool useSetting, const wxColour& back) {
730
 
    SendMsg (SCI_SETWHITESPACEBACK, useSetting, wxColourAsLong(back));
 
1001
void wxScintilla::SetWhitespaceBackground (bool useSetting, const wxColour& back)
 
1002
{
 
1003
    SendMsg(SCI_SETWHITESPACEBACK, useSetting, wxColourAsLong(back));
 
1004
}
 
1005
 
 
1006
// Set the size of the dots used to mark space characters.
 
1007
void wxScintilla::SetWhitespaceSize(int size)
 
1008
{
 
1009
    SendMsg(SCI_SETWHITESPACESIZE, size, 0);
 
1010
}
 
1011
 
 
1012
// Get the size of the dots used to mark space characters.
 
1013
int wxScintilla::GetWhitespaceSize() const
 
1014
{
 
1015
    return SendMsg(SCI_GETWHITESPACESIZE, 0, 0);
731
1016
}
732
1017
 
733
1018
// Divide each styling byte into lexical class bits (default: 5) and indicator
734
1019
// bits (default: 3). If a lexer requires more than 32 lexical states, then this
735
1020
// is used to expand the possible states.
736
 
void wxScintilla::SetStyleBits (int bits) {
737
 
    SendMsg (SCI_SETSTYLEBITS, bits, 0);
 
1021
void wxScintilla::SetStyleBits (int bits)
 
1022
{
 
1023
    SendMsg(SCI_SETSTYLEBITS, bits, 0);
738
1024
}
739
1025
 
740
1026
// Retrieve number of bits in style bytes used to hold the lexical state.
741
 
int wxScintilla::GetStyleBits() {
742
 
    return SendMsg (SCI_GETSTYLEBITS, 0, 0);
 
1027
int wxScintilla::GetStyleBits() const
 
1028
{
 
1029
    return SendMsg(SCI_GETSTYLEBITS, 0, 0);
743
1030
}
744
1031
 
745
1032
// Used to hold extra styling information for each line.
746
 
void wxScintilla::SetLineState (int line, int state) {
747
 
    SendMsg (SCI_SETLINESTATE, line, state);
 
1033
void wxScintilla::SetLineState (int line, int state)
 
1034
{
 
1035
    SendMsg(SCI_SETLINESTATE, line, state);
748
1036
}
749
1037
 
750
1038
// Retrieve the extra styling information for a line.
751
 
int wxScintilla::GetLineState (int line) {
752
 
    return SendMsg (SCI_GETLINESTATE, line, 0);
 
1039
int wxScintilla::GetLineState (int line) const
 
1040
{
 
1041
    return SendMsg(SCI_GETLINESTATE, line, 0);
753
1042
}
754
1043
 
755
1044
// Retrieve the last line number that has line state.
756
 
int wxScintilla::GetMaxLineState() {
757
 
    return SendMsg (SCI_GETMAXLINESTATE, 0, 0);
 
1045
int wxScintilla::GetMaxLineState() const
 
1046
{
 
1047
    return SendMsg(SCI_GETMAXLINESTATE, 0, 0);
758
1048
}
759
1049
 
760
1050
// Is the background of the line containing the caret in a different colour?
761
 
bool wxScintilla::GetCaretLineVisible() {
762
 
    return SendMsg (SCI_GETCARETLINEVISIBLE, 0, 0) != 0;
 
1051
bool wxScintilla::GetCaretLineVisible() const
 
1052
{
 
1053
    return SendMsg(SCI_GETCARETLINEVISIBLE, 0, 0) != 0;
763
1054
}
764
1055
 
765
1056
// Display the background of the line containing the caret in a different colour.
766
 
void wxScintilla::SetCaretLineVisible (bool show) {
767
 
    SendMsg (SCI_SETCARETLINEVISIBLE, show, 0);
 
1057
void wxScintilla::SetCaretLineVisible (bool show)
 
1058
{
 
1059
    SendMsg(SCI_SETCARETLINEVISIBLE, show, 0);
768
1060
}
769
1061
 
770
1062
// Get the colour of the background of the line containing the caret.
771
 
wxColour wxScintilla::GetCaretLineBackground() {
772
 
    long colour = SendMsg (SCI_GETCARETLINEBACK, 0, 0);
773
 
    return wxColourFromLong (colour);
 
1063
wxColour wxScintilla::GetCaretLineBackground() const
 
1064
{
 
1065
    long c = SendMsg(SCI_GETCARETLINEBACK, 0, 0);
 
1066
    return wxColourFromLong(c);
774
1067
}
775
1068
 
776
1069
// Set the colour of the background of the line containing the caret.
777
 
void wxScintilla::SetCaretLineBackground (const wxColour& back) {
778
 
    SendMsg (SCI_SETCARETLINEBACK, wxColourAsLong(back), 0);
 
1070
void wxScintilla::SetCaretLineBackground (const wxColour& back)
 
1071
{
 
1072
    SendMsg(SCI_SETCARETLINEBACK, wxColourAsLong(back), 0);
779
1073
}
780
1074
 
781
1075
// Set a style to be changeable or not (read only).
782
1076
// Experimental feature, currently buggy.
783
 
void wxScintilla::StyleSetChangeable (int style, bool changeable) {
784
 
    SendMsg (SCI_STYLESETCHANGEABLE, style, changeable);
 
1077
void wxScintilla::StyleSetChangeable (int style, bool changeable)
 
1078
{
 
1079
    SendMsg(SCI_STYLESETCHANGEABLE, style, changeable);
785
1080
}
786
1081
 
787
1082
// Display a auto-completion list.
788
1083
// The lenEntered parameter indicates how many characters before
789
1084
// the caret should be used to provide context.
790
 
void wxScintilla::AutoCompShow (int lenEntered, const wxString& itemList) {
791
 
    SendMsg (SCI_AUTOCSHOW, lenEntered, (long)(const char*)wx2sci(itemList));
 
1085
void wxScintilla::AutoCompShow (int lenEntered, const wxString& itemList)
 
1086
{
 
1087
    SendMsg(SCI_AUTOCSHOW, lenEntered, (sptr_t)(const char*)wx2sci(itemList));
792
1088
}
793
1089
 
794
1090
// Remove the auto-completion list from the screen.
795
 
void wxScintilla::AutoCompCancel() {
796
 
    SendMsg (SCI_AUTOCCANCEL, 0, 0);
 
1091
void wxScintilla::AutoCompCancel()
 
1092
{
 
1093
    SendMsg(SCI_AUTOCCANCEL, 0, 0);
797
1094
}
798
1095
 
799
1096
// Is there an auto-completion list visible?
800
 
bool wxScintilla::AutoCompActive() {
801
 
    return SendMsg (SCI_AUTOCACTIVE, 0, 0) != 0;
 
1097
bool wxScintilla::AutoCompActive()
 
1098
{
 
1099
    return SendMsg(SCI_AUTOCACTIVE, 0, 0) != 0;
802
1100
}
803
1101
 
804
1102
// Retrieve the position of the caret when the auto-completion list was displayed.
805
 
int wxScintilla::AutoCompPosStart() {
806
 
    return SendMsg (SCI_AUTOCPOSSTART, 0, 0);
 
1103
int wxScintilla::AutoCompPosStart()
 
1104
{
 
1105
    return SendMsg(SCI_AUTOCPOSSTART, 0, 0);
807
1106
}
808
1107
 
809
1108
// User has selected an item so remove the list and insert the selection.
810
 
void wxScintilla::AutoCompComplete() {
811
 
    SendMsg (SCI_AUTOCCOMPLETE, 0, 0);
 
1109
void wxScintilla::AutoCompComplete()
 
1110
{
 
1111
    SendMsg(SCI_AUTOCCOMPLETE, 0, 0);
812
1112
}
813
1113
 
814
1114
// Define a set of character that when typed cancel the auto-completion list.
815
 
void wxScintilla::AutoCompStops (const wxString& characterSet) {
816
 
    SendMsg (SCI_AUTOCSTOPS, 0, (long)(const char*)wx2sci(characterSet));
 
1115
void wxScintilla::AutoCompStops (const wxString& characterSet)
 
1116
{
 
1117
    SendMsg(SCI_AUTOCSTOPS, 0, (long)(const char*)wx2sci(characterSet));
817
1118
}
818
1119
 
819
1120
// Change the separator character in the string setting up an auto-completion list.
820
1121
// Default is space but can be changed if items contain space.
821
 
void wxScintilla::AutoCompSetSeparator (int separatorCharacter) {
822
 
    SendMsg (SCI_AUTOCSETSEPARATOR, separatorCharacter, 0);
 
1122
void wxScintilla::AutoCompSetSeparator (int separatorCharacter)
 
1123
{
 
1124
    SendMsg(SCI_AUTOCSETSEPARATOR, separatorCharacter, 0);
823
1125
}
824
1126
 
825
1127
// Retrieve the auto-completion list separator character.
826
 
int wxScintilla::AutoCompGetSeparator() {
827
 
    return SendMsg (SCI_AUTOCGETSEPARATOR, 0, 0);
 
1128
int wxScintilla::AutoCompGetSeparator() const
 
1129
{
 
1130
    return SendMsg(SCI_AUTOCGETSEPARATOR, 0, 0);
828
1131
}
829
1132
 
830
1133
// Select the item in the auto-completion list that starts with a string.
831
 
void wxScintilla::AutoCompSelect (const wxString& text) {
832
 
    SendMsg (SCI_AUTOCSELECT, 0, (long)(const char*)wx2sci(text));
 
1134
void wxScintilla::AutoCompSelect (const wxString& text)
 
1135
{
 
1136
    SendMsg(SCI_AUTOCSELECT, 0, (sptr_t)(const char*)wx2sci(text));
833
1137
}
834
1138
 
835
1139
// Should the auto-completion list be cancelled if the user backspaces to a
836
1140
// position before where the box was created.
837
 
void wxScintilla::AutoCompSetCancelAtStart (bool cancel) {
838
 
    SendMsg (SCI_AUTOCSETCANCELATSTART, cancel, 0);
 
1141
void wxScintilla::AutoCompSetCancelAtStart (bool cancel)
 
1142
{
 
1143
    SendMsg(SCI_AUTOCSETCANCELATSTART, cancel, 0);
839
1144
}
840
1145
 
841
1146
// Retrieve whether auto-completion cancelled by backspacing before start.
842
 
bool wxScintilla::AutoCompGetCancelAtStart() {
843
 
    return SendMsg (SCI_AUTOCGETCANCELATSTART, 0, 0) != 0;
 
1147
bool wxScintilla::AutoCompGetCancelAtStart() const
 
1148
{
 
1149
    return SendMsg(SCI_AUTOCGETCANCELATSTART, 0, 0) != 0;
844
1150
}
845
1151
 
846
1152
// Define a set of characters that when typed will cause the autocompletion to
847
1153
// choose the selected item.
848
 
void wxScintilla::AutoCompSetFillUps (const wxString& characterSet) {
849
 
    SendMsg (SCI_AUTOCSETFILLUPS, 0, (long)(const char*)wx2sci(characterSet));
 
1154
void wxScintilla::AutoCompSetFillUps (const wxString& characterSet)
 
1155
{
 
1156
    SendMsg(SCI_AUTOCSETFILLUPS, 0, (sptr_t)(const char*)wx2sci(characterSet));
850
1157
}
851
1158
 
852
1159
// Should a single item auto-completion list automatically choose the item.
853
 
void wxScintilla::AutoCompSetChooseSingle (bool chooseSingle) {
854
 
    SendMsg (SCI_AUTOCSETCHOOSESINGLE, chooseSingle, 0);
 
1160
void wxScintilla::AutoCompSetChooseSingle (bool chooseSingle)
 
1161
{
 
1162
    SendMsg(SCI_AUTOCSETCHOOSESINGLE, chooseSingle, 0);
855
1163
}
856
1164
 
857
1165
// Retrieve whether a single item auto-completion list automatically choose the item.
858
 
bool wxScintilla::AutoCompGetChooseSingle() {
859
 
    return SendMsg (SCI_AUTOCGETCHOOSESINGLE, 0, 0) != 0;
 
1166
bool wxScintilla::AutoCompGetChooseSingle() const
 
1167
{
 
1168
    return SendMsg(SCI_AUTOCGETCHOOSESINGLE, 0, 0) != 0;
860
1169
}
861
1170
 
862
1171
// Set whether case is significant when performing auto-completion searches.
863
 
void wxScintilla::AutoCompSetIgnoreCase (bool ignoreCase) {
864
 
    SendMsg (SCI_AUTOCSETIGNORECASE, ignoreCase, 0);
 
1172
void wxScintilla::AutoCompSetIgnoreCase (bool ignoreCase)
 
1173
{
 
1174
    SendMsg(SCI_AUTOCSETIGNORECASE, ignoreCase, 0);
865
1175
}
866
1176
 
867
1177
// Retrieve state of ignore case flag.
868
 
bool wxScintilla::AutoCompGetIgnoreCase() {
869
 
    return SendMsg (SCI_AUTOCGETIGNORECASE, 0, 0) != 0;
 
1178
bool wxScintilla::AutoCompGetIgnoreCase() const
 
1179
{
 
1180
    return SendMsg(SCI_AUTOCGETIGNORECASE, 0, 0) != 0;
870
1181
}
871
1182
 
872
1183
// Display a list of strings and send notification when user chooses one.
873
 
void wxScintilla::UserListShow (int listType, const wxString& itemList) {
874
 
    SendMsg (SCI_USERLISTSHOW, listType, (long)(const char*)wx2sci(itemList));
 
1184
void wxScintilla::UserListShow (int listType, const wxString& itemList)
 
1185
{
 
1186
    SendMsg(SCI_USERLISTSHOW, listType, (sptr_t)(const char*)wx2sci(itemList));
875
1187
}
876
1188
 
877
1189
// Set whether or not autocompletion is hidden automatically when nothing matches.
878
 
void wxScintilla::AutoCompSetAutoHide (bool autoHide) {
879
 
    SendMsg (SCI_AUTOCSETAUTOHIDE, autoHide, 0);
 
1190
void wxScintilla::AutoCompSetAutoHide (bool autoHide)
 
1191
{
 
1192
    SendMsg(SCI_AUTOCSETAUTOHIDE, autoHide, 0);
880
1193
}
881
1194
 
882
1195
// Retrieve whether or not autocompletion is hidden automatically when nothing matches.
883
 
bool wxScintilla::AutoCompGetAutoHide() {
884
 
    return SendMsg (SCI_AUTOCGETAUTOHIDE, 0, 0) != 0;
 
1196
bool wxScintilla::AutoCompGetAutoHide() const
 
1197
{
 
1198
    return SendMsg(SCI_AUTOCGETAUTOHIDE, 0, 0) != 0;
885
1199
}
886
1200
 
887
1201
// Set whether or not autocompletion deletes any word characters
888
1202
// after the inserted text upon completion.
889
 
void wxScintilla::AutoCompSetDropRestOfWord (bool dropRestOfWord) {
890
 
    SendMsg (SCI_AUTOCSETDROPRESTOFWORD, dropRestOfWord, 0);
 
1203
void wxScintilla::AutoCompSetDropRestOfWord (bool dropRestOfWord)
 
1204
{
 
1205
    SendMsg(SCI_AUTOCSETDROPRESTOFWORD, dropRestOfWord, 0);
891
1206
}
892
1207
 
893
1208
// Retrieve whether or not autocompletion deletes any word characters
894
1209
// after the inserted text upon completion.
895
 
bool wxScintilla::AutoCompGetDropRestOfWord() {
896
 
    return SendMsg (SCI_AUTOCGETDROPRESTOFWORD, 0, 0) != 0;
 
1210
bool wxScintilla::AutoCompGetDropRestOfWord() const
 
1211
{
 
1212
    return SendMsg(SCI_AUTOCGETDROPRESTOFWORD, 0, 0) != 0;
897
1213
}
898
1214
 
899
1215
// Register an image for use in autocompletion lists.
900
 
void wxScintilla::RegisterImage (int type, const wxBitmap& bmp) {
901
 
    // convert bmp to a xpm in a string
902
 
    wxMemoryOutputStream strm;
903
 
    wxImage img = bmp.ConvertToImage();
904
 
#if wxCHECK_VERSION(2, 5, 0)
905
 
    if (img.HasAlpha()) img.ConvertAlphaToMask();
906
 
#endif
907
 
    img.SaveFile(strm, wxBITMAP_TYPE_XPM);
908
 
    size_t len = strm.GetSize();
909
 
    char* buff = new char[len+1];
910
 
    strm.CopyTo(buff, len);
911
 
    buff[len] = 0;
912
 
    SendMsg(SCI_REGISTERIMAGE, type, (long)buff);
913
 
    delete [] buff;
 
1216
void wxScintilla::RegisterImage (int type, const wxBitmap& bmp)
 
1217
{
 
1218
        // convert bmp to a xpm in a string
 
1219
        wxMemoryOutputStream strm;
 
1220
        wxImage img = bmp.ConvertToImage();
 
1221
        if (img.HasAlpha())
 
1222
            img.ConvertAlphaToMask();
 
1223
        img.SaveFile(strm, wxBITMAP_TYPE_XPM);
 
1224
        size_t len = strm.GetSize();
 
1225
        char* buff = new char[len+1];
 
1226
        strm.CopyTo(buff, len);
 
1227
        buff[len] = 0;
 
1228
        SendMsg(SCI_REGISTERIMAGE, type, (sptr_t)buff);
 
1229
        delete [] buff;
 
1230
 
914
1231
}
915
1232
 
916
1233
// Clear all the registered images.
917
 
void wxScintilla::ClearRegisteredImages() {
918
 
    SendMsg (SCI_CLEARREGISTEREDIMAGES, 0, 0);
 
1234
void wxScintilla::ClearRegisteredImages()
 
1235
{
 
1236
    SendMsg(SCI_CLEARREGISTEREDIMAGES, 0, 0);
919
1237
}
920
1238
 
921
1239
// Retrieve the auto-completion list type-separator character.
922
 
int wxScintilla::AutoCompGetTypeSeparator() {
923
 
    return SendMsg (SCI_AUTOCGETTYPESEPARATOR, 0, 0);
 
1240
int wxScintilla::AutoCompGetTypeSeparator() const
 
1241
{
 
1242
    return SendMsg(SCI_AUTOCGETTYPESEPARATOR, 0, 0);
924
1243
}
925
1244
 
926
1245
// Change the type-separator character in the string setting up an auto-completion list.
927
1246
// Default is '?' but can be changed if items contain '?'.
928
 
void wxScintilla::AutoCompSetTypeSeparator (int separatorCharacter) {
929
 
    SendMsg (SCI_AUTOCSETTYPESEPARATOR, separatorCharacter, 0);
 
1247
void wxScintilla::AutoCompSetTypeSeparator (int separatorCharacter)
 
1248
{
 
1249
    SendMsg(SCI_AUTOCSETTYPESEPARATOR, separatorCharacter, 0);
930
1250
}
931
1251
 
932
1252
// Set the maximum width, in characters, of auto-completion and user lists.
933
1253
// Set to 0 to autosize to fit longest item, which is the default.
934
 
void wxScintilla::AutoCompSetMaxWidth (int characterCount) {
935
 
    SendMsg (SCI_AUTOCSETMAXWIDTH, characterCount, 0);
 
1254
void wxScintilla::AutoCompSetMaxWidth (int characterCount)
 
1255
{
 
1256
    SendMsg(SCI_AUTOCSETMAXWIDTH, characterCount, 0);
936
1257
}
937
1258
 
938
1259
// Get the maximum width, in characters, of auto-completion and user lists.
939
 
int wxScintilla::AutoCompGetMaxWidth() {
940
 
    return SendMsg (SCI_AUTOCGETMAXWIDTH, 0, 0);
 
1260
int wxScintilla::AutoCompGetMaxWidth() const
 
1261
{
 
1262
    return SendMsg(SCI_AUTOCGETMAXWIDTH, 0, 0);
941
1263
}
942
1264
 
943
1265
// Set the maximum height, in rows, of auto-completion and user lists.
944
1266
// The default is 5 rows.
945
 
void wxScintilla::AutoCompSetMaxHeight (int rowCount) {
946
 
    SendMsg (SCI_AUTOCSETMAXHEIGHT, rowCount, 0);
 
1267
void wxScintilla::AutoCompSetMaxHeight (int rowCount)
 
1268
{
 
1269
    SendMsg(SCI_AUTOCSETMAXHEIGHT, rowCount, 0);
947
1270
}
948
1271
 
949
1272
// Set the maximum height, in rows, of auto-completion and user lists.
950
 
int wxScintilla::AutoCompGetMaxHeight() {
951
 
    return SendMsg (SCI_AUTOCGETMAXHEIGHT, 0, 0);
 
1273
int wxScintilla::AutoCompGetMaxHeight() const
 
1274
{
 
1275
    return SendMsg(SCI_AUTOCGETMAXHEIGHT, 0, 0);
952
1276
}
953
1277
 
954
1278
// Set the number of spaces used for one level of indentation.
955
 
void wxScintilla::SetIndent (int indentSize) {
956
 
    SendMsg (SCI_SETINDENT, indentSize, 0);
 
1279
void wxScintilla::SetIndent (int indentSize)
 
1280
{
 
1281
    SendMsg(SCI_SETINDENT, indentSize, 0);
957
1282
}
958
1283
 
959
1284
// Retrieve indentation size.
960
 
int wxScintilla::GetIndent() {
961
 
    return SendMsg (SCI_GETINDENT, 0, 0);
 
1285
int wxScintilla::GetIndent() const
 
1286
{
 
1287
    return SendMsg(SCI_GETINDENT, 0, 0);
962
1288
}
963
1289
 
964
1290
// Indentation will only use space characters if useTabs is false, otherwise
965
1291
// it will use a combination of tabs and spaces.
966
 
void wxScintilla::SetUseTabs (bool useTabs) {
967
 
    SendMsg (SCI_SETUSETABS, useTabs, 0);
 
1292
void wxScintilla::SetUseTabs (bool useTabs)
 
1293
{
 
1294
    SendMsg(SCI_SETUSETABS, useTabs, 0);
968
1295
}
969
1296
 
970
1297
// Retrieve whether tabs will be used in indentation.
971
 
bool wxScintilla::GetUseTabs() {
972
 
    return SendMsg (SCI_GETUSETABS, 0, 0) != 0;
 
1298
bool wxScintilla::GetUseTabs() const
 
1299
{
 
1300
    return SendMsg(SCI_GETUSETABS, 0, 0) != 0;
973
1301
}
974
1302
 
975
1303
// Change the indentation of a line to a number of columns.
976
 
void wxScintilla::SetLineIndentation (int line, int indentSize) {
977
 
    SendMsg (SCI_SETLINEINDENTATION, line, indentSize);
 
1304
void wxScintilla::SetLineIndentation (int line, int indentSize)
 
1305
{
 
1306
    SendMsg(SCI_SETLINEINDENTATION, line, indentSize);
978
1307
}
979
1308
 
980
1309
// Retrieve the number of columns that a line is indented.
981
 
int wxScintilla::GetLineIndentation (int line) {
982
 
    return SendMsg (SCI_GETLINEINDENTATION, line, 0);
 
1310
int wxScintilla::GetLineIndentation (int line) const
 
1311
{
 
1312
    return SendMsg(SCI_GETLINEINDENTATION, line, 0);
983
1313
}
984
1314
 
985
1315
// Retrieve the position before the first non indentation character on a line.
986
 
int wxScintilla::GetLineIndentPosition (int line) {
987
 
    return SendMsg (SCI_GETLINEINDENTPOSITION, line, 0);
 
1316
int wxScintilla::GetLineIndentPosition (int line) const
 
1317
{
 
1318
    return SendMsg(SCI_GETLINEINDENTPOSITION, line, 0);
988
1319
}
989
1320
 
990
1321
// Retrieve the column number of a position, taking tab width into account.
991
 
int wxScintilla::GetColumn (int pos) {
992
 
    return SendMsg (SCI_GETCOLUMN, pos, 0);
 
1322
int wxScintilla::GetColumn (int pos) const
 
1323
{
 
1324
    return SendMsg(SCI_GETCOLUMN, pos, 0);
993
1325
}
994
1326
 
995
1327
// Show or hide the horizontal scroll bar.
996
 
void wxScintilla::SetUseHorizontalScrollBar (bool show) {
997
 
    SendMsg (SCI_SETHSCROLLBAR, show, 0);
 
1328
void wxScintilla::SetUseHorizontalScrollBar (bool show)
 
1329
{
 
1330
    SendMsg(SCI_SETHSCROLLBAR, show, 0);
998
1331
}
999
1332
 
1000
1333
// Is the horizontal scroll bar visible?
1001
 
bool wxScintilla::GetUseHorizontalScrollBar() {
1002
 
    return SendMsg (SCI_GETHSCROLLBAR, 0, 0) != 0;
 
1334
bool wxScintilla::GetUseHorizontalScrollBar() const
 
1335
{
 
1336
    return SendMsg(SCI_GETHSCROLLBAR, 0, 0) != 0;
1003
1337
}
1004
1338
 
1005
1339
// Show or hide indentation guides.
1006
 
void wxScintilla::SetIndentationGuides (bool show) {
1007
 
    SendMsg (SCI_SETINDENTATIONGUIDES, show, 0);
 
1340
void wxScintilla::SetIndentationGuides (int indentView)
 
1341
{
 
1342
    SendMsg(SCI_SETINDENTATIONGUIDES, indentView, 0);
1008
1343
}
1009
1344
 
1010
1345
// Are the indentation guides visible?
1011
 
bool wxScintilla::GetIndentationGuides() {
1012
 
    return SendMsg (SCI_GETINDENTATIONGUIDES, 0, 0) != 0;
 
1346
int wxScintilla::GetIndentationGuides() const
 
1347
{
 
1348
    return SendMsg(SCI_GETINDENTATIONGUIDES, 0, 0);
1013
1349
}
1014
1350
 
1015
1351
// Set the highlighted indentation guide column.
1016
1352
// 0 = no highlighted guide.
1017
 
void wxScintilla::SetHighlightGuide (int column) {
1018
 
    SendMsg (SCI_SETHIGHLIGHTGUIDE, column, 0);
 
1353
void wxScintilla::SetHighlightGuide (int column)
 
1354
{
 
1355
    SendMsg(SCI_SETHIGHLIGHTGUIDE, column, 0);
1019
1356
}
1020
1357
 
1021
1358
// Get the highlighted indentation guide column.
1022
 
int wxScintilla::GetHighlightGuide() {
1023
 
    return SendMsg (SCI_GETHIGHLIGHTGUIDE, 0, 0);
 
1359
int wxScintilla::GetHighlightGuide() const
 
1360
{
 
1361
    return SendMsg(SCI_GETHIGHLIGHTGUIDE, 0, 0);
1024
1362
}
1025
1363
 
1026
1364
// Get the position after the last visible characters on a line.
1027
 
int wxScintilla::GetLineEndPosition (int line) {
1028
 
    return SendMsg (SCI_GETLINEENDPOSITION, line, 0);
 
1365
int wxScintilla::GetLineEndPosition (int line) const
 
1366
{
 
1367
    return SendMsg(SCI_GETLINEENDPOSITION, line, 0);
1029
1368
}
1030
1369
 
1031
1370
// Get the code page used to interpret the bytes of the document as characters.
1032
 
int wxScintilla::GetCodePage() {
1033
 
    return SendMsg (SCI_GETCODEPAGE, 0, 0);
 
1371
int wxScintilla::GetCodePage() const
 
1372
{
 
1373
    return SendMsg(SCI_GETCODEPAGE, 0, 0);
1034
1374
}
1035
1375
 
1036
1376
// Get the foreground colour of the caret.
1037
 
wxColour wxScintilla::GetCaretForeground() {
1038
 
    long colour = SendMsg (SCI_GETCARETFORE, 0, 0);
1039
 
    return wxColourFromLong(colour);
 
1377
wxColour wxScintilla::GetCaretForeground() const
 
1378
{
 
1379
    long c = SendMsg(SCI_GETCARETFORE, 0, 0);
 
1380
    return wxColourFromLong(c);
1040
1381
}
1041
1382
 
1042
1383
// Get use palette (SCI_GETUSEPALETTE) not supported
1043
1384
 
1044
1385
// In read-only mode?
1045
 
bool wxScintilla::GetReadOnly() {
1046
 
    return SendMsg (SCI_GETREADONLY, 0, 0) != 0;
 
1386
bool wxScintilla::GetReadOnly() const
 
1387
{
 
1388
    return SendMsg(SCI_GETREADONLY, 0, 0) != 0;
1047
1389
}
1048
1390
 
1049
1391
// Sets the position of the caret.
1050
 
void wxScintilla::SetCurrentPos (int pos) {
1051
 
    SendMsg (SCI_SETCURRENTPOS, pos, 0);
 
1392
void wxScintilla::SetCurrentPos (int pos)
 
1393
{
 
1394
    SendMsg(SCI_SETCURRENTPOS, pos, 0);
1052
1395
}
1053
1396
 
1054
1397
// Sets the position that starts the selection - this becomes the anchor.
1055
 
void wxScintilla::SetSelectionStart (int pos) {
1056
 
    SendMsg (SCI_SETSELECTIONSTART, pos, 0);
 
1398
void wxScintilla::SetSelectionStart(int pos)
 
1399
{
 
1400
    SendMsg(SCI_SETSELECTIONSTART, pos, 0);
1057
1401
}
1058
1402
 
1059
1403
// Returns the position at the start of the selection.
1060
 
int wxScintilla::GetSelectionStart() {
1061
 
    return SendMsg (SCI_GETSELECTIONSTART, 0, 0);
 
1404
int wxScintilla::GetSelectionStart() const
 
1405
{
 
1406
    return SendMsg(SCI_GETSELECTIONSTART, 0, 0);
1062
1407
}
1063
1408
 
1064
1409
// Sets the position that ends the selection - this becomes the currentPosition.
1065
 
void wxScintilla::SetSelectionEnd (int pos) {
1066
 
    SendMsg (SCI_SETSELECTIONEND, pos, 0);
 
1410
void wxScintilla::SetSelectionEnd(int pos)
 
1411
{
 
1412
    SendMsg(SCI_SETSELECTIONEND, pos, 0);
1067
1413
}
1068
1414
 
1069
1415
// Returns the position at the end of the selection.
1070
 
int wxScintilla::GetSelectionEnd() {
1071
 
    return SendMsg (SCI_GETSELECTIONEND, 0, 0);
 
1416
int wxScintilla::GetSelectionEnd() const
 
1417
{
 
1418
    return SendMsg(SCI_GETSELECTIONEND, 0, 0);
1072
1419
}
1073
1420
 
1074
1421
// Sets the print magnification added to the point size of each style for printing.
1075
 
void wxScintilla::SetPrintMagnification (int magnification) {
1076
 
    SendMsg (SCI_SETPRINTMAGNIFICATION, magnification, 0);
 
1422
void wxScintilla::SetPrintMagnification (int magnification)
 
1423
{
 
1424
    SendMsg(SCI_SETPRINTMAGNIFICATION, magnification, 0);
1077
1425
}
1078
1426
 
1079
1427
// Returns the print magnification.
1080
 
int wxScintilla::GetPrintMagnification() {
1081
 
    return SendMsg (SCI_GETPRINTMAGNIFICATION, 0, 0);
 
1428
int wxScintilla::GetPrintMagnification() const
 
1429
{
 
1430
    return SendMsg(SCI_GETPRINTMAGNIFICATION, 0, 0);
1082
1431
}
1083
1432
 
1084
1433
// Modify colours when printing for clearer printed text.
1085
 
void wxScintilla::SetPrintColourMode (int mode) {
1086
 
    SendMsg (SCI_SETPRINTCOLOURMODE, mode, 0);
 
1434
void wxScintilla::SetPrintColourMode (int mode)
 
1435
{
 
1436
    SendMsg(SCI_SETPRINTCOLOURMODE, mode, 0);
1087
1437
}
1088
1438
 
1089
1439
// Returns the print colour mode.
1090
 
int wxScintilla::GetPrintColourMode() {
1091
 
    return SendMsg (SCI_GETPRINTCOLOURMODE, 0, 0);
 
1440
int wxScintilla::GetPrintColourMode() const
 
1441
{
 
1442
    return SendMsg(SCI_GETPRINTCOLOURMODE, 0, 0);
1092
1443
}
1093
1444
 
1094
1445
// Find some text in the document.
1095
 
int wxScintilla::FindText (int minPos, int maxPos, const wxString& text, int flags, int* lengthFound) {
 
1446
int wxScintilla::FindText (int minPos, int maxPos,
 
1447
                           const wxString& text,
 
1448
                           int flags,
 
1449
                           int* lengthFound)
 
1450
{
1096
1451
    TextToFind  ft;
1097
1452
    ft.chrg.cpMin = minPos;
1098
1453
    ft.chrg.cpMax = maxPos;
1099
1454
    wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(text);
1100
1455
    ft.lpstrText = (char*)(const char*)buf;
1101
 
    int ret = SendMsg (SCI_FINDTEXT, flags, (long)&ft);
1102
 
    if (lengthFound) *lengthFound = ft.chrgText.cpMax - ft.chrgText.cpMin;
 
1456
 
 
1457
    int ret = SendMsg(SCI_FINDTEXT, flags, (sptr_t)&ft);
 
1458
    if (lengthFound)
 
1459
        *lengthFound = ft.chrgText.cpMax - ft.chrgText.cpMin;
 
1460
 
1103
1461
    return ret;
1104
1462
}
1105
1463
 
1106
1464
// On Windows, will draw the document into a display context such as a printer.
1107
 
 int wxScintilla::FormatRange (bool doDraw, int startPos, int endPos,
1108
 
                               wxDC* draw, wxDC* target, wxRect renderRect, wxRect pageRect) {
 
1465
 int wxScintilla::FormatRange (bool doDraw,
 
1466
                               int startPos,
 
1467
                               int endPos,
 
1468
                               wxDC* draw,
 
1469
                               wxDC* target,
 
1470
                               wxRect renderRect,
 
1471
                               wxRect pageRect)
 
1472
{
1109
1473
    RangeToFormat fr;
 
1474
 
1110
1475
    if (endPos < startPos) {
1111
 
        int temp = startPos;
1112
 
        startPos = endPos;
1113
 
        endPos = temp;
 
1476
       int temp = startPos;
 
1477
       startPos = endPos;
 
1478
       endPos = temp;
1114
1479
    }
1115
1480
    fr.hdc = draw;
1116
1481
    fr.hdcTarget = target;
1124
1489
    fr.rcPage.bottom = pageRect.GetBottom();
1125
1490
    fr.chrg.cpMin = startPos;
1126
1491
    fr.chrg.cpMax = endPos;
1127
 
    return SendMsg (SCI_FORMATRANGE, doDraw, (long)&fr);
 
1492
 
 
1493
    return SendMsg(SCI_FORMATRANGE, doDraw, (sptr_t)&fr);
1128
1494
}
1129
1495
 
1130
1496
// Retrieve the display line at the top of the display.
1131
 
int wxScintilla::GetFirstVisibleLine() {
1132
 
    return SendMsg (SCI_GETFIRSTVISIBLELINE, 0, 0);
 
1497
int wxScintilla::GetFirstVisibleLine() const
 
1498
{
 
1499
    return SendMsg(SCI_GETFIRSTVISIBLELINE, 0, 0);
1133
1500
}
1134
1501
 
1135
1502
// Retrieve the contents of a line.
1136
 
wxString wxScintilla::GetLine (int line) {
1137
 
    int len = LineLength(line);
1138
 
    if (!len) return wxEmptyString;
1139
 
    wxMemoryBuffer mbuf(len+1);
1140
 
    char* buf = (char*)mbuf.GetWriteBuf(len+1);
1141
 
    SendMsg (SCI_GETLINE, line, (long)buf);
1142
 
    mbuf.UngetWriteBuf(len);
1143
 
    mbuf.AppendByte(0);
1144
 
    return sci2wx(buf);
 
1503
wxString wxScintilla::GetLine (int line) const {
 
1504
         int len = LineLength(line);
 
1505
         if (!len) return wxEmptyString;
 
1506
 
 
1507
         wxMemoryBuffer mbuf(len+1);
 
1508
         char* buf = (char*)mbuf.GetWriteBuf(len+1);
 
1509
         SendMsg(SCI_GETLINE, line, (sptr_t)buf);
 
1510
         mbuf.UngetWriteBuf(len);
 
1511
         mbuf.AppendByte(0);
 
1512
         return sci2wx(buf);
1145
1513
}
1146
1514
 
1147
1515
// Returns the number of lines in the document. There is always at least one.
1148
 
int wxScintilla::GetLineCount() {
1149
 
    return SendMsg (SCI_GETLINECOUNT, 0, 0);
 
1516
int wxScintilla::GetLineCount() const
 
1517
{
 
1518
    return SendMsg(SCI_GETLINECOUNT, 0, 0);
1150
1519
}
1151
1520
 
1152
1521
// Sets the size in pixels of the left margin.
1153
 
void wxScintilla::SetMarginLeft (int pixels) {
1154
 
    SendMsg (SCI_SETMARGINLEFT, 0, pixels);
 
1522
void wxScintilla::SetMarginLeft (int pixelWidth)
 
1523
{
 
1524
    SendMsg(SCI_SETMARGINLEFT, 0, pixelWidth);
1155
1525
}
1156
1526
 
1157
1527
// Returns the size in pixels of the left margin.
1158
 
int wxScintilla::GetMarginLeft() {
1159
 
    return SendMsg (SCI_GETMARGINLEFT, 0, 0);
 
1528
int wxScintilla::GetMarginLeft() const
 
1529
{
 
1530
    return SendMsg(SCI_GETMARGINLEFT, 0, 0);
1160
1531
}
1161
1532
 
1162
1533
// Sets the size in pixels of the right margin.
1163
 
void wxScintilla::SetMarginRight (int pixels) {
1164
 
    SendMsg (SCI_SETMARGINRIGHT, 0, pixels);
 
1534
void wxScintilla::SetMarginRight (int pixelWidth)
 
1535
{
 
1536
    SendMsg(SCI_SETMARGINRIGHT, 0, pixelWidth);
1165
1537
}
1166
1538
 
1167
1539
// Returns the size in pixels of the right margin.
1168
 
int wxScintilla::GetMarginRight() {
1169
 
    return SendMsg (SCI_GETMARGINRIGHT, 0, 0);
 
1540
int wxScintilla::GetMarginRight() const
 
1541
{
 
1542
    return SendMsg(SCI_GETMARGINRIGHT, 0, 0);
1170
1543
}
1171
1544
 
1172
1545
// Is the document different from when it was last saved?
1173
 
bool wxScintilla::GetModify() {
1174
 
    return SendMsg (SCI_GETMODIFY, 0, 0) != 0;
 
1546
bool wxScintilla::GetModify() const
 
1547
{
 
1548
    return SendMsg(SCI_GETMODIFY, 0, 0) != 0;
1175
1549
}
1176
1550
 
1177
1551
// Select a range of text.
1178
 
void wxScintilla::SetSelection (int startPos, int endPos) {
1179
 
    SendMsg (SCI_SETSEL, startPos, endPos);
 
1552
void wxScintilla::SetSelectionVoid(int startPos, int endPos)
 
1553
{
 
1554
    SendMsg(SCI_SETSEL, startPos, endPos);
1180
1555
}
1181
1556
 
1182
1557
// Retrieve the selected text.
1183
 
wxString wxScintilla::GetSelectedText() {
1184
 
    int start;
1185
 
    int end;
1186
 
    GetSelection(&start, &end);
1187
 
    int len = end - start;
 
1558
wxString wxScintilla::GetSelectedText()
 
1559
{
 
1560
/* C::B begin */
 
1561
    /* Notice that this function used to use 'GetSelection(&start, &end);'
 
1562
     * to calculate the selected text length - which works fine when using
 
1563
     * simple selection, but when using multiple selection, or even rectangular
 
1564
     * selection it may cause a crash. */
 
1565
    int len (0);
 
1566
 
 
1567
    // determine the selected text range
 
1568
    len = SendMsg(SCI_GETSELTEXT, 0, 0);
 
1569
/* C::B end */
1188
1570
    if (!len) return wxEmptyString;
 
1571
 
1189
1572
    wxMemoryBuffer mbuf(len+2);
1190
1573
    char* buf = (char*)mbuf.GetWriteBuf(len+1);
1191
 
    SendMsg (SCI_GETSELTEXT, 0, (long)buf);
 
1574
    SendMsg(SCI_GETSELTEXT, 0, (sptr_t)buf);
1192
1575
    mbuf.UngetWriteBuf(len);
1193
1576
    mbuf.AppendByte(0);
1194
1577
    return sci2wx(buf);
1195
1578
}
1196
1579
 
1197
1580
// Retrieve a range of text.
1198
 
wxString wxScintilla::GetTextRange (int startPos, int endPos) {
 
1581
wxString wxScintilla::GetTextRange (int startPos, int endPos)
 
1582
{
1199
1583
    if (endPos < startPos) {
1200
1584
        int temp = startPos;
1201
1585
        startPos = endPos;
1202
1586
        endPos = temp;
1203
 
        }
1204
 
    int len = endPos - startPos;
 
1587
    }
 
1588
    int   len  = endPos - startPos;
1205
1589
    if (!len) return wxEmptyString;
1206
1590
    wxMemoryBuffer mbuf(len+1);
1207
1591
    char* buf = (char*)mbuf.GetWriteBuf(len);
1209
1593
    tr.lpstrText = buf;
1210
1594
    tr.chrg.cpMin = startPos;
1211
1595
    tr.chrg.cpMax = endPos;
1212
 
    SendMsg (SCI_GETTEXTRANGE, 0, (long)&tr);
 
1596
    SendMsg(SCI_GETTEXTRANGE, 0, (sptr_t)&tr);
1213
1597
    mbuf.UngetWriteBuf(len);
1214
1598
    mbuf.AppendByte(0);
1215
1599
    return sci2wx(buf);
1216
1600
}
1217
1601
 
1218
1602
// Draw the selection in normal style or with selection highlighted.
1219
 
void wxScintilla::HideSelection (bool hide) {
1220
 
    SendMsg (SCI_HIDESELECTION, hide, 0);
1221
 
}
1222
 
 
1223
 
// Retrieve the point in the window where a position is displayed.
1224
 
wxPoint wxScintilla::PointFromPosition (int pos) {
1225
 
    int x = SendMsg(SCI_POINTXFROMPOSITION, 0, pos);
1226
 
    int y = SendMsg(SCI_POINTYFROMPOSITION, 0, pos);
1227
 
    return wxPoint (x, y);
 
1603
void wxScintilla::HideSelection (bool normal)
 
1604
{
 
1605
    SendMsg(SCI_HIDESELECTION, normal, 0);
1228
1606
}
1229
1607
 
1230
1608
// Retrieve the line containing a position.
1231
 
int wxScintilla::LineFromPosition (int pos) {
1232
 
    return SendMsg (SCI_LINEFROMPOSITION, pos, 0);
 
1609
int wxScintilla::LineFromPosition (int pos) const
 
1610
{
 
1611
    return SendMsg(SCI_LINEFROMPOSITION, pos, 0);
1233
1612
}
1234
1613
 
1235
1614
// Retrieve the position at the start of a line.
1236
 
int wxScintilla::PositionFromLine (int line) {
1237
 
    return SendMsg (SCI_POSITIONFROMLINE, line, 0);
 
1615
int wxScintilla::PositionFromLine (int line) const
 
1616
{
 
1617
    return SendMsg(SCI_POSITIONFROMLINE, line, 0);
1238
1618
}
1239
1619
 
1240
1620
// Scroll horizontally and vertically.
1241
 
void wxScintilla::LineScroll (int columns, int lines) {
1242
 
    SendMsg (SCI_LINESCROLL, columns, lines);
 
1621
void wxScintilla::LineScroll (int columns, int lines)
 
1622
{
 
1623
    SendMsg(SCI_LINESCROLL, columns, lines);
1243
1624
}
1244
1625
 
1245
1626
// Ensure the caret is visible.
1246
 
void wxScintilla::EnsureCaretVisible() {
1247
 
    SendMsg (SCI_SCROLLCARET, 0, 0);
 
1627
void wxScintilla::EnsureCaretVisible()
 
1628
{
 
1629
    SendMsg(SCI_SCROLLCARET, 0, 0);
1248
1630
}
1249
1631
 
1250
1632
// Replace the selected text with the argument text.
1251
 
void wxScintilla::ReplaceSelection (const wxString& text) {
1252
 
    SendMsg (SCI_REPLACESEL, 0, (long)(const char*)wx2sci(text));
 
1633
void wxScintilla::ReplaceSelection (const wxString& text)
 
1634
{
 
1635
    SendMsg(SCI_REPLACESEL, 0, (sptr_t)(const char*)wx2sci(text));
1253
1636
}
1254
1637
 
1255
1638
// Set to read only or read write.
1256
 
void wxScintilla::SetReadOnly (bool readOnly) {
1257
 
    SendMsg (SCI_SETREADONLY, readOnly, 0);
 
1639
void wxScintilla::SetReadOnly (bool readOnly)
 
1640
{
 
1641
    SendMsg(SCI_SETREADONLY, readOnly, 0);
1258
1642
}
1259
1643
 
1260
1644
// Will a paste succeed?
1261
 
bool wxScintilla::CanPaste() {
1262
 
    return SendMsg (SCI_CANPASTE, 0, 0) != 0;
 
1645
bool wxScintilla::CanPaste() const
 
1646
{
 
1647
    return SendMsg(SCI_CANPASTE, 0, 0) != 0;
1263
1648
}
1264
1649
 
1265
1650
// Are there any undoable actions in the undo history?
1266
 
bool wxScintilla::CanUndo() {
1267
 
    return SendMsg (SCI_CANUNDO, 0, 0) != 0;
 
1651
bool wxScintilla::CanUndo() const
 
1652
{
 
1653
    return SendMsg(SCI_CANUNDO, 0, 0) != 0;
1268
1654
}
1269
1655
 
1270
1656
// Delete the undo history.
1271
 
void wxScintilla::EmptyUndoBuffer() {
1272
 
    SendMsg (SCI_EMPTYUNDOBUFFER, 0, 0);
 
1657
void wxScintilla::EmptyUndoBuffer(bool collectChangeHistory)
 
1658
{
 
1659
    SendMsg(SCI_EMPTYUNDOBUFFER, collectChangeHistory, 0);
1273
1660
}
1274
1661
 
1275
1662
// Undo one action in the undo history.
1276
 
void wxScintilla::Undo() {
1277
 
    SendMsg (SCI_UNDO, 0, 0);
 
1663
void wxScintilla::Undo()
 
1664
{
 
1665
    SendMsg(SCI_UNDO, 0, 0);
1278
1666
}
1279
1667
 
1280
1668
// Cut the selection to the clipboard.
1281
 
void wxScintilla::Cut() {
1282
 
    SendMsg (SCI_CUT, 0, 0);
 
1669
void wxScintilla::Cut()
 
1670
{
 
1671
    SendMsg(SCI_CUT, 0, 0);
1283
1672
}
1284
1673
 
1285
1674
// Copy the selection to the clipboard.
1286
 
void wxScintilla::Copy() {
1287
 
    SendMsg (SCI_COPY, 0, 0);
 
1675
void wxScintilla::Copy()
 
1676
{
 
1677
    SendMsg(SCI_COPY, 0, 0);
1288
1678
}
1289
1679
 
1290
1680
// Paste the contents of the clipboard into the document replacing the selection.
1291
 
void wxScintilla::Paste() {
1292
 
    SendMsg (SCI_PASTE, 0, 0);
 
1681
void wxScintilla::Paste()
 
1682
{
 
1683
    SendMsg(SCI_PASTE, 0, 0);
1293
1684
}
1294
1685
 
1295
1686
// Clear the selection.
1296
 
void wxScintilla::Clear() {
1297
 
    SendMsg (SCI_CLEAR, 0, 0);
 
1687
void wxScintilla::Clear()
 
1688
{
 
1689
    SendMsg(SCI_CLEAR, 0, 0);
1298
1690
}
1299
1691
 
1300
1692
// Replace the contents of the document with the argument text.
1301
 
void wxScintilla::SetText (const wxString& text) {
1302
 
    SendMsg(SCI_SETTEXT, 0, (long)(const char*)wx2sci(text));
 
1693
void wxScintilla::SetText (const wxString& text)
 
1694
{
 
1695
    SendMsg(SCI_SETTEXT, 0, (sptr_t)(const char*)wx2sci(text));
1303
1696
}
1304
1697
 
1305
1698
// Retrieve all the text in the document.
1306
 
wxString wxScintilla::GetText() {
1307
 
    int len  = GetTextLength();
1308
 
    wxMemoryBuffer mbuf(len+1);   // leave room for the null...
1309
 
    char* buf = (char*)mbuf.GetWriteBuf(len+1);
1310
 
    SendMsg (SCI_GETTEXT, len+1, (long)buf);
1311
 
    mbuf.UngetWriteBuf(len);
1312
 
    mbuf.AppendByte(0);
1313
 
    return sci2wx(buf);
 
1699
wxString wxScintilla::GetText() const {
 
1700
         int len  = GetTextLength();
 
1701
         wxMemoryBuffer mbuf(len+1);   // leave room for the null...
 
1702
         char* buf = (char*)mbuf.GetWriteBuf(len+1);
 
1703
         SendMsg(SCI_GETTEXT, len+1, (sptr_t)buf);
 
1704
         mbuf.UngetWriteBuf(len);
 
1705
         mbuf.AppendByte(0);
 
1706
         return sci2wx(buf);
1314
1707
}
1315
1708
 
1316
1709
// Retrieve the number of characters in the document.
1317
 
int wxScintilla::GetTextLength() {
1318
 
    return SendMsg (SCI_GETTEXTLENGTH, 0, 0);
 
1710
int wxScintilla::GetTextLength() const
 
1711
{
 
1712
    return SendMsg(SCI_GETTEXTLENGTH, 0, 0);
1319
1713
}
1320
1714
 
1321
1715
// Set to overtype (true) or insert mode.
1322
 
void wxScintilla::SetOvertype (bool overtype) {
1323
 
    SendMsg (SCI_SETOVERTYPE, overtype, 0);
 
1716
void wxScintilla::SetOvertype (bool overtype)
 
1717
{
 
1718
    SendMsg(SCI_SETOVERTYPE, overtype, 0);
1324
1719
}
1325
1720
 
1326
1721
// Returns true if overtype mode is active otherwise false is returned.
1327
 
bool wxScintilla::GetOvertype() {
1328
 
    return SendMsg (SCI_GETOVERTYPE, 0, 0) != 0;
 
1722
bool wxScintilla::GetOvertype() const
 
1723
{
 
1724
    return SendMsg(SCI_GETOVERTYPE, 0, 0) != 0;
1329
1725
}
1330
1726
 
1331
1727
// Set the width of the insert mode caret.
1332
 
void wxScintilla::SetCaretWidth (int pixels) {
1333
 
    SendMsg (SCI_SETCARETWIDTH, pixels, 0);
 
1728
void wxScintilla::SetCaretWidth (int pixelWidth)
 
1729
{
 
1730
    SendMsg(SCI_SETCARETWIDTH, pixelWidth, 0);
1334
1731
}
1335
1732
 
1336
1733
// Returns the width of the insert mode caret.
1337
 
int wxScintilla::GetCaretWidth() {
1338
 
    return SendMsg (SCI_GETCARETWIDTH, 0, 0);
 
1734
int wxScintilla::GetCaretWidth() const
 
1735
{
 
1736
    return SendMsg(SCI_GETCARETWIDTH, 0, 0);
1339
1737
}
1340
1738
 
1341
1739
// Sets the position that starts the target which is used for updating the
1342
1740
// document without affecting the scroll position.
1343
 
void wxScintilla::SetTargetStart (int pos) {
1344
 
    SendMsg (SCI_SETTARGETSTART, pos, 0);
 
1741
void wxScintilla::SetTargetStart (int pos)
 
1742
{
 
1743
    SendMsg(SCI_SETTARGETSTART, pos, 0);
1345
1744
}
1346
1745
 
1347
1746
// Get the position that starts the target.
1348
 
int wxScintilla::GetTargetStart() {
1349
 
    return SendMsg (SCI_GETTARGETSTART, 0, 0);
 
1747
int wxScintilla::GetTargetStart() const
 
1748
{
 
1749
    return SendMsg(SCI_GETTARGETSTART, 0, 0);
1350
1750
}
1351
1751
 
1352
1752
// Sets the position that ends the target which is used for updating the
1353
1753
// document without affecting the scroll position.
1354
 
void wxScintilla::SetTargetEnd (int pos) {
1355
 
    SendMsg (SCI_SETTARGETEND, pos, 0);
 
1754
void wxScintilla::SetTargetEnd (int pos)
 
1755
{
 
1756
    SendMsg(SCI_SETTARGETEND, pos, 0);
1356
1757
}
1357
1758
 
1358
1759
// Get the position that ends the target.
1359
 
int wxScintilla::GetTargetEnd() {
1360
 
    return SendMsg (SCI_GETTARGETEND, 0, 0);
 
1760
int wxScintilla::GetTargetEnd() const
 
1761
{
 
1762
    return SendMsg(SCI_GETTARGETEND, 0, 0);
1361
1763
}
1362
1764
 
1363
1765
// Replace the target text with the argument text.
1364
1766
// Text is counted so it can contain NULs.
1365
1767
// Returns the length of the replacement text.
1366
 
int wxScintilla::ReplaceTarget (const wxString& text) {
 
1768
 
 
1769
int wxScintilla::ReplaceTarget (const wxString& text)
 
1770
{
1367
1771
    wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(text);
1368
 
    return SendMsg (SCI_REPLACETARGET, strlen(buf), (long)(const char*)buf);
 
1772
    return SendMsg(SCI_REPLACETARGET, strlen(buf), (sptr_t)(const char*)buf);
1369
1773
}
1370
1774
 
1371
1775
// Replace the target text with the argument text after \d processing.
1374
1778
// matched in the last search operation which were surrounded by \( and \).
1375
1779
// Returns the length of the replacement text including any change
1376
1780
// caused by processing the \d patterns.
1377
 
int wxScintilla::ReplaceTargetRE (const wxString& text) {
 
1781
 
 
1782
int wxScintilla::ReplaceTargetRE (const wxString& text)
 
1783
{
1378
1784
    wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(text);
1379
 
    return SendMsg (SCI_REPLACETARGETRE, strlen(buf), (long)(const char*)buf);
 
1785
    return SendMsg(SCI_REPLACETARGETRE, strlen(buf), (sptr_t)(const char*)buf);
1380
1786
}
1381
1787
 
1382
1788
// Search for a counted string in the target and set the target to the found
1383
1789
// range. Text is counted so it can contain NULs.
1384
1790
// Returns length of range or -1 for failure in which case target is not moved.
1385
 
int wxScintilla::SearchInTarget (const wxString& text) {
 
1791
 
 
1792
int wxScintilla::SearchInTarget (const wxString& text)
 
1793
{
1386
1794
    wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(text);
1387
 
    return SendMsg (SCI_SEARCHINTARGET, strlen(buf), (long)(const char*)buf);
 
1795
    return SendMsg(SCI_SEARCHINTARGET, strlen(buf), (sptr_t)(const char*)buf);
1388
1796
}
1389
1797
 
1390
1798
// Set the search flags used by SearchInTarget.
1391
 
void wxScintilla::SetSearchFlags (int flags) {
1392
 
    SendMsg (SCI_SETSEARCHFLAGS, flags, 0);
 
1799
void wxScintilla::SetSearchFlags (int flags)
 
1800
{
 
1801
    SendMsg(SCI_SETSEARCHFLAGS, flags, 0);
1393
1802
}
1394
1803
 
1395
1804
// Get the search flags used by SearchInTarget.
1396
 
int wxScintilla::GetSearchFlags() {
1397
 
    return SendMsg (SCI_GETSEARCHFLAGS, 0, 0);
 
1805
int wxScintilla::GetSearchFlags() const
 
1806
{
 
1807
    return SendMsg(SCI_GETSEARCHFLAGS, 0, 0);
1398
1808
}
1399
1809
 
1400
1810
// Show a call tip containing a definition near position pos.
1401
 
void wxScintilla::CallTipShow (int pos, const wxString& definition) {
1402
 
    SendMsg (SCI_CALLTIPSHOW, pos, (long)(const char*)wx2sci(definition));
 
1811
void wxScintilla::CallTipShow (int pos, const wxString& definition)
 
1812
{
 
1813
    SendMsg(SCI_CALLTIPSHOW, pos, (long)(const char*)wx2sci(definition));
1403
1814
}
1404
1815
 
1405
1816
// Remove the call tip from the screen.
1406
 
void wxScintilla::CallTipCancel() {
1407
 
    SendMsg (SCI_CALLTIPCANCEL, 0, 0);
 
1817
void wxScintilla::CallTipCancel()
 
1818
{
 
1819
    SendMsg(SCI_CALLTIPCANCEL, 0, 0);
1408
1820
}
1409
1821
 
1410
1822
// Is there an active call tip?
1411
 
bool wxScintilla::CallTipActive() {
1412
 
    return SendMsg (SCI_CALLTIPACTIVE, 0, 0) != 0;
 
1823
bool wxScintilla::CallTipActive()
 
1824
{
 
1825
    return SendMsg(SCI_CALLTIPACTIVE, 0, 0) != 0;
1413
1826
}
1414
1827
 
1415
1828
// Retrieve the position where the caret was before displaying the call tip.
1416
 
int wxScintilla::CallTipPosAtStart() {
1417
 
    return SendMsg (SCI_CALLTIPPOSSTART, 0, 0);
 
1829
int wxScintilla::CallTipPosAtStart()
 
1830
{
 
1831
    return SendMsg(SCI_CALLTIPPOSSTART, 0, 0);
1418
1832
}
1419
1833
 
1420
1834
// Highlight a segment of the definition.
1421
 
void wxScintilla::CallTipSetHighlight (int startPos, int endPos) {
1422
 
    SendMsg (SCI_CALLTIPSETHLT, startPos, endPos);
 
1835
void wxScintilla::CallTipSetHighlight (int start, int end)
 
1836
{
 
1837
    SendMsg(SCI_CALLTIPSETHLT, start, end);
1423
1838
}
1424
1839
 
1425
1840
// Set the background colour for the call tip.
1426
 
void wxScintilla::CallTipSetBackground (const wxColour& back) {
1427
 
    SendMsg (SCI_CALLTIPSETBACK, wxColourAsLong(back), 0);
 
1841
void wxScintilla::CallTipSetBackground (const wxColour& back)
 
1842
{
 
1843
    SendMsg(SCI_CALLTIPSETBACK, wxColourAsLong(back), 0);
1428
1844
}
1429
1845
 
1430
1846
// Set the foreground colour for the call tip.
1431
 
void wxScintilla::CallTipSetForeground (const wxColour& fore) {
1432
 
    SendMsg (SCI_CALLTIPSETFORE, wxColourAsLong(fore), 0);
 
1847
void wxScintilla::CallTipSetForeground (const wxColour& fore)
 
1848
{
 
1849
    SendMsg(SCI_CALLTIPSETFORE, wxColourAsLong(fore), 0);
1433
1850
}
1434
1851
 
1435
1852
// Set the foreground colour for the highlighted part of the call tip.
1436
 
void wxScintilla::CallTipSetForegroundHighlight (const wxColour& fore) {
1437
 
    SendMsg (SCI_CALLTIPSETFOREHLT, wxColourAsLong(fore), 0);
 
1853
void wxScintilla::CallTipSetForegroundHighlight (const wxColour& fore)
 
1854
{
 
1855
    SendMsg(SCI_CALLTIPSETFOREHLT, wxColourAsLong(fore), 0);
 
1856
}
 
1857
 
 
1858
// Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
 
1859
void wxScintilla::CallTipUseStyle (int tabSize)
 
1860
{
 
1861
    SendMsg(SCI_CALLTIPUSESTYLE, tabSize, 0);
1438
1862
}
1439
1863
 
1440
1864
// Find the display line of a document line taking hidden lines into account.
1441
 
int wxScintilla::VisibleFromDocLine (int line) {
1442
 
    return SendMsg (SCI_VISIBLEFROMDOCLINE, line, 0);
 
1865
int wxScintilla::VisibleFromDocLine (int line)
 
1866
{
 
1867
    return SendMsg(SCI_VISIBLEFROMDOCLINE, line, 0);
1443
1868
}
1444
1869
 
1445
1870
// Find the document line of a display line taking hidden lines into account.
1446
 
int wxScintilla::DocLineFromVisible (int lineDisplay) {
1447
 
    return SendMsg (SCI_DOCLINEFROMVISIBLE, lineDisplay, 0);
 
1871
int wxScintilla::DocLineFromVisible (int lineDisplay)
 
1872
{
 
1873
    return SendMsg(SCI_DOCLINEFROMVISIBLE, lineDisplay, 0);
1448
1874
}
1449
1875
 
1450
1876
// The number of display lines needed to wrap a document line
1451
 
int wxScintilla::WrapCount (int line) {
1452
 
    return SendMsg (SCI_WRAPCOUNT, line, 0);
 
1877
int wxScintilla::WrapCount (int line)
 
1878
{
 
1879
    return SendMsg(SCI_WRAPCOUNT, line, 0);
1453
1880
}
1454
1881
 
1455
1882
// Set the fold level of a line.
1456
1883
// This encodes an integer level along with flags indicating whether the
1457
1884
// line is a header and whether it is effectively white space.
1458
 
void wxScintilla::SetFoldLevel (int line, int level) {
1459
 
    SendMsg (SCI_SETFOLDLEVEL, line, level);
 
1885
void wxScintilla::SetFoldLevel (int line, int level)
 
1886
{
 
1887
    SendMsg(SCI_SETFOLDLEVEL, line, level);
1460
1888
}
1461
1889
 
1462
1890
// Retrieve the fold level of a line.
1463
 
int wxScintilla::GetFoldLevel (int line) {
1464
 
    return SendMsg (SCI_GETFOLDLEVEL, line, 0);
 
1891
int wxScintilla::GetFoldLevel (int line) const
 
1892
{
 
1893
    return SendMsg(SCI_GETFOLDLEVEL, line, 0);
1465
1894
}
1466
1895
 
1467
1896
// Find the last child line of a header line.
1468
 
int wxScintilla::GetLastChild (int line, int level) {
1469
 
    return SendMsg (SCI_GETLASTCHILD, line, level);
 
1897
int wxScintilla::GetLastChild (int line, int level) const
 
1898
{
 
1899
    return SendMsg(SCI_GETLASTCHILD, line, level);
1470
1900
}
1471
1901
 
1472
1902
// Find the parent line of a child line.
1473
 
int wxScintilla::GetFoldParent (int line) {
1474
 
    return SendMsg (SCI_GETFOLDPARENT, line, 0);
 
1903
int wxScintilla::GetFoldParent (int line) const
 
1904
{
 
1905
    return SendMsg(SCI_GETFOLDPARENT, line, 0);
1475
1906
}
1476
1907
 
1477
1908
// Make a range of lines visible.
1478
 
void wxScintilla::ShowLines (int lineStart, int lineEnd) {
1479
 
    SendMsg (SCI_SHOWLINES, lineStart, lineEnd);
 
1909
void wxScintilla::ShowLines (int lineStart, int lineEnd)
 
1910
{
 
1911
    SendMsg(SCI_SHOWLINES, lineStart, lineEnd);
1480
1912
}
1481
1913
 
1482
1914
// Make a range of lines invisible.
1483
 
void wxScintilla::HideLines (int lineStart, int lineEnd) {
1484
 
    SendMsg (SCI_HIDELINES, lineStart, lineEnd);
 
1915
void wxScintilla::HideLines (int lineStart, int lineEnd)
 
1916
{
 
1917
    SendMsg(SCI_HIDELINES, lineStart, lineEnd);
1485
1918
}
1486
1919
 
1487
1920
// Is a line visible?
1488
 
bool wxScintilla::GetLineVisible (int line) {
1489
 
    return SendMsg (SCI_GETLINEVISIBLE, line, 0) != 0;
 
1921
bool wxScintilla::GetLineVisible (int line) const
 
1922
{
 
1923
    return SendMsg(SCI_GETLINEVISIBLE, line, 0) != 0;
1490
1924
}
1491
1925
 
1492
1926
// Show the children of a header line.
1493
 
void wxScintilla::SetFoldExpanded (int line, bool expanded) {
1494
 
    SendMsg (SCI_SETFOLDEXPANDED, line, expanded);
 
1927
void wxScintilla::SetFoldExpanded (int line, bool expanded)
 
1928
{
 
1929
    SendMsg(SCI_SETFOLDEXPANDED, line, expanded);
1495
1930
}
1496
1931
 
1497
1932
// Is a header line expanded?
1498
 
bool wxScintilla::GetFoldExpanded (int line) {
1499
 
    return SendMsg (SCI_GETFOLDEXPANDED, line, 0) != 0;
 
1933
bool wxScintilla::GetFoldExpanded (int line) const
 
1934
{
 
1935
    return SendMsg(SCI_GETFOLDEXPANDED, line, 0) != 0;
1500
1936
}
1501
1937
 
1502
1938
// Switch a header line between expanded and contracted.
1503
 
void wxScintilla::ToggleFold (int line) {
1504
 
    SendMsg (SCI_TOGGLEFOLD, line, 0);
 
1939
void wxScintilla::ToggleFold (int line)
 
1940
{
 
1941
    SendMsg(SCI_TOGGLEFOLD, line, 0);
1505
1942
}
1506
1943
 
1507
1944
// Ensure a particular line is visible by expanding any header line hiding it.
1508
 
void wxScintilla::EnsureVisible (int line) {
1509
 
    SendMsg (SCI_ENSUREVISIBLE, line, 0);
 
1945
void wxScintilla::EnsureVisible (int line)
 
1946
{
 
1947
    SendMsg(SCI_ENSUREVISIBLE, line, 0);
1510
1948
}
1511
1949
 
1512
1950
// Set some style options for folding.
1513
 
void wxScintilla::SetFoldFlags (int flags) {
 
1951
void wxScintilla::SetFoldFlags (int flags)
 
1952
{
1514
1953
    SendMsg(SCI_SETFOLDFLAGS, flags, 0);
1515
1954
}
1516
1955
 
1517
1956
// Ensure a particular line is visible by expanding any header line hiding it.
1518
1957
// Use the currently set visibility policy to determine which range to display.
1519
 
void wxScintilla::EnsureVisibleEnforcePolicy (int line) {
1520
 
    SendMsg (SCI_ENSUREVISIBLEENFORCEPOLICY, line, 0);
 
1958
void wxScintilla::EnsureVisibleEnforcePolicy (int line)
 
1959
{
 
1960
    SendMsg(SCI_ENSUREVISIBLEENFORCEPOLICY, line, 0);
1521
1961
}
1522
1962
 
1523
1963
// Sets whether a tab pressed when caret is within indentation indents.
1524
 
void wxScintilla::SetTabIndents (bool tabIndents) {
1525
 
    SendMsg (SCI_SETTABINDENTS, tabIndents, 0);
 
1964
void wxScintilla::SetTabIndents (bool tabIndents)
 
1965
{
 
1966
    SendMsg(SCI_SETTABINDENTS, tabIndents, 0);
1526
1967
}
1527
1968
 
1528
1969
// Does a tab pressed when caret is within indentation indent?
1529
 
bool wxScintilla::GetTabIndents() {
1530
 
    return SendMsg (SCI_GETTABINDENTS, 0, 0) != 0;
 
1970
bool wxScintilla::GetTabIndents() const
 
1971
{
 
1972
    return SendMsg(SCI_GETTABINDENTS, 0, 0) != 0;
1531
1973
}
1532
1974
 
1533
1975
// Sets whether a backspace pressed when caret is within indentation unindents.
1534
 
void wxScintilla::SetBackSpaceUnIndents (bool bsUnIndents) {
1535
 
    SendMsg (SCI_SETBACKSPACEUNINDENTS, bsUnIndents, 0);
 
1976
void wxScintilla::SetBackSpaceUnIndents (bool bsUnIndents)
 
1977
{
 
1978
    SendMsg(SCI_SETBACKSPACEUNINDENTS, bsUnIndents, 0);
1536
1979
}
1537
1980
 
1538
1981
// Does a backspace pressed when caret is within indentation unindent?
1539
 
bool wxScintilla::GetBackSpaceUnIndents() {
1540
 
    return SendMsg (SCI_GETBACKSPACEUNINDENTS, 0, 0) != 0;
 
1982
bool wxScintilla::GetBackSpaceUnIndents() const
 
1983
{
 
1984
    return SendMsg(SCI_GETBACKSPACEUNINDENTS, 0, 0) != 0;
1541
1985
}
1542
1986
 
1543
1987
// Sets the time the mouse must sit still to generate a mouse dwell event.
1544
 
void wxScintilla::SetMouseDwellTime (int periodMilliseconds) {
1545
 
    SendMsg (SCI_SETMOUSEDWELLTIME, periodMilliseconds, 0);
 
1988
void wxScintilla::SetMouseDwellTime (int periodMilliseconds)
 
1989
{
 
1990
    SendMsg(SCI_SETMOUSEDWELLTIME, periodMilliseconds, 0);
1546
1991
}
1547
1992
 
1548
1993
// Retrieve the time the mouse must sit still to generate a mouse dwell event.
1549
 
int wxScintilla::GetMouseDwellTime() {
1550
 
    return SendMsg (SCI_GETMOUSEDWELLTIME, 0, 0);
 
1994
int wxScintilla::GetMouseDwellTime() const
 
1995
{
 
1996
    return SendMsg(SCI_GETMOUSEDWELLTIME, 0, 0);
1551
1997
}
1552
1998
 
1553
1999
// Get position of start of word.
1554
 
int wxScintilla::WordStartPosition (int pos, bool onlyWordCharacters) {
1555
 
    return SendMsg (SCI_WORDSTARTPOSITION, pos, onlyWordCharacters);
 
2000
int wxScintilla::WordStartPosition (int pos, bool onlyWordCharacters)
 
2001
{
 
2002
    return SendMsg(SCI_WORDSTARTPOSITION, pos, onlyWordCharacters);
1556
2003
}
1557
2004
 
1558
2005
// Get position of end of word.
1559
 
int wxScintilla::WordEndPosition (int pos, bool onlyWordCharacters) {
1560
 
    return SendMsg (SCI_WORDENDPOSITION, pos, onlyWordCharacters);
 
2006
int wxScintilla::WordEndPosition (int pos, bool onlyWordCharacters)
 
2007
{
 
2008
    return SendMsg(SCI_WORDENDPOSITION, pos, onlyWordCharacters);
1561
2009
}
1562
2010
 
1563
2011
// Sets whether text is word wrapped.
1564
 
void wxScintilla::SetWrapMode (int mode) {
1565
 
    SendMsg (SCI_SETWRAPMODE, mode, 0);
 
2012
void wxScintilla::SetWrapMode (int mode)
 
2013
{
 
2014
    SendMsg(SCI_SETWRAPMODE, mode, 0);
1566
2015
}
1567
2016
 
1568
2017
// Retrieve whether text is word wrapped.
1569
 
int wxScintilla::GetWrapMode() {
1570
 
    return SendMsg (SCI_GETWRAPMODE, 0, 0);
 
2018
int wxScintilla::GetWrapMode() const
 
2019
{
 
2020
    return SendMsg(SCI_GETWRAPMODE, 0, 0);
1571
2021
}
1572
2022
 
1573
2023
// Set the display mode of visual flags for wrapped lines.
1574
 
void wxScintilla::SetWrapVisualFlags (int wrapVisualFlags) {
1575
 
    SendMsg (SCI_SETWRAPVISUALFLAGS, wrapVisualFlags, 0);
 
2024
void wxScintilla::SetWrapVisualFlags (int wrapVisualFlags)
 
2025
{
 
2026
    SendMsg(SCI_SETWRAPVISUALFLAGS, wrapVisualFlags, 0);
1576
2027
}
1577
2028
 
1578
2029
// Retrive the display mode of visual flags for wrapped lines.
1579
 
int wxScintilla::GetWrapVisualFlags() {
1580
 
    return SendMsg (SCI_GETWRAPVISUALFLAGS, 0, 0);
 
2030
int wxScintilla::GetWrapVisualFlags() const
 
2031
{
 
2032
    return SendMsg(SCI_GETWRAPVISUALFLAGS, 0, 0);
1581
2033
}
1582
2034
 
1583
2035
// Set the location of visual flags for wrapped lines.
1584
 
void wxScintilla::SetWrapVisualFlagsLocation (int wrapVisualFlagsLocation) {
1585
 
    SendMsg (SCI_SETWRAPVISUALFLAGSLOCATION, wrapVisualFlagsLocation, 0);
 
2036
void wxScintilla::SetWrapVisualFlagsLocation (int wrapVisualFlagsLocation)
 
2037
{
 
2038
    SendMsg(SCI_SETWRAPVISUALFLAGSLOCATION, wrapVisualFlagsLocation, 0);
1586
2039
}
1587
2040
 
1588
2041
// Retrive the location of visual flags for wrapped lines.
1589
 
int wxScintilla::GetWrapVisualFlagsLocation() {
1590
 
    return SendMsg (SCI_GETWRAPVISUALFLAGSLOCATION, 0, 0);
 
2042
int wxScintilla::GetWrapVisualFlagsLocation() const
 
2043
{
 
2044
    return SendMsg(SCI_GETWRAPVISUALFLAGSLOCATION, 0, 0);
1591
2045
}
1592
2046
 
1593
2047
// Set the start indent for wrapped lines.
1594
 
void wxScintilla::SetWrapStartIndent (int indent) {
1595
 
    SendMsg (SCI_SETWRAPSTARTINDENT, indent, 0);
 
2048
void wxScintilla::SetWrapStartIndent (int indent)
 
2049
{
 
2050
    SendMsg(SCI_SETWRAPSTARTINDENT, indent, 0);
1596
2051
}
1597
2052
 
1598
2053
// Retrive the start indent for wrapped lines.
1599
 
int wxScintilla::GetWrapStartIndent() {
1600
 
    return SendMsg (SCI_GETWRAPSTARTINDENT, 0, 0);
 
2054
int wxScintilla::GetWrapStartIndent() const
 
2055
{
 
2056
    return SendMsg(SCI_GETWRAPSTARTINDENT, 0, 0);
 
2057
}
 
2058
 
 
2059
// Sets how wrapped sublines are placed. Default is fixed.
 
2060
void wxScintilla::SetWrapIndentMode(int mode)
 
2061
{
 
2062
    SendMsg(SCI_SETWRAPINDENTMODE, mode, 0);
 
2063
}
 
2064
 
 
2065
// Retrieve how wrapped sublines are placed. Default is fixed.
 
2066
int wxScintilla::GetWrapIndentMode() const
 
2067
{
 
2068
    return SendMsg(SCI_GETWRAPINDENTMODE, 0, 0);
1601
2069
}
1602
2070
 
1603
2071
// Sets the degree of caching of layout information.
1604
 
void wxScintilla::SetLayoutCache (int mode) {
1605
 
    SendMsg (SCI_SETLAYOUTCACHE, mode, 0);
 
2072
void wxScintilla::SetLayoutCache (int mode)
 
2073
{
 
2074
    SendMsg(SCI_SETLAYOUTCACHE, mode, 0);
1606
2075
}
1607
2076
 
1608
2077
// Retrieve the degree of caching of layout information.
1609
 
int wxScintilla::GetLayoutCache() {
1610
 
    return SendMsg (SCI_GETLAYOUTCACHE, 0, 0);
 
2078
int wxScintilla::GetLayoutCache() const
 
2079
{
 
2080
    return SendMsg(SCI_GETLAYOUTCACHE, 0, 0);
1611
2081
}
1612
2082
 
1613
2083
// Sets the document width assumed for scrolling.
1614
 
void wxScintilla::SetScrollWidth (int pixels) {
1615
 
    SendMsg (SCI_SETSCROLLWIDTH, pixels, 0);
 
2084
void wxScintilla::SetScrollWidth (int pixelWidth)
 
2085
{
 
2086
    SendMsg(SCI_SETSCROLLWIDTH, pixelWidth, 0);
1616
2087
}
1617
2088
 
1618
2089
// Retrieve the document width assumed for scrolling.
1619
 
int wxScintilla::GetScrollWidth() {
1620
 
    return SendMsg (SCI_GETSCROLLWIDTH, 0, 0);
 
2090
int wxScintilla::GetScrollWidth() const
 
2091
{
 
2092
    return SendMsg(SCI_GETSCROLLWIDTH, 0, 0);
 
2093
}
 
2094
 
 
2095
// Sets whether the maximum width line displayed is used to set scroll width.
 
2096
void wxScintilla::SetScrollWidthTracking(bool tracking)
 
2097
{
 
2098
    SendMsg(SCI_SETSCROLLWIDTHTRACKING, tracking, 0);
 
2099
}
 
2100
 
 
2101
// Retrieve whether the scroll width tracks wide lines.
 
2102
bool wxScintilla::GetScrollWidthTracking() const
 
2103
{
 
2104
    return SendMsg(SCI_GETSCROLLWIDTHTRACKING, 0, 0) != 0;
1621
2105
}
1622
2106
 
1623
2107
// Measure the pixel width of some text in a particular style.
1624
2108
// NUL terminated text argument.
1625
2109
// Does not handle tab or control characters.
1626
 
int wxScintilla::TextWidth (int style, const wxString& text) {
1627
 
    return SendMsg (SCI_TEXTWIDTH, style, (long)(const char*)wx2sci(text));
 
2110
int wxScintilla::TextWidth (int style, const wxString& text)
 
2111
{
 
2112
    return SendMsg(SCI_TEXTWIDTH, style, (sptr_t)(const char*)wx2sci(text));
1628
2113
}
1629
2114
 
1630
2115
// Sets the scroll range so that maximum scroll position has
1631
2116
// the last line at the bottom of the view (default).
1632
2117
// Setting this to false allows scrolling one page below the last line.
1633
 
void wxScintilla::SetEndAtLastLine (bool endAtLastLine) {
1634
 
    SendMsg (SCI_SETENDATLASTLINE, endAtLastLine, 0);
 
2118
void wxScintilla::SetEndAtLastLine (bool endAtLastLine)
 
2119
{
 
2120
    SendMsg(SCI_SETENDATLASTLINE, endAtLastLine, 0);
1635
2121
}
1636
2122
 
1637
2123
// Retrieve whether the maximum scroll position has the last
1638
2124
// line at the bottom of the view.
1639
 
int wxScintilla::GetEndAtLastLine() {
1640
 
    return SendMsg (SCI_GETENDATLASTLINE, 0, 0);
 
2125
bool wxScintilla::GetEndAtLastLine() const
 
2126
{
 
2127
    return SendMsg(SCI_GETENDATLASTLINE, 0, 0) != 0;
1641
2128
}
1642
2129
 
1643
2130
// Retrieve the height of a particular line of text in pixels.
1644
 
int wxScintilla::TextHeight (int line) {
1645
 
    return SendMsg (SCI_TEXTHEIGHT, line, 0);
 
2131
int wxScintilla::TextHeight (int line)
 
2132
{
 
2133
    return SendMsg(SCI_TEXTHEIGHT, line, 0);
1646
2134
}
1647
2135
 
1648
2136
// Show or hide the vertical scroll bar.
1649
 
void wxScintilla::SetUseVerticalScrollBar (bool show) {
1650
 
    SendMsg (SCI_SETVSCROLLBAR, show, 0);
 
2137
void wxScintilla::SetUseVerticalScrollBar (bool show)
 
2138
{
 
2139
    SendMsg(SCI_SETVSCROLLBAR, show, 0);
1651
2140
}
1652
2141
 
1653
2142
// Is the vertical scroll bar visible?
1654
 
bool wxScintilla::GetUseVerticalScrollBar() {
1655
 
    return SendMsg (SCI_GETVSCROLLBAR, 0, 0) != 0;
 
2143
bool wxScintilla::GetUseVerticalScrollBar() const
 
2144
{
 
2145
    return SendMsg(SCI_GETVSCROLLBAR, 0, 0) != 0;
1656
2146
}
1657
2147
 
1658
2148
// Add text to the document at current position.
1659
 
void wxScintilla::AppendText (const wxString& text) {
 
2149
void wxScintilla::AppendText (const wxString& text)
 
2150
{
1660
2151
    wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(text);
1661
 
    SendMsg (SCI_APPENDTEXT, strlen(buf), (long)(const char*)buf);
 
2152
    SendMsg(SCI_APPENDTEXT, strlen(buf), (sptr_t)(const char*)buf);
1662
2153
}
1663
2154
 
1664
2155
// Append a string to the end of the document without changing the selection.
1665
 
void wxScintilla::AppendText (int length, const wxString& text) {
1666
 
    SendMsg (SCI_APPENDTEXT, length, (long)(const char*)wx2sci(text));
 
2156
void wxScintilla::AppendText (int length, const wxString& text)
 
2157
{
 
2158
    SendMsg(SCI_APPENDTEXT, length, (sptr_t)(const char*)wx2sci(text));
1667
2159
}
1668
2160
 
1669
2161
// Is drawing done in two phases with backgrounds drawn before foregrounds?
1670
 
bool wxScintilla::GetTwoPhaseDraw() {
1671
 
    return SendMsg (SCI_GETTWOPHASEDRAW, 0, 0) != 0;
 
2162
bool wxScintilla::GetTwoPhaseDraw() const
 
2163
{
 
2164
    return SendMsg(SCI_GETTWOPHASEDRAW, 0, 0) != 0;
1672
2165
}
1673
2166
 
1674
2167
// In twoPhaseDraw mode, drawing is performed in two phases, first the background
1675
2168
// and then the foreground. This avoids chopping off characters that overlap the next run.
1676
 
void wxScintilla::SetTwoPhaseDraw (bool twoPhase) {
1677
 
    SendMsg (SCI_SETTWOPHASEDRAW, twoPhase, 0);
 
2169
void wxScintilla::SetTwoPhaseDraw (bool twoPhase)
 
2170
{
 
2171
    SendMsg(SCI_SETTWOPHASEDRAW, twoPhase, 0);
 
2172
}
 
2173
 
 
2174
// Choose the quality level for text from the FontQuality enumeration.
 
2175
void wxScintilla::SetFontQuality(int fontQuality)
 
2176
{
 
2177
    SendMsg(SCI_SETFONTQUALITY, fontQuality, 0);
 
2178
}
 
2179
 
 
2180
// Retrieve the quality level for text.
 
2181
int wxScintilla::GetFontQuality() const
 
2182
{
 
2183
    return SendMsg(SCI_GETFONTQUALITY, 0, 0);
 
2184
}
 
2185
 
 
2186
// Scroll so that a display line is at the top of the display.
 
2187
void wxScintilla::SetFirstVisibleLine(int lineDisplay)
 
2188
{
 
2189
    SendMsg(SCI_SETFIRSTVISIBLELINE, lineDisplay, 0);
1678
2190
}
1679
2191
 
1680
2192
// Make the target range start and end be the same as the selection range start and end.
1681
 
void wxScintilla::TargetFromSelection() {
1682
 
    SendMsg (SCI_TARGETFROMSELECTION, 0, 0);
 
2193
void wxScintilla::TargetFromSelection()
 
2194
{
 
2195
    SendMsg(SCI_TARGETFROMSELECTION, 0, 0);
1683
2196
}
1684
2197
 
1685
2198
// Join the lines in the target.
1686
 
void wxScintilla::LinesJoin() {
1687
 
    SendMsg (SCI_LINESJOIN, 0, 0);
 
2199
void wxScintilla::LinesJoin()
 
2200
{
 
2201
    SendMsg(SCI_LINESJOIN, 0, 0);
1688
2202
}
1689
2203
 
1690
 
// Split the lines in the target into lines that are less wide than pixel where possible.
1691
 
void wxScintilla::LinesSplit (int pixels) {
1692
 
    SendMsg (SCI_LINESSPLIT, pixels, 0);
 
2204
// Split the lines in the target into lines that are less wide than pixelWidth
 
2205
// where possible.
 
2206
void wxScintilla::LinesSplit (int pixelWidth)
 
2207
{
 
2208
    SendMsg(SCI_LINESSPLIT, pixelWidth, 0);
1693
2209
}
1694
2210
 
1695
2211
// Set the colours used as a chequerboard pattern in the fold margin
1696
 
void wxScintilla::SetFoldMarginColour (bool useSetting, const wxColour& back) {
1697
 
    SendMsg (SCI_SETFOLDMARGINCOLOUR, useSetting, wxColourAsLong(back));
 
2212
void wxScintilla::SetFoldMarginColour (bool useSetting, const wxColour& back)
 
2213
{
 
2214
    SendMsg(SCI_SETFOLDMARGINCOLOUR, useSetting, wxColourAsLong(back));
1698
2215
}
1699
 
void wxScintilla::SetFoldMarginHiColour (bool useSetting, const wxColour& fore) {
1700
 
    SendMsg (SCI_SETFOLDMARGINHICOLOUR, useSetting, wxColourAsLong(fore));
 
2216
void wxScintilla::SetFoldMarginHiColour (bool useSetting, const wxColour& fore)
 
2217
{
 
2218
    SendMsg(SCI_SETFOLDMARGINHICOLOUR, useSetting, wxColourAsLong(fore));
1701
2219
}
1702
2220
 
1703
2221
// Move caret down one line.
1704
 
void wxScintilla::LineDown() {
1705
 
    SendMsg (SCI_LINEDOWN, 0, 0);
 
2222
void wxScintilla::LineDown()
 
2223
{
 
2224
    SendMsg(SCI_LINEDOWN, 0, 0);
1706
2225
}
1707
2226
 
1708
2227
// Move caret down one line extending selection to new caret position.
1709
 
void wxScintilla::LineDownExtend() {
1710
 
    SendMsg (SCI_LINEDOWNEXTEND, 0, 0);
 
2228
void wxScintilla::LineDownExtend()
 
2229
{
 
2230
    SendMsg(SCI_LINEDOWNEXTEND, 0, 0);
1711
2231
}
1712
2232
 
1713
2233
// Move caret up one line.
1714
 
void wxScintilla::LineUp() {
1715
 
    SendMsg (SCI_LINEUP, 0, 0);
 
2234
void wxScintilla::LineUp()
 
2235
{
 
2236
    SendMsg(SCI_LINEUP, 0, 0);
1716
2237
}
1717
2238
 
1718
2239
// Move caret up one line extending selection to new caret position.
1719
 
void wxScintilla::LineUpExtend() {
1720
 
    SendMsg (SCI_LINEUPEXTEND, 0, 0);
 
2240
void wxScintilla::LineUpExtend()
 
2241
{
 
2242
    SendMsg(SCI_LINEUPEXTEND, 0, 0);
1721
2243
}
1722
2244
 
1723
2245
// Move caret left one character.
1724
 
void wxScintilla::CharLeft() {
1725
 
    SendMsg (SCI_CHARLEFT, 0, 0);
 
2246
void wxScintilla::CharLeft()
 
2247
{
 
2248
    SendMsg(SCI_CHARLEFT, 0, 0);
1726
2249
}
1727
2250
 
1728
2251
// Move caret left one character extending selection to new caret position.
1729
 
void wxScintilla::CharLeftExtend() {
1730
 
    SendMsg (SCI_CHARLEFTEXTEND, 0, 0);
 
2252
void wxScintilla::CharLeftExtend()
 
2253
{
 
2254
    SendMsg(SCI_CHARLEFTEXTEND, 0, 0);
1731
2255
}
1732
2256
 
1733
2257
// Move caret right one character.
1734
 
void wxScintilla::CharRight() {
1735
 
    SendMsg (SCI_CHARRIGHT, 0, 0);
 
2258
void wxScintilla::CharRight()
 
2259
{
 
2260
    SendMsg(SCI_CHARRIGHT, 0, 0);
1736
2261
}
1737
2262
 
1738
2263
// Move caret right one character extending selection to new caret position.
1739
 
void wxScintilla::CharRightExtend() {
1740
 
    SendMsg (SCI_CHARRIGHTEXTEND, 0, 0);
 
2264
void wxScintilla::CharRightExtend()
 
2265
{
 
2266
    SendMsg(SCI_CHARRIGHTEXTEND, 0, 0);
1741
2267
}
1742
2268
 
1743
2269
// Move caret left one word.
1744
 
void wxScintilla::WordLeft() {
1745
 
    SendMsg (SCI_WORDLEFT, 0, 0);
 
2270
void wxScintilla::WordLeft()
 
2271
{
 
2272
    SendMsg(SCI_WORDLEFT, 0, 0);
1746
2273
}
1747
2274
 
1748
2275
// Move caret left one word extending selection to new caret position.
1749
 
void wxScintilla::WordLeftExtend() {
1750
 
    SendMsg (SCI_WORDLEFTEXTEND, 0, 0);
 
2276
void wxScintilla::WordLeftExtend()
 
2277
{
 
2278
    SendMsg(SCI_WORDLEFTEXTEND, 0, 0);
1751
2279
}
1752
2280
 
1753
2281
// Move caret right one word.
1754
 
void wxScintilla::WordRight() {
1755
 
    SendMsg (SCI_WORDRIGHT, 0, 0);
 
2282
void wxScintilla::WordRight()
 
2283
{
 
2284
    SendMsg(SCI_WORDRIGHT, 0, 0);
1756
2285
}
1757
2286
 
1758
2287
// Move caret right one word extending selection to new caret position.
1759
 
void wxScintilla::WordRightExtend() {
1760
 
    SendMsg (SCI_WORDRIGHTEXTEND, 0, 0);
 
2288
void wxScintilla::WordRightExtend()
 
2289
{
 
2290
    SendMsg(SCI_WORDRIGHTEXTEND, 0, 0);
1761
2291
}
1762
2292
 
1763
2293
// Move caret to first position on line.
1764
 
void wxScintilla::Home() {
1765
 
    SendMsg (SCI_HOME, 0, 0);
 
2294
void wxScintilla::Home()
 
2295
{
 
2296
    SendMsg(SCI_HOME, 0, 0);
1766
2297
}
1767
2298
 
1768
2299
// Move caret to first position on line extending selection to new caret position.
1769
 
void wxScintilla::HomeExtend() {
1770
 
    SendMsg (SCI_HOMEEXTEND, 0, 0);
 
2300
void wxScintilla::HomeExtend()
 
2301
{
 
2302
    SendMsg(SCI_HOMEEXTEND, 0, 0);
1771
2303
}
1772
2304
 
1773
2305
// Move caret to last position on line.
1774
 
void wxScintilla::LineEnd() {
1775
 
    SendMsg (SCI_LINEEND, 0, 0);
 
2306
void wxScintilla::LineEnd()
 
2307
{
 
2308
    SendMsg(SCI_LINEEND, 0, 0);
1776
2309
}
1777
2310
 
1778
2311
// Move caret to last position on line extending selection to new caret position.
1779
 
void wxScintilla::LineEndExtend() {
1780
 
    SendMsg (SCI_LINEENDEXTEND, 0, 0);
 
2312
void wxScintilla::LineEndExtend()
 
2313
{
 
2314
    SendMsg(SCI_LINEENDEXTEND, 0, 0);
1781
2315
}
1782
2316
 
1783
2317
// Move caret to first position in document.
1784
 
void wxScintilla::DocumentStart() {
1785
 
    SendMsg (SCI_DOCUMENTSTART, 0, 0);
 
2318
void wxScintilla::DocumentStart()
 
2319
{
 
2320
    SendMsg(SCI_DOCUMENTSTART, 0, 0);
1786
2321
}
1787
2322
 
1788
2323
// Move caret to first position in document extending selection to new caret position.
1789
 
void wxScintilla::DocumentStartExtend() {
1790
 
    SendMsg (SCI_DOCUMENTSTARTEXTEND, 0, 0);
 
2324
void wxScintilla::DocumentStartExtend()
 
2325
{
 
2326
    SendMsg(SCI_DOCUMENTSTARTEXTEND, 0, 0);
1791
2327
}
1792
2328
 
1793
2329
// Move caret to last position in document.
1794
 
void wxScintilla::DocumentEnd() {
1795
 
    SendMsg (SCI_DOCUMENTEND, 0, 0);
 
2330
void wxScintilla::DocumentEnd()
 
2331
{
 
2332
    SendMsg(SCI_DOCUMENTEND, 0, 0);
1796
2333
}
1797
2334
 
1798
2335
// Move caret to last position in document extending selection to new caret position.
1799
 
void wxScintilla::DocumentEndExtend() {
1800
 
    SendMsg (SCI_DOCUMENTENDEXTEND, 0, 0);
 
2336
void wxScintilla::DocumentEndExtend()
 
2337
{
 
2338
    SendMsg(SCI_DOCUMENTENDEXTEND, 0, 0);
1801
2339
}
1802
2340
 
1803
2341
// Move caret one page up.
1804
 
void wxScintilla::PageUp() {
1805
 
    SendMsg (SCI_PAGEUP, 0, 0);
 
2342
void wxScintilla::PageUp()
 
2343
{
 
2344
    SendMsg(SCI_PAGEUP, 0, 0);
1806
2345
}
1807
2346
 
1808
2347
// Move caret one page up extending selection to new caret position.
1809
 
void wxScintilla::PageUpExtend() {
1810
 
    SendMsg (SCI_PAGEUPEXTEND, 0, 0);
 
2348
void wxScintilla::PageUpExtend()
 
2349
{
 
2350
    SendMsg(SCI_PAGEUPEXTEND, 0, 0);
1811
2351
}
1812
2352
 
1813
2353
// Move caret one page down.
1814
 
void wxScintilla::PageDown() {
1815
 
    SendMsg (SCI_PAGEDOWN, 0, 0);
 
2354
void wxScintilla::PageDown()
 
2355
{
 
2356
    SendMsg(SCI_PAGEDOWN, 0, 0);
1816
2357
}
1817
2358
 
1818
2359
// Move caret one page down extending selection to new caret position.
1819
 
void wxScintilla::PageDownExtend() {
1820
 
    SendMsg (SCI_PAGEDOWNEXTEND, 0, 0);
 
2360
void wxScintilla::PageDownExtend()
 
2361
{
 
2362
    SendMsg(SCI_PAGEDOWNEXTEND, 0, 0);
1821
2363
}
1822
2364
 
1823
2365
// Switch from insert to overtype mode or the reverse.
1824
 
void wxScintilla::EditToggleOvertype() {
1825
 
    SendMsg (SCI_EDITTOGGLEOVERTYPE, 0, 0);
 
2366
void wxScintilla::EditToggleOvertype()
 
2367
{
 
2368
    SendMsg(SCI_EDITTOGGLEOVERTYPE, 0, 0);
1826
2369
}
1827
2370
 
1828
2371
// Cancel any modes such as call tip or auto-completion list display.
1829
 
void wxScintilla::Cancel() {
1830
 
    SendMsg (SCI_CANCEL, 0, 0);
 
2372
void wxScintilla::Cancel()
 
2373
{
 
2374
    SendMsg(SCI_CANCEL, 0, 0);
1831
2375
}
1832
2376
 
1833
2377
// Delete the selection or if no selection, the character before the caret.
1834
 
void wxScintilla::DeleteBack() {
1835
 
    SendMsg (SCI_DELETEBACK, 0, 0);
 
2378
void wxScintilla::DeleteBack()
 
2379
{
 
2380
    SendMsg(SCI_DELETEBACK, 0, 0);
1836
2381
}
1837
2382
 
1838
2383
// If selection is empty or all on one line replace the selection with a tab character.
1839
2384
// If more than one line selected, indent the lines.
1840
 
void wxScintilla::Tab() {
1841
 
    SendMsg (SCI_TAB, 0, 0);
 
2385
void wxScintilla::Tab()
 
2386
{
 
2387
    SendMsg(SCI_TAB, 0, 0);
1842
2388
}
1843
2389
 
1844
2390
// Dedent the selected lines.
1845
 
void wxScintilla::BackTab() {
1846
 
    SendMsg (SCI_BACKTAB, 0, 0);
 
2391
void wxScintilla::BackTab()
 
2392
{
 
2393
    SendMsg(SCI_BACKTAB, 0, 0);
1847
2394
}
1848
2395
 
1849
2396
// Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
1850
 
void wxScintilla::NewLine() {
1851
 
    SendMsg (SCI_NEWLINE, 0, 0);
 
2397
void wxScintilla::NewLine()
 
2398
{
 
2399
    SendMsg(SCI_NEWLINE, 0, 0);
1852
2400
}
1853
2401
 
1854
2402
// Insert a Form Feed character.
1855
 
void wxScintilla::FormFeed() {
1856
 
    SendMsg (SCI_FORMFEED, 0, 0);
 
2403
void wxScintilla::FormFeed()
 
2404
{
 
2405
    SendMsg(SCI_FORMFEED, 0, 0);
1857
2406
}
1858
2407
 
1859
2408
// Move caret to before first visible character on line.
1860
2409
// If already there move to first character on line.
1861
 
void wxScintilla::VCHome() {
1862
 
    SendMsg (SCI_VCHOME, 0, 0);
 
2410
void wxScintilla::VCHome()
 
2411
{
 
2412
    SendMsg(SCI_VCHOME, 0, 0);
1863
2413
}
1864
2414
 
1865
2415
// Like VCHome but extending selection to new caret position.
1866
 
void wxScintilla::VCHomeExtend() {
1867
 
    SendMsg (SCI_VCHOMEEXTEND, 0, 0);
 
2416
void wxScintilla::VCHomeExtend()
 
2417
{
 
2418
    SendMsg(SCI_VCHOMEEXTEND, 0, 0);
1868
2419
}
1869
2420
 
1870
2421
// Magnify the displayed text by increasing the sizes by 1 point.
1871
 
void wxScintilla::ZoomIn() {
1872
 
    SendMsg (SCI_ZOOMIN, 0, 0);
 
2422
void wxScintilla::ZoomIn()
 
2423
{
 
2424
    SendMsg(SCI_ZOOMIN, 0, 0);
1873
2425
}
1874
2426
 
1875
2427
// Make the displayed text smaller by decreasing the sizes by 1 point.
1876
 
void wxScintilla::ZoomOut() {
1877
 
    SendMsg (SCI_ZOOMOUT, 0, 0);
 
2428
void wxScintilla::ZoomOut()
 
2429
{
 
2430
    SendMsg(SCI_ZOOMOUT, 0, 0);
1878
2431
}
1879
2432
 
1880
2433
// Delete the word to the left of the caret.
1881
 
void wxScintilla::DelWordLeft() {
1882
 
    SendMsg (SCI_DELWORDLEFT, 0, 0);
 
2434
void wxScintilla::DelWordLeft()
 
2435
{
 
2436
    SendMsg(SCI_DELWORDLEFT, 0, 0);
1883
2437
}
1884
2438
 
1885
2439
// Delete the word to the right of the caret.
1886
 
void wxScintilla::DelWordRight() {
1887
 
    SendMsg (SCI_DELWORDRIGHT, 0, 0);
 
2440
void wxScintilla::DelWordRight()
 
2441
{
 
2442
    SendMsg(SCI_DELWORDRIGHT, 0, 0);
 
2443
}
 
2444
 
 
2445
// Delete the word to the right of the caret, but not the trailing non-word characters.
 
2446
void wxScintilla::DelWordRightEnd()
 
2447
{
 
2448
    SendMsg(SCI_DELWORDRIGHTEND, 0, 0);
1888
2449
}
1889
2450
 
1890
2451
// Cut the line containing the caret.
1891
 
void wxScintilla::LineCut() {
1892
 
    SendMsg (SCI_LINECUT, 0, 0);
 
2452
void wxScintilla::LineCut()
 
2453
{
 
2454
    SendMsg(SCI_LINECUT, 0, 0);
1893
2455
}
1894
2456
 
1895
2457
// Delete the line containing the caret.
1896
 
void wxScintilla::LineDelete() {
1897
 
    SendMsg (SCI_LINEDELETE, 0, 0);
 
2458
void wxScintilla::LineDelete()
 
2459
{
 
2460
    SendMsg(SCI_LINEDELETE, 0, 0);
1898
2461
}
1899
2462
 
1900
2463
// Switch the current line with the previous.
1901
 
void wxScintilla::LineTranspose() {
1902
 
    SendMsg (SCI_LINETRANSPOSE, 0, 0);
 
2464
void wxScintilla::LineTranspose()
 
2465
{
 
2466
    SendMsg(SCI_LINETRANSPOSE, 0, 0);
1903
2467
}
1904
2468
 
1905
2469
// Duplicate the current line.
1906
 
void wxScintilla::LineDuplicate() {
1907
 
    SendMsg (SCI_LINEDUPLICATE, 0, 0);
 
2470
void wxScintilla::LineDuplicate()
 
2471
{
 
2472
    SendMsg(SCI_LINEDUPLICATE, 0, 0);
1908
2473
}
1909
2474
 
1910
2475
// Transform the selection to lower case.
1911
 
void wxScintilla::LowerCase() {
1912
 
    SendMsg (SCI_LOWERCASE, 0, 0);
 
2476
void wxScintilla::LowerCase()
 
2477
{
 
2478
    SendMsg(SCI_LOWERCASE, 0, 0);
1913
2479
}
1914
2480
 
1915
2481
// Transform the selection to upper case.
1916
 
void wxScintilla::UpperCase() {
1917
 
    SendMsg (SCI_UPPERCASE, 0, 0);
 
2482
void wxScintilla::UpperCase()
 
2483
{
 
2484
    SendMsg(SCI_UPPERCASE, 0, 0);
1918
2485
}
1919
2486
 
1920
2487
// Scroll the document down, keeping the caret visible.
1921
 
void wxScintilla::LineScrollDown() {
1922
 
    SendMsg (SCI_LINESCROLLDOWN, 0, 0);
 
2488
void wxScintilla::LineScrollDown()
 
2489
{
 
2490
    SendMsg(SCI_LINESCROLLDOWN, 0, 0);
1923
2491
}
1924
2492
 
1925
2493
// Scroll the document up, keeping the caret visible.
1926
 
void wxScintilla::LineScrollUp() {
1927
 
    SendMsg (SCI_LINESCROLLUP, 0, 0);
 
2494
void wxScintilla::LineScrollUp()
 
2495
{
 
2496
    SendMsg(SCI_LINESCROLLUP, 0, 0);
1928
2497
}
1929
2498
 
1930
2499
// Delete the selection or if no selection, the character before the caret.
1931
2500
// Will not delete the character before at the start of a line.
1932
 
void wxScintilla::DeleteBackNotLine() {
1933
 
    SendMsg (SCI_DELETEBACKNOTLINE, 0, 0);
 
2501
void wxScintilla::DeleteBackNotLine()
 
2502
{
 
2503
    SendMsg(SCI_DELETEBACKNOTLINE, 0, 0);
1934
2504
}
1935
2505
 
1936
2506
// Move caret to first position on display line.
1937
 
void wxScintilla::HomeDisplay() {
1938
 
    SendMsg (SCI_HOMEDISPLAY, 0, 0);
 
2507
void wxScintilla::HomeDisplay()
 
2508
{
 
2509
    SendMsg(SCI_HOMEDISPLAY, 0, 0);
1939
2510
}
1940
2511
 
1941
2512
// Move caret to first position on display line extending selection to
1942
2513
// new caret position.
1943
 
void wxScintilla::HomeDisplayExtend() {
1944
 
    SendMsg (SCI_HOMEDISPLAYEXTEND, 0, 0);
 
2514
void wxScintilla::HomeDisplayExtend()
 
2515
{
 
2516
    SendMsg(SCI_HOMEDISPLAYEXTEND, 0, 0);
1945
2517
}
1946
2518
 
1947
2519
// Move caret to last position on display line.
1948
 
void wxScintilla::LineEndDisplay() {
1949
 
    SendMsg (SCI_LINEENDDISPLAY, 0, 0);
 
2520
void wxScintilla::LineEndDisplay()
 
2521
{
 
2522
    SendMsg(SCI_LINEENDDISPLAY, 0, 0);
1950
2523
}
1951
2524
 
1952
2525
// Move caret to last position on display line extending selection to new
1953
2526
// caret position.
1954
 
void wxScintilla::LineEndDisplayExtend() {
1955
 
    SendMsg (SCI_LINEENDDISPLAYEXTEND, 0, 0);
 
2527
void wxScintilla::LineEndDisplayExtend()
 
2528
{
 
2529
    SendMsg(SCI_LINEENDDISPLAYEXTEND, 0, 0);
1956
2530
}
1957
2531
 
1958
2532
// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
1960
2534
// They go first to the start / end of the display line, like (Home|LineEnd)Display
1961
2535
// The difference is that, the cursor is already at the point, it goes on to the start
1962
2536
// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
1963
 
void wxScintilla::HomeWrap() {
1964
 
    SendMsg (SCI_HOMEWRAP, 0, 0);
1965
 
}
1966
 
void wxScintilla::HomeWrapExtend() {
1967
 
    SendMsg (SCI_HOMEWRAPEXTEND, 0, 0);
1968
 
}
1969
 
void wxScintilla::LineEndWrap() {
1970
 
    SendMsg (SCI_LINEENDWRAP, 0, 0);
1971
 
}
1972
 
void wxScintilla::LineEndWrapExtend() {
1973
 
    SendMsg (SCI_LINEENDWRAPEXTEND, 0, 0);
1974
 
}
1975
 
void wxScintilla::VCHomeWrap() {
1976
 
    SendMsg (SCI_VCHOMEWRAP, 0, 0);
1977
 
}
1978
 
void wxScintilla::VCHomeWrapExtend() {
1979
 
    SendMsg (SCI_VCHOMEWRAPEXTEND, 0, 0);
 
2537
void wxScintilla::HomeWrap()
 
2538
{
 
2539
    SendMsg(SCI_HOMEWRAP, 0, 0);
 
2540
}
 
2541
void wxScintilla::HomeWrapExtend()
 
2542
{
 
2543
    SendMsg(SCI_HOMEWRAPEXTEND, 0, 0);
 
2544
}
 
2545
void wxScintilla::LineEndWrap()
 
2546
{
 
2547
    SendMsg(SCI_LINEENDWRAP, 0, 0);
 
2548
}
 
2549
void wxScintilla::LineEndWrapExtend()
 
2550
{
 
2551
    SendMsg(SCI_LINEENDWRAPEXTEND, 0, 0);
 
2552
}
 
2553
void wxScintilla::VCHomeWrap()
 
2554
{
 
2555
    SendMsg(SCI_VCHOMEWRAP, 0, 0);
 
2556
}
 
2557
void wxScintilla::VCHomeWrapExtend()
 
2558
{
 
2559
    SendMsg(SCI_VCHOMEWRAPEXTEND, 0, 0);
1980
2560
}
1981
2561
 
1982
2562
// Copy the line containing the caret.
1983
 
void wxScintilla::LineCopy() {
1984
 
    SendMsg (SCI_LINECOPY, 0, 0);
 
2563
void wxScintilla::LineCopy()
 
2564
{
 
2565
    SendMsg(SCI_LINECOPY, 0, 0);
1985
2566
}
1986
2567
 
1987
2568
// Move the caret inside current view if it's not there already.
1988
 
void wxScintilla::MoveCaretInsideView() {
1989
 
    SendMsg (SCI_MOVECARETINSIDEVIEW, 0, 0);
 
2569
void wxScintilla::MoveCaretInsideView()
 
2570
{
 
2571
    SendMsg(SCI_MOVECARETINSIDEVIEW, 0, 0);
1990
2572
}
1991
2573
 
1992
 
// How many characters are on a line, not including end of line characters?
1993
 
int wxScintilla::LineLength (int line) {
1994
 
    return SendMsg (SCI_LINELENGTH, line, 0);
 
2574
// How many characters are on a line, including end of line characters?
 
2575
int wxScintilla::LineLength (int line) const
 
2576
{
 
2577
    return SendMsg(SCI_LINELENGTH, line, 0);
1995
2578
}
1996
2579
 
1997
2580
// Highlight the characters at two positions.
1998
 
void wxScintilla::BraceHighlight (int pos1, int pos2) {
1999
 
    SendMsg (SCI_BRACEHIGHLIGHT, pos1, pos2);
 
2581
void wxScintilla::BraceHighlight (int pos1, int pos2)
 
2582
{
 
2583
    SendMsg(SCI_BRACEHIGHLIGHT, pos1, pos2);
2000
2584
}
2001
2585
 
2002
2586
// Highlight the character at a position indicating there is no matching brace.
2003
 
void wxScintilla::BraceBadLight (int pos) {
2004
 
    SendMsg (SCI_BRACEBADLIGHT, pos, 0);
 
2587
void wxScintilla::BraceBadLight (int pos)
 
2588
{
 
2589
    SendMsg(SCI_BRACEBADLIGHT, pos, 0);
2005
2590
}
2006
2591
 
2007
2592
// Find the position of a matching brace or INVALID_POSITION if no match.
2008
 
int wxScintilla::BraceMatch (int pos) {
2009
 
    return SendMsg (SCI_BRACEMATCH, pos, 0);
 
2593
int wxScintilla::BraceMatch (int pos)
 
2594
{
 
2595
    return SendMsg(SCI_BRACEMATCH, pos, 0);
2010
2596
}
2011
2597
 
2012
2598
// Are the end of line characters visible?
2013
 
bool wxScintilla::GetViewEOL() {
2014
 
    return SendMsg (SCI_GETVIEWEOL, 0, 0) != 0;
 
2599
bool wxScintilla::GetViewEOL() const
 
2600
{
 
2601
    return SendMsg(SCI_GETVIEWEOL, 0, 0) != 0;
2015
2602
}
2016
2603
 
2017
2604
// Make the end of line characters visible or invisible.
2018
 
void wxScintilla::SetViewEOL (bool visible) {
2019
 
    SendMsg (SCI_SETVIEWEOL, visible, 0);
 
2605
void wxScintilla::SetViewEOL (bool visible)
 
2606
{
 
2607
    SendMsg(SCI_SETVIEWEOL, visible, 0);
2020
2608
}
2021
2609
 
2022
2610
// Retrieve a pointer to the document object.
2023
 
void* wxScintilla::GetDocPointer() {
2024
 
    return (void*)SendMsg (SCI_GETDOCPOINTER);
 
2611
void* wxScintilla::GetDocPointer()
 
2612
{
 
2613
    return (void*)SendMsg(SCI_GETDOCPOINTER);
2025
2614
}
2026
2615
 
2027
2616
// Change the document object used.
2028
 
void wxScintilla::SetDocPointer (void* docPointer) {
2029
 
    SendMsg (SCI_SETDOCPOINTER, 0, (long)docPointer);
 
2617
void wxScintilla::SetDocPointer (void* docPointer)
 
2618
{
 
2619
    SendMsg(SCI_SETDOCPOINTER, 0, (sptr_t)docPointer);
2030
2620
}
2031
2621
 
2032
2622
// Set which document modification events are sent to the container.
2033
 
void wxScintilla::SetModEventMask (int mask) {
2034
 
    SendMsg (SCI_SETMODEVENTMASK, mask, 0);
 
2623
void wxScintilla::SetModEventMask (int mask)
 
2624
{
 
2625
    SendMsg(SCI_SETMODEVENTMASK, mask, 0);
2035
2626
}
2036
2627
 
2037
2628
// Retrieve the column number which text should be kept within.
2038
 
int wxScintilla::GetEdgeColumn() {
2039
 
    return SendMsg (SCI_GETEDGECOLUMN, 0, 0);
 
2629
int wxScintilla::GetEdgeColumn() const
 
2630
{
 
2631
    return SendMsg(SCI_GETEDGECOLUMN, 0, 0);
2040
2632
}
2041
2633
 
2042
2634
// Set the column number of the edge.
2043
2635
// If text goes past the edge then it is highlighted.
2044
 
void wxScintilla::SetEdgeColumn (int column) {
2045
 
    SendMsg (SCI_SETEDGECOLUMN, column, 0);
 
2636
void wxScintilla::SetEdgeColumn (int column)
 
2637
{
 
2638
    SendMsg(SCI_SETEDGECOLUMN, column, 0);
2046
2639
}
2047
2640
 
2048
2641
// Retrieve the edge highlight mode.
2049
 
int wxScintilla::GetEdgeMode() {
2050
 
    return SendMsg (SCI_GETEDGEMODE, 0, 0);
 
2642
int wxScintilla::GetEdgeMode() const
 
2643
{
 
2644
    return SendMsg(SCI_GETEDGEMODE, 0, 0);
2051
2645
}
2052
2646
 
2053
2647
// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2054
2648
// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2055
 
void wxScintilla::SetEdgeMode (int mode) {
2056
 
    SendMsg (SCI_SETEDGEMODE, mode, 0);
 
2649
void wxScintilla::SetEdgeMode (int mode)
 
2650
{
 
2651
    SendMsg(SCI_SETEDGEMODE, mode, 0);
2057
2652
}
2058
2653
 
2059
2654
// Retrieve the colour used in edge indication.
2060
 
wxColour wxScintilla::GetEdgeColour() {
2061
 
    long colour = SendMsg (SCI_GETEDGECOLOUR, 0, 0);
 
2655
wxColour wxScintilla::GetEdgeColour() const
 
2656
{
 
2657
    long colour = SendMsg(SCI_GETEDGECOLOUR, 0, 0);
2062
2658
    return wxColourFromLong(colour);
2063
2659
}
2064
2660
 
2065
2661
// Change the colour used in edge indication.
2066
 
void wxScintilla::SetEdgeColour (const wxColour& colour) {
2067
 
    SendMsg (SCI_SETEDGECOLOUR, wxColourAsLong(colour), 0);
 
2662
void wxScintilla::SetEdgeColour (const wxColour& edgeColour)
 
2663
{
 
2664
    SendMsg(SCI_SETEDGECOLOUR, wxColourAsLong(edgeColour), 0);
2068
2665
}
2069
2666
 
2070
2667
// Sets the current caret position to be the search anchor.
2071
 
void wxScintilla::SearchAnchor() {
2072
 
    SendMsg (SCI_SEARCHANCHOR, 0, 0);
 
2668
void wxScintilla::SearchAnchor()
 
2669
{
 
2670
    SendMsg(SCI_SEARCHANCHOR, 0, 0);
2073
2671
}
2074
2672
 
2075
2673
// Find some text starting at the search anchor.
2076
2674
// Does not ensure the selection is visible.
2077
 
int wxScintilla::SearchNext (int flags, const wxString& text) {
2078
 
    return SendMsg (SCI_SEARCHNEXT, flags, (long)(const char*)wx2sci(text));
 
2675
int wxScintilla::SearchNext (int flags, const wxString& text)
 
2676
{
 
2677
    return SendMsg(SCI_SEARCHNEXT, flags, (sptr_t)(const char*)wx2sci(text));
2079
2678
}
2080
2679
 
2081
2680
// Find some text starting at the search anchor and moving backwards.
2082
2681
// Does not ensure the selection is visible.
2083
 
int wxScintilla::SearchPrev (int flags, const wxString& text) {
2084
 
    return SendMsg (SCI_SEARCHPREV, flags, (long)(const char*)wx2sci(text));
 
2682
int wxScintilla::SearchPrev (int flags, const wxString& text)
 
2683
{
 
2684
    return SendMsg(SCI_SEARCHPREV, flags, (sptr_t)(const char*)wx2sci(text));
2085
2685
}
2086
2686
 
2087
2687
// Retrieves the number of lines completely visible.
2088
 
int wxScintilla::LinesOnScreen() {
2089
 
    return SendMsg (SCI_LINESONSCREEN, 0, 0);
 
2688
int wxScintilla::LinesOnScreen() const
 
2689
{
 
2690
    return SendMsg(SCI_LINESONSCREEN, 0, 0);
2090
2691
}
2091
2692
 
2092
2693
// Set whether a pop up menu is displayed automatically when the user presses
2093
2694
// the wrong mouse button.
2094
 
void wxScintilla::UsePopUp (bool allowPopUp) {
2095
 
    SendMsg (SCI_USEPOPUP, allowPopUp, 0);
 
2695
void wxScintilla::UsePopUp (bool allowPopUp)
 
2696
{
 
2697
    SendMsg(SCI_USEPOPUP, allowPopUp, 0);
2096
2698
}
2097
2699
 
2098
2700
// Is the selection rectangular? The alternative is the more common stream selection.
2099
 
bool wxScintilla::SelectionIsRectangle() {
2100
 
    return SendMsg (SCI_SELECTIONISRECTANGLE, 0, 0) != 0;
 
2701
bool wxScintilla::SelectionIsRectangle() const
 
2702
{
 
2703
    return SendMsg(SCI_SELECTIONISRECTANGLE, 0, 0) != 0;
2101
2704
}
2102
2705
 
2103
2706
// Set the zoom level. This number of points is added to the size of all fonts.
2104
2707
// It may be positive to magnify or negative to reduce.
2105
 
void wxScintilla::SetZoom (int zoom) {
2106
 
    SendMsg (SCI_SETZOOM, zoom, 0);
 
2708
void wxScintilla::SetZoom (int zoom)
 
2709
{
 
2710
    SendMsg(SCI_SETZOOM, zoom, 0);
2107
2711
}
2108
2712
 
2109
2713
// Retrieve the zoom level.
2110
 
int wxScintilla::GetZoom() {
2111
 
    return SendMsg (SCI_GETZOOM, 0, 0);
 
2714
int wxScintilla::GetZoom() const
 
2715
{
 
2716
    return SendMsg(SCI_GETZOOM, 0, 0);
2112
2717
}
2113
2718
 
2114
2719
// Create a new document object.
2115
2720
// Starts with reference count of 1 and not selected into editor.
2116
 
void* wxScintilla::CreateDocument() {
2117
 
    return (void*)SendMsg (SCI_CREATEDOCUMENT, 0, 0);
 
2721
void* wxScintilla::CreateDocument()
 
2722
{
 
2723
    return (void*)SendMsg(SCI_CREATEDOCUMENT, 0, 0);
2118
2724
}
2119
2725
 
2120
2726
// Extend life of document.
2121
 
void wxScintilla::AddRefDocument (void* docPointer) {
2122
 
    SendMsg (SCI_ADDREFDOCUMENT, 0, (long)docPointer);
 
2727
void wxScintilla::AddRefDocument (void* docPointer)
 
2728
{
 
2729
    SendMsg(SCI_ADDREFDOCUMENT, 0, (sptr_t)docPointer);
2123
2730
}
2124
2731
 
2125
2732
// Release a reference to the document, deleting document if it fades to black.
2126
 
void wxScintilla::ReleaseDocument (void* docPointer) {
2127
 
    SendMsg (SCI_RELEASEDOCUMENT, 0, (long)docPointer);
 
2733
void wxScintilla::ReleaseDocument (void* docPointer)
 
2734
{
 
2735
    SendMsg(SCI_RELEASEDOCUMENT, 0, (sptr_t)docPointer);
2128
2736
}
2129
2737
 
2130
2738
// Get which document modification events are sent to the container.
2131
 
int wxScintilla::GetModEventMask() {
2132
 
    return SendMsg (SCI_GETMODEVENTMASK, 0, 0);
 
2739
int wxScintilla::GetModEventMask() const
 
2740
{
 
2741
    return SendMsg(SCI_GETMODEVENTMASK, 0, 0);
2133
2742
}
2134
2743
 
2135
2744
// Change internal focus flag.
2136
 
void wxScintilla::SetSCIFocus (bool focus) {
2137
 
    SendMsg (SCI_SETFOCUS, focus, 0);
 
2745
void wxScintilla::SetSCIFocus (bool focus)
 
2746
{
 
2747
    SendMsg(SCI_SETFOCUS, focus, 0);
2138
2748
}
2139
2749
 
2140
2750
// Get internal focus flag.
2141
 
bool wxScintilla::GetSCIFocus() {
2142
 
    return SendMsg (SCI_GETFOCUS, 0, 0) != 0;
 
2751
bool wxScintilla::GetSCIFocus() const
 
2752
{
 
2753
    return SendMsg(SCI_GETFOCUS, 0, 0) != 0;
2143
2754
}
2144
2755
 
2145
2756
// Change error status - 0 = OK.
2146
 
void wxScintilla::SetStatus (int status) {
2147
 
    SendMsg (SCI_SETSTATUS, status, 0);
 
2757
void wxScintilla::SetStatus (int statusCode)
 
2758
{
 
2759
    SendMsg(SCI_SETSTATUS, statusCode, 0);
2148
2760
}
2149
2761
 
2150
2762
// Get error status.
2151
 
int wxScintilla::GetStatus() {
2152
 
    return SendMsg (SCI_GETSTATUS, 0, 0);
 
2763
int wxScintilla::GetStatus() const
 
2764
{
 
2765
    return SendMsg(SCI_GETSTATUS, 0, 0);
2153
2766
}
2154
2767
 
2155
2768
// Set whether the mouse is captured when its button is pressed.
2156
 
void wxScintilla::SetMouseDownCaptures (bool captures) {
2157
 
    SendMsg (SCI_SETMOUSEDOWNCAPTURES, captures, 0);
 
2769
void wxScintilla::SetMouseDownCaptures (bool captures)
 
2770
{
 
2771
    SendMsg(SCI_SETMOUSEDOWNCAPTURES, captures, 0);
2158
2772
}
2159
2773
 
2160
2774
// Get whether mouse gets captured.
2161
 
bool wxScintilla::GetMouseDownCaptures() {
2162
 
    return SendMsg (SCI_GETMOUSEDOWNCAPTURES, 0, 0) != 0;
 
2775
bool wxScintilla::GetMouseDownCaptures() const
 
2776
{
 
2777
    return SendMsg(SCI_GETMOUSEDOWNCAPTURES, 0, 0) != 0;
2163
2778
}
2164
2779
 
2165
2780
// Sets the cursor to one of the SC_CURSOR* values.
2166
 
void wxScintilla::SetCursorType (int cursorType) {
 
2781
void wxScintilla::SetSCICursor (int cursorType)
 
2782
{
2167
2783
    SendMsg(SCI_SETCURSOR, cursorType, 0);
2168
2784
}
2169
2785
 
2170
2786
// Get cursor type.
2171
 
int wxScintilla::GetCursorType() {
2172
 
    return SendMsg (SCI_GETCURSOR, 0, 0);
 
2787
int wxScintilla::GetSCICursor() const
 
2788
{
 
2789
    return SendMsg(SCI_GETCURSOR, 0, 0);
2173
2790
}
2174
2791
 
2175
2792
// Change the way control characters are displayed:
2176
2793
// If symbol is < 32, keep the drawn way, else, use the given character.
2177
 
void wxScintilla::SetControlCharSymbol (int symbol) {
2178
 
    SendMsg (SCI_SETCONTROLCHARSYMBOL, symbol, 0);
 
2794
void wxScintilla::SetControlCharSymbol (int symbol)
 
2795
{
 
2796
    SendMsg(SCI_SETCONTROLCHARSYMBOL, symbol, 0);
2179
2797
}
2180
2798
 
2181
2799
// Get the way control characters are displayed.
2182
 
int wxScintilla::GetControlCharSymbol() {
2183
 
    return SendMsg (SCI_GETCONTROLCHARSYMBOL, 0, 0);
 
2800
int wxScintilla::GetControlCharSymbol() const
 
2801
{
 
2802
    return SendMsg(SCI_GETCONTROLCHARSYMBOL, 0, 0);
2184
2803
}
2185
2804
 
2186
2805
// Move to the previous change in capitalisation.
2187
 
void wxScintilla::WordPartLeft() {
2188
 
    SendMsg (SCI_WORDPARTLEFT, 0, 0);
 
2806
void wxScintilla::WordPartLeft()
 
2807
{
 
2808
    SendMsg(SCI_WORDPARTLEFT, 0, 0);
2189
2809
}
2190
2810
 
2191
2811
// Move to the previous change in capitalisation extending selection
2192
2812
// to new caret position.
2193
 
void wxScintilla::WordPartLeftExtend() {
2194
 
    SendMsg (SCI_WORDPARTLEFTEXTEND, 0, 0);
 
2813
void wxScintilla::WordPartLeftExtend()
 
2814
{
 
2815
    SendMsg(SCI_WORDPARTLEFTEXTEND, 0, 0);
2195
2816
}
2196
2817
 
2197
2818
// Move to the change next in capitalisation.
2198
 
void wxScintilla::WordPartRight() {
2199
 
    SendMsg (SCI_WORDPARTRIGHT, 0, 0);
 
2819
void wxScintilla::WordPartRight()
 
2820
{
 
2821
    SendMsg(SCI_WORDPARTRIGHT, 0, 0);
2200
2822
}
2201
2823
 
2202
2824
// Move to the next change in capitalisation extending selection
2203
2825
// to new caret position.
2204
 
void wxScintilla::WordPartRightExtend() {
2205
 
    SendMsg (SCI_WORDPARTRIGHTEXTEND, 0, 0);
 
2826
void wxScintilla::WordPartRightExtend()
 
2827
{
 
2828
    SendMsg(SCI_WORDPARTRIGHTEXTEND, 0, 0);
2206
2829
}
2207
2830
 
2208
2831
// Set the way the display area is determined when a particular line
2209
2832
// is to be moved to by Find, FindNext, GotoLine, etc.
2210
 
void wxScintilla::SetVisiblePolicy (int visiblePolicy, int visibleSlop) {
2211
 
    SendMsg (SCI_SETVISIBLEPOLICY, visiblePolicy, visibleSlop);
 
2833
void wxScintilla::SetVisiblePolicy (int visiblePolicy, int visibleSlop)
 
2834
{
 
2835
    SendMsg(SCI_SETVISIBLEPOLICY, visiblePolicy, visibleSlop);
2212
2836
}
2213
2837
 
2214
2838
// Delete back from the current position to the start of the line.
2215
 
void wxScintilla::DelLineLeft() {
2216
 
    SendMsg (SCI_DELLINELEFT, 0, 0);
 
2839
void wxScintilla::DelLineLeft()
 
2840
{
 
2841
    SendMsg(SCI_DELLINELEFT, 0, 0);
2217
2842
}
2218
2843
 
2219
2844
// Delete forwards from the current position to the end of the line.
2220
 
void wxScintilla::DelLineRight() {
2221
 
    SendMsg (SCI_DELLINERIGHT, 0, 0);
 
2845
void wxScintilla::DelLineRight()
 
2846
{
 
2847
    SendMsg(SCI_DELLINERIGHT, 0, 0);
2222
2848
}
2223
2849
 
2224
2850
// Get and Set the xOffset (ie, horizonal scroll position).
2225
 
void wxScintilla::SetXOffset (int newOffset) {
2226
 
    SendMsg (SCI_SETXOFFSET, newOffset, 0);
 
2851
void wxScintilla::SetXOffset (int newOffset)
 
2852
{
 
2853
    SendMsg(SCI_SETXOFFSET, newOffset, 0);
2227
2854
}
2228
 
int wxScintilla::GetXOffset() {
2229
 
    return SendMsg (SCI_GETXOFFSET, 0, 0);
 
2855
int wxScintilla::GetXOffset() const
 
2856
{
 
2857
    return SendMsg(SCI_GETXOFFSET, 0, 0);
2230
2858
}
2231
2859
 
2232
2860
// Set the last x chosen value to be the caret x position.
2233
 
void wxScintilla::ChooseCaretX() {
2234
 
    SendMsg (SCI_CHOOSECARETX, 0, 0);
 
2861
void wxScintilla::ChooseCaretX()
 
2862
{
 
2863
    SendMsg(SCI_CHOOSECARETX, 0, 0);
2235
2864
}
2236
2865
 
 
2866
// Set the focus to this Scintilla widget (GTK+ specific)
2237
2867
// Grab focus (SCI_GRABFOCUS) not supported
2238
2868
 
2239
2869
// Set the way the caret is kept visible when going sideway.
2240
2870
// The exclusion zone is given in pixels.
2241
 
void wxScintilla::SetXCaretPolicy (int caretPolicy, int caretSlop) {
2242
 
    SendMsg (SCI_SETXCARETPOLICY, caretPolicy, caretSlop);
 
2871
void wxScintilla::SetXCaretPolicy (int caretPolicy, int caretSlop)
 
2872
{
 
2873
    SendMsg(SCI_SETXCARETPOLICY, caretPolicy, caretSlop);
2243
2874
}
2244
2875
 
2245
2876
// Set the way the line the caret is on is kept visible.
2246
2877
// The exclusion zone is given in lines.
2247
 
void wxScintilla::SetYCaretPolicy (int caretPolicy, int caretSlop) {
2248
 
    SendMsg (SCI_SETYCARETPOLICY, caretPolicy, caretSlop);
 
2878
void wxScintilla::SetYCaretPolicy (int caretPolicy, int caretSlop)
 
2879
{
 
2880
    SendMsg(SCI_SETYCARETPOLICY, caretPolicy, caretSlop);
2249
2881
}
2250
2882
 
2251
2883
// Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2252
 
void wxScintilla::SetPrintWrapMode (int mode) {
2253
 
    SendMsg (SCI_SETPRINTWRAPMODE, mode, 0);
 
2884
void wxScintilla::SetPrintWrapMode (int mode)
 
2885
{
 
2886
    SendMsg(SCI_SETPRINTWRAPMODE, mode, 0);
2254
2887
}
2255
2888
 
2256
2889
// Is printing line wrapped?
2257
 
int wxScintilla::GetPrintWrapMode() {
2258
 
    return SendMsg (SCI_GETPRINTWRAPMODE, 0, 0);
 
2890
int wxScintilla::GetPrintWrapMode() const
 
2891
{
 
2892
    return SendMsg(SCI_GETPRINTWRAPMODE, 0, 0);
2259
2893
}
2260
2894
 
2261
2895
// Set a fore colour for active hotspots.
2262
 
void wxScintilla::SetHotspotActiveForeground (bool useSetting, const wxColour& fore) {
2263
 
    SendMsg (SCI_SETHOTSPOTACTIVEFORE, useSetting, wxColourAsLong(fore));
 
2896
void wxScintilla::SetHotspotActiveForeground (bool useSetting, const wxColour& fore)
 
2897
{
 
2898
    SendMsg(SCI_SETHOTSPOTACTIVEFORE, useSetting, wxColourAsLong(fore));
 
2899
}
 
2900
 
 
2901
// Get the fore colour for active hotspots.
 
2902
wxColour wxScintilla::GetHotspotActiveForeground() const
 
2903
{
 
2904
    long c = SendMsg(SCI_GETHOTSPOTACTIVEFORE, 0, 0);
 
2905
    return wxColourFromLong(c);
2264
2906
}
2265
2907
 
2266
2908
// Set a back colour for active hotspots.
2267
 
void wxScintilla::SetHotspotActiveBackground (bool useSetting, const wxColour& back) {
2268
 
    SendMsg (SCI_SETHOTSPOTACTIVEBACK, useSetting, wxColourAsLong(back));
 
2909
void wxScintilla::SetHotspotActiveBackground (bool useSetting, const wxColour& back)
 
2910
{
 
2911
    SendMsg(SCI_SETHOTSPOTACTIVEBACK, useSetting, wxColourAsLong(back));
 
2912
}
 
2913
 
 
2914
// Get the back colour for active hotspots.
 
2915
wxColour wxScintilla::GetHotspotActiveBackground() const
 
2916
{
 
2917
    long c = SendMsg(SCI_GETHOTSPOTACTIVEBACK, 0, 0);
 
2918
    return wxColourFromLong(c);
2269
2919
}
2270
2920
 
2271
2921
// Enable / Disable underlining active hotspots.
2272
 
void wxScintilla::SetHotspotActiveUnderline (bool underline) {
2273
 
    SendMsg (SCI_SETHOTSPOTACTIVEUNDERLINE, underline, 0);
 
2922
void wxScintilla::SetHotspotActiveUnderline (bool underline)
 
2923
{
 
2924
    SendMsg(SCI_SETHOTSPOTACTIVEUNDERLINE, underline, 0);
 
2925
}
 
2926
 
 
2927
// Get whether underlining for active hotspots.
 
2928
bool wxScintilla::GetHotspotActiveUnderline() const
 
2929
{
 
2930
    return SendMsg(SCI_GETHOTSPOTACTIVEUNDERLINE, 0, 0) != 0;
2274
2931
}
2275
2932
 
2276
2933
// Limit hotspots to single line so hotspots on two lines don't merge.
2277
 
void wxScintilla::SetHotspotSingleLine (bool singleLine) {
 
2934
void wxScintilla::SetHotspotSingleLine (bool singleLine)
 
2935
{
2278
2936
    SendMsg(SCI_SETHOTSPOTSINGLELINE, singleLine, 0);
2279
2937
}
2280
2938
 
 
2939
// Get the HotspotSingleLine property
 
2940
bool wxScintilla::GetHotspotSingleLine() const
 
2941
{
 
2942
    return SendMsg(SCI_GETHOTSPOTSINGLELINE, 0, 0) != 0;
 
2943
}
 
2944
 
2281
2945
// Move caret between paragraphs (delimited by empty lines).
2282
 
void wxScintilla::ParaDown() {
2283
 
    SendMsg (SCI_PARADOWN, 0, 0);
2284
 
}
2285
 
void wxScintilla::ParaDownExtend() {
2286
 
    SendMsg (SCI_PARADOWNEXTEND, 0, 0);
2287
 
}
2288
 
void wxScintilla::ParaUp() {
2289
 
    SendMsg (SCI_PARAUP, 0, 0);
2290
 
}
2291
 
void wxScintilla::ParaUpExtend() {
2292
 
    SendMsg (SCI_PARAUPEXTEND, 0, 0);
 
2946
void wxScintilla::ParaDown()
 
2947
{
 
2948
    SendMsg(SCI_PARADOWN, 0, 0);
 
2949
}
 
2950
void wxScintilla::ParaDownExtend()
 
2951
{
 
2952
    SendMsg(SCI_PARADOWNEXTEND, 0, 0);
 
2953
}
 
2954
void wxScintilla::ParaUp()
 
2955
{
 
2956
    SendMsg(SCI_PARAUP, 0, 0);
 
2957
}
 
2958
void wxScintilla::ParaUpExtend()
 
2959
{
 
2960
    SendMsg(SCI_PARAUPEXTEND, 0, 0);
2293
2961
}
2294
2962
 
2295
2963
// Given a valid document position, return the previous position taking code
2296
2964
// page into account. Returns 0 if passed 0.
2297
 
int wxScintilla::PositionBefore (int pos) {
2298
 
    return SendMsg (SCI_POSITIONBEFORE, pos, 0);
 
2965
int wxScintilla::PositionBefore (int pos)
 
2966
{
 
2967
    return SendMsg(SCI_POSITIONBEFORE, pos, 0);
2299
2968
}
2300
2969
 
2301
2970
// Given a valid document position, return the next position taking code
2302
2971
// page into account. Maximum value returned is the last position in the document.
2303
 
int wxScintilla::PositionAfter (int pos) {
2304
 
    return SendMsg (SCI_POSITIONAFTER, pos, 0);
 
2972
int wxScintilla::PositionAfter (int pos)
 
2973
{
 
2974
    return SendMsg(SCI_POSITIONAFTER, pos, 0);
2305
2975
}
2306
2976
 
2307
2977
// Copy a range of text to the clipboard. Positions are clipped into the document.
2308
 
void wxScintilla::CopyRange (int startPos, int endPos) {
2309
 
    SendMsg (SCI_COPYRANGE, startPos, endPos);
 
2978
void wxScintilla::CopyRange (int start, int end)
 
2979
{
 
2980
    SendMsg(SCI_COPYRANGE, start, end);
2310
2981
}
2311
2982
 
2312
2983
// Copy argument text to the clipboard.
2313
 
void wxScintilla::CopyText (int length, const wxString& text) {
2314
 
    SendMsg (SCI_COPYTEXT, length, (long)(const char*)wx2sci(text));
 
2984
void wxScintilla::CopyText (int length, const wxString& text)
 
2985
{
 
2986
    SendMsg(SCI_COPYTEXT, length, (sptr_t)(const char*)wx2sci(text));
2315
2987
}
2316
2988
 
2317
 
// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or
 
2989
// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
2318
2990
// by lines (SC_SEL_LINES).
2319
 
void wxScintilla::SetSelectionMode (int mode) {
2320
 
    SendMsg (SCI_SETSELECTIONMODE, mode, 0);
 
2991
void wxScintilla::SetSelectionMode (int mode)
 
2992
{
 
2993
    SendMsg(SCI_SETSELECTIONMODE, mode, 0);
2321
2994
}
2322
2995
 
2323
2996
// Get the mode of the current selection.
2324
 
int wxScintilla::GetSelectionMode() {
2325
 
    return SendMsg (SCI_GETSELECTIONMODE, 0, 0);
 
2997
int wxScintilla::GetSelectionMode() const
 
2998
{
 
2999
    return SendMsg(SCI_GETSELECTIONMODE, 0, 0);
2326
3000
}
2327
3001
 
2328
3002
// Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
2329
 
int wxScintilla::GetLineSelStartPosition (int line) {
2330
 
    return SendMsg (SCI_GETLINESELSTARTPOSITION, line, 0);
 
3003
int wxScintilla::GetLineSelStartPosition (int line)
 
3004
{
 
3005
    return SendMsg(SCI_GETLINESELSTARTPOSITION, line, 0);
2331
3006
}
2332
3007
 
2333
3008
// Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
2334
 
int wxScintilla::GetLineSelEndPosition (int line) {
2335
 
    return SendMsg (SCI_GETLINESELENDPOSITION, line, 0);
 
3009
int wxScintilla::GetLineSelEndPosition (int line)
 
3010
{
 
3011
    return SendMsg(SCI_GETLINESELENDPOSITION, line, 0);
2336
3012
}
2337
3013
 
2338
3014
// Move caret down one line, extending rectangular selection to new caret position.
2339
 
void wxScintilla::LineDownRectExtend() {
2340
 
    SendMsg (SCI_LINEDOWNRECTEXTEND, 0, 0);
 
3015
void wxScintilla::LineDownRectExtend()
 
3016
{
 
3017
    SendMsg(SCI_LINEDOWNRECTEXTEND, 0, 0);
2341
3018
}
2342
3019
 
2343
3020
// Move caret up one line, extending rectangular selection to new caret position.
2344
 
void wxScintilla::LineUpRectExtend() {
2345
 
    SendMsg (SCI_LINEUPRECTEXTEND, 0, 0);
 
3021
void wxScintilla::LineUpRectExtend()
 
3022
{
 
3023
    SendMsg(SCI_LINEUPRECTEXTEND, 0, 0);
2346
3024
}
2347
3025
 
2348
3026
// Move caret left one character, extending rectangular selection to new caret position.
2349
 
void wxScintilla::CharLeftRectExtend() {
2350
 
    SendMsg (SCI_CHARLEFTRECTEXTEND, 0, 0);
 
3027
void wxScintilla::CharLeftRectExtend()
 
3028
{
 
3029
    SendMsg(SCI_CHARLEFTRECTEXTEND, 0, 0);
2351
3030
}
2352
3031
 
2353
3032
// Move caret right one character, extending rectangular selection to new caret position.
2354
 
void wxScintilla::CharRightRectExtend() {
2355
 
    SendMsg (SCI_CHARRIGHTRECTEXTEND, 0, 0);
 
3033
void wxScintilla::CharRightRectExtend()
 
3034
{
 
3035
    SendMsg(SCI_CHARRIGHTRECTEXTEND, 0, 0);
2356
3036
}
2357
3037
 
2358
3038
// Move caret to first position on line, extending rectangular selection to new caret position.
2359
 
void wxScintilla::HomeRectExtend() {
2360
 
    SendMsg (SCI_HOMERECTEXTEND, 0, 0);
 
3039
void wxScintilla::HomeRectExtend()
 
3040
{
 
3041
    SendMsg(SCI_HOMERECTEXTEND, 0, 0);
2361
3042
}
2362
3043
 
2363
3044
// Move caret to before first visible character on line.
2364
3045
// If already there move to first character on line.
2365
3046
// In either case, extend rectangular selection to new caret position.
2366
 
void wxScintilla::VCHomeRectExtend() {
2367
 
    SendMsg (SCI_VCHOMERECTEXTEND, 0, 0);
 
3047
void wxScintilla::VCHomeRectExtend()
 
3048
{
 
3049
    SendMsg(SCI_VCHOMERECTEXTEND, 0, 0);
2368
3050
}
2369
3051
 
2370
3052
// Move caret to last position on line, extending rectangular selection to new caret position.
2371
 
void wxScintilla::LineEndRectExtend() {
2372
 
    SendMsg (SCI_LINEENDRECTEXTEND, 0, 0);
 
3053
void wxScintilla::LineEndRectExtend()
 
3054
{
 
3055
    SendMsg(SCI_LINEENDRECTEXTEND, 0, 0);
2373
3056
}
2374
3057
 
2375
3058
// Move caret one page up, extending rectangular selection to new caret position.
2376
 
void wxScintilla::PageUpRectExtend() {
2377
 
    SendMsg (SCI_PAGEUPRECTEXTEND, 0, 0);
 
3059
void wxScintilla::PageUpRectExtend()
 
3060
{
 
3061
    SendMsg(SCI_PAGEUPRECTEXTEND, 0, 0);
2378
3062
}
2379
3063
 
2380
3064
// Move caret one page down, extending rectangular selection to new caret position.
2381
 
void wxScintilla::PageDownRectExtend() {
2382
 
    SendMsg (SCI_PAGEDOWNRECTEXTEND, 0, 0);
 
3065
void wxScintilla::PageDownRectExtend()
 
3066
{
 
3067
    SendMsg(SCI_PAGEDOWNRECTEXTEND, 0, 0);
2383
3068
}
2384
3069
 
2385
3070
// Move caret to top of page, or one page up if already at top of page.
2386
 
void wxScintilla::StutteredPageUp() {
2387
 
    SendMsg (SCI_STUTTEREDPAGEUP, 0, 0);
 
3071
void wxScintilla::StutteredPageUp()
 
3072
{
 
3073
    SendMsg(SCI_STUTTEREDPAGEUP, 0, 0);
2388
3074
}
2389
3075
 
2390
3076
// Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
2391
 
void wxScintilla::StutteredPageUpExtend() {
2392
 
    SendMsg (SCI_STUTTEREDPAGEUPEXTEND, 0, 0);
 
3077
void wxScintilla::StutteredPageUpExtend()
 
3078
{
 
3079
    SendMsg(SCI_STUTTEREDPAGEUPEXTEND, 0, 0);
2393
3080
}
2394
3081
 
2395
3082
// Move caret to bottom of page, or one page down if already at bottom of page.
2396
 
void wxScintilla::StutteredPageDown() {
2397
 
    SendMsg (SCI_STUTTEREDPAGEDOWN, 0, 0);
 
3083
void wxScintilla::StutteredPageDown()
 
3084
{
 
3085
    SendMsg(SCI_STUTTEREDPAGEDOWN, 0, 0);
2398
3086
}
2399
3087
 
2400
3088
// Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
2401
 
void wxScintilla::StutteredPageDownExtend() {
2402
 
    SendMsg (SCI_STUTTEREDPAGEDOWNEXTEND, 0, 0);
 
3089
void wxScintilla::StutteredPageDownExtend()
 
3090
{
 
3091
    SendMsg(SCI_STUTTEREDPAGEDOWNEXTEND, 0, 0);
2403
3092
}
2404
3093
 
2405
3094
// Move caret left one word, position cursor at end of word.
2406
 
void wxScintilla::WordLeftEnd() {
2407
 
    SendMsg (SCI_WORDLEFTEND, 0, 0);
 
3095
void wxScintilla::WordLeftEnd()
 
3096
{
 
3097
    SendMsg(SCI_WORDLEFTEND, 0, 0);
2408
3098
}
2409
3099
 
2410
3100
// Move caret left one word, position cursor at end of word, extending selection to new caret position.
2411
 
void wxScintilla::WordLeftEndExtend() {
2412
 
    SendMsg (SCI_WORDLEFTENDEXTEND, 0, 0);
 
3101
void wxScintilla::WordLeftEndExtend()
 
3102
{
 
3103
    SendMsg(SCI_WORDLEFTENDEXTEND, 0, 0);
2413
3104
}
2414
3105
 
2415
3106
// Move caret right one word, position cursor at end of word.
2416
 
void wxScintilla::WordRightEnd() {
2417
 
    SendMsg (SCI_WORDRIGHTEND, 0, 0);
 
3107
void wxScintilla::WordRightEnd()
 
3108
{
 
3109
    SendMsg(SCI_WORDRIGHTEND, 0, 0);
2418
3110
}
2419
3111
 
2420
3112
// Move caret right one word, position cursor at end of word, extending selection to new caret position.
2421
 
void wxScintilla::WordRightEndExtend() {
2422
 
    SendMsg (SCI_WORDRIGHTENDEXTEND, 0, 0);
 
3113
void wxScintilla::WordRightEndExtend()
 
3114
{
 
3115
    SendMsg(SCI_WORDRIGHTENDEXTEND, 0, 0);
2423
3116
}
2424
3117
 
2425
3118
// Set the set of characters making up whitespace for when moving or selecting by word.
2426
3119
// Should be called after SetWordChars.
2427
 
void wxScintilla::SetWhitespaceChars (const wxString& characters) {
2428
 
    SendMsg (SCI_SETWHITESPACECHARS, 0, (long)(const char*)wx2sci(characters));
 
3120
void wxScintilla::SetWhitespaceChars (const wxString& characters)
 
3121
{
 
3122
    SendMsg(SCI_SETWHITESPACECHARS, 0, (sptr_t)(const char*)wx2sci(characters));
2429
3123
}
2430
3124
 
2431
3125
// Reset the set of characters for whitespace and word characters to the defaults.
2432
 
void wxScintilla::SetCharsDefault() {
2433
 
    SendMsg (SCI_SETCHARSDEFAULT, 0, 0);
 
3126
void wxScintilla::SetCharsDefault()
 
3127
{
 
3128
    SendMsg(SCI_SETCHARSDEFAULT, 0, 0);
2434
3129
}
2435
3130
 
2436
3131
// Get currently selected item position in the auto-completion list
2437
 
int wxScintilla::AutoCompGetCurrent() {
2438
 
    return SendMsg (SCI_AUTOCGETCURRENT, 0, 0);
 
3132
int wxScintilla::AutoCompGetCurrent()
 
3133
{
 
3134
    return SendMsg(SCI_AUTOCGETCURRENT, 0, 0);
 
3135
}
 
3136
 
 
3137
// Get currently selected item text in the auto-completion list
 
3138
// Returns the length of the item text
 
3139
wxString wxScintilla::AutoCGetCurrentText()
 
3140
{
 
3141
    int len (0);
 
3142
 
 
3143
    // determine the selected text range
 
3144
    len = SendMsg(SCI_AUTOCGETCURRENTTEXT, 0, 0);
 
3145
    if (!len) return wxEmptyString;
 
3146
 
 
3147
    wxMemoryBuffer mbuf(len+2);
 
3148
    char* buf = (char*)mbuf.GetWriteBuf(len+1);
 
3149
    SendMsg(SCI_AUTOCGETCURRENTTEXT, 0, (sptr_t)buf);
 
3150
    mbuf.UngetWriteBuf(len);
 
3151
    mbuf.AppendByte(0);
 
3152
    return sci2wx(buf);
2439
3153
}
2440
3154
 
2441
3155
// Enlarge the document to a particular size of text bytes.
2442
 
void wxScintilla::Allocate (int bytes) {
2443
 
    SendMsg (SCI_ALLOCATE, bytes, 0);
 
3156
void wxScintilla::Allocate (int bytes)
 
3157
{
 
3158
    SendMsg(SCI_ALLOCATE, bytes, 0);
2444
3159
}
2445
3160
 
2446
3161
// Target as UTF8 (SCI_TARGETASUTF8) not supported
2449
3164
 
2450
3165
// Set endoce from UTF8 (SCI_ENCODEDFROMUTF8) not supported
2451
3166
 
2452
 
// Returns the position of a column on a line taking the width of tabs into account.
2453
 
int wxScintilla::FindColumn (int line, int column) {
2454
 
    return SendMsg (SCI_ENCODEDFROMUTF8, line, column);
 
3167
// Find the position of a column on a line taking into account tabs and
 
3168
// multi-byte characters. If beyond end of line, return line end position.
 
3169
int wxScintilla::FindColumn (int line, int column)
 
3170
{
 
3171
    return SendMsg(SCI_ENCODEDFROMUTF8, line, column);
2455
3172
}
2456
3173
 
2457
3174
// Can the caret preferred x position only be changed by explicit movement commands?
2458
 
bool wxScintilla::GetCaretSticky () {
2459
 
    return SendMsg (SCI_GETCARETSTICKY, 0, 0) != 0;
 
3175
bool wxScintilla::GetCaretSticky () const
 
3176
{
 
3177
    return SendMsg(SCI_GETCARETSTICKY, 0, 0) != 0;
2460
3178
}
2461
3179
 
2462
3180
// Stop the caret preferred x position changing when the user types.
2463
 
void wxScintilla::SetCaretSticky (bool useCaretStickyBehaviour) {
2464
 
    SendMsg (SCI_SETCARETSTICKY, useCaretStickyBehaviour, 0);
 
3181
void wxScintilla::SetCaretSticky (bool useCaretStickyBehaviour)
 
3182
{
 
3183
    SendMsg(SCI_SETCARETSTICKY, useCaretStickyBehaviour, 0);
2465
3184
}
2466
3185
 
2467
3186
// Switch between sticky and non-sticky: meant to be bound to a key.
2468
 
void wxScintilla::ToggleCaretSticky () {
2469
 
    SendMsg (SCI_TOGGLECARETSTICKY, 0, 0);
2470
 
}
2471
 
 
2472
 
// Enable/Disable convert-on-paste for line endings.
2473
 
void wxScintilla::SetPasteConvertEndings (bool convert) {
2474
 
    SendMsg (SCI_SETPASTECONVERTENDINGS, convert, 0);
2475
 
}
2476
 
 
2477
 
// Get convert-on-paste setting.
2478
 
bool wxScintilla::GetPasteConvertEndings () {
2479
 
    return SendMsg (SCI_GETPASTECONVERTENDINGS, 0, 0) != 0;
 
3187
void wxScintilla::ToggleCaretSticky ()
 
3188
{
 
3189
    SendMsg(SCI_TOGGLECARETSTICKY, 0, 0);
 
3190
}
 
3191
 
 
3192
// Enable/Disable convert-on-paste for line endings
 
3193
void wxScintilla::SetPasteConvertEndings (bool convert)
 
3194
{
 
3195
    SendMsg(SCI_SETPASTECONVERTENDINGS, convert, 0);
 
3196
}
 
3197
 
 
3198
// Get convert-on-paste setting
 
3199
bool wxScintilla::GetPasteConvertEndings () const
 
3200
{
 
3201
    return SendMsg(SCI_GETPASTECONVERTENDINGS, 0, 0) != 0;
2480
3202
}
2481
3203
 
2482
3204
// Duplicate the selection. If selection empty duplicate the line containing the caret.
2483
 
void wxScintilla::SelectionDuplicate () {
2484
 
    SendMsg (SCI_SELECTIONDUPLICATE, 0, 0);
2485
 
}
 
3205
void wxScintilla::SelectionDuplicate ()
 
3206
{
 
3207
    SendMsg(SCI_SELECTIONDUPLICATE, 0, 0);
 
3208
}
 
3209
 
 
3210
// Set background alpha of the caret line.
 
3211
void wxScintilla::SetCaretLineBackAlpha(int alpha)
 
3212
{
 
3213
    SendMsg(SCI_SETCARETLINEBACKALPHA, alpha, 0);
 
3214
}
 
3215
 
 
3216
// Get the background alpha of the caret line.
 
3217
int wxScintilla::GetCaretLineBackAlpha () const
 
3218
{
 
3219
    return SendMsg(SCI_GETCARETLINEBACKALPHA, 0, 0);
 
3220
}
 
3221
 
 
3222
// Set the style of the caret to be drawn.
 
3223
void wxScintilla::SetCaretStyle(int caretStyle)
 
3224
{
 
3225
    SendMsg(SCI_SETCARETSTYLE, caretStyle, 0);
 
3226
}
 
3227
 
 
3228
// Returns the current style of the caret.
 
3229
int wxScintilla::GetCaretStyle() const
 
3230
{
 
3231
    return SendMsg(SCI_GETCARETSTYLE, 0, 0);
 
3232
}
 
3233
 
 
3234
// Set the indicator used for IndicatorFillRange and IndicatorClearRange
 
3235
void wxScintilla::SetIndicatorCurrent(int indicator)
 
3236
{
 
3237
    SendMsg(SCI_SETINDICATORCURRENT, indicator, 0);
 
3238
}
 
3239
 
 
3240
// Get the current indicator
 
3241
int wxScintilla::GetIndicatorCurrent() const
 
3242
{
 
3243
    return SendMsg(SCI_GETINDICATORCURRENT, 0, 0);
 
3244
}
 
3245
 
 
3246
// Set the value used for IndicatorFillRange
 
3247
void wxScintilla::SetIndicatorValue(int value)
 
3248
{
 
3249
    SendMsg(SCI_SETINDICATORVALUE, value, 0);
 
3250
}
 
3251
 
 
3252
// Get the current indicator vaue
 
3253
int wxScintilla::GetIndicatorValue() const
 
3254
{
 
3255
    return SendMsg(SCI_GETINDICATORVALUE, 0, 0);
 
3256
}
 
3257
 
 
3258
// Turn a indicator on over a range.
 
3259
void wxScintilla::IndicatorFillRange(int position, int fillLength)
 
3260
{
 
3261
    SendMsg(SCI_INDICATORFILLRANGE, position, fillLength);
 
3262
}
 
3263
 
 
3264
// Turn a indicator off over a range.
 
3265
void wxScintilla::IndicatorClearRange(int position, int clearLength)
 
3266
{
 
3267
    SendMsg(SCI_INDICATORCLEARRANGE, position, clearLength);
 
3268
}
 
3269
 
 
3270
// Are any indicators present at position?
 
3271
int wxScintilla::IndicatorAllOnFor(int position)
 
3272
{
 
3273
    return SendMsg(SCI_INDICATORALLONFOR, position, 0);
 
3274
}
 
3275
 
 
3276
// What value does a particular indicator have at at a position?
 
3277
int wxScintilla::IndicatorValueAt(int indicator, int position)
 
3278
{
 
3279
    return SendMsg(SCI_INDICATORVALUEAT, indicator, position);
 
3280
}
 
3281
 
 
3282
// Where does a particular indicator start?
 
3283
int wxScintilla::IndicatorStart(int indicator, int position)
 
3284
{
 
3285
    return SendMsg(SCI_INDICATORSTART, indicator, position);
 
3286
}
 
3287
 
 
3288
// Where does a particular indicator end?
 
3289
int wxScintilla::IndicatorEnd(int indicator, int position)
 
3290
{
 
3291
    return SendMsg(SCI_INDICATOREND, indicator, position);
 
3292
}
 
3293
 
 
3294
// Set number of entries in position cache
 
3295
void wxScintilla::SetPositionCacheSize(int size)
 
3296
{
 
3297
    SendMsg(SCI_SETPOSITIONCACHE, size, 0);
 
3298
}
 
3299
 
 
3300
// How many entries are allocated to the position cache?
 
3301
int wxScintilla::GetPositionCacheSize() const
 
3302
{
 
3303
    return SendMsg(SCI_GETPOSITIONCACHE, 0, 0);
 
3304
}
 
3305
 
 
3306
// Copy the selection, if selection empty copy the line with the caret
 
3307
void wxScintilla::CopyAllowLine()
 
3308
{
 
3309
    SendMsg(SCI_COPYALLOWLINE, 0, 0);
 
3310
}
 
3311
 
 
3312
// Compact the document buffer and return a read-only pointer to the
 
3313
// characters in the document.
 
3314
// defined later as wxUIntPtr wxScintilla::GetCharacterPointer() const;
 
3315
/*
 
3316
int wxScintilla::GetCharacterPointer() const
 
3317
{
 
3318
    return SendMsg(SCI_GETCHARACTERPOINTER, 0, 0);
 
3319
}
 
3320
*/
 
3321
 
 
3322
// Always interpret keyboard input as Unicode
 
3323
void wxScintilla::SetKeysUnicode(bool keysUnicode)
 
3324
{
 
3325
    SendMsg(SCI_SETKEYSUNICODE, keysUnicode, 0);
 
3326
}
 
3327
 
 
3328
// Are keys always interpreted as Unicode?
 
3329
bool wxScintilla::GetKeysUnicode() const
 
3330
{
 
3331
    return SendMsg(SCI_GETKEYSUNICODE, 0, 0) != 0;
 
3332
}
 
3333
 
 
3334
// Set the alpha fill colour of the given indicator.
 
3335
void wxScintilla::IndicSetAlpha(int indicator, int alpha)
 
3336
{
 
3337
    SendMsg(SCI_INDICSETALPHA, indicator, alpha);
 
3338
}
 
3339
 
 
3340
// Get the alpha fill colour of the given indicator.
 
3341
int wxScintilla::IndicGetAlpha(int indicator) const
 
3342
{
 
3343
    return SendMsg(SCI_INDICGETALPHA, indicator, 0);
 
3344
}
 
3345
 
 
3346
// Set extra ascent for each line
 
3347
void wxScintilla::SetExtraAscent(int extraAscent)
 
3348
{
 
3349
    SendMsg(SCI_SETEXTRAASCENT, extraAscent, 0);
 
3350
}
 
3351
 
 
3352
// Get extra ascent for each line
 
3353
int wxScintilla::GetExtraAscent() const
 
3354
{
 
3355
    return SendMsg(SCI_GETEXTRAASCENT, 0, 0);
 
3356
}
 
3357
 
 
3358
// Set extra descent for each line
 
3359
void wxScintilla::SetExtraDescent(int extraDescent)
 
3360
{
 
3361
    SendMsg(SCI_SETEXTRADESCENT, extraDescent, 0);
 
3362
}
 
3363
 
 
3364
// Get extra descent for each line
 
3365
int wxScintilla::GetExtraDescent() const
 
3366
{
 
3367
    return SendMsg(SCI_GETEXTRADESCENT, 0, 0);
 
3368
}
 
3369
 
 
3370
// Which symbol was defined for markerNumber with MarkerDefine
 
3371
int wxScintilla::MarkerSymbolDefined(int markerNumber)
 
3372
{
 
3373
    return SendMsg(SCI_MARKERSYMBOLDEFINED, markerNumber, 0);
 
3374
}
 
3375
 
 
3376
// Set the text in the text margin for a line
 
3377
void wxScintilla::MarginSetText(int line, const wxString& text)
 
3378
{
 
3379
    SendMsg(SCI_MARGINSETTEXT, line, (sptr_t)(const char*)wx2sci(text));
 
3380
}
 
3381
 
 
3382
// Get the text in the text margin for a line
 
3383
wxString wxScintilla::MarginGetText(int line) const
 
3384
{
 
3385
    int len = LineLength(line);
 
3386
    if (!len) return wxEmptyString;
 
3387
 
 
3388
    wxMemoryBuffer mbuf(len+1);
 
3389
    char* buf = (char*)mbuf.GetWriteBuf(len+1);
 
3390
    SendMsg(SCI_MARGINGETTEXT, (sptr_t)buf);
 
3391
    mbuf.UngetWriteBuf(len);
 
3392
    mbuf.AppendByte(0);
 
3393
    return sci2wx(buf);
 
3394
}
 
3395
 
 
3396
// Set the style number for the text margin for a line
 
3397
void wxScintilla::MarginSetStyle(int line, int style)
 
3398
{
 
3399
    SendMsg(SCI_MARGINSETSTYLE, line, style);
 
3400
}
 
3401
 
 
3402
// Get the style number for the text margin for a line
 
3403
int wxScintilla::MarginGetStyle(int line) const
 
3404
{
 
3405
    return SendMsg(SCI_MARGINGETSTYLE, line, 0);
 
3406
}
 
3407
 
 
3408
// Set the style in the text margin for a line
 
3409
void wxScintilla::MarginSetStyles(int line, const wxString& styles)
 
3410
{
 
3411
    SendMsg(SCI_MARGINSETSTYLES, line, (sptr_t)(const char*)wx2sci(styles));
 
3412
}
 
3413
 
 
3414
// Get the styles in the text margin for a line
 
3415
wxString wxScintilla::MarginGetStyles(int line) const
 
3416
{
 
3417
    int len = LineLength(line);
 
3418
    if (!len) return wxEmptyString;
 
3419
 
 
3420
    wxMemoryBuffer mbuf(len+1);
 
3421
    char* buf = (char*)mbuf.GetWriteBuf(len+1);
 
3422
    SendMsg(SCI_MARGINGETSTYLES, (sptr_t)buf);
 
3423
    mbuf.UngetWriteBuf(len);
 
3424
    mbuf.AppendByte(0);
 
3425
    return sci2wx(buf);
 
3426
}
 
3427
 
 
3428
// Clear the margin text on all lines
 
3429
void wxScintilla::MarginTextClearAll()
 
3430
{
 
3431
    SendMsg(SCI_MARGINTEXTCLEARALL, 0, 0);
 
3432
}
 
3433
 
 
3434
// Get the start of the range of style numbers used for margin text
 
3435
void wxScintilla::MarginSetStyleOffset(int style)
 
3436
{
 
3437
    SendMsg(SCI_MARGINSETSTYLEOFFSET, style, 0);
 
3438
}
 
3439
 
 
3440
// Get the start of the range of style numbers used for margin text
 
3441
int wxScintilla::MarginGetStyleOffset() const
 
3442
{
 
3443
    return SendMsg(SCI_MARGINGETSTYLEOFFSET, 0, 0);
 
3444
}
 
3445
 
 
3446
// Set the annotation text for a line
 
3447
void wxScintilla::AnnotationSetText(int line, const wxString& text)
 
3448
{
 
3449
    SendMsg(SCI_ANNOTATIONSETTEXT, line, (sptr_t)(const char*)wx2sci(text));
 
3450
}
 
3451
 
 
3452
// Get the annotation text for a line
 
3453
wxString wxScintilla::AnnotationGetText(int line) const
 
3454
{
 
3455
    int len = LineLength(line);
 
3456
    if (!len) return wxEmptyString;
 
3457
 
 
3458
    wxMemoryBuffer mbuf(len+1);
 
3459
    char* buf = (char*)mbuf.GetWriteBuf(len+1);
 
3460
    SendMsg(SCI_ANNOTATIONGETTEXT, (sptr_t)buf);
 
3461
    mbuf.UngetWriteBuf(len);
 
3462
    mbuf.AppendByte(0);
 
3463
    return sci2wx(buf);
 
3464
}
 
3465
 
 
3466
// Set the style number for the annotations for a line
 
3467
void wxScintilla::AnnotationSetStyle(int line, int style)
 
3468
{
 
3469
    SendMsg(SCI_ANNOTATIONSETSTYLE, line, style);
 
3470
}
 
3471
 
 
3472
// Get the style number for the annotations for a line
 
3473
int wxScintilla::AnnotationGetStyle(int line) const
 
3474
{
 
3475
    return SendMsg(SCI_ANNOTATIONGETSTYLE, line, 0);
 
3476
}
 
3477
 
 
3478
// Set the annotation styles for a line
 
3479
void wxScintilla::AnnotationSetStyles(int line, const wxString& styles)
 
3480
{
 
3481
    SendMsg(SCI_ANNOTATIONSETSTYLES, line, (sptr_t)(const char*)wx2sci(styles));
 
3482
}
 
3483
 
 
3484
// Get the annotation styles for a line
 
3485
wxString wxScintilla::AnnotationGetStyles(int line) const
 
3486
{
 
3487
    int len = LineLength(line);
 
3488
    if (!len) return wxEmptyString;
 
3489
 
 
3490
    wxMemoryBuffer mbuf(len+1);
 
3491
    char* buf = (char*)mbuf.GetWriteBuf(len+1);
 
3492
    SendMsg(SCI_ANNOTATIONGETSTYLES, (sptr_t)buf);
 
3493
    mbuf.UngetWriteBuf(len);
 
3494
    mbuf.AppendByte(0);
 
3495
    return sci2wx(buf);
 
3496
}
 
3497
 
 
3498
// Get the number of annotation lines for a line
 
3499
int wxScintilla::AnnotationGetLines(int line) const
 
3500
{
 
3501
    return SendMsg(SCI_ANNOTATIONGETLINES, line, 0);
 
3502
}
 
3503
 
 
3504
// Clear the annotations from all lines
 
3505
void wxScintilla::AnnotationClearAll()
 
3506
{
 
3507
    SendMsg(SCI_ANNOTATIONCLEARALL, 0, 0);
 
3508
}
 
3509
 
 
3510
// Set the visibility for the annotations for a view
 
3511
void wxScintilla::AnnotationSetVisible(int visible)
 
3512
{
 
3513
    SendMsg(SCI_ANNOTATIONSETVISIBLE, visible, 0);
 
3514
}
 
3515
 
 
3516
// Get the visibility for the annotations for a view
 
3517
int wxScintilla::AnnotationGetVisible() const
 
3518
{
 
3519
    return SendMsg(SCI_ANNOTATIONGETVISIBLE, 0, 0);
 
3520
}
 
3521
 
 
3522
// Get the start of the range of style numbers used for annotations
 
3523
void wxScintilla::AnnotationSetStyleOffset(int style)
 
3524
{
 
3525
    SendMsg(SCI_ANNOTATIONSETSTYLEOFFSET, style, 0);
 
3526
}
 
3527
 
 
3528
// Get the start of the range of style numbers used for annotations
 
3529
int wxScintilla::AnnotationGetStyleOffset() const
 
3530
{
 
3531
    return SendMsg(SCI_ANNOTATIONGETSTYLEOFFSET, 0, 0);
 
3532
}
 
3533
 
 
3534
// Add a container action to the undo stack
 
3535
void wxScintilla::AddUndoAction(int token, int flags)
 
3536
{
 
3537
    SendMsg(SCI_ADDUNDOACTION, token, flags);
 
3538
}
 
3539
 
 
3540
// Find the position of a character from a point within the window.
 
3541
int wxScintilla::CharPositionFromPoint(int x, int y)
 
3542
{
 
3543
    return SendMsg(SCI_CHARPOSITIONFROMPOINT, x, y);
 
3544
}
 
3545
 
 
3546
// Find the position of a character from a point within the window.
 
3547
// Return INVALID_POSITION if not close to text.
 
3548
int wxScintilla::CharPositionFromPointClose(int x, int y)
 
3549
{
 
3550
    return SendMsg(SCI_CHARPOSITIONFROMPOINTCLOSE, x, y);
 
3551
}
 
3552
 
 
3553
// Set whether multiple selections can be made
 
3554
void wxScintilla::SetMultipleSelection(bool multipleSelection)
 
3555
{
 
3556
    SendMsg(SCI_SETMULTIPLESELECTION, multipleSelection, 0);
 
3557
}
 
3558
 
 
3559
// Whether multiple selections can be made
 
3560
bool wxScintilla::GetMultipleSelection() const
 
3561
{
 
3562
    return SendMsg(SCI_GETMULTIPLESELECTION, 0, 0) != 0;
 
3563
}
 
3564
 
 
3565
// Set whether typing can be performed into multiple selections
 
3566
void wxScintilla::SetAdditionalSelectionTyping(bool additionalSelectionTyping)
 
3567
{
 
3568
    SendMsg(SCI_SETADDITIONALSELECTIONTYPING, additionalSelectionTyping, 0);
 
3569
}
 
3570
 
 
3571
// Whether typing can be performed into multiple selections
 
3572
bool wxScintilla::GetAdditionalSelectionTyping() const
 
3573
{
 
3574
    return SendMsg(SCI_GETADDITIONALSELECTIONTYPING, 0, 0) != 0;
 
3575
}
 
3576
 
 
3577
// Set whether additional carets will blink
 
3578
void wxScintilla::SetAdditionalCaretsBlink(bool additionalCaretsBlink)
 
3579
{
 
3580
    SendMsg(SCI_SETADDITIONALCARETSBLINK, additionalCaretsBlink, 0);
 
3581
}
 
3582
 
 
3583
// Whether additional carets will blink
 
3584
bool wxScintilla::GetAdditionalCaretsBlink() const
 
3585
{
 
3586
    return SendMsg(SCI_GETADDITIONALCARETSBLINK, 0, 0) != 0;
 
3587
}
 
3588
 
 
3589
// Set whether additional carets are visible
 
3590
void wxScintilla::SetAdditionalCaretsVisible(bool additionalCaretsBlink)
 
3591
{
 
3592
    SendMsg(SCI_SETADDITIONALCARETSVISIBLE, additionalCaretsBlink, 0);
 
3593
}
 
3594
 
 
3595
// Whether additional carets are visible
 
3596
bool wxScintilla::GetAdditionalCaretsVisible() const
 
3597
{
 
3598
    return SendMsg(SCI_GETADDITIONALCARETSVISIBLE, 0, 0) != 0;
 
3599
}
 
3600
 
 
3601
// How many selections are there?
 
3602
int wxScintilla::GetSelections() const
 
3603
{
 
3604
    return SendMsg(SCI_GETSELECTIONS, 0, 0);
 
3605
}
 
3606
 
 
3607
// Clear selections to a single empty stream selection
 
3608
void wxScintilla::ClearSelections()
 
3609
{
 
3610
    SendMsg(SCI_CLEARSELECTIONS, 0, 0);
 
3611
}
 
3612
 
 
3613
// Set a simple selection
 
3614
int wxScintilla::SetSelectionInt(int caret, int anchor)
 
3615
{
 
3616
    return SendMsg(SCI_SETSELECTION, caret, anchor);
 
3617
}
 
3618
 
 
3619
// Add a selection
 
3620
int wxScintilla::AddSelection(int caret, int anchor)
 
3621
{
 
3622
    return SendMsg(SCI_ADDSELECTION, caret, anchor);
 
3623
}
 
3624
 
 
3625
// Set the main selection
 
3626
void wxScintilla::SetMainSelection(int selection)
 
3627
{
 
3628
    SendMsg(SCI_SETMAINSELECTION, selection, 0);
 
3629
}
 
3630
 
 
3631
// Which selection is the main selection
 
3632
int wxScintilla::GetMainSelection() const
 
3633
{
 
3634
    return SendMsg(SCI_GETMAINSELECTION, 0, 0);
 
3635
}
 
3636
void wxScintilla::SetSelectionNCaret(int selection, int pos)
 
3637
{
 
3638
    SendMsg(SCI_SETSELECTIONNCARET, selection, pos);
 
3639
}
 
3640
int wxScintilla::GetSelectionNCaret(int selection) const
 
3641
{
 
3642
    return SendMsg(SCI_GETSELECTIONNCARET, selection, 0);
 
3643
}
 
3644
void wxScintilla::SetSelectionNAnchor(int selection, int posAnchor)
 
3645
{
 
3646
    SendMsg(SCI_SETSELECTIONNANCHOR, selection, posAnchor);
 
3647
}
 
3648
int wxScintilla::GetSelectionNAnchor(int selection) const
 
3649
{
 
3650
    return SendMsg(SCI_GETSELECTIONNANCHOR, selection, 0);
 
3651
}
 
3652
void wxScintilla::SetSelectionNCaretVirtualSpace(int selection, int space)
 
3653
{
 
3654
    SendMsg(SCI_SETSELECTIONNCARETVIRTUALSPACE, selection, space);
 
3655
}
 
3656
int wxScintilla::GetSelectionNCaretVirtualSpace(int selection) const
 
3657
{
 
3658
    return SendMsg(SCI_GETSELECTIONNCARETVIRTUALSPACE, selection, 0);
 
3659
}
 
3660
 
 
3661
void wxScintilla::SetSelectionNAnchorVirtualSpace(int selection, int space)
 
3662
{
 
3663
    SendMsg(SCI_SETSELECTIONNANCHORVIRTUALSPACE, selection, space);
 
3664
}
 
3665
int wxScintilla::GetSelectionNAnchorVirtualSpace(int selection) const
 
3666
{
 
3667
    return SendMsg(SCI_GETSELECTIONNANCHORVIRTUALSPACE, selection, 0);
 
3668
}
 
3669
// Sets the position that starts the selection - this becomes the anchor.
 
3670
void wxScintilla::SetSelectionNStart(int selection, int pos)
 
3671
{
 
3672
    SendMsg(SCI_SETSELECTIONNSTART, selection, pos);
 
3673
}
 
3674
 
 
3675
// Returns the position at the start of the selection.
 
3676
int wxScintilla::GetSelectionNStart(int selection) const
 
3677
{
 
3678
    return SendMsg(SCI_GETSELECTIONNSTART, selection, 0);
 
3679
}
 
3680
 
 
3681
// Sets the position that ends the selection - this becomes the currentPosition.
 
3682
void wxScintilla::SetSelectionNEnd(int selection, int pos)
 
3683
{
 
3684
    SendMsg(SCI_SETSELECTIONNEND, selection, pos);
 
3685
}
 
3686
 
 
3687
// Returns the position at the end of the selection.
 
3688
int wxScintilla::GetSelectionNEnd(int selection) const
 
3689
{
 
3690
    return SendMsg(SCI_GETSELECTIONNEND, selection, 0);
 
3691
}
 
3692
 
 
3693
void wxScintilla::SetRectangularSelectionCaret(int pos)
 
3694
{
 
3695
    SendMsg(SCI_SETRECTANGULARSELECTIONCARET, pos, 0);
 
3696
}
 
3697
 
 
3698
int wxScintilla::GetRectangularSelectionCaret() const
 
3699
{
 
3700
    return SendMsg(SCI_GETRECTANGULARSELECTIONCARET, 0, 0);
 
3701
}
 
3702
 
 
3703
void wxScintilla::SetRectangularSelectionAnchor(int posAnchor)
 
3704
{
 
3705
    SendMsg(SCI_SETRECTANGULARSELECTIONANCHOR, posAnchor, 0);
 
3706
}
 
3707
 
 
3708
int wxScintilla::GetRectangularSelectionAnchor() const
 
3709
{
 
3710
    return SendMsg(SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0);
 
3711
}
 
3712
 
 
3713
void wxScintilla::SetRectangularSelectionCaretVirtualSpace(int space)
 
3714
{
 
3715
    SendMsg(SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE, space, 0);
 
3716
}
 
3717
 
 
3718
int wxScintilla::GetRectangularSelectionCaretVirtualSpace() const
 
3719
{
 
3720
    return SendMsg(SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, 0, 0);
 
3721
}
 
3722
 
 
3723
void wxScintilla::SetRectangularSelectionAnchorVirtualSpace(int space)
 
3724
{
 
3725
    SendMsg(SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE, space, 0);
 
3726
}
 
3727
 
 
3728
int wxScintilla::GetRectangularSelectionAnchorVirtualSpace() const
 
3729
{
 
3730
    return SendMsg(SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0);
 
3731
}
 
3732
 
 
3733
void wxScintilla::SetVirtualSpaceOptions(int virtualSpaceOptions)
 
3734
{
 
3735
    SendMsg(SCI_SETVIRTUALSPACEOPTIONS, virtualSpaceOptions, 0);
 
3736
}
 
3737
 
 
3738
int wxScintilla::GetVirtualSpaceOptions() const
 
3739
{
 
3740
    return SendMsg(SCI_GETVIRTUALSPACEOPTIONS, 0, 0);
 
3741
}
 
3742
 
 
3743
// On GTK+, allow selecting the modifier key to use for mouse-based
 
3744
// rectangular selection. Often the window manager requires Alt+Mouse Drag
 
3745
// for moving windows.
 
3746
// Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
 
3747
void wxScintilla::SetRectangularSelectionModifier(int modifier)
 
3748
{
 
3749
    SendMsg(SCI_SETRECTANGULARSELECTIONMODIFIER, modifier, 0);
 
3750
}
 
3751
 
 
3752
// Get the modifier key used for rectangular selection.
 
3753
int wxScintilla::GetRectangularSelectionModifier() const
 
3754
{
 
3755
    return SendMsg(SCI_GETRECTANGULARSELECTIONMODIFIER, 0, 0);
 
3756
}
 
3757
 
 
3758
// Set the foreground colour of additional selections.
 
3759
// Must have previously called SetSelFore with non-zero first argument for this to have an effect.
 
3760
void wxScintilla::SetAdditionalSelFore(const wxColour& fore)
 
3761
{
 
3762
    SendMsg(SCI_SETADDITIONALSELFORE, wxColourAsLong(fore), 0);
 
3763
}
 
3764
 
 
3765
// Set the background colour of additional selections.
 
3766
// Must have previously called SetSelBack with non-zero first argument for this to have an effect.
 
3767
void wxScintilla::SetAdditionalSelBack(const wxColour& back)
 
3768
{
 
3769
    SendMsg(SCI_SETADDITIONALSELBACK, wxColourAsLong(back), 0);
 
3770
}
 
3771
 
 
3772
// Set the alpha of the selection.
 
3773
void wxScintilla::SetAdditionalSelAlpha(int alpha)
 
3774
{
 
3775
    SendMsg(SCI_SETADDITIONALSELALPHA, alpha, 0);
 
3776
}
 
3777
 
 
3778
// Get the alpha of the selection.
 
3779
int wxScintilla::GetAdditionalSelAlpha() const
 
3780
{
 
3781
    return SendMsg(SCI_GETADDITIONALSELALPHA, 0, 0);
 
3782
}
 
3783
 
 
3784
// Set the foreground colour of additional carets.
 
3785
void wxScintilla::SetAdditionalCaretFore(const wxColour& fore)
 
3786
{
 
3787
    SendMsg(SCI_SETADDITIONALCARETFORE, wxColourAsLong(fore), 0);
 
3788
}
 
3789
 
 
3790
// Get the foreground colour of additional carets.
 
3791
wxColour wxScintilla::GetAdditionalCaretFore() const
 
3792
{
 
3793
    long c = SendMsg(SCI_GETADDITIONALCARETFORE, 0, 0);
 
3794
    return wxColourFromLong(c);
 
3795
}
 
3796
 
 
3797
// Set the main selection to the next selection.
 
3798
void wxScintilla::RotateSelection()
 
3799
{
 
3800
    SendMsg(SCI_ROTATESELECTION, 0, 0);
 
3801
}
 
3802
 
 
3803
// Swap that caret and anchor of the main selection.
 
3804
void wxScintilla::SwapMainAnchorCaret()
 
3805
{
 
3806
    SendMsg(SCI_SWAPMAINANCHORCARET, 0, 0);
 
3807
}
 
3808
 
 
3809
wxSciFnDirect wxScintilla::GetDirectFunction()
 
3810
{
 
3811
    return (wxSciFnDirect)SendMsg(SCI_GETDIRECTFUNCTION , 0, 0);
 
3812
}
 
3813
 
 
3814
wxIntPtr wxScintilla::GetDirectPointer() const
 
3815
{
 
3816
    return (wxIntPtr)SendMsg(SCI_GETDIRECTPOINTER , 0, 0);
 
3817
}
 
3818
 
 
3819
wxUIntPtr wxScintilla::GetCharacterPointer() const
 
3820
{
 
3821
    return (wxUIntPtr)SendMsg(SCI_GETCHARACTERPOINTER , 0, 0);
 
3822
}
 
3823
 
 
3824
void wxScintilla::GrabSCIFocus()
 
3825
{
 
3826
    SendMsg(SCI_GRABFOCUS , 0, 0);
 
3827
}
 
3828
 
 
3829
void wxScintilla::LoadLexerLibrary(const wxString& path)
 
3830
{
 
3831
    SendMsg(SCI_LOADLEXERLIBRARY , 0, (sptr_t)(const char*)wx2sci(path));
 
3832
}
 
3833
 
 
3834
void wxScintilla::SetUsePalette(bool allowPaletteUse)
 
3835
{
 
3836
    SendMsg(SCI_SETUSEPALETTE ,allowPaletteUse, 0);
 
3837
}
 
3838
 
 
3839
bool wxScintilla::GetUsePalette()
 
3840
{
 
3841
    return SendMsg(SCI_GETUSEPALETTE , 0, 0) != 0;
 
3842
}
 
3843
 
2486
3844
 
2487
3845
// Start notifying the container of all key presses and commands.
2488
 
void wxScintilla::StartRecord () {
2489
 
    SendMsg (SCI_STARTRECORD, 0, 0);
 
3846
void wxScintilla::StartRecord ()
 
3847
{
 
3848
    SendMsg(SCI_STARTRECORD, 0, 0);
2490
3849
}
2491
3850
 
2492
3851
// Stop notifying the container of all key presses and commands.
2493
 
void wxScintilla::StopRecord () {
2494
 
    SendMsg (SCI_STOPRECORD, 0, 0);
 
3852
void wxScintilla::StopRecord ()
 
3853
{
 
3854
    SendMsg(SCI_STOPRECORD, 0, 0);
2495
3855
}
2496
3856
 
2497
3857
// Set the lexing language of the document.
2498
 
void wxScintilla::SetLexer (int lexer) {
2499
 
    SendMsg (SCI_SETLEXER, lexer, 0);
 
3858
void wxScintilla::SetLexer (int lexer)
 
3859
{
 
3860
    SendMsg(SCI_SETLEXER, lexer, 0);
2500
3861
}
2501
3862
 
2502
3863
// Retrieve the lexing language of the document.
2503
 
int wxScintilla::GetLexer () {
2504
 
    return SendMsg (SCI_GETLEXER, 0, 0);
 
3864
int wxScintilla::GetLexer () const
 
3865
{
 
3866
    return SendMsg(SCI_GETLEXER, 0, 0);
2505
3867
}
2506
3868
 
2507
3869
// Colourise a segment of the document using the current lexing language.
2508
 
void wxScintilla::Colourise (int startPos, int endPos) {
2509
 
    SendMsg (SCI_COLOURISE, startPos, endPos);
 
3870
void wxScintilla::Colourise (int start, int end)
 
3871
{
 
3872
    SendMsg(SCI_COLOURISE, start, end);
2510
3873
}
2511
3874
 
2512
3875
// Set up a value that may be used by a lexer for some optional feature.
2513
 
void wxScintilla::SetProperty (const wxString& key, const wxString& value) {
2514
 
    SendMsg (SCI_SETPROPERTY, (long)(const char*)wx2sci(key), (long)(const char*)wx2sci(value));
2515
 
}
2516
 
 
2517
 
// Retrieve a value that may be used by a lexer for some optional feature.
2518
 
wxString wxScintilla::GetProperty (const wxString& key) {
2519
 
    wxMemoryBuffer mbuf(256); //? TODO: make size 256 variable
2520
 
    char* buf = (char*)mbuf.GetWriteBuf(256+1);
2521
 
    SendMsg (SCI_GETPROPERTY, (long)(const char*)wx2sci(key), (long)buf);
2522
 
    mbuf.UngetWriteBuf(mbuf.GetBufSize());
2523
 
    mbuf.AppendByte(0);
2524
 
    return sci2wx(buf);
2525
 
}
2526
 
wxString wxScintilla::GetPropertyExpanded (const wxString& key) {
2527
 
    wxMemoryBuffer mbuf(256); //? TODO: make size 256 variable
2528
 
    char* buf = (char*)mbuf.GetWriteBuf(256+1);
2529
 
    SendMsg (SCI_GETPROPERTYEXPANDED, (long)(const char*)wx2sci(key), (long)buf);
2530
 
    mbuf.UngetWriteBuf(mbuf.GetBufSize());
2531
 
    mbuf.AppendByte(0);
2532
 
    return sci2wx(buf);
2533
 
}
2534
 
int wxScintilla::GetPropertyInt (const wxString& key) {
2535
 
    return SendMsg (SCI_GETPROPERTYINT, (long)(const char*)wx2sci(key), 0);
2536
 
}
2537
 
 
2538
 
// Retrieve the number of bits the current lexer needs for styling.
2539
 
int wxScintilla::GetStyleBitsNeeded () {
2540
 
    return SendMsg (SCI_GETSTYLEBITSNEEDED, 0, 0);
 
3876
void wxScintilla::SetProperty (const wxString& key, const wxString& value)
 
3877
{
 
3878
    SendMsg(SCI_SETPROPERTY, (sptr_t)(const char*)wx2sci(key), (sptr_t)(const char*)wx2sci(value));
2541
3879
}
2542
3880
 
2543
3881
// Set up the key words used by the lexer.
2544
 
void wxScintilla::SetKeyWords (int keywordSet, const wxString& keyWords) {
2545
 
    SendMsg (SCI_SETKEYWORDS, keywordSet, (long)(const char*)wx2sci(keyWords));
 
3882
void wxScintilla::SetKeyWords(int keywordSet, const wxString& keyWords)
 
3883
{
 
3884
    SendMsg(SCI_SETKEYWORDS, keywordSet, (sptr_t)(const char*)wx2sci(keyWords));
2546
3885
}
2547
3886
 
2548
3887
// Set the lexing language of the document based on string name.
2549
 
void wxScintilla::SetLexerLanguage (const wxString& language) {
2550
 
    SendMsg (SCI_SETLEXERLANGUAGE, 0, (long)(const char*)wx2sci(language));
 
3888
void wxScintilla::SetLexerLanguage(const wxString& language)
 
3889
{
 
3890
    SendMsg(SCI_SETLEXERLANGUAGE, 0, (sptr_t)(const char*)wx2sci(language));
 
3891
}
 
3892
 
 
3893
// Retrieve a 'property' value previously set with SetProperty.
 
3894
wxString wxScintilla::GetProperty (const wxString& key)
 
3895
{
 
3896
    int len = SendMsg(SCI_GETPROPERTY, (sptr_t)(const char*)wx2sci(key), 0);
 
3897
    if (!len) return wxEmptyString;
 
3898
 
 
3899
    wxMemoryBuffer mbuf(len+1);
 
3900
    char* buf = (char*)mbuf.GetWriteBuf(len+1);
 
3901
    SendMsg(SCI_GETPROPERTY, (uptr_t)(const char*)wx2sci(key), (sptr_t)buf);
 
3902
    mbuf.UngetWriteBuf(len);
 
3903
    mbuf.AppendByte(0);
 
3904
    return sci2wx(buf);
 
3905
}
 
3906
 
 
3907
// Retrieve a 'property' value previously set with SetProperty,
 
3908
// with '$()' variable replacement on returned buffer.
 
3909
wxString wxScintilla::GetPropertyExpanded (const wxString& key)
 
3910
{
 
3911
    int len = SendMsg(SCI_GETPROPERTYEXPANDED, (uptr_t)(const char*)wx2sci(key), 0);
 
3912
    if (!len) return wxEmptyString;
 
3913
 
 
3914
    wxMemoryBuffer mbuf(len+1);
 
3915
    char* buf = (char*)mbuf.GetWriteBuf(len+1);
 
3916
    SendMsg(SCI_GETPROPERTYEXPANDED, (uptr_t)(const char*)wx2sci(key), (uptr_t)buf);
 
3917
    mbuf.UngetWriteBuf(len);
 
3918
    mbuf.AppendByte(0);
 
3919
    return sci2wx(buf);
 
3920
}
 
3921
 
 
3922
// Retrieve a 'property' value previously set with SetProperty,
 
3923
// interpreted as an int AFTER any '$()' variable replacement.
 
3924
int wxScintilla::GetPropertyInt (const wxString& key) const
 
3925
{
 
3926
    return SendMsg(SCI_GETPROPERTYINT, (sptr_t)(const char*)wx2sci(key), 0);
 
3927
}
 
3928
 
 
3929
// Retrieve the number of bits the current lexer needs for styling.
 
3930
int wxScintilla::GetStyleBitsNeeded () const
 
3931
{
 
3932
    return SendMsg(SCI_GETSTYLEBITSNEEDED, 0, 0);
 
3933
}
 
3934
 
 
3935
// Retrieve the name of the lexer.
 
3936
wxString wxScintilla::GetLexerLanguage() const
 
3937
{
 
3938
    int len (0);
 
3939
 
 
3940
    // determine the lexers language string length
 
3941
    len = SendMsg(SCI_GETLEXERLANGUAGE, 0, 0);
 
3942
    if (!len) return wxEmptyString;
 
3943
 
 
3944
    wxMemoryBuffer mbuf(len+2);
 
3945
    char* buf = (char*)mbuf.GetWriteBuf(len+1);
 
3946
    SendMsg(SCI_GETLEXERLANGUAGE, 0, (sptr_t)buf);
 
3947
    mbuf.UngetWriteBuf(len);
 
3948
    mbuf.AppendByte(0);
 
3949
    return sci2wx(buf);
2551
3950
}
2552
3951
 
2553
3952
// END of generated section
2555
3954
 
2556
3955
 
2557
3956
// Returns the line number of the line with the caret.
2558
 
int wxScintilla::GetCurrentLine () {
2559
 
    int line = LineFromPosition (GetCurrentPos());
 
3957
int wxScintilla::GetCurrentLine ()
 
3958
{
 
3959
    int line = LineFromPosition(GetCurrentPos());
2560
3960
    return line;
2561
3961
}
2562
3962
 
2573
3973
//      eol                     turns on eol filling
2574
3974
//      underline               turns on underlining
2575
3975
//
2576
 
void wxScintilla::StyleSetSpec (int styleNum, const wxString& spec) {
2577
 
 
2578
 
    wxStringTokenizer tkz (spec, _T(","));
 
3976
void wxScintilla::StyleSetSpec (int styleNum, const wxString& spec)
 
3977
{
 
3978
    wxStringTokenizer tkz(spec, wxT(","));
2579
3979
    while (tkz.HasMoreTokens()) {
2580
3980
        wxString token = tkz.GetNextToken();
2581
3981
 
2582
 
        wxString option = token.BeforeFirst (':');
2583
 
        wxString val = token.AfterFirst (':');
2584
 
 
2585
 
        if (option == _T("bold"))
2586
 
            StyleSetBold (styleNum, true);
2587
 
 
2588
 
        else if (option == _T("italic"))
2589
 
            StyleSetItalic (styleNum, true);
2590
 
 
2591
 
        else if (option == _T("underline"))
2592
 
            StyleSetUnderline (styleNum, true);
2593
 
 
2594
 
        else if (option == _T("eol"))
2595
 
            StyleSetEOLFilled (styleNum, true);
2596
 
 
2597
 
        else if (option == _T("size")) {
 
3982
        wxString option = token.BeforeFirst(':');
 
3983
        wxString val = token.AfterFirst(':');
 
3984
 
 
3985
        if (option == wxT("bold"))
 
3986
            StyleSetBold(styleNum, true);
 
3987
 
 
3988
        else if (option == wxT("italic"))
 
3989
            StyleSetItalic(styleNum, true);
 
3990
 
 
3991
        else if (option == wxT("underline"))
 
3992
            StyleSetUnderline(styleNum, true);
 
3993
 
 
3994
        else if (option == wxT("eol"))
 
3995
            StyleSetEOLFilled(styleNum, true);
 
3996
 
 
3997
        else if (option == wxT("size")) {
2598
3998
            long points;
2599
 
            if (val.ToLong (&points))
2600
 
                StyleSetSize (styleNum, points);
 
3999
            if (val.ToLong(&points))
 
4000
                StyleSetSize(styleNum, points);
2601
4001
        }
2602
4002
 
2603
 
        else if (option == _T("face"))
2604
 
            StyleSetFaceName (styleNum, val);
2605
 
 
2606
 
        else if (option == _T("fore"))
2607
 
            StyleSetForeground (styleNum, wxColourFromSpec (val));
2608
 
 
2609
 
        else if (option == _T("back"))
2610
 
            StyleSetBackground (styleNum, wxColourFromSpec (val));
 
4003
        else if (option == wxT("face"))
 
4004
            StyleSetFaceName(styleNum, val);
 
4005
 
 
4006
        else if (option == wxT("fore"))
 
4007
            StyleSetForeground(styleNum, wxColourFromSpec(val));
 
4008
 
 
4009
        else if (option == wxT("back"))
 
4010
            StyleSetBackground(styleNum, wxColourFromSpec(val));
2611
4011
    }
2612
4012
}
2613
4013
 
2614
4014
 
 
4015
// Get the font of a style
 
4016
wxFont wxScintilla::StyleGetFont(int style)
 
4017
{
 
4018
    wxFont font;
 
4019
    font.SetPointSize(StyleGetSize(style));
 
4020
    font.SetFaceName(StyleGetFaceName(style));
 
4021
    if( StyleGetBold(style) )
 
4022
        font.SetWeight(wxFONTWEIGHT_BOLD);
 
4023
    else
 
4024
        font.SetWeight(wxFONTWEIGHT_NORMAL);
 
4025
 
 
4026
    if( StyleGetItalic(style) )
 
4027
        font.SetStyle(wxFONTSTYLE_ITALIC);
 
4028
    else
 
4029
        font.SetStyle(wxFONTSTYLE_NORMAL);
 
4030
 
 
4031
    return font;
 
4032
}
 
4033
 
 
4034
 
2615
4035
// Set style size, face, bold, italic, and underline attributes from
2616
4036
// a wxFont's attributes.
2617
 
void wxScintilla::StyleSetFont (int styleNum, wxFont& font) {
 
4037
void wxScintilla::StyleSetFont (int styleNum, wxFont& font)
 
4038
{
2618
4039
#ifdef __WXGTK__
2619
4040
    // Ensure that the native font is initialized
2620
4041
    int x, y;
2621
 
    GetTextExtent (_T("X"), &x, &y, NULL, NULL, &font);
 
4042
    GetTextExtent(wxT("X"), &x, &y, NULL, NULL, &font);
2622
4043
#endif
2623
4044
    int            size     = font.GetPointSize();
2624
4045
    wxString       faceName = font.GetFaceName();
2627
4048
    bool           under    = font.GetUnderlined();
2628
4049
    wxFontEncoding encoding = font.GetEncoding();
2629
4050
 
2630
 
    StyleSetFontAttr (styleNum, size, faceName, bold, italic, under, encoding);
 
4051
    StyleSetFontAttr(styleNum, size, faceName, bold, italic, under, encoding);
2631
4052
}
2632
4053
 
2633
4054
// Set all font style attributes at once.
2634
 
void wxScintilla::StyleSetFontAttr (int styleNum, int size, const wxString& faceName,
2635
 
                                    bool bold, bool italic, bool underline,
2636
 
                                    wxFontEncoding encoding) {
2637
 
    StyleSetSize (styleNum, size);
2638
 
    StyleSetFaceName (styleNum, faceName);
2639
 
    StyleSetBold (styleNum, bold);
2640
 
    StyleSetItalic (styleNum, italic);
2641
 
    StyleSetUnderline (styleNum, underline);
2642
 
    StyleSetFontEncoding (styleNum, encoding);
 
4055
void wxScintilla::StyleSetFontAttr (int styleNum, int size,
 
4056
                                    const wxString& faceName,
 
4057
                                    bool bold, bool italic,
 
4058
                                    bool underline,
 
4059
                                    wxFontEncoding encoding)
 
4060
{
 
4061
    StyleSetSize(styleNum, size);
 
4062
    StyleSetFaceName(styleNum, faceName);
 
4063
    StyleSetBold(styleNum, bold);
 
4064
    StyleSetItalic(styleNum, italic);
 
4065
    StyleSetUnderline(styleNum, underline);
 
4066
    StyleSetFontEncoding(styleNum, encoding);
2643
4067
}
2644
4068
 
2645
 
// Set the character set of the font in a style.
2646
 
void wxScintilla::StyleSetCharacterSet (int style, int characterSet) {
 
4069
 
 
4070
// Set the character set of the font in a style.  Converts the Scintilla
 
4071
// character set values to a wxFontEncoding.
 
4072
void wxScintilla::StyleSetCharacterSet (int style, int characterSet)
 
4073
{
2647
4074
    wxFontEncoding encoding;
2648
4075
 
2649
4076
    // Translate the Scintilla characterSet to a wxFontEncoding
2653
4080
        case wxSCI_CHARSET_DEFAULT:
2654
4081
            encoding = wxFONTENCODING_DEFAULT;
2655
4082
            break;
 
4083
 
2656
4084
        case wxSCI_CHARSET_BALTIC:
2657
4085
            encoding = wxFONTENCODING_ISO8859_13;
2658
4086
            break;
 
4087
 
2659
4088
        case wxSCI_CHARSET_CHINESEBIG5:
2660
4089
            encoding = wxFONTENCODING_CP950;
2661
4090
            break;
 
4091
 
2662
4092
        case wxSCI_CHARSET_EASTEUROPE:
2663
4093
            encoding = wxFONTENCODING_ISO8859_2;
2664
4094
            break;
 
4095
 
2665
4096
        case wxSCI_CHARSET_GB2312:
2666
4097
            encoding = wxFONTENCODING_CP936;
2667
4098
            break;
 
4099
 
2668
4100
        case wxSCI_CHARSET_GREEK:
2669
4101
            encoding = wxFONTENCODING_ISO8859_7;
2670
4102
            break;
 
4103
 
2671
4104
        case wxSCI_CHARSET_HANGUL:
2672
4105
            encoding = wxFONTENCODING_CP949;
2673
4106
            break;
 
4107
 
2674
4108
        case wxSCI_CHARSET_MAC:
2675
4109
            encoding = wxFONTENCODING_DEFAULT;
2676
4110
            break;
 
4111
 
2677
4112
        case wxSCI_CHARSET_OEM:
2678
4113
            encoding = wxFONTENCODING_DEFAULT;
2679
4114
            break;
 
4115
 
2680
4116
        case wxSCI_CHARSET_RUSSIAN:
2681
4117
            encoding = wxFONTENCODING_KOI8;
2682
4118
            break;
 
4119
 
2683
4120
        case wxSCI_CHARSET_SHIFTJIS:
2684
4121
            encoding = wxFONTENCODING_CP932;
2685
4122
            break;
 
4123
 
2686
4124
        case wxSCI_CHARSET_SYMBOL:
2687
4125
            encoding = wxFONTENCODING_DEFAULT;
2688
4126
            break;
 
4127
 
2689
4128
        case wxSCI_CHARSET_TURKISH:
2690
4129
            encoding = wxFONTENCODING_ISO8859_9;
2691
4130
            break;
 
4131
 
2692
4132
        case wxSCI_CHARSET_JOHAB:
2693
4133
            encoding = wxFONTENCODING_DEFAULT;
2694
4134
            break;
 
4135
 
2695
4136
        case wxSCI_CHARSET_HEBREW:
2696
4137
            encoding = wxFONTENCODING_ISO8859_8;
2697
4138
            break;
 
4139
 
2698
4140
        case wxSCI_CHARSET_ARABIC:
2699
4141
            encoding = wxFONTENCODING_ISO8859_6;
2700
4142
            break;
 
4143
 
2701
4144
        case wxSCI_CHARSET_VIETNAMESE:
2702
4145
            encoding = wxFONTENCODING_DEFAULT;
2703
4146
            break;
 
4147
 
2704
4148
        case wxSCI_CHARSET_THAI:
2705
4149
            encoding = wxFONTENCODING_ISO8859_11;
2706
4150
            break;
 
4151
 
 
4152
        case wxSCI_CHARSET_CYRILLIC:
 
4153
            encoding = wxFONTENCODING_ISO8859_5;
 
4154
            break;
 
4155
 
 
4156
        case wxSCI_CHARSET_8859_15:
 
4157
            encoding = wxFONTENCODING_ISO8859_15;
 
4158
            break;
2707
4159
    }
2708
4160
 
2709
4161
    // We just have Scintilla track the wxFontEncoding for us.  It gets used
2711
4163
    // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
2712
4164
    // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
2713
4165
    // to wxFONENCODING_DEFAULT in Font::Create.
2714
 
    SendMsg (SCI_STYLESETCHARACTERSET, style, encoding+1);
 
4166
    SendMsg(SCI_STYLESETCHARACTERSET, style, encoding+1);
2715
4167
}
2716
4168
 
 
4169
 
2717
4170
// Set the font encoding to be used by a style.
2718
 
void wxScintilla::StyleSetFontEncoding(int style, wxFontEncoding encoding) {
2719
 
    SendMsg (SCI_STYLESETCHARACTERSET, style, encoding+1);
 
4171
void wxScintilla::StyleSetFontEncoding(int style, wxFontEncoding encoding)
 
4172
{
 
4173
    SendMsg(SCI_STYLESETCHARACTERSET, style, encoding+1);
2720
4174
}
2721
4175
 
 
4176
 
2722
4177
// Perform one of the operations defined by the wxSCI_CMD_* constants.
2723
 
void wxScintilla::CmdKeyExecute (int cmd) {
2724
 
    SendMsg (cmd);
 
4178
void wxScintilla::CmdKeyExecute (int cmd)
 
4179
{
 
4180
    SendMsg(cmd);
2725
4181
}
2726
4182
 
2727
4183
 
2728
4184
// Set the left and right margin in the edit area, measured in pixels.
2729
 
void wxScintilla::SetMargins (int left, int right) {
2730
 
    SetMarginLeft (left);
2731
 
    SetMarginRight (right);
2732
 
}
2733
 
 
 
4185
void wxScintilla::SetMargins (int left, int right)
 
4186
{
 
4187
    SetMarginLeft(left);
 
4188
    SetMarginRight(right);
 
4189
}
 
4190
 
 
4191
 
 
4192
// Retrieve the point in the window where a position is displayed.
 
4193
wxPoint wxScintilla::PointFromPosition(int pos)
 
4194
{
 
4195
    int x = SendMsg(SCI_POINTXFROMPOSITION, 0, pos);
 
4196
    int y = SendMsg(SCI_POINTYFROMPOSITION, 0, pos);
 
4197
    return wxPoint(x, y);
 
4198
}
2734
4199
 
2735
4200
// Retrieve the start and end positions of the current selection.
2736
 
void wxScintilla::GetSelection (int* startPos, int* endPos) {
2737
 
    if (startPos != NULL) *startPos = SendMsg (SCI_GETSELECTIONSTART);
2738
 
    if (endPos != NULL) *endPos = SendMsg (SCI_GETSELECTIONEND);
 
4201
void wxScintilla::GetSelection (long *from, long *to)
 
4202
{
 
4203
    if ( from )
 
4204
        *from = GetSelectionStart();
 
4205
    if ( to )
 
4206
        *to = GetSelectionEnd();
2739
4207
}
2740
4208
 
 
4209
// kept for compatibility only
 
4210
//void wxScintilla::GetSelection(int *from, int *to)
 
4211
//{
 
4212
//    long f, t;
 
4213
//    GetSelection(&f, &t);
 
4214
//    if ( from )
 
4215
//        *from = f;
 
4216
//    if ( to )
 
4217
//        *to = t;
 
4218
//}
2741
4219
 
2742
4220
// Scroll enough to make the given line visible
2743
 
void wxScintilla::ScrollToLine (int line) {
2744
 
    m_swx->DoScrollToLine (line);
 
4221
void wxScintilla::ScrollToLine (int line)
 
4222
{
 
4223
    m_swx->DoScrollToLine(line);
2745
4224
}
2746
4225
 
2747
4226
 
2748
4227
// Scroll enough to make the given column visible
2749
 
void wxScintilla::ScrollToColumn (int column) {
2750
 
    m_swx->DoScrollToColumn (column);
 
4228
void wxScintilla::ScrollToColumn (int column)
 
4229
{
 
4230
    m_swx->DoScrollToColumn(column);
2751
4231
}
2752
4232
 
2753
4233
 
2754
 
bool wxScintilla::SaveFile (const wxString& filename) {
2755
 
    wxFile file (filename, wxFile::write);
2756
 
    if (!file.IsOpened()) return false;
2757
 
 
2758
 
    bool success = file.Write (GetText(), *wxConvCurrent);
2759
 
    if (success) {
 
4234
bool wxScintilla::SaveFile (const wxString& filename)
 
4235
{
 
4236
    wxFile file(filename, wxFile::write);
 
4237
 
 
4238
    if (!file.IsOpened())
 
4239
        return false;
 
4240
 
 
4241
    bool success = file.Write(GetText(), *wxConvCurrent);
 
4242
 
 
4243
    file.Close();
 
4244
 
 
4245
    if (success)
2760
4246
        SetSavePoint();
2761
 
    }
2762
4247
 
2763
4248
    return success;
2764
4249
}
2765
4250
 
2766
 
bool wxScintilla::LoadFile (const wxString& filename) {
2767
 
    wxFile file (filename, wxFile::read);
2768
 
    if (!file.IsOpened()) return false;
2769
 
 
2770
 
    // get the file size (assume it is not huge file...)
2771
 
    size_t len = file.Length();
2772
 
 
 
4251
bool wxScintilla::LoadFile (const wxString& filename)
 
4252
{
2773
4253
    bool success = false;
2774
 
    if (len > 0) {
 
4254
    wxFile file(filename, wxFile::read);
 
4255
 
 
4256
    if (file.IsOpened())
 
4257
    {
 
4258
        wxString contents;
 
4259
        // get the file size (assume it is not huge file...)
 
4260
        ssize_t len = (ssize_t)file.Length();
 
4261
 
 
4262
        if (len > 0)
 
4263
        {
2775
4264
#if wxUSE_UNICODE
2776
 
        wxMemoryBuffer buffer (len+1);
2777
 
        success = (file.Read (buffer.GetData(), len) == (int)len);
2778
 
        if (success) {
2779
 
            ((char*)buffer.GetData())[len] = 0;
2780
 
            SetText (wxString (buffer, *wxConvCurrent, len));
2781
 
        }
 
4265
            wxMemoryBuffer buffer(len+1);
 
4266
            success = (file.Read(buffer.GetData(), len) == len);
 
4267
            if (success) {
 
4268
                ((char*)buffer.GetData())[len] = 0;
 
4269
                contents = wxString(buffer, *wxConvCurrent, len);
 
4270
            }
2782
4271
#else
2783
 
        wxString buffer;
2784
 
        success = (file.Read (wxStringBuffer (buffer, len), len) == (int)len);
2785
 
        if (success) {
2786
 
            SetText (buffer);
2787
 
        }
 
4272
            wxString buffer;
 
4273
            success = (file.Read(wxStringBuffer(buffer, len), len) == len);
 
4274
            contents = buffer;
2788
4275
#endif
2789
 
    }else if (len == 0) {
2790
 
        success = true; // empty file is ok
2791
 
        SetText (wxEmptyString);
2792
 
    }else{
2793
 
        success = false; // len == wxInvalidOffset
2794
 
    }
2795
 
 
2796
 
    if (success) {
2797
 
        EmptyUndoBuffer();
2798
 
        SetSavePoint();
 
4276
        }
 
4277
        else
 
4278
        {
 
4279
            if (len == 0)
 
4280
                success = true;  // empty file is ok
 
4281
            else
 
4282
                success = false; // len == wxInvalidOffset
 
4283
        }
 
4284
 
 
4285
        file.Close();
 
4286
 
 
4287
        if (success)
 
4288
        {
 
4289
            SetText(contents);
 
4290
            EmptyUndoBuffer();
 
4291
            SetSavePoint();
 
4292
        }
2799
4293
    }
2800
4294
 
2801
4295
    return success;
2802
4296
}
2803
4297
 
2804
4298
 
2805
 
#if SCI_USE_DND
2806
 
wxDragResult wxScintilla::DoDragOver (wxCoord x, wxCoord y, wxDragResult def) {
2807
 
    return m_swx->DoDragOver (x, y, def);
2808
 
}
2809
 
 
2810
 
bool wxScintilla::DoDropText (long x, long y, const wxString& data) {
2811
 
    return m_swx->DoDropText (x, y, data);
2812
 
}
2813
 
 
2814
 
wxDragResult wxScintilla::DoDragEnter (wxCoord x, wxCoord y, wxDragResult def) {
2815
 
    return m_swx->DoDragOver (x, y, def);
2816
 
}
2817
 
 
2818
 
void wxScintilla::DoDragLeave () {
 
4299
#if wxUSE_DRAG_AND_DROP
 
4300
wxDragResult wxScintilla::DoDragOver (wxCoord x, wxCoord y, wxDragResult def)
 
4301
{
 
4302
    return m_swx->DoDragOver(x, y, def);
 
4303
}
 
4304
 
 
4305
 
 
4306
bool wxScintilla::DoDropText (long x, long y, const wxString& data)
 
4307
{
 
4308
    return m_swx->DoDropText(x, y, data);
 
4309
}
 
4310
 
 
4311
wxDragResult wxScintilla::DoDragEnter (wxCoord x, wxCoord y, wxDragResult def)
 
4312
{
 
4313
    return m_swx->DoDragOver (x, y, def);
 
4314
}
 
4315
 
 
4316
void wxScintilla::DoDragLeave ()
 
4317
{
2819
4318
    m_swx->DoDragLeave ();
2820
4319
}
2821
4320
#endif
2822
4321
 
2823
4322
 
2824
 
void wxScintilla::SetUseAntiAliasing (bool useAA) {
2825
 
    m_swx->SetUseAntiAliasing (useAA);
2826
 
}
2827
 
 
2828
 
bool wxScintilla::GetUseAntiAliasing() {
2829
 
    return m_swx->GetUseAntiAliasing();
2830
 
}
2831
 
 
2832
 
#if wxCHECK_VERSION(2, 5, 0)
2833
4323
// Raw text handling for UTF-8
2834
 
void wxScintilla::AddTextRaw (const char* text) {
2835
 
    SendMsg (SCI_ADDTEXT, strlen(text), (long)text);
2836
 
}
2837
 
 
2838
 
void wxScintilla::InsertTextRaw (int pos, const char* text) {
2839
 
    SendMsg (SCI_INSERTTEXT, pos, (long)text);
2840
 
}
2841
 
 
2842
 
wxCharBuffer wxScintilla::GetCurLineRaw (int* linePos) {
2843
 
    int len = LineLength (GetCurrentLine());
 
4324
 
 
4325
 
 
4326
void wxScintilla::AddTextRaw (const char* text)
 
4327
{
 
4328
    SendMsg(SCI_ADDTEXT, strlen(text), (sptr_t)text);
 
4329
}
 
4330
 
 
4331
void wxScintilla::InsertTextRaw (int pos, const char* text)
 
4332
{
 
4333
    SendMsg(SCI_INSERTTEXT, pos, (sptr_t)text);
 
4334
}
 
4335
 
 
4336
wxCharBuffer wxScintilla::GetCurLineRaw (int* linePos)
 
4337
{
 
4338
    int len = LineLength(GetCurrentLine());
2844
4339
    if (!len) {
2845
4340
        if (linePos)  *linePos = 0;
2846
4341
        wxCharBuffer empty;
2847
4342
        return empty;
2848
4343
    }
2849
 
    wxCharBuffer buf(len);
2850
 
    int pos = SendMsg (SCI_GETCURLINE, len, (long)buf.data());
2851
 
    if (linePos) *linePos = pos;
2852
 
    return buf;
2853
 
}
2854
 
 
2855
 
wxCharBuffer wxScintilla::GetLineRaw (int line) {
2856
 
    int len = LineLength (line);
2857
 
    if (!len) {
2858
 
        wxCharBuffer empty;
2859
 
        return empty;
2860
 
    }
2861
 
    wxCharBuffer buf(len);
2862
 
    SendMsg (SCI_GETLINE, line, (long)buf.data());
2863
 
    return buf;
2864
 
}
2865
 
 
2866
 
wxCharBuffer wxScintilla::GetSelectedTextRaw() {
2867
 
    int start;
2868
 
    int end;
2869
 
    GetSelection (&start, &end);
2870
 
    int len = end - start;
2871
 
    if (!len) {
2872
 
        wxCharBuffer empty;
2873
 
        return empty;
2874
 
    }
2875
 
    wxCharBuffer buf(len);
2876
 
    SendMsg (SCI_GETSELTEXT, 0, (long)buf.data());
2877
 
    return buf;
2878
 
}
2879
 
 
2880
 
wxCharBuffer wxScintilla::GetTextRangeRaw (int startPos, int endPos) {
 
4344
 
 
4345
    wxCharBuffer buf(len);
 
4346
    int pos = SendMsg(SCI_GETCURLINE, len, (sptr_t)buf.data());
 
4347
    if (linePos)  *linePos = pos;
 
4348
    return buf;
 
4349
}
 
4350
 
 
4351
wxCharBuffer wxScintilla::GetLineRaw (int line)
 
4352
{
 
4353
    int len = LineLength(line);
 
4354
    if (!len) {
 
4355
        wxCharBuffer empty;
 
4356
        return empty;
 
4357
    }
 
4358
 
 
4359
    wxCharBuffer buf(len);
 
4360
    SendMsg(SCI_GETLINE, line, (sptr_t)buf.data());
 
4361
    return buf;
 
4362
}
 
4363
 
 
4364
wxCharBuffer wxScintilla::GetSelectedTextRaw()
 
4365
{
 
4366
/* C::B begin */
 
4367
    /* Notice that this function used to use 'GetSelection(&start, &end);'
 
4368
     * to calculate the selected text length - which works fine when using
 
4369
     * simple selection, but when using multiple selection, or even rectangular
 
4370
     * selection it may cause a crash. */
 
4371
    int len (0);
 
4372
 
 
4373
    // determine the selected text range
 
4374
    len = SendMsg(SCI_GETSELTEXT, 0, 0);
 
4375
/* C::B end */
 
4376
    if (!len) {
 
4377
        wxCharBuffer empty;
 
4378
        return empty;
 
4379
    }
 
4380
 
 
4381
    wxCharBuffer buf(len);
 
4382
    SendMsg(SCI_GETSELTEXT, 0, (sptr_t)buf.data());
 
4383
    return buf;
 
4384
}
 
4385
 
 
4386
wxCharBuffer wxScintilla::GetTextRangeRaw (int startPos, int endPos)
 
4387
{
2881
4388
    if (endPos < startPos) {
2882
4389
        int temp = startPos;
2883
4390
        startPos = endPos;
2888
4395
        wxCharBuffer empty;
2889
4396
        return empty;
2890
4397
    }
 
4398
 
2891
4399
    wxCharBuffer buf(len);
2892
4400
    TextRange tr;
2893
4401
    tr.lpstrText = buf.data();
2894
4402
    tr.chrg.cpMin = startPos;
2895
4403
    tr.chrg.cpMax = endPos;
2896
 
    SendMsg (SCI_GETTEXTRANGE, 0, (long)&tr);
 
4404
    SendMsg(SCI_GETTEXTRANGE, 0, (sptr_t)&tr);
2897
4405
    return buf;
2898
4406
}
2899
4407
 
2900
 
void wxScintilla::SetTextRaw (const char* text) {
2901
 
    SendMsg (SCI_SETTEXT, 0, (long)text);
 
4408
void wxScintilla::SetTextRaw (const char* text)
 
4409
{
 
4410
    SendMsg(SCI_SETTEXT, 0, (sptr_t)text);
2902
4411
}
2903
4412
 
2904
 
wxCharBuffer wxScintilla::GetTextRaw() {
 
4413
wxCharBuffer wxScintilla::GetTextRaw()
 
4414
{
2905
4415
    int len = GetTextLength();
2906
 
    wxCharBuffer buf(len);
2907
 
    SendMsg (SCI_GETTEXT, len, (long)buf.data());
 
4416
    wxCharBuffer buf(len); // adds 1 for NUL automatically
 
4417
    SendMsg(SCI_GETTEXT, len + 1, (sptr_t)buf.data());
2908
4418
    return buf;
2909
4419
}
2910
4420
 
2911
 
void wxScintilla::AppendTextRaw (const char* text) {
2912
 
    SendMsg (SCI_APPENDTEXT, strlen(text), (long)text);
 
4421
void wxScintilla::AppendTextRaw (const char* text)
 
4422
{
 
4423
    SendMsg(SCI_APPENDTEXT, strlen(text), (sptr_t)text);
2913
4424
}
2914
 
#endif
 
4425
 
 
4426
 
 
4427
 
2915
4428
 
2916
4429
 
2917
4430
//----------------------------------------------------------------------
2918
4431
// Event handlers
2919
4432
 
2920
 
void wxScintilla::OnPaint (wxPaintEvent& WXUNUSED(evt)) {
 
4433
void wxScintilla::OnPaint (wxPaintEvent& WXUNUSED(evt))
 
4434
{
 
4435
#ifdef __WXGTK__
 
4436
    // avoid flickering, thanks Eran for the patch
 
4437
        // On Mac / Windows there is no real need for this
 
4438
    wxBufferedPaintDC dc(this);
 
4439
#else
2921
4440
    wxPaintDC dc(this);
2922
 
    m_swx->DoPaint (&dc, GetUpdateRegion().GetBox());
 
4441
#endif
 
4442
    m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
2923
4443
}
2924
4444
 
2925
 
void wxScintilla::OnScrollWin (wxScrollWinEvent& evt) {
 
4445
void wxScintilla::OnScrollWin (wxScrollWinEvent& evt)
 
4446
{
2926
4447
    if (evt.GetOrientation() == wxHORIZONTAL)
2927
 
        m_swx->DoHScroll (evt.GetEventType(), evt.GetPosition());
 
4448
        m_swx->DoHScroll(evt.GetEventType(), evt.GetPosition());
2928
4449
    else
2929
 
        m_swx->DoVScroll (evt.GetEventType(), evt.GetPosition());
 
4450
        m_swx->DoVScroll(evt.GetEventType(), evt.GetPosition());
2930
4451
}
2931
4452
 
2932
 
void wxScintilla::OnScroll (wxScrollEvent& evt) {
2933
 
    wxScrollBar* sb = wxDynamicCast (evt.GetEventObject(), wxScrollBar);
 
4453
void wxScintilla::OnScroll (wxScrollEvent& evt)
 
4454
{
 
4455
    wxScrollBar* sb = wxDynamicCast(evt.GetEventObject(), wxScrollBar);
2934
4456
    if (sb) {
2935
4457
        if (sb->IsVertical())
2936
 
            m_swx->DoVScroll (evt.GetEventType(), evt.GetPosition());
 
4458
            m_swx->DoVScroll(evt.GetEventType(), evt.GetPosition());
2937
4459
        else
2938
 
            m_swx->DoHScroll (evt.GetEventType(), evt.GetPosition());
 
4460
            m_swx->DoHScroll(evt.GetEventType(), evt.GetPosition());
2939
4461
    }
2940
4462
}
2941
4463
 
2942
 
void wxScintilla::OnSize (wxSizeEvent& WXUNUSED(evt)) {
 
4464
void wxScintilla::OnSize (wxSizeEvent& WXUNUSED(evt))
 
4465
{
2943
4466
    if (m_swx) {
2944
4467
        wxSize sz = GetClientSize();
2945
 
        m_swx->DoSize (sz.x, sz.y);
 
4468
        m_swx->DoSize(sz.x, sz.y);
2946
4469
    }
2947
4470
}
2948
4471
 
2949
 
void wxScintilla::OnMouseLeftDown (wxMouseEvent& evt) {
 
4472
void wxScintilla::OnMouseLeftDown (wxMouseEvent& evt)
 
4473
{
2950
4474
    SetFocus();
2951
4475
    wxPoint pt = evt.GetPosition();
2952
 
    m_swx->DoLeftButtonDown (Point(pt.x, pt.y), m_stopWatch.Time(),
2953
 
                             evt.ShiftDown(), evt.ControlDown(), evt.AltDown());
2954
 
}
2955
 
 
2956
 
void wxScintilla::OnMouseMove (wxMouseEvent& evt) {
2957
 
    wxPoint pt = evt.GetPosition();
2958
 
    m_swx->DoLeftButtonMove (Point(pt.x, pt.y));
2959
 
}
2960
 
 
2961
 
void wxScintilla::OnMouseLeftUp (wxMouseEvent& evt) {
2962
 
    wxPoint pt = evt.GetPosition();
2963
 
    m_swx->DoLeftButtonUp (Point(pt.x, pt.y), m_stopWatch.Time(),
2964
 
                           evt.ControlDown());
2965
 
}
2966
 
 
2967
 
 
2968
 
void wxScintilla::OnMouseRightUp (wxMouseEvent& evt) {
2969
 
    wxPoint pt = evt.GetPosition();
2970
 
    m_swx->DoContextMenu (Point(pt.x, pt.y));
2971
 
}
2972
 
 
2973
 
 
2974
 
void wxScintilla::OnMouseMiddleUp (wxMouseEvent& evt) {
2975
 
    wxPoint pt = evt.GetPosition();
2976
 
    m_swx->DoMiddleButtonUp (Point(pt.x, pt.y));
2977
 
}
2978
 
 
2979
 
void wxScintilla::OnContextMenu (wxContextMenuEvent& evt) {
2980
 
    wxPoint pt = evt.GetPosition();
2981
 
    ScreenToClient (&pt.x, &pt.y);
 
4476
    m_swx->DoLeftButtonDown(Point(pt.x, pt.y), m_stopWatch.Time(),
 
4477
                      evt.ShiftDown(), evt.ControlDown(), evt.AltDown());
 
4478
}
 
4479
 
 
4480
void wxScintilla::OnMouseMove (wxMouseEvent& evt)
 
4481
{
 
4482
    wxPoint pt = evt.GetPosition();
 
4483
    m_swx->DoLeftButtonMove(Point(pt.x, pt.y));
 
4484
}
 
4485
 
 
4486
void wxScintilla::OnMouseLeftUp (wxMouseEvent& evt)
 
4487
{
 
4488
    wxPoint pt = evt.GetPosition();
 
4489
    m_swx->DoLeftButtonUp(Point(pt.x, pt.y), m_stopWatch.Time(),
 
4490
                      evt.ControlDown());
 
4491
}
 
4492
 
 
4493
 
 
4494
void wxScintilla::OnMouseRightUp (wxMouseEvent& evt)
 
4495
{
 
4496
    wxPoint pt = evt.GetPosition();
 
4497
    m_swx->DoContextMenu(Point(pt.x, pt.y));
 
4498
}
 
4499
 
 
4500
 
 
4501
void wxScintilla::OnMouseMiddleUp (wxMouseEvent& evt)
 
4502
{
 
4503
    wxPoint pt = evt.GetPosition();
 
4504
    m_swx->DoMiddleButtonUp(Point(pt.x, pt.y));
 
4505
}
 
4506
 
 
4507
void wxScintilla::OnContextMenu (wxContextMenuEvent& evt)
 
4508
{
 
4509
    wxPoint pt = evt.GetPosition();
 
4510
    ScreenToClient(&pt.x, &pt.y);
2982
4511
    /*
2983
4512
      Show context menu at event point if it's within the window,
2984
4513
      or at caret location if not
2985
4514
    */
2986
4515
    wxHitTest ht = this->HitTest(pt);
2987
4516
    if (ht != wxHT_WINDOW_INSIDE) {
2988
 
        pt = this->PointFromPosition (this->GetCurrentPos());
2989
 
    }
2990
 
    m_swx->DoContextMenu (Point(pt.x, pt.y));
2991
 
}
2992
 
 
2993
 
void wxScintilla::OnMouseWheel (wxMouseEvent& evt) {
2994
 
    m_swx->DoMouseWheel (evt.GetWheelRotation(),
2995
 
                         evt.GetWheelDelta(),
2996
 
                         evt.GetLinesPerAction(),
2997
 
                         evt.ControlDown(),
2998
 
                         evt.IsPageScroll());
2999
 
}
3000
 
 
3001
 
 
3002
 
void wxScintilla::OnChar (wxKeyEvent& evt) {
3003
 
    // On (some?) non-US keyboards the AltGr key is required to enter some
 
4517
        pt = this->PointFromPosition(this->GetCurrentPos());
 
4518
    }
 
4519
    m_swx->DoContextMenu(Point(pt.x, pt.y));
 
4520
}
 
4521
 
 
4522
 
 
4523
void wxScintilla::OnMouseWheel (wxMouseEvent& evt)
 
4524
{
 
4525
    // prevent having an event queue with wheel events that cannot be processed
 
4526
    // reasonably fast (see ticket #9057)
 
4527
    if ( m_lastWheelTimestamp <= evt.GetTimestamp() )
 
4528
    {
 
4529
        m_lastWheelTimestamp = m_stopWatch.Time();
 
4530
        m_swx->DoMouseWheel(evt.GetWheelRotation(),
 
4531
                            evt.GetWheelDelta(),
 
4532
                            evt.GetLinesPerAction(),
 
4533
                            evt.ControlDown(),
 
4534
                            evt.IsPageScroll());
 
4535
        m_lastWheelTimestamp = m_stopWatch.Time() - m_lastWheelTimestamp;
 
4536
        m_lastWheelTimestamp += evt.GetTimestamp();
 
4537
    }
 
4538
}
 
4539
 
 
4540
 
 
4541
void wxScintilla::OnChar (wxKeyEvent& evt)
 
4542
{
 
4543
    // On (some?) non-US PC keyboards the AltGr key is required to enter some
3004
4544
    // common characters.  It comes to us as both Alt and Ctrl down so we need
3005
4545
    // to let the char through in that case, otherwise if only ctrl or only
3006
4546
    // alt let's skip it.
3015
4555
#endif
3016
4556
    bool skip = ((ctrl || alt) && ! (ctrl && alt));
3017
4557
 
 
4558
#if wxUSE_UNICODE
 
4559
    // apparently if we don't do this, Unicode keys pressed after non-char
 
4560
    // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
 
4561
    if (m_lastKeyDownConsumed && evt.GetUnicodeKey() > 255)
 
4562
        m_lastKeyDownConsumed = false;
 
4563
#endif
 
4564
 
3018
4565
    if (!m_lastKeyDownConsumed && !skip) {
3019
4566
#if wxUSE_UNICODE
3020
 
#if !wxCHECK_VERSION(2, 5, 0)
3021
 
        int key = evt.m_rawCode;
3022
 
#else
3023
4567
        int key = evt.GetUnicodeKey();
3024
 
#endif
3025
4568
        bool keyOk = true;
3026
4569
 
3027
4570
        // if the unicode key code is not really a unicode character (it may
3033
4576
            keyOk = (key <= 127);
3034
4577
        }
3035
4578
        if (keyOk) {
3036
 
            m_swx->DoAddChar (key);
 
4579
            m_swx->DoAddChar(key);
3037
4580
            return;
3038
4581
        }
3039
4582
#else
3040
4583
        int key = evt.GetKeyCode();
3041
 
#if !wxCHECK_VERSION(2, 5, 0)
3042
 
        if ( (key <= WXK_START || key > WXK_NUMPAD_DIVIDE)) {
3043
 
#else
3044
 
        if ( (key <= WXK_START || key > WXK_COMMAND)) {
3045
 
#endif
3046
 
            m_swx->DoAddChar (key);
 
4584
        if ( (key <= WXK_START) || (key > WXK_COMMAND) ) {
 
4585
            m_swx->DoAddChar(key);
3047
4586
            return;
3048
4587
        }
3049
4588
#endif
3050
4589
    }
 
4590
 
3051
4591
    evt.Skip();
3052
4592
}
3053
4593
 
3054
 
void wxScintilla::OnKeyDown (wxKeyEvent& evt) {
3055
 
    int processed = m_swx->DoKeyDown (evt, &m_lastKeyDownConsumed);
3056
 
    if (!processed && !m_lastKeyDownConsumed) {
 
4594
 
 
4595
void wxScintilla::OnKeyDown (wxKeyEvent& evt)
 
4596
{
 
4597
    int processed = m_swx->DoKeyDown(evt, &m_lastKeyDownConsumed);
 
4598
    if (!processed && !m_lastKeyDownConsumed)
3057
4599
        evt.Skip();
3058
 
    }
3059
4600
}
3060
4601
 
3061
 
void wxScintilla::OnLoseFocus (wxFocusEvent& evt) {
 
4602
 
 
4603
void wxScintilla::OnLoseFocus (wxFocusEvent& evt)
 
4604
{
3062
4605
    m_swx->DoLoseFocus();
3063
4606
    evt.Skip();
3064
4607
}
3065
4608
 
3066
4609
 
3067
 
void wxScintilla::OnGainFocus (wxFocusEvent& evt) {
 
4610
void wxScintilla::OnGainFocus (wxFocusEvent& evt)
 
4611
{
3068
4612
    m_swx->DoGainFocus();
3069
4613
    evt.Skip();
3070
4614
}
3071
4615
 
3072
4616
 
3073
 
void wxScintilla::OnSysColourChanged (wxSysColourChangedEvent& WXUNUSED(evt)) {
 
4617
void wxScintilla::OnSysColourChanged (wxSysColourChangedEvent& WXUNUSED(evt))
 
4618
{
3074
4619
    m_swx->DoSysColourChange();
3075
4620
}
3076
4621
 
3077
4622
 
3078
 
void wxScintilla::OnEraseBackground (wxEraseEvent& WXUNUSED(evt)) {
 
4623
void wxScintilla::OnEraseBackground (wxEraseEvent& WXUNUSED(evt))
 
4624
{
3079
4625
    // do nothing to help avoid flashing
3080
4626
}
3081
4627
 
3082
4628
 
3083
4629
 
3084
 
void wxScintilla::OnMenu (wxCommandEvent& evt) {
3085
 
    m_swx->DoCommand (evt.GetId());
3086
 
}
3087
 
 
3088
 
 
3089
 
void wxScintilla::OnListBox (wxCommandEvent& WXUNUSED(evt)) {
3090
 
    m_swx->DoOnListBox ();
3091
 
}
3092
 
 
3093
 
 
3094
 
void wxScintilla::OnIdle (wxIdleEvent& evt) {
3095
 
    m_swx->DoOnIdle (evt);
 
4630
void wxScintilla::OnMenu (wxCommandEvent& evt)
 
4631
{
 
4632
    m_swx->DoCommand(evt.GetId());
 
4633
}
 
4634
 
 
4635
 
 
4636
void wxScintilla::OnListBox (wxCommandEvent& WXUNUSED(evt))
 
4637
{
 
4638
    m_swx->DoOnListBox();
 
4639
}
 
4640
 
 
4641
 
 
4642
void wxScintilla::OnIdle (wxIdleEvent& evt)
 
4643
{
 
4644
    m_swx->DoOnIdle(evt);
3096
4645
}
3097
4646
 
3098
4647
 
3107
4656
//----------------------------------------------------------------------
3108
4657
// Turn notifications from Scintilla into events
3109
4658
 
 
4659
void wxScintilla::NotifyFocus(bool focus)
 
4660
{
 
4661
    wxScintillaEvent evt (focus ? wxEVT_SCI_SETFOCUS : wxEVT_SCI_KILLFOCUS, GetId());
 
4662
    evt.SetEventObject(this);
 
4663
    GetEventHandler()->ProcessEvent(evt);
 
4664
}
3110
4665
 
3111
 
void wxScintilla::NotifyChange() {
 
4666
void wxScintilla::NotifyChange()
 
4667
{
3112
4668
    wxScintillaEvent evt (wxEVT_SCI_CHANGE, GetId());
3113
 
    evt.SetEventObject (this);
 
4669
    evt.SetEventObject(this);
3114
4670
    GetEventHandler()->ProcessEvent(evt);
3115
4671
}
3116
4672
 
3117
 
static void SetEventText (wxScintillaEvent& evt, const char* text, size_t length) {
 
4673
 
 
4674
static void SetEventText (wxScintillaEvent& evt, const char* text,
 
4675
                          size_t length)
 
4676
{
3118
4677
    if(!text) return;
3119
 
    // The unicode conversion MUST have a null byte to terminate the
3120
 
    // string so move it into a buffer first and give it one.
3121
 
    wxMemoryBuffer buf(length+1);
3122
 
    buf.AppendData ((void*)text, length);
3123
 
    buf.AppendByte (0);
3124
 
    evt.SetText (sci2wx(buf));
 
4678
 
 
4679
    evt.SetText(sci2wx(text, length));
3125
4680
}
3126
4681
 
3127
 
void wxScintilla::NotifyParent (SCNotification* _scn) {
 
4682
 
 
4683
void wxScintilla::NotifyParent (SCNotification* _scn)
 
4684
{
3128
4685
    SCNotification& scn = *_scn;
3129
4686
    wxScintillaEvent evt (0, GetId());
3130
 
    evt.SetEventObject (this);
3131
 
    evt.SetPosition (scn.position);
3132
 
    evt.SetKey (scn.ch);
3133
 
    evt.SetModifiers (scn.modifiers);
 
4687
 
 
4688
    evt.SetEventObject(this);
 
4689
    evt.SetPosition(scn.position);
 
4690
    evt.SetKey(scn.ch);
 
4691
    evt.SetModifiers(scn.modifiers);
3134
4692
 
3135
4693
    switch (scn.nmhdr.code) {
3136
4694
    case SCN_STYLENEEDED:
3167
4725
 
3168
4726
    case SCN_MODIFIED:
3169
4727
        evt.SetEventType (wxEVT_SCI_MODIFIED);
3170
 
        evt.SetModificationType (scn.modificationType);
3171
 
        SetEventText (evt, scn.text, scn.length);
3172
 
        evt.SetLength (scn.length);
3173
 
        evt.SetLinesAdded (scn.linesAdded);
3174
 
        evt.SetLine (scn.line);
3175
 
        evt.SetFoldLevelNow (scn.foldLevelNow);
3176
 
        evt.SetFoldLevelPrev (scn.foldLevelPrev);
 
4728
        evt.SetModificationType(scn.modificationType);
 
4729
        SetEventText(evt, scn.text, scn.length);
 
4730
        evt.SetLength(scn.length);
 
4731
        evt.SetLinesAdded(scn.linesAdded);
 
4732
        evt.SetLine(scn.line);
 
4733
        evt.SetFoldLevelNow(scn.foldLevelNow);
 
4734
        evt.SetFoldLevelPrev(scn.foldLevelPrev);
3177
4735
        break;
3178
4736
 
3179
4737
    case SCN_MACRORECORD:
3180
4738
        evt.SetEventType (wxEVT_SCI_MACRORECORD);
3181
 
        evt.SetMessage (scn.message);
3182
 
        evt.SetWParam (scn.wParam);
3183
 
        evt.SetLParam (scn.lParam);
 
4739
        evt.SetMessage(scn.message);
 
4740
        evt.SetWParam(scn.wParam);
 
4741
        evt.SetLParam(scn.lParam);
3184
4742
        break;
3185
4743
 
3186
4744
    case SCN_MARGINCLICK:
3187
4745
        evt.SetEventType (wxEVT_SCI_MARGINCLICK);
3188
 
        evt.SetMargin (scn.margin);
 
4746
        evt.SetMargin(scn.margin);
3189
4747
        break;
3190
4748
 
3191
4749
    case SCN_NEEDSHOWN:
3192
4750
        evt.SetEventType (wxEVT_SCI_NEEDSHOWN);
3193
 
        evt.SetLength (scn.length);
 
4751
        evt.SetLength(scn.length);
3194
4752
        break;
3195
4753
 
3196
4754
    case SCN_PAINTED:
3197
4755
        evt.SetEventType (wxEVT_SCI_PAINTED);
3198
4756
        break;
3199
4757
 
 
4758
    case SCN_AUTOCSELECTION:
 
4759
        evt.SetEventType(wxEVT_SCI_AUTOCOMP_SELECTION);
 
4760
        evt.SetListType(scn.listType);
 
4761
        SetEventText(evt, scn.text, strlen(scn.text));
 
4762
        evt.SetPosition(scn.lParam);
 
4763
        break;
 
4764
 
 
4765
    case SCN_AUTOCCANCELLED:
 
4766
        evt.SetEventType(wxEVT_SCI_AUTOCOMP_CANCELLED);
 
4767
        break;
 
4768
 
 
4769
    case SCN_AUTOCCHARDELETED:
 
4770
        evt.SetEventType(wxEVT_SCI_AUTOCOMP_CHARDELETED);
 
4771
        break;
 
4772
 
3200
4773
    case SCN_USERLISTSELECTION:
3201
 
        evt.SetEventType (wxEVT_SCI_USERLISTSELECTION);
3202
 
        evt.SetListType (scn.listType);
3203
 
        SetEventText (evt, scn.text, strlen(scn.text));
 
4774
        evt.SetEventType(wxEVT_SCI_USERLISTSELECTION);
 
4775
        evt.SetListType(scn.listType);
 
4776
        SetEventText(evt, scn.text, strlen(scn.text));
 
4777
        evt.SetPosition(scn.lParam);
3204
4778
        break;
3205
4779
 
3206
4780
    case SCN_URIDROPPED:
3207
4781
        evt.SetEventType (wxEVT_SCI_URIDROPPED);
3208
 
        SetEventText (evt, scn.text, strlen(scn.text));
 
4782
        SetEventText(evt, scn.text, strlen(scn.text));
3209
4783
        break;
3210
4784
 
3211
4785
    case SCN_DWELLSTART:
3212
4786
        evt.SetEventType (wxEVT_SCI_DWELLSTART);
3213
 
        evt.SetX (scn.x);
3214
 
        evt.SetY (scn.y);
 
4787
        evt.SetX(scn.x);
 
4788
        evt.SetY(scn.y);
3215
4789
        break;
3216
4790
 
3217
4791
    case SCN_DWELLEND:
3218
4792
        evt.SetEventType (wxEVT_SCI_DWELLEND);
3219
 
        evt.SetX (scn.x);
3220
 
        evt.SetY (scn.y);
 
4793
        evt.SetX(scn.x);
 
4794
        evt.SetY(scn.y);
3221
4795
        break;
3222
4796
 
3223
4797
    case SCN_ZOOM:
3236
4810
        evt.SetEventType (wxEVT_SCI_CALLTIP_CLICK);
3237
4811
        break;
3238
4812
 
 
4813
    case SCN_INDICATORCLICK:
 
4814
        evt.SetEventType (wxEVT_SCI_INDICATOR_CLICK);
 
4815
        break;
 
4816
 
 
4817
    case SCN_INDICATORRELEASE:
 
4818
        evt.SetEventType (wxEVT_SCI_INDICATOR_RELEASE);
 
4819
        break;
 
4820
 
3239
4821
    default:
3240
4822
        return;
3241
4823
    }
3242
4824
 
3243
 
    GetEventHandler()->ProcessEvent (evt);
 
4825
    GetEventHandler()->ProcessEvent(evt);
3244
4826
}
3245
4827
 
3246
4828
 
3249
4831
//----------------------------------------------------------------------
3250
4832
 
3251
4833
wxScintillaEvent::wxScintillaEvent (wxEventType commandType, int id)
3252
 
                : wxCommandEvent (commandType, id) {
 
4834
    : wxCommandEvent(commandType, id)
 
4835
{
3253
4836
    m_position = 0;
3254
4837
    m_key = 0;
3255
4838
    m_modifiers = 0;
3266
4849
    m_listType = 0;
3267
4850
    m_x = 0;
3268
4851
    m_y = 0;
3269
 
    m_dragAllowMove = FALSE;
 
4852
/* C::B begin */
 
4853
    m_dragAllowMove = wxDrag_CopyOnly;
 
4854
/* C::B end */
3270
4855
#if wxUSE_DRAG_AND_DROP
3271
4856
    m_dragResult = wxDragNone;
3272
4857
#endif
3277
4862
bool wxScintillaEvent::GetAlt() const { return (m_modifiers & SCI_ALT) != 0; }
3278
4863
 
3279
4864
 
3280
 
wxScintillaEvent::wxScintillaEvent (const wxScintillaEvent& event)
3281
 
                : wxCommandEvent(event) {
3282
 
    m_position =         event.m_position;
3283
 
    m_key =              event.m_key;
3284
 
    m_modifiers =        event.m_modifiers;
3285
 
    m_modificationType = event.m_modificationType;
3286
 
    m_text =             event.m_text;
3287
 
    m_length =           event.m_length;
3288
 
    m_linesAdded =       event.m_linesAdded;
3289
 
    m_line =             event.m_line;
3290
 
    m_foldLevelNow =     event.m_foldLevelNow;
3291
 
    m_foldLevelPrev =    event.m_foldLevelPrev;
3292
 
    m_margin =           event.m_margin;
3293
 
    m_message =          event.m_message;
3294
 
    m_wParam =           event.m_wParam;
3295
 
    m_lParam =           event.m_lParam;
3296
 
    m_listType =         event.m_listType;
3297
 
    m_x =                event.m_x;
3298
 
    m_y =                event.m_y;
3299
 
    m_dragText =         event.m_dragText;
3300
 
    m_dragAllowMove =    event.m_dragAllowMove;
 
4865
wxScintillaEvent::wxScintillaEvent (const wxScintillaEvent& event):
 
4866
  wxCommandEvent(event)
 
4867
{
 
4868
    m_position          = event.m_position;
 
4869
    m_key               = event.m_key;
 
4870
    m_modifiers         = event.m_modifiers;
 
4871
    m_modificationType  = event.m_modificationType;
 
4872
    m_text              = event.m_text;
 
4873
    m_length            = event.m_length;
 
4874
    m_linesAdded        = event.m_linesAdded;
 
4875
    m_line              = event.m_line;
 
4876
    m_foldLevelNow      = event.m_foldLevelNow;
 
4877
    m_foldLevelPrev     = event.m_foldLevelPrev;
 
4878
 
 
4879
    m_margin            = event.m_margin;
 
4880
 
 
4881
    m_message           = event.m_message;
 
4882
    m_wParam            = event.m_wParam;
 
4883
    m_lParam            = event.m_lParam;
 
4884
 
 
4885
    m_listType          = event.m_listType;
 
4886
    m_x                 = event.m_x;
 
4887
    m_y                 = event.m_y;
 
4888
 
 
4889
    m_dragText          = event.m_dragText;
 
4890
    m_dragAllowMove     = event.m_dragAllowMove;
3301
4891
#if wxUSE_DRAG_AND_DROP
3302
 
    m_dragResult =       event.m_dragResult;
 
4892
    m_dragResult        = event.m_dragResult;
3303
4893
#endif
3304
4894
}
3305
4895
 
3306
4896
//----------------------------------------------------------------------
3307
4897
//----------------------------------------------------------------------
 
4898