]> git.saurik.com Git - wxWidgets.git/commitdiff
A couple little fixes for wxSTC
authorRobin Dunn <robin@alldunn.com>
Tue, 4 Sep 2001 23:42:13 +0000 (23:42 +0000)
committerRobin Dunn <robin@alldunn.com>
Tue, 4 Sep 2001 23:42:13 +0000 (23:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11559 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

contrib/include/wx/stc/stc.h
contrib/src/stc/gen_iface.py
contrib/src/stc/makefile.vc
contrib/src/stc/stc.cpp
include/wx/stc/stc.h
src/stc/gen_iface.py
src/stc/makefile.vc
src/stc/stc.cpp

index 8dfe9a92f469b43ae27d631b00c5870bdb850e48..6618f7dec17ad491d8c3e07cf116f2c2eb6090ef 100644 (file)
@@ -734,7 +734,11 @@ public:
 
     // Retrieve the text of the line containing the caret.
     // 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.
     int GetEndStyled();
@@ -1417,10 +1421,10 @@ public:
     int GetModEventMask();
 
     // Change internal focus flag
-    void SetFocus(bool focus);
+    void SetSTCFocus(bool focus);
 
     // Get internal focus flag
-    bool GetFocus();
+    bool GetSTCFocus();
 
     // Change error status - 0 = OK
     void SetStatus(int statusCode);
index e198bdc6e0af7d48d44406324283e45e2d8d45bd..04303b82023120d3a0bfe90c9cb79038dd1a9b56 100644 (file)
@@ -108,15 +108,19 @@ methodOverrideMap = {
                            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 text;
                        int len = LineLength(GetCurrentLine());
-                       if (!len) return "";
-                       char* buf = text.GetWriteBuf(len);
-
-                       int pos = SendMsg(%s, len, (long)buf);
+                       if (!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+1, (long)buf);
                        text.UngetWriteBuf(len);
                        if (linePos)  *linePos = pos;
 
@@ -346,11 +350,11 @@ methodOverrideMap = {
 
                  '''wxString %s() {
                         wxString text;
-                        int   len  = GetTextLength()+1;
-                        char* buff = text.GetWriteBuf(len);
+                        int   len  = GetTextLength();
+                        char* buff = text.GetWriteBuf(len+1);  // leave room for the null...
 
-                        SendMsg(%s, len, (long)buff);
-                        text.UngetWriteBuf(len-1);
+                        SendMsg(%s, len+1, (long)buff);
+                        text.UngetWriteBuf(len);
                         return text;''',
 
                  ('Retrieve all the text in the document.', )),
@@ -474,6 +478,9 @@ methodOverrideMap = {
                          0),
 
     'GrabFocus' : (None, 0, 0, 0),
+    'SetFocus'  : ('SetSTCFocus', 0, 0, 0),
+    'GetFocus'  : ('GetSTCFocus', 0, 0, 0),
+
 
     '' : ('', 0, 0, 0),
 
index b8fce0a183987558e1dff1ed46d9e96ac683472b..fa0f4a7e77471f6ed7f70d5ee1bd2fe7d436377c 100644 (file)
@@ -25,22 +25,30 @@ OBJECTS = \
        $(D)\Indicator.obj      \
        $(D)\KeyMap.obj         \
        $(D)\KeyWords.obj       \
+       $(D)\LineMarker.obj     \
+       $(D)\PropSet.obj        \
+       $(D)\RESearch.obj       \
+       $(D)\ScintillaBase.obj  \
+       $(D)\Style.obj          \
+       $(D)\UniConversion.obj  \
+       $(D)\ViewStyle.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)\LineMarker.obj     \
-       $(D)\PosRegExp.obj      \
-       $(D)\PropSet.obj        \
-       $(D)\ScintillaBase.obj  \
-       $(D)\Style.obj          \
-       $(D)\UniConversion.obj  \
-       $(D)\ViewStyle.obj      \
-       $(D)\WindowAccessor.obj \
                                \
        $(D)\PlatWX.obj         \
        $(D)\ScintillaWX.obj    \
index 944df02c536d2af3533035265ef2cea0bb70e275..ba9cf82838cd84df4f5dd2f95462083621a67674 100644 (file)
@@ -338,10 +338,14 @@ void wxStyledTextCtrl::SetAnchor(int posAnchor) {
 wxString wxStyledTextCtrl::GetCurLine(int* linePos) {
                        wxString text;
                        int len = LineLength(GetCurrentLine());
-                       if (!len) return "";
-                       char* buf = text.GetWriteBuf(len);
-
-                       int pos = SendMsg(2027, len, (long)buf);
+                       if (!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+1, (long)buf);
                        text.UngetWriteBuf(len);
                        if (linePos)  *linePos = pos;
 
@@ -1141,11 +1145,11 @@ void wxStyledTextCtrl::SetText(const wxString& text) {
 // Retrieve all the text in the document.
 wxString wxStyledTextCtrl::GetText() {
                         wxString text;
-                        int   len  = GetTextLength()+1;
-                        char* buff = text.GetWriteBuf(len);
+                        int   len  = GetTextLength();
+                        char* buff = text.GetWriteBuf(len+1);  // leave room for the null...
 
-                        SendMsg(2182, len, (long)buff);
-                        text.UngetWriteBuf(len-1);
+                        SendMsg(2182, len+1, (long)buff);
+                        text.UngetWriteBuf(len);
                         return text;
 }
 
@@ -1526,12 +1530,12 @@ int wxStyledTextCtrl::GetModEventMask() {
 }
 
 // Change internal focus flag
-void wxStyledTextCtrl::SetFocus(bool focus) {
+void wxStyledTextCtrl::SetSTCFocus(bool focus) {
     SendMsg(2380, focus, 0);
 }
 
 // Get internal focus flag
-bool wxStyledTextCtrl::GetFocus() {
+bool wxStyledTextCtrl::GetSTCFocus() {
     return SendMsg(2381, 0, 0) != 0;
 }
 
index 8dfe9a92f469b43ae27d631b00c5870bdb850e48..6618f7dec17ad491d8c3e07cf116f2c2eb6090ef 100644 (file)
@@ -734,7 +734,11 @@ public:
 
     // Retrieve the text of the line containing the caret.
     // 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.
     int GetEndStyled();
@@ -1417,10 +1421,10 @@ public:
     int GetModEventMask();
 
     // Change internal focus flag
-    void SetFocus(bool focus);
+    void SetSTCFocus(bool focus);
 
     // Get internal focus flag
-    bool GetFocus();
+    bool GetSTCFocus();
 
     // Change error status - 0 = OK
     void SetStatus(int statusCode);
index e198bdc6e0af7d48d44406324283e45e2d8d45bd..04303b82023120d3a0bfe90c9cb79038dd1a9b56 100644 (file)
@@ -108,15 +108,19 @@ methodOverrideMap = {
                            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 text;
                        int len = LineLength(GetCurrentLine());
-                       if (!len) return "";
-                       char* buf = text.GetWriteBuf(len);
-
-                       int pos = SendMsg(%s, len, (long)buf);
+                       if (!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+1, (long)buf);
                        text.UngetWriteBuf(len);
                        if (linePos)  *linePos = pos;
 
@@ -346,11 +350,11 @@ methodOverrideMap = {
 
                  '''wxString %s() {
                         wxString text;
-                        int   len  = GetTextLength()+1;
-                        char* buff = text.GetWriteBuf(len);
+                        int   len  = GetTextLength();
+                        char* buff = text.GetWriteBuf(len+1);  // leave room for the null...
 
-                        SendMsg(%s, len, (long)buff);
-                        text.UngetWriteBuf(len-1);
+                        SendMsg(%s, len+1, (long)buff);
+                        text.UngetWriteBuf(len);
                         return text;''',
 
                  ('Retrieve all the text in the document.', )),
@@ -474,6 +478,9 @@ methodOverrideMap = {
                          0),
 
     'GrabFocus' : (None, 0, 0, 0),
+    'SetFocus'  : ('SetSTCFocus', 0, 0, 0),
+    'GetFocus'  : ('GetSTCFocus', 0, 0, 0),
+
 
     '' : ('', 0, 0, 0),
 
index b8fce0a183987558e1dff1ed46d9e96ac683472b..fa0f4a7e77471f6ed7f70d5ee1bd2fe7d436377c 100644 (file)
@@ -25,22 +25,30 @@ OBJECTS = \
        $(D)\Indicator.obj      \
        $(D)\KeyMap.obj         \
        $(D)\KeyWords.obj       \
+       $(D)\LineMarker.obj     \
+       $(D)\PropSet.obj        \
+       $(D)\RESearch.obj       \
+       $(D)\ScintillaBase.obj  \
+       $(D)\Style.obj          \
+       $(D)\UniConversion.obj  \
+       $(D)\ViewStyle.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)\LineMarker.obj     \
-       $(D)\PosRegExp.obj      \
-       $(D)\PropSet.obj        \
-       $(D)\ScintillaBase.obj  \
-       $(D)\Style.obj          \
-       $(D)\UniConversion.obj  \
-       $(D)\ViewStyle.obj      \
-       $(D)\WindowAccessor.obj \
                                \
        $(D)\PlatWX.obj         \
        $(D)\ScintillaWX.obj    \
index 944df02c536d2af3533035265ef2cea0bb70e275..ba9cf82838cd84df4f5dd2f95462083621a67674 100644 (file)
@@ -338,10 +338,14 @@ void wxStyledTextCtrl::SetAnchor(int posAnchor) {
 wxString wxStyledTextCtrl::GetCurLine(int* linePos) {
                        wxString text;
                        int len = LineLength(GetCurrentLine());
-                       if (!len) return "";
-                       char* buf = text.GetWriteBuf(len);
-
-                       int pos = SendMsg(2027, len, (long)buf);
+                       if (!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+1, (long)buf);
                        text.UngetWriteBuf(len);
                        if (linePos)  *linePos = pos;
 
@@ -1141,11 +1145,11 @@ void wxStyledTextCtrl::SetText(const wxString& text) {
 // Retrieve all the text in the document.
 wxString wxStyledTextCtrl::GetText() {
                         wxString text;
-                        int   len  = GetTextLength()+1;
-                        char* buff = text.GetWriteBuf(len);
+                        int   len  = GetTextLength();
+                        char* buff = text.GetWriteBuf(len+1);  // leave room for the null...
 
-                        SendMsg(2182, len, (long)buff);
-                        text.UngetWriteBuf(len-1);
+                        SendMsg(2182, len+1, (long)buff);
+                        text.UngetWriteBuf(len);
                         return text;
 }
 
@@ -1526,12 +1530,12 @@ int wxStyledTextCtrl::GetModEventMask() {
 }
 
 // Change internal focus flag
-void wxStyledTextCtrl::SetFocus(bool focus) {
+void wxStyledTextCtrl::SetSTCFocus(bool focus) {
     SendMsg(2380, focus, 0);
 }
 
 // Get internal focus flag
-bool wxStyledTextCtrl::GetFocus() {
+bool wxStyledTextCtrl::GetSTCFocus() {
     return SendMsg(2381, 0, 0) != 0;
 }