diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 291181f2de..576dab1807 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,11 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-15-18 15:12 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/ideedit.prg + * contrib/hbqt/hbqt_hbqplaintextedit.cpp + ! Fixed: more selections and cursor behavior. + 2010-15-18 14:30 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/hbide.prg * contrib/hbide/ideedit.prg diff --git a/harbour/contrib/hbide/ideedit.prg b/harbour/contrib/hbide/ideedit.prg index 04f8ad0534..9c9dbb510d 100644 --- a/harbour/contrib/hbide/ideedit.prg +++ b/harbour/contrib/hbide/ideedit.prg @@ -760,14 +760,6 @@ STATIC FUNCTION hbide_qCursorDownInsert( qCursor ) /*----------------------------------------------------------------------*/ -METHOD IdeEdit:clearSelection() - - ::qEdit:hbSetSelectionInfo( { -1,-1,-1,-1,1 } ) - - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD IdeEdit:copyBlockContents( aCord ) LOCAL nT, nL, nB, nR, nW, i, cLine, nMode, qClip LOCAL cClip := "" @@ -1312,6 +1304,13 @@ METHOD IdeEdit:toggleLineSelectionMode() /*----------------------------------------------------------------------*/ +METHOD IdeEdit:clearSelection() + //::qEdit:hbSetSelectionInfo( { -1,-1,-1,-1,1 } ) + ::qEdit:hbSetSelectionMode( 0, .t. ) + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEdit:toggleCurrentLineHighlightMode() ::qEdit:hbHighlightCurrentLine( ::lCurrentLineHighlightEnabled ) RETURN Self diff --git a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp index 1eecc24b22..0ea53ecb21 100644 --- a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp +++ b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp @@ -389,6 +389,17 @@ void HBQPlainTextEdit::hbSetSelectionMode( int mode, bool byApplication ) { if( byApplication ) { + if( mode == 0 ) + { + isSelectionByApplication = false; + isStreamSelectionON = false; + isColumnSelectionON = false; + isLineSelectionON = false; + hbClearSelection(); + repaint(); + return; + } + isSelectionByApplication = ! isSelectionByApplication; if( ! isSelectionByApplication ) @@ -396,6 +407,18 @@ void HBQPlainTextEdit::hbSetSelectionMode( int mode, bool byApplication ) isStreamSelectionON = false; isColumnSelectionON = false; isLineSelectionON = false; + + if( mode == selectionMode_column ) + { + QTextCursor c( textCursor() ); + c.movePosition( QTextCursor::EndOfLine ); + if( c.columnNumber() > columnEnds ) + { + c.movePosition( QTextCursor::StartOfLine ); + c.movePosition( QTextCursor::Right, QTextCursor::MoveAnchor, columnEnds ); + } + setTextCursor( c ); + } setCursorWidth( 1 ); } else @@ -405,14 +428,17 @@ void HBQPlainTextEdit::hbSetSelectionMode( int mode, bool byApplication ) case selectionMode_stream: { setCursorWidth( 1 ); - if( columnBegins >= 0 ) - { - hbToStream(); - } selectionMode = selectionMode_stream; isStreamSelectionON = true; isColumnSelectionON = false; isLineSelectionON = false; + + QTextCursor c( textCursor() ); + + rowBegins = c.blockNumber(); + rowEnds = rowBegins; + columnBegins = c.columnNumber(); + columnEnds = columnBegins; break; } case selectionMode_column: @@ -460,19 +486,20 @@ void HBQPlainTextEdit::hbSetSelectionMode( int mode, bool byApplication ) { case selectionMode_stream: { + setCursorWidth( 1 ); if( columnBegins >= 0 ) { hbToStream(); } - selectionMode = selectionMode_stream; + selectionMode = selectionMode_stream; isColumnSelectionON = false; isLineSelectionON = false; - setCursorWidth( 1 ); break; } case selectionMode_column: { - selectionMode = selectionMode_column; + setCursorWidth( 0 ); + selectionMode = selectionMode_column; isColumnSelectionON = true; isLineSelectionON = false; break;