diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2866e937de..498694fe1c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,40 @@ The license applies to all entries newer than 2009-04-28. */ +2012-08-22 17:36 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/dict.prg + * contrib/hbide/edit.prg + * contrib/hbide/themes.prg + + Implemented: The concept of for sake of + syntax highlighting and case conversion while editing a + source. User has the ability to pull keywords from : + a. standard text file (.txt), + b. Harbour's symbol collection mechanism knows + as .hbx files, + c. a text file with the extension .dic (xMate), + d. or any other type of text file ( be careful ). + + Dictionaries can be kept activated/deactivated. + + The following attributes can be assigned to the keywords: + 1. Bold + 2. Italic + 3. Underlined + 4. Text Color + 5. Back Color + 6. Case Sensitivity : from coloring point of view + + Keywords can be attributed to be converted to: + 1. As is typed by the user + 2. Upper-cased + 3. Lower-cased + 4. As published in the dictionary. + + All changes in the dictionary management are reflective + in next run of HbIDE. The changes cannot be made effective inline. + + ; This commit completes a long-standing and much requested feature. + 2012-08-22 09:48 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/dict.prg * contrib/hbide/misc.prg diff --git a/harbour/contrib/hbide/dict.prg b/harbour/contrib/hbide/dict.prg index 6dfcf91ec7..85cfd77d05 100644 --- a/harbour/contrib/hbide/dict.prg +++ b/harbour/contrib/hbide/dict.prg @@ -149,7 +149,7 @@ CLASS IdeDictionary INHERIT IdeObject DATA cTxtColor INIT "" DATA cBgColor INIT "" - DATA aItems INIT {} + DATA hItems INIT {=>} DATA aTxtRGB INIT {} DATA aBgRGB INIT {} @@ -170,7 +170,10 @@ CLASS IdeDictionary INHERIT IdeObject /*----------------------------------------------------------------------*/ METHOD IdeDictionary:new( oIde ) + ::oIde := oIde + hb_HCaseMatch( ::hItems, .F. ) + RETURN Self /*----------------------------------------------------------------------*/ @@ -261,7 +264,7 @@ METHOD IdeDictionary:load( cDict ) ENDIF IF !empty( cKeyword ) - aadd( ::aItems, { cKeyword, cSyntax, cDesc } ) + ::hItems[ cKeyword ] := { cKeyword, cSyntax, cDesc } ENDIF NEXT ENDIF diff --git a/harbour/contrib/hbide/edit.prg b/harbour/contrib/hbide/edit.prg index 1433db2d7f..4df62060b0 100644 --- a/harbour/contrib/hbide/edit.prg +++ b/harbour/contrib/hbide/edit.prg @@ -3549,28 +3549,21 @@ STATIC FUNCTION hbide_isQtFunction( cWord, cCased ) /*----------------------------------------------------------------------*/ STATIC FUNCTION hbide_isUserFunction( cWord, cCased ) - LOCAL s, a_, aDict, oDict + LOCAL 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 + FOR EACH oDict IN hbide_setIDE():aUserDict + IF oDict:lActive + IF hb_HHasKey( oDict:hItems, cWord ) + SWITCH oDict:cConvMode + CASE "ASIS" ; cCased := oDict:hItems[ cWord ][ 1 ] ; EXIT + CASE "LOWER" ; cCased := Lower( oDict:hItems[ cWord ][ 1 ] ) ; EXIT + CASE "UPPER" ; cCased := Upper( oDict:hItems[ cWord ][ 1 ] ) ; EXIT + CASE "NONE" ; cCased := cWord ; EXIT + ENDSWITCH + RETURN .T. ENDIF - NEXT - ENDIF - IF cWord $ s_b_ - cCased := s_b_[ cWord ] - RETURN .T. - ENDIF + ENDIF + NEXT RETURN .F. diff --git a/harbour/contrib/hbide/themes.prg b/harbour/contrib/hbide/themes.prg index 234aab3d86..b4f3d5599b 100644 --- a/harbour/contrib/hbide/themes.prg +++ b/harbour/contrib/hbide/themes.prg @@ -513,17 +513,17 @@ METHOD IdeThemes:mergeUserDictionaries( qHiliter, cTheme ) LOCAL oDict, s, aAttr, qFormat, qRegExp, cName, a_ FOR EACH oDict IN ::oIde:aUserDict - IF oDict:lActive .AND. ! empty( oDict:aItems ) + IF oDict:lActive .AND. ! empty( oDict:hItems ) cName := "UserDictionary" + hb_ntos( oDict:__enumIndex() ) s := "" - FOR EACH a_ IN oDict:aItems + FOR EACH a_ IN oDict:hItems s += "\b" + a_[ 1 ] + "\b|" NEXT s := substr( s, 1, Len( s ) - 1 ) qRegExp := QRegExp() - //qRegExp:setCaseSensitivity( oDict:lCaseSensitive ) + qRegExp:setCaseSensitivity( iif( oDict:lCaseSens, Qt_CaseSensitive, Qt_CaseInsensitive ) ) qRegExp:setPattern( s ) /* Must be blended WITH dictionary definition attributes */