X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6d7b19b01379566b9f18a0e17f74afc2080dcf2c..66c2bf7b1d9326fb650acfaae22ec50528cfbf7c:/include/wx/stc/stc.h diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index ca27bc89f7..434783c223 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -12,7 +12,6 @@ // Author: Robin Dunn // // Created: 13-Jan-2000 -// RCS-ID: $Id$ // Copyright: (c) 2000 by Total Control Software // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -4557,8 +4556,8 @@ public: } virtual void Replace(long from, long to, const wxString& text) { - SetTargetStart(from); - SetTargetEnd(to); + SetTargetStart((int)from); + SetTargetEnd((int)to); ReplaceTarget(text); } @@ -4577,7 +4576,10 @@ public: */ - virtual void SetInsertionPoint(long pos) { SetCurrentPos(pos); } + virtual void SetInsertionPoint(long pos) + { + SetCurrentPos(int(pos == -1 ? GetLastPosition() : pos)); + } virtual long GetInsertionPoint() const { return GetCurrentPos(); } virtual long GetLastPosition() const { return GetTextLength(); } @@ -4589,8 +4591,8 @@ public: } else { - SetSelectionStart(from); - SetSelectionEnd(to); + SetSelectionStart((int)from); + SetSelectionEnd((int)to); } } @@ -4616,9 +4618,9 @@ public: long f, t; GetSelection(&f, &t); if ( from ) - *from = f; + *from = (int)f; if ( to ) - *to = t; + *to = (int)t; } #endif @@ -4628,8 +4630,18 @@ public: // implement wxTextAreaBase pure virtual methods // --------------------------------------------- - virtual int GetLineLength(long n) const { return GetLine(n).length(); } - virtual wxString GetLineText(long n) const { return GetLine(n); } + virtual int GetLineLength(long lineNo) const { return static_cast(GetLineText(lineNo).length()); } + virtual wxString GetLineText(long lineNo) const + { + wxString text = GetLine(static_cast(lineNo)); + size_t lastNewLine = text.find_last_not_of(wxS("\r\n")); + + if ( lastNewLine != wxString::npos ) + text.erase(lastNewLine + 1); // remove trailing cr+lf + else + text.clear(); + return text; + } virtual int GetNumberOfLines() const { return GetLineCount(); } virtual bool IsModified() const { return GetModify(); } @@ -4660,14 +4672,14 @@ public: virtual long XYToPosition(long x, long y) const { - long pos = PositionFromLine(y); + long pos = PositionFromLine((int)y); pos += x; return pos; } virtual bool PositionToXY(long pos, long *x, long *y) const { - long l = LineFromPosition(pos); + int l = LineFromPosition((int)pos); if ( l == -1 ) return false; @@ -4680,7 +4692,7 @@ public: return true; } - virtual void ShowPosition(long pos) { GotoPos(pos); } + virtual void ShowPosition(long pos) { GotoPos((int)pos); } // FIXME-VC6: can't use wxWindow here because of "error C2603: illegal // access declaration: 'wxWindow' is not a direct base of