diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 31c9aafac8..42d0dd7fe7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,28 @@ The license applies to all entries newer than 2009-04-28. */ +2010-09-07 16:22 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/idemisc.prg + * contrib/hbide/ideprojmanager.prg + * contrib/hbide/idetools.prg + + Added: Tools & Utilities - new macros: + "source_name_less_ext" + Current editing instance's source file's name part only. + hb_fNameSplit( cSource, , @cName ) => cName + "project_title" + Last compiled project's title. If no project is yet compiled + in current session of hbIDE, then project title of current + set project is used. If no current project is set, empty + string is substituted. + "project_path" + Last compiled project's path. Rest per "project_title" above. + "project_output_path" + Last compiled project's output path. If no project has been + compiled under current session, null string is substituted. + Here no assumption is taken from current set project. + + Macros added per requested by Maurizio. + 2010-09-08 00:17 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/sha1.c * src/rtl/sha1.h diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 839600c57b..612e2e970d 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -104,6 +104,39 @@ FUNCTION hbide_setIde( oIde ) /*----------------------------------------------------------------------*/ +FUNCTION hbide_setProjectOutputPath( cPath ) + LOCAL oldProjPath + + STATIC cProjPath := "" + + oldProjPath := cProjPath + + IF hb_isChar( cPath ) + cProjPath := cPath + ENDIF + + RETURN oldProjPath + +/*----------------------------------------------------------------------*/ + +FUNCTION hbide_setProjectTitle( cTitle ) + LOCAL oldProjTitle + + STATIC cProjTitle + + IF empty( cProjTitle ) + cProjTitle := hbide_setIde():oPM:getCurrentProjectTitle() + ENDIF + oldProjTitle := cProjTitle + + IF hb_isChar( cTitle ) + cProjTitle := cTitle + ENDIF + + RETURN oldProjTitle + +/*----------------------------------------------------------------------*/ + FUNCTION hbide_execPopup( aPops, aqPos, qParent ) LOCAL i, qPop, qPoint, qAct, cAct, xRet, pAct, a_, qSub, b_ LOCAL qSub_:={} diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index 251b38687b..997d60a470 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -243,6 +243,7 @@ CLASS IdeProjManager INHERIT IdeObject METHOD selectCurrentProject() METHOD getCurrentProject( lAlert ) + METHOD getCurrentProjectTitle() METHOD getProjectProperties( cProjectTitle ) METHOD getProjectByFile( cProjectFile ) @@ -1025,6 +1026,23 @@ METHOD IdeProjManager:setCurrentProject( cProjectName ) /*----------------------------------------------------------------------*/ +METHOD IdeProjManager:getCurrentProjectTitle() + + IF Empty( ::aProjects ) + RETURN "" + ENDIF + IF ! Empty( ::cWrkProject ) + RETURN ::cWrkProject + ENDIF + IF Len( ::aProjects ) == 1 + ::setCurrentProject( ::aProjects[ 1, 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] ) + RETURN ::aProjects[ 1, 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] + ENDIF + + RETURN "" + +/*----------------------------------------------------------------------*/ + METHOD IdeProjManager:getCurrentProject( lAlert ) DEFAULT lAlert TO .t. @@ -1363,6 +1381,9 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) lRebuild := .t. ENDIF + /* Make Macros happy */ + hbide_setProjectTitle( cProject ) + ::oProject := ::getProjectByTitle( cProject ) // attempt to save the sources if are open in editors should it be controlled by some option ? IF ::oINI:lSaveSourceWhenComp @@ -1513,30 +1534,35 @@ METHOD IdeProjManager:finished( nExitCode, nExitStatus, oProcess ) NEXT ENDIF + cTmp := ::oOutputResult:oWidget:toPlainText() + cExe := "" + IF empty( cExe ) + cTkn := "hbmk2: Linking... " + IF ( n := at( cTkn, cTmp ) ) > 0 + n1 := hb_at( Chr( 10 ), cTmp, n + len( cTkn ) ) + cExe := StrTran( substr( cTmp, n + len( cTkn ), n1 - n - len( cTkn ) ), Chr( 13 ) ) + ENDIF + ENDIF + IF empty( cExe ) + cTkn := "hbmk2: Target up to date: " + IF ( n := at( cTkn, cTmp ) ) > 0 + n1 := hb_at( Chr( 10 ), cTmp, n + len( cTkn ) ) + cExe := StrTran( substr( cTmp, n + len( cTkn ), n1 - n - len( cTkn ) ), Chr( 13 ) ) + ENDIF + ENDIF + + IF hb_isObject( ::cargo ) + cExe := hbide_PathProc( cExe, hbide_pathToOSPath( ::cargo:cPath ) ) + ELSE + cExe := hbide_PathProc( cExe, hbide_pathToOSPath( ::oProject:location ) ) + ENDIF + + IF !empty( cExe ) + hb_fNameSplit( cExe, @cTmp ) + hbide_setProjectOutputPath( cTmp ) + ENDIF + IF ::lLaunch - cTmp := ::oOutputResult:oWidget:toPlainText() - cExe := "" - IF empty( cExe ) - cTkn := "hbmk2: Linking... " - IF ( n := at( cTkn, cTmp ) ) > 0 - n1 := hb_at( Chr( 10 ), cTmp, n + len( cTkn ) ) - cExe := StrTran( substr( cTmp, n + len( cTkn ), n1 - n - len( cTkn ) ), Chr( 13 ) ) - ENDIF - ENDIF - IF empty( cExe ) - cTkn := "hbmk2: Target up to date: " - IF ( n := at( cTkn, cTmp ) ) > 0 - n1 := hb_at( Chr( 10 ), cTmp, n + len( cTkn ) ) - cExe := StrTran( substr( cTmp, n + len( cTkn ), n1 - n - len( cTkn ) ), Chr( 13 ) ) - ENDIF - ENDIF - - IF hb_isObject( ::cargo ) - cExe := hbide_PathProc( cExe, hbide_pathToOSPath( ::cargo:cPath ) ) - ELSE - cExe := hbide_PathProc( cExe, hbide_pathToOSPath( ::oProject:location ) ) - ENDIF - ::outputText( " " ) IF empty( cExe ) ::outputText( "" + "Executable could not been detected from linker output!" + "" ) diff --git a/harbour/contrib/hbide/idetools.prg b/harbour/contrib/hbide/idetools.prg index e83042bc04..44d5931618 100644 --- a/harbour/contrib/hbide/idetools.prg +++ b/harbour/contrib/hbide/idetools.prg @@ -856,9 +856,21 @@ METHOD IdeToolsManager:macro2value( cMacro ) CASE cMacroL == "source_name" cVal := cFile + cExt + CASE cMacroL == "source_name_less_ext" + cVal := cFile + CASE cMacroL == "source_ext" cVal := cExt + CASE cMacroL == "project_title" + cVal := hbide_setProjectTitle() + + CASE cMacroL == "project_path" + cVal := ::oPM:getProjectPathFromTitle( hbide_setProjectTitle() ) + + CASE cMacroL == "project_output_path" + cVal := hbide_setProjectOutputPath() + OTHERWISE cVal := hb_GetEnv( cMacro )