- int i;
- wxString tmp1( line );
- wxString tmp2( line );
- dc.DrawRectangle( 0+2, lineNum*m_lineHeight+2,
- selEndX*m_charWidth, m_lineHeight );
- for (i = 0; i < selEndX; i++)
- if ((int)tmp1.Len() > i)
- tmp1.SetChar( i, ' ' );
- dc.DrawText( tmp1, x, y );
- for (i = selEndX; i < (int)tmp2.Len(); i++)
- tmp2.SetChar( i, ' ' );
- dc.SetTextForeground( *wxWHITE );
- dc.DrawText( tmp2, x, y );
- dc.SetTextForeground( *wxBLACK );
- }
-
- dc.SetTextForeground( m_keywordColour );
- dc.DrawText( keyword, x, y );
- dc.SetTextForeground( m_defineColour );
- dc.DrawText( define, x, y );
- dc.SetTextForeground( m_variableColour );
- dc.DrawText( variable, x, y );
- dc.SetTextForeground( m_commentColour );
- dc.DrawText( comment, x, y );
- dc.SetTextForeground( m_stringColour );
- dc.DrawText( my_string, x, y );
- dc.SetTextForeground( *wxBLACK );
+ // int ww = selEndX*m_charWidth;
+ int ww = PosToPixel( lineNum, selEndX );
+ dc.DrawRectangle( 0+2, lineNum*m_lineHeight+2, ww, m_lineHeight );
+
+ for (size_t i = 0; i < (size_t)selEndX; i++)
+ {
+ selection[i] = line[i];
+ line[i] = ' ';
+ }
+ }
+
+ DrawLinePart( dc, x, y, line, line2, *wxBLACK );
+ DrawLinePart( dc, x, y, selection, line2, *wxWHITE );
+ DrawLinePart( dc, x, y, keyword, line2, m_keywordColour );
+ DrawLinePart( dc, x, y, define, line2, m_defineColour );
+ DrawLinePart( dc, x, y, variable, line2, m_variableColour );
+ DrawLinePart( dc, x, y, comment, line2, m_commentColour );
+ DrawLinePart( dc, x, y, my_string, line2, m_stringColour );