From 9cfa81238d36dec976fd7ddcb32e65552b8c08ef Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 18 May 2011 01:12:58 +0000 Subject: [PATCH] 2011-05-18 17:53 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/idedocks.prg * contrib/hbide/ideedit.prg * contrib/hbide/ideeditor.prg + Added: some methods used internally to provide hbIDE speed advantage. * contrib/hbide/idesaveload.prg ! Changed: the default behavior of :lTrimTrailingBlanks to FALSE responsible to strip trailing blanks from saved sources. Now if this behavior is desired, change the settings from . * contrib/hbide/idethemes.prg * contrib/hbqt/qtgui/hbqt_init.cpp + Added: Slot "QRect$int" for updateRequest(QRect,int) for QPlainTextEdit. * contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth * contrib/hbqt/qtgui/qth/HBQSyntaxHighlighter.qth + Added: more methods. * contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp ! Fixed: 2 pixel margin around a document text which was causing a major visual glich which selecting text in an editing instance. Now it is 0,0 no matter which font and size is used. * contrib/hbqt/qtgui/hbqt_hbqplaintextedit.h * contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp * contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.h + Synchronized: to apply syntax highlighting per page basis. Qt applies highlighting to the entire document when supplied which, conceptually, should be onto the page brought forward. This has rendered hbIDE extremely fast at startup no matter how many sources are loaded probably making hbIDE the fastest IDE at startup. --- harbour/ChangeLog | 36 +++++++++ harbour/contrib/hbide/idedocks.prg | 2 +- harbour/contrib/hbide/ideedit.prg | 24 ++++-- harbour/contrib/hbide/ideeditor.prg | 20 +++-- harbour/contrib/hbide/idesaveload.prg | 2 +- harbour/contrib/hbide/idethemes.prg | 3 + .../hbqt/qtgui/hbqt_hbqplaintextedit.cpp | 78 ++++++++++++++++++- .../hbqt/qtgui/hbqt_hbqplaintextedit.h | 5 ++ .../hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp | 39 +++------- .../hbqt/qtgui/hbqt_hbqsyntaxhighlighter.h | 5 ++ harbour/contrib/hbqt/qtgui/hbqt_init.cpp | 13 ++++ .../hbqt/qtgui/qth/HBQPlainTextEdit.qth | 3 + .../hbqt/qtgui/qth/HBQSyntaxHighlighter.qth | 3 + 13 files changed, 189 insertions(+), 44 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c307b9ceaa..4e65e1077a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,42 @@ The license applies to all entries newer than 2009-04-28. */ +2011-05-18 17:53 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/idedocks.prg + * contrib/hbide/ideedit.prg + * contrib/hbide/ideeditor.prg + + Added: some methods used internally to provide hbIDE speed advantage. + + * contrib/hbide/idesaveload.prg + ! Changed: the default behavior of :lTrimTrailingBlanks to FALSE + responsible to strip trailing blanks from saved sources. + Now if this behavior is desired, change the settings from + . + + * contrib/hbide/idethemes.prg + * contrib/hbqt/qtgui/hbqt_init.cpp + + Added: Slot "QRect$int" for updateRequest(QRect,int) for QPlainTextEdit. + + * contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth + * contrib/hbqt/qtgui/qth/HBQSyntaxHighlighter.qth + + Added: more methods. + + * contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp + ! Fixed: 2 pixel margin around a document text which was causing a + major visual glich which selecting text in an editing instance. + Now it is 0,0 no matter which font and size is used. + + * contrib/hbqt/qtgui/hbqt_hbqplaintextedit.h + * contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp + * contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.h + + Synchronized: to apply syntax highlighting per page basis. + Qt applies highlighting to the entire document when supplied + which, conceptually, should be onto the page brought forward. + + This has rendered hbIDE extremely fast at startup no matter + how many sources are loaded probably making hbIDE the fastest + IDE at startup. + 2011-05-18 01:46 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/gtwvt/gtwvt.c ! fixed regression referred to in 2011-05-18 01:06 UTC+0200 Viktor Szakats diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index 3c1ef2f872..91402a3e08 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -1044,7 +1044,7 @@ METHOD IdeDocks:setView( cView ) EXIT OTHERWISE - IF ( n := ascan( ::aViews, {|o| o:oWidget:objectName() == cView } ) ) > 0 + IF ( n := ascan( ::aViews, {|o| iif( hb_isChar( o:oWidget:objectName() ), o:oWidget:objectName() == cView, .f. ) } ) ) > 0 ::oIde:cWrkView := cView IF !( cView == "Stats" ) ::oIde:qTabWidget := ::aViews[ n ]:oTabWidget:oWidget diff --git a/harbour/contrib/hbide/ideedit.prg b/harbour/contrib/hbide/ideedit.prg index d894e9f2df..55bc93cc97 100644 --- a/harbour/contrib/hbide/ideedit.prg +++ b/harbour/contrib/hbide/ideedit.prg @@ -246,6 +246,8 @@ CLASS IdeEdit INHERIT IdeObject METHOD unHighlight() METHOD parseCodeCompletion( cSyntax ) + METHOD highlightPage() + ENDCLASS /*----------------------------------------------------------------------*/ @@ -400,8 +402,8 @@ METHOD IdeEdit:disconnectEditSignals( oEdit ) oEdit:qEdit:disConnect( "copyAvailable(bool)" ) #if 0 - oEdit:qEdit:disConnect( "modificationChanged(bool)" ) oEdit:qEdit:disConnect( "updateRequest(QRect,int)" ) + oEdit:qEdit:disConnect( "modificationChanged(bool)" ) oEdit:qEdit:disConnect( "redoAvailable(bool)" ) oEdit:qEdit:disConnect( "undoAvailable(bool)" ) #endif @@ -411,17 +413,18 @@ METHOD IdeEdit:disconnectEditSignals( oEdit ) /*----------------------------------------------------------------------*/ METHOD IdeEdit:connectEditSignals( oEdit ) + HB_SYMBOL_UNUSED( oEdit ) oEdit:qEdit:connect( "customContextMenuRequested(QPoint)", {|p | ::execEvent( 1, oEdit, p ) } ) - oEdit:qEdit:Connect( "textChanged()" , {| | ::execEvent( 2, oEdit, ) } ) - oEdit:qEdit:Connect( "selectionChanged()" , {|p | ::execEvent( 6, oEdit, p ) } ) - oEdit:qEdit:Connect( "cursorPositionChanged()" , {| | ::execEvent( 9, oEdit, ) } ) - oEdit:qEdit:Connect( "copyAvailable(bool)" , {|p | ::execEvent( 3, oEdit, p ) } ) + oEdit:qEdit:connect( "textChanged()" , {| | ::execEvent( 2, oEdit, ) } ) + oEdit:qEdit:connect( "selectionChanged()" , {|p | ::execEvent( 6, oEdit, p ) } ) + oEdit:qEdit:connect( "cursorPositionChanged()" , {| | ::execEvent( 9, oEdit, ) } ) + oEdit:qEdit:connect( "copyAvailable(bool)" , {|p | ::execEvent( 3, oEdit, p ) } ) #if 0 + oEdit:qEdit:connect( "updateRequest(QRect,int)" , {|p,p1| ::execEvent( updateRequest, oEdit, p, p1 ) } ) oEdit:qEdit:connect( "modificationChanged(bool)" , {|p | ::execEvent( 4, oEdit, p ) } ) - oEdit:qEdit:connect( "updateRequest(QRect,int)" , {|p,p1| ::execEvent( 8, oEdit, p, p1 ) } ) oEdit:qEdit:connect( "redoAvailable(bool)" , {|p | ::execEvent( 5, oEdit, p ) } ) oEdit:qEdit:connect( "undoAvailable(bool)" , {|p | ::execEvent( 7, oEdit, p ) } ) #endif @@ -442,7 +445,6 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) SWITCH nMode CASE customContextMenuRequested - //::oEM:aActions[ 17, 2 ]:setEnabled( !empty( qCursor:selectedText() ) ) ::oEM:aActions[ 17, 2 ]:setEnabled( !empty( qCursor:selectedText() ) ) n := ascan( ::oEditor:aEdits, {|o| o == oEdit } ) @@ -726,6 +728,14 @@ METHOD IdeEdit:execKeyEvent( nMode, nEvent, p, p1 ) /*----------------------------------------------------------------------*/ +METHOD IdeEdit:highlightPage() + + ::qEdit:hbHighlightPage() + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEdit:dispStatusInfo() LOCAL nMode diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index a11cc21cbf..0adebacb44 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -1351,10 +1351,11 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, a ::oEdit:qEdit:connect( "updateRequest(QRect,int)", {|| ::scrollThumbnail() } ) ::qDocument := ::qEdit:document() - +#if 0 IF !( ::cType == "U" ) ::qHiliter := ::oTH:SetSyntaxHilighting( ::oEdit:qEdit, @::cTheme ) ENDIF +#endif ::qCursor := ::qEdit:textCursor() /* Populate Tabs Array */ @@ -1368,7 +1369,10 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, a ::oEdit:setReadOnly( .t. ) ::qEdit:setTextInteractionFlags( Qt_TextSelectableByMouse + Qt_TextSelectableByKeyboard ) ENDIF - ::setTabImage() + + ::qDocument:setModified( .f. ) + ::qTabWidget:setTabIcon( ::qTabWidget:indexOf( ::oTab:oWidget ), ; + hbide_image( iif( ::lReadOnly, "tabreadonly", "tabunmodified" ) ) ) RETURN Self @@ -1430,7 +1434,8 @@ METHOD IdeEditor:split( nOrient, oEditP ) METHOD IdeEditor:destroy() LOCAL n, oEdit -HB_TRACE( HB_TR_DEBUG, "..........................................................IdeEditor:destroy()", 0 ) + HB_TRACE( HB_TR_DEBUG, "..........................................................IdeEditor:destroy()", 0 ) + ::oEdit:qEdit:disconnect( "updateRequest(QRect,int)" ) IF !empty( ::qTimerSave ) @@ -1480,7 +1485,7 @@ HB_TRACE( HB_TR_DEBUG, "........................................................ ::oIde:lDockRVisible := .f. ENDIF ENDIF -HB_TRACE( HB_TR_DEBUG, "................................................................IdeEditor:destroy()", 1 ) + HB_TRACE( HB_TR_DEBUG, "................................................................IdeEditor:destroy()", 1 ) RETURN Self /*----------------------------------------------------------------------*/ @@ -1545,6 +1550,11 @@ METHOD IdeEditor:setDocumentProperties() IF !( ::lLoaded ) /* First Time */ ::qEdit:setPlainText( ::prepareBufferToLoad( hb_memoread( ::sourceFile ) ) ) +#if 1 + IF !( ::cType == "U" ) + ::qHiliter := ::oTH:setSyntaxHilighting( ::qEdit, @::cTheme ) + ENDIF +#endif qCursor:setPosition( ::nPos ) ::qEdit:setTextCursor( qCursor ) @@ -1563,7 +1573,6 @@ METHOD IdeEditor:setDocumentProperties() ::qTimerSave:connect( "timeout()", {|| ::execEvent( "qTimeSave_timeout" ) } ) ::qTimerSave:start() ENDIF - ::oUpDn:show() ENDIF @@ -1623,6 +1632,7 @@ METHOD IdeEditor:activateTab( mp1, mp2, oXbp ) oEdit:qCoEdit:dispStatusInfo() ::oUpDn:show() oEdit:changeThumbnail() + oEdit:qCoEdit:highlightPage() ENDIF RETURN Self diff --git a/harbour/contrib/hbide/idesaveload.prg b/harbour/contrib/hbide/idesaveload.prg index 4fbe1a189b..8d99b46323 100644 --- a/harbour/contrib/hbide/idesaveload.prg +++ b/harbour/contrib/hbide/idesaveload.prg @@ -138,7 +138,7 @@ CLASS IdeINI INHERIT IdeObject DATA nPointSize INIT 10 DATA cLineEndingMode INIT "" - DATA lTrimTrailingBlanks INIT .t. + DATA lTrimTrailingBlanks INIT .f. DATA lSaveSourceWhenComp INIT .t. DATA lSupressHbKWordsToUpper INIT .f. DATA lReturnAsBeginKeyword INIT .f. diff --git a/harbour/contrib/hbide/idethemes.prg b/harbour/contrib/hbide/idethemes.prg index dd7fb7a039..fca2b96140 100644 --- a/harbour/contrib/hbide/idethemes.prg +++ b/harbour/contrib/hbide/idethemes.prg @@ -482,9 +482,12 @@ METHOD IdeThemes:setSyntaxHilighting( qEdit, cTheme, lNew ) aAttr := ::getThemeAttribute( "SelectionBackground", cTheme ) qEdit:hbSetSelectionColor( QColor( aAttr[ THM_ATR_R ], aAttr[ THM_ATR_G ], aAttr[ THM_ATR_B ] ) ) + + qEdit:hbSetHighLighter( qHiliter ) ENDIF qHiliter:setDocument( qEdit:document() ) + qHiliter:hbSetEditor( qEdit ) RETURN qHiliter diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp index c53dd08972..aec1b07765 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp @@ -178,6 +178,9 @@ HBQPlainTextEdit::HBQPlainTextEdit( QWidget * parent ) : QPlainTextEdit( parent connect( timer, SIGNAL( timeout() ), this, SLOT( hbUpdateCaret() ) ); timer->start( 500 ); #endif + + QTextDocument * doc = document(); + doc->setDocumentMargin( 0 ); } /*----------------------------------------------------------------------*/ @@ -1629,6 +1632,25 @@ void HBQPlainTextEdit::hbUpdateCaret() /*----------------------------------------------------------------------*/ +int HBQPlainTextEdit::lastVisibleBlockNumber() +{ + QTextBlock block = firstVisibleBlock(); + int blockNumber = block.blockNumber(); + int top = ( int ) blockBoundingGeometry( block ).translated( contentOffset() ).top(); + int height = ( int ) blockBoundingRect( block ).height(); + int vpHeight = viewport()->height(); + + while( block.isValid() && top < vpHeight ) + { + top += height; + ++blockNumber; + block = block.next(); + } + return blockNumber; +} + +/*----------------------------------------------------------------------*/ + void HBQPlainTextEdit::horzRulerPaintEvent( QPaintEvent *event ) { int fontWidth = fontMetrics().averageCharWidth(); @@ -1762,7 +1784,8 @@ void HBQPlainTextEdit::hbPaintSelection( QPaintEvent * event ) { QPainter p( viewport() ); - int marginX = ( c > 0 ? 0 : contentsRect().left() ) + 2 ; + //int marginX = ( c > 0 ? 0 : contentsRect().left() ) + 2 ; + int marginX = ( c > 0 ? 0 : contentsRect().left() ) ; int fontWidth = fontMetrics().averageCharWidth(); int top = ( ( rb <= t ) ? 0 : ( ( rb - t ) * fontHeight ) ) + ttop; @@ -2065,10 +2088,63 @@ void HBQPlainTextEdit::hbUpdateHorzRuler( const QRect & rect, int dy ) /*----------------------------------------------------------------------*/ +void HBQPlainTextEdit::hbHighlightPage() +{ + int iLastVisBlockNum = lastVisibleBlockNumber(); + QTextBlock block = firstVisibleBlock(); + if( block.isValid() ) + { + int i; + for( i = block.blockNumber(); i < iLastVisBlockNum; i++ ) + { + highlighter->rehighlightBlock( block ); + block = block.next(); + if( ! block.isValid() ) + break; + } + } +} + +/*----------------------------------------------------------------------*/ + void HBQPlainTextEdit::hbUpdateLineNumberArea( const QRect &rect, int dy ) { if( dy ) + { lineNumberArea->scroll( 0, dy ); + +#if QT_VERSION >= 0x040600 + int rows = abs( dy / fontMetrics().height() ); + int i; + QTextBlock block; + + if( dy < 0 ) + { + + int iLastVisBlockNum = lastVisibleBlockNumber(); + + for( i = iLastVisBlockNum - rows; i <= iLastVisBlockNum; i++ ) + { + block = document()->findBlockByNumber( i ); + if( block.isValid() ) + { + highlighter->rehighlightBlock( block ); + } + } + } + else + { + block = firstVisibleBlock(); + for( i = 0; i < rows; i++ ) + { + highlighter->rehighlightBlock( block ); + block = block.next(); + } + } +#else + highlighter->rehighlight(); +#endif + } else lineNumberArea->update( 0, rect.y(), lineNumberArea->width(), rect.height() ); diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.h b/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.h index bd8f8449e3..efbeff679a 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.h +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.h @@ -117,6 +117,11 @@ public: void hbSetEventBlock( PHB_ITEM pBlock ); int horzRulerHeight; void hbUpdateHorzRulerHeight( int height ); + void hbSetHighLighter( HBQSyntaxHighlighter * hilighter ){ highlighter = hilighter; }; + void hbHighlightPage(); + + int firstVisibleBlockNumber() { return QPlainTextEdit::firstVisibleBlock().blockNumber(); }; + int lastVisibleBlockNumber(); private: QVector bookMark; diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp index edb6ed052d..c2554ddd12 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp @@ -55,6 +55,7 @@ #if QT_VERSION >= 0x040500 #include "hbqt_hbqsyntaxhighlighter.h" +#include "hbqt_hbqplaintextedit.h" #include #include @@ -145,44 +146,24 @@ void HBQSyntaxHighlighter::hbSetFormatColumnSelection( int start, int count, con void HBQSyntaxHighlighter::highlightBlock( const QString &text ) { - #if 0 - QTextBlock curBlock( currentBlock() ); - int iState = -1; - HBQTextBlockUserData * data = ( HBQTextBlockUserData * ) curBlock.userData(); + int iFirstBlock = editor->firstVisibleBlockNumber(); + int iLastBlock = editor->lastVisibleBlockNumber(); + int iBlock = currentBlock().blockNumber(); - QTextBlockFormat fmt( curBlock.blockFormat() ); - if( data ) + if( iBlock < iFirstBlock || iBlock > iLastBlock ) { - iState = data->state; - HB_TRACE( HB_TR_DEBUG, ( "iState = %i", iState ) ); - - switch( iState ) - { - case 99: - fmt.setBackground( QColor( 255,255,0 ) ); - break; - } + return; } - #endif int index = 0; + int length = 0; foreach( const HighlightingRule &rule, HighlightingRules ) { - #if 0 - QRegExp expression( rule.pattern ); - index = expression.indexIn( text ); - while( index >= 0 ) - { - int length = expression.matchedLength(); - setFormat( index, length, rule.format ); - index = expression.indexIn( text, index + length ); - } - #endif index = rule.pattern.indexIn( text ); while( index >= 0 ) { - int length = rule.pattern.matchedLength(); + length = rule.pattern.matchedLength(); setFormat( index, length, rule.format ); index = rule.pattern.indexIn( text, index + length ); } @@ -192,7 +173,7 @@ void HBQSyntaxHighlighter::highlightBlock( const QString &text ) index = patternQuotation.indexIn( text ); while( index >= 0 ) { - int length = patternQuotation.matchedLength(); + length = patternQuotation.matchedLength(); setFormat( index, length, quotationFormat ); index = patternQuotation.indexIn( text, index + length ); } @@ -201,7 +182,7 @@ void HBQSyntaxHighlighter::highlightBlock( const QString &text ) index = commentSingleLine.indexIn( text ); while( index >= 0 ) { - int length = commentSingleLine.matchedLength(); + length = commentSingleLine.matchedLength(); setFormat( index, length, singleLineCommentFormat ); index = commentSingleLine.indexIn( text, index + length ); } diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.h b/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.h index c97427d147..8554cc40e3 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.h +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.h @@ -59,8 +59,10 @@ #include #include +#include class QTextDocument; +class HBQPlainTextEdit; class HBQTextBlockUserData : public QTextBlockUserData { @@ -86,12 +88,15 @@ class HBQSyntaxHighlighter : public QSyntaxHighlighter public: HBQSyntaxHighlighter( QTextDocument *parent = 0 ); + HBQPlainTextEdit * editor; + void hbSetMultiLineCommentFormat( const QTextCharFormat & format ); void hbSetSingleLineCommentFormat( const QTextCharFormat & format ); void hbSetRule( QString name, QString pattern, const QTextCharFormat & format ); void hbSetFormat( QString name, const QTextCharFormat & format ); void hbSetFormatColumnSelection( int start, int count, const QColor & color ); void hbSetRuleWithRegExp( QString name, const QRegExp & reg, const QTextCharFormat & format ); + void hbSetEditor( HBQPlainTextEdit * edit ){ editor = edit; }; protected: void highlightBlock( const QString &text ); diff --git a/harbour/contrib/hbqt/qtgui/hbqt_init.cpp b/harbour/contrib/hbqt/qtgui/hbqt_init.cpp index 690e12b34b..74001f6645 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_init.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_init.cpp @@ -101,6 +101,7 @@ extern void * hbqt_gcAllocate_QListWidgetItem( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QTreeWidgetItem( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QTableWidgetItem( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QWidget( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QRect( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QActionEvent( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QContextMenuEvent( void * pObj, bool bNew ); @@ -352,6 +353,17 @@ static void hbqt_SlotsExecQWidgetInt( PHB_ITEM * codeBlock, void ** arguments, Q hb_vmSend( 2 ); } +static void hbqt_SlotsExecQRectInt( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) +{ + Q_UNUSED( pList ); + + hb_vmPushEvalSym(); + hb_vmPush( codeBlock ); + hb_vmPush( hbqt_create_objectGC( hbqt_gcAllocate_QRect( new QRect( ( *reinterpret_cast< QRect( * ) >( arguments[ 1 ] ) ) ), true ), "hb_QRect" ) ); + hb_vmPushInteger( *reinterpret_cast< int( * ) >( arguments[ 2 ] ) ); + hb_vmSend( 2 ); +} + HB_FUNC_EXTERN( HB_QABSTRACTBUTTON ); HB_FUNC_EXTERN( HB_QACTION ); @@ -460,6 +472,7 @@ static void hbqt_registerCallbacks( void ) hbqt_slots_register_callback( "QTreeWidgetItem*" , hbqt_SlotsExecQTreeWidgetItem ); hbqt_slots_register_callback( "QListWidgetItem*" , hbqt_SlotsExecQListWidgetItem ); hbqt_slots_register_callback( "QWidget*" , hbqt_SlotsExecQWidget ); + hbqt_slots_register_callback( "QRect$int" , hbqt_SlotsExecQRectInt ); hbqt_events_register_createobj( QEvent::MouseButtonPress , "hb_QMouseEvent" , hbqt_gcAllocate_QMouseEvent ); hbqt_events_register_createobj( QEvent::MouseButtonRelease , "hb_QMouseEvent" , hbqt_gcAllocate_QMouseEvent ); diff --git a/harbour/contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth b/harbour/contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth index c33b2f4fdf..b644730ebc 100644 --- a/harbour/contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth +++ b/harbour/contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth @@ -25,6 +25,7 @@ New = #include #include "hbqt_hbqplaintextedit.h" +#include "hbqt_hbqsyntaxhighlighter.h" HBQT_GC_FUNC( hbqt_gcMark_HBQPlainTextEdit ) { @@ -86,6 +87,8 @@ HB_FUNC( QT_HBQPLAINTEXTEDIT ) void hbHighlightCurrentLine(bool b) bool hbHighlightCurrentLine() void hbSetEventBlock( PHB_ITEM block ) + void hbSetHighLighter( HBQSyntaxHighlighter * hilighter ) + void hbHighlightPage() diff --git a/harbour/contrib/hbqt/qtgui/qth/HBQSyntaxHighlighter.qth b/harbour/contrib/hbqt/qtgui/qth/HBQSyntaxHighlighter.qth index 28f144c53d..be820d854e 100644 --- a/harbour/contrib/hbqt/qtgui/qth/HBQSyntaxHighlighter.qth +++ b/harbour/contrib/hbqt/qtgui/qth/HBQSyntaxHighlighter.qth @@ -26,7 +26,9 @@ New = #include +#include #include "hbqt_hbqsyntaxhighlighter.h" +#include "hbqt_hbqplaintextedit.h" /* * HBQSyntaxHighlighter ( QTextDocument * textDocument ) @@ -49,6 +51,7 @@ void hbSetRule( QString name, QString pattern, QTextCharFormat & format ) void hbSetFormat( QString name, const QTextCharFormat & format ) void hbSetFormatColumnSelection( int start, int count, const QColor & color ) void hbSetRuleWithRegExp( QString name, const QRegExp & reg, const QTextCharFormat & format ) +void hbSetEditor( HBQPlainTextEdit * edit ) # QTextBlock currentBlock () const # int currentBlockState () const