fixed STC under Win64: as wxStyledTextCtrl::SendMsg() used (32 bit) long arguments, passing (64 bit) pointers to it almost certainly didn't work

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54236 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-06-15 13:56:59 +00:00
parent 88e4e082bf
commit b796ba3931
7 changed files with 175 additions and 172 deletions

View File

@@ -987,84 +987,6 @@ typedef wxUint32 wxDword;
#define wxINT64_MIN (wxLL(-9223372036854775807)-1)
#endif
/*
Define an integral type big enough to contain all of long, size_t and void *.
*/
#if SIZEOF_SIZE_T >= SIZEOF_VOID_P
/*
Win64 case: size_t is the only integral type big enough for "void *".
Notice that wxUIntPtr should be also defined as size_t when building
under Win32 with MSVC with /Wp64 option as otherwise any conversion
between ints and pointers results in a warning 4311 or 4312, even if it
is safe under Win32. Using size_t (declared with __w64) allows to avoid
them.
*/
typedef size_t wxUIntPtr;
#elif SIZEOF_LONG >= SIZEOF_VOID_P
/*
Normal case when long is the largest integral type.
*/
typedef unsigned long wxUIntPtr;
#else
/*
This should never happen for the current architectures but if you're
using one where it does, please contact wx-dev@lists.wxwidgets.org.
*/
#error "Pointers can't be stored inside integer types."
#endif
#ifdef __cplusplus
/* And also define a couple of simple functions to cast pointer to/from it. */
inline wxUIntPtr wxPtrToUInt(const void *p)
{
/*
VC++ 7.1 gives warnings about casts such as below even when they're
explicit with /Wp64 option, suppress them as we really know what we're
doing here. Same thing with icc with -Wall.
*/
#ifdef __VISUALC__
#if __VISUALC__ >= 1200
#pragma warning(push)
#endif
/* pointer truncation from '' to '' */
#pragma warning(disable: 4311)
#elif defined(__INTELC__)
#pragma warning(push)
/* conversion from pointer to same-sized integral type */
#pragma warning(disable: 1684)
#endif
return wx_reinterpret_cast(wxUIntPtr, p);
#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__)
#pragma warning(pop)
#endif
}
inline void *wxUIntToPtr(wxUIntPtr p)
{
#ifdef __VISUALC__
#if __VISUALC__ >= 1200
#pragma warning(push)
#endif
/* conversion to type of greater size */
#pragma warning(disable: 4312)
#elif defined(__INTELC__)
#pragma warning(push)
/* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */
#pragma warning(disable: 171)
#endif
return wx_reinterpret_cast(void *, p);
#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__)
#pragma warning(pop)
#endif
}
#endif /*__cplusplus*/
/* 64 bit */
/* NB: we #define and not typedef wxLongLong_t because we use "#ifdef */
@@ -1202,6 +1124,87 @@ inline void *wxUIntToPtr(wxUIntPtr p)
#endif
#endif
/*
Define signed and unsigned integral types big enough to contain all of long,
size_t and void *.
*/
#if SIZEOF_SIZE_T >= SIZEOF_VOID_P
/*
Win64 case: size_t is the only integral type big enough for "void *".
Notice that wxUIntPtr should be also defined as size_t when building
under Win32 with MSVC with /Wp64 option as otherwise any conversion
between ints and pointers results in a warning 4311 or 4312, even if it
is safe under Win32. Using size_t (declared with __w64) allows to avoid
them.
*/
#define wxIntPtr ssize_t
typedef size_t wxUIntPtr;
#elif SIZEOF_LONG >= SIZEOF_VOID_P
/*
Normal case when long is the largest integral type.
*/
typedef long wxIntPtr;
typedef unsigned long wxUIntPtr;
#else
/*
This should never happen for the current architectures but if you're
using one where it does, please contact wx-dev@lists.wxwidgets.org.
*/
#error "Pointers can't be stored inside integer types."
#endif
#ifdef __cplusplus
/* And also define a couple of simple functions to cast pointer to/from it. */
inline wxUIntPtr wxPtrToUInt(const void *p)
{
/*
VC++ 7.1 gives warnings about casts such as below even when they're
explicit with /Wp64 option, suppress them as we really know what we're
doing here. Same thing with icc with -Wall.
*/
#ifdef __VISUALC__
#if __VISUALC__ >= 1200
#pragma warning(push)
#endif
/* pointer truncation from '' to '' */
#pragma warning(disable: 4311)
#elif defined(__INTELC__)
#pragma warning(push)
/* conversion from pointer to same-sized integral type */
#pragma warning(disable: 1684)
#endif
return wx_reinterpret_cast(wxUIntPtr, p);
#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__)
#pragma warning(pop)
#endif
}
inline void *wxUIntToPtr(wxUIntPtr p)
{
#ifdef __VISUALC__
#if __VISUALC__ >= 1200
#pragma warning(push)
#endif
/* conversion to type of greater size */
#pragma warning(disable: 4312)
#elif defined(__INTELC__)
#pragma warning(push)
/* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */
#pragma warning(disable: 171)
#endif
return wx_reinterpret_cast(void *, p);
#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__)
#pragma warning(pop)
#endif
}
#endif /*__cplusplus*/
/* base floating point types */
/* wxFloat32: 32 bit IEEE float ( 1 sign, 8 exponent bits, 23 fraction bits */

View File

@@ -3571,7 +3571,7 @@ public:
// NB: this method is not really const as it can modify the control but it
// has to be declared as such as it's called from both const and
// non-const methods and we can't distinguish between the two
long SendMsg(int msg, long wp=0, long lp=0) const;
long SendMsg(int msg, wxUIntPtr wp=0, wxIntPtr lp=0) const;
// Set the vertical scrollbar to use instead of the ont that's built-in.

View File

@@ -1430,7 +1430,7 @@ long Platform::SendScintillaPointer(WindowID w,
void *lParam) {
wxStyledTextCtrl* stc = (wxStyledTextCtrl*)w;
return stc->SendMsg(msg, wParam, (long)lParam);
return stc->SendMsg(msg, wParam, (wxIntPtr)lParam);
}

View File

@@ -85,14 +85,14 @@ methodOverrideMap = {
'''void %s(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
SendMsg(%s, strlen(buf), (long)(const char*)buf);''',
SendMsg(%s, strlen(buf), (sptr_t)(const char*)buf);''',
0),
'AddStyledText' : (0,
'void %s(const wxMemoryBuffer& data);',
'''void %s(const wxMemoryBuffer& data) {
SendMsg(%s, data.GetDataLen(), (long)data.GetData());''',
SendMsg(%s, data.GetDataLen(), (sptr_t)data.GetData());''',
0),
'AppendText' : (0,
@@ -100,7 +100,7 @@ methodOverrideMap = {
'''void %s(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
SendMsg(%s, strlen(buf), (long)(const char*)buf);''',
SendMsg(%s, strlen(buf), (sptr_t)(const char*)buf);''',
0),
'GetViewWS' : ( 'GetViewWhiteSpace', 0, 0, 0),
@@ -135,7 +135,7 @@ methodOverrideMap = {
tr.lpstrText = (char*)buf.GetWriteBuf(len*2+1);
tr.chrg.cpMin = startPos;
tr.chrg.cpMax = endPos;
len = SendMsg(%s, 0, (long)&tr);
len = SendMsg(%s, 0, (sptr_t)&tr);
buf.UngetWriteBuf(len);
return buf;''',
@@ -164,7 +164,7 @@ methodOverrideMap = {
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
int pos = SendMsg(%s, len+1, (long)buf);
int pos = SendMsg(%s, len+1, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
if (linePos) *linePos = pos;
@@ -211,7 +211,7 @@ methodOverrideMap = {
char* buff = new char[len+1];
strm.CopyTo(buff, len);
buff[len] = 0;
SendMsg(%s, markerNumber, (long)buff);
SendMsg(%s, markerNumber, (sptr_t)buff);
delete [] buff;
''',
('Define a marker from a bitmap',)),
@@ -242,7 +242,7 @@ methodOverrideMap = {
long len = SendMsg(msg, style, 0);
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(msg, style, (long)buf);
SendMsg(msg, style, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
@@ -275,7 +275,7 @@ methodOverrideMap = {
'void %s(int length, char* styleBytes);',
'''void %s(int length, char* styleBytes) {
SendMsg(%s, length, (long)styleBytes);''',
SendMsg(%s, length, (sptr_t)styleBytes);''',
0),
@@ -332,7 +332,7 @@ methodOverrideMap = {
char* buff = new char[len+1];
strm.CopyTo(buff, len);
buff[len] = 0;
SendMsg(%s, type, (long)buff);
SendMsg(%s, type, (sptr_t)buff);
delete [] buff;
''',
('Register an image for use in autocompletion lists.',)),
@@ -365,7 +365,7 @@ methodOverrideMap = {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
ft.lpstrText = (char*)(const char*)buf;
return SendMsg(%s, flags, (long)&ft);''',
return SendMsg(%s, flags, (sptr_t)&ft);''',
0),
'FormatRange' :
@@ -404,7 +404,7 @@ methodOverrideMap = {
fr.chrg.cpMin = startPos;
fr.chrg.cpMax = endPos;
return SendMsg(%s, doDraw, (long)&fr);''',
return SendMsg(%s, doDraw, (sptr_t)&fr);''',
0),
@@ -418,7 +418,7 @@ methodOverrideMap = {
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(%s, line, (long)buf);
SendMsg(%s, line, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
@@ -441,7 +441,7 @@ methodOverrideMap = {
wxMemoryBuffer mbuf(len+2);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(%s, 0, (long)buf);
SendMsg(%s, 0, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
@@ -467,7 +467,7 @@ methodOverrideMap = {
tr.lpstrText = buf;
tr.chrg.cpMin = startPos;
tr.chrg.cpMax = endPos;
SendMsg(%s, 0, (long)&tr);
SendMsg(%s, 0, (sptr_t)&tr);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
@@ -489,7 +489,7 @@ methodOverrideMap = {
int len = GetTextLength();
wxMemoryBuffer mbuf(len+1); // leave room for the null...
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(%s, len+1, (long)buf);
SendMsg(%s, len+1, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
@@ -520,7 +520,7 @@ methodOverrideMap = {
'''
int %s(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
return SendMsg(%s, strlen(buf), (long)(const char*)buf);''',
return SendMsg(%s, strlen(buf), (sptr_t)(const char*)buf);''',
0),
'ReplaceTargetRE' :
@@ -530,7 +530,7 @@ methodOverrideMap = {
'''
int %s(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
return SendMsg(%s, strlen(buf), (long)(const char*)buf);''',
return SendMsg(%s, strlen(buf), (sptr_t)(const char*)buf);''',
0),
'SearchInTarget' :
@@ -540,7 +540,7 @@ methodOverrideMap = {
'''
int %s(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
return SendMsg(%s, strlen(buf), (long)(const char*)buf);''',
return SendMsg(%s, strlen(buf), (sptr_t)(const char*)buf);''',
0),
# not sure what to do about these yet
@@ -554,12 +554,12 @@ methodOverrideMap = {
'wxString %s(const wxString& key);',
'''wxString %s(const wxString& key) {
int len = SendMsg(SCI_GETPROPERTY, (long)(const char*)wx2stc(key), 0);
int len = SendMsg(SCI_GETPROPERTY, (sptr_t)(const char*)wx2stc(key), 0);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(%s, (long)(const char*)wx2stc(key), (long)buf);
SendMsg(%s, (uptr_t)(const char*)wx2stc(key), (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
@@ -570,12 +570,12 @@ methodOverrideMap = {
'wxString %s(const wxString& key);',
'''wxString %s(const wxString& key) {
int len = SendMsg(SCI_GETPROPERTYEXPANDED, (long)(const char*)wx2stc(key), 0);
int len = SendMsg(SCI_GETPROPERTYEXPANDED, (uptr_t)(const char*)wx2stc(key), 0);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(%s, (long)(const char*)wx2stc(key), (long)buf);
SendMsg(%s, (uptr_t)(const char*)wx2stc(key), (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
@@ -598,7 +598,7 @@ methodOverrideMap = {
(0,
'void %s(void* docPointer);',
'''void %s(void* docPointer) {
SendMsg(%s, 0, (long)docPointer);''',
SendMsg(%s, 0, (sptr_t)docPointer);''',
0),
'CreateDocument' :
@@ -612,14 +612,14 @@ methodOverrideMap = {
(0,
'void %s(void* docPointer);',
'''void %s(void* docPointer) {
SendMsg(%s, 0, (long)docPointer);''',
SendMsg(%s, 0, (sptr_t)docPointer);''',
0),
'ReleaseDocument' :
(0,
'void %s(void* docPointer);',
'''void %s(void* docPointer) {
SendMsg(%s, 0, (long)docPointer);''',
SendMsg(%s, 0, (sptr_t)docPointer);''',
0),
'SetCodePage' :
@@ -840,7 +840,7 @@ def makeArgString(param):
typ, name = param
if typ == 'string':
return '(long)(const char*)wx2stc(%s)' % name
return '(sptr_t)(const char*)wx2stc(%s)' % name
if typ == 'colour':
return 'wxColourAsLong(%s)' % name

View File

@@ -224,7 +224,7 @@ wxStyledTextCtrl::~wxStyledTextCtrl() {
//----------------------------------------------------------------------
long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) const
long wxStyledTextCtrl::SendMsg(int msg, wxUIntPtr wp, wxIntPtr lp) const
{
return m_swx->WndProc(msg, wp, lp);
}
@@ -257,18 +257,18 @@ void wxStyledTextCtrl::SetHScrollBar(wxScrollBar* bar) {
// Add text to the document at current position.
void wxStyledTextCtrl::AddText(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
SendMsg(2001, strlen(buf), (long)(const char*)buf);
SendMsg(2001, strlen(buf), (sptr_t)(const char*)buf);
}
// Add array of cells to document.
void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer& data) {
SendMsg(2002, data.GetDataLen(), (long)data.GetData());
SendMsg(2002, data.GetDataLen(), (sptr_t)data.GetData());
}
// Insert string at a position.
void wxStyledTextCtrl::InsertText(int pos, const wxString& text)
{
SendMsg(2003, pos, (long)(const char*)wx2stc(text));
SendMsg(2003, pos, (sptr_t)(const char*)wx2stc(text));
}
// Delete all text in the document.
@@ -351,7 +351,7 @@ wxMemoryBuffer wxStyledTextCtrl::GetStyledText(int startPos, int endPos) {
tr.lpstrText = (char*)buf.GetWriteBuf(len*2+1);
tr.chrg.cpMin = startPos;
tr.chrg.cpMax = endPos;
len = SendMsg(2015, 0, (long)&tr);
len = SendMsg(2015, 0, (sptr_t)&tr);
buf.UngetWriteBuf(len);
return buf;
}
@@ -436,7 +436,7 @@ wxString wxStyledTextCtrl::GetCurLine(int* linePos) {
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
int pos = SendMsg(2027, len+1, (long)buf);
int pos = SendMsg(2027, len+1, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
if (linePos) *linePos = pos;
@@ -591,7 +591,7 @@ void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp)
char* buff = new char[len+1];
strm.CopyTo(buff, len);
buff[len] = 0;
SendMsg(2049, markerNumber, (long)buff);
SendMsg(2049, markerNumber, (sptr_t)buff);
delete [] buff;
}
@@ -695,7 +695,7 @@ void wxStyledTextCtrl::StyleSetSize(int style, int sizePoints)
// Set the font of a style.
void wxStyledTextCtrl::StyleSetFaceName(int style, const wxString& fontName)
{
SendMsg(2056, style, (long)(const char*)wx2stc(fontName));
SendMsg(2056, style, (sptr_t)(const char*)wx2stc(fontName));
}
// Set a style to have its end of line filled or not.
@@ -754,7 +754,7 @@ wxString wxStyledTextCtrl::StyleGetFaceName(int style) {
long len = SendMsg(msg, style, 0);
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(msg, style, (long)buf);
SendMsg(msg, style, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
@@ -875,7 +875,7 @@ void wxStyledTextCtrl::CmdKeyClearAll()
// Set the styles for a segment of the document.
void wxStyledTextCtrl::SetStyleBytes(int length, char* styleBytes) {
SendMsg(2073, length, (long)styleBytes);
SendMsg(2073, length, (sptr_t)styleBytes);
}
// Set a style to be visible or not.
@@ -900,7 +900,7 @@ void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds)
// First sets deaults like SetCharsDefault.
void wxStyledTextCtrl::SetWordChars(const wxString& characters)
{
SendMsg(2077, 0, (long)(const char*)wx2stc(characters));
SendMsg(2077, 0, (sptr_t)(const char*)wx2stc(characters));
}
// Start a sequence of actions that is undone and redone as a unit.
@@ -1034,7 +1034,7 @@ void wxStyledTextCtrl::StyleSetChangeable(int style, bool changeable)
// the caret should be used to provide context.
void wxStyledTextCtrl::AutoCompShow(int lenEntered, const wxString& itemList)
{
SendMsg(2100, lenEntered, (long)(const char*)wx2stc(itemList));
SendMsg(2100, lenEntered, (sptr_t)(const char*)wx2stc(itemList));
}
// Remove the auto-completion list from the screen.
@@ -1064,7 +1064,7 @@ void wxStyledTextCtrl::AutoCompComplete()
// Define a set of character that when typed cancel the auto-completion list.
void wxStyledTextCtrl::AutoCompStops(const wxString& characterSet)
{
SendMsg(2105, 0, (long)(const char*)wx2stc(characterSet));
SendMsg(2105, 0, (sptr_t)(const char*)wx2stc(characterSet));
}
// Change the separator character in the string setting up an auto-completion list.
@@ -1083,7 +1083,7 @@ int wxStyledTextCtrl::AutoCompGetSeparator() const
// Select the item in the auto-completion list that starts with a string.
void wxStyledTextCtrl::AutoCompSelect(const wxString& text)
{
SendMsg(2108, 0, (long)(const char*)wx2stc(text));
SendMsg(2108, 0, (sptr_t)(const char*)wx2stc(text));
}
// Should the auto-completion list be cancelled if the user backspaces to a
@@ -1103,7 +1103,7 @@ bool wxStyledTextCtrl::AutoCompGetCancelAtStart() const
// choose the selected item.
void wxStyledTextCtrl::AutoCompSetFillUps(const wxString& characterSet)
{
SendMsg(2112, 0, (long)(const char*)wx2stc(characterSet));
SendMsg(2112, 0, (sptr_t)(const char*)wx2stc(characterSet));
}
// Should a single item auto-completion list automatically choose the item.
@@ -1133,7 +1133,7 @@ bool wxStyledTextCtrl::AutoCompGetIgnoreCase() const
// Display a list of strings and send notification when user chooses one.
void wxStyledTextCtrl::UserListShow(int listType, const wxString& itemList)
{
SendMsg(2117, listType, (long)(const char*)wx2stc(itemList));
SendMsg(2117, listType, (sptr_t)(const char*)wx2stc(itemList));
}
// Set whether or not autocompletion is hidden automatically when nothing matches.
@@ -1174,7 +1174,7 @@ void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) {
char* buff = new char[len+1];
strm.CopyTo(buff, len);
buff[len] = 0;
SendMsg(2405, type, (long)buff);
SendMsg(2405, type, (sptr_t)buff);
delete [] buff;
}
@@ -1399,7 +1399,7 @@ int wxStyledTextCtrl::FindText(int minPos, int maxPos,
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
ft.lpstrText = (char*)(const char*)buf;
return SendMsg(2150, flags, (long)&ft);
return SendMsg(2150, flags, (sptr_t)&ft);
}
// On Windows, will draw the document into a display context such as a printer.
@@ -1430,7 +1430,7 @@ int wxStyledTextCtrl::FindText(int minPos, int maxPos,
fr.chrg.cpMin = startPos;
fr.chrg.cpMax = endPos;
return SendMsg(2151, doDraw, (long)&fr);
return SendMsg(2151, doDraw, (sptr_t)&fr);
}
// Retrieve the display line at the top of the display.
@@ -1446,7 +1446,7 @@ wxString wxStyledTextCtrl::GetLine(int line) const {
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(2153, line, (long)buf);
SendMsg(2153, line, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
@@ -1505,7 +1505,7 @@ wxString wxStyledTextCtrl::GetSelectedText() {
wxMemoryBuffer mbuf(len+2);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(2161, 0, (long)buf);
SendMsg(2161, 0, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
@@ -1526,7 +1526,7 @@ wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) {
tr.lpstrText = buf;
tr.chrg.cpMin = startPos;
tr.chrg.cpMax = endPos;
SendMsg(2162, 0, (long)&tr);
SendMsg(2162, 0, (sptr_t)&tr);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
@@ -1565,7 +1565,7 @@ void wxStyledTextCtrl::EnsureCaretVisible()
// Replace the selected text with the argument text.
void wxStyledTextCtrl::ReplaceSelection(const wxString& text)
{
SendMsg(2170, 0, (long)(const char*)wx2stc(text));
SendMsg(2170, 0, (sptr_t)(const char*)wx2stc(text));
}
// Set to read only or read write.
@@ -1625,7 +1625,7 @@ void wxStyledTextCtrl::Clear()
// Replace the contents of the document with the argument text.
void wxStyledTextCtrl::SetText(const wxString& text)
{
SendMsg(2181, 0, (long)(const char*)wx2stc(text));
SendMsg(2181, 0, (sptr_t)(const char*)wx2stc(text));
}
// Retrieve all the text in the document.
@@ -1633,7 +1633,7 @@ wxString wxStyledTextCtrl::GetText() const {
int len = GetTextLength();
wxMemoryBuffer mbuf(len+1); // leave room for the null...
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(2182, len+1, (long)buf);
SendMsg(2182, len+1, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
@@ -1701,7 +1701,7 @@ int wxStyledTextCtrl::GetTargetEnd() const
int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
return SendMsg(2194, strlen(buf), (long)(const char*)buf);
return SendMsg(2194, strlen(buf), (sptr_t)(const char*)buf);
}
// Replace the target text with the argument text after \d processing.
@@ -1713,7 +1713,7 @@ int wxStyledTextCtrl::GetTargetEnd() const
int wxStyledTextCtrl::ReplaceTargetRE(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
return SendMsg(2195, strlen(buf), (long)(const char*)buf);
return SendMsg(2195, strlen(buf), (sptr_t)(const char*)buf);
}
// Search for a counted string in the target and set the target to the found
@@ -1722,7 +1722,7 @@ int wxStyledTextCtrl::GetTargetEnd() const
int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
return SendMsg(2197, strlen(buf), (long)(const char*)buf);
return SendMsg(2197, strlen(buf), (sptr_t)(const char*)buf);
}
// Set the search flags used by SearchInTarget.
@@ -1740,7 +1740,7 @@ int wxStyledTextCtrl::GetSearchFlags() const
// Show a call tip containing a definition near position pos.
void wxStyledTextCtrl::CallTipShow(int pos, const wxString& definition)
{
SendMsg(2200, pos, (long)(const char*)wx2stc(definition));
SendMsg(2200, pos, (sptr_t)(const char*)wx2stc(definition));
}
// Remove the call tip from the screen.
@@ -2027,7 +2027,7 @@ bool wxStyledTextCtrl::GetScrollWidthTracking() const
// Does not handle tab or control characters.
int wxStyledTextCtrl::TextWidth(int style, const wxString& text)
{
return SendMsg(2276, style, (long)(const char*)wx2stc(text));
return SendMsg(2276, style, (sptr_t)(const char*)wx2stc(text));
}
// Sets the scroll range so that maximum scroll position has
@@ -2066,7 +2066,7 @@ bool wxStyledTextCtrl::GetUseVerticalScrollBar() const
// Append a string to the end of the document without changing the selection.
void wxStyledTextCtrl::AppendText(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
SendMsg(2282, strlen(buf), (long)(const char*)buf);
SendMsg(2282, strlen(buf), (sptr_t)(const char*)buf);
}
// Is drawing done in two phases with backgrounds drawn before foregrounds?
@@ -2507,7 +2507,7 @@ void* wxStyledTextCtrl::GetDocPointer() {
// Change the document object used.
void wxStyledTextCtrl::SetDocPointer(void* docPointer) {
SendMsg(2358, 0, (long)docPointer);
SendMsg(2358, 0, (sptr_t)docPointer);
}
// Set which document modification events are sent to the container.
@@ -2565,14 +2565,14 @@ void wxStyledTextCtrl::SearchAnchor()
// Does not ensure the selection is visible.
int wxStyledTextCtrl::SearchNext(int flags, const wxString& text)
{
return SendMsg(2367, flags, (long)(const char*)wx2stc(text));
return SendMsg(2367, flags, (sptr_t)(const char*)wx2stc(text));
}
// Find some text starting at the search anchor and moving backwards.
// Does not ensure the selection is visible.
int wxStyledTextCtrl::SearchPrev(int flags, const wxString& text)
{
return SendMsg(2368, flags, (long)(const char*)wx2stc(text));
return SendMsg(2368, flags, (sptr_t)(const char*)wx2stc(text));
}
// Retrieves the number of lines completely visible.
@@ -2615,12 +2615,12 @@ void* wxStyledTextCtrl::CreateDocument() {
// Extend life of document.
void wxStyledTextCtrl::AddRefDocument(void* docPointer) {
SendMsg(2376, 0, (long)docPointer);
SendMsg(2376, 0, (sptr_t)docPointer);
}
// Release a reference to the document, deleting document if it fades to black.
void wxStyledTextCtrl::ReleaseDocument(void* docPointer) {
SendMsg(2377, 0, (long)docPointer);
SendMsg(2377, 0, (sptr_t)docPointer);
}
// Get which document modification events are sent to the container.
@@ -2868,7 +2868,7 @@ void wxStyledTextCtrl::CopyRange(int start, int end)
// Copy argument text to the clipboard.
void wxStyledTextCtrl::CopyText(int length, const wxString& text)
{
SendMsg(2420, length, (long)(const char*)wx2stc(text));
SendMsg(2420, length, (sptr_t)(const char*)wx2stc(text));
}
// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or
@@ -3004,7 +3004,7 @@ void wxStyledTextCtrl::WordRightEndExtend()
// Should be called after SetWordChars.
void wxStyledTextCtrl::SetWhitespaceChars(const wxString& characters)
{
SendMsg(2443, 0, (long)(const char*)wx2stc(characters));
SendMsg(2443, 0, (sptr_t)(const char*)wx2stc(characters));
}
// Reset the set of characters for whitespace and word characters to the defaults.
@@ -3197,29 +3197,29 @@ void wxStyledTextCtrl::Colourise(int start, int end)
// Set up a value that may be used by a lexer for some optional feature.
void wxStyledTextCtrl::SetProperty(const wxString& key, const wxString& value)
{
SendMsg(4004, (long)(const char*)wx2stc(key), (long)(const char*)wx2stc(value));
SendMsg(4004, (sptr_t)(const char*)wx2stc(key), (sptr_t)(const char*)wx2stc(value));
}
// Set up the key words used by the lexer.
void wxStyledTextCtrl::SetKeyWords(int keywordSet, const wxString& keyWords)
{
SendMsg(4005, keywordSet, (long)(const char*)wx2stc(keyWords));
SendMsg(4005, keywordSet, (sptr_t)(const char*)wx2stc(keyWords));
}
// Set the lexing language of the document based on string name.
void wxStyledTextCtrl::SetLexerLanguage(const wxString& language)
{
SendMsg(4006, 0, (long)(const char*)wx2stc(language));
SendMsg(4006, 0, (sptr_t)(const char*)wx2stc(language));
}
// Retrieve a 'property' value previously set with SetProperty.
wxString wxStyledTextCtrl::GetProperty(const wxString& key) {
int len = SendMsg(SCI_GETPROPERTY, (long)(const char*)wx2stc(key), 0);
int len = SendMsg(SCI_GETPROPERTY, (sptr_t)(const char*)wx2stc(key), 0);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(4008, (long)(const char*)wx2stc(key), (long)buf);
SendMsg(4008, (uptr_t)(const char*)wx2stc(key), (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
@@ -3228,12 +3228,12 @@ wxString wxStyledTextCtrl::GetProperty(const wxString& key) {
// Retrieve a 'property' value previously set with SetProperty,
// with '$()' variable replacement on returned buffer.
wxString wxStyledTextCtrl::GetPropertyExpanded(const wxString& key) {
int len = SendMsg(SCI_GETPROPERTYEXPANDED, (long)(const char*)wx2stc(key), 0);
int len = SendMsg(SCI_GETPROPERTYEXPANDED, (uptr_t)(const char*)wx2stc(key), 0);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(4009, (long)(const char*)wx2stc(key), (long)buf);
SendMsg(4009, (uptr_t)(const char*)wx2stc(key), (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
@@ -3243,7 +3243,7 @@ wxString wxStyledTextCtrl::GetPropertyExpanded(const wxString& key) {
// interpreted as an int AFTER any '$()' variable replacement.
int wxStyledTextCtrl::GetPropertyInt(const wxString& key) const
{
return SendMsg(4010, (long)(const char*)wx2stc(key), 0);
return SendMsg(4010, (sptr_t)(const char*)wx2stc(key), 0);
}
// Retrieve the number of bits the current lexer needs for styling.
@@ -3609,12 +3609,12 @@ bool wxStyledTextCtrl::GetUseAntiAliasing() {
void wxStyledTextCtrl::AddTextRaw(const char* text)
{
SendMsg(SCI_ADDTEXT, strlen(text), (long)text);
SendMsg(SCI_ADDTEXT, strlen(text), (sptr_t)text);
}
void wxStyledTextCtrl::InsertTextRaw(int pos, const char* text)
{
SendMsg(SCI_INSERTTEXT, pos, (long)text);
SendMsg(SCI_INSERTTEXT, pos, (sptr_t)text);
}
wxCharBuffer wxStyledTextCtrl::GetCurLineRaw(int* linePos)
@@ -3627,7 +3627,7 @@ wxCharBuffer wxStyledTextCtrl::GetCurLineRaw(int* linePos)
}
wxCharBuffer buf(len);
int pos = SendMsg(SCI_GETCURLINE, len, (long)buf.data());
int pos = SendMsg(SCI_GETCURLINE, len, (sptr_t)buf.data());
if (linePos) *linePos = pos;
return buf;
}
@@ -3641,7 +3641,7 @@ wxCharBuffer wxStyledTextCtrl::GetLineRaw(int line)
}
wxCharBuffer buf(len);
SendMsg(SCI_GETLINE, line, (long)buf.data());
SendMsg(SCI_GETLINE, line, (sptr_t)buf.data());
return buf;
}
@@ -3658,7 +3658,7 @@ wxCharBuffer wxStyledTextCtrl::GetSelectedTextRaw()
}
wxCharBuffer buf(len);
SendMsg(SCI_GETSELTEXT, 0, (long)buf.data());
SendMsg(SCI_GETSELTEXT, 0, (sptr_t)buf.data());
return buf;
}
@@ -3680,26 +3680,26 @@ wxCharBuffer wxStyledTextCtrl::GetTextRangeRaw(int startPos, int endPos)
tr.lpstrText = buf.data();
tr.chrg.cpMin = startPos;
tr.chrg.cpMax = endPos;
SendMsg(SCI_GETTEXTRANGE, 0, (long)&tr);
SendMsg(SCI_GETTEXTRANGE, 0, (sptr_t)&tr);
return buf;
}
void wxStyledTextCtrl::SetTextRaw(const char* text)
{
SendMsg(SCI_SETTEXT, 0, (long)text);
SendMsg(SCI_SETTEXT, 0, (sptr_t)text);
}
wxCharBuffer wxStyledTextCtrl::GetTextRaw()
{
int len = GetTextLength();
wxCharBuffer buf(len); // adds 1 for NUL automatically
SendMsg(SCI_GETTEXT, len + 1, (long)buf.data());
SendMsg(SCI_GETTEXT, len + 1, (sptr_t)buf.data());
return buf;
}
void wxStyledTextCtrl::AppendTextRaw(const char* text)
{
SendMsg(SCI_APPENDTEXT, strlen(text), (long)text);
SendMsg(SCI_APPENDTEXT, strlen(text), (sptr_t)text);
}

View File

@@ -224,7 +224,7 @@ wxStyledTextCtrl::~wxStyledTextCtrl() {
//----------------------------------------------------------------------
long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) const
long wxStyledTextCtrl::SendMsg(int msg, wxUIntPtr wp, wxIntPtr lp) const
{
return m_swx->WndProc(msg, wp, lp);
}
@@ -612,12 +612,12 @@ bool wxStyledTextCtrl::GetUseAntiAliasing() {
void wxStyledTextCtrl::AddTextRaw(const char* text)
{
SendMsg(SCI_ADDTEXT, strlen(text), (long)text);
SendMsg(SCI_ADDTEXT, strlen(text), (sptr_t)text);
}
void wxStyledTextCtrl::InsertTextRaw(int pos, const char* text)
{
SendMsg(SCI_INSERTTEXT, pos, (long)text);
SendMsg(SCI_INSERTTEXT, pos, (sptr_t)text);
}
wxCharBuffer wxStyledTextCtrl::GetCurLineRaw(int* linePos)
@@ -630,7 +630,7 @@ wxCharBuffer wxStyledTextCtrl::GetCurLineRaw(int* linePos)
}
wxCharBuffer buf(len);
int pos = SendMsg(SCI_GETCURLINE, len, (long)buf.data());
int pos = SendMsg(SCI_GETCURLINE, len, (sptr_t)buf.data());
if (linePos) *linePos = pos;
return buf;
}
@@ -644,7 +644,7 @@ wxCharBuffer wxStyledTextCtrl::GetLineRaw(int line)
}
wxCharBuffer buf(len);
SendMsg(SCI_GETLINE, line, (long)buf.data());
SendMsg(SCI_GETLINE, line, (sptr_t)buf.data());
return buf;
}
@@ -661,7 +661,7 @@ wxCharBuffer wxStyledTextCtrl::GetSelectedTextRaw()
}
wxCharBuffer buf(len);
SendMsg(SCI_GETSELTEXT, 0, (long)buf.data());
SendMsg(SCI_GETSELTEXT, 0, (sptr_t)buf.data());
return buf;
}
@@ -683,26 +683,26 @@ wxCharBuffer wxStyledTextCtrl::GetTextRangeRaw(int startPos, int endPos)
tr.lpstrText = buf.data();
tr.chrg.cpMin = startPos;
tr.chrg.cpMax = endPos;
SendMsg(SCI_GETTEXTRANGE, 0, (long)&tr);
SendMsg(SCI_GETTEXTRANGE, 0, (sptr_t)&tr);
return buf;
}
void wxStyledTextCtrl::SetTextRaw(const char* text)
{
SendMsg(SCI_SETTEXT, 0, (long)text);
SendMsg(SCI_SETTEXT, 0, (sptr_t)text);
}
wxCharBuffer wxStyledTextCtrl::GetTextRaw()
{
int len = GetTextLength();
wxCharBuffer buf(len); // adds 1 for NUL automatically
SendMsg(SCI_GETTEXT, len + 1, (long)buf.data());
SendMsg(SCI_GETTEXT, len + 1, (sptr_t)buf.data());
return buf;
}
void wxStyledTextCtrl::AppendTextRaw(const char* text)
{
SendMsg(SCI_APPENDTEXT, strlen(text), (long)text);
SendMsg(SCI_APPENDTEXT, strlen(text), (sptr_t)text);
}

View File

@@ -204,7 +204,7 @@ public:
// NB: this method is not really const as it can modify the control but it
// has to be declared as such as it's called from both const and
// non-const methods and we can't distinguish between the two
long SendMsg(int msg, long wp=0, long lp=0) const;
long SendMsg(int msg, wxUIntPtr wp=0, wxIntPtr lp=0) const;
// Set the vertical scrollbar to use instead of the ont that's built-in.