From 6f467ba4791c5f3c8ccd04e866519a0287767527 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 7 Sep 2010 08:13:38 +0000 Subject: [PATCH] 2010-09-07 01:05 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbxbp/hbpprocess.prg + Prepared to route stdOut and stdErr outputs accordingly. * contrib/hbxbp/xbprtf.prg ! Minor. * contrib/hbide/idemisc.prg * contrib/hbide/ideprojmanager.prg + Implemented: first error reported by hbMK2 when a project is built, is made visible in the "Output Console" after compile/link cycle is finished. This facilitates to track errors instantly without naviaging the contents of output console. --- harbour/ChangeLog | 14 ++++++++++ harbour/contrib/hbide/idemisc.prg | 12 +++++---- harbour/contrib/hbide/ideprojmanager.prg | 34 +++++++++++++++++++++--- harbour/contrib/hbxbp/hbpprocess.prg | 12 +++++---- harbour/contrib/hbxbp/xbprtf.prg | 1 + 5 files changed, 60 insertions(+), 13 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 02b796c9b3..004d77a237 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,20 @@ The license applies to all entries newer than 2009-04-28. */ +2010-09-07 01:05 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbxbp/hbpprocess.prg + + Prepared to route stdOut and stdErr outputs accordingly. + + * contrib/hbxbp/xbprtf.prg + ! Minor. + + * contrib/hbide/idemisc.prg + * contrib/hbide/ideprojmanager.prg + + Implemented: first error reported by hbMK2 when a project is built, + is made visible in the "Output Console" after compile/link cycle is + finished. This facilitates to track errors instantly without naviaging + the contents of output console. + 2010-09-07 09:16 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbmysql/hbmysql.hbp * harbour/contrib/gtalleg/gtalleg.hbm diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 9a133e267c..839600c57b 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -761,9 +761,7 @@ FUNCTION hbide_parseFNfromStatusMsg( cText, cFileName, nLine, lValidText ) */ FUNCTION hbide_convertBuildStatusMsgToHtml( cText, oWidget ) LOCAL aColors := { CLR_MSG_ERR, CLR_MSG_INFO, CLR_MSG_WARN } - LOCAL aLines - LOCAL cLine - LOCAL nPos + LOCAL aLines, cIfError, cLine, nPos IF aRegList == NIL aRegList := {} @@ -773,6 +771,7 @@ FUNCTION hbide_convertBuildStatusMsgToHtml( cText, oWidget ) 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 ) ) + cText := StrTran( cText, " ", " " ) /* Convert some chars to valid HTML chars */ DO WHILE "<" $ cText @@ -787,18 +786,21 @@ FUNCTION hbide_convertBuildStatusMsgToHtml( cText, oWidget ) IF !Empty( cLine ) IF ( nPos := aScan( aRegList, {| reg | !Empty( hb_RegEx( reg[ 2 ], cLine ) ) } ) ) > 0 + IF aRegList[ nPos,1 ] == MSG_TYPE_ERR + cIfError := cLine + ENDIF cLine := '' + cLine + '' ELSEIF "XBT" $ cLine cLine := '' + cLine + '' ELSE - cLine := "" + cLine + "" + cLine := "" + cLine + "" ENDIF ENDIF oWidget:append( cLine ) NEXT - RETURN cText + RETURN cIfError /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index ea85488689..251b38687b 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -224,6 +224,8 @@ CLASS IdeProjManager INHERIT IdeObject DATA lFetch INIT .T. DATA lUpdateTree INIT .F. + DATA cIfError INIT NIL + METHOD new( oIDE ) METHOD create( oIDE ) METHOD destroy() @@ -1469,18 +1471,22 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) /*----------------------------------------------------------------------*/ METHOD IdeProjManager:showOutput( cOutput, mp2, oProcess ) + LOCAL cIfError HB_SYMBOL_UNUSED( mp2 ) HB_SYMBOL_UNUSED( oProcess ) - hbide_convertBuildStatusMsgToHtml( cOutput, ::oOutputResult:oWidget ) + cIfError := hbide_convertBuildStatusMsgToHtml( cOutput, ::oOutputResult:oWidget ) + IF ! empty( cIfError ) .AND. empty( ::cIfError ) + ::cIfError := cIfError + ENDIF RETURN Self /*----------------------------------------------------------------------*/ METHOD IdeProjManager:finished( nExitCode, nExitStatus, oProcess ) - LOCAL cTmp, n, n1, cTkn, cExe + LOCAL cTmp, n, n1, cTkn, cExe, qDoc, qCursor HB_SYMBOL_UNUSED( oProcess ) @@ -1492,6 +1498,21 @@ METHOD IdeProjManager:finished( nExitCode, nExitStatus, oProcess ) ferase( ::cBatch ) + IF ! empty( ::cIfError ) + ::oOutputResult:SelStart := 0 + ::oOutputResult:find( ::cIfError ) + ::oOutputResult:SelBold := .T. + + qDoc := QTextDocument():from( ::oOutputResult:document() ) + FOR n := 0 TO qDoc:blockCount() - 1 + IF ::cIfError == QTextBlock():from( qDoc:findBlockByNumber( n ) ):text() + qCursor := QTextCursor():from( qDoc:find_2( ::cIfError ) ) + ::oOutputResult:setTextCursor( qCursor ) + EXIT + ENDIF + NEXT + ENDIF + IF ::lLaunch cTmp := ::oOutputResult:oWidget:toPlainText() cExe := "" @@ -1535,6 +1556,12 @@ METHOD IdeProjManager:finished( nExitCode, nExitStatus, oProcess ) ::editSource( ::cPPO ) ENDIF + ::cIfError := NIL + ::oOutputResult:ensureCursorVisible() + IF !empty( qCursor ) + qCursor:clearSelection() + ::oOutputResult:setTextCursor( qCursor ) + ENDIF RETURN Self /*----------------------------------------------------------------------*/ @@ -1620,8 +1647,9 @@ METHOD IdeProjManager:runAsScript() METHOD IdeProjManager:outputText( cText ) - ::oOutputResult:oWidget:append( cText ) + ::oOutputResult:oWidget:append( "" + cText + "" ) RETURN Self /*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbxbp/hbpprocess.prg b/harbour/contrib/hbxbp/hbpprocess.prg index 90e32a7cd5..3f0afec655 100644 --- a/harbour/contrib/hbxbp/hbpprocess.prg +++ b/harbour/contrib/hbxbp/hbpprocess.prg @@ -122,7 +122,7 @@ CLASS HbpProcess DATA bOutput METHOD read( nMode, i, ii ) - METHOD outputMe( cLine ) + METHOD outputMe( cLine, nMode ) METHOD finish() ENDCLASS @@ -243,19 +243,19 @@ METHOD HbpProcess:read( nMode, i, ii ) DO CASE CASE nMode == CHN_BGN - ::outputMe( "CurDir() => " + CurDir() + " Starting in => " + ::qProcess:workingDirectory() ) + ::outputMe( "CurDir() => " + CurDir() + " Starting in => " + ::qProcess:workingDirectory(), CHN_BGN ) CASE nMode == CHN_OUT ::qProcess:setReadChannel( 0 ) cLine := space( nSize ) ::qProcess:read( @cLine, nSize ) - ::outputMe( cLine ) + ::outputMe( cLine, CHN_OUT ) CASE nMode == CHN_ERR ::qProcess:setReadChannel( 1 ) cLine := space( nSize ) ::qProcess:read( @cLine, nSize ) - ::outputMe( cLine ) + ::outputMe( cLine, CHN_ERR ) CASE nMode == CHN_FIN ::nExitCode := i @@ -269,7 +269,9 @@ METHOD HbpProcess:read( nMode, i, ii ) /*----------------------------------------------------------------------*/ -METHOD HbpProcess:outputMe( cLine ) +METHOD HbpProcess:outputMe( cLine, nMode ) + + HB_SYMBOL_UNUSED( nMode ) IF hb_isBlock( ::bOutput ) .AND. !empty( cLine ) eval( ::bOutput, trim( cLine ), NIL, Self ) diff --git a/harbour/contrib/hbxbp/xbprtf.prg b/harbour/contrib/hbxbp/xbprtf.prg index 7150c1cd87..0b3afe33bf 100644 --- a/harbour/contrib/hbxbp/xbprtf.prg +++ b/harbour/contrib/hbxbp/xbprtf.prg @@ -308,6 +308,7 @@ METHOD XbpRtf:find( cSearchString, nStart, nEnd, nOptions ) ::oTextDocument:pPtr := ::oWidget:document() ::oTextCursor:pPtr := ::oTextDocument:find_2( cSearchString ) ::oCurCursor := ::oTextCursor + nPos := ::oTextCursor:position() ENDIF RETURN nPos