From fb6bbdebc300a914c682b7f4e0b095f36189363c Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 28 Aug 2012 21:18:23 +0000 Subject: [PATCH] 2012-08-28 14:13 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/dict.prg * contrib/hbide/functions.prg * contrib/hbide/saveload.prg + Added: to load HbIDE created {project_name}.tag files for "Dictionaries" implementation.The options earlier were .hbx, .dic, .txt. It will save you a lot of time to create disctionaries manually. --- harbour/ChangeLog | 9 +++++++++ harbour/contrib/hbide/dict.prg | 17 ++++++++++++----- harbour/contrib/hbide/functions.prg | 14 +++++++------- harbour/contrib/hbide/saveload.prg | 6 +++++- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ed495bfdf5..6a28db19b5 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,15 @@ The license applies to all entries newer than 2009-04-28. */ +2012-08-28 14:13 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/dict.prg + * contrib/hbide/functions.prg + * contrib/hbide/saveload.prg + + Added: to load HbIDE created {project_name}.tag files + for "Dictionaries" implementation.The options earlier were + .hbx, .dic, .txt. It will save you a lot of time to create + disctionaries manually. + 2012-08-28 12:46 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/hbqt_init.cpp ! Fixed: QTableWidgetItem => QTableWidgetItem* diff --git a/harbour/contrib/hbide/dict.prg b/harbour/contrib/hbide/dict.prg index 85cfd77d05..0226da061b 100644 --- a/harbour/contrib/hbide/dict.prg +++ b/harbour/contrib/hbide/dict.prg @@ -111,10 +111,6 @@ FUNCTION hbide_loadUserDictionaries( oIde ) LOCAL aDict := oIde:oINI:aDictionaries LOCAL oDict, i - IF Empty( aDict ) - AAdd( aDict, "C:\harbour\contrib\hbide\projects\my.dic;YES;.PRG.C.CPP;ASIS;NO;NO;NO;NO;{0,0,0};{122,133,233};" ) /* Testing */ - ENDIF - FOR i := 1 TO Len( aDict ) oDict := IdeDictionary():new( oIde ):create() oDict:load( aDict[ i ] ) @@ -148,6 +144,7 @@ CLASS IdeDictionary INHERIT IdeObject DATA lBgColor INIT .F. DATA cTxtColor INIT "" DATA cBgColor INIT "" + DATA aRawLines INIT {} DATA hItems INIT {=>} @@ -242,9 +239,19 @@ METHOD IdeDictionary:load( cDict ) IF !empty( ::cFilename ) .AND. hb_fileExists( ::cFilename ) IF Lower( hb_FNameExt( ::cFilename ) ) == ".hbx" b_:= hbide_getHbxFunctions( hb_MemoRead( ::cFilename ) ) + ELSEIF Lower( hb_FNameExt( ::cFilename ) ) == ".tag" + c_:= hb_deserialize( hb_memoRead( ::cFilename ) ) + IF Empty( c_ ) .OR. ! HB_ISARRAY( c_ ) + c_:= {} + ENDIF + b_:= {} + FOR EACH s IN c_ + AAdd( b_, s[ 5 ] ) + NEXT ELSE b_:= hbide_readSource( ::cFilename ) ENDIF + ::aRawLines := b_ FOR EACH s IN b_ s := alltrim( s ) IF empty( s ) @@ -324,7 +331,7 @@ METHOD IdeDictionary:populateUI( oUI ) oUI:radioDictAsIn : setChecked( ::cConvMode == "ASIS" ) oUI:plainKeywords : clear() - oUI:plainKeywords : setPlainText( hb_MemoRead( ::cFileName ) ) + oUI:plainKeywords : setPlainText( hbide_arrayToMemo( ::aRawLines ) ) ::setButtonColors( oUI ) diff --git a/harbour/contrib/hbide/functions.prg b/harbour/contrib/hbide/functions.prg index 1509b9bf4e..bfd985e7ae 100644 --- a/harbour/contrib/hbide/functions.prg +++ b/harbour/contrib/hbide/functions.prg @@ -146,13 +146,13 @@ METHOD IdeFunctions:create( oIde ) ::buildHeader() - ::oUI:editFunction :connect( "textChanged(QString)" , {|p| ::execEvent( __editFunc_textChanged__ , p ) } ) - ::oUI:editFunction :connect( "returnPressed()" , {| | ::execEvent( __editFunc_returnPressed__ ) } ) - ::oUI:buttonMark :connect( "clicked()" , {| | ::execEvent( __buttonMark_clicked__ ) } ) - ::oUI:buttonLoad :connect( "clicked()" , {| | ::execEvent( __buttonLoad_clicked__ ) } ) - ::oUI:buttonTag :connect( "clicked()" , {| | ::execEvent( __buttonTag_clicked__ ) } ) - ::oUI:buttonClose :connect( "clicked()" , {| | ::execEvent( __buttonClose_clicked__ ) } ) - ::oUI:tableFuncList:connect( "itemSelectionChanged()" , {| | ::execEvent( __tableFuncList_itemSelectionChanged__ ) } ) + ::oUI:editFunction :connect( "textChanged(QString)" , {|p| ::execEvent( __editFunc_textChanged__ , p ) } ) + ::oUI:editFunction :connect( "returnPressed()" , {| | ::execEvent( __editFunc_returnPressed__ ) } ) + ::oUI:buttonMark :connect( "clicked()" , {| | ::execEvent( __buttonMark_clicked__ ) } ) + ::oUI:buttonLoad :connect( "clicked()" , {| | ::execEvent( __buttonLoad_clicked__ ) } ) + ::oUI:buttonTag :connect( "clicked()" , {| | ::execEvent( __buttonTag_clicked__ ) } ) + ::oUI:buttonClose :connect( "clicked()" , {| | ::execEvent( __buttonClose_clicked__ ) } ) + ::oUI:tableFuncList:connect( "itemSelectionChanged()" , {| | ::execEvent( __tableFuncList_itemSelectionChanged__ ) } ) ::oUI:tableFuncList:connect( "itemDoubleClicked(QTableWidgetItem*)", {|p| ::execEvent( __tableFuncList_itemDoubleClicked__, p ) } ) RETURN Self diff --git a/harbour/contrib/hbide/saveload.prg b/harbour/contrib/hbide/saveload.prg index a5f49e9131..6c60e4bc17 100644 --- a/harbour/contrib/hbide/saveload.prg +++ b/harbour/contrib/hbide/saveload.prg @@ -2262,7 +2262,11 @@ METHOD IdeSetup:execEvent( nEvent, p, p1 ) EXIT CASE __buttonDictAdd_clicked__ cFile := hbide_fetchAFile( ::oDlg, "Open a Dictionary", ; - { {"HBX Files", "*.hbx"}, {"Text Files", "*.txt"}, {"Dictionary Files", "*.dic"}, {"All Files", "*" } } /*, cDftDir, cDftSuffix, lAllowMulti*/ ) + { { "HBX Files" , "*.hbx" }, ; + { "HbIDE .tag Files", "*.tag" }, ; + { "Text Files" , "*.txt" }, ; + { "Dictionary Files", "*.dic" }, ; + { "All Files" , "*" } } /*, cDftDir, cDftSuffix, lAllowMulti*/ ) IF ! Empty( cFile ) oDict := IdeDictionary():new( ::oIde ):create() oDict:load( cFile )