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.
This commit is contained in:
Pritpal Bedi
2012-08-08 02:44:50 +00:00
parent 76f774464d
commit 9f52b7f53c
4 changed files with 46 additions and 14 deletions

View File

@@ -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

View File

@@ -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
/*----------------------------------------------------------------------*/

View File

@@ -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.
/*----------------------------------------------------------------------*/

View File

@@ -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