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.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -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 := '<pre><code>'
|
||||
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 := '<font color=blue>' + cLine + '</font>'
|
||||
IF Empty( cLine )
|
||||
*
|
||||
ELSEIF aScan( aRegWarns, {| reg | !Empty( hb_RegEx( reg, cLine ) ) } ) > 0
|
||||
cLine := '<font color=blue>' + cLine + '</font>'
|
||||
|
||||
ELSEIF aScan( aRegErrors, {| reg | !Empty(hb_RegEx( reg, cLine )) } ) > 0
|
||||
cLine := '<font color=red>' + cLine + '</font>'
|
||||
End
|
||||
cText += cLine + '<br>'
|
||||
End
|
||||
ELSEIF aScan( aRegErrors, {| reg | !Empty( hb_RegEx( reg, cLine ) ) } ) > 0
|
||||
cLine := '<font color=red>' + cLine + '</font>'
|
||||
|
||||
ENDIF
|
||||
|
||||
oWidget:append( cLine )
|
||||
|
||||
cText += cLine + '<br>'
|
||||
NEXT
|
||||
|
||||
cText += '</code></pre>'
|
||||
|
||||
cText += '</code></pre>'
|
||||
RETURN cText
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
#include <QtGui/QTextBlock>
|
||||
#include <QtGui/QTextCursor>
|
||||
#include <QtGui/QTextDocumentFragment>
|
||||
|
||||
@@ -87,22 +88,22 @@
|
||||
* ~QTextCursor ()
|
||||
*/
|
||||
|
||||
QT_G_FUNC( hbqt_gcRelease_QTextCursor )
|
||||
QT_G_FUNC( release_QTextCursor )
|
||||
{
|
||||
QGC_POINTER * p = ( QGC_POINTER * ) Cargo;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextCursor p=%p", p ) );
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextCursor ph=%p", p->ph ) );
|
||||
HB_TRACE( HB_TR_DEBUG, ( "release_QTextCursor p=%p", p ) );
|
||||
HB_TRACE( HB_TR_DEBUG, ( "release_QTextCursor ph=%p", p->ph ) );
|
||||
|
||||
if( p && p->ph )
|
||||
{
|
||||
delete ( ( QTextCursor * ) p->ph );
|
||||
p->ph = NULL;
|
||||
HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextCursor Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
|
||||
HB_TRACE( HB_TR_DEBUG, ( "YES release_QTextCursor Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextCursor Object Already deleted!" ) );
|
||||
HB_TRACE( HB_TR_DEBUG, ( "DEL release_QTextCursor Object Already deleted!" ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ void * hbqt_gcAllocate_QTextCursor( void * pObj )
|
||||
QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() );
|
||||
|
||||
p->ph = pObj;
|
||||
p->func = hbqt_gcRelease_QTextCursor;
|
||||
p->func = release_QTextCursor;
|
||||
HB_TRACE( HB_TR_DEBUG, ( " new_QTextCursor %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
|
||||
return( p );
|
||||
}
|
||||
@@ -200,6 +201,14 @@ HB_FUNC( QT_QTEXTCURSOR_BEGINEDITBLOCK )
|
||||
hbqt_par_QTextCursor( 1 )->beginEditBlock();
|
||||
}
|
||||
|
||||
/*
|
||||
* QTextBlock block () const
|
||||
*/
|
||||
HB_FUNC( QT_QTEXTCURSOR_BLOCK )
|
||||
{
|
||||
hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextCursor( 1 )->block() ) ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* QTextCharFormat blockCharFormat () const
|
||||
*/
|
||||
|
||||
@@ -63,9 +63,12 @@
|
||||
#include "hbclass.ch"
|
||||
|
||||
|
||||
CREATE CLASS QTextCursor INHERIT HbQtObjectHandler
|
||||
CREATE CLASS QTextCursor
|
||||
|
||||
VAR pPtr
|
||||
|
||||
METHOD new()
|
||||
METHOD configure( xObject )
|
||||
|
||||
METHOD anchor()
|
||||
METHOD atBlockEnd()
|
||||
@@ -73,6 +76,7 @@ CREATE CLASS QTextCursor INHERIT HbQtObjectHandler
|
||||
METHOD atEnd()
|
||||
METHOD atStart()
|
||||
METHOD beginEditBlock()
|
||||
METHOD block()
|
||||
METHOD blockCharFormat()
|
||||
METHOD blockFormat()
|
||||
METHOD blockNumber()
|
||||
@@ -130,6 +134,7 @@ CREATE CLASS QTextCursor INHERIT HbQtObjectHandler
|
||||
|
||||
ENDCLASS
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD QTextCursor:new( ... )
|
||||
LOCAL p
|
||||
@@ -141,6 +146,15 @@ METHOD QTextCursor:new( ... )
|
||||
RETURN Self
|
||||
|
||||
|
||||
METHOD QTextCursor:configure( xObject )
|
||||
IF hb_isObject( xObject )
|
||||
::pPtr := xObject:pPtr
|
||||
ELSEIF hb_isPointer( xObject )
|
||||
::pPtr := xObject
|
||||
ENDIF
|
||||
RETURN Self
|
||||
|
||||
|
||||
METHOD QTextCursor:anchor()
|
||||
RETURN Qt_QTextCursor_anchor( ::pPtr )
|
||||
|
||||
@@ -165,6 +179,10 @@ METHOD QTextCursor:beginEditBlock()
|
||||
RETURN Qt_QTextCursor_beginEditBlock( ::pPtr )
|
||||
|
||||
|
||||
METHOD QTextCursor:block()
|
||||
RETURN Qt_QTextCursor_block( ::pPtr )
|
||||
|
||||
|
||||
METHOD QTextCursor:blockCharFormat()
|
||||
RETURN Qt_QTextCursor_blockCharFormat( ::pPtr )
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ oTextCursor := QTextCursor():new( "QTextFrame" , pQTextFrame )
|
||||
</DOC>
|
||||
|
||||
<CODE>
|
||||
#include <QtGui/QTextBlock>
|
||||
#include <QtGui/QTextCursor>
|
||||
#include <QtGui/QTextDocumentFragment>
|
||||
|
||||
@@ -130,7 +131,7 @@ bool atEnd () const
|
||||
bool atStart () const
|
||||
void beginEditBlock ()
|
||||
#
|
||||
//QTextBlock block () const
|
||||
QTextBlock block () const
|
||||
#
|
||||
QTextCharFormat blockCharFormat () const
|
||||
QTextBlockFormat blockFormat () const
|
||||
|
||||
Reference in New Issue
Block a user