From aaa1edf5726e3ea168e945480fff02d7afd135ff Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Thu, 7 Jan 2010 01:33:15 +0000 Subject: [PATCH] 2010-01-06 17:10 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/projects/hbide.hbi ! Deleted hard-coded -o directive, no longer needed. ! Project paths are now shown without meta-dat. * contrib/hbide/resources/projectproperties.ui ! Changed components background behavior not to use gradients. Now it is plain vanila white. * contrib/hbide/hbide.prg * contrib/hbide/idedocks.prg * contrib/hbide/ideeditor.prg * contrib/hbide/idemisc.prg * contrib/hbide/ideobject.prg * contrib/hbide/ideprojmanager.prg * contrib/hbide/idesaveload.prg * contrib/hbide/idestylesheets.prg ! Another round of reforms. And I am almost done with them. But wait... ! Started implementation of .env concept. What was missing from hbIDE => hbMK2 were the shell commands minimum necessary to let hbMK2 engine take control of. Now it can be done via QProcess:setEnvironment() call. I have left under the commented code in ideprojmanager.prg: /* 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. */ /* If I am not wrong, HBMK2 can have these variables alread set */ /* and hence developer can choose any compiler of his choice. */ /* */ /* Actually, this was the intension in hbIDE.env I commited in IDE root */ I am been able to compile/link/execute hbIDE.exe after setting ( WinXP ) qListSets := QStringList():new() qListSets:append( "HB_WITH_QT=c:\qt\4.5.3\lib" ) ::qProcess:setEnvironment( qListSets ) just before triggering the process. Your input is desired as I know nothing about make system. ! Fixed many artifacts difficult to jot-down. + Implemented not to load any source until brought forward for view. This has increased the loading speed extremely fast and always consistent in timing. This feature was hanging on my drawing board since begining. This effectively means that sessions with any number of source tabs will not pose speed panelty. TODO: Syntax highlighting is a slow process, to speed-up. --- harbour/ChangeLog | 49 +++++++ harbour/contrib/hbide/hbide.prg | 32 +++-- harbour/contrib/hbide/idedocks.prg | 2 +- harbour/contrib/hbide/ideeditor.prg | 130 ++++++++++++------ harbour/contrib/hbide/idemisc.prg | 4 +- harbour/contrib/hbide/ideobject.prg | 2 + harbour/contrib/hbide/ideprojmanager.prg | 101 ++++++++------ harbour/contrib/hbide/idesaveload.prg | 8 +- harbour/contrib/hbide/idestylesheets.prg | 24 ++++ harbour/contrib/hbide/projects/hbide.hbi | 18 +-- .../hbide/resources/projectproperties.ui | 10 +- 11 files changed, 267 insertions(+), 113 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0d19f82f34..3b96a5f594 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,55 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-06 17:10 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/projects/hbide.hbi + ! Deleted hard-coded -o directive, no longer needed. + ! Project paths are now shown without meta-dat. + + * contrib/hbide/resources/projectproperties.ui + ! Changed components background behavior not to use gradients. + Now it is plain vanila white. + + * contrib/hbide/hbide.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/idemisc.prg + * contrib/hbide/ideobject.prg + * contrib/hbide/ideprojmanager.prg + * contrib/hbide/idesaveload.prg + * contrib/hbide/idestylesheets.prg + ! Another round of reforms. And I am almost done with them. But wait... + + ! Started implementation of .env concept. What was missing from + hbIDE => hbMK2 were the shell commands minimum necessary to + let hbMK2 engine take control of. Now it can be done via + QProcess:setEnvironment() call. I have left under the commented + code in ideprojmanager.prg: + /* 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. */ + /* If I am not wrong, HBMK2 can have these variables alread set */ + /* and hence developer can choose any compiler of his choice. */ + /* */ + /* Actually, this was the intension in hbIDE.env I commited in IDE root */ + I am been able to compile/link/execute hbIDE.exe after setting ( WinXP ) + qListSets := QStringList():new() + qListSets:append( "HB_WITH_QT=c:\qt\4.5.3\lib" ) + ::qProcess:setEnvironment( qListSets ) + just before triggering the process. + Your input is desired as I know nothing about make system. + + ! Fixed many artifacts difficult to jot-down. + + + Implemented not to load any source until brought forward for view. + This has increased the loading speed extremely fast and always + consistent in timing. This feature was hanging on my drawing board + since begining. + This effectively means that sessions with any number of source tabs + will not pose speed panelty. + + TODO: Syntax highlighting is a slow process, to speed-up. + 2010-01-07 01:40 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/Makefile - contrib/hbwin/win_err.c diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index c114120d25..d994832292 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -119,6 +119,8 @@ CLASS HbIde DATA oED DATA oAC + DATA aMeta INIT {} /* Holds current definition only */ + DATA mp1, mp2, oXbp, nEvent DATA aTabs INIT {} DATA cProjIni @@ -1142,10 +1144,11 @@ METHOD HbIde:manageProjectContext( mp1, mp2, oXbpTreeItem ) aadd( aPops, { "Load Project" , {|| ::oPM:loadProperties( , .f., .f., .t. ) } } ) hbide_ExecPopup( aPops, mp1, ::oProjTree:oWidget ) - CASE ::aProjData[ n, 2 ] == "Project Name" - aPrj := ::aProjData[ n, 5 ] + CASE ::aProjData[ n, TRE_TYPE ] == "Project Name" + aPrj := ::aProjData[ n, TRE_DATA ] cHbi := aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_LOCATION ] + s_pathSep + ; aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_OUTPUT ] + ".hbi" + cHbi := hbide_pathToOSPath( cHbi ) // IF Alltrim( Upper( ::cWrkProject ) ) != Alltrim( Upper( oXbpTreeItem:caption ) ) aadd( aPops, { "Set as Current" , {|| ::oPM:setCurrentProject( oXbpTreeItem:caption ) } } ) @@ -1163,10 +1166,10 @@ METHOD HbIde:manageProjectContext( mp1, mp2, oXbpTreeItem ) // hbide_ExecPopup( aPops, mp1, ::oProjTree:oWidget ) - CASE ::aProjData[ n, 2 ] == "Source File" + CASE ::aProjData[ n, TRE_TYPE ] == "Source File" // - CASE ::aProjData[ n, 2 ] == "Opened Source" + CASE ::aProjData[ n, TRE_TYPE ] == "Opened Source" cSource := ::aProjData[ n, 5 ] n := ascan( ::aTabs, {|e_| hbide_pathNormalized( e_[ 5 ] ) == cSource } ) // @@ -1202,19 +1205,21 @@ METHOD HbIde:updateFuncList() /*----------------------------------------------------------------------*/ METHOD HbIde:gotoFunction( mp1, mp2, oListBox ) - LOCAL n, cAnchor + LOCAL n, cAnchor, oEdit mp1 := oListBox:getData() mp2 := oListBox:getItem( mp1 ) IF ( n := ascan( ::aTags, {|e_| mp2 == e_[ 7 ] } ) ) > 0 cAnchor := trim( ::aText[ ::aTags[ n,3 ] ] ) - IF !( ::aTabs[ ::nCurTab, TAB_QEDIT ]:find( cAnchor, QTextDocument_FindCaseSensitively ) ) - ::aTabs[ ::nCurTab, TAB_QEDIT ]:find( cAnchor, QTextDocument_FindBackward + QTextDocument_FindCaseSensitively ) - + IF !empty( oEdit := ::oED:getEditorCurrent() ) + IF !( oEdit:qEdit:find( cAnchor, QTextDocument_FindCaseSensitively ) ) + oEdit:qEdit:find( cAnchor, QTextDocument_FindBackward + QTextDocument_FindCaseSensitively ) + ENDIF ENDIF ENDIF ::manageFocusInEditor() + RETURN Self /*----------------------------------------------------------------------*/ @@ -1315,20 +1320,21 @@ METHOD HbIde:updateProjectMenu() */ METHOD HbIde:updateTitleBar() LOCAL cTitle := "Harbour-Qt IDE" + LOCAL oEdit IF Empty( ::oDlg ) RETURN Self ENDIF IF !Empty( ::cWrkProject ) - cTitle += " - " + ::cWrkProject + "" + cTitle += " [" + ::cWrkProject + "] " ENDIF - IF ::nCurTab > 0 .AND. ::nCurTab <= Len( ::aTabs ) - IF Empty( ::aTabs[ ::nCurTab, TAB_SOURCEFILE ] ) - cTitle += " - [" + ::aTabs[ ::nCurTab, TAB_OTAB ]:Caption + "]" + IF !empty( oEdit := ::oED:getEditorCurrent() ) + IF Empty( oEdit:sourceFile ) + cTitle += "[" + oEdit:oTab:caption + "]" ELSE - cTitle += " - [" + ::aTabs[ ::nCurTab, TAB_SOURCEFILE ] + "]" + cTitle += "[" + oEdit:sourceFile + "]" ENDIF ENDIF diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index e7194946fb..45db073ac0 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -195,7 +195,7 @@ METHOD IdeDocks:buildProjectTree() ::oProjTree:hasButtons := .T. ::oProjTree:create( ::oDa, , { 0,0 }, { 10,10 }, , .t. ) - * ::oProjTree:setStyleSheet( GetStyleSheet( "QTreeWidget" ) ) + ::oProjTree:setStyleSheet( GetStyleSheet( "QTreeWidgetHB" ) ) //::oProjTree:itemMarked := {|oItem| ::manageItemSelected( 0, oItem ), ::oCurProjItem := oItem } ::oProjTree:itemMarked := {|oItem| ::oIde:oCurProjItem := oItem, ::oIde:manageFocusInEditor() } diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index e5fbc1e027..87bf14a55d 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -105,8 +105,10 @@ CLASS IdeEditsManager INHERIT IdeObject METHOD setSourceVisible() METHOD setSourceVisibleByIndex() + METHOD getEditorCurrent() METHOD getEditorBySource() METHOD getEditorByTabPosition() + METHOD getEditorByTabObject() METHOD getEditorByIndex() ENDCLASS @@ -121,6 +123,20 @@ METHOD IdeEditsManager:buildEditor( cSourceFile, nPos, nHPos, nVPos, cTheme ) /*----------------------------------------------------------------------*/ +METHOD IdeEditsManager:getEditorCurrent() + LOCAL qTab, nTab + + IF ::qTabWidget:count() > 0 + qTab := ::qTabWidget:currentWidget() + IF ( nTab := ascan( ::aTabs, {|e_| hbqt_IsEqualGcQtPointer( e_[ TAB_OTAB ]:oWidget:pPtr, qTab ) } ) ) > 0 + RETURN ::aTabs[ nTab, TAB_OEDITOR ] + ENDIF + ENDIF + + RETURN Nil + +/*----------------------------------------------------------------------*/ + METHOD IdeEditsManager:getEditorByIndex( nIndex ) /* Index is 0 based */ LOCAL pTab, a_ @@ -137,6 +153,19 @@ METHOD IdeEditsManager:getEditorByIndex( nIndex ) /* Index is 0 based */ /*----------------------------------------------------------------------*/ +METHOD IdeEditsManager:getEditorByTabObject( oTab ) + LOCAL nPos + + IF hb_isObject( oTab ) + IF ( nPos := ascan( ::aTabs, {|e_| e_[ TAB_OTAB ] == oTab } ) ) > 0 + RETURN ::aTabs[ nPos, TAB_OEDITOR ] + ENDIF + ENDIF + + RETURN Nil + +/*----------------------------------------------------------------------*/ + METHOD IdeEditsManager:getEditorByTabPosition( nPos ) IF hb_isNumeric( nPos ) .AND. nPos > 0 .AND. nPos <= len( ::aTabs ) @@ -180,10 +209,15 @@ METHOD IdeEditsManager:isOpen( cSource ) /*----------------------------------------------------------------------*/ METHOD IdeEditsManager:setSourceVisible( cSource ) - LOCAL oEdit + LOCAL oEdit, nIndex IF !empty( oEdit := ::getEditorBySource( cSource ) ) - ::qTabWidget:setCurrentIndex( ::qTabWidget:indexOf( oEdit:oTab:oWidget ) ) + nIndex := ::qTabWidget:indexOf( oEdit:oTab:oWidget ) + IF ::qTabWidget:currentIndex() != nIndex + ::qTabWidget:setCurrentIndex( nIndex ) + ELSE + oEdit:setDocumentProperties() + ENDIF RETURN .t. ENDIF @@ -194,7 +228,11 @@ METHOD IdeEditsManager:setSourceVisible( cSource ) METHOD IdeEditsManager:setSourceVisibleByIndex( nIndex ) IF ::qTabWidget:count() > 0 .AND. ::qTabWidget:count() > nIndex /* nIndex is 0 based */ - ::qTabWidget:setCurrentIndex( nIndex ) + IF ::qTabWidget:currentIndex() != nIndex + ::qTabWidget:setCurrentIndex( nIndex ) + ELSE + ::getEditorByIndex( nIndex ):setDocumentProperties() + ENDIF ENDIF RETURN .f. @@ -498,7 +536,7 @@ CLASS IdeEditor INHERIT IdeObject DATA sourceFile DATA pathNormalized DATA qLayout - + DATA lLoaded INIT .F. DATA nBlock INIT -1 DATA nColumn INIT -1 @@ -523,6 +561,7 @@ CLASS IdeEditor INHERIT IdeObject METHOD onBlockCountChanged() METHOD setTabImage() METHOD applyTheme() + METHOD setDocumentProperties() ENDCLASS @@ -567,7 +606,6 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) ::buildTabPage( ::sourceFile ) ::qEdit := QPlainTextEdit():new( ::oTab:oWidget ) - ::qEdit:setPlainText( hb_memoRead( ::sourceFile ) ) ::qEdit:setLineWrapMode( QTextEdit_NoWrap ) ::qEdit:setFont( ::oFont:oWidget ) ::qEdit:ensureCursorVisible() @@ -591,34 +629,66 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) Qt_Slots_Connect( ::pSlots, ::qDocument, "blockCountChanged(int)" , {|o,i| ::onBlockCountChanged( i, o ) } ) ::qEdit:show() - - /* Restore State */ ::qCursor := QTextCursor():configure( ::qEdit:textCursor() ) - ::qCursor:setPosition( ::nPos ) - ::qEdit:setTextCursor( ::qCursor ) - // - QScrollBar():configure( ::qEdit:horizontalScrollBar() ):setValue( ::nHPos ) - // - QScrollBar():configure( ::qEdit:verticalScrollBar() ):setValue( ::nVPos ) /* Populate Tabs Array */ aadd( ::aTabs, { ::oTab, ::qEdit, ::qHiliter, ::qLayout, ::sourceFile, ::qDocument, Self } ) ::oIde:nCurTab := len( ::oIde:aTabs ) - ::oIde:aSources := { ::sourceFile } - ::oIde:createTags() - ::oIde:updateFuncList() + /* Populate right at creation */ ::oIde:addSourceInTree( ::sourceFile ) - ::oIde:updateTitleBar() - ::oIde:manageFocusInEditor() - - ::nBlock := ::qCursor:blockNumber() - ::nColumn := ::qCursor:columnNumber() ::qTabWidget:setStyleSheet( GetStyleSheet( "QTabWidget" ) ) ::setTabImage() + hbide_dbg( " ." ) + hbide_dbg( ".......................................", cSourceFile ) + hbide_dbg( " ." ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEditor:setDocumentProperties() + LOCAL qCursor + + qCursor := QTextCursor():configure( ::qEdit:textCursor() ) + + IF !( ::lLoaded ) /* First Time */ + ::lLoaded := .T. + ::qEdit:setPlainText( hb_memoRead( ::sourceFile ) ) + qCursor:setPosition( ::nPos ) + ::qEdit:setTextCursor( qCursor ) + QScrollBar():configure( ::qEdit:horizontalScrollBar() ):setValue( ::nHPos ) + QScrollBar():configure( ::qEdit:verticalScrollBar() ):setValue( ::nVPos ) + ENDIF + + ::nBlock := qCursor:blockNumber() + ::nColumn := qCursor:columnNumber() + + ::oIde:aSources := { ::sourceFile } + ::oIde:createTags() + ::oIde:updateFuncList() + ::oIde:updateTitleBar() + ::dispEditInfo() + + ::oIde:manageFocusInEditor() + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEditor:activateTab( mp1, mp2, oXbp ) + LOCAL oEdit + + HB_SYMBOL_UNUSED( mp1 ) + + IF !empty( oEdit := ::oED:getEditorByTabObject( oXbp ) ) + ::oIde:nCurTab := mp2 + oEdit:setDocumentProperties() + ENDIF + RETURN Self /*----------------------------------------------------------------------*/ @@ -739,24 +809,6 @@ METHOD IdeEditor:buildTabPage( cSource ) /*----------------------------------------------------------------------*/ -METHOD IdeEditor:activateTab( mp1, mp2, oXbp ) - - HB_SYMBOL_UNUSED( mp1 ) - - IF ( mp2 := ascan( ::oIde:aTabs, {|e_| e_[ TAB_OTAB ] == oXbp } ) ) > 0 - ::oIde:nCurTab := mp2 - ::oIde:aSources := { ::oIde:aTabs[ ::oIde:nCurTab, TAB_SOURCEFILE ] } - ::oIde:createTags() - ::oIde:updateFuncList() - ::aTabs[ mp2, TAB_OEDITOR ]:dispEditInfo() - ::oIde:updateTitleBar() - ::oIde:manageFocusInEditor() - ENDIF - - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD IdeEditor:closeTab( mp1, mp2, oXbp ) IF PCount() == 00 diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 17de8ee587..5dfd8bbb8e 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -543,8 +543,8 @@ FUNCTION hbide_pathNormalized( cPath, lLower ) FUNCTION hbide_pathToOSPath( cPath ) - cPath := strtran( cPath, "/", hb_osPathSeparator() ) - cPath := strtran( cPath, "\", hb_osPathSeparator() ) + cPath := strtran( cPath, "/" , hb_osPathSeparator() ) + cPath := strtran( cPath, "\" , hb_osPathSeparator() ) RETURN cPath diff --git a/harbour/contrib/hbide/ideobject.prg b/harbour/contrib/hbide/ideobject.prg index db721d6b23..40a50a494a 100644 --- a/harbour/contrib/hbide/ideobject.prg +++ b/harbour/contrib/hbide/ideobject.prg @@ -84,6 +84,8 @@ CLASS IdeObject ACCESS oDK INLINE ::oIde:oDK ACCESS oAC INLINE ::oIde:oAC + ACCESS aMeta INLINE ::oIde:aMeta + ACCESS qCurEdit INLINE ::oIde:qCurEdit ACCESS oCurEditor INLINE ::oIde:oCurEditor ACCESS qTabWidget INLINE ::oIde:oDA:oTabWidget:oWidget diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index bcc0a8cc92..6fa33170ed 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -71,6 +71,19 @@ /*----------------------------------------------------------------------*/ +#define CHN_BGN 1 +#define CHN_OUT 2 +#define CHN_ERR 3 +#define CHN_FIN 4 +#define CHN_STT 5 +#define CHN_ERE 6 +#define CHN_CLO 7 +#define CHN_BYT 8 +#define CHN_RCF 9 +#define CHN_REA 10 + +/*----------------------------------------------------------------------*/ + CLASS IdeProjManager INHERIT IdeObject DATA cSaveTo @@ -79,6 +92,9 @@ CLASS IdeProjManager INHERIT IdeObject DATA qProcess DATA nStarted INIT 0 + DATA lLaunch INIT .f. + DATA cProjectInProcess INIT "" + METHOD new() METHOD create() METHOD destroy() @@ -138,15 +154,15 @@ METHOD IdeProjManager:populate() /*----------------------------------------------------------------------*/ -METHOD IdeProjManager:loadProperties( cProject, lNew, lFetch, lUpdateTree ) +METHOD IdeProjManager:loadProperties( cProjFileName, lNew, lFetch, lUpdateTree ) LOCAL n, t, cWrkProject - DEFAULT cProject TO "" - DEFAULT lNew TO .F. - DEFAULT lFetch TO .T. - DEFAULT lUpdateTree TO .F. + DEFAULT cProjFileName TO "" + DEFAULT lNew TO .F. + DEFAULT lFetch TO .T. + DEFAULT lUpdateTree TO .F. - /* Never touch original project file sent */ + /* Never touch original project file name */ ::aPrjProps := {} ::cSaveTo := "" @@ -154,40 +170,41 @@ METHOD IdeProjManager:loadProperties( cProject, lNew, lFetch, lUpdateTree ) IF lNew lFetch := .t. ELSE - IF empty( cProject ) - cProject := hbide_fetchAFile( ::oDlg, "Load Project...", { { "Harbour IDE Projects (*.hbi)", "*.hbi" } } ) + IF empty( cProjFileName ) + cProjFileName := hbide_fetchAFile( ::oDlg, "Load Project...", { { "Harbour IDE Projects (*.hbi)", "*.hbi" } } ) ENDIF - IF empty( cProject ) + IF empty( cProjFileName ) RETURN Self ENDIF ENDIF n := 0 - IF !empty( cProject ) - cWrkProject := hbide_pathNormalized( cProject ) /* normalize project name */ + IF !empty( cProjFileName ) + cWrkProject := hbide_pathNormalized( cProjFileName ) /* normalize project name */ IF ( n := ascan( ::aProjects, {|e_| hbide_pathNormalized( e_[ 1 ] ) == cWrkProject } ) ) > 0 ::aPrjProps := ::aProjects[ n, 3 ] t := ::aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] ENDIF IF empty( ::aPrjProps ) - ::aPrjProps := hbide_fetchHbiStructFromFile( hbide_pathToOSPath( cProject ) ) + ::aPrjProps := hbide_fetchHbiStructFromFile( hbide_pathToOSPath( cProjFileName ) ) ENDIF + ::oIde:aMeta := ::aPrjProps[ PRJ_PRP_METADATA, 2 ] ENDIF IF lFetch ::fetchProperties() IF !empty( ::cSaveTo ) .and. hb_FileExists( ::cSaveTo ) - cProject := ::cSaveTo - ::aPrjProps := hbide_fetchHbiStructFromFile( hbide_pathToOSPath( cProject ) ) /* Reload from file */ + cProjFileName := ::cSaveTo + ::aPrjProps := hbide_fetchHbiStructFromFile( hbide_pathToOSPath( cProjFileName ) ) /* Reload from file */ ENDIF ENDIF IF n == 0 - aadd( ::oIde:aProjects, { lower( cProject ), cProject, aclone( ::aPrjProps ) } ) + aadd( ::oIde:aProjects, { lower( cProjFileName ), cProjFileName, aclone( ::aPrjProps ) } ) IF lUpdateTree ::updateProjectTree( ::aPrjProps ) ENDIF - hbide_mnuAddFileToMRU( ::oIde, cProject, INI_RECENTPROJECTS ) + hbide_mnuAddFileToMRU( ::oIde, cProjFileName, INI_RECENTPROJECTS ) ELSE ::aProjects[ n, 3 ] := aclone( ::aPrjProps ) IF lUpdateTree @@ -473,6 +490,7 @@ METHOD IdeProjManager:setCurrentProject( cProjectName ) IF !empty( oItem := hbide_findProjTreeItem( ::oIde, ::cWrkProject, "Project Name" ) ) oItem:oWidget:setForeground( 0, ::qBrushWrkProject ) hbide_expandChildren( ::oIde, oItem ) + ::oProjTree:oWidget:setCurrentItem( oItem:oWidget ) ENDIF ENDIF ENDIF @@ -616,7 +634,7 @@ METHOD IdeProjManager:buildProjectViaQt( cProject ) /*----------------------------------------------------------------------*/ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) - LOCAL cOutput, cErrors, n, aPrj, cHbpPath, aHbp, qStringList + LOCAL cOutput, cErrors, n, aPrj, cHbpPath, aHbp, qStringList, qListSets LOCAL cTmp, nResult, nSeconds, cTargetFN, cPath, cFileName, lDelHbp DEFAULT lLaunch TO .F. @@ -624,6 +642,9 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) DEFAULT lPPO TO .F. DEFAULT lViaQt TO .F. + ::lLaunch := lLaunch + ::cProjectInProcess := cProject + lDelHbp := lPPO IF lPPO .AND. ::getCurrentTab() == 0 @@ -721,33 +742,33 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) ::qProcess := QProcess():new() ::qProcess:setReadChannel( 1 ) - #define CHN_BGN 1 - #define CHN_OUT 2 - #define CHN_ERR 3 - #define CHN_FIN 4 - #define CHN_STT 5 - #define CHN_ERE 6 - #define CHN_CLO 7 - #define CHN_BYT 8 - #define CHN_RCF 9 - #define CHN_REA 10 - - //Qt_Slots_Connect( ::pSlots, ::qProcess, "readyRead()" , {|o,i| ::readProcessInfo( CHN_REA, i, o ) } ) + Qt_Slots_Connect( ::pSlots, ::qProcess, "readyRead()" , {|o,i| ::readProcessInfo( CHN_REA, i, o ) } ) Qt_Slots_Connect( ::pSlots, ::qProcess, "readChannelFinished()" , {|o,i| ::readProcessInfo( CHN_RCF, i, o ) } ) Qt_Slots_Connect( ::pSlots, ::qProcess, "aboutToClose()" , {|o,i| ::readProcessInfo( CHN_CLO, i, o ) } ) Qt_Slots_Connect( ::pSlots, ::qProcess, "bytesWritten(int)" , {|o,i| ::readProcessInfo( CHN_BYT, i, o ) } ) Qt_Slots_Connect( ::pSlots, ::qProcess, "stateChanged(int)" , {|o,i| ::readProcessInfo( CHN_STT, i, o ) } ) Qt_Slots_Connect( ::pSlots, ::qProcess, "error(int)" , {|o,i| ::readProcessInfo( CHN_ERE, i, o ) } ) - Qt_Slots_Connect( ::pSlots, ::qProcess, "started()" , {|o,i| ::readProcessInfo( CHN_BGN, o, i ) } ) + Qt_Slots_Connect( ::pSlots, ::qProcess, "started()" , {|o,i| ::readProcessInfo( CHN_BGN, o, i ) } ) Qt_Slots_Connect( ::pSlots, ::qProcess, "readyReadStandardOutput()", {|o,i| ::readProcessInfo( CHN_OUT, i, o ) } ) Qt_Slots_Connect( ::pSlots, ::qProcess, "readyReadStandardError()" , {|o,i| ::readProcessInfo( CHN_ERR, i, o ) } ) Qt_Slots_Connect( ::pSlots, ::qProcess, "finished(int,int)" , {|o,i,ii| ::readProcessInfo( CHN_FIN, i, ii, o ) } ) - ::oOutputResult:oWidget:clear() ::oOutputResult:oWidget:append( cTmp ) ::nStarted := seconds() + #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. */ + /* If I am not wrong, HBMK2 can have these variables alread set */ + /* and hence developer can choose any compiler of his choice. */ + /* */ + /* Actually, this was the intension in hbIDE.env I commited in IDE root */ + qListSets := QStringList():new() + qListSets:append( "HB_WITH_QT=c:\qt\4.5.3\lib" ) + ::qProcess:setEnvironment( qListSets ) + #endif + ::qProcess:start( "hbmk2", qStringList ) ELSE @@ -789,7 +810,7 @@ METHOD IdeProjManager:readProcessInfo( nMode, i, ii ) nSize := 16384 DO CASE - CASE nMode == CHN_BGN + CASE nMode == CHN_REA // ReadReady() CASE nMode == CHN_OUT ::qProcess:setReadChannel( 0 ) @@ -823,6 +844,9 @@ METHOD IdeProjManager:readProcessInfo( nMode, i, ii ) ::qProcess:pPtr := 0 ::qProcess := NIL + IF ::lLaunch + ::launchProject( ::cProjectInProcess ) + ENDIF ENDCASE RETURN nil @@ -833,25 +857,20 @@ METHOD IdeProjManager:readProcessInfo( nMode, i, ii ) * 03/01/2010 - 09:24:50 */ METHOD IdeProjManager:LaunchProject( cProject ) - LOCAL qProcess - LOCAL cTargetFN - LOCAL cTmp, aPrj, n + LOCAL qProcess, cTargetFN, cTmp, aPrj, n IF empty( cProject ) cProject := ::oPM:getCurrentProject() ENDIF - IF empty( cProject ) RETURN Self ENDIF - n := ascan( ::aProjects, {|e_, x| x := e_[ 3 ], x[ 1,2,PRJ_PRP_TITLE ] == cProject } ) + n := ascan( ::aProjects, {|e_, x| x := e_[ 3 ], x[ 1, 2, PRJ_PRP_TITLE ] == cProject } ) aPrj := ::aProjects[ n,3 ] cTargetFN := aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_LOCATION ] + ::pathSep + aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_OUTPUT ] - cTargetFN := StrTran( cTargetFN, '/', ::pathSep ) - cTargetFN := StrTran( cTargetFN, '\', ::pathSep ) - + cTargetFN := hbide_pathToOSPath( cTargetFN ) #ifdef __PLATFORM__WINDOWS IF aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Executable" cTargetFN += '.exe' @@ -869,8 +888,10 @@ METHOD IdeProjManager:LaunchProject( cProject ) qProcess:waitForStarted() qProcess:pPtr := 0 qProcess := NIL + ELSE cTmp := "Launch application " + cTargetFN + "... (not applicable)" + ENDIF ::oOutputResult:oWidget:append( cTmp ) diff --git a/harbour/contrib/hbide/idesaveload.prg b/harbour/contrib/hbide/idesaveload.prg index 4035d52f19..a4f77e4fce 100644 --- a/harbour/contrib/hbide/idesaveload.prg +++ b/harbour/contrib/hbide/idesaveload.prg @@ -112,10 +112,10 @@ FUNCTION hbide_saveINI( oIde ) qVScr := QScrollBar():configure( oEdit:qEdit:verticalScrollBar() ) qCursor := QTextCursor():configure( oEdit:qEdit:textCursor() ) - aadd( txt_, oIde:aTabs[ nTab, TAB_SOURCEFILE ] + "," + ; - hb_ntos( qCursor:position() ) + "," + ; - hb_ntos( qHScr:value() ) + "," + ; - hb_ntos( qVScr:value() ) + "," + ; + aadd( txt_, oEdit:sourceFile + "," + ; + hb_ntos( iif( oEdit:lLoaded, qCursor:position(), oEdit:nPos ) )+ "," + ; + hb_ntos( iif( oEdit:lLoaded, qHScr:value(), oEdit:nHPos ) ) + "," + ; + hb_ntos( iif( oEdit:lLoaded, qVScr:value(), oEdit:nVPos ) ) + "," + ; oEdit:cTheme + "," ) ENDIF NEXT diff --git a/harbour/contrib/hbide/idestylesheets.prg b/harbour/contrib/hbide/idestylesheets.prg index 59ebf8dc77..940f5d3977 100644 --- a/harbour/contrib/hbide/idestylesheets.prg +++ b/harbour/contrib/hbide/idestylesheets.prg @@ -159,6 +159,30 @@ FUNCTION GetStyleSheet( cWidget ) aadd( txt_, ' /*spacing: 3px; spacing between items in the tool bar */ ' ) aadd( txt_, ' } ' ) + CASE cWidget == "QTreeWidgetHB" + + aadd( txt_, ' QTreeWidget { ' ) + aadd( txt_, ' alternate-background-color: yellow; ' ) + aadd( txt_, ' } ' ) + aadd( txt_, ' QTreeWidget { ' ) + aadd( txt_, ' show-decoration-selected: 1; ' ) + aadd( txt_, ' } ' ) + aadd( txt_, ' QTreeWidget::item:alternate { ' ) + aadd( txt_, ' background: #EEEEEE; ' ) + aadd( txt_, ' } ' ) + aadd( txt_, ' QTreeWidget::item:selected { ' ) + aadd( txt_, ' border: 1px solid #6a6ea9; ' ) + aadd( txt_, ' } ' ) + aadd( txt_, ' QTreeWidget::item:selected:!active { ' ) + aadd( txt_, ' background: rgba( 255, 127, 127, 255 ); ' ) + aadd( txt_, ' } ' ) + aadd( txt_, ' QTreeWidget::item:selected:active { ' ) + aadd( txt_, ' background: rgba( 127,127,255, 255 ); ' ) + aadd( txt_, ' } ' ) + aadd( txt_, ' QTreeWidget::item:hover { ' ) + aadd( txt_, ' background: rgba( 210,201,210,255 ); ' ) + aadd( txt_, '} ' ) + CASE cWidget == "QTreeWidget" aadd( txt_, ' QTreeWidget { ' ) diff --git a/harbour/contrib/hbide/projects/hbide.hbi b/harbour/contrib/hbide/projects/hbide.hbi index dfcffa7a26..d4f77f062c 100644 --- a/harbour/contrib/hbide/projects/hbide.hbi +++ b/harbour/contrib/hbide/projects/hbide.hbi @@ -1,21 +1,20 @@ [ PROPERTIES ] Type = Executable Title = Harbour-Qt IDE -Location = projects -WorkingFolder = projects -DestinationFolder = projects +Location = E:/harbour/contrib/hbide/projects +WorkingFolder = E:/harbour/contrib/hbide/projects +DestinationFolder = E:/harbour/contrib/hbide/projects Output = hbide -LaunchParams = -LaunchProgram = - +LaunchParams = +LaunchProgram = + [ FLAGS ] ../../hbxbp/hbxbp.hbc -inc -w3 -es2 --oprojects\hbides -workdir=projects/${hb_plat}/${hb_comp}/hbide - + [ SOURCES ] # hbide.prg @@ -36,7 +35,8 @@ LaunchProgram = # hbide.ch hbide.ini - + [ METADATA ] # IdeSrc = hb_dirBase() + diff --git a/harbour/contrib/hbide/resources/projectproperties.ui b/harbour/contrib/hbide/resources/projectproperties.ui index 25487f251f..3a6a805eb9 100644 --- a/harbour/contrib/hbide/resources/projectproperties.ui +++ b/harbour/contrib/hbide/resources/projectproperties.ui @@ -315,7 +315,7 @@ p, li { white-space: pre-wrap; } <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Compiler/Linker flags may include all commands except the source files list. Additional libraries can be included here.</span></p></body></html> - background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(158, 158, 158, 255), stop:1 rgba(255, 255, 255, 255)); + QPlainTextEdit::NoWrap @@ -448,7 +448,7 @@ p, li { white-space: pre-wrap; } <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Only .prg .c .cpp .rc .res files will be supplied to the HBMK2. All other files will be made visible for editing in &lt;Project Tree&gt;.</p></body></html> - background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(214, 219, 198, 255), stop:1 rgba(255, 255, 255, 255)); + QPlainTextEdit::NoWrap @@ -478,7 +478,7 @@ p, li { white-space: pre-wrap; } <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The expression is evaluated only once and keeps its value until the HBIDE interface is closed. In case of any error, the expression string itself is returned.</p></body></html> - background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 206, 170, 255), stop:1 rgba(255, 255, 255, 255)); + QPlainTextEdit::NoWrap @@ -543,7 +543,7 @@ p, li { white-space: pre-wrap; } <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600; text-decoration: underline;">Enjoy</span></p></body></html> - background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(191, 234, 255, 255), stop:1 rgba(255, 255, 255, 255)); + QPlainTextEdit::NoWrap @@ -578,7 +578,7 @@ p, li { white-space: pre-wrap; } <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">This opens up the possibility to experiment with different compilers without re-opening the IDE or setting up the envvars manually.</span></p></body></html> - background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 191, 255), stop:1 rgba(255, 255, 255, 255)); + QPlainTextEdit::NoWrap