2010-15-15 12:03 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbqt/doc/en/class_hbqplaintextedit.txt
  * contrib/hbqt/hbqt_hbqplaintextedit.cpp
  * contrib/hbqt/hbqt_hbqplaintextedit.h
  * contrib/hbqt/qtgui/HBQPlainTextEdit.cpp
  * contrib/hbqt/qtgui/THBQPlainTextEdit.prg
  * contrib/hbqt/qth/HBQPlainTextEdit.qth

  * contrib/hbide/idedocks.prg
  * contrib/hbide/ideedit.prg
  * contrib/hbide/ideeditor.prg
    ! Fixed: the artifacts reported by Mindaugas and Itamar.
    ! Optimized: C++ code.
    ! Fixed: many other artifacts, i.e., status-bar panel was wrongly 
        reporting selection mode.

    Mindaugas, can you please test again ?
This commit is contained in:
Pritpal Bedi
2010-05-15 19:08:54 +00:00
parent b8324adfec
commit 515f1b1a11
10 changed files with 61 additions and 67 deletions

View File

@@ -17,6 +17,24 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-15-15 12:03 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbqt/doc/en/class_hbqplaintextedit.txt
* contrib/hbqt/hbqt_hbqplaintextedit.cpp
* contrib/hbqt/hbqt_hbqplaintextedit.h
* contrib/hbqt/qtgui/HBQPlainTextEdit.cpp
* contrib/hbqt/qtgui/THBQPlainTextEdit.prg
* contrib/hbqt/qth/HBQPlainTextEdit.qth
* contrib/hbide/idedocks.prg
* contrib/hbide/ideedit.prg
* contrib/hbide/ideeditor.prg
! Fixed: the artifacts reported by Mindaugas and Itamar.
! Optimized: C++ code.
! Fixed: many other artifacts, i.e., status-bar panel was wrongly
reporting selection mode.
Mindaugas, can you please test again ?
2010-05-15 20:02 UTC+0200 José Luis Capel (jlcapel at hotmail . com)
+ contrib/hbwin/win_srv.c
+ contrib/hbwin/tests/testsrv.prg

View File

@@ -451,7 +451,7 @@ METHOD IdeDocks:buildViewWidget( cObjectName )
oFrame:oTabWidget:oWidget:setCornerWidget( qTBtnClose, Qt_TopRightCorner )
ENDIF
oFrame:oTabWidget:oWidget:setUsesScrollButtons( .f. )
oFrame:oTabWidget:oWidget:setUsesScrollButtons( .t. )
oFrame:oTabWidget:oWidget:setMovable( .t. )
aadd( ::oIde:aViews, oFrame )

View File

@@ -765,7 +765,7 @@ METHOD IdeEdit:copyBlockContents( aCord )
IF nMode == selectionMode_stream
IF i == nT .AND. i == nB
cLine := substr( cLine, aCord[ 4 ] + 1, nW )
cLine := substr( cLine, aCord[ 2 ] + 1, nW )
ELSEIF i == nT
cLine := substr( cLine, aCord[ 2 ] + 1 )
ELSEIF i == nB
@@ -784,6 +784,8 @@ METHOD IdeEdit:copyBlockContents( aCord )
cClip += cLine + iif( i < nB, hb_osNewLine(), "" )
NEXT
* HB_TRACE( HB_TR_ALWAYS, "copyBlockContents", cClip )
hbide_blockContents( { nMode, ::aBlockCopyContents } )
qClip := QClipboard():new()
@@ -1233,7 +1235,8 @@ METHOD IdeEdit:toggleLineNumbers()
METHOD IdeEdit:toggleSelectionMode()
::isColumnSelectionON := ! ::isColumnSelectionON
::qEdit:hbHighlightSelectedColumns( ::isColumnSelectionON )
//::qEdit:hbHighlightSelectedColumns( ::isColumnSelectionON )
::qEdit:hbSetSelectionMode( iif( ::isColumnSelectionON, 2, 1 ), .t. )
::dispStatusInfo()
RETURN Self

View File

@@ -1374,8 +1374,6 @@ METHOD IdeEditor:dispEditInfo( qEdit )
::oIde:oSBar:getItem( SB_PNL_COLUMN ):caption := "Col " + hb_ntos( qCursor:columnNumber() + 1 )
::oIde:oSBar:getItem( SB_PNL_INS ):caption := iif( qEdit:overwriteMode() , " ", "Ins" )
::oIde:oSBar:getItem( SB_PNL_MODIFIED ):caption := iif( qDocument:isModified(), "Modified", iif( qEdit:isReadOnly(), "ReadOnly", " " ) )
::oIde:oSBar:getItem( SB_PNL_STREAM ):caption := "Stream"
::oIde:oSBar:getItem( SB_PNL_EDIT ):caption := "Edit"
RETURN Self

View File

@@ -58,7 +58,6 @@
:hbBlockIndent( nSteps ) -> NIL
:hbDeleteLine() -> NIL
:hbMoveLine( nIDirection ) -> NIL
:hbHighlightSelectedColumns( lYes ) -> NIL
:hbGetSelectedText() -> cQString
:hbTextUnderCursor() -> cQString
:hbShowPrototype( cTip ) -> NIL

View File

@@ -107,7 +107,7 @@ HBQPlainTextEdit::HBQPlainTextEdit( QWidget * parent ) : QPlainTextEdit( parent
rowBegins = -1;
rowEnds = -1;
selectionState = selectionState_off;
selectionMode = selectionMode_none;
selectionMode = selectionMode_stream;
selectionDisplay = selectionDisplay_none;
isColumnSelectionEnabled = false;
isLineSelectionON = false;
@@ -331,13 +331,6 @@ void HBQPlainTextEdit::hbGetSelectionInfo()
/*----------------------------------------------------------------------*/
void HBQPlainTextEdit::hbHighlightSelectedColumns( bool yes )
{
hbSetSelectionMode( ( yes ? selectionMode_column : selectionMode_stream ), true );
}
/*----------------------------------------------------------------------*/
void HBQPlainTextEdit::hbSetSelectionMode( int mode, bool on )
{
switch( mode )
@@ -362,33 +355,32 @@ void HBQPlainTextEdit::hbSetSelectionMode( int mode, bool on )
}
case selectionMode_line:
{
selectionMode = selectionMode_line;
isColumnSelectionEnabled = false;
if( on )
{
isLineSelectionON = true;
hbClearColumnSelection();
QTextCursor c( textCursor() );
rowBegins = c.blockNumber();
rowEnds = c.blockNumber();
columnBegins = 0;
columnEnds = 0;
selectionMode = selectionMode_line;
rowBegins = c.blockNumber();
rowEnds = rowBegins;
columnBegins = 0;
columnEnds = 0;
}
else
{
isLineSelectionON = false;
selectionMode = selectionMode_stream;
}
break;
}
#if 0
default:
{
selectionMode = selectionMode_none;
hbClearColumnSelection();
}
#endif
}
update();
}
@@ -518,13 +510,26 @@ void HBQPlainTextEdit::hbPaste()
void HBQPlainTextEdit::mouseDoubleClickEvent( QMouseEvent *event )
{
QPlainTextEdit::mouseDoubleClickEvent( event );
QTextCursor c( textCursor() );
if( c.hasSelection() )
{
rowBegins = c.blockNumber();
rowEnds = rowBegins;
columnEnds = c.columnNumber();
columnBegins = columnEnds - ( c.selectionEnd() - c.selectionStart() );
selectionMode = selectionMode_stream;
emit selectionChanged();
repaint();
}
if( block )
{
PHB_ITEM p1 = hb_itemPutNI( NULL, QEvent::MouseButtonDblClick );
hb_vmEvalBlockV( block, 1, p1 );
hb_itemRelease( p1 );
}
QPlainTextEdit::mouseDoubleClickEvent( event );
}
/*----------------------------------------------------------------------*/
@@ -543,15 +548,19 @@ void HBQPlainTextEdit::mouseReleaseEvent( QMouseEvent *event )
selectionState = 1;
setCursorWidth( 1 );
QPlainTextEdit::mouseReleaseEvent( event );
if( isLineSelectionON )
{
QTextCursor c( textCursor() );
rowEnds = c.blockNumber();
repaint();
}
}
/*----------------------------------------------------------------------*/
void HBQPlainTextEdit::mouseMoveEvent( QMouseEvent *event )
{
if( isColumnSelectionEnabled )
selectionMode = selectionMode_column;
else
if( selectionMode == selectionMode_line )
selectionMode = selectionMode_stream;
if( event->buttons() & Qt::LeftButton )
@@ -564,7 +573,7 @@ void HBQPlainTextEdit::mouseMoveEvent( QMouseEvent *event )
if( columnBegins == -1 )
{
if( isColumnSelectionEnabled )
if( selectionMode == selectionMode_column )
setCursorWidth( 0 );
QTextCursor c( textCursor() );
@@ -578,7 +587,7 @@ void HBQPlainTextEdit::mouseMoveEvent( QMouseEvent *event )
}
else
{
if( isColumnSelectionEnabled )
if( selectionMode == selectionMode_column )
{
QTextCursor c( cursorForPosition( QPoint( 1,1 ) ) );
rowEnds = c.blockNumber() + ( event->y() / fontMetrics().height() );
@@ -587,7 +596,7 @@ void HBQPlainTextEdit::mouseMoveEvent( QMouseEvent *event )
QPlainTextEdit::mouseMoveEvent( event );
QTextCursor c = textCursor();
if( ! isColumnSelectionEnabled )
if( selectionMode != selectionMode_column )
{
rowEnds = c.blockNumber();
columnEnds = c.columnNumber();
@@ -618,15 +627,6 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event )
return true;
}
if( isColumnSelectionEnabled )
{
selectionMode = selectionMode_column;
}
else if( selectionMode != selectionMode_line )
{
selectionMode = selectionMode_stream;
}
bool bClear = false;
if( selectionMode == selectionMode_column || selectionMode == selectionMode_stream )
@@ -654,6 +654,7 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event )
columnBegins = col;
rowEnds = row;
columnEnds = col;
emit selectionChanged();
}
if( selectionMode == selectionMode_column )
@@ -831,15 +832,11 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event )
}
else if( selectionMode == selectionMode_line )
{
if( isLineSelectionON && ( k == Qt::Key_Up || k == Qt::Key_Down ) )
if( isLineSelectionON && isNavableKey( k ) )
{
QPlainTextEdit::keyPressEvent( event );
QTextCursor c( textCursor() );
if( ( k == Qt::Key_Down && c.blockNumber() == rowEnds + 1 ) ||
( k == Qt::Key_Up && c.blockNumber() == rowBegins - 1 ) )
{
rowEnds = c.blockNumber();
}
rowEnds = c.blockNumber();
event->ignore();
update();
return true;
@@ -1234,7 +1231,7 @@ void HBQPlainTextEdit::hbPaintSelection( QPaintEvent * event )
for( i = ( rb >= t ? rb : t ); i <= re; i++ )
{
if( i == rb )
if( i == rowBegins )
{
if( rb == re )
{
@@ -1248,7 +1245,7 @@ void HBQPlainTextEdit::hbPaintSelection( QPaintEvent * event )
r = QRect( x, top, width + abs( x ), fontHeight );
}
}
else if( i == re )
else if( i == rowEnds )
{
int x = ( ( columnEnds - c ) * fontWidth ) + marginX;
r = QRect( 0, top, x, fontHeight );

View File

@@ -177,7 +177,6 @@ public slots:
void hbDuplicateLine();
void hbReplaceSelection( const QString & txt );
void hbInsertTab( int mode );
void hbHighlightSelectedColumns( bool yes );
QString hbGetSelectedText();
QString hbTextUnderCursor();
void hbNumberBlockVisible( bool b );

View File

@@ -580,20 +580,6 @@ HB_FUNC( QT_HBQPLAINTEXTEDIT_HBMOVELINE )
}
}
/*
* void hbHighlightSelectedColumns( bool yes )
*/
HB_FUNC( QT_HBQPLAINTEXTEDIT_HBHIGHLIGHTSELECTEDCOLUMNS )
{
HBQPlainTextEdit * p = hbqt_par_HBQPlainTextEdit( 1 );
if( p )
( p )->hbHighlightSelectedColumns( hb_parl( 2 ) );
else
{
HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_HBQPLAINTEXTEDIT_HBHIGHLIGHTSELECTEDCOLUMNS FP=( p )->hbHighlightSelectedColumns( hb_parl( 2 ) ); p is NULL" ) );
}
}
/*
* QString hbGetSelectedText()
*/

View File

@@ -97,7 +97,6 @@ CREATE CLASS HBQPlainTextEdit INHERIT HbQtObjectHandler, QPlainTextEdit
METHOD hbBlockIndent( nSteps )
METHOD hbDeleteLine()
METHOD hbMoveLine( nIDirection )
METHOD hbHighlightSelectedColumns( lYes )
METHOD hbGetSelectedText()
METHOD hbTextUnderCursor()
METHOD hbShowPrototype( cTip )
@@ -246,10 +245,6 @@ METHOD HBQPlainTextEdit:hbMoveLine( nIDirection )
RETURN Qt_HBQPlainTextEdit_hbMoveLine( ::pPtr, nIDirection )
METHOD HBQPlainTextEdit:hbHighlightSelectedColumns( lYes )
RETURN Qt_HBQPlainTextEdit_hbHighlightSelectedColumns( ::pPtr, lYes )
METHOD HBQPlainTextEdit:hbGetSelectedText()
RETURN Qt_HBQPlainTextEdit_hbGetSelectedText( ::pPtr )

View File

@@ -128,7 +128,6 @@ HB_FUNC( QT_HBQPLAINTEXTEDIT )
void hbBlockIndent( int steps )
void hbDeleteLine()
void hbMoveLine( int iDirection )
void hbHighlightSelectedColumns( bool yes )
QString hbGetSelectedText()
QString hbTextUnderCursor()
void hbShowPrototype( const QString & tip )