diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2a8e9f8164..8ed2cbf9a4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,19 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-12-29 00:41 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbqt/qtgui/QTextCursor.cpp + * contrib/hbqt/qtgui/TQTextCursor.prg + * contrib/hbqt/qth/QTextCursor.qth + ! Enabled :block() commented out method. + + * contrib/hbide/hbide.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/idemisc.prg + + Implemented double-click on any error/warning compiler output. + This opens or brings forward source file and cursor stays at the + offending source line. + 2009-12-28 18:54 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/idedocks.prg + Added skeleton to process double-click on compile output. diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 96f6239b1a..6de0020a6e 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -634,10 +634,6 @@ METHOD HbIde:getCurCursor() METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos, lPPO ) LOCAL n - #if 0 - LOCAL oTab, qEdit, qHiliter, qLayout, qDocument, qHScr, qVScr - LOCAL lFirst := .t. - #endif IF !Empty( cSourceFile ) .AND. !( IsValidText( cSourceFile ) ) RETURN Self @@ -653,7 +649,7 @@ METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos, lPPO ) IF Empty( cSourceFile ) n := 0 ELSE - n := aScan( ::aTabs, {|a| a[ TAB_SOURCEFILE ] == cSourceFile }) + n := aScan( ::aTabs, {|a_| PathNormalized( a_[ TAB_SOURCEFILE ] ) == PathNormalized( cSourceFile ) } ) End IF n > 0 @@ -661,7 +657,6 @@ METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos, lPPO ) IF lPPO ::aTabs[ n, TAB_QEDIT ]:setPlainText( hb_memoRead( cSourceFile ) ) END - RETURN Self END @@ -1732,7 +1727,8 @@ METHOD HbIde:buildProject( cProject, lLaunch, lRebuild, lPPO ) End End - ::oOutputResult:oWidget:setHtml( ConvertBuildStatusMsgToHtml( cTmp ) ) + //::oOutputResult:oWidget:setHtml( ConvertBuildStatusMsgToHtml( cTmp ) ) + ConvertBuildStatusMsgToHtml( cTmp, ::oOutputResult:oWidget ) IF lDelHbp FErase( cHbpPath ) diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index 3f719fac35..405ba42f3b 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -350,18 +350,38 @@ METHOD IdeDocks:buildOutputResults() /*----------------------------------------------------------------------*/ METHOD IdeDocks:outputDoubleClicked( lSelected ) - LOCAL qCursor + LOCAL qCursor, cText, n, cSource, nLine, cLine IF lSelected ::nPass++ IF ::nPass == 1 qCursor := QTextCursor():configure( ::oOutputResult:oWidget:textCursor() ) - HB_TRACE( HB_TR_ALWAYS, "METHOD IdeDocks:outputDoubleClicked()", lSelected, qCursor:blockNumber() ) + cText := QTextBlock():configure( qCursor:block() ):text() + IF ( n := at( "Error", cText ) ) > 0 + cLine := alltrim( substr( cText, 1, n - 1 ) ) + ELSEIF ( n := at( "Warning", cText ) ) > 0 + cLine := alltrim( substr( cText, 1, n - 1 ) ) + ENDIF + IF !empty( cLine ) + IF ( n := at( "(", cLine ) ) > 0 + cSource := alltrim( substr( cLine, 1, n - 1 ) ) + cLine := substr( cLine, n + 1 ) + n := at( ")", cLine ) + nLine := val( substr( cLine, 1, n - 1 ) ) + ::oIde:editSource( cSource ) + qCursor := QTextCursor():configure( ::oIde:qCurEdit:textCursor() ) + qCursor:setPosition( 0 ) + qCursor:movePosition( QTextCursor_Down, QTextCursor_MoveAnchor, nLine ) + ::oIde:qCurEdit:setTextCursor( qCursor ) + ELSE + nLine := 0 + ENDIF + ENDIF ENDIF IF ::nPass >= 2 ::nPass := 0 ENDIF ENDIF - RETURN Self + RETURN nLine /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 675751dab8..cbb2e70971 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -473,15 +473,17 @@ FUNCTION PathNormalized( cPath, lLower ) * * 28/12/2009 - 16:17:37 */ -FUNCTION ConvertBuildStatusMsgToHtml( cText ) +FUNCTION ConvertBuildStatusMsgToHtml( cText, oWidget ) LOCAL aLines LOCAL cLine LOCAL aRegWarns := {} LOCAL aRegErrors := {} - cText := StrTran( cText, Chr(13)+Chr(10), Chr(10) ) - cText := StrTran( cText, Chr(13), Chr(10) ) - cText := StrTran( cText, Chr(10)+Chr(10), Chr(10) ) + oWidget:clear() + + cText := StrTran( cText, Chr( 13 ) + Chr( 10 ), Chr( 10 ) ) + cText := StrTran( cText, Chr( 13 ) , Chr( 10 ) ) + cText := StrTran( cText, Chr( 10 ) + Chr( 10 ), Chr( 10 ) ) /* Convert some chars to valid HTML chars */ DO WHILE "<" $ cText @@ -492,28 +494,35 @@ FUNCTION ConvertBuildStatusMsgToHtml( cText ) cText := StrTran( cText, ">", ">" ) ENDDO - aLines := hb_aTokens( cText, Chr(10) ) + aLines := hb_aTokens( cText, Chr( 10 ) ) + cText := '
'
+ oWidget:insertHTML( cText )
AAdd( aRegWarns, hb_RegexComp( ".*: warning.*" ) )
AAdd( aRegWarns, hb_RegexComp( ".*\) Warning W.*" ) )
AAdd( aRegErrors, hb_RegexComp( ".*: error.*" ) )
AAdd( aRegErrors, hb_RegexComp( ".*\) Error E.*" ) )
-
+
FOR EACH cLine IN aLines
- IF Empty( cLine )
- *
- ELSEIF aScan( aRegWarns, {| reg | !Empty(hb_RegEx( reg, cLine )) } ) > 0
- cLine := '' + cLine + ''
+ IF Empty( cLine )
+ *
+ ELSEIF aScan( aRegWarns, {| reg | !Empty( hb_RegEx( reg, cLine ) ) } ) > 0
+ cLine := '' + cLine + ''
- ELSEIF aScan( aRegErrors, {| reg | !Empty(hb_RegEx( reg, cLine )) } ) > 0
- cLine := '' + cLine + ''
- End
- cText += cLine + '
'
- End
+ ELSEIF aScan( aRegErrors, {| reg | !Empty( hb_RegEx( reg, cLine ) ) } ) > 0
+ cLine := '' + cLine + ''
+
+ ENDIF
+
+ oWidget:append( cLine )
+
+ cText += cLine + '
'
+ NEXT
+
+ cText += ''
- cText += ''
RETURN cText
/*----------------------------------------------------------------------*/
diff --git a/harbour/contrib/hbqt/qtgui/QTextCursor.cpp b/harbour/contrib/hbqt/qtgui/QTextCursor.cpp
index fe998c083e..530ef77cb4 100644
--- a/harbour/contrib/hbqt/qtgui/QTextCursor.cpp
+++ b/harbour/contrib/hbqt/qtgui/QTextCursor.cpp
@@ -74,6 +74,7 @@
#include
+#include
#include
#include
@@ -130,7 +131,7 @@ bool atEnd () const
bool atStart () const
void beginEditBlock ()
#
-//QTextBlock block () const
+QTextBlock block () const
#
QTextCharFormat blockCharFormat () const
QTextBlockFormat blockFormat () const