diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 78dedf995e..b8794fcc45 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,11 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-15-15 16:03 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbqt/hbqt_hbqplaintextedit.cpp + * contrib/hbide/ideedit.prg + ! Fixed more artifacts about reverse selection/copy operations. + 2010-05-16 00:56 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/Makefile - contrib/hbwin/win_srv.c diff --git a/harbour/contrib/hbide/ideedit.prg b/harbour/contrib/hbide/ideedit.prg index 8be33fe3f3..1b90a047c4 100644 --- a/harbour/contrib/hbide/ideedit.prg +++ b/harbour/contrib/hbide/ideedit.prg @@ -764,12 +764,22 @@ METHOD IdeEdit:copyBlockContents( aCord ) cLine := ::getLine( i + 1 ) IF nMode == selectionMode_stream - IF i == nT .AND. i == nB - cLine := substr( cLine, min( aCord[ 2 ], aCord[ 4 ] ) + 1, nW ) - ELSEIF i == aCord[ 1 ] - cLine := substr( cLine, aCord[ 2 ] + 1 ) - ELSEIF i == aCord[ 3 ] - cLine := substr( cLine, 1, aCord[ 4 ] + 1 ) + IF aCord[ 1 ] > aCord[ 3 ] + IF i == nT .AND. i == nB + cLine := substr( cLine, min( aCord[ 2 ], aCord[ 4 ] ) + 1, nW ) + ELSEIF i == aCord[ 1 ] + cLine := substr( cLine, 1, aCord[ 2 ] ) + ELSEIF i == aCord[ 3 ] + cLine := substr( cLine, aCord[ 4 ] + 1 ) + ENDIF + ELSE + IF i == nT .AND. i == nB + cLine := substr( cLine, min( aCord[ 2 ], aCord[ 4 ] ) + 1, nW ) + ELSEIF i == aCord[ 1 ] + cLine := substr( cLine, aCord[ 2 ] + 1 ) + ELSEIF i == aCord[ 3 ] + cLine := substr( cLine, 1, aCord[ 4 ] ) + ENDIF ENDIF ELSEIF nMode == selectionMode_column @@ -847,13 +857,10 @@ METHOD IdeEdit:pasteBlockContents( nMode ) NEXT CASE nPasteMode == selectionMode_line + qCursor:movePosition( QTextCursor_StartOfLine, QTextCursor_MoveAnchor ) FOR i := 1 TO len( aCopy ) - qCursor:movePosition( QTextCursor_StartOfLine, QTextCursor_MoveAnchor ) - qCursor:movePosition( QTextCursor_EndOfLine , QTextCursor_KeepAnchor ) qCursor:insertText( aCopy[ i ] ) - IF i < len( aCopy ) - hbide_qCursorDownInsert( qCursor ) - ENDIF + qCursor:insertBlock() NEXT ENDCASE diff --git a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp index 80da35c0c9..224e0b49c9 100644 --- a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp +++ b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp @@ -629,6 +629,14 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event ) bool bClear = false; + if( shift && isNavableKey( k ) && selectionMode == selectionMode_line ) + { + selectionMode = selectionMode_stream; + selectionState = 0; + hbClearColumnSelection(); + repaint(); + } + if( selectionMode == selectionMode_column || selectionMode == selectionMode_stream ) { QTextCursor c( textCursor() ); @@ -637,6 +645,12 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event ) if( shift && isNavableKey( k ) ) { + if( selectionMode == selectionMode_line ) + { + selectionMode = selectionMode_stream; + selectionState = 0; + } + if( selectionState == 0 ) { hbClearColumnSelection(); @@ -648,7 +662,7 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event ) if( columnBegins == -1 ) { - selectionState = 1; + selectionState = 2; // rowBegins = row; columnBegins = col; @@ -808,7 +822,7 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event ) } else { - bClear = true; + // bClear = true; } } else @@ -1231,34 +1245,59 @@ void HBQPlainTextEdit::hbPaintSelection( QPaintEvent * event ) for( i = ( rb >= t ? rb : t ); i <= re; i++ ) { - if( i == rowBegins ) + if( rowBegins > rowEnds ) { - if( rb == re ) + if( i == rowEnds ) { - int x = ( ( cb - c ) * fontWidth ) + marginX; - int w = ( ce - cb ) * fontWidth; - r = QRect( x, top, w, fontHeight ); + if( rb == re ) + { + int x = ( ( cb - c ) * fontWidth ) + marginX; + int w = ( ce - cb ) * fontWidth; + r = QRect( x, top, w, fontHeight ); + } + else + { + int x = ( ( columnEnds - c ) * fontWidth ) + marginX; + r = QRect( x, top, width + abs( x ), fontHeight ); + } + } + else if( i == rowBegins ) + { + int x = ( ( columnBegins - c ) * fontWidth ) + marginX; + r = QRect( 0, top, x, fontHeight ); } else { - int x = ( ( columnBegins - c ) * fontWidth ) + marginX; - r = QRect( x, top, width + abs( x ), fontHeight ); + r = QRect( 0, top, width, fontHeight ); } } - else if( i == rowEnds ) - { - int x = ( ( columnEnds - c ) * fontWidth ) + marginX; - r = QRect( 0, top, x, fontHeight ); - } else { - r = QRect( 0, top, width, fontHeight ); - } - - //if( event->rect().intersects( r ) ) - { - p.fillRect( r, QBrush( m_selectionColor ) ); + if( i == rowBegins ) + { + if( rb == re ) + { + int x = ( ( cb - c ) * fontWidth ) + marginX; + int w = ( ce - cb ) * fontWidth; + r = QRect( x, top, w, fontHeight ); + } + else + { + int x = ( ( columnBegins - c ) * fontWidth ) + marginX; + r = QRect( x, top, width + abs( x ), fontHeight ); + } + } + else if( i == rowEnds ) + { + int x = ( ( columnEnds - c ) * fontWidth ) + marginX; + r = QRect( 0, top, x, fontHeight ); + } + else + { + r = QRect( 0, top, width, fontHeight ); + } } + p.fillRect( r, QBrush( m_selectionColor ) ); top += fontHeight; } }