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:
@@ -1303,9 +1303,7 @@ public:
|
|||||||
int GetPrintColourMode();
|
int GetPrintColourMode();
|
||||||
|
|
||||||
// Find some text in the document.
|
// Find some text in the document.
|
||||||
int FindText(int minPos, int maxPos,
|
int FindText(int minPos, int maxPos, const wxString& text, int flags=0);
|
||||||
const wxString& text,
|
|
||||||
bool caseSensitive, bool wholeWord);
|
|
||||||
|
|
||||||
// On Windows will draw the document into a display context such as a printer.
|
// On Windows will draw the document into a display context such as a printer.
|
||||||
int FormatRange(bool doDraw,
|
int FormatRange(bool doDraw,
|
||||||
|
@@ -82,6 +82,16 @@ methodOverrideMap = {
|
|||||||
'GetViewWS' : ( 'GetViewWhiteSpace', 0, 0, 0),
|
'GetViewWS' : ( 'GetViewWhiteSpace', 0, 0, 0),
|
||||||
'SetViewWS' : ( 'SetViewWhiteSpace', 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,
|
'GetStyledText' : (0,
|
||||||
'wxMemoryBuffer %s(int startPos, int endPos);',
|
'wxMemoryBuffer %s(int startPos, int endPos);',
|
||||||
|
|
||||||
@@ -236,17 +246,12 @@ methodOverrideMap = {
|
|||||||
'GetUsePalette' : (None, 0, 0, 0),
|
'GetUsePalette' : (None, 0, 0, 0),
|
||||||
|
|
||||||
'FindText' : (0,
|
'FindText' : (0,
|
||||||
'''int %s(int minPos, int maxPos,
|
'''int %s(int minPos, int maxPos, const wxString& text, int flags=0);''',
|
||||||
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;
|
|
||||||
|
|
||||||
flags |= caseSensitive ? SCFIND_MATCHCASE : 0;
|
'''int %s(int minPos, int maxPos,
|
||||||
flags |= wholeWord ? SCFIND_WHOLEWORD : 0;
|
const wxString& text,
|
||||||
|
int flags) {
|
||||||
|
TextToFind ft;
|
||||||
ft.chrg.cpMin = minPos;
|
ft.chrg.cpMin = minPos;
|
||||||
ft.chrg.cpMax = maxPos;
|
ft.chrg.cpMax = maxPos;
|
||||||
ft.lpstrText = (char*)(const char*)wx2stc(text);
|
ft.lpstrText = (char*)(const char*)wx2stc(text);
|
||||||
@@ -642,6 +647,7 @@ def checkMethodOverride(name, number, docs):
|
|||||||
if methodOverrideMap.has_key(name):
|
if methodOverrideMap.has_key(name):
|
||||||
item = methodOverrideMap[name]
|
item = methodOverrideMap[name]
|
||||||
|
|
||||||
|
try:
|
||||||
if item[0] != 0:
|
if item[0] != 0:
|
||||||
name = item[0]
|
name = item[0]
|
||||||
if item[1] != 0:
|
if item[1] != 0:
|
||||||
@@ -650,6 +656,9 @@ def checkMethodOverride(name, number, docs):
|
|||||||
theImp = item[2] % ('wxStyledTextCtrl::'+name, number) + '\n}'
|
theImp = item[2] % ('wxStyledTextCtrl::'+name, number) + '\n}'
|
||||||
if item[3] != 0:
|
if item[3] != 0:
|
||||||
docs = item[3]
|
docs = item[3]
|
||||||
|
except:
|
||||||
|
print "*************", name
|
||||||
|
raise
|
||||||
|
|
||||||
return name, theDef, theImp, docs
|
return name, theDef, theImp, docs
|
||||||
|
|
||||||
|
@@ -197,7 +197,7 @@ int wxStyledTextCtrl::GetLength() {
|
|||||||
|
|
||||||
// Returns the character byte at the position
|
// Returns the character byte at the position
|
||||||
int wxStyledTextCtrl::GetCharAt(int pos) {
|
int wxStyledTextCtrl::GetCharAt(int pos) {
|
||||||
return SendMsg(2007, pos, 0);
|
return (unsigned char)SendMsg(2007, pos, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the position of the caret
|
// Returns the position of the caret
|
||||||
@@ -212,7 +212,7 @@ int wxStyledTextCtrl::GetAnchor() {
|
|||||||
|
|
||||||
// Returns the style byte at the position
|
// Returns the style byte at the position
|
||||||
int wxStyledTextCtrl::GetStyleAt(int pos) {
|
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
|
// Redoes the next action on the undo history
|
||||||
@@ -947,12 +947,8 @@ int wxStyledTextCtrl::GetPrintColourMode() {
|
|||||||
// Find some text in the document.
|
// Find some text in the document.
|
||||||
int wxStyledTextCtrl::FindText(int minPos, int maxPos,
|
int wxStyledTextCtrl::FindText(int minPos, int maxPos,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
bool caseSensitive, bool wholeWord) {
|
int flags) {
|
||||||
TextToFind ft;
|
TextToFind ft;
|
||||||
int flags = 0;
|
|
||||||
|
|
||||||
flags |= caseSensitive ? SCFIND_MATCHCASE : 0;
|
|
||||||
flags |= wholeWord ? SCFIND_WHOLEWORD : 0;
|
|
||||||
ft.chrg.cpMin = minPos;
|
ft.chrg.cpMin = minPos;
|
||||||
ft.chrg.cpMax = maxPos;
|
ft.chrg.cpMax = maxPos;
|
||||||
ft.lpstrText = (char*)(const char*)wx2stc(text);
|
ft.lpstrText = (char*)(const char*)wx2stc(text);
|
||||||
|
@@ -1303,9 +1303,7 @@ public:
|
|||||||
int GetPrintColourMode();
|
int GetPrintColourMode();
|
||||||
|
|
||||||
// Find some text in the document.
|
// Find some text in the document.
|
||||||
int FindText(int minPos, int maxPos,
|
int FindText(int minPos, int maxPos, const wxString& text, int flags=0);
|
||||||
const wxString& text,
|
|
||||||
bool caseSensitive, bool wholeWord);
|
|
||||||
|
|
||||||
// On Windows will draw the document into a display context such as a printer.
|
// On Windows will draw the document into a display context such as a printer.
|
||||||
int FormatRange(bool doDraw,
|
int FormatRange(bool doDraw,
|
||||||
|
@@ -82,6 +82,16 @@ methodOverrideMap = {
|
|||||||
'GetViewWS' : ( 'GetViewWhiteSpace', 0, 0, 0),
|
'GetViewWS' : ( 'GetViewWhiteSpace', 0, 0, 0),
|
||||||
'SetViewWS' : ( 'SetViewWhiteSpace', 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,
|
'GetStyledText' : (0,
|
||||||
'wxMemoryBuffer %s(int startPos, int endPos);',
|
'wxMemoryBuffer %s(int startPos, int endPos);',
|
||||||
|
|
||||||
@@ -236,17 +246,12 @@ methodOverrideMap = {
|
|||||||
'GetUsePalette' : (None, 0, 0, 0),
|
'GetUsePalette' : (None, 0, 0, 0),
|
||||||
|
|
||||||
'FindText' : (0,
|
'FindText' : (0,
|
||||||
'''int %s(int minPos, int maxPos,
|
'''int %s(int minPos, int maxPos, const wxString& text, int flags=0);''',
|
||||||
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;
|
|
||||||
|
|
||||||
flags |= caseSensitive ? SCFIND_MATCHCASE : 0;
|
'''int %s(int minPos, int maxPos,
|
||||||
flags |= wholeWord ? SCFIND_WHOLEWORD : 0;
|
const wxString& text,
|
||||||
|
int flags) {
|
||||||
|
TextToFind ft;
|
||||||
ft.chrg.cpMin = minPos;
|
ft.chrg.cpMin = minPos;
|
||||||
ft.chrg.cpMax = maxPos;
|
ft.chrg.cpMax = maxPos;
|
||||||
ft.lpstrText = (char*)(const char*)wx2stc(text);
|
ft.lpstrText = (char*)(const char*)wx2stc(text);
|
||||||
@@ -642,6 +647,7 @@ def checkMethodOverride(name, number, docs):
|
|||||||
if methodOverrideMap.has_key(name):
|
if methodOverrideMap.has_key(name):
|
||||||
item = methodOverrideMap[name]
|
item = methodOverrideMap[name]
|
||||||
|
|
||||||
|
try:
|
||||||
if item[0] != 0:
|
if item[0] != 0:
|
||||||
name = item[0]
|
name = item[0]
|
||||||
if item[1] != 0:
|
if item[1] != 0:
|
||||||
@@ -650,6 +656,9 @@ def checkMethodOverride(name, number, docs):
|
|||||||
theImp = item[2] % ('wxStyledTextCtrl::'+name, number) + '\n}'
|
theImp = item[2] % ('wxStyledTextCtrl::'+name, number) + '\n}'
|
||||||
if item[3] != 0:
|
if item[3] != 0:
|
||||||
docs = item[3]
|
docs = item[3]
|
||||||
|
except:
|
||||||
|
print "*************", name
|
||||||
|
raise
|
||||||
|
|
||||||
return name, theDef, theImp, docs
|
return name, theDef, theImp, docs
|
||||||
|
|
||||||
|
@@ -197,7 +197,7 @@ int wxStyledTextCtrl::GetLength() {
|
|||||||
|
|
||||||
// Returns the character byte at the position
|
// Returns the character byte at the position
|
||||||
int wxStyledTextCtrl::GetCharAt(int pos) {
|
int wxStyledTextCtrl::GetCharAt(int pos) {
|
||||||
return SendMsg(2007, pos, 0);
|
return (unsigned char)SendMsg(2007, pos, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the position of the caret
|
// Returns the position of the caret
|
||||||
@@ -212,7 +212,7 @@ int wxStyledTextCtrl::GetAnchor() {
|
|||||||
|
|
||||||
// Returns the style byte at the position
|
// Returns the style byte at the position
|
||||||
int wxStyledTextCtrl::GetStyleAt(int pos) {
|
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
|
// Redoes the next action on the undo history
|
||||||
@@ -947,12 +947,8 @@ int wxStyledTextCtrl::GetPrintColourMode() {
|
|||||||
// Find some text in the document.
|
// Find some text in the document.
|
||||||
int wxStyledTextCtrl::FindText(int minPos, int maxPos,
|
int wxStyledTextCtrl::FindText(int minPos, int maxPos,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
bool caseSensitive, bool wholeWord) {
|
int flags) {
|
||||||
TextToFind ft;
|
TextToFind ft;
|
||||||
int flags = 0;
|
|
||||||
|
|
||||||
flags |= caseSensitive ? SCFIND_MATCHCASE : 0;
|
|
||||||
flags |= wholeWord ? SCFIND_WHOLEWORD : 0;
|
|
||||||
ft.chrg.cpMin = minPos;
|
ft.chrg.cpMin = minPos;
|
||||||
ft.chrg.cpMax = maxPos;
|
ft.chrg.cpMax = maxPos;
|
||||||
ft.lpstrText = (char*)(const char*)wx2stc(text);
|
ft.lpstrText = (char*)(const char*)wx2stc(text);
|
||||||
|
@@ -4562,7 +4562,7 @@ static PyObject *_wrap_wxStyledTextCtrl_GetPrintColourMode(PyObject *self, PyObj
|
|||||||
return _resultobj;
|
return _resultobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define wxStyledTextCtrl_FindText(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4) (_swigobj->FindText(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4))
|
#define wxStyledTextCtrl_FindText(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->FindText(_swigarg0,_swigarg1,_swigarg2,_swigarg3))
|
||||||
static PyObject *_wrap_wxStyledTextCtrl_FindText(PyObject *self, PyObject *args, PyObject *kwargs) {
|
static PyObject *_wrap_wxStyledTextCtrl_FindText(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
PyObject * _resultobj;
|
PyObject * _resultobj;
|
||||||
int _result;
|
int _result;
|
||||||
@@ -4570,16 +4570,13 @@ static PyObject *_wrap_wxStyledTextCtrl_FindText(PyObject *self, PyObject *args,
|
|||||||
int _arg1;
|
int _arg1;
|
||||||
int _arg2;
|
int _arg2;
|
||||||
wxString * _arg3;
|
wxString * _arg3;
|
||||||
bool _arg4;
|
int _arg4 = (int ) 0;
|
||||||
bool _arg5;
|
|
||||||
PyObject * _argo0 = 0;
|
PyObject * _argo0 = 0;
|
||||||
PyObject * _obj3 = 0;
|
PyObject * _obj3 = 0;
|
||||||
int tempbool4;
|
char *_kwnames[] = { "self","minPos","maxPos","text","flags", NULL };
|
||||||
int tempbool5;
|
|
||||||
char *_kwnames[] = { "self","minPos","maxPos","text","caseSensitive","wholeWord", NULL };
|
|
||||||
|
|
||||||
self = self;
|
self = self;
|
||||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiiOii:wxStyledTextCtrl_FindText",_kwnames,&_argo0,&_arg1,&_arg2,&_obj3,&tempbool4,&tempbool5))
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiiO|i:wxStyledTextCtrl_FindText",_kwnames,&_argo0,&_arg1,&_arg2,&_obj3,&_arg4))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (_argo0) {
|
if (_argo0) {
|
||||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
@@ -4593,11 +4590,9 @@ static PyObject *_wrap_wxStyledTextCtrl_FindText(PyObject *self, PyObject *args,
|
|||||||
if (_arg3 == NULL)
|
if (_arg3 == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
_arg4 = (bool ) tempbool4;
|
|
||||||
_arg5 = (bool ) tempbool5;
|
|
||||||
{
|
{
|
||||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
_result = (int )wxStyledTextCtrl_FindText(_arg0,_arg1,_arg2,*_arg3,_arg4,_arg5);
|
_result = (int )wxStyledTextCtrl_FindText(_arg0,_arg1,_arg2,*_arg3,_arg4);
|
||||||
|
|
||||||
wxPyEndAllowThreads(__tstate);
|
wxPyEndAllowThreads(__tstate);
|
||||||
if (PyErr_Occurred()) return NULL;
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
Reference in New Issue
Block a user