From f009567e50125e5c4585a6aa0d9d63c064cb9799 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sat, 9 Jan 2010 02:12:39 +0000 Subject: [PATCH] 2010-01-08 18:10 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/hbide.prg * contrib/hbide/ideeditor.prg * contrib/hbide/idemisc.prg * contrib/hbide/ideprojmanager.prg + Enabled .PPO creation in a tab sharing the other sources. So all other editing features are available to it. .ppo is opened in separate tab than the original source. .ppo is not included in "Recent Files" list and hance it is not made available at next execution. --- harbour/ChangeLog | 11 ++++ harbour/contrib/hbide/hbide.prg | 4 +- harbour/contrib/hbide/ideeditor.prg | 11 ++-- harbour/contrib/hbide/idemisc.prg | 26 ++++++-- harbour/contrib/hbide/ideprojmanager.prg | 75 ++++++++++++------------ 5 files changed, 75 insertions(+), 52 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f095b3080f..d46b3580b8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,17 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-08 18:10 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/hbide.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/idemisc.prg + * contrib/hbide/ideprojmanager.prg + + Enabled .PPO creation in a tab sharing the other sources. + So all other editing features are available to it. + .ppo is opened in separate tab than the original source. + .ppo is not included in "Recent Files" list and hance + it is not made available at next execution. + 2010-01-09 01:39 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * config/global.mk ! Fixed to not require HB_BIN_COMPILE is host and target diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 37a7f91714..8fc5afba62 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -439,7 +439,7 @@ METHOD HbIde:execAction( cKey ) CASE cKey == "Compile" // CASE cKey == "CompilePPO" - ::oPM:buildProject( '', .F., .F., .T. ) + ::oPM:buildProject( '', .F., .F., .T., .T. ) CASE cKey == "Properties" IF Empty( ::cWrkProject ) MsgBox( 'No active project detected!' ) @@ -711,7 +711,7 @@ METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme, lAlert, lVisib ::oED:setSourceVisible( cSourceFile ) ENDIF - IF !Empty( cSourceFile ) + IF !Empty( cSourceFile ) .AND. !hbide_isSourcePPO( cSourceFile ) hbide_mnuAddFileToMRU( Self, cSourceFile, INI_RECENTFILES ) ENDIF diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index 2eb22ddc68..ac7d73b629 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -228,9 +228,10 @@ METHOD IdeEditsManager:setSourceVisible( cSource ) METHOD IdeEditsManager:setSourceVisibleByIndex( nIndex ) /* nIndex is 0 based */ IF ::qTabWidget:count() > 0 .AND. ::qTabWidget:count() > nIndex - ::qTabWidget:setCurrentIndex( nIndex ) - ::getEditorByIndex( nIndex ):setDocumentProperties() + nIndex := 0 ENDIF + ::qTabWidget:setCurrentIndex( 0 ) + ::getEditorByIndex( 0 ):setDocumentProperties() RETURN .f. @@ -599,7 +600,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) hb_fNameSplit( cSourceFile, @::cPath, @::cFile, @::cExt ) ::cType := upper( strtran( ::cExt, ".", "" ) ) - ::cType := iif( ::cType $ "PRG,C,CPP,H,CH", ::cType, "U" ) + ::cType := iif( ::cType $ "PRG,C,CPP,H,CH,PPO", ::cType, "U" ) ::buildTabPage( ::sourceFile ) @@ -648,8 +649,6 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) METHOD IdeEditor:setDocumentProperties() LOCAL qCursor - hbide_dbg( " ." ) - qCursor := QTextCursor():configure( ::qEdit:textCursor() ) IF !( ::lLoaded ) /* First Time */ @@ -677,8 +676,6 @@ METHOD IdeEditor:setDocumentProperties() ::oIde:manageFocusInEditor() - hbide_dbg( " ." ) - RETURN Self /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 3a16a5c7d0..0e23904c5d 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -513,10 +513,9 @@ FUNCTION hbide_isValidText( cSourceFile ) LOCAL cExt hb_fNameSplit( cSourceFile, , , @cExt ) - cExt := lower( cExt ) - RETURN ( cExt $ ".c,.cpp,.prg,.h,.ch,.txt,.log,.ini,.env,.ppo,"+; - ".cc,.hbc,.hbp,.hbm,.xml,.bat,.sh,.rc" ) + RETURN ( lower( cExt ) $ ".c,.cpp,.prg,.h,.ch,.txt,.log,.ini,.env,.ppo," + ; + ".cc,.hbc,.hbp,.hbm,.xml,.bat,.sh,.rc" ) /*----------------------------------------------------------------------*/ @@ -524,9 +523,26 @@ FUNCTION hbide_isValidSource( cSourceFile ) LOCAL cExt hb_fNameSplit( cSourceFile, , , @cExt ) - cExt := lower( cExt ) - RETURN ( cExt $ ".c,.cpp,.prg,.res,.rc" ) + RETURN ( lower( cExt ) $ ".c,.cpp,.prg,.res,.rc" ) + +/*----------------------------------------------------------------------*/ + +FUNCTION hbide_isSourcePPO( cSourceFile ) + LOCAL cExt + + hb_fNameSplit( cSourceFile, , , @cExt ) + + RETURN ( lower( cExt ) == ".ppo" ) + +/*----------------------------------------------------------------------*/ + +FUNCTION hbide_isSourcePRG( cSourceFile ) + LOCAL cExt + + hb_fNameSplit( cSourceFile, , , @cExt ) + + RETURN ( lower( cExt ) == ".prg" ) /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index ba02c9aa4f..8cdbd2ab41 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -94,6 +94,8 @@ CLASS IdeProjManager INHERIT IdeObject DATA lLaunch INIT .f. DATA cProjectInProcess INIT "" + DATA cPPO INIT "" + DATA lPPO INIT .f. METHOD new() METHOD create() @@ -636,14 +638,15 @@ METHOD IdeProjManager:buildProjectViaQt( cProject ) /*----------------------------------------------------------------------*/ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) - LOCAL cOutput, cErrors, n, aPrj, cHbpPath, aHbp, qStringList, qListSets - LOCAL cTmp, nResult, nSeconds, cTargetFN, cPath, cFileName, lDelHbp + LOCAL cOutput, cErrors, n, aPrj, cHbpPath, aHbp, qStringList, oEdit + LOCAL cTmp, nResult, nSeconds, cTargetFN, lDelHbp DEFAULT lLaunch TO .F. DEFAULT lRebuild TO .F. DEFAULT lPPO TO .F. DEFAULT lViaQt TO .F. + ::lPPO := lPPO ::lLaunch := lLaunch ::cProjectInProcess := cProject @@ -653,11 +656,9 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) MsgBox( 'No file open issue to be compiled!' ) RETURN Self End - IF empty( cProject ) cProject := ::getCurrentProject() ENDIF - IF empty( cProject ) RETURN Self ENDIF @@ -696,28 +697,29 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) aeval( aPrj[ PRJ_PRP_FLAGS, 2 ], {|e| aadd( aHbp, e ) } ) - IF !( lPPO ) + IF !( ::lPPO ) aeval( hbide_filesToSources( aPrj[ PRJ_PRP_SOURCES, 2 ] ), {|e| aadd( aHbp, e ) } ) ELSE - aadd( aHbp, "-hbcmp -s -p" ) + IF !empty( oEdit := ::oED:getEditorCurrent() ) + IF hbide_isSourcePRG( oEdit:sourceFile ) + aadd( aHbp, "-hbcmp -s -p" ) - n := ::getCurrentTab() + // TODO: We have to test if the current file is part of a project, and we + // pull your settings, even though this is not the active project - vailtom + aadd( aHbp, hbide_pathToOSPath( oEdit:sourceFile ) ) - hb_FNameSplit( ::aTabs[ n, TAB_SOURCEFILE ], @cPath, @cFileName, @cTmp ) + ::cPPO := hbide_pathToOSPath( oEdit:cPath + oEdit:cFile + '.ppo' ) + FErase( ::cPPO ) - IF !( lower( cTmp ) $ ".prg,?" ) - MsgBox( 'Operation not supported for this file type: "' + cTmp + '"' ) - RETURN Self + ELSE + MsgBox( 'Operation not supported for this file type: "' + cTmp + '"' ) + RETURN Self + + ENDIF + + lViaQt := .t. /* Donot know why it fails with Qt */ ENDIF - - cFileName := cPath + cFileName + '.ppo' - - // TODO: We have to test if the current file is part of a project, and we - // pull your settings, even though this is not the active project - vailtom - aadd( aHbp, ::aTabs[ n, TAB_SOURCEFILE ] ) - - FErase( cFileName ) ENDIF IF !hbide_createTarget( cHbpPath, aHbp ) @@ -756,18 +758,6 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) ::oOutputResult:oWidget:append( cTmp ) ::nStarted := seconds() - #if 0 /* Experiment */ - qStringList := QStringList():new() - qStringList:append( "/k" ) - qStringList:append( "c:\batches\SetMinGW-harbour-E.bat" ) - qStringList:append( "hbMK2.exe -help" ) - ::qProcess:startDetached_1( "cmd.exe", qStringList ) - #endif - - - qListSets := QStringList():new() - qListSets:append( "HB_WITH_QT=c:\qt\4.5.3\lib" ) - #if 0 /* Mechanism to supply environment variables to called process */ /* I do not know nixes but assume that Qt must be issueing proper */ /* shell command for the target OS to set them. */ @@ -775,14 +765,20 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) /* and hence developer can choose any compiler of his choice. */ /* */ /* Actually, this was the intension in hbIDE.env I commited in IDE root */ - ::qProcess:setEnvironment( qListSets ) - #endif + qStringList := QStringList():new() + qStringList:append( "HB_WITH_QT=c:\qt\4.5.3\lib" ) + ::qProcess:setEnvironment( qStringList ) + + qStringList := QStringList():new() + qStringList:append( [/c c:\batches\SetMinGW-harbour-E.bat && hbMK2.exe ] + cHbpPath ) + ::qProcess:start( "cmd.exe", qStringList ) + #else qStringList := QStringList():new() qStringList:append( cHbpPath ) // ::qProcess:start( "hbmk2", qStringList ) - + #endif ELSE cOutput := "" ; cErrors := "" nResult := hb_processRun( ( "hbmk2 " + cHbpPath ), , @cOutput, @cErrors ) @@ -800,6 +796,10 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) IF ( nResult == 0 ) .AND. ( lLaunch ) ::LaunchProject( cProject ) ENDIF + + IF ::lPPO .AND. hb_FileExists( ::cPPO ) + ::oIde:editSource( ::cPPO ) + ENDIF ENDIF ENDIF @@ -808,10 +808,6 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) FErase( cHbpPath ) ENDIF - IF lPPO .AND. hb_FileExists( cFileName ) - ::oED:showPPO( cFileName ) - ENDIF - RETURN Self /*----------------------------------------------------------------------*/ @@ -866,6 +862,9 @@ METHOD IdeProjManager:readProcessInfo( nMode, i, ii ) IF ::lLaunch ::launchProject( ::cProjectInProcess ) ENDIF + IF ::lPPO .AND. hb_FileExists( ::cPPO ) + ::oIde:editSource( ::cPPO ) + ENDIF ENDCASE RETURN nil