Changed FindTExt intercase to more easily handle additional flags.

Fixed GetCharAt and GetStyleAt to only return values 0..255 instead of
possibly negative values.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15745 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-06-04 19:25:29 +00:00
parent d8ddee9c46
commit c13219d6a8
7 changed files with 69 additions and 68 deletions

View File

@@ -1303,9 +1303,7 @@ public:
int GetPrintColourMode();
// Find some text in the document.
int FindText(int minPos, int maxPos,
const wxString& text,
bool caseSensitive, bool wholeWord);
int FindText(int minPos, int maxPos, const wxString& text, int flags=0);
// On Windows will draw the document into a display context such as a printer.
int FormatRange(bool doDraw,

View File

@@ -82,6 +82,16 @@ methodOverrideMap = {
'GetViewWS' : ( 'GetViewWhiteSpace', 0, 0, 0),
'SetViewWS' : ( 'SetViewWhiteSpace', 0, 0, 0),
'GetCharAt' : ( 0, 0,
'''int %s(int pos) {
return (unsigned char)SendMsg(%s, pos, 0);''',
0),
'GetStyleAt' : ( 0, 0,
'''int %s(int pos) {
return (unsigned char)SendMsg(%s, pos, 0);''',
0),
'GetStyledText' : (0,
'wxMemoryBuffer %s(int startPos, int endPos);',
@@ -236,17 +246,12 @@ methodOverrideMap = {
'GetUsePalette' : (None, 0, 0, 0),
'FindText' : (0,
'''int %s(int minPos, int maxPos,
const wxString& text,
bool caseSensitive, bool wholeWord);''',
'''int %s(int minPos, int maxPos,
const wxString& text,
bool caseSensitive, bool wholeWord) {
TextToFind ft;
int flags = 0;
'''int %s(int minPos, int maxPos, const wxString& text, int flags=0);''',
flags |= caseSensitive ? SCFIND_MATCHCASE : 0;
flags |= wholeWord ? SCFIND_WHOLEWORD : 0;
'''int %s(int minPos, int maxPos,
const wxString& text,
int flags) {
TextToFind ft;
ft.chrg.cpMin = minPos;
ft.chrg.cpMax = maxPos;
ft.lpstrText = (char*)(const char*)wx2stc(text);
@@ -642,14 +647,18 @@ def checkMethodOverride(name, number, docs):
if methodOverrideMap.has_key(name):
item = methodOverrideMap[name]
if item[0] != 0:
name = item[0]
if item[1] != 0:
theDef = ' ' + (item[1] % name)
if item[2] != 0:
theImp = item[2] % ('wxStyledTextCtrl::'+name, number) + '\n}'
if item[3] != 0:
docs = item[3]
try:
if item[0] != 0:
name = item[0]
if item[1] != 0:
theDef = ' ' + (item[1] % name)
if item[2] != 0:
theImp = item[2] % ('wxStyledTextCtrl::'+name, number) + '\n}'
if item[3] != 0:
docs = item[3]
except:
print "*************", name
raise
return name, theDef, theImp, docs

View File

@@ -197,7 +197,7 @@ int wxStyledTextCtrl::GetLength() {
// Returns the character byte at the position
int wxStyledTextCtrl::GetCharAt(int pos) {
return SendMsg(2007, pos, 0);
return (unsigned char)SendMsg(2007, pos, 0);
}
// Returns the position of the caret
@@ -212,7 +212,7 @@ int wxStyledTextCtrl::GetAnchor() {
// Returns the style byte at the position
int wxStyledTextCtrl::GetStyleAt(int pos) {
return SendMsg(2010, pos, 0);
return (unsigned char)SendMsg(2010, pos, 0);
}
// Redoes the next action on the undo history
@@ -946,13 +946,9 @@ int wxStyledTextCtrl::GetPrintColourMode() {
// Find some text in the document.
int wxStyledTextCtrl::FindText(int minPos, int maxPos,
const wxString& text,
bool caseSensitive, bool wholeWord) {
const wxString& text,
int flags) {
TextToFind ft;
int flags = 0;
flags |= caseSensitive ? SCFIND_MATCHCASE : 0;
flags |= wholeWord ? SCFIND_WHOLEWORD : 0;
ft.chrg.cpMin = minPos;
ft.chrg.cpMax = maxPos;
ft.lpstrText = (char*)(const char*)wx2stc(text);