From 7f6a0de6de622ffdcb3960233a37ec00a612c4c6 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 18 May 2010 21:35:15 +0000 Subject: [PATCH] 2010-15-18 14:30 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/hbide.prg * contrib/hbide/ideedit.prg * contrib/hbide/ideeditor.prg * contrib/hbide/idetags.prg + Implemented: Context-menu option "Goto Function" looks for the function/method in the current source first, and if found, jumps to that, otherwise it rellies on tagging. It implies that functions in current source are always can be reached with "Goto Function" option which operates on word under cursor. --- harbour/ChangeLog | 12 ++++++++++++ harbour/contrib/hbide/hbide.prg | 2 +- harbour/contrib/hbide/ideedit.prg | 24 +++++++++++++++++++----- harbour/contrib/hbide/ideeditor.prg | 11 +++++++++++ harbour/contrib/hbide/idetags.prg | 5 +++-- 5 files changed, 46 insertions(+), 8 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 87bedefb05..291181f2de 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,18 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-15-18 14:30 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/hbide.prg + * contrib/hbide/ideedit.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/idetags.prg + + Implemented: Context-menu option "Goto Function" looks + for the function/method in the current source first, + and if found, jumps to that, otherwise it rellies on + tagging. It implies that functions in current source + are always can be reached with "Goto Function" option + which operates on word under cursor. + 2010-15-18 13:00 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/ideprojmanager.prg % Fixed: tab order in "Projects Properties" dialog. diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 03147e8155..148864e342 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -1274,7 +1274,7 @@ METHOD HbIde:CreateTags() cComments := CheckComments( ::aText ) aSummary := Summarize( ::aText, cComments, @aSumData , iif( Upper( cExt ) == ".PRG", 9, 1 ) ) - ::aTags := UpdateTags( ::aSources[ i ], aSummary, aSumData, @::aFuncList, @::aLines ) + ::aTags := UpdateTags( ::aSources[ i ], aSummary, aSumData, @::aFuncList, @::aLines, ::aText ) #if 0 IF !empty( aTags ) diff --git a/harbour/contrib/hbide/ideedit.prg b/harbour/contrib/hbide/ideedit.prg index 9b2df08d82..04f8ad0534 100644 --- a/harbour/contrib/hbide/ideedit.prg +++ b/harbour/contrib/hbide/ideedit.prg @@ -1441,11 +1441,17 @@ METHOD IdeEdit:find( cText, nPosFrom ) qCursor:setPosition( nPosFrom ) ENDIF ::qEdit:setTextCursor( qCursor ) - IF ( lFound := ::qEdit:find( cText, QTextDocument_FindCaseSensitively ) ) - ::qEdit:centerCursor() - ELSE + IF ! ( lFound := ::qEdit:find( cText, QTextDocument_FindCaseSensitively ) ) + IF ! hb_isNumeric( nPosFrom ) + lFound := ::qEdit:find( cText, QTextDocument_FindBackward + QTextDocument_FindCaseSensitively ) + ENDIF + ENDIF + + IF ! lFound qCursor:setPosition( nPos ) ::qEdit:setTextCursor( qCursor ) + ELSE + ::qEdit:centerCursor() ENDIF RETURN lFound @@ -1798,9 +1804,17 @@ METHOD IdeEdit:handleCurrentIndent() /*----------------------------------------------------------------------*/ METHOD IdeEdit:gotoFunction() - LOCAL cWord + LOCAL cWord, n + LOCAL lFindCur := .f. IF !empty( cWord := ::getWord( .f. ) ) - ::oFN:jumpToFunction( cWord, .t. ) + IF ( n := ascan( ::aTags, {|e_| lower( cWord ) $ lower( e_[ 7 ] ) } ) ) > 0 + IF ::find( alltrim( ::aTags[ n,8 ] ) ) + lFindCur := .t. + ENDIF + ENDIF + IF ! lFindCur + ::oFN:jumpToFunction( cWord, .t. ) + ENDIF ENDIF RETURN Self diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index e095118240..bee5819df8 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -167,6 +167,8 @@ CLASS IdeEditsManager INHERIT IdeObject METHOD pageUp() METHOD pageDown() + METHOD find( cString ) + ENDCLASS /*----------------------------------------------------------------------*/ @@ -1093,6 +1095,15 @@ METHOD IdeEditsManager:pageDown() ENDIF RETURN Self /*----------------------------------------------------------------------*/ +// Locating +/*----------------------------------------------------------------------*/ +METHOD IdeEditsManager:find( cString ) + LOCAL oEdit + IF !empty( oEdit := ::getEditObjectCurrent() ) + oEdit:find( cString ) + ENDIF + RETURN Self +/*----------------------------------------------------------------------*/ // // CLASS IdeEditor // Holds One Document in One Tab diff --git a/harbour/contrib/hbide/idetags.prg b/harbour/contrib/hbide/idetags.prg index 95e1587929..2d1dcb5626 100644 --- a/harbour/contrib/hbide/idetags.prg +++ b/harbour/contrib/hbide/idetags.prg @@ -71,7 +71,7 @@ /*----------------------------------------------------------------------*/ -FUNCTION UpdateTags( cModule, aSummary, aSumData, aFuncList, aLines ) +FUNCTION UpdateTags( cModule, aSummary, aSumData, aFuncList, aLines, aText ) LOCAL cType, cName, cSyntax, n, m, i, cSource, cExt LOCAL cClassName := "" LOCAL aTags := {} @@ -174,7 +174,8 @@ FUNCTION UpdateTags( cModule, aSummary, aSumData, aFuncList, aLines ) cModule ,; cSyntax ,; cType ,; - Iif( cType = "METH", ":", "" ) + cSyntax ; + Iif( cType = "METH", ":", "" ) + cSyntax, ; + aText[ aSumData[ i,2 ] ] ; }; ) ENDIF