2010-15-16 05:47 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbqt/hbqt_hbqplaintextedit.cpp
  * contrib/hbqt/hbqt_hbqplaintextedit.h
  * contrib/hbqt/qtgui/HBQPlainTextEdit.cpp
  * contrib/hbide/ideedit.prg
    ! Fixed: Ctrl+X: cut() was faultering.
This commit is contained in:
Pritpal Bedi
2010-05-16 12:52:16 +00:00
parent 1276155cea
commit bf43b397be
5 changed files with 42 additions and 41 deletions

View File

@@ -17,6 +17,13 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-15-16 05:47 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbqt/hbqt_hbqplaintextedit.cpp
* contrib/hbqt/hbqt_hbqplaintextedit.h
* contrib/hbqt/qtgui/HBQPlainTextEdit.cpp
* contrib/hbide/ideedit.prg
! Fixed: Ctrl+X: cut() was faultering.
2010-05-16 11:12 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/win_svc.c
! Fixed callback definitions to be the ones required by Windows.

View File

@@ -911,16 +911,17 @@ METHOD IdeEdit:insertBlockContents( aCord )
/*----------------------------------------------------------------------*/
METHOD IdeEdit:deleteBlockContents( aCord )
LOCAL nT, nL, nB, nR, nW, i, cLine, qCursor, k
LOCAL nT, nL, nB, nR, nW, i, cLine, qCursor, k, nSelMode
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
k := aCord[ 7 ]
k := iif( empty( k ), Qt_Key_X, k )
IF k == Qt_Key_X
::copyBlockContents( aCord )
ENDIF
nSelMode := aCord[ 5 ]
//HB_TRACE( HB_TR_ALWAYS, nT, nL, nB, nR, nSelMode )
qCursor := QTextCursor():from( ::qEdit:textCursor() )
qCursor:beginEditBlock()
@@ -935,7 +936,7 @@ METHOD IdeEdit:deleteBlockContents( aCord )
ELSE
IF k == Qt_Key_Delete .OR. k == Qt_Key_X
IF aCord[ 5 ] == selectionMode_column
IF nSelMode == selectionMode_column
FOR i := nT TO nB
cLine := ::getLine( i + 1 )
cLine := pad( substr( cLine, 1, nL ), nL ) + substr( cLine, nR + 1 )
@@ -943,7 +944,7 @@ METHOD IdeEdit:deleteBlockContents( aCord )
NEXT
hbide_qPositionCursor( qCursor, nT, nL )
ELSEIF aCord[ 5 ] == selectionMode_stream
ELSEIF nSelMode == selectionMode_stream
hbide_qPositionCursor( qCursor, nT, nL )
qCursor:movePosition( QTextCursor_Down , QTextCursor_KeepAnchor, nB - nT )
qCursor:movePosition( QTextCursor_StartOfLine, QTextCursor_KeepAnchor )
@@ -951,7 +952,7 @@ METHOD IdeEdit:deleteBlockContents( aCord )
qCursor:removeSelectedText()
::qEdit:hbSetSelectionInfo( { -1,-1,-1,-1,0 } )
ELSEIF aCord[ 5 ] == selectionMode_line
ELSEIF nSelMode == selectionMode_line
hbide_qPositionCursor( qCursor, nT, nL )
qCursor:movePosition( QTextCursor_Down , QTextCursor_KeepAnchor, nB - nT + 1 )
qCursor:movePosition( QTextCursor_StartOfLine, QTextCursor_KeepAnchor )
@@ -1242,7 +1243,6 @@ METHOD IdeEdit:toggleLineNumbers()
METHOD IdeEdit:toggleSelectionMode()
::isColumnSelectionON := ! ::isColumnSelectionON
//::qEdit:hbHighlightSelectedColumns( ::isColumnSelectionON )
::qEdit:hbSetSelectionMode( iif( ::isColumnSelectionON, 2, 1 ), .t. )
::dispStatusInfo()
RETURN Self
@@ -1276,7 +1276,7 @@ METHOD IdeEdit:undo()
/*----------------------------------------------------------------------*/
METHOD IdeEdit:cut()
::qEdit:hbCut()
::qEdit:hbCut( Qt_Key_X )
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -344,6 +344,7 @@ void HBQPlainTextEdit::hbSetSelectionMode( int mode, bool on )
selectionMode = selectionMode_stream;
isColumnSelectionEnabled = false;
isLineSelectionON = false;
setCursorWidth( 1 );
break;
}
case selectionMode_column:
@@ -373,13 +374,6 @@ void HBQPlainTextEdit::hbSetSelectionMode( int mode, bool on )
}
break;
}
#if 0
default:
{
selectionMode = selectionMode_none;
hbClearColumnSelection();
}
#endif
}
update();
}
@@ -451,7 +445,7 @@ void HBQPlainTextEdit::hbCut( int k )
hb_itemRelease( p1 );
hb_itemRelease( p2 );
if( selectionMode == selectionMode_column && k == 0 )
if( selectionMode == selectionMode_column ) //&& k == 0 )
columnEnds = columnBegins;
}
else
@@ -633,7 +627,22 @@ void HBQPlainTextEdit::mouseMoveEvent( QMouseEvent *event )
/*----------------------------------------------------------------------*/
bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event )
void HBQPlainTextEdit::keyReleaseEvent( QKeyEvent * event )
{
QPlainTextEdit::keyReleaseEvent( event );
if( ( event->modifiers() & Qt::ControlModifier ) && event->text() == "" )
{
if( selectionState == 2 )
{
selectionState = 1;
}
}
}
/*----------------------------------------------------------------------*/
bool HBQPlainTextEdit::hbKeyPressSelection( QKeyEvent * event )
{
bool ctrl = event->modifiers() & Qt::ControlModifier;
bool shift = event->modifiers() & Qt::ShiftModifier;
@@ -735,7 +744,7 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event )
break;
}
}
//HB_TRACE( HB_TR_ALWAYS, ( "0 NAV %i %i %i %i", rowBegins, columnBegins, rowEnds, columnEnds ) );
c.clearSelection();
setTextCursor( c );
@@ -773,8 +782,9 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event )
rowEnds = row;
columnEnds = col;
}
//HB_TRACE( HB_TR_ALWAYS, ( "1 NAV %i %i %i %i", rowBegins, columnBegins, rowEnds, columnEnds ) );
update();
event->ignore();
event->accept();
return true;
} // if( shift && isNavableKey( k ) )
else if( selectionMode == selectionMode_column )
@@ -805,7 +815,7 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event )
columnEnds++;
}
repaint();
event->ignore();
event->accept();
return true;
}
}
@@ -824,7 +834,7 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event )
columnEnds = columnBegins;
}
repaint();
event->ignore();
event->accept();
return true;
}
else
@@ -839,7 +849,7 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event )
hbCut( k );
repaint();
selectionState = 0;
event->ignore();
event->accept();
return true;
}
else
@@ -873,7 +883,7 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event )
QPlainTextEdit::keyPressEvent( event );
QTextCursor c( textCursor() );
rowEnds = c.blockNumber();
event->ignore();
event->accept();
update();
return true;
}
@@ -883,25 +893,9 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event )
/*----------------------------------------------------------------------*/
void HBQPlainTextEdit::keyReleaseEvent( QKeyEvent * event )
{
QPlainTextEdit::keyReleaseEvent( event );
bool ctrl = event->modifiers() & Qt::ControlModifier;
if( ctrl && event->text() == "" )
{
if( selectionState > 0 )
{
selectionState = 0;
}
}
}
/*----------------------------------------------------------------------*/
void HBQPlainTextEdit::keyPressEvent( QKeyEvent * event )
{
if( hbKeyPressColumnSelection( event ) )
if( hbKeyPressSelection( event ) )
{
return;
}

View File

@@ -203,7 +203,7 @@ private slots:
void hbUpdateLineNumberArea( const QRect &, int );
void hbUpdateHorzRuler( const QRect &, int );
void hbPaintSelection( QPaintEvent * );
bool hbKeyPressColumnSelection( QKeyEvent * );
bool hbKeyPressSelection( QKeyEvent * );
void hbClearColumnSelection();
void hbUpdateCaret();
};

View File

@@ -72,7 +72,7 @@
#include "../hbqt_hbqplaintextedit.h"
/*
* HBQPlainTextEdit ( QWidget * parent = 0 ) .
* HBQPlainTextEdit ( QWidget * parent = 0 )
* HBQPlainTextEdit ( const QString & text, QWidget * parent = 0 )
* virtual ~HBQPlainTextEdit ()
*/