diff --git a/harbour/ChangeLog b/harbour/ChangeLog index de3cd9567b..dd8457e80f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,12 @@ The license applies to all entries newer than 2009-04-28. */ +2012-08-07 19:42 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/dict.prg + * contrib/hbide/edit.prg + * contrib/hbide/themes.prg + + Started: implementation of user-defined dictionaries. + 2012-08-07 18:10 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + contrib/hbide/hbfunc.txt * contrib/hbide/hbide.qrc diff --git a/harbour/contrib/hbide/dict.prg b/harbour/contrib/hbide/dict.prg index 628b842701..2cd404bb6c 100644 --- a/harbour/contrib/hbide/dict.prg +++ b/harbour/contrib/hbide/dict.prg @@ -84,8 +84,8 @@ FUNCTION hbide_loadUserDictionaries( oIde ) // File , CaseSensitive , ConvMode=asis, upper, lower , include in autocomplete, bgColor - #if 0 - LOCAL aDict := { "C:\harbour\contrib\hbide\hbide.dic;NO;ASIS;YES;{122,133,233}" } + #if 1 + LOCAL aDict := { "E:\harbour\contrib\hbide\projects\my.dic;NO;ASIS;YES;{122,133,233}" } #else LOCAL aDict := {} #endif @@ -142,15 +142,6 @@ METHOD IdeDictionary:create( oIde ) METHOD IdeDictionary:destroy() - ::cDictInfo := NIL - ::cFilename := NIL - ::lCaseSensitive := NIL - ::cConvMode := NIL - ::lAutoComplete := NIL - ::cBgColor := NIL - ::qBgColor := NIL - ::aItems := NIL - RETURN Self /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/edit.prg b/harbour/contrib/hbide/edit.prg index 2183bdd185..8b76d20f73 100644 --- a/harbour/contrib/hbide/edit.prg +++ b/harbour/contrib/hbide/edit.prg @@ -2291,6 +2291,16 @@ METHOD IdeEdit:reformatLine( nPos, nAdded, nDeleted ) qCursor:endEditBlock() ENDIF + ELSEIF ( cPWord == "(" .OR. cPWord == " " ) .AND. hbide_isUserFunction( cPPWord, @cCased ) /* User dictionaries : base work */ + IF ::oEditor:lIsPRG + qCursor:beginEditBlock() + qCursor:movePosition( QTextCursor_PreviousWord, QTextCursor_MoveAnchor, 2 ) + qCursor:select( QTextCursor_WordUnderCursor ) + qCursor:removeSelectedText() + qCursor:insertText( cCased ) + qCursor:endEditBlock() + ENDIF + ELSEIF cCWord == " " .AND. cPPWord != "#" .AND. hbide_isHarbourKeyword( cPWord ) IF ::oEditor:lIsPRG .AND. ! ::oINI:lSupressHbKWordsToUpper qCursor:beginEditBlock() @@ -2950,7 +2960,6 @@ FUNCTION hbide_isHarbourKeyword( cWord, oIde ) FUNCTION hbide_isHarbourFunction( cWord, cCased ) LOCAL s, a_ - STATIC s_b_ IF empty( s_b_ ) @@ -2964,7 +2973,6 @@ FUNCTION hbide_isHarbourFunction( cWord, cCased ) ENDIF NEXT ENDIF - IF cWord $ s_b_ cCased := s_b_[ cWord ] RETURN .T. @@ -2974,3 +2982,30 @@ FUNCTION hbide_isHarbourFunction( cWord, cCased ) /*----------------------------------------------------------------------*/ +FUNCTION hbide_isUserFunction( cWord, cCased ) + LOCAL s, a_, aDict, oDict + STATIC s_b_ + + IF empty( s_b_ ) + s_b_:= {=>} + hb_hCaseMatch( s_b_, .f. ) + aDict := hbide_setIDE():aUserDict + FOR EACH oDict IN aDict + IF !Empty( oDict:aItems ) + FOR EACH a_ IN oDict:aItems + s := AllTrim( a_[ 1 ] ) + IF ! Empty( s ) + s_b_[ s ] := s + ENDIF + NEXT + ENDIF + NEXT + ENDIF + IF cWord $ s_b_ + cCased := s_b_[ cWord ] + RETURN .T. + ENDIF + + RETURN .F. + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/themes.prg b/harbour/contrib/hbide/themes.prg index ad80b61db5..498e37f4d4 100644 --- a/harbour/contrib/hbide/themes.prg +++ b/harbour/contrib/hbide/themes.prg @@ -524,7 +524,7 @@ METHOD IdeThemes:mergeUserDictionaries( qHiliter, cTheme ) s := substr( s, 1, Len( s ) - 1 ) qRegExp := QRegExp() - qRegExp:setCaseSensitivity( oDict:lCaseSensitive ) + //qRegExp:setCaseSensitivity( oDict:lCaseSensitive ) qRegExp:setPattern( s ) aAttr := ::getThemeAttribute( "UserDictionary", cTheme ) // cName after slots are implemented