diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 21cef11327..a1aeb60397 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2011-05-18 18:31 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/ideeditor.prg + * contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp + * contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.h + * contrib/hbqt/qtgui/qth/HBQSyntaxHighlighter.qth + + Optimized: further the loading time of a source. + It should be much fatser than before. + 2011-05-18 12:51 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/idedocks.prg * contrib/hbxbp/xbpdialog.prg diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index 0adebacb44..7b0051a0b0 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -1576,6 +1576,9 @@ METHOD IdeEditor:setDocumentProperties() ::oUpDn:show() ENDIF + ::qHiliter:hbSetInitialized( .t. ) + ::qEdit:hbHighlightPage() + ::nBlock := qCursor:blockNumber() ::nColumn := qCursor:columnNumber() diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp index c2554ddd12..1e6a719924 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.cpp @@ -97,6 +97,8 @@ HBQSyntaxHighlighter::HBQSyntaxHighlighter( QTextDocument * parent ) commentSingleLine = QRegExp( "//[^\n]*" ); patternQuotation = QRegExp( "\"[^\"]+\"|\'[^\']+\'" ); + + initialized = false; } void HBQSyntaxHighlighter::hbSetRule( QString name, QString pattern, const QTextCharFormat & format ) @@ -146,6 +148,9 @@ void HBQSyntaxHighlighter::hbSetFormatColumnSelection( int start, int count, con void HBQSyntaxHighlighter::highlightBlock( const QString &text ) { + if( ! initialized ) + return; + int iFirstBlock = editor->firstVisibleBlockNumber(); int iLastBlock = editor->lastVisibleBlockNumber(); int iBlock = currentBlock().blockNumber(); diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.h b/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.h index 8554cc40e3..19555b1ca0 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.h +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqsyntaxhighlighter.h @@ -90,6 +90,8 @@ public: HBQPlainTextEdit * editor; + bool initialized; + void hbSetMultiLineCommentFormat( const QTextCharFormat & format ); void hbSetSingleLineCommentFormat( const QTextCharFormat & format ); void hbSetRule( QString name, QString pattern, const QTextCharFormat & format ); @@ -97,6 +99,7 @@ public: 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; }; + void hbSetInitialized( bool bInit ){ initialized = bInit; }; protected: void highlightBlock( const QString &text ); diff --git a/harbour/contrib/hbqt/qtgui/qth/HBQSyntaxHighlighter.qth b/harbour/contrib/hbqt/qtgui/qth/HBQSyntaxHighlighter.qth index be820d854e..8ce87e4a40 100644 --- a/harbour/contrib/hbqt/qtgui/qth/HBQSyntaxHighlighter.qth +++ b/harbour/contrib/hbqt/qtgui/qth/HBQSyntaxHighlighter.qth @@ -52,6 +52,7 @@ 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 ) +void hbSetInitialized( bool init ) # QTextBlock currentBlock () const # int currentBlockState () const