Update of /cvsroot/pywin32/pywin32/Pythonwin/Scintilla/win32
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17978/win32
Modified Files:
PlatWin.cxx ScintRes.rc ScintillaWin.cxx scintilla.mak
scintilla_vc6.mak
Log Message:
update to scintilla 1.77
Index: PlatWin.cxx
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/Scintilla/win32/PlatWin.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** PlatWin.cxx 10 Feb 2008 11:01:48 -0000 1.14
--- PlatWin.cxx 31 Jan 2009 03:03:14 -0000 1.15
***************
*** 78,81 ****
--- 78,85 ----
}
+ #ifdef SCI_NAMESPACE
+ using namespace Scintilla;
+ #endif
+
Point Point::FromLong(long lpoint) {
return Point(static_cast<short>(LOWORD(lpoint)), static_cast<short>(HIWORD(lpoint)));
***************
*** 220,224 ****
FontCached::FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) :
next(0), usage(0), hash(0) {
! ::SetLogFont(lf, faceName_, characterSet_, size_, bold_, italic_);
hash = HashFont(faceName_, characterSet_, size_, bold_, italic_);
id = ::CreateFontIndirectA(&lf);
--- 224,228 ----
FontCached::FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) :
next(0), usage(0), hash(0) {
! SetLogFont(lf, faceName_, characterSet_, size_, bold_, italic_);
hash = HashFont(faceName_, characterSet_, size_, bold_, italic_);
id = ::CreateFontIndirectA(&lf);
***************
*** 297,301 ****
#ifndef FONTS_CACHED
LOGFONT lf;
! ::SetLogFont(lf, faceName, characterSet, size, bold, italic);
id = ::CreateFontIndirect(&lf);
#else
--- 301,305 ----
#ifndef FONTS_CACHED
LOGFONT lf;
! SetLogFont(lf, faceName, characterSet, size, bold, italic);
id = ::CreateFontIndirect(&lf);
#else
***************
*** 315,318 ****
--- 319,326 ----
}
+ #ifdef SCI_NAMESPACE
+ namespace Scintilla {
+ #endif
+
class SurfaceImpl : public Surface {
bool unicodeMode;
***************
*** 388,391 ****
--- 396,403 ----
};
+ #ifdef SCI_NAMESPACE
+ } //namespace Scintilla
+ #endif
+
SurfaceImpl::SurfaceImpl() :
unicodeMode(false),
***************
*** 652,656 ****
}
! const int MAX_US_LEN = 10000;
void SurfaceImpl::DrawTextCommon(PRectangle rc, Font &font_, int ybase, const char *s, int len, UINT fuOptions) {
--- 664,705 ----
}
! // Buffer to hold strings and string position arrays without always allocating on heap.
! // May sometimes have string too long to allocate on stack. So use a fixed stack-allocated buffer
! // when less than safe size otherwise allocate on heap and free automatically.
! template<typename T, int lengthStandard>
! class VarBuffer {
! T bufferStandard[lengthStandard];
! public:
! T *buffer;
! VarBuffer(size_t length) : buffer(0) {
! if (length > lengthStandard) {
! buffer = new T[length];
! } else {
! buffer = bufferStandard;
! }
! }
! ~VarBuffer() {
! if (buffer != bufferStandard) {
! delete []buffer;
! buffer = 0;
! }
! }
! };
!
! const int stackBufferLength = 10000;
! class TextWide : public VarBuffer<wchar_t, stackBufferLength> {
! public:
! int tlen;
! TextWide(const char *s, int len, bool unicodeMode, int codePage=0) :
! VarBuffer<wchar_t, stackBufferLength>(len) {
! if (unicodeMode) {
! tlen = UTF16FromUTF8(s, len, buffer, len);
! } else {
! // Support Asian string display in 9x English
! tlen = ::MultiByteToWideChar(codePage, 0, s, len, buffer, len);
! }
! }
! };
! typedef VarBuffer<int, stackBufferLength> TextPositions;
void SurfaceImpl::DrawTextCommon(PRectangle rc, Font &font_, int ybase, const char *s, int len, UINT fuOptions) {
***************
*** 682,704 ****
} else {
// Use Unicode calls
! wchar_t tbuf[MAX_US_LEN];
! int tlen;
! if (unicodeMode) {
! tlen = UTF16FromUTF8(s, len, tbuf, MAX_US_LEN);
! } else {
! // Support Asian string display in 9x English
! tlen = ::MultiByteToWideChar(codePage, 0, s, len, NULL, 0);
! if (tlen > MAX_US_LEN)
! tlen = MAX_US_LEN;
! ::MultiByteToWideChar(codePage, 0, s, len, tbuf, tlen);
! }
! if (!::ExtTextOutW(hdc, x, ybase, fuOptions, &rcw, tbuf, tlen, NULL)) {
! while (tlen > pos) {
! int seglen = Platform::Minimum(maxSegmentLength, tlen - pos);
! if (!::ExtTextOutW(hdc, x, ybase, fuOptions, &rcw, tbuf+pos, seglen, NULL)) {
PLATFORM_ASSERT(false);
return;
}
! ::GetTextExtentPoint32W(hdc, tbuf+pos, seglen, &sz);
x += sz.cx;
pos += seglen;
--- 731,743 ----
} else {
// Use Unicode calls
! const TextWide tbuf(s, len, unicodeMode, codePage);
! if (!::ExtTextOutW(hdc, x, ybase, fuOptions, &rcw, tbuf.buffer, tbuf.tlen, NULL)) {
! while (tbuf.tlen > pos) {
! int seglen = Platform::Minimum(maxSegmentLength, tbuf.tlen - pos);
! if (!::ExtTextOutW(hdc, x, ybase, fuOptions, &rcw, tbuf.buffer+pos, seglen, NULL)) {
PLATFORM_ASSERT(false);
return;
}
! ::GetTextExtentPoint32W(hdc, tbuf.buffer+pos, seglen, &sz);
x += sz.cx;
pos += seglen;
***************
*** 739,754 ****
SetFont(font_);
SIZE sz={0,0};
! if (unicodeMode) {
! wchar_t tbuf[MAX_US_LEN];
! int tlen = UTF16FromUTF8(s, len, tbuf, MAX_US_LEN);
! ::GetTextExtentPoint32W(hdc, tbuf, tlen, &sz);
! } else if (IsNT() || (codePage==0) || win9xACPSame) {
::GetTextExtentPoint32A(hdc, s, Platform::Minimum(len, maxLenText), &sz);
} else {
! // Support Asian string display in 9x English
! wchar_t tbuf[MAX_US_LEN];
! int tlen = ::MultiByteToWideChar(codePage, 0, s, len, NULL, 0);
! ::MultiByteToWideChar(codePage, 0, s, len, tbuf, tlen);
! ::GetTextExtentPoint32W(hdc, tbuf, tlen, &sz);
}
return sz.cx;
--- 778,786 ----
SetFont(font_);
SIZE sz={0,0};
! if ((!unicodeMode) && (IsNT() || (codePage==0) || win9xACPSame)) {
::GetTextExtentPoint32A(hdc, s, Platform::Minimum(len, maxLenText), &sz);
} else {
! const TextWide tbuf(s, len, unicodeMode, codePage);
! ::GetTextExtentPoint32W(hdc, tbuf.buffer, tbuf.tlen, &sz);
}
return sz.cx;
***************
*** 760,777 ****
int fit = 0;
if (unicodeMode) {
! wchar_t tbuf[MAX_US_LEN];
! int tlen = UTF16FromUTF8(s, len, tbuf, MAX_US_LEN);
! int poses[MAX_US_LEN];
! fit = tlen;
! if (!::GetTextExtentExPointW(hdc, tbuf, tlen, maxWidthMeasure, &fit, poses, &sz)) {
// Likely to have failed because on Windows 9x where function not available
// So measure the character widths by measuring each initial substring
// Turns a linear operation into a qudratic but seems fast enough on test files
! for (int widthSS=0; widthSS < tlen; widthSS++) {
! ::GetTextExtentPoint32W(hdc, tbuf, widthSS+1, &sz);
! poses[widthSS] = sz.cx;
}
}
! // Map the widths given for UCS-2 characters back onto the UTF-8 input string
int ui=0;
const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
--- 792,808 ----
int fit = 0;
if (unicodeMode) {
! const TextWide tbuf(s, len, unicodeMode, codePage);
! TextPositions poses(tbuf.tlen);
! fit = tbuf.tlen;
! if (!::GetTextExtentExPointW(hdc, tbuf.buffer, tbuf.tlen, maxWidthMeasure, &fit, poses.buffer, &sz)) {
// Likely to have failed because on Windows 9x where function not available
// So measure the character widths by measuring each initial substring
// Turns a linear operation into a qudratic but seems fast enough on test files
! for (int widthSS=0; widthSS < tbuf.tlen; widthSS++) {
! ::GetTextExtentPoint32W(hdc, tbuf.buffer, widthSS+1, &sz);
! poses.buffer[widthSS] = sz.cx;
}
}
! // Map the widths given for UTF-16 characters back onto the UTF-8 input string
int ui=0;
const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
***************
*** 789,793 ****
}
for (unsigned int bytePos=0; (bytePos<lenChar) && (i<len); bytePos++) {
! positions[i++] = poses[ui];
}
ui++;
--- 820,824 ----
}
for (unsigned int bytePos=0; (bytePos<lenChar) && (i<len); bytePos++) {
! positions[i++] = poses.buffer[ui];
}
ui++;
***************
*** 800,824 ****
}
} else if (IsNT() || (codePage==0) || win9xACPSame) {
! if (!::GetTextExtentExPointA(hdc, s, Platform::Minimum(len, maxLenText),
! maxWidthMeasure, &fit, positions, &sz)) {
! // Eeek - a NULL DC or other foolishness could cause this.
! // The least we can do is set the positions to zero!
! memset(positions, 0, len * sizeof(*positions));
! } else if (fit < len) {
! // For some reason, such as an incomplete DBCS character
! // Not all the positions are filled in so make them equal to end.
! for (int i=fit;i<len;i++)
! positions[i] = positions[fit-1];
}
} else {
// Support Asian string display in 9x English
! wchar_t tbuf[MAX_US_LEN];
! int tlen = ::MultiByteToWideChar(codePage, 0, s, len, NULL, 0);
! ::MultiByteToWideChar(codePage, 0, s, len, tbuf, tlen);
!
! int poses[MAX_US_LEN];
! for (int widthSS=0; widthSS<tlen; widthSS++) {
! ::GetTextExtentPoint32W(hdc, tbuf, widthSS+1, &sz);
! poses[widthSS] = sz.cx;
}
--- 831,864 ----
}
} else if (IsNT() || (codePage==0) || win9xACPSame) {
! // Zero positions to avoid random behaviour on failure.
! memset(positions, 0, len * sizeof(*positions));
! // len may be larger than platform supports so loop over segments small enough for platform
! int startOffset = 0;
! while (len > 0) {
! int lenBlock = Platform::Minimum(len, maxLenText);
! if (!::GetTextExtentExPointA(hdc, s, lenBlock, maxWidthMeasure, &fit, positions, &sz)) {
! // Eeek - a NULL DC or other foolishness could cause this.
! return;
! } else if (fit < lenBlock) {
! // For some reason, such as an incomplete DBCS character
! // Not all the positions are filled in so make them equal to end.
! for (int i=fit;i<lenBlock;i++)
! positions[i] = positions[fit-1];
! } else if (startOffset > 0) {
! for (int i=0;i<lenBlock;i++)
! positions[i] += startOffset;
! }
! startOffset = positions[lenBlock-1];
! len -= lenBlock;
! positions += lenBlock;
! s += lenBlock;
}
} else {
// Support Asian string display in 9x English
! const TextWide tbuf(s, len, unicodeMode, codePage);
! TextPositions poses(tbuf.tlen);
! for (int widthSS=0; widthSS<tbuf.tlen; widthSS++) {
! ::GetTextExtentPoint32W(hdc, tbuf.buffer, widthSS+1, &sz);
! poses.buffer[widthSS] = sz.cx;
}
***************
*** 826,834 ****
for (int i=0;i<len;) {
if (::IsDBCSLeadByteEx(codePage, s[i])) {
! positions[i] = poses[ui];
! positions[i+1] = poses[ui];
i += 2;
} else {
! positions[i] = poses[ui];
i++;
}
--- 866,874 ----
for (int i=0;i<len;) {
if (::IsDBCSLeadByteEx(codePage, s[i])) {
! positions[i] = poses.buffer[ui];
! positions[i+1] = poses.buffer[ui];
i += 2;
} else {
! positions[i] = poses.buffer[ui];
i++;
}
***************
*** 1343,1350 ****
int len = widestItem ? strlen(widestItem) : 0;
if (unicodeMode) {
! wchar_t tbuf[MAX_US_LEN];
! len = UTF16FromUTF8(widestItem, len, tbuf, sizeof(tbuf)/sizeof(wchar_t)-1);
! tbuf[len] = L'\0';
! ::GetTextExtentPoint32W(hdc, tbuf, len, &textSize);
} else {
::GetTextExtentPoint32A(hdc, widestItem, len, &textSize);
--- 1383,1388 ----
int len = widestItem ? strlen(widestItem) : 0;
if (unicodeMode) {
! const TextWide tbuf(widestItem, len, unicodeMode);
! ::GetTextExtentPoint32W(hdc, tbuf.buffer, tbuf.tlen, &textSize);
} else {
::GetTextExtentPoint32A(hdc, widestItem, len, &textSize);
***************
*** 1462,1469 ****
if (unicodeMode) {
! wchar_t tbuf[MAX_US_LEN];
! int tlen = UTF16FromUTF8(text, len, tbuf, sizeof(tbuf)/sizeof(wchar_t)-1);
! tbuf[tlen] = L'\0';
! ::DrawTextW(pDrawItem->hDC, tbuf, tlen, &rcText, DT_NOPREFIX|DT_END_ELLIPSIS|DT_SINGLELINE|DT_NOCLIP);
} else {
::DrawTextA(pDrawItem->hDC, text, len, &rcText, DT_NOPREFIX|DT_END_ELLIPSIS|DT_SINGLELINE|DT_NOCLIP);
--- 1500,1505 ----
if (unicodeMode) {
! const TextWide tbuf(text, len, unicodeMode);
! ::DrawTextW(pDrawItem->hDC, tbuf.buffer, tbuf.tlen, &rcText, DT_NOPREFIX|DT_END_ELLIPSIS|DT_SINGLELINE|DT_NOCLIP);
} else {
::DrawTextA(pDrawItem->hDC, text, len, &rcText, DT_NOPREFIX|DT_END_ELLIPSIS|DT_SINGLELINE|DT_NOCLIP);
Index: ScintillaWin.cxx
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/Scintilla/win32/ScintillaWin.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ScintillaWin.cxx 10 Feb 2008 11:01:48 -0000 1.15
--- ScintillaWin.cxx 31 Jan 2009 03:03:14 -0000 1.16
***************
*** 100,103 ****
--- 100,107 ----
const TCHAR callClassName[] = TEXT("CallTip");
+ #ifdef SCI_NAMESPACE
+ using namespace Scintilla;
+ #endif
+
class ScintillaWin; // Forward declaration for COM interface subobjects
***************
*** 280,283 ****
--- 284,288 ----
int sysCaretWidth;
int sysCaretHeight;
+ bool keysAlwaysUnicode;
};
***************
*** 317,320 ****
--- 322,327 ----
sysCaretHeight = 0;
+ keysAlwaysUnicode = false;
+
Initialise();
}
***************
*** 729,732 ****
--- 736,744 ----
break;
+ case WM_RBUTTONDOWN:
+ if (!PointInSelection(Point::FromLong(lParam)))
+ SetEmptySelection(PositionFromLocation(Point::FromLong(lParam)));
+ break;
+
case WM_SETCURSOR:
if (LoWord(lParam) == HTCLIENT) {
***************
*** 755,759 ****
case WM_CHAR:
if (((wParam >= 128) || !iscntrl(wParam)) || !lastKeyDownConsumed) {
! if (::IsWindowUnicode(MainHWND())) {
wchar_t wcs[2] = {wParam, 0};
if (IsUnicodeMode()) {
--- 767,771 ----
case WM_CHAR:
if (((wParam >= 128) || !iscntrl(wParam)) || !lastKeyDownConsumed) {
! if (::IsWindowUnicode(MainHWND()) || keysAlwaysUnicode) {
wchar_t wcs[2] = {wParam, 0};
if (IsUnicodeMode()) {
***************
*** 1003,1006 ****
--- 1015,1025 ----
break;
+ case SCI_SETKEYSUNICODE:
+ keysAlwaysUnicode = wParam != 0;
+ break;
+
+ case SCI_GETKEYSUNICODE:
+ return keysAlwaysUnicode;
+
#ifdef SCI_LEXER
case SCI_LOADLEXERLIBRARY:
***************
*** 2243,2247 ****
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW;
! wndclass.lpfnWndProc = ::ScintillaWin::SWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = sizeof(ScintillaWin *);
--- 2262,2266 ----
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW;
! wndclass.lpfnWndProc = ScintillaWin::SWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = sizeof(ScintillaWin *);
***************
*** 2260,2264 ****
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW;
! wndclass.lpfnWndProc = ::ScintillaWin::SWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = sizeof(ScintillaWin *);
--- 2279,2283 ----
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW;
! wndclass.lpfnWndProc = ScintillaWin::SWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = sizeof(ScintillaWin *);
***************
*** 2422,2426 ****
}
! extern "C" __declspec(dllexport) sptr_t __stdcall Scintilla_DirectFunction(
ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam) {
return sci->WndProc(iMessage, wParam, lParam);
--- 2441,2449 ----
}
! extern "C"
! #ifndef STATIC_BUILD
! __declspec(dllexport)
! #endif
! sptr_t __stdcall Scintilla_DirectFunction(
ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam) {
return sci->WndProc(iMessage, wParam, lParam);
Index: scintilla_vc6.mak
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/Scintilla/win32/scintilla_vc6.mak,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** scintilla_vc6.mak 4 Apr 2008 04:57:33 -0000 1.5
--- scintilla_vc6.mak 31 Jan 2009 03:03:14 -0000 1.6
***************
*** 44,48 ****
# If you have problems with lexers being linked, try removing -OPT:REF and replacing with -OPT:NOREF
LDFLAGS=-OPT:NOWIN98 -OPT:REF
! LDDEBUG= /DEBUG
LIBS=KERNEL32.lib USER32.lib GDI32.lib IMM32.lib OLE32.LIB
NOLOGO=-nologo
--- 44,48 ----
# If you have problems with lexers being linked, try removing -OPT:REF and replacing with -OPT:NOREF
LDFLAGS=-OPT:NOWIN98 -OPT:REF
! LDDEBUG=
LIBS=KERNEL32.lib USER32.lib GDI32.lib IMM32.lib OLE32.LIB
NOLOGO=-nologo
***************
*** 158,161 ****
--- 158,162 ----
$(DIR_O)\LexMPT.obj \
$(DIR_O)\LexMSSQL.obj \
+ $(DIR_O)\LexMySQL.obj \
$(DIR_O)\LexNsis.obj \
$(DIR_O)\LexOpal.obj \
***************
*** 392,395 ****
--- 393,398 ----
$(DIR_O)\LexMSSQL.obj: ..\src\LexMSSQL.cxx $(LEX_HEADERS)
+ $(DIR_O)\LexMySQL.obj: ..\src\LexMySQL.cxx $(LEX_HEADERS)
+
$(DIR_O)\LexNsis.obj: ..\src\LexNsis.cxx $(LEX_HEADERS)
Index: ScintRes.rc
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/Scintilla/win32/ScintRes.rc,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ScintRes.rc 10 Feb 2008 11:01:48 -0000 1.12
--- ScintRes.rc 31 Jan 2009 03:03:14 -0000 1.13
***************
*** 10,15 ****
VS_VERSION_INFO VERSIONINFO
! FILEVERSION 1, 7, 5, 0
! PRODUCTVERSION 1, 7, 5, 0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0
--- 10,15 ----
VS_VERSION_INFO VERSIONINFO
! FILEVERSION 1, 7, 7, 0
! PRODUCTVERSION 1, 7, 7, 0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0
***************
*** 28,37 ****
VALUE "CompanyName", "Neil Hodgson ne...@sc...\0"
VALUE "FileDescription", "Scintilla.DLL - a Source Editing Component\0"
! VALUE "FileVersion", "1.75\0"
VALUE "InternalName", "Scintilla\0"
! VALUE "LegalCopyright", "Copyright 1998-2007 by Neil Hodgson\0"
VALUE "OriginalFilename", "Scintilla.DLL\0"
VALUE "ProductName", "Scintilla\0"
! VALUE "ProductVersion", "1.75\0"
END
END
--- 28,37 ----
VALUE "CompanyName", "Neil Hodgson ne...@sc...\0"
VALUE "FileDescription", "Scintilla.DLL - a Source Editing Component\0"
! VALUE "FileVersion", "1.77\0"
VALUE "InternalName", "Scintilla\0"
! VALUE "LegalCopyright", "Copyright 1998-2008 by Neil Hodgson\0"
VALUE "OriginalFilename", "Scintilla.DLL\0"
VALUE "ProductName", "Scintilla\0"
! VALUE "ProductVersion", "1.77\0"
END
END
Index: scintilla.mak
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/Scintilla/win32/scintilla.mak,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** scintilla.mak 10 Feb 2008 11:01:48 -0000 1.7
--- scintilla.mak 31 Jan 2009 03:03:14 -0000 1.8
***************
*** 156,159 ****
--- 156,160 ----
$(DIR_O)\LexMPT.obj \
$(DIR_O)\LexMSSQL.obj \
+ $(DIR_O)\LexMySQL.obj \
$(DIR_O)\LexNsis.obj \
$(DIR_O)\LexOpal.obj \
***************
*** 390,393 ****
--- 391,396 ----
$(DIR_O)\LexMSSQL.obj: ..\src\LexMSSQL.cxx $(LEX_HEADERS)
+ $(DIR_O)\LexMySQL.obj: ..\src\LexMySQL.cxx $(LEX_HEADERS)
+
$(DIR_O)\LexNsis.obj: ..\src\LexNsis.cxx $(LEX_HEADERS)
|