From 3f105ded2ec7ab9769ed187c9ff16a682cdf65b5 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Thu, 17 Feb 2011 01:06:31 +0000 Subject: [PATCH] 2011-02-16 17:02 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth ! Fix: optional parameter was not properly laid. * contrib/hbide/idedocwriter.prg * contrib/hbide/ideharbourhelp.prg + Implemented: Harbour's core API functions to manage Documents retrieval and storage. --- harbour/ChangeLog | 8 + harbour/contrib/hbide/idedocwriter.prg | 19 +- harbour/contrib/hbide/ideharbourhelp.prg | 176 ++---------------- .../hbqt/qtgui/qth/HBQPlainTextEdit.qth | 2 +- 4 files changed, 29 insertions(+), 176 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b0f4596a72..3c4cf2c5cd 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2011-02-16 17:02 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth + ! Fix: optional parameter was not properly laid. + * contrib/hbide/idedocwriter.prg + * contrib/hbide/ideharbourhelp.prg + + Implemented: Harbour's core API functions to manage + Documents retrieval and storage. + 2011-02-17 00:53 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbrun/plugins.prg + Will now load custom plugins places next to the hbrun executable, diff --git a/harbour/contrib/hbide/idedocwriter.prg b/harbour/contrib/hbide/idedocwriter.prg index 2c234217c0..b00bded102 100644 --- a/harbour/contrib/hbide/idedocwriter.prg +++ b/harbour/contrib/hbide/idedocwriter.prg @@ -416,7 +416,7 @@ METHOD IdeDocWriter:fillFormByObject( oFunc ) ::oUI:q_editOneLiner :setText ( oFunc:cOneLiner ) ::oUI:q_editSyntax :setText ( hbide_ar2delString( oFunc:aSyntax , "; " ) ) ::oUI:q_editReturns :setText ( hbide_ar2delString( oFunc:aReturns, "; " ) ) - ::oUI:q_editSeeAlso :setText ( oFunc:cSeaAlso ) + ::oUI:q_editSeeAlso :setText ( oFunc:cSeeAlso ) ::oUI:q_editFiles :setText ( hbide_ar2delString( oFunc:aFiles , "; " ) ) ::oUI:q_plainArgs :setPlainText ( hbide_arrayTOmemo( oFunc:aArguments ) ) ::oUI:q_plainDesc :setPlainText ( hbide_arrayTOmemo( oFunc:aDescription ) ) @@ -509,7 +509,6 @@ METHOD IdeDocWriter:pullDocFromSource( nLineFrom, oEdit ) METHOD IdeDocWriter:loadCurrentFuncDoc() LOCAL oEdit, nCurLine, n, cProto, nProtoLine, aFacts, aDoc, oFunc - //LOCAL qCursor, qEdit IF !empty( oEdit := ::oEM:getEditObjectCurrent() ) IF oEdit:isModified() @@ -631,7 +630,7 @@ METHOD IdeDocWriter:saveInFile() /*----------------------------------------------------------------------*/ METHOD IdeDocWriter:saveInFunction() - LOCAL nCurLine, oEdit, qCursor, a_, b_, s + LOCAL nCurLine, oEdit, qCursor, a_ /* Bring it on top and make it current */ ::oSM:editSource( ::cSourceFile, , , , , , .f. ) @@ -656,17 +655,11 @@ METHOD IdeDocWriter:saveInFunction() qCursor:beginEditBlock() ::removeDocHelp( nCurLine, oEdit ) - b_:={} + a_:= ::buildDocument() - FOR EACH s IN a_ - IF "*" $ s - aadd( b_, s ) - ENDIF - NEXT + oEdit:home() - oEdit:insertText( hbide_arrayToMemo( b_ ) ) - oEdit:up() - oEdit:deleteLine() + oEdit:insertText( a_ ) qCursor:endEditBlock() oEdit:qEdit:setTextCursor( qCursor ) @@ -725,7 +718,7 @@ METHOD IdeDocWriter:buildDocument() hEntry[ "FILES" ] := s ENDIF IF !empty( s := ::oUI:q_editSeeAlso:text() ) - hEntry[ "SEEALSO" ] += s + hEntry[ "SEEALSO" ] := s ENDIF RETURN __hbdoc_ToSource( { hEntry } ) diff --git a/harbour/contrib/hbide/ideharbourhelp.prg b/harbour/contrib/hbide/ideharbourhelp.prg index e0e38c6ece..28ac5d2dd3 100644 --- a/harbour/contrib/hbide/ideharbourhelp.prg +++ b/harbour/contrib/hbide/ideharbourhelp.prg @@ -614,7 +614,7 @@ METHOD IdeHarbourHelp:refreshDocTree() IF ! ( right( cRoot, 1 ) $ "/\" ) cRoot += hb_ps() ENDIF - cRoot := hbide_pathToOSPath( cRoot ) + cRoot := hbide_pathToOSPath( cRoot + "/doc/" ) aHbd := directory( cRoot + "*.hbd" ) IF ! empty( aHbd ) @@ -622,7 +622,7 @@ METHOD IdeHarbourHelp:refreshDocTree() aDocs := { cRoot } ELSE hbide_fetchSubPaths( @aPaths, ::cPathInstall, .t. ) - + cRoot := aPaths[ 1 ] FOR EACH cFolder IN aPaths cNFolder := hbide_pathNormalized( cFolder, .t. ) IF ( "/doc" $ cNFolder ) .OR. ( "/doc/en" $ cNFolder ) @@ -790,185 +790,37 @@ METHOD IdeHarbourHelp:populateIndex() /*----------------------------------------------------------------------*/ METHOD IdeHarbourHelp:pullDefinitions( acBuffer ) - LOCAL a_, s, nPart, oFunc - LOCAL lIsFunc := .f. - LOCAL aFn := {} IF hb_isArray( acBuffer ) - a_:= acBuffer + RETURN doc2functions( __hbdoc_fromSource( hbide_arrayTOmemo( acBuffer ) ) ) ELSE IF hb_fileExists( acBuffer ) - a_:= hbide_readSource( acBuffer ) + RETURN doc2functions( __hbdoc_fromSource( memoread( acBuffer ) ) ) ELSE - a_:= hbide_memoTOarray( acBuffer ) + RETURN doc2functions( __hbdoc_fromSource( acBuffer ) ) ENDIF ENDIF - IF .t. - nPart := DOC_FUN_NONE + RETURN {} - FOR EACH s IN a_ - DO CASE +/*----------------------------------------------------------------------*/ - CASE "$DOC$" $ s - lIsFunc := .t. - nPart := DOC_FUN_BEGINS - oFunc := IdeDocFunction():new() +METHOD IdeHarbourHelp:pullDefinitionsHBD( cFileHBD ) - CASE "$END$" $ s - IF lIsFunc - oFunc:lOk := .t. - aadd( aFn, oFunc ) - ENDIF - - CASE "$TEMPLATE$" $ s - nPart := DOC_FUN_TEMPLATE - CASE "$FUNCNAME$" $ s .OR. "$NAME$" $ s - nPart := DOC_FUN_FUNCNAME - CASE "$CATEGORY$" $ s - nPart := DOC_FUN_CATEGORY - CASE "$SUBCATEGORY$" $ s - nPart := DOC_FUN_SUBCATEGORY - CASE "$ONELINER$" $ s - nPart := DOC_FUN_ONELINER - CASE "$SYNTAX$" $ s - nPart := DOC_FUN_SYNTAX - CASE "$ARGUMENTS$" $ s - nPart := DOC_FUN_ARGUMENTS - CASE "$RETURNS$" $ s - nPart := DOC_FUN_RETURNS - CASE "$DESCRIPTION$" $ s - nPart := DOC_FUN_DESCRIPTION - CASE "$EXAMPLES$" $ s - nPart := DOC_FUN_EXAMPLES - CASE "$TESTS$" $ s - nPart := DOC_FUN_TESTS - CASE "$FILES$" $ s - nPart := DOC_FUN_FILES - CASE "$STATUS$" $ s - nPart := DOC_FUN_STATUS - CASE "$PLATFORMS$" $ s .OR. "$COMPLIANCE$" $ s - nPart := DOC_FUN_PLATFORMS - CASE "$SEEALSO$" $ s - nPart := DOC_FUN_SEEALSO - CASE "$VERSION$" $ s - nPart := DOC_FUN_VERSION - CASE "$INHERITS" $ s - nPart := DOC_FUN_INHERITS - CASE "$METHODS" $ s - nPart := DOC_FUN_METHODS - CASE "$EXTERNALLINK" $ s - nPart := DOC_FUN_EXTERNALLINK - OTHERWISE - IF ! lIsFunc - LOOP // It is a fake line not within $DOC$ => $END$ block - ENDIF - s := substr( s, 8 ) - - SWITCH nPart - CASE DOC_FUN_BEGINS - EXIT - CASE DOC_FUN_TEMPLATE - IF ! empty( s ) - oFunc:cTemplate := s - ENDIF - EXIT - CASE DOC_FUN_FUNCNAME - IF ! empty( s ) - oFunc:cName := alltrim( s ) - ENDIF - EXIT - CASE DOC_FUN_CATEGORY - IF ! empty( s ) - oFunc:cCategory := alltrim( s ) - ENDIF - EXIT - CASE DOC_FUN_SUBCATEGORY - IF ! empty( s ) - oFunc:cSubCategory := alltrim( s ) - ENDIF - EXIT - CASE DOC_FUN_ONELINER - IF ! empty( s ) - oFunc:cOneLiner := s - ENDIF - EXIT - CASE DOC_FUN_SYNTAX - aadd( oFunc:aSyntax , s ) - EXIT - CASE DOC_FUN_ARGUMENTS - aadd( oFunc:aArguments , s ) - EXIT - CASE DOC_FUN_RETURNS - aadd( oFunc:aReturns , s ) - EXIT - CASE DOC_FUN_DESCRIPTION - aadd( oFunc:aDescription, s ) - EXIT - CASE DOC_FUN_EXAMPLES - aadd( oFunc:aExamples , s ) - EXIT - CASE DOC_FUN_TESTS - aadd( oFunc:aTests , s ) - EXIT - CASE DOC_FUN_FILES - aadd( oFunc:aFiles , s ) - EXIT - CASE DOC_FUN_STATUS - IF ! empty( s ) - oFunc:cStatus := alltrim( s ) - ENDIF - EXIT - CASE DOC_FUN_PLATFORMS - IF ! empty( s ) - oFunc:cPlatForms := alltrim( s ) - ENDIF - EXIT - CASE DOC_FUN_SEEALSO - IF ! empty( s ) - oFunc:cSeeAlso := alltrim( s ) - ENDIF - EXIT - CASE DOC_FUN_INHERITS - IF ! empty( s ) - oFunc:cInherits := alltrim( s ) - ENDIF - EXIT - CASE DOC_FUN_METHODS - aadd( oFunc:aMethods , s ) - EXIT - CASE DOC_FUN_VERSION - IF ! empty( s ) - oFunc:cVersion := alltrim( s ) - ENDIF - EXIT - CASE DOC_FUN_EXTERNALLINK - IF ! empty( s ) - oFunc:cExternalLink := alltrim( s ) - ENDIF - EXIT - OTHERWISE - nPart := DOC_FUN_NONE - EXIT - ENDSWITCH - ENDCASE - NEXT + IF hb_fileExists( cFileHBD ) + doc2functions( __hbdoc_LoadHBD( cFileHBD ) ) ENDIF - RETURN aFn + RETURN {} /*----------------------------------------------------------------------*/ #define __S2A( c ) hb_aTokens( strtran( c, chr( 13 ) ), chr( 10 ) ) -METHOD IdeHarbourHelp:pullDefinitionsHBD( cFileHBD ) - LOCAL oFunc, hDoc, hFile +STATIC FUNCTION doc2functions( hFile ) + LOCAL oFunc, hDoc LOCAL aFn := {} - IF hb_fileExists( cFileHBD ) - hFile := __hbdoc_LoadHBD( cFileHBD ) - ENDIF - FOR EACH hDoc IN hFile oFunc := IdeDocFunction():new() @@ -1097,7 +949,7 @@ METHOD IdeHarbourHelp:getFunctionPrototypes() IF ! ( right( cRoot, 1 ) $ "/\" ) cRoot += hb_ps() ENDIF - cRoot := hbide_pathToOSPath( cRoot ) + cRoot := hbide_pathToOSPath( cRoot + "/doc/" ) aHbd := directory( cRoot + "*.hbd" ) IF ! empty( aHbd ) diff --git a/harbour/contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth b/harbour/contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth index 8695652212..3300b60c0d 100644 --- a/harbour/contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth +++ b/harbour/contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth @@ -102,7 +102,7 @@ HB_FUNC( QT_HBQPLAINTEXTEDIT ) void hbSetSelectionColor( const QColor & color ) void hbSetMatchBraces( bool all ) void hbGetViewportInfo() - void hbApplyKey( int key, Qt::KeyboardModifiers modifiers = 0, const QString & txt ) + void hbApplyKey( int key, Qt::KeyboardModifiers modifiers = 0, const QString & txt = "" ) void hbHighlightArea( int top, int left, int bottom, int right, int mode ) void hbTogglePersistentSelection() void hbHorzRulerVisible( bool visible )