diff --git a/harbour/ChangeLog b/harbour/ChangeLog index dde02588fa..17798cdd43 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,39 @@ The license applies to all entries newer than 2009-04-28. */ +2010-07-15 18:54 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/doc/en/class_hbqplaintextedit.txt + * contrib/hbqt/hbqt_hbqplaintextedit.cpp + * contrib/hbqt/hbqt_hbqplaintextedit.h + * contrib/hbqt/qtgui/HBQPlainTextEdit.cpp + * contrib/hbqt/qtgui/THBQPlainTextEdit.prg + * contrib/hbqt/qth/HBQPlainTextEdit.qth + ! Changed: the space character not to terminate the code completion dialog. + It is needed for commands to be selected at next level. + + + contrib/hbide/plugins/hbide_script_rdds.prg + + Added a dummy script to supply the required info + for different actions of an RDD operation if another + RDD is linked with hbIDE. DBFCDX and DBFNTX are + linked by default. + To make this feature functional, this dummy script has + to be popiulated with real-time code and be copied inside + "resources" folder with another name prefixed as: + hbide_persist_myrdd.prg + A complete example will be published in the meantime. + + * contrib/hbide/hbide.prg + * contrib/hbide/idebrowse.prg + * contrib/hbide/ideplugins.prg + + Implemented: persistent record/order/rowpos/colpos + of ideDBU views. Now tables are opened in the same + state of last run. + + + Totally reworked table-management engine. Now supports + external RDDs if linked which take effect automatically + for database operations, i.e., /rdds/exists/select/open; + more actions will follow. + 2010-07-16 00:25 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * config/vxworks/diab.mk + Implemented support for Wind River Compiler. diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 80b7578724..3afd445e35 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -402,6 +402,9 @@ METHOD HbIde:create( aParams ) ::oINI:load( ::cProjIni ) ENDIF + /* Load Persistent Scripts - hbide_persist_*.prg | hbs */ + hbide_loadPersistentScripts() + /* Load User Dictionaries */ hbide_loadUserDictionaries( Self ) diff --git a/harbour/contrib/hbide/idebrowse.prg b/harbour/contrib/hbide/idebrowse.prg index aaf09b884b..4a3827e565 100644 --- a/harbour/contrib/hbide/idebrowse.prg +++ b/harbour/contrib/hbide/idebrowse.prg @@ -108,11 +108,13 @@ CLASS IdeBrowseManager INHERIT IdeObject DATA qVSplitter DATA qToolBar DATA qStruct + DATA qRddCombo DATA aPanels INIT {} DATA aToolBtns INIT {} DATA aButtons INIT {} DATA aIndexAct INIT {} + DATA aRdds INIT { "DBFCDX", "DBFNTX" } DATA oCurBrw DATA oCurPanel @@ -131,7 +133,7 @@ CLASS IdeBrowseManager INHERIT IdeObject METHOD destroy() METHOD buildToolbar() METHOD execEvent( cEvent, p, p1, p2 ) - METHOD addTable( cFileDBF, cAlias, aInfo ) + METHOD addTable( aInfo ) METHOD addArray( aData, aAttr ) METHOD getPanelNames() METHOD getPanelsInfo() @@ -150,6 +152,8 @@ CLASS IdeBrowseManager INHERIT IdeObject METHOD populateUiStruct() METHOD populateFieldData() METHOD updateIndexMenu( qSubWindow ) + METHOD buildRddsCombo() + ACCESS currentDriver() INLINE ::qRddCombo:currentText() ENDCLASS @@ -385,9 +389,9 @@ METHOD IdeBrowseManager:execEvent( cEvent, p, p1, p2 ) qUrl := QUrl():new( qList:at( i ) ) hb_fNameSplit( qUrl:toLocalFile(), @cPath, @cTable, @cExt ) IF lower( cExt ) == ".dbf" - ::addTable( hbide_pathToOSPath( cPath + cTable + cExt ) ) + ::addTable( { NIL, hbide_pathToOSPath( cPath + cTable + cExt ), NIL, ; + iif( ! ( ::qRddCombo:currentText() $ "DBFCDX.DBFNTX" ), "DBFCDX", ::qRddCombo:currentText() ) } ) ENDIF - HB_TRACE( HB_TR_ALWAYS, cPath, cTable, cExt ) NEXT ENDIF EXIT @@ -415,10 +419,16 @@ METHOD IdeBrowseManager:execEvent( cEvent, p, p1, p2 ) EXIT CASE "buttonOpen_clicked" - IF !empty( cTable := hbide_fetchAFile( ::oIde:oDlg, "Select a Table", { { "Database File", "*.dbf" } }, ::oIde:cWrkFolderLast ) ) - hb_fNameSplit( cTable, @cPath ) - ::oIde:cWrkFolderLast := cPath - ::addTable( cTable ) + IF ::currentDriver() $ "DBFCDX,DBFNTX" + IF !empty( cTable := hbide_fetchAFile( ::oIde:oDlg, "Select a Table", { { "Database File", "*.dbf" } }, ::oIde:cWrkFolderLast ) ) + hb_fNameSplit( cTable, @cPath ) + ::oIde:cWrkFolderLast := cPath + ::addTable( { NIL, cTable, NIL, ::currentDriver() } ) + ENDIF + ELSE + IF !empty( cTable := hbide_execScriptFunction( "tableSelect", ::currentDriver() ) ) + ::addTable( { NIL, cTable, NIL, ::currentDriver() } ) + ENDIF ENDIF EXIT @@ -637,32 +647,15 @@ METHOD IdeBrowseManager:buildUiStruct() /*----------------------------------------------------------------------*/ METHOD IdeBrowseManager:loadTables() - LOCAL cInfo, aPanel, oCurPanel, cTable + LOCAL cInfo, aInfo, oCurPanel oCurPanel := ::oCurPanel FOR EACH cInfo IN ::oINI:aDbuPanelsInfo - aPanel := hb_aTokens( cInfo, "," ) - - aSize( aPanel, TBL_VRBLS ) - - DEFAULT aPanel[ TBL_PANEL ] TO "" - DEFAULT aPanel[ TBL_NAME ] TO "" - DEFAULT aPanel[ TBL_ALIAS ] TO "" - DEFAULT aPanel[ TBL_DRIVER ] TO "" - DEFAULT aPanel[ TBL_INDEX ] TO "" - DEFAULT aPanel[ TBL_RECORD ] TO "" - DEFAULT aPanel[ TBL_CURSOR ] TO "" - DEFAULT aPanel[ TBL_GEOMETRY ] TO "" - DEFAULT aPanel[ TBL_ROWPOS ] TO "1" - DEFAULT aPanel[ TBL_COLPOS ] TO "1" - DEFAULT aPanel[ TBL_NEXT ] TO "" - - IF ::isPanel( aPanel[ 1 ] ) - IF hb_fileExists( cTable := hbide_pathToOSPath( aPanel[ 2 ] ) ) - ::setPanel( aPanel[ 1 ] ) - ::addTable( cTable, , aPanel ) - ENDIF + aInfo := hb_aTokens( cInfo, "," ) + IF ::isPanel( aInfo[ 1 ] ) + ::setPanel( aInfo[ 1 ] ) + ::addTable( aInfo ) ENDIF NEXT @@ -671,30 +664,14 @@ METHOD IdeBrowseManager:loadTables() /*----------------------------------------------------------------------*/ -METHOD IdeBrowseManager:addTable( cFileDBF, cAlias, aInfo ) +METHOD IdeBrowseManager:addTable( aInfo ) LOCAL oBrw, qSubWindow - oBrw := IdeBrowse():new( ::oIde, Self, ::oCurPanel ) - oBrw:cTable := cFileDBF - oBrw:cAlias := cAlias - //oBrw:oManager := Self - - oBrw:create() - + oBrw := IdeBrowse():new( ::oIde, Self, ::oCurPanel, aInfo ):create() IF empty( oBrw:oBrw ) RETURN Self ENDIF - IF hb_isArray( aInfo ) - oBrw:oBrw:rowPos := val( aInfo[ TBL_ROWPOS ] ) - oBrw:oBrw:colPos := val( aInfo[ TBL_COLPOS ] ) - oBrw:oBrw:forceStable() - oBrw:setOrder( val( aInfo[ TBL_INDEX ] ) ) - oBrw:goto( val( aInfo[ TBL_RECORD ] ) ) - oBrw:oBrw:refreshAll() - oBrw:oBrw:forceStable() - ENDIF - qSubWindow := ::oCurPanel:addBrowser( oBrw, aInfo ) ::connect( qSubWindow, "aboutToActivate()", {|| ::execEvent( "mdiSubWindow_aboutToActivate", qSubWindow ) } ) @@ -726,6 +703,8 @@ METHOD IdeBrowseManager:buildToolbar() ::buildPanelsButton() ::buildToolButton( {} ) + ::buildRddsCombo() + ::buildToolButton( {} ) ::buildToolButton( { "Open a table" , "dc_plus" , "clicked()", {|| ::execEvent( "buttonOpen_clicked" ) }, .f. } ) ::buildToolButton( {} ) ::buildToolButton( { "Show/hide form view", "formview" , "clicked()", {|| ::execEvent( "buttonShowForm_clicked" ) }, .t. } ) @@ -745,6 +724,24 @@ METHOD IdeBrowseManager:buildToolbar() /*----------------------------------------------------------------------*/ +METHOD IdeBrowseManager:buildRddsCombo() + LOCAL aRdds, cRdd + + IF !empty( aRdds := hbide_execScriptFunction( "rdds" ) ) + aeval( aRdds, {|e| aadd( ::aRdds, e ) } ) + ENDIF + + ::qRddCombo := QComboBox():new() + ::qRddCombo:setToolTip( "Rdd to open next table" ) + FOR EACH cRdd IN ::aRdds + ::qRddCombo:addItem( cRdd ) + NEXT + ::qToolBar:addWidget( ::qRddCombo ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeBrowseManager:buildToolButton( aBtn ) LOCAL qBtn @@ -798,6 +795,7 @@ METHOD IdeBrowseManager:updateIndexMenu( qSubWindow ) ::disconnect( qAct, "triggered(bool)" ) qAct := NIL NEXT + ::aIndexAct := {} ::qIndexMenu:clear() @@ -1063,6 +1061,7 @@ CLASS IdeBrowse INHERIT IdeObject DATA oManager DATA oPanel DATA qMDI + DATA aInfo INIT {} DATA nType INIT BRW_TYPE_DBF DATA cAlias INIT "" @@ -1083,8 +1082,8 @@ CLASS IdeBrowse INHERIT IdeObject DATA qClose DATA aIndex INIT {} - METHOD new( oIde, oManager, oPanel ) - METHOD create( oIde, oManager, oPanel ) + METHOD new( oIde, oManager, oPanel, aInfo ) + METHOD create( oIde, oManager, oPanel, aInfo ) METHOD configure() METHOD destroy() METHOD execEvent( cEvent, p, p1 ) @@ -1094,13 +1093,19 @@ CLASS IdeBrowse INHERIT IdeObject METHOD getPP( aStruct ) METHOD skipBlock( nHowMany ) + + METHOD use() + METHOD exists() METHOD goTop() METHOD goBottom() METHOD goTo( nRec ) + METHOD goToAsk() METHOD recNo() METHOD lastRec() ACCESS dbStruct() INLINE ::aStruct METHOD indexOrd() + METHOD ordName( nOrder ) + METHOD IndexKey( nOrder ) METHOD setOrder( nOrder ) METHOD refreshAll() METHOD getIndexInfo() @@ -1109,6 +1114,7 @@ CLASS IdeBrowse INHERIT IdeObject METHOD dispInfo() METHOD search( cSearch ) + METHOD searchAsk() METHOD next() METHOD previous() METHOD buildForm() @@ -1119,37 +1125,53 @@ CLASS IdeBrowse INHERIT IdeObject /*----------------------------------------------------------------------*/ -METHOD IdeBrowse:new( oIde, oManager, oPanel ) +METHOD IdeBrowse:new( oIde, oManager, oPanel, aInfo ) ::oIde := oIde ::oManager := oManager ::oPanel := oPanel + ::aInfo := aInfo RETURN Self /*----------------------------------------------------------------------*/ -METHOD IdeBrowse:create( oIde, oManager, oPanel ) - LOCAL xVrb, cT, cAlias, bError, oErr, cName +METHOD IdeBrowse:create( oIde, oManager, oPanel, aInfo ) + LOCAL xVrb, cT, cName LOCAL lMissing := .t. - LOCAL lErr := .f. DEFAULT oIde TO ::oIde DEFAULT oManager TO ::oManager DEFAULT oPanel TO ::oPanel + DEFAULT aInfo TO ::aInfo ::oIde := oIde ::oManager := oManager ::oPanel := oPanel + ::aInfo := aInfo - IF !empty( ::aData ) - ::nType := BRW_TYPE_ARRAY - ENDIF + aSize( ::aInfo, TBL_VRBLS ) - #if 0 - IF empty( ::cAlias ) - ::cAlias := ::fetchAlias( ::cTable ) + DEFAULT ::aInfo[ TBL_PANEL ] TO ::oPanel:cName + DEFAULT ::aInfo[ TBL_NAME ] TO "" + DEFAULT ::aInfo[ TBL_ALIAS ] TO "" + DEFAULT ::aInfo[ TBL_DRIVER ] TO ::oManager:qRddCombo:currentText() + DEFAULT ::aInfo[ TBL_INDEX ] TO "" + DEFAULT ::aInfo[ TBL_RECORD ] TO "" + DEFAULT ::aInfo[ TBL_CURSOR ] TO "" + DEFAULT ::aInfo[ TBL_GEOMETRY ] TO "" + DEFAULT ::aInfo[ TBL_ROWPOS ] TO "1" + DEFAULT ::aInfo[ TBL_COLPOS ] TO "1" + DEFAULT ::aInfo[ TBL_NEXT ] TO "" + + ::cTable := hbide_pathToOSPath( ::aInfo[ TBL_NAME ] ) + hb_fNameSplit( ::cTable, , @cName ) + ::cTableOnly := cName + ::cAlias := ::aInfo[ TBL_ALIAS ] + ::cDriver := upper( ::cDriver ) + + IF ! ::exists() + RETURN Self ENDIF - #endif IF ::nType == BRW_TYPE_DBF IF !empty( ::cAlias ) .AND. empty( ::cTable ) @@ -1159,33 +1181,12 @@ METHOD IdeBrowse:create( oIde, oManager, oPanel ) ENDIF IF lMissing .AND. !empty( ::cTable ) - bError := ErrorBlock( {|o| break( o ) } ) - BEGIN SEQUENCE - IF empty( ::cAlias ) - USE ( ::cTable ) SHARED NEW VIA ( ::cDriver ) - ELSE - cAlias := ::cAlias - USE ( ::cTable ) ALIAS ( cAlias ) SHARED NEW VIA ( ::cDriver ) - ENDIF - IF NetErr() - MsgBox( ::cTable, "Could not been opened!" ) - lErr := .t. - ENDIF - RECOVER USING oErr - MsgBox( oErr:description, "Error Opening Table" ) - RETURN Self - ENDSEQUENCE - ErrorBlock( bError ) - IF lErr + IF ! ( ::lOpened := ::use() ) RETURN Self ENDIF - IF empty( ::cAlias ) - ::cAlias := alias() - ENDIF - ::lOpened := .t. ENDIF - ::aStruct := DbStruct() + ::aStruct := ( ::cAlias )->( DbStruct() ) ELSE FOR EACH xVrb IN ::aData[ 1 ] cT := valtype( xVrb ) @@ -1214,13 +1215,17 @@ METHOD IdeBrowse:create( oIde, oManager, oPanel ) ::oBrw:configure() ::oBrw:forceStable() + ::oBrw:rowPos := val( aInfo[ TBL_ROWPOS ] ) + ::oBrw:colPos := val( aInfo[ TBL_COLPOS ] ) + ::oBrw:forceStable() + ::setOrder( val( aInfo[ TBL_INDEX ] ) ) + ::goto( val( aInfo[ TBL_RECORD ] ) ) + ::oBrw:refreshAll() + ::oBrw:forceStable() + ::oBrw:navigate := {|mp1,mp2| ::execEvent( "browse_navigate", mp1, mp2 ) } ::oBrw:keyboard := {|mp1,mp2| ::execEvent( "browse_keyboard", mp1, mp2 ) } - hb_fNameSplit( ::cTable, , @cName ) - - ::cTableOnly := cName - RETURN Self /*----------------------------------------------------------------------*/ @@ -1329,7 +1334,6 @@ METHOD IdeBrowse:buildBrowser() /*----------------------------------------------------------------------*/ METHOD IdeBrowse:execEvent( cEvent, p, p1 ) - LOCAL cSearch HB_SYMBOL_UNUSED( p ) HB_SYMBOL_UNUSED( p1 ) @@ -1344,11 +1348,10 @@ METHOD IdeBrowse:execEvent( cEvent, p, p1 ) CASE "browse_keyboard" IF p == xbeK_CTRL_F - IF ! empty( cSearch := hbide_fetchAString( ::oWnd:oWidget, "", "FieldNamr", "Search" ) ) - ::search( cSearch ) - ENDIF + ::searchAsk() ELSEIF p == xbeK_CTRL_G + ::gotoAsk() ENDIF EXIT @@ -1364,8 +1367,8 @@ METHOD IdeBrowse:dispInfo() IF !empty( ::qMdi ) ::qMdi:setTooltip( ::cTable ) - ::qMdi:setWindowTitle( "[" + ::cDriver +"][" + hb_ntos( ::indexOrd() ) + "] " + ; - "[" + hb_ntos( ::recno() ) + "/" + hb_ntos( ::lastRec() ) + "] " + ; + ::qMdi:setWindowTitle( "[" + ::cDriver +"][" + hb_ntos( ::indexOrd() ) + ":" + ::ordName() + "] " + ; + "[" + hb_ntos( ::recno() ) + "/" + hb_ntos( ::lastRec() ) + "] " + ; ::cTableOnly ) ENDIF RETURN Self @@ -1565,20 +1568,34 @@ METHOD IdeBrowse:previous() /*----------------------------------------------------------------------*/ +METHOD IdeBrowse:searchAsk() + LOCAL cSearch + + IF !empty( cSearch := hbide_fetchAString( ::oWnd:oWidget, "", ::aStruct[ ::oBrw:colPos, 1 ], "Search" ) ) + ::search( cSearch ) + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeBrowse:search( cSearch ) LOCAL nRec IF ::nType == BRW_TYPE_DBF - IF ( ::cAlias )->( IndexOrd() ) > 0 - nRec := ::recNo() - IF ( ::cAlias )->( DbSeek( cSearch ) ) - ::refreshAll() + IF ! empty( cSearch ) + IF ( ::cAlias )->( IndexOrd() ) > 0 + nRec := ::recNo() + IF ( ::cAlias )->( DbSeek( cSearch ) ) + ::refreshAll() + ::dispInfo() + ELSE + ::goto( nRec ) + MsgBox( "Could not find: " + cSearch ) + ENDIF ELSE - ::goto( nRec ) - MsgBox( "Could not find: " + cSearch ) + // Sequential search ENDIF - ELSE - // Sequential search ENDIF ELSE // Ascan @@ -1598,6 +1615,28 @@ METHOD IdeBrowse:refreshAll() /*----------------------------------------------------------------------*/ +METHOD IdeBrowse:goToAsk() + LOCAL nRec + + IF ! empty( nRec := ( QInputDialog():new() ):getInt( , "Goto", "Record_# ?", , ::recno() ) ) + ::goto( nRec ) + ::refreshAll() + ENDIF + + RETURN NIL + +/*----------------------------------------------------------------------*/ + +METHOD IdeBrowse:goto( nRec ) + + IF ::nType == BRW_TYPE_DBF + RETURN ( ::cAlias )->( DbGoto( nRec ) ) + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeBrowse:goTop() IF ::nType == BRW_TYPE_DBF @@ -1674,6 +1713,8 @@ METHOD IdeBrowse:setIndex( cIndex ) ::oBrw:refreshAll() ::oBrw:forceStable() ::oBrw:setCurrentIndex( .t. ) + + ::dispInfo() ENDIF RETURN Self @@ -1685,7 +1726,7 @@ METHOD IdeBrowse:getIndexInfo() IF ::nType == BRW_TYPE_DBF FOR i := 1 to 50 - IF ( cKey := ( ::cAlias )->( indexkey( i ) ) ) == '' + IF ( cKey := ( ::cAlias )->( IndexKey( i ) ) ) == '' EXIT ENDIF aadd( a_, ( ::cAlias )->( OrdName( i ) ) + ' : ' + cKey ) @@ -1698,15 +1739,81 @@ METHOD IdeBrowse:getIndexInfo() /*----------------------------------------------------------------------*/ -METHOD IdeBrowse:goTo( nRec ) +METHOD IdeBrowse:ordName( nOrder ) + DEFAULT nOrder TO ::indexOrd() IF ::nType == BRW_TYPE_DBF - ( ::cAlias )->( DbGoto( nRec ) ) - ELSE - ::nIndex := nRec + RETURN ( ::cAlias )->( OrdName( nOrder ) ) ENDIF - RETURN NIL + RETURN "" + +/*----------------------------------------------------------------------*/ + +METHOD IdeBrowse:indexKey( nOrder ) + DEFAULT nOrder TO ::indexOrd() + + IF ::nType == BRW_TYPE_DBF + RETURN ( ::cAlias )->( IndexKey( nOrder ) ) + ENDIF + + RETURN "" + +/*----------------------------------------------------------------------*/ + +METHOD IdeBrowse:use() + LOCAL bError, oErr + LOCAL lErr := .f. + + SWITCH ::cDriver + CASE "DBFCDX" + CASE "DBFNTX" + bError := ErrorBlock( {|o| break( o ) } ) + BEGIN SEQUENCE + IF empty( ::cAlias ) + USE ( ::cTable ) SHARED NEW VIA ( ::cDriver ) + ELSE + USE ( ::cTable ) ALIAS ( ::cAlias ) SHARED NEW VIA ( ::cDriver ) + ENDIF + IF NetErr() + MsgBox( ::cTable, "Could not been opened!" ) + lErr := .t. + ENDIF + RECOVER USING oErr + MsgBox( oErr:description, "Error Opening Table" ) + RETURN Self + ENDSEQUENCE + ErrorBlock( bError ) + + EXIT + OTHERWISE + lErr := hbide_execScriptFunction( "tableUse", ::cTable, ::cAlias ) /* cTable holds the information about connection */ + EXIT + ENDSWITCH + + IF lErr + RETURN .f. + ENDIF + + IF empty( ::cAlias ) + ::cAlias := alias() + ENDIF + + RETURN .t. + +/*----------------------------------------------------------------------*/ + +METHOD IdeBrowse:exists() + + SWITCH ::cDriver + CASE "DBFCDX" + CASE "DBFNTX" + RETURN hb_fileExists( ::cTable ) + OTHERWISE + RETURN hbide_execScriptFunction( "tableExists", ::cTable ) + ENDSWITCH + + RETURN .f. /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/ideplugins.prg b/harbour/contrib/hbide/ideplugins.prg index f11f9fe8b7..c61a7ae9a2 100644 --- a/harbour/contrib/hbide/ideplugins.prg +++ b/harbour/contrib/hbide/ideplugins.prg @@ -74,6 +74,7 @@ STATIC s_aPlugins := { { "", NIL } } STATIC s_aLoaded := { { "", .f. } } +STATIC s_aPersist := {} /*----------------------------------------------------------------------*/ @@ -265,3 +266,53 @@ FUNCTION hbide_loadPrototypes( cPath ) RETURN aProto /*------------------------------------------------------------------------*/ +/* Silent Mode */ + +FUNCTION hbide_compileAScript( cBuffer, cCompFlags ) + LOCAL cFile, pHrb + LOCAL bError := ErrorBlock( {|o| break( o ) } ) + + BEGIN SEQUENCE + cFile := hb_compileFromBuf( cBuffer, cCompFlags ) + IF ! Empty( cFile ) + pHrb := hb_hrbLoad( HB_HRB_BIND_OVERLOAD, cFile ) + ENDIF + END SEQUENCE + + ErrorBlock( bError ) + RETURN pHrb + +/*----------------------------------------------------------------------*/ + +FUNCTION hbide_loadPersistentScripts() + LOCAL cPath, a_, dir_, cFileName, cBuffer, pHrb + + IF !empty( cPath := hbide_setIde():oINI:getResourcesPath() ) + a_:= {} + dir_:= directory( cPath + "hbide_persist_*.prg" ) + aeval( dir_, {|e_| aadd( a_, e_[ 1 ] ) } ) + dir_:= directory( cPath + "hbide_persist_*.hbs" ) + aeval( dir_, {|e_| aadd( a_, e_[ 1 ] ) } ) + + FOR EACH cFileName IN a_ + IF !empty( cBuffer := hb_memoRead( cPath + cFileName ) ) + IF !empty( pHrb := hbide_compileAScript( cBuffer ) ) + aadd( s_aPersist, pHrb ) + ENDIF + ENDIF + NEXT + ENDIF + + RETURN NIL + +/*------------------------------------------------------------------------*/ + +FUNCTION hbide_execScriptFunction( cFunc, ... ) + + IF type( "script_" + cFunc + "()" ) == "UI" + RETURN eval( &( "{|...| " + "script_" + cFunc + "( ... )" + "}" ), ... ) + ENDIF + + RETURN NIL + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/plugins/hbide_script_rdds.prg b/harbour/contrib/hbide/plugins/hbide_script_rdds.prg new file mode 100644 index 0000000000..e08b6f8ec5 --- /dev/null +++ b/harbour/contrib/hbide/plugins/hbide_script_rdds.prg @@ -0,0 +1,92 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * hbide plugin. + * + * Copyright 2010 Pritpal Bedi + * www - http://harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------// + + Script TO handle rdd call from hbide + To be linked with hbIDE, change the name of this file to + hbide_persist_rdds.prg and place inside "resources" folder. + hbIDE will call these functions at appropriate times + when initializing the RDD structures. + + Please note that RDDs supposed to be operated as such + must be linked properly with hbIDE build process. + You will need to expand these functions. + +//----------------------------------------------------------------------*/ + +FUNCTION script_rdds() + RETURN {} + +/*----------------------------------------------------------------------*/ + +FUNCTION script_tableExists( cTable ) + + RETURN .f. + +/*----------------------------------------------------------------------*/ + +FUNCTION script_tableUse( cTable, cAlias ) + + RETURN .f. + +/*----------------------------------------------------------------------*/ + +FUNCTION script_tableSelect( cDriver ) + LOCAL cTable := "" + + RETURN cTable + +/*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbqt/doc/en/class_hbqplaintextedit.txt b/harbour/contrib/hbqt/doc/en/class_hbqplaintextedit.txt index cf2062adff..ecaebcbe5d 100644 --- a/harbour/contrib/hbqt/doc/en/class_hbqplaintextedit.txt +++ b/harbour/contrib/hbqt/doc/en/class_hbqplaintextedit.txt @@ -1,5 +1,5 @@ /* - * hbQTgen v1.0 - Harbour Callable Wrappers Generator for Qt v4.5.3+ + * hbQTgen v1.0 - Harbour Callable Wrappers Generator for Qt v4.5+ * Please do not modify this document as it is subject to change in future. * Pritpal Bedi */ @@ -59,7 +59,7 @@ :hbDeleteLine() -> NIL :hbMoveLine( nIDirection ) -> NIL :hbGetSelectedText() -> cQString - :hbTextUnderCursor() -> cQString + :hbTextUnderCursor( lBCodeComplete ) -> cQString :hbShowPrototype( cTip, nRows, nCols ) -> NIL :hbSetCompleter( pCompleter ) -> NIL :hbSetCurrentLineColor( pColor ) -> NIL @@ -93,10 +93,10 @@ $PLATFORMS$ Windows, Linux, MacOS, OS2 $VERSION$ - 4.5.3 + 4.5 or upper $FILES$ - Prg Source : contrib/hbqt/qtgui/THBQPlainTextEdit.prg - C++ Wrappers : contrib/hbqt/qtgui/HBQPlainTextEdit.cpp + Prg source : contrib/hbqt/qtgui/THBQPlainTextEdit.prg + C++ wrappers : contrib/hbqt/qtgui/HBQPlainTextEdit.cpp Library : hbqtgui $SEEALSO$ QPlainTextEdit diff --git a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp index 4fb72c3074..a9085b61de 100644 --- a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp +++ b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp @@ -1377,9 +1377,10 @@ void HBQPlainTextEdit::keyPressEvent( QKeyEvent * event ) if( ( ctrlOrShift && event->text().isEmpty() ) ) return; - static QString eow( " ~!@#$%^&*()+{}|:\"<>?,./;'[]\\-=" ); /* end of word */ + //static QString eow( " ~!@#$%^&*()+{}|:\"<>?,./;'[]\\-=" ); /* end of word */ + static QString eow( "~!@#$%^&*()+{}|:\"<>?,./;'[]\\-=" ); /* end of word */ bool hasModifier = ( event->modifiers() != Qt::NoModifier ) && !ctrlOrShift; - QString completionPrefix = hbTextUnderCursor(); + QString completionPrefix = hbTextUnderCursor( true ); if( ( hasModifier || event->text().isEmpty() || @@ -1408,10 +1409,31 @@ void HBQPlainTextEdit::keyPressEvent( QKeyEvent * event ) /*----------------------------------------------------------------------*/ -QString HBQPlainTextEdit::hbTextUnderCursor() +QString HBQPlainTextEdit::hbTextUnderCursor( bool bCodeComplete ) { - QTextCursor tc = textCursor(); - tc.select( QTextCursor::WordUnderCursor ); + QTextCursor tc( textCursor() ); + if( bCodeComplete ) + { + tc.movePosition( QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor, 1 ); + QString txt = tc.selectedText(); + tc.clearSelection(); + if( txt == ( QString ) ' ' ) + { + tc.select( QTextCursor::WordUnderCursor ); + txt = tc.selectedText() + ' '; + return txt; + } + else + { + tc = textCursor(); + tc.select( QTextCursor::WordUnderCursor ); + return tc.selectedText(); + } + } + else + { + tc.select( QTextCursor::WordUnderCursor ); + } return tc.selectedText(); } diff --git a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.h b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.h index e88b479c23..d460696579 100644 --- a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.h +++ b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.h @@ -190,7 +190,7 @@ public slots: void hbReplaceSelection( const QString & txt ); void hbInsertTab( int mode ); QString hbGetSelectedText(); - QString hbTextUnderCursor(); + QString hbTextUnderCursor( bool bCodeComplete = false ); void hbNumberBlockVisible( bool b ); bool hbNumberBlockVisible(); void hbShowPrototype( const QString & tip, int rows, int cols ); diff --git a/harbour/contrib/hbqt/qtgui/HBQPlainTextEdit.cpp b/harbour/contrib/hbqt/qtgui/HBQPlainTextEdit.cpp index ad29197f5a..55152bda56 100644 --- a/harbour/contrib/hbqt/qtgui/HBQPlainTextEdit.cpp +++ b/harbour/contrib/hbqt/qtgui/HBQPlainTextEdit.cpp @@ -597,16 +597,16 @@ HB_FUNC( QT_HBQPLAINTEXTEDIT_HBGETSELECTEDTEXT ) } /* - * QString hbTextUnderCursor() + * QString hbTextUnderCursor( bool bCodeComplete ) */ HB_FUNC( QT_HBQPLAINTEXTEDIT_HBTEXTUNDERCURSOR ) { HBQPlainTextEdit * p = hbqt_par_HBQPlainTextEdit( 1 ); if( p ) - hb_retc( ( p )->hbTextUnderCursor().toAscii().data() ); + hb_retc( ( p )->hbTextUnderCursor( hb_parl( 2 ) ).toAscii().data() ); else { - HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_HBQPLAINTEXTEDIT_HBTEXTUNDERCURSOR FP=hb_retc( ( p )->hbTextUnderCursor().toAscii().data() ); p is NULL" ) ); + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_HBQPLAINTEXTEDIT_HBTEXTUNDERCURSOR FP=hb_retc( ( p )->hbTextUnderCursor( hb_parl( 2 ) ).toAscii().data() ); p is NULL" ) ); } } diff --git a/harbour/contrib/hbqt/qtgui/THBQPlainTextEdit.prg b/harbour/contrib/hbqt/qtgui/THBQPlainTextEdit.prg index 7dae01892a..406ab8a707 100644 --- a/harbour/contrib/hbqt/qtgui/THBQPlainTextEdit.prg +++ b/harbour/contrib/hbqt/qtgui/THBQPlainTextEdit.prg @@ -98,7 +98,7 @@ CREATE CLASS HBQPlainTextEdit INHERIT HbQtObjectHandler, QPlainTextEdit METHOD hbDeleteLine() METHOD hbMoveLine( nIDirection ) METHOD hbGetSelectedText() - METHOD hbTextUnderCursor() + METHOD hbTextUnderCursor( lBCodeComplete ) METHOD hbShowPrototype( cTip, nRows, nCols ) METHOD hbSetCompleter( pCompleter ) METHOD hbSetCurrentLineColor( pColor ) @@ -255,8 +255,8 @@ METHOD HBQPlainTextEdit:hbGetSelectedText() RETURN Qt_HBQPlainTextEdit_hbGetSelectedText( ::pPtr ) -METHOD HBQPlainTextEdit:hbTextUnderCursor() - RETURN Qt_HBQPlainTextEdit_hbTextUnderCursor( ::pPtr ) +METHOD HBQPlainTextEdit:hbTextUnderCursor( lBCodeComplete ) + RETURN Qt_HBQPlainTextEdit_hbTextUnderCursor( ::pPtr, lBCodeComplete ) METHOD HBQPlainTextEdit:hbShowPrototype( cTip, nRows, nCols ) diff --git a/harbour/contrib/hbqt/qth/HBQPlainTextEdit.qth b/harbour/contrib/hbqt/qth/HBQPlainTextEdit.qth index 1807a802d0..df3627dcb4 100644 --- a/harbour/contrib/hbqt/qth/HBQPlainTextEdit.qth +++ b/harbour/contrib/hbqt/qth/HBQPlainTextEdit.qth @@ -129,7 +129,7 @@ HB_FUNC( QT_HBQPLAINTEXTEDIT ) void hbDeleteLine() void hbMoveLine( int iDirection ) QString hbGetSelectedText() - QString hbTextUnderCursor() + QString hbTextUnderCursor( bool bCodeComplete ) void hbShowPrototype( const QString & tip, int rows, int cols ) void hbSetCompleter( QCompleter * completer ) void hbSetCurrentLineColor( const QColor & color )