From eb50c3f64c79de09a4eb7622fe04a64dcf641bd2 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 28 Apr 2010 02:02:36 +0000 Subject: [PATCH] 2010-04-27 19:06 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbxbp/xbplistbox.prg + setItemColorFG( nIndex, aRGB ) * contrib/hbide/ideeditor.prg + Implemented: current function the cursor is navigating highlighted in the Functions List. --- harbour/ChangeLog | 8 ++++++++ harbour/contrib/hbide/ideeditor.prg | 28 ++++++++++++++++++++++++++++ harbour/contrib/hbxbp/xbplistbox.prg | 16 ++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7fc63867b7..024fe5a383 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,14 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-04-27 19:06 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbxbp/xbplistbox.prg + + setItemColorFG( nIndex, aRGB ) + + * contrib/hbide/ideeditor.prg + + Implemented: current function the cursor is navigating + highlighted in the Functions List. + 2010-04-28 01:39 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/cdpapi.c * harbour/src/rtl/cdpapihb.c diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index e086d33f97..1abacf06fe 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -1394,6 +1394,7 @@ CLASS IdeEdit INHERIT IdeObject DATA nLastLine INIT -99 DATA nCurLineNo INIT 0 DATA nPrevLineNo INIT -1 + DATA nPrevLineNo1 INIT -1 DATA aBookMarks INIT {} @@ -1468,6 +1469,7 @@ CLASS IdeEdit INHERIT IdeObject METHOD refresh() METHOD isModified() INLINE ::oEditor:qDocument:isModified() METHOD setFont() + METHOD markCurrentFunction() ENDCLASS @@ -1688,6 +1690,8 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) ::handlePreviousWord( ::lUpdatePrevWord ) ::handleCurrentIndent() + ::markCurrentFunction() + IF ::nProtoLine != -1 nLine := ::getLineNo() IF ! ::isSuspended @@ -1891,6 +1895,30 @@ METHOD IdeEdit:execKeyEvent( nMode, nEvent, p, p1 ) /*----------------------------------------------------------------------*/ +METHOD IdeEdit:markCurrentFunction() + LOCAL n, nCurLine + + IF ::nPrevLineNo1 != ::getLineNo() + ::nPrevLineNo1 := ::getLineNo() + + IF !empty( ::aTags ) + nCurLine := ::getLineNo() + IF len( ::aTags ) == 1 + n := 1 + ELSEIF ( n := ascan( ::aTags, {|e_| e_[ 3 ] >= nCurLine } ) ) == 0 + n := len( ::aTags ) + ELSEIF n > 0 + n-- + ENDIF + IF n > 0 + ::oIde:oFuncList:setItemColorFG( n, { 255,0,0 } ) + ENDIF + ENDIF + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEdit:presentSkeletons() ::oSK:selectByMenuAndPostText( ::qEdit ) diff --git a/harbour/contrib/hbxbp/xbplistbox.prg b/harbour/contrib/hbxbp/xbplistbox.prg index dd568f0ebe..7774cb1293 100644 --- a/harbour/contrib/hbxbp/xbplistbox.prg +++ b/harbour/contrib/hbxbp/xbplistbox.prg @@ -86,6 +86,8 @@ CLASS XbpListBox INHERIT XbpWindow, XbpDataRef DATA oStrModel DATA aItems INIT {} + DATA nOldIndex INIT 0 + METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) METHOD hbCreateFromQtPtr( oParent, oOwner, aPos, aSize, aPresParams, lVisible, pQtObject ) @@ -118,6 +120,7 @@ CLASS XbpListBox INHERIT XbpWindow, XbpDataRef METHOD toggleSelected( nIndex ) METHOD connectAll() METHOD disConnectAll() + METHOD setItemColorFG( nIndex, aRGB ) DATA sl_hScroll @@ -408,6 +411,19 @@ METHOD XbpListBox:setItem( nIndex, cItem ) /*----------------------------------------------------------------------*/ +METHOD XbpListBox:setItemColorFG( nIndex, aRGB ) + + IF hb_isNumeric( nIndex ) .AND. nIndex > 0 .AND. nIndex <= len( ::aItems ) + IF ::nOldIndex > 0 .AND. nIndex <= len( ::aItems ) + ::aItems[ ::nOldIndex ]:setForeGround( QBrush():new( "QColor", QColor():new( 0,0,0 ) ) ) + ENDIF + ::aItems[ nIndex ]:setForeGround( QBrush():new( "QColor", QColor():new( aRGB[ 1 ], aRGB[ 2 ], aRGB[ 3 ] ) ) ) + ::nOldIndex := nIndex + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD XbpListBox:itemMarked( ... ) LOCAL a_:= hb_aParams() IF len( a_ ) == 1 .AND. hb_isBlock( a_[ 1 ] )