X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5d8301397cb1582616ea504f7ab0dee869761c8f..cfeff6f71c716a19a9651b176dce26534c4da216:/src/x11/textctrl.cpp?ds=sidebyside diff --git a/src/x11/textctrl.cpp b/src/x11/textctrl.cpp index 50329f67fe..3b778c72a9 100644 --- a/src/x11/textctrl.cpp +++ b/src/x11/textctrl.cpp @@ -7,11 +7,12 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "textctrl.h" #endif #include "wx/textctrl.h" + #include "wx/utils.h" #include "wx/intl.h" #include "wx/log.h" @@ -19,6 +20,7 @@ #include "wx/panel.h" #include "wx/clipbrd.h" #include "wx/tokenzr.h" +#include "wx/dcclient.h" #include "wx/univ/inphand.h" #include "wx/univ/renderer.h" @@ -52,7 +54,7 @@ wxSourceUndoStep::wxSourceUndoStep( wxSourceUndo type, int y1, int y2, wxTextCtr for (int i = m_y1; i < m_y2+2; i++) { if (i >= (int)m_owner->m_lines.GetCount()) - m_lines.Add( "" ); + m_lines.Add( wxT("") ); else m_lines.Add( m_owner->m_lines[i].m_text ); } @@ -134,7 +136,6 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground) EVT_CHAR(wxTextCtrl::OnChar) EVT_MOUSE_EVENTS(wxTextCtrl::OnMouse) - EVT_IDLE(wxTextCtrl::OnIdle) EVT_KILL_FOCUS(wxTextCtrl::OnKillFocus) EVT_SET_FOCUS(wxTextCtrl::OnSetFocus) @@ -156,8 +157,6 @@ void wxTextCtrl::Init() m_editable = TRUE; m_modified = FALSE; - m_undos.DeleteContents( TRUE ); - m_lang = wxSOURCE_LANG_NONE; m_capturing = FALSE; @@ -201,6 +200,11 @@ wxTextCtrl::wxTextCtrl( wxWindow *parent, Create( parent, id, value, pos, size, style, validator, name ); } +wxTextCtrl::~wxTextCtrl() +{ + WX_CLEAR_LIST(wxList, m_undos); +} + bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, @@ -217,7 +221,7 @@ bool wxTextCtrl::Create( wxWindow *parent, style |= wxALWAYS_SHOW_SB; wxTextCtrlBase::Create( parent, id, pos /* wxDefaultPosition */, size, - style|wxVSCROLL|wxHSCROLL|wxNO_FULL_REPAINT_ON_RESIZE ); + style | wxVSCROLL | wxHSCROLL); SetBackgroundColour( *wxWHITE ); @@ -275,12 +279,8 @@ void wxTextCtrl::SetValue(const wxString& value) { m_modified = FALSE; - if ((GetWindowStyle() & wxTE_MULTILINE) == 0) - { - if (value == GetValue()) - return; - } - + wxString oldValue = GetValue(); + m_cursorX = 0; m_cursorY = 0; ClearSelection(); @@ -330,6 +330,13 @@ void wxTextCtrl::SetValue(const wxString& value) } } } + + // Don't need to refresh if the value hasn't changed + if ((GetWindowStyle() & wxTE_MULTILINE) == 0) + { + if (value == oldValue) + return; + } MyAdjustScrollbars(); @@ -369,6 +376,17 @@ bool wxTextCtrl::IsEditable() const void wxTextCtrl::GetSelection(long* from, long* to) const { + if (m_selStartX == -1 || m_selStartY == -1 || + m_selEndX == -1 || m_selEndY == -1) + { + *from = GetInsertionPoint(); + *to = GetInsertionPoint(); + } + else + { + *from = XYToPosition(m_selStartX, m_selStartY); + *to = XYToPosition(m_selEndX, m_selEndY); + } } void wxTextCtrl::Clear() @@ -383,7 +401,7 @@ void wxTextCtrl::Clear() SetScrollbars( m_charWidth, m_lineHeight, 0, 0, 0, 0 ); Refresh(); - m_undos.Clear(); + WX_CLEAR_LIST(wxList, m_undos); } void wxTextCtrl::Replace(long from, long to, const wxString& value) @@ -455,184 +473,6 @@ void wxTextCtrl::SetLanguage( wxSourceLanguage lang ) m_lang = lang; m_keywords.Clear(); - - if (m_lang == wxSOURCE_LANG_PYTHON) - { - m_keywords.Add( "class" ); - m_keywords.Add( "__init__" ); - m_keywords.Add( "return" ); - m_keywords.Add( "def" ); - m_keywords.Add( "try" ); - m_keywords.Add( "except" ); - m_keywords.Add( "if" ); - m_keywords.Add( "else" ); - m_keywords.Add( "finally" ); - m_keywords.Add( "for" ); - m_keywords.Add( "if" ); - m_keywords.Add( "elif" ); - m_keywords.Add( "in" ); - m_keywords.Add( "and" ); - m_keywords.Add( "del" ); - m_keywords.Add( "is" ); - m_keywords.Add( "raise" ); - m_keywords.Add( "assert" ); - m_keywords.Add( "lambda" ); - m_keywords.Add( "break" ); - m_keywords.Add( "global" ); - m_keywords.Add( "not" ); - m_keywords.Add( "or" ); - m_keywords.Add( "while" ); - m_keywords.Add( "continue" ); - m_keywords.Add( "exec" ); - m_keywords.Add( "pass" ); - m_keywords.Add( "print" ); - } else - if (m_lang == wxSOURCE_LANG_PERL) - { - m_keywords.Add( "main" ); - m_keywords.Add( "sub" ); - m_keywords.Add( "shift" ); - m_keywords.Add( "push" ); - m_keywords.Add( "split" ); - m_keywords.Add( "join" ); - m_keywords.Add( "chop" ); - m_keywords.Add( "grep" ); - m_keywords.Add( "open" ); - m_keywords.Add( "print" ); - m_keywords.Add( "sprint" ); - m_keywords.Add( "printf" ); - m_keywords.Add( "sprintf" ); - m_keywords.Add( "my" ); - m_keywords.Add( "local" ); - m_keywords.Add( "exit" ); - m_keywords.Add( "die" ); - m_keywords.Add( "return" ); - m_keywords.Add( "for" ); - m_keywords.Add( "foreach" ); - m_keywords.Add( "while" ); - m_keywords.Add( "unless" ); - m_keywords.Add( "if" ); - m_keywords.Add( "next" ); - m_keywords.Add( "last" ); - m_keywords.Add( "else" ); - m_keywords.Add( "elsif" ); - m_keywords.Add( "ne" ); - m_keywords.Add( "qe" ); - } - else - if (m_lang == wxSOURCE_LANG_CPP) - { - m_keywords.Add( "class" ); - m_keywords.Add( "return" ); - m_keywords.Add( "if" ); - m_keywords.Add( "then" ); - m_keywords.Add( "else" ); - m_keywords.Add( "struct" ); - m_keywords.Add( "enum" ); - m_keywords.Add( "while" ); - m_keywords.Add( "do" ); - m_keywords.Add( "for" ); - m_keywords.Add( "continue" ); - m_keywords.Add( "break" ); - m_keywords.Add( "switch" ); - m_keywords.Add( "case" ); - m_keywords.Add( "goto" ); - m_keywords.Add( "label" ); - m_keywords.Add( "inline" ); - m_keywords.Add( "operator" ); - m_keywords.Add( "virtual" ); - m_keywords.Add( "private" ); - m_keywords.Add( "public" ); - m_keywords.Add( "protected" ); - m_keywords.Add( "friend" ); - m_keywords.Add( "exception" ); - m_keywords.Add( "throw" ); - m_keywords.Add( "catch" ); - m_keywords.Add( "delete" ); - m_keywords.Add( "new" ); - m_keywords.Add( "default" ); - m_keywords.Add( "overload" ); - m_keywords.Add( "using" ); - m_keywords.Add( "template" ); - m_keywords.Add( "try" ); - m_keywords.Add( "typedef" ); - m_keywords.Add( "union" ); - m_keywords.Add( "volatile" ); - m_keywords.Add( "asm" ); - } - - m_defines.Clear(); - - if (m_lang == wxSOURCE_LANG_PYTHON) - { - m_defines.Add( "from" ); - m_defines.Add( "import" ); - } else - if (m_lang == wxSOURCE_LANG_PERL) - { - m_defines.Add( "use" ); - m_defines.Add( "do" ); - m_defines.Add( "package" ); - m_defines.Add( "defined" ); - } else - if (m_lang == wxSOURCE_LANG_CPP) - { - m_defines.Add( "#define" ); - m_defines.Add( "#if" ); - m_defines.Add( "#ifndef" ); - m_defines.Add( "#ifdef" ); - m_defines.Add( "#else" ); - m_defines.Add( "#elif" ); - m_defines.Add( "#endif" ); - m_defines.Add( "#pragma" ); - m_defines.Add( "#include" ); - } - - m_variables.Clear(); - - if (m_lang == wxSOURCE_LANG_PYTHON) - { - m_variables.Add( "nil" ); - m_variables.Add( "None" ); - m_variables.Add( "self" ); - m_variables.Add( "false" ); - m_variables.Add( "true" ); - } else - if (m_lang == wxSOURCE_LANG_PERL) - { - m_variables.Add( "undef" ); - m_variables.Add( "class" ); - m_variables.Add( "this" ); - m_variables.Add( "IN" ); - m_variables.Add( "OUT" ); - m_variables.Add( "STDIN" ); - m_variables.Add( "STDOUT" ); - m_variables.Add( "STDERR" ); - } else - if (m_lang == wxSOURCE_LANG_CPP) - { - m_variables.Add( "int" ); - m_variables.Add( "bool" ); - m_variables.Add( "void" ); - m_variables.Add( "long" ); - m_variables.Add( "short" ); - m_variables.Add( "const" ); - m_variables.Add( "signed" ); - m_variables.Add( "unsigned" ); - m_variables.Add( "char" ); - m_variables.Add( "size_t" ); - m_variables.Add( "wchar_t" ); - m_variables.Add( "NULL" ); - m_variables.Add( "this" ); - m_variables.Add( "TRUE" ); - m_variables.Add( "FALSE" ); - m_variables.Add( "float" ); - m_variables.Add( "double" ); - m_variables.Add( "register" ); - m_variables.Add( "extern" ); - m_variables.Add( "static" ); - m_variables.Add( "sizeof" ); - } } void wxTextCtrl::WriteText(const wxString& text2) @@ -749,14 +589,15 @@ long wxTextCtrl::XYToPosition(long x, long y) const { if (i < (size_t)y) { - ret += m_lines[i].m_text.Len(); + // Add one for the end-of-line character + ret += m_lines[i].m_text.Len() + 1; continue; } - if ((size_t)x < m_lines[i].m_text.Len()) + if ((size_t)x < (m_lines[i].m_text.Len()+1)) return (ret + x); else - return (ret + m_lines[i].m_text.Len()); + return (ret + m_lines[i].m_text.Len() + 1); } return ret; @@ -777,19 +618,25 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const for (size_t i = 0; i < m_lines.GetCount(); i++) { - pos -= m_lines[i].m_text.Len(); - if (pos <= 0) + //pos -= m_lines[i].m_text.Len(); + //if (pos <= 0) + + // Add one for the end-of-line character. (In Windows, + // there are _two_ positions for each end of line.) + if (pos <= ((int)m_lines[i].m_text.Len())) { - xx = -pos; + xx = pos; if (x) *x = xx; if (y) *y = yy; return TRUE; } + pos -= (m_lines[i].m_text.Len() + 1); yy++; } // Last pos - xx = m_lines[ m_lines.GetCount()-1 ].m_text.Len(); + //xx = m_lines[ m_lines.GetCount()-1 ].m_text.Len(); + xx = pos; if (x) *x = xx; if (y) *y = yy; @@ -841,12 +688,12 @@ void wxTextCtrl::Copy() { tmp.Remove( 0, selStartX ); sel = tmp; - sel.Append( "\n" ); + sel.Append( wxT("\n") ); } for (int i = selStartY+1; i < selEndY; i++) { sel.Append( m_lines[i].m_text ); - sel.Append( "\n" ); + sel.Append( wxT("\n") ); } tmp = m_lines[selEndY].m_text; if (selEndX > (int)tmp.Len()) @@ -951,22 +798,31 @@ void wxTextCtrl::Undo() { if (m_undos.GetCount() == 0) return; - wxNode *node = m_undos.Nth( m_undos.GetCount()-1 ); - wxSourceUndoStep *undo = (wxSourceUndoStep*) node->Data(); + wxList::compatibility_iterator node = m_undos.Item( m_undos.GetCount()-1 ); + wxSourceUndoStep *undo = (wxSourceUndoStep*) node->GetData(); undo->Undo(); - - delete node; + + delete undo; + m_undos.Erase( node ); m_modified = TRUE; } void wxTextCtrl::SetInsertionPoint(long pos) { + ClearSelection(); + long x, y; + PositionToXY(pos, & x, & y); + m_cursorX = x; + m_cursorY = y; + // TODO: scroll to this position if necessary + Refresh(); } void wxTextCtrl::SetInsertionPointEnd() { + SetInsertionPoint(GetLastPosition()); } long wxTextCtrl::GetInsertionPoint() const @@ -977,7 +833,9 @@ long wxTextCtrl::GetInsertionPoint() const long wxTextCtrl::GetLastPosition() const { size_t lineCount = m_lines.GetCount() - 1; - return XYToPosition( m_lines[lineCount].m_text.Len()-1, lineCount ); + // It's the length of the line, not the length - 1, + // because there's a position after the last character. + return XYToPosition( m_lines[lineCount].m_text.Len(), lineCount ); } void wxTextCtrl::SetSelection(long from, long to) @@ -1040,7 +898,7 @@ void wxTextCtrl::SearchForBrackets() char bracket = ' '; if (m_cursorX > 0) - bracket = current[m_cursorX-1]; + bracket = current[(size_t) (m_cursorX-1)]; if (bracket == ')' || bracket == ']' || bracket == '}') { @@ -1061,13 +919,13 @@ void wxTextCtrl::SearchForBrackets() for (int n = current.Len()-1; n >= 0; n--) { // ignore chars - if (current[n] == '\'') + if (current[(size_t) (n)] == '\'') { for (int m = n-1; m >= 0; m--) { - if (current[m] == '\'') + if (current[(size_t) (m)] == '\'') { - if (m == 0 || current[m-1] != '\\') + if (m == 0 || current[(size_t) (m-1)] != '\\') break; } n = m-1; @@ -1076,13 +934,13 @@ void wxTextCtrl::SearchForBrackets() } // ignore strings - if (current[n] == '\"') + if (current[(size_t) (n)] == '\"') { for (int m = n-1; m >= 0; m--) { - if (current[m] == '\"') + if (current[(size_t) (m)] == '\"') { - if (m == 0 || current[m-1] != '\\') + if (m == 0 || current[(size_t) (m-1)] != '\\') break; } n = m-1; @@ -1090,7 +948,7 @@ void wxTextCtrl::SearchForBrackets() continue; } - if (current[n] == antibracket) + if (current[(size_t) (n)] == antibracket) { count--; if (count == 0) @@ -1104,7 +962,7 @@ void wxTextCtrl::SearchForBrackets() return; } } - else if (current[n] == bracket) + else if (current[(size_t) (n)] == bracket) { count++; } @@ -1116,7 +974,7 @@ void wxTextCtrl::SearchForBrackets() bracket = ' '; if ((int)current.Len() > m_cursorX) - bracket = current[m_cursorX]; + bracket = current[(size_t) (m_cursorX)]; if (bracket == '(' || bracket == '[' || bracket == '{') { char antibracket = ')'; @@ -1137,13 +995,13 @@ void wxTextCtrl::SearchForBrackets() for (int n = start; n < (int)current.Len(); n++) { // ignore chars - if (current[n] == '\'') + if (current[(size_t) (n)] == '\'') { for (int m = n+1; m < (int)current.Len(); m++) { - if (current[m] == '\'') + if (current[(size_t) (m)] == '\'') { - if (m == 0 || (current[m-1] != '\\') || (m >= 2 && current[m-2] == '\\')) + if (m == 0 || (current[(size_t) (m-1)] != '\\') || (m >= 2 && current[(size_t) (m-2)] == '\\')) break; } n = m+1; @@ -1152,13 +1010,13 @@ void wxTextCtrl::SearchForBrackets() } // ignore strings - if (current[n] == '\"') + if (current[(size_t) (n)] == '\"') { for (int m = n+1; m < (int)current.Len(); m++) { - if (current[m] == '\"') + if (current[(size_t) (m)] == '\"') { - if (m == 0 || (current[m-1] != '\\') || (m >= 2 && current[m-2] == '\\')) + if (m == 0 || (current[(size_t) (m-1)] != '\\') || (m >= 2 && current[(size_t) (m-2)] == '\\')) break; } n = m+1; @@ -1166,7 +1024,7 @@ void wxTextCtrl::SearchForBrackets() continue; } - if (current[n] == antibracket) + if (current[(size_t) (n)] == antibracket) { count--; if (count == 0) @@ -1180,7 +1038,7 @@ void wxTextCtrl::SearchForBrackets() return; } } - else if (current[n] == bracket) + else if (current[(size_t) (n)] == bracket) { count++; } @@ -1484,7 +1342,7 @@ void wxTextCtrl::DoDClick() wxString line( m_lines[ m_cursorY ].m_text ); if (m_cursorX >= (int)line.Len()) return; int p = m_cursorX; - char ch = line[p]; + char ch = line[(size_t) (p)]; if (((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9')) || @@ -1494,7 +1352,7 @@ void wxTextCtrl::DoDClick() m_selEndY = m_cursorY; if (p > 0) { - ch = line[p-1]; + ch = line[(size_t) (p-1)]; while (((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9')) || @@ -1502,7 +1360,7 @@ void wxTextCtrl::DoDClick() { p--; if (p == 0) break; - ch = line[p-1]; + ch = line[(size_t) (p-1)]; } } m_selStartX = p; @@ -1510,7 +1368,7 @@ void wxTextCtrl::DoDClick() p = m_cursorX; if (p < (int)line.Len()) { - ch = line[p]; + ch = line[(size_t) (p)]; while (((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9')) || @@ -1518,7 +1376,7 @@ void wxTextCtrl::DoDClick() { if (p >= (int)line.Len()) break; p++; - ch = line[p]; + ch = line[(size_t) (p)]; } } m_selEndX = p; @@ -1544,7 +1402,7 @@ wxString wxTextCtrl::GetNextToken( wxString &line, size_t &pos ) } else { - if ((line[p] == '/') && (p+1 < len) && (line[p+1] == '/')) + if ((line[p] == '/') && (p+1 < len) && (line[(size_t) (p+1)] == '/')) { for (size_t q = p; q < len; q++) ret.Append( line[q] ); @@ -1559,7 +1417,7 @@ wxString wxTextCtrl::GetNextToken( wxString &line, size_t &pos ) for (size_t q = p+1; q < len; q++) { ret.Append( line[q] ); - if ((line[q] == '"') && ((line[q-1] != '\\') || (q >= 2 && line[q-2] == '\\'))) + if ((line[q] == '"') && ((line[(size_t) (q-1)] != '\\') || (q >= 2 && line[(size_t) (q-2)] == '\\'))) break; } pos = p; @@ -1572,7 +1430,7 @@ wxString wxTextCtrl::GetNextToken( wxString &line, size_t &pos ) for (size_t q = p+1; q < len; q++) { ret.Append( line[q] ); - if ((line[q] == '\'') && ((line[q-1] != '\\') || (q >= 2 && line[q-2] == '\\'))) + if ((line[q] == '\'') && ((line[(size_t) (q-1)] != '\\') || (q >= 2 && line[(size_t) (q-2)] == '\\'))) break; } pos = p; @@ -1686,7 +1544,7 @@ void wxTextCtrl::DrawLine( wxDC &dc, int x, int y, const wxString &line2, int li wxString red( ' ', line.Len() ); if (m_bracketX < (int)line.Len()) { - red.SetChar( m_bracketX, line[m_bracketX] ); + red.SetChar( m_bracketX, line[(size_t) (m_bracketX)] ); line.SetChar( m_bracketX, ' ' ); dc.SetTextForeground( *wxRED ); dc.DrawText( red, x, y ); @@ -1717,7 +1575,7 @@ void wxTextCtrl::DrawLine( wxDC &dc, int x, int y, const wxString &line2, int li } } else if ((m_variables.Index( token ) != wxNOT_FOUND) || - ((token.Len() > 2) && (token[0] == 'w') && (token[1] == 'x'))) + ((token.Len() > 2) && (token[(size_t) (0)] == 'w') && (token[(size_t) (1)] == 'x'))) { size_t end_pos = pos + token.Len(); for (size_t i = pos; i < end_pos; i++) @@ -1726,7 +1584,7 @@ void wxTextCtrl::DrawLine( wxDC &dc, int x, int y, const wxString &line2, int li line[i] = ' '; } } else - if ((token.Len() >= 2) && (token[0] == '/') && (token[1] == '/') && (m_lang == wxSOURCE_LANG_CPP)) + if ((token.Len() >= 2) && (token[(size_t) (0)] == '/') && (token[(size_t) (1)] == '/') && (m_lang == wxSOURCE_LANG_CPP)) { size_t end_pos = pos + token.Len(); for (size_t i = pos; i < end_pos; i++) @@ -1735,7 +1593,7 @@ void wxTextCtrl::DrawLine( wxDC &dc, int x, int y, const wxString &line2, int li line[i] = ' '; } } else - if ((token[0] == '#') && + if ((token[(size_t) (0)] == '#') && ((m_lang == wxSOURCE_LANG_PYTHON) || (m_lang == wxSOURCE_LANG_PERL))) { size_t end_pos = pos + token.Len(); @@ -1745,7 +1603,7 @@ void wxTextCtrl::DrawLine( wxDC &dc, int x, int y, const wxString &line2, int li line[i] = ' '; } } else - if ((token[0] == '"') || (token[0] == '\'')) + if ((token[(size_t) (0)] == '"') || (token[(size_t) (0)] == '\'')) { size_t end_pos = pos + token.Len(); for (size_t i = pos; i < end_pos; i++) @@ -2084,8 +1942,8 @@ void wxTextCtrl::OnChar( wxKeyEvent &event ) } default: { - if ( (event.KeyCode() >= 'a') && - (event.KeyCode() <= 'z') && + if ( (event.GetKeyCode() >= 'a') && + (event.GetKeyCode() <= 'z') && (event.AltDown()) ) { // Alt-F etc. @@ -2093,13 +1951,13 @@ void wxTextCtrl::OnChar( wxKeyEvent &event ) return; } - if ( (event.KeyCode() >= 32) && - (event.KeyCode() <= 255) && + if ( (event.GetKeyCode() >= 32) && + (event.GetKeyCode() <= 255) && !(event.ControlDown() && !event.AltDown()) ) // filters out Ctrl-X but leaves Alt-Gr { if (HasSelection()) Delete(); - DoChar( (char) event.KeyCode() ); + DoChar( (char) event.GetKeyCode() ); return; } } @@ -2108,14 +1966,14 @@ void wxTextCtrl::OnChar( wxKeyEvent &event ) event.Skip(); } -void wxTextCtrl::OnIdle( wxIdleEvent &event ) +void wxTextCtrl::OnInternalIdle() { + wxControl::OnInternalIdle(); + m_ignoreInput = FALSE; if (m_lang != wxSOURCE_LANG_NONE) SearchForBrackets(); - - event.Skip( TRUE ); } void wxTextCtrl::Indent() @@ -2138,7 +1996,7 @@ void wxTextCtrl::Indent() for (int i = startY; i <= endY; i++) { - m_lines[i].m_text.insert( 0u, " " ); + m_lines[i].m_text.insert( 0u, wxT(" ") ); RefreshLine( i ); } } @@ -2165,7 +2023,7 @@ void wxTextCtrl::Unindent() { for (int n = 0; n < 4; n++) { - if (m_lines[i].m_text[0u] == ' ') + if (m_lines[i].m_text[0u] == wxT(' ')) m_lines[i].m_text.erase(0u,1u); } RefreshLine( i ); @@ -2224,7 +2082,7 @@ void wxTextCtrl::MoveCursor( int new_x, int new_y, bool shift, bool centre ) // if (IsSingleLine() || (m_lang == wxSOURCE_LANG_NONE)) { - if (new_x > m_lines[new_y].m_text.Len()) + if (new_x > (int) (m_lines[new_y].m_text.Len())) new_x = m_lines[new_y].m_text.Len(); } @@ -2429,7 +2287,7 @@ void wxTextCtrl::MyAdjustScrollbars() int height = 0; GetClientSize( NULL, &height ); height -= 4; - if (height >= m_lines.GetCount() *m_lineHeight) + if (height >= (int)m_lines.GetCount() *m_lineHeight) y_range = 0; int view_x = 0;