A couple little fixes for wxSTC

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11559 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-09-04 23:42:13 +00:00
parent 33381c829b
commit 8de28db94f
8 changed files with 104 additions and 58 deletions

View File

@@ -734,7 +734,11 @@ public:
// Retrieve the text of the line containing the caret. // Retrieve the text of the line containing the caret.
// Returns the index of the caret on the line. // Returns the index of the caret on the line.
wxString GetCurLine(int* OUTPUT=NULL); #ifdef SWIG
wxString GetCurLine(int* OUTPUT);
#else
wxString GetCurLine(int* linePos=NULL);
#endif
// Retrieve the position of the last correctly styled character. // Retrieve the position of the last correctly styled character.
int GetEndStyled(); int GetEndStyled();
@@ -1417,10 +1421,10 @@ public:
int GetModEventMask(); int GetModEventMask();
// Change internal focus flag // Change internal focus flag
void SetFocus(bool focus); void SetSTCFocus(bool focus);
// Get internal focus flag // Get internal focus flag
bool GetFocus(); bool GetSTCFocus();
// Change error status - 0 = OK // Change error status - 0 = OK
void SetStatus(int statusCode); void SetStatus(int statusCode);

View File

@@ -108,15 +108,19 @@ methodOverrideMap = {
0), 0),
'GetCurLine' : (0, 'GetCurLine' : (0,
'wxString %s(int* OUTPUT=NULL);', '#ifdef SWIG\n wxString %s(int* OUTPUT);\n#else\n wxString GetCurLine(int* linePos=NULL);\n#endif',
'''wxString %s(int* linePos) { '''wxString %s(int* linePos) {
wxString text; wxString text;
int len = LineLength(GetCurrentLine()); int len = LineLength(GetCurrentLine());
if (!len) return ""; if (!len) {
char* buf = text.GetWriteBuf(len); if (linePos) *linePos = 0;
return "";
}
// Need an extra byte because SCI_GETCURLINE writes a null to the string
char* buf = text.GetWriteBuf(len+1);
int pos = SendMsg(%s, len, (long)buf); int pos = SendMsg(%s, len+1, (long)buf);
text.UngetWriteBuf(len); text.UngetWriteBuf(len);
if (linePos) *linePos = pos; if (linePos) *linePos = pos;
@@ -346,11 +350,11 @@ methodOverrideMap = {
'''wxString %s() { '''wxString %s() {
wxString text; wxString text;
int len = GetTextLength()+1; int len = GetTextLength();
char* buff = text.GetWriteBuf(len); char* buff = text.GetWriteBuf(len+1); // leave room for the null...
SendMsg(%s, len, (long)buff); SendMsg(%s, len+1, (long)buff);
text.UngetWriteBuf(len-1); text.UngetWriteBuf(len);
return text;''', return text;''',
('Retrieve all the text in the document.', )), ('Retrieve all the text in the document.', )),
@@ -474,6 +478,9 @@ methodOverrideMap = {
0), 0),
'GrabFocus' : (None, 0, 0, 0), 'GrabFocus' : (None, 0, 0, 0),
'SetFocus' : ('SetSTCFocus', 0, 0, 0),
'GetFocus' : ('GetSTCFocus', 0, 0, 0),
'' : ('', 0, 0, 0), '' : ('', 0, 0, 0),

View File

@@ -25,23 +25,31 @@ OBJECTS = \
$(D)\Indicator.obj \ $(D)\Indicator.obj \
$(D)\KeyMap.obj \ $(D)\KeyMap.obj \
$(D)\KeyWords.obj \ $(D)\KeyWords.obj \
$(D)\LexCPP.obj \
$(D)\LexHTML.obj \
$(D)\LexLua.obj \
$(D)\LexOthers.obj \
$(D)\LexPerl.obj \
$(D)\LexPython.obj \
$(D)\LexSQL.obj \
$(D)\LexVB.obj \
$(D)\LineMarker.obj \ $(D)\LineMarker.obj \
$(D)\PosRegExp.obj \
$(D)\PropSet.obj \ $(D)\PropSet.obj \
$(D)\RESearch.obj \
$(D)\ScintillaBase.obj \ $(D)\ScintillaBase.obj \
$(D)\Style.obj \ $(D)\Style.obj \
$(D)\UniConversion.obj \ $(D)\UniConversion.obj \
$(D)\ViewStyle.obj \ $(D)\ViewStyle.obj \
$(D)\WindowAccessor.obj \ $(D)\WindowAccessor.obj \
\ \
$(D)\LexAda.obj \
$(D)\LexAVE.obj \
$(D)\LexConf.obj \
$(D)\LexCPP.obj \
$(D)\LexEiffel.obj \
$(D)\LexHTML.obj \
$(D)\LexLisp.obj \
$(D)\LexLua.obj \
$(D)\LexOthers.obj \
$(D)\LexPascal.obj \
$(D)\LexPerl.obj \
$(D)\LexPython.obj \
$(D)\LexRuby.obj \
$(D)\LexSQL.obj \
$(D)\LexVB.obj \
\
$(D)\PlatWX.obj \ $(D)\PlatWX.obj \
$(D)\ScintillaWX.obj \ $(D)\ScintillaWX.obj \
$(D)\stc.obj \ $(D)\stc.obj \

View File

@@ -338,10 +338,14 @@ void wxStyledTextCtrl::SetAnchor(int posAnchor) {
wxString wxStyledTextCtrl::GetCurLine(int* linePos) { wxString wxStyledTextCtrl::GetCurLine(int* linePos) {
wxString text; wxString text;
int len = LineLength(GetCurrentLine()); int len = LineLength(GetCurrentLine());
if (!len) return ""; if (!len) {
char* buf = text.GetWriteBuf(len); if (linePos) *linePos = 0;
return "";
}
// Need an extra byte because SCI_GETCURLINE writes a null to the string
char* buf = text.GetWriteBuf(len+1);
int pos = SendMsg(2027, len, (long)buf); int pos = SendMsg(2027, len+1, (long)buf);
text.UngetWriteBuf(len); text.UngetWriteBuf(len);
if (linePos) *linePos = pos; if (linePos) *linePos = pos;
@@ -1141,11 +1145,11 @@ void wxStyledTextCtrl::SetText(const wxString& text) {
// Retrieve all the text in the document. // Retrieve all the text in the document.
wxString wxStyledTextCtrl::GetText() { wxString wxStyledTextCtrl::GetText() {
wxString text; wxString text;
int len = GetTextLength()+1; int len = GetTextLength();
char* buff = text.GetWriteBuf(len); char* buff = text.GetWriteBuf(len+1); // leave room for the null...
SendMsg(2182, len, (long)buff); SendMsg(2182, len+1, (long)buff);
text.UngetWriteBuf(len-1); text.UngetWriteBuf(len);
return text; return text;
} }
@@ -1526,12 +1530,12 @@ int wxStyledTextCtrl::GetModEventMask() {
} }
// Change internal focus flag // Change internal focus flag
void wxStyledTextCtrl::SetFocus(bool focus) { void wxStyledTextCtrl::SetSTCFocus(bool focus) {
SendMsg(2380, focus, 0); SendMsg(2380, focus, 0);
} }
// Get internal focus flag // Get internal focus flag
bool wxStyledTextCtrl::GetFocus() { bool wxStyledTextCtrl::GetSTCFocus() {
return SendMsg(2381, 0, 0) != 0; return SendMsg(2381, 0, 0) != 0;
} }

View File

@@ -734,7 +734,11 @@ public:
// Retrieve the text of the line containing the caret. // Retrieve the text of the line containing the caret.
// Returns the index of the caret on the line. // Returns the index of the caret on the line.
wxString GetCurLine(int* OUTPUT=NULL); #ifdef SWIG
wxString GetCurLine(int* OUTPUT);
#else
wxString GetCurLine(int* linePos=NULL);
#endif
// Retrieve the position of the last correctly styled character. // Retrieve the position of the last correctly styled character.
int GetEndStyled(); int GetEndStyled();
@@ -1417,10 +1421,10 @@ public:
int GetModEventMask(); int GetModEventMask();
// Change internal focus flag // Change internal focus flag
void SetFocus(bool focus); void SetSTCFocus(bool focus);
// Get internal focus flag // Get internal focus flag
bool GetFocus(); bool GetSTCFocus();
// Change error status - 0 = OK // Change error status - 0 = OK
void SetStatus(int statusCode); void SetStatus(int statusCode);

View File

@@ -108,15 +108,19 @@ methodOverrideMap = {
0), 0),
'GetCurLine' : (0, 'GetCurLine' : (0,
'wxString %s(int* OUTPUT=NULL);', '#ifdef SWIG\n wxString %s(int* OUTPUT);\n#else\n wxString GetCurLine(int* linePos=NULL);\n#endif',
'''wxString %s(int* linePos) { '''wxString %s(int* linePos) {
wxString text; wxString text;
int len = LineLength(GetCurrentLine()); int len = LineLength(GetCurrentLine());
if (!len) return ""; if (!len) {
char* buf = text.GetWriteBuf(len); if (linePos) *linePos = 0;
return "";
}
// Need an extra byte because SCI_GETCURLINE writes a null to the string
char* buf = text.GetWriteBuf(len+1);
int pos = SendMsg(%s, len, (long)buf); int pos = SendMsg(%s, len+1, (long)buf);
text.UngetWriteBuf(len); text.UngetWriteBuf(len);
if (linePos) *linePos = pos; if (linePos) *linePos = pos;
@@ -346,11 +350,11 @@ methodOverrideMap = {
'''wxString %s() { '''wxString %s() {
wxString text; wxString text;
int len = GetTextLength()+1; int len = GetTextLength();
char* buff = text.GetWriteBuf(len); char* buff = text.GetWriteBuf(len+1); // leave room for the null...
SendMsg(%s, len, (long)buff); SendMsg(%s, len+1, (long)buff);
text.UngetWriteBuf(len-1); text.UngetWriteBuf(len);
return text;''', return text;''',
('Retrieve all the text in the document.', )), ('Retrieve all the text in the document.', )),
@@ -474,6 +478,9 @@ methodOverrideMap = {
0), 0),
'GrabFocus' : (None, 0, 0, 0), 'GrabFocus' : (None, 0, 0, 0),
'SetFocus' : ('SetSTCFocus', 0, 0, 0),
'GetFocus' : ('GetSTCFocus', 0, 0, 0),
'' : ('', 0, 0, 0), '' : ('', 0, 0, 0),

View File

@@ -25,23 +25,31 @@ OBJECTS = \
$(D)\Indicator.obj \ $(D)\Indicator.obj \
$(D)\KeyMap.obj \ $(D)\KeyMap.obj \
$(D)\KeyWords.obj \ $(D)\KeyWords.obj \
$(D)\LexCPP.obj \
$(D)\LexHTML.obj \
$(D)\LexLua.obj \
$(D)\LexOthers.obj \
$(D)\LexPerl.obj \
$(D)\LexPython.obj \
$(D)\LexSQL.obj \
$(D)\LexVB.obj \
$(D)\LineMarker.obj \ $(D)\LineMarker.obj \
$(D)\PosRegExp.obj \
$(D)\PropSet.obj \ $(D)\PropSet.obj \
$(D)\RESearch.obj \
$(D)\ScintillaBase.obj \ $(D)\ScintillaBase.obj \
$(D)\Style.obj \ $(D)\Style.obj \
$(D)\UniConversion.obj \ $(D)\UniConversion.obj \
$(D)\ViewStyle.obj \ $(D)\ViewStyle.obj \
$(D)\WindowAccessor.obj \ $(D)\WindowAccessor.obj \
\ \
$(D)\LexAda.obj \
$(D)\LexAVE.obj \
$(D)\LexConf.obj \
$(D)\LexCPP.obj \
$(D)\LexEiffel.obj \
$(D)\LexHTML.obj \
$(D)\LexLisp.obj \
$(D)\LexLua.obj \
$(D)\LexOthers.obj \
$(D)\LexPascal.obj \
$(D)\LexPerl.obj \
$(D)\LexPython.obj \
$(D)\LexRuby.obj \
$(D)\LexSQL.obj \
$(D)\LexVB.obj \
\
$(D)\PlatWX.obj \ $(D)\PlatWX.obj \
$(D)\ScintillaWX.obj \ $(D)\ScintillaWX.obj \
$(D)\stc.obj \ $(D)\stc.obj \

View File

@@ -338,10 +338,14 @@ void wxStyledTextCtrl::SetAnchor(int posAnchor) {
wxString wxStyledTextCtrl::GetCurLine(int* linePos) { wxString wxStyledTextCtrl::GetCurLine(int* linePos) {
wxString text; wxString text;
int len = LineLength(GetCurrentLine()); int len = LineLength(GetCurrentLine());
if (!len) return ""; if (!len) {
char* buf = text.GetWriteBuf(len); if (linePos) *linePos = 0;
return "";
}
// Need an extra byte because SCI_GETCURLINE writes a null to the string
char* buf = text.GetWriteBuf(len+1);
int pos = SendMsg(2027, len, (long)buf); int pos = SendMsg(2027, len+1, (long)buf);
text.UngetWriteBuf(len); text.UngetWriteBuf(len);
if (linePos) *linePos = pos; if (linePos) *linePos = pos;
@@ -1141,11 +1145,11 @@ void wxStyledTextCtrl::SetText(const wxString& text) {
// Retrieve all the text in the document. // Retrieve all the text in the document.
wxString wxStyledTextCtrl::GetText() { wxString wxStyledTextCtrl::GetText() {
wxString text; wxString text;
int len = GetTextLength()+1; int len = GetTextLength();
char* buff = text.GetWriteBuf(len); char* buff = text.GetWriteBuf(len+1); // leave room for the null...
SendMsg(2182, len, (long)buff); SendMsg(2182, len+1, (long)buff);
text.UngetWriteBuf(len-1); text.UngetWriteBuf(len);
return text; return text;
} }
@@ -1526,12 +1530,12 @@ int wxStyledTextCtrl::GetModEventMask() {
} }
// Change internal focus flag // Change internal focus flag
void wxStyledTextCtrl::SetFocus(bool focus) { void wxStyledTextCtrl::SetSTCFocus(bool focus) {
SendMsg(2380, focus, 0); SendMsg(2380, focus, 0);
} }
// Get internal focus flag // Get internal focus flag
bool wxStyledTextCtrl::GetFocus() { bool wxStyledTextCtrl::GetSTCFocus() {
return SendMsg(2381, 0, 0) != 0; return SendMsg(2381, 0, 0) != 0;
} }