diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ac1cb2ffc6..545abfa91f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,33 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-06-03 18:22 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbqt/hbqt_hbqplaintextedit.cpp + ! Minor. + + * contrib/hbide/resources/buildsource.png + + Icon for "Build Source" action. + + * contrib/hbide/hbide.prg + * contrib/hbide/ideactions.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideedit.prg + * contrib/hbide/idefindreplace.prg + * contrib/hbide/idemisc.prg + * contrib/hbide/ideprojmanager.prg + + Implemeted: to compile a source, source is not saved + if in modified state. Action was already defined but inactive. + + + Implemented: to build a source, current defined environment is + used and build process stays in the folder where source resides. + Also source is not saved. hbIDE attempts to executable it also. + Action defines a new icon on the top-toolbar and also an entry + into the "Build" menu. + + % Few more fixes in selections and find processes. + + NOTE: new setup is also uploaded on my site. + 2010-06-04 01:23 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg ! Fixed typo in recent header detection changes causing -inc diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 3539413969..85fe8dcc2e 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -666,6 +666,7 @@ METHOD HbIde:execAction( cKey ) CASE "NewProject" CASE "LoadProject" CASE "LaunchProject" + CASE "BuildSource" CASE "Build" CASE "BuildLaunch" CASE "Rebuild" @@ -922,6 +923,9 @@ METHOD HbIde:execProjectAction( cKey ) CASE "LaunchProject" ::oPM:launchProject() EXIT + CASE "BuildSource" + ::oPM:buildSource( .t. ) + EXIT CASE "Build" ::oPM:buildProject( '', .F., .F. ) EXIT @@ -935,7 +939,7 @@ METHOD HbIde:execProjectAction( cKey ) ::oPM:buildProject( '', .T., .T. ) EXIT CASE "Compile" - // + ::oPM:buildSource( .f. ) EXIT CASE "CompilePPO" ::oPM:buildProject( '', .F., .F., .T., .T. ) diff --git a/harbour/contrib/hbide/ideactions.prg b/harbour/contrib/hbide/ideactions.prg index aee850d1e7..8e2585af86 100644 --- a/harbour/contrib/hbide/ideactions.prg +++ b/harbour/contrib/hbide/ideactions.prg @@ -183,6 +183,7 @@ METHOD IdeActions:loadActions() aadd( aAct, { "TB_Print" , "~Print" , "print" , "" , "No", "Yes" } ) aadd( aAct, { "TB_Compile" , "Co~mpile" , "compile" , "" , "No", "Yes" } ) aadd( aAct, { "TB_CompilePPO" , "Com~pile to PPO" , "ppo" , "" , "No", "Yes" } ) + aadd( aAct, { "TB_BuildSource" , "Build Source" , "buildsource" , "" , "No", "Yes" } ) aadd( aAct, { "TB_Build" , "Build Project" , "build" , "" , "No", "Yes" } ) aadd( aAct, { "TB_BuildLaunch" , "Build and Launch" , "buildlaunch" , "" , "No", "Yes" } ) aadd( aAct, { "TB_Rebuild" , "Rebuild Project" , "rebuild" , "" , "No", "Yes" } ) @@ -220,6 +221,7 @@ METHOD IdeActions:loadActions() aadd( aAct, { "Compile" , "Co~mpile" , "compile" , "" , "No", "Yes" } ) aadd( aAct, { "CompilePPO" , "Com~pile to PPO" , "ppo" , "" , "No", "Yes" } ) aadd( aAct, { "Build" , "Build Project" , "build" , "" , "No", "Yes" } ) + aadd( aAct, { "BuildSource" , "Build Source" , "buildsource" , "" , "No", "Yes" } ) aadd( aAct, { "BuildLaunch" , "Build and Launch" , "buildlaunch" , "" , "No", "Yes" } ) aadd( aAct, { "Rebuild" , "Rebuild Project" , "rebuild" , "" , "No", "Yes" } ) aadd( aAct, { "RebuildLaunch" , "Rebuild and Launch" , "rebuildlaunch" , "" , "No", "Yes" } ) @@ -266,7 +268,7 @@ METHOD IdeActions:loadActions() aadd( aAct, { "BuildLaunch" , "Build and Launch Project" , "buildlaunch" , "F9" , "No", "Yes" } ) aadd( aAct, { "ReBuild" , "Rebuild Project" , "rebuild" , "" , "No", "Yes" } ) aadd( aAct, { "ReBuildLaunch" , "Rebuild and Launch Project" , "rebuildlaunch" , "" , "No", "Yes" } ) - aadd( aAct, { "CompileCurrent" , "Compile Current Source" , "compile" , "" , "No", "Yes" } ) + aadd( aAct, { "Compile" , "Compile Current Source" , "compile" , "" , "No", "Yes" } ) aadd( aAct, { "CompilePPO" , "Compile Current Source to PPO", "ppo" , "" , "No", "Yes" } ) aadd( aAct, { "LaunchProject" , "Launch Project" , "" , "^F10" , "No", "Yes" } ) aadd( aAct, { "ConfigureTools" , "Configure Tools...*" , "" , "" , "No", "Yes" } ) @@ -344,6 +346,7 @@ METHOD IdeActions:buildToolBar() oTBar:addItem( , , , , , nSep ) oTBar:addItem( ::getAction( "TB_Compile" ), , , , , , "Compile" ) oTBar:addItem( ::getAction( "TB_CompilePPO" ), , , , , , "CompilePPO" ) + oTBar:addItem( ::getAction( "TB_BuildSource" ), , , , , , "BuildSource" ) oTBar:addItem( ::getAction( "TB_Build" ), , , , , , "Build" ) oTBar:addItem( ::getAction( "TB_BuildLaunch" ), , , , , , "BuildLaunch" ) oTBar:addItem( ::getAction( "TB_Rebuild" ), , , , , , "Rebuild" ) @@ -576,14 +579,15 @@ METHOD IdeActions:buildMainMenu() /*----------------------------------------------------------------------------*/ oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~Build" + oSubMenu:addItem( { ::getAction( "Compile" ), {|| oIde:execAction( "Compile" ) } } ) + oSubMenu:addItem( { ::getAction( "CompilePPO" ), {|| oIde:execAction( "CompilePPO" ) } } ) + oSubMenu:addItem( { ::getAction( "BuildSource" ), {|| oIde:execAction( "BuildSource" ) } } ) + hbide_menuAddSep( oSubMenu ) oSubMenu:addItem( { ::getAction( "Build" ), {|| oIde:execAction( "Build" ) } } ) oSubMenu:addItem( { ::getAction( "BuildLaunch" ), {|| oIde:execAction( "BuildLaunch" ) } } ) oSubMenu:addItem( { ::getAction( "Rebuild" ), {|| oIde:execAction( "Rebuild" ) } } ) oSubMenu:addItem( { ::getAction( "RebuildLaunch" ), {|| oIde:execAction( "RebuildLaunch" ) } } ) hbide_menuAddSep( oSubMenu ) - oSubMenu:addItem( { ::getAction( "SaveCompileCurrent" ), {|| oIde:execAction( "SaveCompileCurrent" ) } } ) - oSubMenu:addItem( { ::getAction( "CompilePPO" ), {|| oIde:execAction( "CompilePPO" ) } } ) - hbide_menuAddSep( oSubMenu ) oSubMenu:addItem( { ::getAction( "LaunchProject" ), {|| oIde:execAction( "LaunchProject" ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index 5e8bcf7fa3..fc4d267f38 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -216,7 +216,7 @@ METHOD IdeDocks:buildDialog() ::oDlg:oWidget:setTabPosition( Qt_BottomDockWidgetArea, QTabWidget_South ) ::oDlg:oWidget:setCorner( Qt_BottomLeftCorner, Qt_LeftDockWidgetArea ) ::oDlg:oWidget:setCorner( Qt_BottomRightCorner, Qt_RightDockWidgetArea ) - ::oDlg:oWidget:resize( 868,470 ) + ::oDlg:oWidget:resize( 900,470 ) ::oIde:oDa := ::oDlg:drawingArea diff --git a/harbour/contrib/hbide/ideedit.prg b/harbour/contrib/hbide/ideedit.prg index 2f1cf37e08..8f71eca491 100644 --- a/harbour/contrib/hbide/ideedit.prg +++ b/harbour/contrib/hbide/ideedit.prg @@ -230,6 +230,7 @@ CLASS IdeEdit INHERIT IdeObject METHOD spaces2tabs() METHOD removeTrailingSpaces() METHOD formatBraces() + METHOD findEx( cText, nFlags ) ENDCLASS @@ -1160,12 +1161,16 @@ METHOD IdeEdit:blockConvert( cMode ) DO CASE CASE nMode == selectionMode_stream - IF i == nT - cLine := substr( cLine, 1, nL ) + hbide_convertALine( substr( cLine, nL + 1 ), cMode ) - ELSEIF i == nB - cLine := hbide_convertALine( substr( cLine, 1, nR ), cMode ) + substr( cLine, nR + 1 ) + IF nT == nB + cLine := substr( cLine, 1, nL ) + hbide_convertALine( substr( cLine, nL + 1, nW ), cMode ) + substr( cLine, nL + 1 + nW ) ELSE - cLine := hbide_convertALine( cLine, cMode ) + IF i == nT + cLine := substr( cLine, 1, nL ) + hbide_convertALine( substr( cLine, nL + 1 ), cMode ) + ELSEIF i == nB + cLine := hbide_convertALine( substr( cLine, 1, nR ), cMode ) + substr( cLine, nR + 1 ) + ELSE + cLine := hbide_convertALine( cLine, cMode ) + ENDIF ENDIF CASE nMode == selectionMode_column @@ -1463,6 +1468,23 @@ METHOD IdeEdit:find( cText, nPosFrom ) RETURN lFound +/*----------------------------------------------------------------------*/ +/* nFlags will decide the position, case sensitivity and direction + */ +METHOD IdeEdit:findEx( cText, nFlags ) + LOCAL qCursor, lFound, cT + + IF ( lFound := ::qEdit:find( cText, nFlags ) ) + ::qEdit:centerCursor() + qCursor := ::getCursor() + cT := qCursor:selectedText() + ::qEdit:hbSetSelectionInfo( { qCursor:blockNumber(), qCursor:columnNumber() - len( cT ), ; + qCursor:blockNumber(), qCursor:columnNumber(), 1 } ) + ::qEdit:setTextCursor( qCursor ) + ENDIF + + RETURN lFound + /*----------------------------------------------------------------------*/ METHOD IdeEdit:refresh() diff --git a/harbour/contrib/hbide/idefindreplace.prg b/harbour/contrib/hbide/idefindreplace.prg index 1c063d0f81..83aff3bb4f 100644 --- a/harbour/contrib/hbide/idefindreplace.prg +++ b/harbour/contrib/hbide/idefindreplace.prg @@ -483,7 +483,7 @@ METHOD IdeFindReplace:find( lWarn ) nFlags += iif( ::oUI:q_checkMatchCase:isChecked(), QTextDocument_FindCaseSensitively, 0 ) nFlags += iif( ::oUI:q_radioUp:isChecked(), QTextDocument_FindBackward, 0 ) - IF !( lFound := ::oEM:getEditCurrent():find( cText, nFlags ) ) .AND. lWarn + IF !( lFound := ::oEM:getEditObjectCurrent():findEx( cText, nFlags ) ) .AND. lWarn hbide_showWarning( "Cannot find : " + cText ) ENDIF ENDIF diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index a5c853d2e6..95cee23bfc 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -988,7 +988,7 @@ FUNCTION hbide_help( nOption ) AAdd( txt_, "Harbour Developers Mailing List" ) AAdd( txt_, "" ) AAdd( txt_, "Please visit the home page:" ) - AAdd( txt_, "http://lists.harbour-project.org/pipermail/harbour/" ) + AAdd( txt_, "http://groups.google.com/group/harbour-devel/" ) EXIT CASE 3 @@ -996,7 +996,7 @@ FUNCTION hbide_help( nOption ) AAdd( txt_, "Harbour Users Mailing List" ) AAdd( txt_, "" ) AAdd( txt_, "Please visit the home page:" ) - AAdd( txt_, "http://lists.harbour-project.org/pipermail/harbour/" ) + AAdd( txt_, "http://groups.google.com/group/harbour-users/" ) EXIT CASE 4 diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index 43f23ec3d7..a83b0aee97 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -207,6 +207,7 @@ METHOD IdeProject:new( oIDE, aProps ) CLASS IdeProjManager INHERIT IdeObject + DATA cargo DATA cSaveTo DATA aPrjProps INIT {} @@ -257,6 +258,7 @@ CLASS IdeProjManager INHERIT IdeObject METHOD removeProject( cProjectTitle ) METHOD closeProject( cProjectTitle ) METHOD promptForPath( cObjPathName, cTitle, cObjFileName, cObjPath2, cObjPath3 ) + METHOD buildSource( lExecutable ) METHOD buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) METHOD launchProject( cProject, cExe ) METHOD showOutput( cOutput, mp2, oProcess ) @@ -1209,6 +1211,88 @@ METHOD IdeProjManager:promptForPath( cObjPathName, cTitle, cObjFileName, cObjPat /*----------------------------------------------------------------------*/ +METHOD IdeProjManager:buildSource( lExecutable ) + LOCAL oEdit, cTmp, cExeHbMk2, cCmd, cC, cCmdParams, cBuf + LOCAL cbRed := "", ceRed := "" + LOCAL lRebuild := .T. + LOCAL aHbp := {} + + ::lPPO := .t. + ::lLaunch := lExecutable + ::cProjectInProcess := NIL + + IF !empty( oEdit := ::oEM:getEditorCurrent() ) + IF ! hbide_isSourcePRG( oEdit:sourceFile ) + MsgBox( 'Operation not supported for this file type: "' + oEdit:sourceFile + '"' ) + RETURN Self + ENDIF + ELSE + MsgBox( "No active editing source available !" ) + RETURN Self + ENDIF + ::cargo := oEdit + + aadd( aHbp, "-q" ) + aadd( aHbp, "-trace" ) + aadd( aHbp, "-info" ) + aadd( aHbp, "-lang=en" ) + aadd( aHbp, "-width=512" ) + aadd( aHbp, "-rebuild" ) + IF lExecutable + aadd( aHbp, "-hbexe" ) + ELSE + aadd( aHbp, "-s" ) + ENDIF + aadd( aHbp, hbide_pathToOSPath( oEdit:sourceFile ) ) + + ::oDockB2:show() + ::oOutputResult:oWidget:clear() + + ::oOutputResult:oWidget:append( hbide_outputLine() ) + cTmp := "Project [ " + oEdit:sourceFile + " ] " + ; + "Launch [ " + iif( ::lLaunch , 'Yes', 'No' ) + " ] " + ; + "Rebuild [ " + iif( lRebuild, 'Yes', 'No' ) + " ] " + ; + "Started [ " + time() + " ]" + ::oOutputResult:oWidget:append( cTmp ) + ::oOutputResult:oWidget:append( hbide_outputLine() ) + + ::oIDE:oEV := IdeEnvironments():new():create( ::oIDE ) + ::cBatch := ::oEV:prepareBatch( ::cWrkEnvironment ) + aeval( ::oEV:getHbmk2Commands( ::cWrkEnvironment ), {|e| aadd( aHbp, e ) } ) + + cExeHbMk2 := "hbmk2" + + cCmdParams := hbide_array2cmdParams( aHbp ) + + ::oProcess := HbpProcess():new() + // + ::oProcess:output := {|cOut, mp2, oHbp| ::showOutput( cOut,mp2,oHbp ) } + ::oProcess:finished := {|nEC , nES, oHbp| ::finished( nEC ,nES,oHbp ) } + ::oProcess:workingPath := hbide_pathToOSPath( oEdit:cPath ) + // + cCmd := hbide_getShellCommand() + cC := iif( hbide_getOS() == "nix", "", "/C " ) + + IF hb_fileExists( ::cBatch ) + cBuf := memoread( ::cBatch ) + cBuf += hb_osNewLine() + cExeHbMk2 + " " + cCmdParams + hb_osNewLine() + hb_memowrit( ::cBatch, cBuf ) + ENDIF + // + ::outputText( cbRed + "Batch File " + iif( hb_fileExists( ::cBatch ), " Exists", " : doesn't Exist" ) + " => " + ceRed + trim( ::cBatch ) ) + ::outputText( cbRed + "Batch File Contents => " + ceRed ) + ::outputText( memoread( ::cBatch ) ) + ::outputText( cbRed + "Command => " + ceRed + cCmd ) + ::outputText( cbRed + "Arguments => " + ceRed + cC + ::cBatch ) + ::outputText( hbide_outputLine() ) + // + ::oProcess:addArg( cC + ::cBatch ) + ::oProcess:start( cCmd ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) LOCAL cHbpPath, oEdit, cHbpFN, cTmp, cExeHbMk2, aHbp, cCmd, cC, oSource, cCmdParams, cBuf LOCAL cbRed := "", ceRed := "" @@ -1390,14 +1474,18 @@ METHOD IdeProjManager:finished( nExitCode, nExitStatus, oProcess ) ENDIF ENDIF - cExe := hbide_PathProc( cExe, hbide_pathToOSPath( ::oProject:location ) ) + IF empty( ::cProjectInProcess ) + 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!" + "" ) ELSE cExe := alltrim( cExe ) - ::outputText( "" + "Detected exeutable => " + cExe + "" ) + ::outputText( "" + "Detected executable => " + cExe + "" ) ENDIF ::outputText( " " ) diff --git a/harbour/contrib/hbide/resources/buildsource.png b/harbour/contrib/hbide/resources/buildsource.png new file mode 100644 index 0000000000..1746bbe785 Binary files /dev/null and b/harbour/contrib/hbide/resources/buildsource.png differ diff --git a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp index 448a3a4bd9..eb15c8834a 100644 --- a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp +++ b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp @@ -381,11 +381,13 @@ void HBQPlainTextEdit::hbGetViewportInfo() void HBQPlainTextEdit::hbSetSelectionInfo( PHB_ITEM selectionInfo ) { rowBegins = hb_arrayGetNI( selectionInfo, 1 ); - rowEnds = hb_arrayGetNI( selectionInfo, 2 ); - columnBegins = hb_arrayGetNI( selectionInfo, 3 ); + columnBegins = hb_arrayGetNI( selectionInfo, 2 ); + rowEnds = hb_arrayGetNI( selectionInfo, 3 ); columnEnds = hb_arrayGetNI( selectionInfo, 4 ); selectionMode = hb_arrayGetNI( selectionInfo, 5 ); + emit selectionChanged(); + update(); } @@ -1209,7 +1211,6 @@ bool HBQPlainTextEdit::hbKeyPressSelection( QKeyEvent * event ) } } } - selectionState = 0; return false; #if 0