diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 263356878b..e4d18f0fb1 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,17 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-02-26 20:51 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/ideeditor.prg + * contrib/hbide/ideharbourhelp.prg + + Implemented: auto activating and displaying the function's documentation + you have currently finished typing opening brace. This feature + is activated only when you have initialized the documentation + browser by clicking on the "H" icon on the right toolbar. + + I am open to hear what other features can be implemented in this context. + This itself is a big productivity boost. + 2010-02-26 18:15 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/THbQtUI.prg ! Miss of prev commit. diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index 5b158910dd..c7a9769835 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -1380,6 +1380,7 @@ CLASS IdeEdit INHERIT IdeObject METHOD presentSkeletons() METHOD handleCurrentIndent() METHOD handlePreviousWord( lUpdatePrevWord ) + METHOD loadFuncHelp() ENDCLASS @@ -1524,7 +1525,7 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) EXIT CASE textChanged - hbide_dbg( "textChanged()" ) + //hbide_dbg( "textChanged()" ) ::oEditor:setTabImage( qEdit ) EXIT @@ -1545,7 +1546,7 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) EXIT CASE cursorPositionChanged - hbide_dbg( "cursorPositionChanged()" ) + //hbide_dbg( "cursorPositionChanged()" ) ::oEditor:dispEditInfo( qEdit ) ::handlePreviousWord( ::lUpdatePrevWord ) ::handleCurrentIndent() @@ -1664,6 +1665,11 @@ METHOD IdeEdit:execKeyEvent( nMode, nEvent, p ) ::moveLine( 1 ) RETURN .t. ENDIF + CASE Qt_Key_ParenLeft + IF ! lCtrl .AND. ! lAlt + ::loadFuncHelp() + ENDIF + EXIT ENDSWITCH EXIT @@ -1838,6 +1844,27 @@ METHOD IdeEdit:caseInvert() /*----------------------------------------------------------------------*/ +METHOD IdeEdit:loadFuncHelp() + LOCAL qEdit, qCursor, qTextBlock, cText, cWord, nCol + + qEdit := ::qEdit + + qCursor := QTextCursor():configure( qEdit:textCursor() ) + qTextBlock := QTextBlock():configure( qCursor:block() ) + cText := qTextBlock:text() + nCol := qCursor:columnNumber() + cWord := hbide_getPreviousWord( cText, nCol ) +hbide_dbg( "IdeEdit:loadFuncHelp()", cWord ) + IF !empty( cWord ) + IF !empty( ::oDocViewDock:qtObject ) + ::oDocViewDock:qtObject:jumpToFunction( cWord ) + ENDIF + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEdit:handlePreviousWord( lUpdatePrevWord ) LOCAL qCursor, qTextBlock, cText, cWord, nB, nL, qEdit, lPrevOnly, nCol, nSpace, nSpaces, nOff @@ -1915,7 +1942,6 @@ METHOD IdeEdit:handlePreviousWord( lUpdatePrevWord ) ENDIF ENDIF ENDIF - ENDIF RETURN .t. diff --git a/harbour/contrib/hbide/ideharbourhelp.prg b/harbour/contrib/hbide/ideharbourhelp.prg index d181439609..5603f5d279 100644 --- a/harbour/contrib/hbide/ideharbourhelp.prg +++ b/harbour/contrib/hbide/ideharbourhelp.prg @@ -192,6 +192,7 @@ CLASS IdeHarbourHelp INHERIT IdeObject METHOD exportAsPdf() METHOD paintRequested( pPrinter ) METHOD parseTextFile( cTextFile, oParent ) + METHOD jumpToFunction( cFunction ) ENDCLASS @@ -551,6 +552,21 @@ METHOD IdeHarbourHelp:execEvent( nMode, p, p1 ) /*----------------------------------------------------------------------*/ +METHOD IdeHarbourHelp:jumpToFunction( cFunction ) + LOCAL n, nLen + + nLen := len( cFunction ) + cFunction := lower( cFunction ) + IF !empty( ::aNodes ) + IF ( n := ascan( ::aFunctions, {|e_| lower( left( e_[ 2 ], nLen ) ) == cFunction } ) ) > 0 + ::oUI:q_treeDoc:setCurrentItem( ::aFunctions[ n, 4 ] ) + ENDIF + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeHarbourHelp:populateIndexedSelection() LOCAL qItem, cText, n