diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 10a10bb1f3..9445774b85 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,56 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-04 01:58 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/hbide.hbp + * contrib/hbide/hbide.prg + * contrib/hbide/ideactions.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/idefindreplace.prg + * contrib/hbide/idemisc.prg + * contrib/hbide/ideobject.prg + * contrib/hbide/ideprojmanager.prg + * contrib/hbide/idesaveload.prg + * contrib/hbide/idethemes.prg + * contrib/hbide/projects/hbide.hbi + + + contrib/hbide/resources/insert-datetime.png + + contrib/hbide/resources/insert-external-file.png + + contrib/hbide/resources/insert-procname.png + + contrib/hbide/resources/readonly.png + * contrib/hbide/resources/tabreadonly.png + + * contrib/hbxbp/xbpqtuiloader.prg + + A lot of changes are in effect including the patch + sent by Vailton. The code is in the middle of restructing + phase and may take several days to finish. Till the I request + you all to bear with me and may expect some bumps too. + Please do not update this code until I finish preliminaries. + + To sumup this commit includes: + ! Thourough reclassification of classes and separation of + code fragments in a way that not two developers collide + with each other. One may takeup one segment and the other another. + + + Used hbide_* namespace and have changed almost every function. + + + Implemented, though not in a way I wanted, building a project + via Qt's process classes. You will see a refreshing difference. + + + A major breakthrough in XbpQtUiLoader() class implementation. + Now you can access the child widgets of a .ui component per + this syntax: + oUI:qObj[ "checkMatchCase" ]:setChecked( .t. ) + => + oUI:q_checkMatchCase:seChecked( .t. ) + ^^ + just prefix object name with "q_" ( Q + Underscore ). + This greatly simmplifies coding and allows to exploit child + widgets as real-time objects. + + 2010-01-03 21:19 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/hbqt_hbevents.cpp * contrib/hbqt/hbqt_hbslots.cpp diff --git a/harbour/contrib/hbide/hbide.ch b/harbour/contrib/hbide/hbide.ch index 23d601a262..2ad4b8a48e 100644 --- a/harbour/contrib/hbide/hbide.ch +++ b/harbour/contrib/hbide/hbide.ch @@ -139,5 +139,11 @@ #define TAB_QDOCUMENT 6 #define TAB_OEDITOR 7 +#define TRE_OITEM 1 +#define TRE_TYPE 2 // Path | Source File | Project | Opened File +#define TRE_OPARENT 3 +#define TRE_ORIGINAL 4 +#define TRE_DATA 5 + #endif diff --git a/harbour/contrib/hbide/hbide.hbp b/harbour/contrib/hbide/hbide.hbp index 475fb9755d..ad65c42b72 100644 --- a/harbour/contrib/hbide/hbide.hbp +++ b/harbour/contrib/hbide/hbide.hbp @@ -15,6 +15,7 @@ -ldflag={msvc}-defaultlib:libcmt.lib hbide.prg +ideobject.prg idestylesheets.prg idetags.prg idemisc.prg @@ -25,5 +26,6 @@ idedocks.prg idesaveload.prg iderequests.prg idethemes.prg +ideprojmanager.prg ideparseexpr.c diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 9f1c35e9dc..2b515e29e2 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -91,6 +91,9 @@ STATIC s_pathSep PROCEDURE Main( cProjIni ) LOCAL oIde + SET CENTURY ON + SET EPOCH TO 1970 + HBQT_SET_RELEASE_METHOD( HBQT_RELEASE_WITH_DESTRUTOR ) // Exits cleanly //HBQT_SET_RELEASE_METHOD( HBQT_RELEASE_WITH_DELETE ) // Exits cleanly //HBQT_SET_RELEASE_METHOD( HBQT_RELEASE_WITH_DELETE_LATER ) // Exits cleanly @@ -107,8 +110,10 @@ PROCEDURE Main( cProjIni ) CLASS HbIde - ACCESS pSlots INLINE hbxbp_getSlotsPtr() - ACCESS pEvents INLINE hbxbp_GetEventsPtr() + ACCESS pSlots INLINE hbxbp_getSlotsPtr() + ACCESS pEvents INLINE hbxbp_getEventsPtr() + + DATA oPM DATA mp1, mp2, oXbp, nEvent DATA aTabs INIT {} @@ -172,6 +177,27 @@ CLASS HbIde DATA oOpenedSources DATA resPath INIT hb_DirBase() + "resources" + hb_OsPathSeparator() + DATA pathSep INIT hb_OsPathSeparator() + + DATA aTags INIT {} + DATA aText INIT {} + DATA aSources INIT {} + DATA aFuncList INIT {} + DATA aLines INIT {} + DATA aComments INIT {} + DATA aProjects INIT {} + DATA cWrkProject INIT '' + DATA oProps + DATA oFR + + DATA cProcessInfo + DATA qProcess + + DATA aEdits INIT {} + + DATA cIniThemes + DATA oThemes + METHOD new( cProjectOrSource ) METHOD create( cProjectOrSource ) @@ -200,63 +226,31 @@ CLASS HbIde METHOD updateFuncList() METHOD gotoFunction() - METHOD fetchProjectProperties() - METHOD loadProjectProperties() - METHOD appendProjectInTree() + + METHOD updateProjectMenu() + METHOD updateProjectTree() + METHOD manageItemSelected() - METHOD addSourceInTree() METHOD getCurrentTab() METHOD getCurCursor() - - DATA aTags INIT {} - DATA aText INIT {} - DATA aSources INIT {} - DATA aFuncList INIT {} - DATA aLines INIT {} - DATA aComments INIT {} - DATA aPrjProps INIT {} - DATA aProjects INIT {} - DATA cWrkProject INIT '' + METHOD addSourceInTree() METHOD createTags() - DATA oProps - DATA oFR - METHOD manageFocusInEditor() METHOD convertSelection() + METHOD insertText() METHOD printPreview() METHOD paintRequested() METHOD loadUI() - METHOD updateHbp() - METHOD saveProject() - METHOD addSourcesToProject() - /* Project Build and Launch Methods */ - DATA cProcessInfo - DATA qProcess - - METHOD setCurrentProject() - METHOD getCurrentProject() - - METHOD buildProject() - METHOD buildProjectViaQt() - METHOD readProcessInfo() - METHOD Help() METHOD goto() METHOD setCodec() - METHOD PromptForPath( cObjName, cTitle, cObjPath2, cObjPath3 ) - - DATA aEdits INIT {} - METHOD findEditByFileName() METHOD findEditByID() METHOD updateTitleBar() - DATA cIniThemes - DATA oThemes - ENDCLASS /*----------------------------------------------------------------------*/ @@ -280,37 +274,41 @@ METHOD HbIde:new( cProjIni ) /*----------------------------------------------------------------------*/ METHOD HbIde:create( cProjIni ) - //LOCAL qSet - + /* Setup GUI Error Reporting System*/ hbqt_errorsys() - LoadINI( Self, cProjIni ) + /* Initialte Project Manager */ + ::oPM := IdeProjManager():new( Self ):create() - ::BuildDialog() - ::oDa := ::oDlg:drawingArea - SetAppWindow( ::oDlg ) - ::oDlg:Show() + /* Load IDE Settings */ + hbide_loadINI( Self, cProjIni ) - /* Load HBIDE define | User Defined Themes */ - LoadThemes( Self ) + /* Build IDE's Main Window */ + ::BuildDialog() ; ::oDa := ::oDlg:drawingArea ; SetAppWindow( ::oDlg ) ; ::oDlg:Show() + /* Load IDE|User defined Themes */ + hbide_loadThemes( Self ) + + /* Prepare Editor's Tabs */ ::oDa:oTabWidget := XbpTabWidget():new():create( ::oDa, , {0,0}, {10,10}, , .t. ) - // ::oDa:oTabWidget:oWidget:setTabsClosable( .t. ) ::oDa:oTabWidget:oWidget:setUsesScrollButtons( .f. ) ::oTabWidget := ::oDa:oTabWidget ::qTabWidget := ::oDa:oTabWidget:oWidget + /* Setup DOCKing windows */ IdeDocks():new():create( Self ) + /* Attach GRID Layout to Editor Area - Futuristic */ ::qLayout := QGridLayout():new() ::qLayout:setContentsMargins( 0,0,0,0 ) ::qLayout:setHorizontalSpacing( 0 ) ::qLayout:setVerticalSpacing( 0 ) - + // ::oDa:oWidget:setLayout( ::qLayout ) - + // ::qLayout:addWidget_1( ::oDa:oTabWidget:oWidget, 0, 0, 1, 1 ) + /* Just to spare some GC calls */ ::qCursor := QTextCursor():new() /* Editor's Font */ @@ -318,34 +316,38 @@ METHOD HbIde:create( cProjIni ) ::oFont:fixed := .t. ::oFont:create( "10.Courier" ) + /* Build Main Menu */ buildMainMenu( ::oDlg, Self ) + + /* Setup Toolbar */ ::oTBar := buildToolBar( ::oDlg, Self ) + /* Setup Statusbar and Panels */ ::buildStatusBar() + /* Once create Find/Replace dialog */ ::oFR := IdeFindReplace():new():create( Self ) - #if 0 - qSet := QSettings():new( "Harbour", "HbIde" ) - HB_TRACE( HB_TR_ALWAYS, "QSettings", qSet:applicationName(), qSet:value( "state" ) ) - ::oDlg:oWidget:restoreState( QByteArray():configure( qSet:value( "state" ) ) ) - #endif - + /* Request Main Window to Appear on the Screen */ ::oDlg:Show() + /* Fill various elements of the IDE */ + ::oPM:populate() ::loadSources() + ::updateProjectMenu() + ::updateTitleBar() DO WHILE .t. ::nEvent := AppEvent( @::mp1, @::mp2, @::oXbp ) IF ::nEvent == xbeP_Quit HBXBP_DEBUG( "xbeP_Quit" ) - SaveINI( Self ) + hbide_saveINI( Self ) EXIT ENDIF IF ::nEvent == xbeP_Close - SaveINI( Self ) + hbide_saveINI( Self ) ::closeAllSources() EXIT @@ -361,9 +363,6 @@ METHOD HbIde:create( cProjIni ) CASE ::mp1 == xbeK_ESC ::closeSource() -// CASE ::mp1 == xbeK_CTRL_S -// ::saveSource( ::getCurrentTab(), .f. ) - CASE ::mp1 == xbeK_CTRL_G IF !empty( ::qCurEdit ) ::goto() @@ -381,10 +380,6 @@ METHOD HbIde:create( cProjIni ) IF !empty( ::qCurEdit ) ::oFR:replace() ENDIF - CASE ::mp1 == xbeK_TAB - IF !empty( ::qCurEdit ) - ::qCurEdit:insertText( " " ) - ENDIF ENDCASE ENDIF @@ -421,22 +416,24 @@ METHOD HbIde:executeAction( cKey ) CASE cKey == "Exit" PostAppEvent( xbeP_Close, NIL, NIL, ::oDlg ) CASE cKey == "NewProject" - ::loadProjectProperties( , .t., .t., .t. ) + ::oPM:loadProperties( , .t., .t., .t. ) CASE cKey == "LoadProject" - ::loadProjectProperties( , .f., .f., .t. ) + ::oPM:loadProperties( , .f., .f., .t. ) + CASE cKey == "LaunchProject" + ::oPM:launchProject() CASE cKey == "SaveBuild" - ::buildProject( '', .F., .F. ) + ::oPM:buildProject( '', .F., .F. ) CASE cKey == "SaveBuildLaunch" - ::buildProject( '', .T., .F. ) + ::oPM:buildProject( '', .T., .F. ) CASE cKey == "SaveRebuild" - ::buildProject( '', .F., .T. ) + ::oPM:buildProject( '', .F., .T. ) CASE cKey == "SaveRebuildLaunch" - ::buildProject( '', .T., .T. ) + ::oPM:buildProject( '', .T., .T. ) CASE cKey == "CompilePPO" - ::buildProject( '', .F., .F., .T. ) + ::oPM:buildProject( '', .F., .F., .T. ) CASE cKey == "Properties" @@ -444,28 +441,31 @@ METHOD HbIde:executeAction( cKey ) MsgBox( 'No active project detected!' ) End - Tmp := ::getCurrentProject() + Tmp := ::oPM:getCurrentProject() IF ( n := ascan( ::aProjects, {|e_| e_[ 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] == Tmp } ) ) > 0 aPrj := ::aProjects[ n, 3 ] cHbi := aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_LOCATION ] + s_pathSep + ; aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_OUTPUT ] + ".hbi" - ::loadProjectProperties( cHbi, .f., .t., .t. ) + ::oPM:loadProperties( cHbi, .f., .t., .t. ) ELSE MsgBox( 'Invalid project: ' + Tmp ) End + CASE cKey == "SelectProject" + ::oPM:selectCurrentProject() + CASE cKey == "CloseProject" + ::oPM:closeProject() + CASE cKey == "New" ::editSource( '' ) - CASE cKey == "Open" Tmp := ::selectSource( "openmany" ) IF !Empty( Tmp ) aEval( Tmp, {|f| ::editSource( f ) }) ENDIF - CASE cKey == "Save" ::saveSource( ::getCurrentTab() ) CASE cKey == "SaveAs" @@ -510,6 +510,12 @@ METHOD HbIde:executeAction( cKey ) IF !empty( ::qCurEdit ) ::qCurEdit:selectAll() ENDIF + + CASE cKey == "switchReadOnly" + IF !empty( ::qCurEdit ) + ::qCurEdit:setReadOnly( !::qCurEdit:isReadOnly() ) + ::oCurEditor:setTabImage() + ENDIF CASE cKey == "Find" IF !Empty( ::qCurEdit ) ::oFR:show() @@ -526,6 +532,12 @@ METHOD HbIde:executeAction( cKey ) ::convertSelection( cKey ) CASE cKey == "Invert" ::convertSelection( cKey ) + CASE cKey == "InsertDateTime" + ::insertText( cKey ) + CASE cKey == "InsertRandomName" + ::insertText( cKey ) + CASE cKey == "InsertExternalFile" + ::insertText( cKey ) CASE cKey == "ZoomIn" IF !empty( ::qCurEdit ) //::qCurEdit:zoomIn() @@ -614,6 +626,73 @@ METHOD HbIde:convertSelection( cKey ) /*----------------------------------------------------------------------*/ +METHOD HbIde:insertText( cKey ) + LOCAL b, c, t, n + LOCAL nB, nL + + IF Empty( ::qCurEdit ) + RETURN Self + ENDIF + + ::qCursor := QTextCursor():configure( ::qCurEdit:textCursor() ) + + DO CASE + CASE cKey == "InsertDateTime" + b := DTOC( Date() ) + ' - ' + Time() + CASE cKey == "InsertRandomName" + + b := '' + t := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' + + WHILE Len(b) <> 10 + c := Subst( t, HB_RANDOMINT( 1, Len(t) ), 1 ) + + IF !( c $ b ) + IF Empty(b) .AND. IsDigit(c) + LOOP + ENDIF + b += c + ENDIF + End + + b += '(' + + CASE cKey == "InsertExternalFile" + + n := ::selectSource( "open" ) + + IF Empty(n) .OR. !File( n ) + RETURN Self + ENDIF + + msgbox(n) + + IF !( hbide_isValidText( n ) ) + MsgBox( 'File type unknown or unsupported: ' + n ) + RETURN Self + ENDIF + + b := hb_memoread( n ) + + OTHERWISE + RETURN Self + ENDCASE + + IF !Empty( b ) + nL := len( b ) + nB := ::qCursor:position() + nL + + ::qCursor:beginEditBlock() + ::qCursor:removeSelectedText() + ::qCursor:insertText( b ) + ::qCursor:setPosition( nB ) + ::qCursor:endEditBlock() + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD HbIde:setPosAndSizeByIni( qWidget, nPart ) LOCAL aRect @@ -669,12 +748,12 @@ METHOD HbIde:getCurCursor() METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme ) LOCAL n - IF !Empty( cSourceFile ) .AND. !( IsValidText( cSourceFile ) ) + IF !Empty( cSourceFile ) .AND. !( hbide_isValidText( cSourceFile ) ) MsgBox( 'File type unknown or unsupported: ' + cSourceFile ) RETURN Self ENDIF - IF !Empty( cSourceFile ) .AND. !hb_FileExists( cSourceFile ) + IF !Empty( cSourceFile ) .AND. !File( cSourceFile ) MsgBox( 'File not found: ' + cSourceFile ) RETURN Self ENDIF @@ -688,7 +767,7 @@ METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme ) IF Empty( cSourceFile ) n := 0 ELSE - n := aScan( ::aTabs, {|a_| PathNormalized( a_[ TAB_SOURCEFILE ] ) == PathNormalized( cSourceFile ) } ) + n := aScan( ::aTabs, {|a_| hbide_pathNormalized( a_[ TAB_SOURCEFILE ] ) == hbide_pathNormalized( cSourceFile ) } ) End IF n > 0 @@ -699,7 +778,7 @@ METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme ) aadd( ::aEdits, IdeEditor():new():create( Self, cSourceFile, nPos, nHPos, nVPos, cTheme ) ) IF !Empty( cSourceFile ) - mnuAddFileToMRU( Self, cSourceFile, INI_RECENTFILES ) + hbide_mnuAddFileToMRU( Self, cSourceFile, INI_RECENTFILES ) ENDIF RETURN Self @@ -738,10 +817,9 @@ METHOD HbIde:closeSource( nTab, lCanCancel, lCanceled ) IF !::aTabs[ nTab, TAB_QDOCUMENT ]:isModified() * File has not changed, ignore the question to User - lSave := .f. - + lSave := .F. ELSEIF lCanCancel - n := GetYesNoCancel( ::aTabs[ nTab, TAB_OTAB ]:Caption, ; + n := hbide_getYesNoCancel( ::aTabs[ nTab, TAB_OTAB ]:Caption, ; "Has been modified, save this source?", 'Save?' ) lCanceled := ( n == QMessageBox_Cancel ) @@ -751,7 +829,7 @@ METHOD HbIde:closeSource( nTab, lCanCancel, lCanceled ) RETURN .F. End ELSE - IF !GetYesNo( ::aTabs[ nTab, TAB_OTAB ]:Caption, ; + IF !hbide_getYesNo( ::aTabs[ nTab, TAB_OTAB ]:Caption, ; "Has been modified, save this source?", 'Save?' ) lSave := .F. ENDIF @@ -777,6 +855,7 @@ METHOD HbIde:closeAllSources() * Finally now we will close all tabs. DO WHILE ( ++i <= Len( ::aTabs ) ) + IF ::closeSource( i, .T., @lCanceled ) i -- Loop @@ -869,7 +948,7 @@ METHOD HbIde:revertSource( nTab ) IF !::aTabs[ nTab, TAB_QDOCUMENT ]:isModified() * File has not changed, ignore the question to User ELSE - IF !GetYesNo( 'Revert ' + ::aTabs[ nTab, TAB_OTAB ]:Caption + '?', ; + IF !hbide_getYesNo( 'Revert ' + ::aTabs[ nTab, TAB_OTAB ]:Caption + '?', ; 'The file ' + ::aTabs[ nTab, TAB_SOURCEFILE ] + ' has changed. '+; 'Discard current changes and revert contents to the previously saved on disk?', 'Revert file?' ) RETURN Self @@ -910,7 +989,7 @@ METHOD HbIde:saveSourceAs( nTab, lCancel ) End IF ::saveSource( nTab, cSource, @lCancel ) - mnuAddFileToMRU( Self, cSource, INI_RECENTFILES ) + hbide_mnuAddFileToMRU( Self, cSource, INI_RECENTFILES ) RETURN .T. ENDIF @@ -1050,48 +1129,139 @@ METHOD HbIde:getCurrentTab() /*----------------------------------------------------------------------*/ -METHOD HbIde:appendProjectInTree( aPrj ) +METHOD HbIde:updateProjectTree( aPrj, lRemove ) LOCAL cType, oParent, oP, aSrc, j, cProject, nPath - LOCAL aPath, cPath, cFile, cExt, oPP, cPathA + LOCAL aPath, aInUse, cPath, cFile, cExt, oPP, cPathA, nPos - IF !empty( aPrj ) .and. !empty( cProject := aPrj[ PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] ) - IF ascan( ::aProjData, {|e_| e_[ 2 ] == "Project Name" .and. e_[ 4 ] == cProject } ) == 0 + DEFAULT lRemove TO .F. - cType := aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] + IF Empty( aPrj ) + RETURN Self + ENDIF - DO CASE - CASE cType == "Executable" - oParent := ::aProjData[ 1, 1 ] - CASE cType == "Lib" - oParent := ::aProjData[ 2, 1 ] - CASE cType == "Dll" - oParent := ::aProjData[ 3, 1 ] - ENDCASE + cProject := aPrj[ PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] + IF Empty( cProject ) + RETURN Self + ENDIF + + nPos := aScan( ::aProjData, {|e_| e_[ 2 ] == "Project Name" .and. e_[ 4 ] == cProject } ) + cType := aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] + + DO CASE + CASE cType == "Executable" + oParent := ::aProjData[ 1, 1 ] + CASE cType == "Lib" + oParent := ::aProjData[ 2, 1 ] + CASE cType == "Dll" + oParent := ::aProjData[ 3, 1 ] + ENDCASE + + IF !( lRemove ) + + * It is a new node? + IF nPos == 0 oParent:expand( .t. ) oP := oParent:addItem( cProject ) aadd( ::aProjData, { oP, "Project Name", oParent, cProject, aPrj } ) oParent := oP - aPath := {} - aSrc := aPrj[ PRJ_PRP_SOURCES, 2 ] - FOR j := 1 TO len( aSrc ) - hb_fNameSplit( aSrc[ j ], @cPath, @cFile, @cExt ) - cPathA := strtran( cPath, "\", "/" ) - IF ( nPath := ascan( aPath, {|e_| e_[ 1 ] == cPathA } ) ) == 0 - oPP := oParent:addItem( cPath ) - aadd( ::aProjData, { oPP, "Path", oParent, cPathA, cProject } ) - aadd( aPath, { cPathA, oPP } ) - nPath := len( aPath ) - ENDIF - - oPP := aPath[ nPath,2 ] - aadd( ::aProjData, { oPP:addItem( cFile+cExt ), "Source File", oPP, aSrc[ j ], PathNormalized( aSrc[ j ] ) } ) - NEXT + * Need to be an update? ELSE - // Handle duplicate opening + nPos := aScan( oParent:aChilds, {|o| o:caption == cProject } ) + IF nPos <> 00 + oParent := oParent:aChilds[ nPos ] + ENDIF + ENDIF + + aSrc := aClone( aPrj[ PRJ_PRP_SOURCES, 2 ] ) + aSrc := ASort( aSrc ) + aPath := {} + aInUse:= {} + + * Load previous aPath used to fill ::aProjData + * 03/01/2010 - 16:08:25 - vailtom + FOR j := 1 TO LEN( ::aProjData ) + IF !hb_isChar( ::aProjData[ j, 5 ] ).OR. ; // It is not a char? + ::aProjData[ j, 2 ] != 'Path' .OR. ; // Is not an path? + ::aProjData[ j, 5 ] != cProject // Is not from same project? + LOOP + ENDIF + AAdd( aPath, { ::aProjData[ j, 4 ], ::aProjData[ j, 1 ]} ) + NEXT + + * Add new nodes with file names to tree... + FOR j := 1 TO len( aSrc ) + hb_fNameSplit( aSrc[ j ], @cPath, @cFile, @cExt ) + + cPathA := hbide_pathNormalized( cPath, .T. ) + nPath := aScan( aPath, {|e_| e_[ 1 ] == cPathA } ) + + AAdd( aInUse, cPathA ) + + * Find an node with Caption == cPathA + IF ( nPath == 0 ) + oPP := oParent:addItem( hbide_pathNormalized( cPath, .f. ) ) + aadd( ::aProjData, { oPP, "Path", oParent, cPathA, cProject } ) + aadd( aPath, { cPathA, oPP } ) + nPath := len( aPath ) + ENDIF + + oPP := aPath[ nPath,2 ] + cFile := cFile + cExt + nPos := aScan( ::aProjData, {|e_| e_[ 2 ] == "Source File" .AND. ; + e_[ 4 ] == aSrc[ j ] } ) + IF nPos == 00 + aadd( ::aProjData, { oPP:addItem( cFile ), "Source File", oPP, aSrc[ j ], cProject } ) + ENDIF + NEXT + + * Remove deleted nodes from tree + FOR j := 1 TO LEN( ::aProjData ) + + * Is not from same project? + IF !hb_isChar( ::aProjData[ j, 5 ] ) .OR. ; + ::aProjData[ j, 5 ] != cProject + LOOP + ENDIF + + * It is a path? + IF ::aProjData[ j, 2 ] == 'Path' + cPathA := ::aProjData[ j, 4 ] + nPath := aScan( aInUse, {|e_| e_ == cPathA } ) + + IF nPath == 00 + ::aProjData[ j, 3 ]:delItem( ::aProjData[ j, 1 ] ) + hb_aDel( ::aProjData, j, .T. ) + ENDIF + + LOOP + ENDIF + + * It is a filename? + IF ::aProjData[ j, 2 ] == 'Source File' + cFile := ::aProjData[ j, 4 ] + nPos := aScan( aSrc, {|e_| e_ == cFile } ) + + IF nPos == 00 + ::aProjData[ j, 3 ]:delItem( ::aProjData[ j, 1 ] ) + hb_aDel( ::aProjData, j, .T. ) + ENDIF + + LOOP + ENDIF + NEXT + + ELSE + + IF nPos != 0 + nPos := aScan( oParent:aChilds, {|e_| e_:Caption == cProject } ) + + IF nPos > 0 + oParent:delItem( oParent:aChilds[ nPos ] ) + ENDIF ENDIF ENDIF @@ -1103,12 +1273,12 @@ METHOD HbIde:addSourceInTree( cSourceFile ) LOCAL cPath, cPathA, cFile, cExt, n, oParent LOCAL oGrand := ::oOpenedSources - IF Empty(cSourceFile) + IF Empty( cSourceFile ) RETURN nil End hb_fNameSplit( cSourceFile, @cPath, @cFile, @cExt ) - cPathA := PathNormalized( cPath ) + cPathA := hbide_pathNormalized( cPath ) n := ascan( ::aEditorPath, {|e_| e_[ 2 ] == cPathA } ) @@ -1121,7 +1291,7 @@ METHOD HbIde:addSourceInTree( cSourceFile ) ENDIF aadd( ::aProjData, { oParent:addItem( cFile+cExt ), "Opened Source", oParent, ; - cSourceFile, PathNormalized( cSourceFile ) } ) + cSourceFile, hbide_pathNormalized( cSourceFile ) } ) RETURN Self /*----------------------------------------------------------------------*/ @@ -1137,36 +1307,33 @@ METHOD HbIde:manageItemSelected( oXbpTreeItem ) n := ascan( ::aProjData, {|e_| e_[ 1 ] == oXbpTreeItem } ) ENDIF - ::aPrjProps := {} - DO CASE - CASE n == 0 // Source File - nothing to do CASE n == -2 // "Files" CASE n == -1 - CASE ::aProjData[ n, 2 ] == "Project Name" + CASE ::aProjData[ n, TRE_TYPE ] == "Project Name" aPrj := ::aProjData[ n, 5 ] cHbi := aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_LOCATION ] + s_pathSep + ; aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_OUTPUT ] + ".hbi" - ::loadProjectProperties( cHbi, .f., .t., .f. ) + ::oPM:loadProperties( cHbi, .f., .t., .f. ) - CASE ::aProjData[ n, 2 ] == "Source File" - cSource := ::aProjData[ n, 5 ] - IF ( n := ascan( ::aTabs, {|e_| PathNormalized( e_[ 5 ] ) == cSource } ) ) == 0 + CASE ::aProjData[ n, TRE_TYPE ] == "Source File" + cSource := ::aProjData[ n, TRE_ORIGINAL ] + IF ( n := ascan( ::aTabs, {|e_| hbide_pathNormalized( e_[ TAB_SOURCEFILE ] ) == hbide_pathNormalized( cSource ) } ) ) == 0 ::editSource( cSource ) ELSE ::qTabWidget:setCurrentIndex( ::qTabWidget:indexOf( ::aTabs[ n, TAB_OTAB ]:oWidget ) ) ENDIF - CASE ::aProjData[ n, 2 ] == "Opened Source" - cSource := ::aProjData[ n, 5 ] - IF ( n := ascan( ::aTabs, {|e_| PathNormalized( e_[ 5 ] ) == cSource } ) ) > 0 + CASE ::aProjData[ n, TRE_TYPE ] == "Opened Source" + cSource := ::aProjData[ n, TRE_DATA ] + IF ( n := ascan( ::aTabs, {|e_| hbide_pathNormalized( e_[ TAB_SOURCEFILE ] ) == hbide_pathNormalized( cSource ) } ) ) > 0 ::qTabWidget:setCurrentIndex( ::qTabWidget:indexOf( ::aTabs[ n, TAB_OTAB ]:oWidget ) ) ENDIF - CASE ::aProjData[ n, 2 ] == "Path" + CASE ::aProjData[ n, TRE_TYPE ] == "Path" ENDCASE @@ -1181,8 +1348,6 @@ METHOD HbIde:manageProjectContext( mp1, mp2, oXbpTreeItem ) HB_SYMBOL_UNUSED( mp2 ) - ::aPrjProps := {} - oXbpTreeItem := ::oCurProjItem IF oXbpTreeItem == ::oProjRoot @@ -1197,10 +1362,10 @@ METHOD HbIde:manageProjectContext( mp1, mp2, oXbpTreeItem ) CASE n == 0 // Source File - nothing to do CASE n == -2 // "Files" CASE n == -1 // Project Root - aadd( aPops, { "New Project" , {|| ::loadProjectProperties( , .t., .t., .t. ) } } ) + aadd( aPops, { "New Project" , {|| ::oPM:loadProperties( , .t., .t., .t. ) } } ) aadd( aPops, { "" } ) - aadd( aPops, { "Load Project", {|| ::loadProjectProperties( , .f., .f., .t. ) } } ) - ExecPopup( aPops, mp1, ::oProjTree:oWidget ) + 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 ] @@ -1208,38 +1373,40 @@ METHOD HbIde:manageProjectContext( mp1, mp2, oXbpTreeItem ) aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_OUTPUT ] + ".hbi" // IF Alltrim( Upper( ::cWrkProject )) != Alltrim( Upper( oXbpTreeItem:caption )) - aadd( aPops, { "Set as Current" , {|| ::setCurrentProject( oXbpTreeItem:caption ) } } ) + aadd( aPops, { "Set as Current" , {|| ::oPM:setCurrentProject( oXbpTreeItem:caption ) } } ) End - aadd( aPops, { "Properties" , {|| ::loadProjectProperties( cHbi, .f., .t., .t. ) } } ) + aadd( aPops, { "Properties" , {|| ::oPM:loadProperties( cHbi, .f., .t., .t. ) } } ) aadd( aPops, { "" } ) - aadd( aPops, { "Save and Build" , {|| ::buildProject( oXbpTreeItem:caption, .F. ) } } ) - aadd( aPops, { "Save and Build (Qt)" , {|| ::buildProjectViaQt( oXbpTreeItem:caption ) } } ) - aadd( aPops, { "Save, Build and Launch" , {|| ::buildProject( oXbpTreeItem:caption, .T. ) } } ) + aadd( aPops, { "Save and Build" , {|| ::oPM:buildProject( oXbpTreeItem:caption, .F. ) } } ) + aadd( aPops, { "Save and Build (Qt)" , {|| ::oPM:buildProjectViaQt( oXbpTreeItem:caption ) } } ) + aadd( aPops, { "Save, Build and Launch" , {|| ::oPM:buildProject( oXbpTreeItem:caption, .T. ) } } ) aadd( aPops, { "" } ) - aadd( aPops, { "Save and Re-Build" , {|| ::buildProject( oXbpTreeItem:caption, .F., .T. ) } } ) - aadd( aPops, { "Save, Re-Build and Launch", {|| ::buildProject( oXbpTreeItem:caption, .T., .T. ) } } ) + aadd( aPops, { "Save and Re-Build" , {|| ::oPM:buildProject( oXbpTreeItem:caption, .F., .T. ) } } ) + aadd( aPops, { "Save, Re-Build and Launch", {|| ::oPM:buildProject( oXbpTreeItem:caption, .T., .T. ) } } ) aadd( aPops, { "" } ) - aadd( aPops, { "CloseDrop Project ", {|| NIL } } ) + aadd( aPops, { "Launch" , {|| ::oPM:launchProject( oXbpTreeItem:caption ) } } ) + aadd( aPops, { "" } ) + aadd( aPops, { "Close This Project" , {|| ::oPM:closeProject( oXbpTreeItem:caption ) } } ) // - ExecPopup( aPops, mp1, ::oProjTree:oWidget ) + hbide_ExecPopup( aPops, mp1, ::oProjTree:oWidget ) CASE ::aProjData[ n, 2 ] == "Source File" // CASE ::aProjData[ n, 2 ] == "Opened Source" cSource := ::aProjData[ n, 5 ] - n := ascan( ::aTabs, {|e_| PathNormalized( e_[ 5 ] ) == cSource } ) + n := ascan( ::aTabs, {|e_| hbide_pathNormalized( e_[ 5 ] ) == cSource } ) // - aadd( aPops, { "~Save" , {|| ::saveSource( n ) } } ) - aadd( aPops, { "Save ~As" , {|| ::saveSourceAs( n ) } } ) + aadd( aPops, { "Save" , {|| ::saveSource( n ) } } ) + aadd( aPops, { "Save As" , {|| ::saveSourceAs( n ) } } ) aadd( aPops, { "" } ) - aadd( aPops, { "~Close" , {|| ::closeSource( n ) } } ) - aadd( aPops, { "Close ~Others" , {|| ::closeAllOthers( n ) } } ) + aadd( aPops, { "Close" , {|| ::closeSource( n ) } } ) + aadd( aPops, { "Close Others" , {|| ::closeAllOthers( n ) } } ) aadd( aPops, { "" } ) aadd( aPops, { "Apply Theme", {|| ::aTabs[ n, TAB_OEDITOR ]:applyTheme() } } ) // - ExecPopup( aPops, mp1, ::oProjTree:oWidget ) + hbide_ExecPopup( aPops, mp1, ::oProjTree:oWidget ) CASE ::aProjData[ n, 2 ] == "Path" @@ -1351,7 +1518,7 @@ METHOD HbIde:manageFuncContext( mp1 ) aadd( aPops, { 'Delete' , {|| NIL } } ) aadd( aPops, { 'Move to another source', {|| NIL } } ) - ExecPopup( aPops, mp1, ::oFuncList:oWidget ) + hbide_ExecPopup( aPops, mp1, ::oFuncList:oWidget ) ::manageFocusInEditor() ENDIF @@ -1369,7 +1536,7 @@ METHOD HbIde:CreateTags() HB_FNameSplit( ::aSources[ i ], @cPath, @cSource, @cExt ) IF Upper( cExt ) $ ".PRG.CPP" - IF !empty( ::aText := ReadSource( ::aSources[ i ] ) ) + IF !empty( ::aText := hbide_readSource( ::aSources[ i ] ) ) aSumData := {} cComments := CheckComments( ::aText ) @@ -1417,14 +1584,12 @@ METHOD HbIde:paintRequested( pPrinter ) RETURN Self /*----------------------------------------------------------------------*/ -// Menu and Toolbar Actions -/*----------------------------------------------------------------------*/ METHOD HbIde:loadUI( cUi ) LOCAL cUiFull := s_resPath + cUi + ".ui" LOCAL qDialog, qUiLoader, qFile - IF hb_FileExists( cUiFull ) + IF file( cUiFull ) qFile := QFile():new( cUiFull ) IF qFile:open( 1 ) qUiLoader := QUiLoader():new() @@ -1436,312 +1601,26 @@ METHOD HbIde:loadUI( cUi ) RETURN qDialog /*----------------------------------------------------------------------*/ -// Project Properties -/*----------------------------------------------------------------------*/ - /* - * Create an empty project or loading an existing from cFileName + * Update the project menu to show current info. + * 03/01/2010 - 12:48:18 - vailtom */ -METHOD HbIde:loadProjectProperties( cProject, lNew, lFetch, lUpdateTree ) - LOCAL cWrkProject - LOCAL n := 0 - LOCAL t +METHOD HbIde:updateProjectMenu() - DEFAULT cProject TO "" - DEFAULT lNew TO .F. - DEFAULT lFetch TO .T. - DEFAULT lUpdateTree TO .F. + LOCAL oItem := hbide_mnuFindItem( Self, 'Project' ) - ::aPrjProps := {} - - cProject := StrTran( cProject, '\', '/' ) - - IF lNew - lFetch := .t. + IF Empty( oItem ) + RETURN Self ENDIF - IF !( lNew ) - IF empty( cProject ) - cProject := fetchAFile( ::oDlg, "Load Project...", { { "Harbour IDE Projects (*.hbi)", "*.hbi" } } ) - ENDIF - IF empty( cProject ) - RETURN Self - ENDIF - ENDIF - - IF !empty( cProject ) - cWrkProject := PathNormalized( cProject ) // normalized - - n := ascan( ::aProjects, {|e_| PathNormalized( e_[ 1 ] ) == cWrkProject } ) - - IF n > 0 - ::aPrjProps := ::aProjects[ n, 3 ] - t := ::aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] - ENDIF - - IF empty( ::aPrjProps ) - ::aPrjProps := fetchHbiStructFromFile( cProject ) - ENDIF - ENDIF - - IF lFetch - ::cSaveTo := "" - ::fetchProjectProperties() - IF !empty( ::cSaveTo ) .and. hb_FileExists( ::cSaveTo ) - cProject := ::cSaveTo - /* Reload from file */ - ::aPrjProps := fetchHbiStructFromFile( cProject ) - ENDIF - ENDIF - - IF n == 0 - aadd( ::aProjects, { lower( cProject ), cProject, aclone( ::aPrjProps ) } ) - - IF lUpdateTree - ::appendProjectInTree( ::aPrjProps ) - End - - mnuAddFileToMRU( Self, cProject, INI_RECENTPROJECTS ) - ELSE - ::aProjects[ n,3 ] := aclone( ::aPrjProps ) - - IF lUpdateTree .AND. ::aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] <> t - MsgBox( '::removeProjectFromTree( ::aPrjProps )' ) - End - ENDIF - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD HbIde:fetchProjectProperties() - LOCAL cPrjLoc := hb_dirBase() + "projects" - - ::oProps := XbpQtUiLoader():new( ::oDlg ) - ::oProps:file := s_resPath + "projectproperties.ui" - ::oProps:create() - - ::oProps:qObj[ "comboPrjType" ]:addItem( "Executable" ) - ::oProps:qObj[ "comboPrjType" ]:addItem( "Library" ) - ::oProps:qObj[ "comboPrjType" ]:addItem( "Dll" ) - - DO CASE - CASE empty( ::aPrjProps ) - ::oProps:qObj[ "comboPrjType" ]:setCurrentIndex(0) - CASE ::aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Lib" - ::oProps:qObj[ "comboPrjType" ]:setCurrentIndex(1) - CASE ::aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Dll" - ::oProps:qObj[ "comboPrjType" ]:setCurrentIndex(2) - OTHERWISE - ::oProps:qObj[ "comboPrjType" ]:setCurrentIndex(0) - ENDCASE - - ::oProps:signal( "buttonCn" , "clicked()", {|| ::oProps:oWidget:close() } ) - ::oProps:signal( "buttonSave" , "clicked()", {|| ::saveProject( .F. ) } ) - ::oProps:signal( "buttonSaveExit", "clicked()", {|| ::saveProject( .T. ) } ) - ::oProps:signal( "buttonSelect" , "clicked()", {|| ::addSourcesToProject() } ) - ::oProps:signal( "tabWidget" , "currentChanged(int)", {|o,p| ::updateHbp( p, o ) } ) - - // TODO: Loading lookup.png inside these buttons... - ::oProps:signal( "buttonChoosePrjLoc", "clicked()", {|| ::PromptForPath( 'editPrjLoctn', 'Choose the Project Location...', 'editOutName', "editWrkFolder", "editDstFolder" ) } ) - ::oProps:signal( "buttonChooseWd" , "clicked()", {|| ::PromptForPath( 'editWrkFolder', 'Choose a Working Folder...' ) } ) - ::oProps:signal( "buttonChooseDest" , "clicked()", {|| ::PromptForPath( 'editDstFolder', 'Choose a Destination Folder...' ) } ) - - IF empty( ::aPrjProps ) - /* - * When they click on the button to confirm the name of the project, we - * will adjust the other parameters. (vailtoms) - * 25/12/2009 - 20:40:22 - */ - * ::oProps:qObj[ "editPrjTitle" ]:setText( "untitled" ) - ::oProps:qObj[ "editPrjLoctn" ]:setText( StrTran( cPrjLoc, '\', '/' ) ) - * ::oProps:qObj[ "editWrkFolder" ]:setText( hb_dirBase() ) - * ::oProps:qObj[ "editDstFolder" ]:setText( cPrjLoc ) - * ::oProps:qObj[ "editOutName" ]:setText( "untitled" ) - - ELSE - ::oProps:qObj[ "editPrjTitle" ]:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_TITLE ] ) - ::oProps:qObj[ "editPrjLoctn" ]:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_LOCATION ] ) - ::oProps:qObj[ "editWrkFolder" ]:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_WRKFOLDER ] ) - ::oProps:qObj[ "editDstFolder" ]:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_DSTFOLDER ] ) - ::oProps:qObj[ "editOutName" ]:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_OUTPUT ] ) - - ::oProps:qObj[ "editFlags" ]:setPlainText( ArrayToMemo( ::aPrjProps[ PRJ_PRP_FLAGS , 1 ] ) ) - ::oProps:qObj[ "editSources" ]:setPlainText( ArrayToMemo( ::aPrjProps[ PRJ_PRP_SOURCES , 1 ] ) ) - ::oProps:qObj[ "editMetaData" ]:setPlainText( ArrayToMemo( ::aPrjProps[ PRJ_PRP_METADATA, 1 ] ) ) - ::oProps:qObj[ "editCompilers" ]:setPlainText( memoread( hb_dirBase() + "hbide.env" ) ) - - #if 0 - ::oProps:qObj[ "editLaunchParams" ]:setText() - ::oProps:qObj[ "editLaunchExe" ]:setText() - ::oProps:qObj[ "editHbp" ]:setPlainText() - #endif - ENDIF - - IF empty( ::aPrjProps ) - ::oProps:oWidget:setWindowTitle( 'New Project...' ) - ELSE - ::oProps:oWidget:setWindowTitle( 'Properties for "' + ::oProps:qObj[ "editPrjTitle" ]:Text() + '"' ) - End - - ::setPosByIni( ::oProps:oWidget, PropsDialogGeometry ) - ::oProps:exec() - ::aIni[ INI_HBIDE, PropsDialogGeometry ] := PosAndSize( ::oProps:oWidget ) - ::oProps:destroy() - ::oProps := NIL - - ::manageFocusInEditor() - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD HbIde:saveProject( lCanClose ) - LOCAL a_, a4_1 - LOCAL typ_:= { "Executable", "Lib", "Dll" } - LOCAL txt_:= {} - LOCAL lOk - - * Validate certain parameters before continuing ... (vailtom) - IF Empty( ::oProps:qObj[ "editOutName" ]:text() ) - IF Empty( ::oProps:qObj[ "editPrjTitle" ]:text() ) - MsgBox( 'Invalid Output FileName!' ) - ::oProps:qObj[ "editOutName" ]:setFocus() - RETURN .F. - End - - ::oProps:qObj[ "editOutName" ]:setText( ::oProps:qObj[ "editPrjTitle" ]:text() ) - End - - IF Empty( ::oProps:qObj[ "editPrjTitle" ]:text() ) - ::oProps:qObj[ "editPrjTitle" ]:setText( ::oProps:qObj[ "editOutName" ]:text() ) - End - - IF !IsValidPath( ::oProps:qObj[ "editPrjLoctn" ]:text(), 'Project Location' ) - ::oProps:qObj[ "editPrjLoctn" ]:setFocus() - RETURN .F. - End - - IF !IsValidPath( ::oProps:qObj[ "editWrkFolder" ]:text(), 'Working Folder' ) - ::oProps:qObj[ "editWrkFolder" ]:setText( ::oProps:qObj[ "editPrjLoctn" ]:text() ) - RETURN .F. - End - - IF !IsValidPath( ::oProps:qObj[ "editDstFolder" ]:text(), 'Destination Folder' ) - ::oProps:qObj[ "editDstFolder" ]:setText( ::oProps:qObj[ "editPrjLoctn" ]:text() ) - RETURN .F. - End - - aadd( txt_, "[ PROPERTIES ]" ) - aadd( txt_, "Type = " + typ_[ ::oProps:qObj[ "comboPrjType" ]:currentIndex()+1 ] ) - aadd( txt_, "Title = " + ::oProps:qObj[ "editPrjTitle" ]:text() ) - aadd( txt_, "Location = " + ::oProps:qObj[ "editPrjLoctn" ]:text() ) - aadd( txt_, "WorkingFolder = " + ::oProps:qObj[ "editWrkFolder" ]:text() ) - aadd( txt_, "DestinationFolder = " + ::oProps:qObj[ "editDstFolder" ]:text() ) - aadd( txt_, "Output = " + ::oProps:qObj[ "editOutName" ]:text() ) - aadd( txt_, "LaunchParams = " + ::oProps:qObj[ "editLaunchParams" ]:text() ) - aadd( txt_, "LaunchProgram = " + ::oProps:qObj[ "editLaunchExe" ]:text() ) - aadd( txt_, " " ) - - aadd( txt_, "[ FLAGS ]" ) - a_:= MemoToArray( ::oProps:qObj[ "editFlags" ]:toPlainText() ); aeval( a_, {|e| aadd( txt_, e ) } ) ; aadd( txt_, " " ) - aadd( txt_, "[ SOURCES ]" ) - a_:= MemoToArray( ::oProps:qObj[ "editSources" ]:toPlainText() ); aeval( a_, {|e| aadd( txt_, e ) } ) ; aadd( txt_, " " ) - aadd( txt_, "[ METADATA ]" ) - a_:= MemoToArray( ::oProps:qObj[ "editMetaData" ]:toPlainText() ); aeval( a_, {|e| aadd( txt_, e ) } ) ; aadd( txt_, " " ) - - /* Setup Meta Keys */ - a4_1 := SetupMetaKeys( a_ ) - - ::cSaveTo := ParseWithMetaData( ::oProps:qObj[ "editPrjLoctn" ]:text(), a4_1 ) + ; - s_pathSep + ; - ParseWithMetaData( ::oProps:qObj[ "editOutName" ]:text(), a4_1 ) + ; - ".hbi" - - IF ( lOk := CreateTarget( ::cSaveTo, txt_ ) ) - *MsgBox( 'The project file was saved successfully: ' + ::cSaveTo, 'Saving project ...' ) - hb_MemoWrit( hb_dirBase() + "hbide.env", ::oProps:qObj[ "editCompilers" ]:toPlainText() ) - ELSE - MsgBox( 'Error saving project file: ' + ::cSaveTo, 'Error saving project ...' ) - ENDIF - - IF lCanClose .AND. lOk - ::oProps:oWidget:close() - End - RETURN lOk - -/*----------------------------------------------------------------------*/ - -METHOD HbIde:updateHbp( iIndex ) - LOCAL a_, a4_1, txt_, s - LOCAL cExt - - IF iIndex != 3 - RETURN nil - ENDIF - - a_:= hb_atokens( strtran( ::oProps:qObj[ "editMetaData" ]:toPlainText(), chr( 13 ) ), _EOL ) - a4_1 := SetupMetaKeys( a_ ) - - txt_:= {} - /* This block will be absent when submitting to hbmk engine */ - aadd( txt_, "# " + ParseWithMetaData( ::oProps:qObj[ "editWrkFolder" ]:text(), a4_1 ) + s_pathSep + ; - ParseWithMetaData( ::oProps:qObj[ "editOutName" ]:text(), a4_1 ) + ".hbp" ) - aadd( txt_, " " ) - - /* Flags */ - a_:= hb_atokens( ::oProps:qObj[ "editFlags" ]:toPlainText(), _EOL ) - FOR EACH s IN a_ - s := alltrim( s ) - IF !( "#" == left( s,1 ) ) .and. !empty( s ) - s := ParseWithMetaData( s, a4_1 ) - aadd( txt_, s ) - ENDIF - NEXT - aadd( txt_, " " ) - - /* Sources */ - a_:= hb_atokens( ::oProps:qObj[ "editSources" ]:toPlainText(), _EOL ) - FOR EACH s IN a_ - s := alltrim( s ) - IF !( "#" == left( s,1 ) ) .and. !empty( s ) - s := ParseWithMetaData( s, a4_1 ) - hb_FNameSplit( s, , , @cExt ) - IF lower( cExt ) $ ".c,.cpp,.prg,.rc,.res" - aadd( txt_, s ) - ENDIF - ENDIF - NEXT - aadd( txt_, " " ) - - /* Final assault */ - ::oProps:qObj[ "editHbp" ]:setPlainText( ArrayToMemo( txt_ ) ) - - RETURN txt_ - -/*----------------------------------------------------------------------*/ - -METHOD HbIde:addSourcesToProject() - LOCAL aFiles, a_, b_, a4_1, s - - IF !empty( aFiles := ::selectSource( "openmany" ) ) - a_:= MemoToArray( ::oProps:qObj[ "editMetaData" ]:toPlainText() ) - a4_1 := SetupMetaKeys( a_ ) - - a_:= MemoToArray( ::oProps:qObj[ "editSources" ]:toPlainText() ) - - b_:={} - aeval( aFiles, {|e| aadd( b_, ApplyMetaData( e, a4_1 ) ) } ) - - FOR EACH s IN b_ - IF ascan( a_, s ) == 0 - aadd( a_, s ) - ENDIF - NEXT - - ::oProps:qObj[ "editSources" ]:setPlainText( ArrayToMemo( a_ ) ) +* msgbox( ToString( oMenuBar:aMenuItems[ n ] )) + + IF Empty( ::cWrkProject ) + oItem[2]:setDisabled(.T.) + RETURN Self ENDIF + oItem[2]:setEnabled( .T.) RETURN Self /*----------------------------------------------------------------------*/ @@ -1753,6 +1632,10 @@ METHOD HbIde:addSourcesToProject() METHOD HbIde:updateTitleBar() LOCAL cTitle := "Harbour-Qt IDE" + IF Empty( ::oDlg ) + RETURN Self + ENDIF + IF !Empty( ::cWrkProject ) cTitle += ' - ' + ::cWrkProject + '' ENDIF @@ -1769,362 +1652,6 @@ METHOD HbIde:updateTitleBar() ::oDlg:oWidget:setWindowTitle( ::oDlg:Title ) RETURN Self -/*----------------------------------------------------------------------*/ -/* Set current project for build - vailtom - * 26/12/2009 - 02:19:38 - */ -METHOD HbIde:setCurrentProject( cProjectName ) - LOCAL cOldProject := ::cWrkProject - LOCAL aPrjProps - LOCAL n - - IF ( n := ascan( ::aProjects, {|e_| e_[ 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] == cProjectName } ) ) > 0 - aPrjProps := ::aProjects[ n, 3 ] - ::cWrkProject := aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] - - ::oSBar:getItem( SB_PNL_PROJECT ):caption := ::cWrkProject - ::updateTitleBar() - ELSE - MsgBox( 'Invalid project selected: ' + cProjectName ) - End - - RETURN cOldProject - -/*----------------------------------------------------------------------*/ - -METHOD HbIde:getCurrentProject() - LOCAL oDlg - LOCAL i, p, t - - IF !Empty( ::cWrkProject ) - RETURN ::cWrkProject - End - - IF Empty( ::aProjects ) - MsgBox( "No longer available projects!" ) - RETURN ::cWrkProject - End - - IF Len( ::aProjects ) == 1 - RETURN ::aProjects[ 1, 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] - End - - oDlg := XbpQtUiLoader():new( ::oDlg ) - oDlg:file := s_resPath + "selectproject.ui" - oDlg:create() - - * Fill ComboBox with current project names - FOR i := 1 TO Len( ::aProjects ) - p := ::aProjects[i] - t := p[ 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] - - IF !Empty( t ) - oDlg:qObj[ "cbProjects" ]:addItem( t ) - End - End - - oDlg:signal( "btnOk" , "clicked()", {|| ::setCurrentProject( oDlg:qObj[ "cbProjects" ]:currentText() ), oDlg:oWidget:close() } ) - oDlg:signal( "btnCancel" , "clicked()", {|| oDlg:oWidget:close() } ) - - oDlg:exec() - oDlg:destroy() - oDlg := NIL - - RETURN ::cWrkProject - -/*----------------------------------------------------------------------*/ -// Project Builds -/*----------------------------------------------------------------------*/ -/* hb_processRun( , [ ], [ @ ], [ @ ], [ ] ) -> */ - -METHOD HbIde:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) - LOCAL cOutput, cErrors, n, aPrj, cHbpPath, aHbp, qStringList - LOCAL cTmp, nResult - LOCAL nseconds - LOCAL cTargetFN - LOCAL qProcess - LOCAL cPath - LOCAL cFileName - LOCAL lDelHbp - - DEFAULT lLaunch TO .F. - DEFAULT lRebuild TO .F. - DEFAULT lPPO TO .F. - DEFAULT lViaQt TO .F. - - lDelHbp := lPPO - - IF lPPO .AND. ::getCurrentTab() == 0 - MsgBox( 'No file open issue to be compiled!' ) - RETURN Self - End - - IF empty( cProject ) - cProject := ::getCurrentProject() - ENDIF - - IF empty( cProject ) - RETURN Self - ENDIF - - n := ascan( ::aProjects, {|e_, x| x := e_[ 3 ], x[ 1,2,PRJ_PRP_TITLE ] == cProject } ) - aPrj := ::aProjects[ n,3 ] - aHbp := {} - - cTargetFN := aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_LOCATION ] + s_pathSep + aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_OUTPUT ] - cTargetFN := StrTran( cTargetFN, '/', s_pathSep ) - cTargetFN := StrTran( cTargetFN, '\', s_pathSep ) - - /* - * Creates a temporary file to avoid erase the file. Hbp correct this project. - * 26/12/2009 - 04:17:56 - vailtom - */ - IF lDelHbp - cHbpPath := cTargetFN + '.' + hb_md5( alltrim(str( seconds() ))) + ".hbp" - ELSE - cHbpPath := cTargetFN + ".hbp" - End - - DO CASE - CASE aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Lib" - aadd( aHbp, "-hblib" ) - CASE aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Dll" - aadd( aHbp, "-hbdyn" ) - ENDCASE - - aadd( aHbp, "-o" + cTargetFN ) - aadd( aHbp, "-q" ) - aadd( aHbp, "-trace" ) - aadd( aHbp, "-info" ) - - IF lRebuild - aadd( aHbp, "-rebuild" ) - End - - aeval( aPrj[ PRJ_PRP_FLAGS, 2 ], {|e| aadd( aHbp, e ) } ) - - IF !( lPPO ) - aeval( FilesToSources( aPrj[ PRJ_PRP_SOURCES, 2 ] ), {|e| aadd( aHbp, e ) } ) - - ELSE - aadd( aHbp, "-hbcmp -s -p" ) - - n := ::getCurrentTab() - - hb_FNameSplit( ::aTabs[ n, 5 ], @cPath, @cFileName, @cTmp ) - - IF !( lower( cTmp ) $ ".prg,?" ) - MsgBox( 'Operation not supported for this file type: "'+cTmp+'"' ) - RETURN Self - 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, 5 ] ) - - FErase( cFileName ) - ENDIF - - IF !CreateTarget( cHbpPath, aHbp ) - cTmp := 'Error saving: ' + cHbpPath - - ELSE - ::lDockBVisible := .t. - ::oDockB2:show() - - nSeconds := seconds() // time elapsed - - IF lViaQt - ::cProcessInfo := "" - - qStringList := QStringList():new() - qStringList:append( cHbpPath ) - - ::qProcess := QProcess():new() - ::qProcess:setProcessChannelMode( 0 ) - ::qProcess:setReadChannel( 0 ) - //::qProcess:setStandardOutputFile( "c:\temp\out.out" ) - //::qProcess:setStandardErrorFile( "c:\temp\err.out" ) - - Qt_Slots_Connect( ::pSlots, ::qProcess, "readyReadStandardOutput()", {|o,i| ::readProcessInfo( 2, i, o ) } ) - Qt_Slots_Connect( ::pSlots, ::qProcess, "readyReadStandardError()" , {|o,i| ::readProcessInfo( 3, i, o ) } ) - Qt_Slots_Connect( ::pSlots, ::qProcess, "finished(int,int)" , {|o,i| ::readProcessInfo( 4, i, o ) } ) - - ::oOutputResult:oWidget:clear() - ::qProcess:start( "hbmk2", qStringList ) - - ELSE - cTmp := "Project: " + cProject + CRLF + ; - "Launch.: " + iif( lLaunch, 'Yes', 'No' ) + CRLF + ; - "Rebuild: " + iif( lRebuild, 'Yes', 'No' ) + CRLF + ; - CRLF + ; - 'Started at ' + time() + CRLF + ; - '-----------------------------------------------------------------' + CRLF - - cOutput := "" ; cErrors := "" - nResult := hb_processRun( ( "hbmk2 " + cHbpPath ), , @cOutput, @cErrors ) - - * Show detailed status about compile process... - cTmp += cOutput + CRLF - cTmp += IIF( empty( cErrors ), "", cErrors ) + CRLF - cTmp += "errorlevel: " + hb_ntos( nResult ) + CRLF - cTmp += '-----------------------------------------------------------------' + CRLF - cTmp += 'Finished at ' + time() + CRLF - cTmp += "Done in " + ltrim( str( seconds() - nseconds ) ) +" seconds." + CRLF - - IF ( nResult == 0 ) .AND. ( lLaunch ) - cTmp += CRLF - - IF !hb_FileExists( cTargetFN ) - cTmp += "Launch application error: file not found " + cTargetFN + "!" - - ELSEIF aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Executable" - cTmp += "Launch application " + cTargetFN + "... " - - qProcess := QProcess():new() - qProcess:startDetached_2( cTargetFN ) - qProcess:waitForStarted() - qProcess:pPtr := 0 - qProcess := NIL - - ELSE - cTmp += "Launch application " + cTargetFN + "... (not applicable)" + CRLF - - ENDIF - ENDIF - - ConvertBuildStatusMsgToHtml( cTmp, ::oOutputResult:oWidget ) - ENDIF - - ENDIF - - IF lDelHbp - FErase( cHbpPath ) - ENDIF - - IF lPPO .AND. hb_FileExists( cFileName ) - ::aEdits[ 1 ]:showPPO( cFileName ) - ENDIF - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD HbIde:buildProjectViaQt( cProject ) - - ::buildProject( cProject, , , , .t. ) - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD HbIde:readProcessInfo( nMode ) - LOCAL cLine - - DO CASE - CASE nMode == 1 - - - CASE nMode == 2 - ::qProcess:setReadChannel( 0 ) - cLine := space( 4096 ) - ::qProcess:readLine( @cLine, 4096 ) - IF !empty( cLine ) - ::oOutputResult:oWidget:append( cLine ) - ENDIF - - CASE nMode == 3 - ::qProcess:setReadChannel( 1 ) - cLine := space( 4096 ) - ::qProcess:readLine( @cLine, 4096 ) - - IF !empty( cLine ) - ::cProcessInfo += CRLF + trim( cLine ) - IF ( "Warning" $ cLine ) - cLine := '' + cLine + '' - ELSEIF ( "Error" $ cLine ) - cLine := '' + cLine + '' - ENDIF - - ::oOutputResult:oWidget:append( cLine ) - ENDIF - - CASE nMode == 4 - ::oOutputResult:oWidget:append( '-----------------------------------------------------------------' ) - ::oOutputResult:oWidget:append( 'Finished at ' + time() ) - - Qt_Slots_disConnect( ::pSlots, ::qProcess, "finished(int,int)" ) - Qt_Slots_disConnect( ::pSlots, ::qProcess, "readyReadStandardOutput()" ) - Qt_Slots_disConnect( ::pSlots, ::qProcess, "readyReadStandardError()" ) - - ::qProcess:kill() - ::qProcess:pPtr := 0 - ::qProcess := NIL - - ENDCASE - - RETURN nil - -/*----------------------------------------------------------------------*/ -METHOD HbIde:Help( nOption ) - LOCAL txt_ := {} - LOCAL tit_ := '' - - SWITCH nOption - CASE 1 - tit_ := 'About hbIde' - AAdd( txt_, "Harbour-QT IDE (hbide)" ) - AAdd( txt_, "Developed by" ) - AAdd( txt_, "Pritpal Bedi - pritpal@vouchcac.com" ) - AAdd( txt_, "" ) - AAdd( txt_, "built with:" ) - AAdd( txt_, HB_VERSION() ) - AAdd( txt_, HB_COMPILER() ) - AAdd( txt_, "Qt " + QT_VERSION_STR() ) - AAdd( txt_, "" ) - AAdd( txt_, "Visit the project website at:" ) - AAdd( txt_, "http://www.harbour-project.org/" ) - EXIT - - CASE 2 - tit_ := 'Mailing List' - AAdd( txt_, "Harbour Developers Mailing List" ) - AAdd( txt_, "" ) - AAdd( txt_, "Please visit the home page:" ) - AAdd( txt_, "http://lists.harbour-project.org/pipermail/harbour/" ) - EXIT - - CASE 3 - tit_ := 'Mailing List' - AAdd( txt_, "Harbour Users Mailing List" ) - AAdd( txt_, "" ) - AAdd( txt_, "Please visit the home page:" ) - AAdd( txt_, "http://lists.harbour-project.org/pipermail/harbour/" ) - EXIT - - CASE 4 - tit_ := 'About Harbour' - AAdd( txt_, "About Harbour" ) - AAdd( txt_, "" ) - AAdd( txt_, '"The Harbour Project is a Free Open Source Software effort to build' ) - AAdd( txt_, 'a multiplatform Clipper language compiler. Harbour consists of the' ) - AAdd( txt_, 'xBase language compiler and the runtime libraries with different' ) - AAdd( txt_, 'terminal plugins and different databases (not just DBF)"' ) - AAdd( txt_, "" ) - AAdd( txt_, "Get downloads, samples, contribs and much more at:" ) - AAdd( txt_, "http://www.harbour-project.org/" ) - EXIT - - END - - IF !Empty( txt_ ) - MsgBox( ArrayToMemo( txt_ ), tit_ ) - ENDIF - - RETURN Self - /*----------------------------------------------------------------------*/ METHOD HbIde:goto() @@ -2142,7 +1669,7 @@ METHOD HbIde:goto() ::setPosByIni( qGo, GotoDialogGeometry ) qGo:exec() - ::aIni[ INI_HBIDE, GotoDialogGeometry ] := PosAndSize( qGo ) + ::aIni[ INI_HBIDE, GotoDialogGeometry ] := hbide_posAndSize( qGo ) nLine := qGo:intValue() - nLine @@ -2166,49 +1693,6 @@ METHOD HbIde:setCodec( cCodec ) RETURN Self -/*----------------------------------------------------------------------*/ -/* Prompt for user to select a existing folder - * 25/12/2009 - 19:03:09 - vailtom - */ -METHOD HbIde:PromptForPath( cObjPathName, cTitle, cObjFileName, cObjPath2, cObjPath3 ) - LOCAL cTemp, cPath, cFile - - IF !hb_isChar( cObjFileName ) - cTemp := ::oProps:qObj[ cObjPathName ]:Text() - cPath := FetchADir( ::oDlg, cTitle, cTemp ) - cPath := StrTran( cPath, "\", "/" ) - - ELSE - cTemp := ::oProps:qObj[ cObjPathName ]:Text() - cTemp := FetchAFile( ::oDlg, cTitle, { { "Harbour IDE Projects", "*.hbi" } }, cTemp ) - - IF !Empty( cTemp ) - cTemp := strtran( cTemp, "\", '/' ) - - hb_fNameSplit( cTemp, @cPath, @cFile ) - - ::oProps:qObj[ cObjFileName ]:setText( cFile ) - ENDIF - ENDIF - - IF !Empty( cPath ) - IF Right( cPath, 1 ) == '/' - cPath := Left( cPath, Len( cPath ) - 1 ) - ENDIF - ::oProps:qObj[ cObjPathName ]:setText( cPath ) - - IF hb_isChar( cObjPath2 ) .AND. Empty( ::oProps:qObj[ cObjPath2 ]:Text() ) - ::oProps:qObj[ cObjPath2 ]:setText( cPath ) - ENDIF - - IF hb_isChar( cObjPath3 ) .AND. Empty( ::oProps:qObj[ cObjPath3 ]:Text() ) - ::oProps:qObj[ cObjPath3 ]:setText( cPath ) - ENDIF - ENDIF - - ::oProps:qObj[ cObjPathName ]:setFocus() - RETURN Self - /*----------------------------------------------------------------------*/ /* * Find an item in aEdits[] based on the file name passed as argument. @@ -2217,7 +1701,7 @@ METHOD HbIde:PromptForPath( cObjPathName, cTitle, cObjFileName, cObjPath2, cObjP METHOD HbIde:findEditByFileName( cSource ) LOCAL myEdit - cSource := PathNormalized( cSource, .F. ) + cSource := hbide_pathNormalized( cSource, .F. ) FOR EACH myEdit IN ::aEdits diff --git a/harbour/contrib/hbide/ideactions.prg b/harbour/contrib/hbide/ideactions.prg index cba9287f8a..4e6ee25756 100644 --- a/harbour/contrib/hbide/ideactions.prg +++ b/harbour/contrib/hbide/ideactions.prg @@ -160,8 +160,8 @@ STATIC FUNCTION mnuNormalizeItem( cCaption ) LOCAL p /* Retrieve and update the ICON name for this menu item */ - IF ( (p := Rat( '|', cCaption ) ) != 00 ) - cIco := Substr( cCaption, p+1 ) + IF ( ( p := Rat( '|', cCaption ) ) != 00 ) + cIco := Substr( cCaption, p + 1 ) cIco := alltrim( cIco ) cCaption := Substr( cCaption, 1, p - 1 ) @@ -184,7 +184,7 @@ STATIC FUNCTION mnuNormalizeItem( cCaption ) /* Update the key shortcut for this menu item */ IF ( ( p := Rat( ',', cCaption ) ) != 00 ) - cKey := Substr( cCaption, p+1 ) + cKey := Substr( cCaption, p + 1 ) cCaption := Substr( cCaption, 1, p - 1 ) cCaption := alltrim( cCaption ) @@ -199,14 +199,13 @@ STATIC FUNCTION mnuNormalizeItem( cCaption ) cKey := '' ENDIF - cCaption := cIco + cCaption + cKey - RETURN cCaption + RETURN ( cIco + cCaption + cKey ) /*----------------------------------------------------------------------*/ /* * This pseudo function helps to create is a menu item with text and shortcut. */ -#define _T( x ) ( mnuNormalizeItem(x) ) +#define _T( x ) ( mnuNormalizeItem( x ) ) FUNCTION buildMainMenu( oWnd, oIde ) LOCAL oMenuBar, oSubMenu, oSub1, oSubMenu2 @@ -219,25 +218,25 @@ FUNCTION buildMainMenu( oWnd, oIde ) oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~File" - oSubMenu2 := XbpMenu():new( oSubMenu ):create() - oSubMenu2:addItem( { _T( "~Source, ^N | new.png" ) , {|| oIde:executeAction( "New" ) } } ) - oSubMenu2:addItem( { _T( "~Project | project.png" ) , {|| oIde:executeAction( "NewProject" ) } } ) - oMenuBar:addItem( { oSubMenu2, _T( "~New" ) } ) - oMenuBar:aMenuItems[ oMenuBar:numItems(), 2 ]:seticon( oIde:resPath + 'new.png' ) + oSubMenu2 := XbpMenu():new( oSubMenu ):create() + oSubMenu2:addItem( { _T( "~Source, ^N | new.png" ) , {|| oIde:executeAction( "New" ) } } ) + oSubMenu2:addItem( { _T( "~Project | project.png" ) , {|| oIde:executeAction( "NewProject" ) } } ) + oMenuBar:addItem( { oSubMenu2, _T( "~New" ) } ) + oMenuBar:aMenuItems[ oMenuBar:numItems(), 2 ]:seticon( oIde:resPath + 'new.png' ) // oSubMenu:addItem( { _T( "~New File, ^N | new.png" ) , {|| oIde:executeAction( "New" ) } } ) // oSubMenu:addItem( { _T( "New Pro~ject, Sh+^N | project.png" ) , {|| oIde:executeAction( "NewProject" ) } } ) oSubMenu:addItem( { _T( "~Open, ^O | open.png" ) , {|| oIde:executeAction( "Open" ) } } ) oSubMenu:addItem( { _T( "Open Projec~t" ) , {|| oIde:executeAction( "LoadProject" ) } } ) - MenuAddSep( oSubMenu ) + hbide_menuAddSep( oSubMenu ) oSubMenu2 := XbpMenu():new( oSubMenu ):create() oSubMenu2:itemSelected := {| nIndex, cFile | cFile := oIde:aIni[ INI_RECENTFILES, nIndex ], ; oIde:editSource( cFile ) } lEmpty := .T. FOR n := 1 TO Len( oIde:aIni[ INI_RECENTFILES ] ) - f := PathNormalized( oIde:aIni[ INI_RECENTFILES, n ], .F. ) + f := hbide_pathNormalized( oIde:aIni[ INI_RECENTFILES, n ], .F. ) lEmpty := .F. oSubMenu2:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + f ) , nil } ) IF !File(f) @@ -256,7 +255,7 @@ FUNCTION buildMainMenu( oWnd, oIde ) lEmpty := .T. FOR n := 1 TO Len( oIde:aIni[ INI_RECENTPROJECTS ] ) - f := PathNormalized( oIde:aIni[ INI_RECENTPROJECTS, n ], .F. ) + f := hbide_pathNormalized( oIde:aIni[ INI_RECENTPROJECTS, n ], .F. ) lEmpty := .F. oSubMenu2:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + f ) , nil } ) IF !File(f) @@ -269,7 +268,7 @@ FUNCTION buildMainMenu( oWnd, oIde ) ENDIF oMenuBar:addItem( { oSubMenu2, _T( "Recent Projects" ) } ) - MenuAddSep( oSubMenu ) + hbide_menuAddSep( oSubMenu ) oSubMenu:addItem( { _T( "~Save, ^S | save.png" ) , {|| oIde:executeAction( "Save" ) } } ) oSubMenu:addItem( { _T( "Save ~As | saveas.png" ) , {|| oIde:executeAction( "SaveAs" ) } } ) @@ -278,68 +277,65 @@ FUNCTION buildMainMenu( oWnd, oIde ) oSubMenu:addItem( { _T( "Clos~e All | closeall.png" ) , {|| oIde:executeAction( "CloseAll" ) } } ) oSubMenu:addItem( { _T( "Close ~Others| closeexcept.png" ) , {|| oIde:executeAction( "CloseOther" ) } } ) oSubMenu:addItem( { _T( "~Revert to Saved, Sh+^R" ) , {|| oIde:executeAction( "Revert" ) } } ) - MenuAddSep( oSubMenu ) + hbide_menuAddSep( oSubMenu ) - oSubMenu:addItem( { _T( "~Export as HTML* | exporthtml.png" ), {|| oIde:executeAction( "" ) } } ) - oSubMenu:disableItem( oSubMenu:numItems ) + * oSubMenu:addItem( { _T( "~Export as HTML* | exporthtml.png" ), {|| oIde:executeAction( "" ) } } ) oSubMenu:addItem( { _T( "~Print, ^P | print.png" ) , {|| oIde:executeAction( "Print" ) } } ) - MenuAddSep( oSubMenu ) + hbide_menuAddSep( oSubMenu ) oSubMenu:addItem( { _T( "Sa~ve and Exit, Sh+^W" ) , {|| oIde:executeAction( "SaveExit" ) } } ) oSubMenu:addItem( { _T( "E~xit | exit.png" ) , {|| oIde:executeAction( "Exit" ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~Edit" - oSubMenu:addItem( { _T( "Undo | undo.png" ) , {|| oIde:executeAction( "Undo" ) } } ) - oSubMenu:addItem( { _T( "Redo | redo.png" ) , {|| oIde:executeAction( "Redo" ) } } ) - MenuAddSep( oSubMenu ) - oSubMenu:addItem( { _T( "Cut | cut.png" ) , {|| oIde:executeAction( "Cut" ) } } ) - oSubMenu:addItem( { _T( "Copy | copy.png" ) , {|| oIde:executeAction( "Copy" ) } } ) - oSubMenu:addItem( { _T( "Paste| paste.png" ) , {|| oIde:executeAction( "Paste" ) } } ) - oSubMenu:addItem( { _T( "Duplicate Line*" ) , {|| oIde:executeAction( "" ) } } ) - oSubMenu:addItem( { _T( "Select All | selectall.png" ) , {|| oIde:executeAction( "SelectAll" ) } } ) - MenuAddSep( oSubMenu ) - oSubMenu:addItem( { _T( "Find/Replace, ^F | find.png" ) , {|| oIde:executeAction( "Find" ) } } ) - oSubMenu:addItem( { _T( "Go To Line..., ^G| gotoline.png" ) , {|| oIde:executeAction( "Goto" ) } } ) - MenuAddSep( oSubMenu ) - oSubMenu:addItem( { _T( "Insert*" ) , {|| oIde:executeAction( "" ) } } ) - MenuAddSep( oSubMenu ) - oSubMenu:addItem( { _T( "Set as Readonly*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "~Undo | undo.png" ) , {|| oIde:executeAction( "Undo" ) } } ) + oSubMenu:addItem( { _T( "~Redo | redo.png" ) , {|| oIde:executeAction( "Redo" ) } } ) + hbide_menuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "C~ut | cut.png" ) , {|| oIde:executeAction( "Cut" ) } } ) + oSubMenu:addItem( { _T( "~Copy | copy.png" ) , {|| oIde:executeAction( "Copy" ) } } ) + oSubMenu:addItem( { _T( "~Paste| paste.png" ) , {|| oIde:executeAction( "Paste" ) } } ) + oSubMenu:addItem( { _T( "Select ~All | selectall.png" ) , {|| oIde:executeAction( "SelectAll" ) } } ) + hbide_menuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "~Find/Replace, ^F | find.png" ) , {|| oIde:executeAction( "Find" ) } } ) + oSubMenu:addItem( { _T( "~Go To Line..., ^G| gotoline.png" ) , {|| oIde:executeAction( "Goto" ) } } ) + hbide_menuAddSep( oSubMenu ) + + oSubMenu2 := XbpMenu():new( oSubMenu ):create() + oSubMenu2:addItem( { _T( "~Date && Time, Sh+F7| insert-datetime.png" ) , {|| oIde:executeAction( "InsertDateTime" ) } } ) + oSubMenu2:addItem( { _T( "~Random Function Name, Sh+^F8| insert-procname.png" ) , {|| oIde:executeAction( "InsertRandomName" ) } } ) + oSubMenu2:addItem( { _T( "~External File at cursor| insert-external-file.png" ) , {|| oIde:executeAction( "InsertExternalFile" ) } } ) + oMenuBar:addItem( { oSubMenu2, _T( "~Insert" ) } ) + + hbide_menuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "Switch Read~Only Mode | readonly.png" ) , {|| oIde:executeAction( "switchReadOnly" ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~Project" - oSubMenu:addItem( { _T( "Add to Project...*| projectadd.png" ), {|| oIde:executeAction( "" ) } } ) - oSubMenu:addItem( { _T( "Remove from Project...* | projectdel.png" ), {|| oIde:executeAction( "" ) } } ) - MenuAddSep( oSubMenu ) - oSubMenu:addItem( { _T( "Close" ) , {|| oIde:executeAction( "CloseProject" ) } } ) - MenuAddSep( oSubMenu ) - oSubMenu:addItem( { _T( "Select Main Module...* | setmain.png" ), {|| oIde:executeAction( "" ) } } ) - oSubMenu:addItem( { _T( "Project Properties" ) , {|| oIde:executeAction( "Properties" ) } } ) - MenuAddSep( oSubMenu ) - oSubMenu:addItem( { _T( "Select Current Project*" ) , {|| oIde:executeAction( "" ) } } ) - oSubMenu:addItem( { _T( "Drop Current from Tree*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Properties" ) , {|| oIde:executeAction( "Properties" ) } } ) + hbide_menuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "Add File* | projectadd.png" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Remove File* | projectdel.png" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Select Main Module | setmain.png" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:disableItem( oSubMenu:numItems ) + hbide_menuAddSep( oSubMenu ) + hbide_menuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "Change Current Project" ) , {|| oIde:executeAction( "SelectProject" ) } } ) + oSubMenu:addItem( { _T( "Close Current Project" ) , {|| oIde:executeAction( "CloseProject" ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~Build" - #if 0 - oSubMenu:addItem( { _T( "Build,^F9" ) , {|| oIde:executeAction( "SaveBuild" ) } } ) - oSubMenu:addItem( { _T( "Build and Run, F9 | run.png" ) , {|| oIde:executeAction( "SaveBuildLaunch" ) } } ) - oSubMenu:addItem( { _T( "Re-build | clean.png" ) , {|| oIde:executeAction( "SaveRebuild" ) } } ) - oSubMenu:addItem( { _T( "Re-build and Run, Sh+^F9 | cleanrun.png" ), {|| oIde:executeAction( "SaveRebuildLaunch" ) } } ) - #else oSubMenu:addItem( { _T( "Build, ^F9 | build.png" ) , {|| oIde:executeAction( "SaveBuild" ) } } ) oSubMenu:addItem( { _T( "Build and Launch, F9 | buildlaunch.png" ), {|| oIde:executeAction( "SaveBuildLaunch" ) } } ) oSubMenu:addItem( { _T( "Re-build | rebuild.png" ) , {|| oIde:executeAction( "SaveRebuild" ) } } ) oSubMenu:addItem( { _T( "Re-build and Launch, Sh+^F9 | rebuildlaunch.png" ), {|| oIde:executeAction( "SaveRebuildLaunch" ) } } ) - #endif - MenuAddSep( oSubMenu ) + hbide_menuAddSep( oSubMenu ) oSubMenu:addItem( { _T( "Save and Compile Current File | compile.png"), {|| oIde:executeAction( "SaveCompileCurrent" ) } } ) oSubMenu:addItem( { _T( "Save and Compile to PPO | ppo.png" ), {|| oIde:executeAction( "CompilePPO" ) } } ) - MenuAddSep( oSubMenu ) - oSubMenu:addItem( { _T( "Run*, ^F10" ) , {|| oIde:executeAction( "" ) } } ) - oSubMenu:addItem( { _T( "Run without Debug*, Sh+^F10 | runnodebug.png" ), {|| oIde:executeAction( "" ) } } ) + hbide_menuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "Launch, ^F10" ) , {|| oIde:executeAction( "LaunchProject" ) } } ) + * oSubMenu:addItem( { _T( "Run without Debug*, Sh+^F10 | runnodebug.png" ), {|| oIde:executeAction( "" ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) oSubMenu := XbpMenu():new( oMenuBar ):create() @@ -430,7 +426,7 @@ FUNCTION buildMainMenu( oWnd, oIde ) oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~Tools" oSubMenu:addItem( { _T( "Configure Tools...*" ) , {|| oIde:executeAction( "" ) } } ) - MenuAddSep( oSubMenu ) + hbide_menuAddSep( oSubMenu ) // TODO: Load custom TOOLS LINK from .INI file #ifdef __PLATFORM__WINDOWS oSubMenu:addItem( { _T( "Command Prompt...*" ) , {|| oIde:executeAction( "" ) } } ) @@ -448,23 +444,22 @@ FUNCTION buildMainMenu( oWnd, oIde ) /* Help */ oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~Help" - oSubMenu:addItem( { _T( "About hbIDE | vr-16x16.png" ) , {|| oIde:Help( 1 ) } } ) - oSubMenu:addItem( { _T( "About Harbour | hb-16x16.png" ) , {|| oIde:Help(4) } } ) - MenuAddSep( oSubMenu ) - oSubMenu:addItem( { _T( "Harbour Users (Mailing Lists) | list-users.png" ) , {|| oIde:Help(3) } } ) - oSubMenu:addItem( { _T( "Harbour Developers (Mailing Lists) | list-developers.png" ), {|| oIde:Help(2) } } ) + oSubMenu:addItem( { _T( "About hbIDE | vr-16x16.png" ) , {|| hbide_help( 1 ) } } ) + oSubMenu:addItem( { _T( "About Harbour | hb-16x16.png" ) , {|| hbide_help( 4 ) } } ) + hbide_menuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "Harbour Users (Mailing Lists) | list-users.png" ) , {|| hbide_help( 3 ) } } ) + oSubMenu:addItem( { _T( "Harbour Developers (Mailing Lists) | list-developers.png" ), {|| hbide_help( 2 ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) Return Nil /*----------------------------------------------------------------------*/ /* - * * 02/01/2010 - 22:44:19 */ #define QMF_POPUP 1 -STATIC FUNCTION mnuUpdateMRUpopup( oIde, nType ) +STATIC FUNCTION hbide_mnuUpdateMRUpopup( oIde, nType ) LOCAL oMenuBar LOCAL lEmpty LOCAL oItem @@ -507,7 +502,7 @@ STATIC FUNCTION mnuUpdateMRUpopup( oIde, nType ) oItem[4]:delAllItems() FOR n := 1 TO Len( oIde:aIni[ nType ] ) - c := PathNormalized( oIde:aIni[ nType , n ], .F. ) + c := hbide_pathNormalized( oIde:aIni[ nType , n ], .F. ) lEmpty := .F. oItem[4]:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + c ) , nil } ) @@ -526,20 +521,21 @@ STATIC FUNCTION mnuUpdateMRUpopup( oIde, nType ) ENDIF RETURN nil +/*----------------------------------------------------------------------*/ /* * Add a file name to MRU menu item. * 02/01/2010 - 23:23:22 - vailtom */ -FUNCTION mnuAddFileToMRU( oIde, cFileName, nType ) +FUNCTION hbide_mnuAddFileToMRU( oIde, cFileName, nType ) LOCAL nPos IF nType != INI_RECENTPROJECTS .AND. nType != INI_RECENTFILES RETURN nil ENDIF - cFileName := PathNormalized( cFileName ) + cFileName := hbide_pathNormalized( cFileName ) - nPos := aScan( oIde:aIni[ nType ], {|f| PathNormalized( f ) == cFileName } ) + nPos := aScan( oIde:aIni[ nType ], {|f| hbide_pathNormalized( f ) == cFileName } ) IF nPos > 0 hb_aDel( oIde:aIni[ nType ], nPos, .T. ) @@ -554,5 +550,37 @@ FUNCTION mnuAddFileToMRU( oIde, cFileName, nType ) aSize( oIde:aIni[ nType ], 15 ) ENDIF - mnuUpdateMRUpopup( oIde, nType ) + hbide_mnuUpdateMRUpopup( oIde, nType ) RETURN nil + +/*----------------------------------------------------------------------*/ +/* + * Find a menu item with same caption as passed on argument. + * 03/01/2010 - 13:12:42 + */ +FUNCTION hbide_mnuFindItem( oIde, cCaption ) + LOCAL oMenuBar + LOCAL oItem + LOCAL n, c + + IF Empty(oIde:oDlg ) + RETURN nil + ENDIF + + oMenuBar := oIde:oDlg:MenuBar() + cCaption := Alltrim( Upper( cCaption ) ) + + FOR n := 1 TO oMenuBar:numItems() + + oItem := oMenuBar:aMenuItems[ n ] + c := Upper( oItem[3] ) + c := StrTran( c, '~', '' ) + c := StrTran( c, '&', '' ) + + IF cCaption == alltrim( c ) + RETURN oItem + ENDIF + NEXT + RETURN nil + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index f7b9da2e63..5c87eee1f1 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -71,40 +71,10 @@ /*----------------------------------------------------------------------*/ -CLASS IdeDocks - - ACCESS pSlots INLINE hbxbp_getSlotsPtr() - ACCESS pEvents INLINE hbxbp_GetEventsPtr() +CLASS IdeDockS INHERIT IdeObject DATA nPass INIT 0 - DATA oIde - - ACCESS oDlg INLINE ::oIde:oDlg - ACCESS oDA INLINE ::oIde:oDA - - ACCESS oDockPT INLINE ::oIde:oDockPT - ACCESS oProjTree INLINE ::oIde:oProjTree - ACCESS oProjRoot INLINE ::oIde:oProjRoot - ACCESS aProjData INLINE ::oIde:aProjData - ACCESS aProjects INLINE ::oIde:aProjects - - ACCESS oDockED INLINE ::oIde:oDockED - ACCESS oEditTree INLINE ::oIde:oEditTree - ACCESS oOpenedSources INLINE ::oIde:oOpenedSources - - ACCESS oDockR INLINE ::oIde:oDockR - ACCESS oFuncList INLINE ::oIde:oFuncList - - ACCESS oDockB INLINE ::oIde:oDockB - ACCESS oCompileResult INLINE ::oIde:oCompileResult - - ACCESS oDockB1 INLINE ::oIde:oDockB1 - ACCESS oLinkResult INLINE ::oIde:oLinkResult - - ACCESS oDockB2 INLINE ::oIde:oDockB2 - ACCESS oOutputResult INLINE ::oIde:oOutputResult - METHOD new() METHOD create() METHOD destroy() @@ -188,7 +158,7 @@ METHOD IdeDocks:buildProjectTree() ::oProjRoot:expand( .t. ) // FOR i := 1 TO len( ::aProjects ) - ::oIde:appendProjectInTree( ::aProjects[ i, 3 ] ) + ::oIde:updateProjectTree( ::aProjects[ i, 3 ] ) NEXT /* Insert Project Tree Into Dock Widget */ @@ -362,7 +332,7 @@ METHOD IdeDocks:outputDoubleClicked( lSelected ) qCursor := QTextCursor():configure( ::oOutputResult:oWidget:textCursor() ) cText := QTextBlock():configure( qCursor:block() ):text() - IF ParseFNfromStatusMsg( cText, @cSource, @nLine, .T. ) + IF hbide_parseFNfromStatusMsg( cText, @cSource, @nLine, .T. ) ::oIde:editSource( cSource ) qCursor := QTextCursor():configure( ::oIde:qCurEdit:textCursor() ) nLine := iif( nLine < 1, 0, nLine - 1 ) diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index d78cd9f1ae..a2fddafb9d 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -73,12 +73,7 @@ /*----------------------------------------------------------------------*/ -CLASS IdeEditor - - ACCESS pSlots INLINE hbxbp_getSlotsPtr() - ACCESS pEvents INLINE hbxbp_GetEventsPtr() - - DATA oIde +CLASS IdeEditor INHERIT IdeObject DATA oTab DATA cPath @@ -101,8 +96,6 @@ CLASS IdeEditor DATA nVPos INIT 0 DATA nID - ACCESS qTabWidget INLINE ::oIde:oDA:oTabWidget:oWidget - DATA qCursor METHOD new() @@ -132,7 +125,7 @@ METHOD IdeEditor:new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) ::nHPos := nHPos ::nVPos := nVPos ::cTheme := cTheme - ::nID := GetNextUniqueID() + ::nID := hbide_getNextUniqueID() RETURN Self /*----------------------------------------------------------------------*/ @@ -147,7 +140,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) DEFAULT cTheme TO ::cTheme ::oIde := oIde - ::SourceFile := PathNormalized( cSourceFile, .F. ) + ::SourceFile := hbide_pathNormalized( cSourceFile, .F. ) ::nPos := nPos ::nHPos := nHPos ::nVPos := nVPos @@ -163,7 +156,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) ::qEdit := QPlainTextEdit():new( ::oTab:oWidget ) ::qEdit:setPlainText( hb_memoRead( ::sourceFile ) ) ::qEdit:setLineWrapMode( QTextEdit_NoWrap ) - ::qEdit:setFont( ::oIde:oFont:oWidget ) + ::qEdit:setFont( ::oFont:oWidget ) ::qEdit:ensureCursorVisible() * ::qEdit:setStyleSheet( GetStyleSheet( "QPlainTextEdit" ) ) @@ -177,7 +170,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) ::oTab:oWidget:setLayout( ::qLayout ) IF ::cType != "U" - ::qHiliter := ::oIde:oThemes:SetSyntaxHilighting( ::qEdit, @::cTheme ) + ::qHiliter := ::oThemes:SetSyntaxHilighting( ::qEdit, @::cTheme ) ENDIF Qt_Slots_Connect( ::pSlots, ::qEdit , "textChanged()" , {|| ::setTabImage() } ) @@ -197,7 +190,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) QScrollBar():configure( ::qEdit:verticalScrollBar() ):setValue( ::nVPos ) /* Populate Tabs Array */ - aadd( ::oIde:aTabs, { ::oTab, ::qEdit, ::qHiliter, ::qLayout, ::sourceFile, ::qDocument, Self } ) + aadd( ::aTabs, { ::oTab, ::qEdit, ::qHiliter, ::qLayout, ::sourceFile, ::qDocument, Self } ) ::oIde:nCurTab := len( ::oIde:aTabs ) @@ -212,6 +205,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) ::nColumn := ::qCursor:columnNumber() ::qTabWidget:setStyleSheet( GetStyleSheet( "QTabWidget" ) ) + ::setTabImage() RETURN Self @@ -282,17 +276,12 @@ METHOD IdeEditor:removeTabPage() // ::oTab := nil ENDIF - n := aScan( ::oIde:aProjData, {|e_| e_[ 4 ] == cSource } ) - - IF ( n > 0 ) - ::oIde:aProjData[ n,3 ]:delItem( ::oIde:aProjData[ n,1 ] ) - - hb_aDel( ::oIde:aProjData, n, .T. ) + IF ( n := aScan( ::oIde:aProjData, {|e_| e_[ 4 ] == cSource } ) ) > 0 + ::aProjData[ n,3 ]:delItem( ::oIde:aProjData[ n,1 ] ) + hb_aDel( ::aProjData, n, .T. ) ENDIF - n := aScan( ::oIde:aEdits, {|e_| e_:nID == ::nID } ) - - IF ( n > 0 ) + IF ( n := aScan( ::oIde:aEdits, {|e_| e_:nID == ::nID } ) ) > 0 hb_aDel( ::oIde:aEdits, n, .T. ) ENDIF @@ -304,11 +293,11 @@ METHOD IdeEditor:removeTabPage() * aEdits - OK * */ - IF ::oIde:qTabWidget:count() == 0 - IF ::oIde:lDockRVisible - ::oIde:oDockR:hide() - ::oIde:lDockRVisible := .f. - End + IF ::qTabWidget:count() == 0 + IF ::lDockRVisible + ::oDockR:hide() + ::lDockRVisible := .f. + ENDIF ENDIF RETURN Self @@ -320,7 +309,7 @@ METHOD IdeEditor:buildTabPage( cSource ) ::oTab := XbpTabPage():new( ::oIde:oDA, , { 5,5 }, { 700,400 }, , .t. ) IF Empty( cSource ) - ::oTab:caption := "Untitled " + hb_ntos( GetNextUntitled() ) + ::oTab:caption := "Untitled " + hb_ntos( hbide_getNextUntitled() ) ELSE ::oTab:caption := ::cFile + ::cExt ENDIF @@ -348,7 +337,7 @@ METHOD IdeEditor:activateTab( mp1, mp2, oXbp ) ::oIde:aSources := { ::oIde:aTabs[ ::oIde:nCurTab, TAB_SOURCEFILE ] } ::oIde:createTags() ::oIde:updateFuncList() - ::oIde:aTabs[ mp2, TAB_OEDITOR ]:dispEditInfo() + ::aTabs[ mp2, TAB_OEDITOR ]:dispEditInfo() ::oIde:updateTitleBar() ::oIde:manageFocusInEditor() ENDIF @@ -402,7 +391,8 @@ METHOD IdeEditor:dispEditInfo() ::oIde:oSBar:getItem( SB_PNL_LINE ):caption := s ::oIde:oSBar:getItem( SB_PNL_COLUMN ):caption := "Col " + hb_ntos( ::qCursor:columnNumber() + 1 ) ::oIde:oSBar:getItem( SB_PNL_INS ):caption := iif( ::qEdit:overwriteMode() , " ", "Ins" ) - ::oIde:oSBar:getItem( SB_PNL_MODIFIED ):caption := iif( ::qDocument:isModified(), "Modified", " " ) + ::oIde:oSBar:getItem( SB_PNL_MODIFIED ):caption := iif( ::qDocument:isModified(), "Modified", iif( ::qEdit:isReadOnly(), "ReadOnly", " " ) ) + ::oIde:oSBar:getItem( SB_PNL_STREAM ):caption := "Stream" ::oIde:oSBar:getItem( SB_PNL_EDIT ):caption := "Edit" @@ -413,10 +403,19 @@ METHOD IdeEditor:dispEditInfo() METHOD IdeEditor:setTabImage() LOCAL nIndex := ::qTabWidget:indexOf( ::oTab:oWidget ) LOCAL lModified := ::qDocument:isModified() + LOCAL lReadOnly := ::qEdit:isReadOnly() + LOCAL cIcon - ::qTabWidget:setTabIcon( nIndex, ::oIde:resPath + iif( lModified, "tabmodified.png", "tabunmodified.png" ) ) + IF lModified + cIcon := "tabmodified.png" + ELSEIF lReadOnly + cIcon := "tabreadonly.png" + ELSE + cIcon := "tabunmodified.png" + ENDIF - ::oIde:oSBar:getItem( SB_PNL_MODIFIED ):caption := iif( lModified, "Modified", " " ) + ::qTabWidget:setTabIcon( nIndex, ::resPath + cIcon ) + ::oSBar:getItem( SB_PNL_MODIFIED ):caption := iif( lModified, "Modified", iif( lReadOnly, "ReadOnly", " " ) ) RETURN Self @@ -465,10 +464,10 @@ METHOD IdeEditor:applyTheme( cTheme ) IF ::cType != "U" IF empty( cTheme ) - cTheme := ::oIde:oThemes:selectTheme() + cTheme := ::oThemes:selectTheme() ENDIF - IF ::oIde:oThemes:contains( cTheme ) + IF ::oThemes:contains( cTheme ) ::cTheme := cTheme ::qHiliter := ::oIde:oThemes:SetSyntaxHilighting( ::qEdit, @::cTheme ) ENDIF diff --git a/harbour/contrib/hbide/idefindreplace.prg b/harbour/contrib/hbide/idefindreplace.prg index 82e4119d78..9d9539f9fe 100644 --- a/harbour/contrib/hbide/idefindreplace.prg +++ b/harbour/contrib/hbide/idefindreplace.prg @@ -71,12 +71,7 @@ /*----------------------------------------------------------------------*/ -CLASS IdeFindReplace - - DATA oIde - DATA oFR - - ACCESS qCurEdit INLINE ::oIde:qCurEdit +CLASS IdeFindReplace INHERIT IdeObject METHOD new() METHOD create() @@ -107,36 +102,36 @@ METHOD IdeFindReplace:create( oIde ) ::oIde := oIde - ::oFR := XbpQtUiLoader():new( ::oIde:oDlg ) - ::oFR:file := ::oIde:resPath + "finddialog.ui" - ::oFR:create() - ::oFR:setWindowFlags( Qt_Sheet ) + ::oUI := XbpQtUiLoader():new( ::oIde:oDlg ) + ::oUI:file := ::oIde:resPath + "finddialog.ui" + ::oUI:create() + ::oUI:setWindowFlags( Qt_Sheet ) - aeval( ::oIde:aIni[ INI_FIND ], {|e| ::oFR:qObj[ "comboFindWhat" ]:addItem( e ) } ) - aeval( ::oIde:aIni[ INI_REPLACE ], {|e| ::oFR:qObj[ "comboReplaceWith" ]:addItem( e ) } ) + aeval( ::oIde:aIni[ INI_FIND ], {|e| ::oUI:q_comboFindWhat:addItem( e ) } ) + aeval( ::oIde:aIni[ INI_REPLACE ], {|e| ::oUI:q_comboReplaceWith:addItem( e ) } ) - ::oFR:qObj[ "radioFromCursor" ]:setChecked( .t. ) - ::oFR:qObj[ "radioDown" ]:setChecked( .t. ) + ::oUI:q_radioFromCursor:setChecked( .t. ) + ::oUI:q_radioDown:setChecked( .t. ) - ::oFR:signal( "buttonFind" , "clicked()", {|| ::onClickFind() } ) - ::oFR:signal( "buttonReplace", "clicked()", {|| ::onClickReplace() } ) - ::oFR:signal( "buttonClose" , "clicked()", ; - {|| ::oIde:aIni[ INI_HBIDE, FindDialogGeometry ] := PosAndSize( ::oFR:oWidget ), ::oFR:hide() } ) + ::oUI:signal( "buttonFind" , "clicked()", {|| ::onClickFind() } ) + ::oUI:signal( "buttonReplace", "clicked()", {|| ::onClickReplace() } ) + ::oUI:signal( "buttonClose" , "clicked()", ; + {|| ::oIde:aIni[ INI_HBIDE, FindDialogGeometry ] := hbide_posAndSize( ::oUI:oWidget ), ::oUI:hide() } ) - ::oFR:signal( "comboFindWhat", "currentIndexChanged(text)", ; + ::oUI:signal( "comboFindWhat", "currentIndexChanged(text)", ; {|o,p| o := o, ::oIde:oSBar:getItem( SB_PNL_SEARCH ):caption := "FIND: " + p } ) - ::oFR:signal( "checkListOnly", "stateChanged(int)", {|o,p| o := o, ; - ::oFR:qObj[ "comboReplaceWith" ]:setEnabled( p == 0 ), ; - iif( p == 1, ::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. ), NIL ) } ) + ::oUI:signal( "checkListOnly", "stateChanged(int)", {|o,p| o := o, ; + ::oUI:q_comboReplaceWith:setEnabled( p == 0 ), ; + iif( p == 1, ::oUI:q_buttonReplace:setEnabled( .f. ), NIL ) } ) RETURN Self /*----------------------------------------------------------------------*/ METHOD IdeFindReplace:destroy() - ::oFR:hide() - ::oFR:oWidget:pPtr := 0 + ::oUI:hide() + ::oUI:oWidget:pPtr := 0 RETURN Self @@ -144,13 +139,13 @@ METHOD IdeFindReplace:destroy() METHOD IdeFindReplace:show() - ::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. ) - ::oFR:qObj[ "checkGlobal" ]:setEnabled( .f. ) - ::oFR:qObj[ "checkNoPrompting" ]:setEnabled( .f. ) - ::oFR:qObj[ "checkListOnly" ]:setChecked( .f. ) - ::oIde:setPosByIni( ::oFR:oWidget, FindDialogGeometry ) - ::oFR:qObj[ "comboFindWhat" ]:setFocus() - ::oFR:show() + ::oUI:q_buttonReplace:setEnabled( .f. ) + ::oUI:q_checkGlobal:setEnabled( .f. ) + ::oUI:q_checkNoPrompting:setEnabled( .f. ) + ::oUI:q_checkListOnly:setChecked( .f. ) + ::oIde:setPosByIni( ::oUI:oWidget, FindDialogGeometry ) + ::oUI:q_comboFindWhat:setFocus() + ::oUI:show() RETURN Self @@ -160,7 +155,7 @@ METHOD IdeFindReplace:onClickReplace() ::updateFindReplaceData( "replace" ) - IF ::oFR:qObj[ "comboReplaceWith" ]:isEnabled() + IF ::oUI:q_comboReplaceWith:isEnabled() ::replace() ENDIF @@ -196,20 +191,20 @@ METHOD IdeFindReplace:replace() LOCAL nFound IF !empty( ::qCurEdit ) - cReplWith := QLineEdit():configure( ::oFR:qObj[ "comboReplaceWith" ]:lineEdit() ):text() + cReplWith := QLineEdit():configure( ::oUI:q_comboReplaceWith:lineEdit() ):text() ::replaceSelection( cReplWith ) - IF ::oFR:qObj[ "checkGlobal" ]:isChecked() - IF ::oFR:qObj[ "checkNoPrompting" ]:isChecked() + IF ::oUI:q_checkGlobal:isChecked() + IF ::oUI:q_checkNoPrompting:isChecked() nFound := 1 DO WHILE ::find( .f. ) nFound++ ::replaceSelection( cReplWith ) ENDDO - ::oIde:oSBar:getItem( SB_PNL_MAIN ):caption := 'Replaced [' + hb_ntos( nFound ) + "] : "+ cReplWith + "" - ::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. ) - ::oFR:qObj[ "checkGlobal" ]:setChecked( .f. ) - ::oFR:qObj[ "checkNoPrompting" ]:setChecked( .f. ) + ::oSBar:getItem( SB_PNL_MAIN ):caption := 'Replaced [' + hb_ntos( nFound ) + "] : "+ cReplWith + "" + ::oUI:q_buttonReplace:setEnabled( .f. ) + ::oUI:q_checkGlobal:setChecked( .f. ) + ::oUI:q_checkNoPrompting:setChecked( .f. ) ELSE ::find() ENDIF @@ -225,8 +220,8 @@ METHOD IdeFindReplace:onClickFind() ::updateFindReplaceData( "find" ) - IF ::oFR:qObj[ "radioEntire" ]:isChecked() - ::oFR:qObj[ "radioFromCursor" ]:setChecked( .t. ) + IF ::oUI:q_radioEntire:isChecked() + ::oUI:q_radioFromCursor:setChecked( .t. ) qCursor := QTextCursor():configure( ::qCurEdit:textCursor() ) nPos := qCursor:position() @@ -241,13 +236,13 @@ METHOD IdeFindReplace:onClickFind() ENDIF IF lFound - ::oFR:qObj[ "buttonReplace" ]:setEnabled( .t. ) - ::oFR:qObj[ "checkGlobal" ]:setEnabled( .t. ) - ::oFR:qObj[ "checkNoPrompting" ]:setEnabled( .t. ) + ::oUI:q_buttonReplace:setEnabled( .t. ) + ::oUI:q_checkGlobal:setEnabled( .t. ) + ::oUI:q_checkNoPrompting:setEnabled( .t. ) ELSE - ::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. ) - ::oFR:qObj[ "checkGlobal" ]:setEnabled( .f. ) - ::oFR:qObj[ "checkNoPrompting" ]:setEnabled( .f. ) + ::oUI:q_buttonReplace:setEnabled( .f. ) + ::oUI:q_checkGlobal:setEnabled( .f. ) + ::oUI:q_checkNoPrompting:setEnabled( .f. ) ENDIF RETURN Self @@ -256,18 +251,18 @@ METHOD IdeFindReplace:onClickFind() METHOD IdeFindReplace:find( lWarn ) LOCAL nFlags - LOCAL cText := QLineEdit():configure( ::oFR:qObj[ "comboFindWhat" ]:lineEdit() ):text() + LOCAL cText := QLineEdit():configure( ::oUI:q_comboFindWhat:lineEdit() ):text() LOCAL lFound := .f. DEFAULT lWarn TO .t. IF !empty( cText ) nFlags := 0 - nFlags += iif( ::oFR:qObj[ "checkMatchCase" ]:isChecked(), QTextDocument_FindCaseSensitively, 0 ) - nFlags += iif( ::oFR:qObj[ "radioUp" ]:isChecked(), QTextDocument_FindBackward, 0 ) + nFlags += iif( ::oUI:q_checkMatchCase:isChecked(), QTextDocument_FindCaseSensitively, 0 ) + nFlags += iif( ::oUI:q_radioUp:isChecked(), QTextDocument_FindBackward, 0 ) IF !( lFound := ::qCurEdit:find( cText, nFlags ) ) .and. lWarn - ShowWarning( "Cannot find : " + cText ) + hbide_showWarning( "Cannot find : " + cText ) ENDIF ENDIF @@ -279,21 +274,21 @@ METHOD IdeFindReplace:updateFindReplaceData( cMode ) LOCAL cData IF cMode == "find" - cData := QLineEdit():configure( ::oFR:qObj[ "comboFindWhat" ]:lineEdit() ):text() + cData := QLineEdit():configure( ::oUI:q_comboFindWhat:lineEdit() ):text() IF !empty( cData ) IF ascan( ::oIde:aIni[ INI_FIND ], {|e| e == cData } ) == 0 hb_ains( ::oIde:aIni[ INI_FIND ], 1, cData, .t. ) - ::oFR:qObj[ "comboFindWhat" ]:insertItem( 0, cData ) + ::oUI:q_comboFindWhat:insertItem( 0, cData ) ENDIF ENDIF // - ::oIde:oSBar:getItem( SB_PNL_SEARCH ):caption := "FIND: " + cData + ::oSBar:getItem( SB_PNL_SEARCH ):caption := "FIND: " + cData ELSE - cData := QLineEdit():configure( ::oFR:qObj[ "comboReplaceWith" ]:lineEdit() ):text() + cData := QLineEdit():configure( ::oUI:q_comboReplaceWith:lineEdit() ):text() IF !empty( cData ) IF ascan( ::oIde:aIni[ INI_REPLACE ], cData ) == 0 hb_ains( ::oIde:aIni[ INI_REPLACE ], 1, cData, .t. ) - ::oFR:qObj[ "comboReplaceWith" ]:insertItem( 0, cData ) + ::oUI:q_comboReplaceWith:insertItem( 0, cData ) ENDIF ENDIF ENDIF diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 091a8eab1e..e621a95185 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -92,12 +92,12 @@ PROCEDURE AppSys() /*----------------------------------------------------------------------*/ -PROCEDURE JustACall() +PROCEDURE hbide_justACall() RETURN /*----------------------------------------------------------------------*/ -FUNCTION ExecPopup( aPops, aPos, qParent ) +FUNCTION hbide_execPopup( aPops, aPos, qParent ) LOCAL i, qPop, qPoint, qAct, nAct, cAct, xRet, pAct qPop := QMenu():new( IIF( hb_isObject( qParent ), qParent, NIL ) ) @@ -126,7 +126,7 @@ FUNCTION ExecPopup( aPops, aPos, qParent ) /*----------------------------------------------------------------------*/ -FUNCTION MenuAddSep( oMenu ) +FUNCTION hbide_menuAddSep( oMenu ) oMenu:addItem( { NIL, NIL, XBPMENUBAR_MIS_SEPARATOR, NIL } ) @@ -134,7 +134,7 @@ FUNCTION MenuAddSep( oMenu ) /*----------------------------------------------------------------------*/ -FUNCTION CreateTarget( cFile, txt_ ) +FUNCTION hbide_createTarget( cFile, txt_ ) LOCAL hHandle := fcreate( cFile ) LOCAL cNewLine := hb_OsNewLine() @@ -147,14 +147,14 @@ FUNCTION CreateTarget( cFile, txt_ ) /*----------------------------------------------------------------------*/ -FUNCTION PosAndSize( qWidget ) +FUNCTION hbide_posAndSize( qWidget ) RETURN hb_ntos( qWidget:x() ) + "," + hb_ntos( qWidget:y() ) + "," + ; hb_ntos( qWidget:width() ) + "," + hb_ntos( qWidget:height() ) + "," /*----------------------------------------------------------------------*/ -FUNCTION ShowWarning( cMsg, cInfo, cTitle ) +FUNCTION hbide_showWarning( cMsg, cInfo, cTitle ) LOCAL oMB DEFAULT cTitle TO "Information" @@ -173,7 +173,7 @@ FUNCTION ShowWarning( cMsg, cInfo, cTitle ) /*----------------------------------------------------------------------*/ -FUNCTION GetYesNo( cMsg, cInfo, cTitle ) +FUNCTION hbide_getYesNo( cMsg, cInfo, cTitle ) LOCAL oMB DEFAULT cTitle TO "Option Please!" @@ -193,7 +193,7 @@ FUNCTION GetYesNo( cMsg, cInfo, cTitle ) /*----------------------------------------------------------------------*/ -FUNCTION GetYesNoCancel( cMsg, cInfo, cTitle ) +FUNCTION hbide_getYesNoCancel( cMsg, cInfo, cTitle ) LOCAL oMB DEFAULT cTitle TO "Option Please!" @@ -213,7 +213,7 @@ FUNCTION GetYesNoCancel( cMsg, cInfo, cTitle ) /*----------------------------------------------------------------------*/ -FUNCTION FetchAFile( oWnd, cTitle, aFlt, cDftDir, cDftSuffix ) +FUNCTION hbide_fetchAFile( oWnd, cTitle, aFlt, cDftDir, cDftSuffix ) LOCAL oDlg, cFile DEFAULT cTitle TO "Please Select a File" @@ -235,7 +235,7 @@ FUNCTION FetchAFile( oWnd, cTitle, aFlt, cDftDir, cDftSuffix ) /*----------------------------------------------------------------------*/ -FUNCTION SaveAFile( oWnd, cTitle, aFlt, cDftFile, cDftSuffix ) +FUNCTION hbide_saveAFile( oWnd, cTitle, aFlt, cDftFile, cDftSuffix ) LOCAL oDlg, cFile DEFAULT cTitle TO "Please Select a File" @@ -257,7 +257,7 @@ FUNCTION SaveAFile( oWnd, cTitle, aFlt, cDftFile, cDftSuffix ) /* Function to user select a existing folder * 25/12/2009 - 19:10:41 - vailtom */ -FUNCTION FetchADir( oWnd, cTitle, cDftDir ) +FUNCTION hbide_fetchADir( oWnd, cTitle, cDftDir ) LOCAL oDlg, cFile DEFAULT cTitle TO "Please Select a Folder" @@ -280,16 +280,18 @@ FUNCTION FetchADir( oWnd, cTitle, cDftDir ) /*----------------------------------------------------------------------*/ -FUNCTION ReadSource( cTxtFile ) +FUNCTION hbide_readSource( cTxtFile ) LOCAL cFileBody := hb_MemoRead( cTxtFile ) + HB_TRACE( HB_TR_DEBUG, cFileBody ) + cFileBody := StrTran( cFileBody, Chr( 13 ) ) RETURN hb_ATokens( cFileBody, Chr( 10 ) ) /*----------------------------------------------------------------------*/ -FUNCTION EvalAsString( cExp ) +FUNCTION hbide_evalAsString( cExp ) LOCAL cValue BEGIN SEQUENCE WITH { || break() } @@ -306,17 +308,17 @@ FUNCTION EvalAsString( cExp ) /*----------------------------------------------------------------------*/ -FUNCTION FetchHbiStructFromBuffer( cBuffer ) - RETURN PullHbiStruct( hb_atokens( cBuffer, _EOL ) ) +FUNCTION hbide_fetchHbiStructFromBuffer( cBuffer ) + RETURN hbide_pullHbiStruct( hb_atokens( cBuffer, _EOL ) ) /*----------------------------------------------------------------------*/ -FUNCTION FetchHbiStructFromFile( cProject ) - RETURN PullHbiStruct( ReadSource( cProject ) ) +FUNCTION hbide_fetchHbiStructFromFile( cProject ) + RETURN hbide_pullHbiStruct( hbide_readSource( cProject ) ) /*----------------------------------------------------------------------*/ -STATIC FUNCTION PullHbiStruct( a_ ) +STATIC FUNCTION hbide_pullHbiStruct( a_ ) LOCAL n, s, nPart, cKey, cVal, ss LOCAL aPrp := { "Type", "Title", "Location", "WorkingFolder", "DestinationFolder", ; "Output", "LaunchParams", "LaunchProgram" } @@ -334,7 +336,7 @@ STATIC FUNCTION PullHbiStruct( a_ ) FOR EACH ss IN a_ s := alltrim( ss ) - IF .t. + IF !empty( s ) DO CASE CASE s == "[ PROPERTIES ]" nPart := PRJ_PRP_PROPERTIES @@ -359,13 +361,13 @@ STATIC FUNCTION PullHbiStruct( a_ ) CASE nPart == PRJ_PRP_SOURCES aadd( a3_0, s ) - +//HB_TRACE( HB_TR_ALWAYS, s ) CASE nPart == PRJ_PRP_METADATA aadd( a4_0, s ) IF !( "#" == left( s,1 ) ) IF ( n := at( "=", s ) ) > 0 cKey := alltrim( substr( s, 1, n-1 ) ) - cVal := EvalAsString( alltrim( substr( s, n+1 ) ) ) + cVal := hbide_evalAsString( alltrim( substr( s, n+1 ) ) ) aadd( a4_1, { "<"+ cKey +">", cVal } ) ENDIF ENDIF @@ -376,21 +378,22 @@ STATIC FUNCTION PullHbiStruct( a_ ) /* General Properties */ FOR EACH s IN a1_0 - aadd( a1_1, ParseWithMetaData( s, a4_1 ) ) + aadd( a1_1, hbide_parseWithMetaData( s, a4_1 ) ) NEXT /* Parse Flags */ IF !empty( a2_0 ) FOR EACH s IN a2_0 - aadd( a2_1, ParseWithMetaData( s, a4_1 ) ) + aadd( a2_1, hbide_parseWithMetaData( s, a4_1 ) ) NEXT ENDIF /* Parse Files */ IF !empty( a3_0 ) FOR EACH s IN a3_0 +//HB_TRACE( HB_TR_ALWAYS, "Files ", s ) IF !( "#" == left( s,1 ) ) .and. !empty( s ) - aadd( a3_1, ParseWithMetaData( s, a4_1 ) ) + aadd( a3_1, hbide_parseWithMetaData( s, a4_1 ) ) ENDIF NEXT ENDIF @@ -401,7 +404,7 @@ STATIC FUNCTION PullHbiStruct( a_ ) /*----------------------------------------------------------------------*/ -FUNCTION SetupMetaKeys( a_ ) +FUNCTION hbide_setupMetaKeys( a_ ) LOCAL s, n, cKey, cVal LOCAL a4_1 := {} @@ -409,7 +412,7 @@ FUNCTION SetupMetaKeys( a_ ) IF !( "#" == left( s,1 ) ) IF ( n := at( "=", s ) ) > 0 cKey := alltrim( substr( s, 1, n-1 ) ) - cVal := EvalAsString( alltrim( substr( s, n+1 ) ) ) + cVal := hbide_evalAsString( alltrim( substr( s, n+1 ) ) ) aadd( a4_1, { "<"+ cKey +">", cVal } ) ENDIF ENDIF @@ -419,12 +422,12 @@ FUNCTION SetupMetaKeys( a_ ) /*----------------------------------------------------------------------*/ -FUNCTION ApplyMetaData( s, a_ ) +FUNCTION hbide_applyMetaData( s, a_ ) LOCAL k IF ! Empty( a_ ) FOR EACH k IN a_ - s := StrTran( s, PathNormalized( k[ 2 ], .f. ), k[ 1 ] ) + s := StrTran( s, hbide_pathNormalized( k[ 2 ], .f. ), k[ 1 ] ) NEXT ENDIF @@ -432,7 +435,7 @@ FUNCTION ApplyMetaData( s, a_ ) /*----------------------------------------------------------------------*/ -FUNCTION ParseWithMetaData( s, a_ ) +FUNCTION hbide_parseWithMetaData( s, a_ ) LOCAL k IF ! Empty( a_ ) @@ -445,7 +448,7 @@ FUNCTION ParseWithMetaData( s, a_ ) /*----------------------------------------------------------------------*/ -FUNCTION ArrayToMemo( a_ ) +FUNCTION hbide_arrayToMemo( a_ ) LOCAL s := "" aeval( a_, {|e| s += e + CRLF } ) @@ -456,7 +459,7 @@ FUNCTION ArrayToMemo( a_ ) /*----------------------------------------------------------------------*/ -FUNCTION MemoToArray( s ) +FUNCTION hbide_memoToArray( s ) LOCAL aLine := hb_ATokens( StrTran( RTrim( s ), CRLF, _EOL ), _EOL ) LOCAL nNewSize := 0 LOCAL line @@ -474,7 +477,7 @@ FUNCTION MemoToArray( s ) /*----------------------------------------------------------------------*/ -FUNCTION IsValidPath( cPath, cPathDescr ) +FUNCTION hbide_isValidPath( cPath, cPathDescr ) DEFAULT cPathDescr TO '' @@ -491,18 +494,18 @@ FUNCTION IsValidPath( cPath, cPathDescr ) /*----------------------------------------------------------------------*/ -FUNCTION IsValidText( cSourceFile ) +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" ) + ".cc,.hbc,.hbp,.hbm,.xml,.bat,.sh,.rc" ) /*----------------------------------------------------------------------*/ -FUNCTION IsValidSource( cSourceFile ) +FUNCTION hbide_isValidSource( cSourceFile ) LOCAL cExt hb_fNameSplit( cSourceFile, , , @cExt ) @@ -512,7 +515,7 @@ FUNCTION IsValidSource( cSourceFile ) /*----------------------------------------------------------------------*/ -FUNCTION PathNormalized( cPath, lLower ) +FUNCTION hbide_pathNormalized( cPath, lLower ) LOCAL S DEFAULT lLower TO .T. @@ -521,6 +524,15 @@ FUNCTION PathNormalized( cPath, lLower ) RETURN IIF( lLower, lower( s ), s ) +/*----------------------------------------------------------------------*/ + +FUNCTION hbide_pathToOSPath( cPath ) + + cPath := strtran( cPath, "/", hb_osPathSeparator() ) + cPath := strtran( cPath, "\", hb_osPathSeparator() ) + + RETURN cPath + /*----------------------------------------------------------------------*/ /* * This function fills an array with the list of regular expressions that will @@ -535,7 +547,8 @@ FUNCTION PathNormalized( cPath, lLower ) #define CLR_MSG_INFO 'brown' #define CLR_MSG_WARN 'blue' -STATIC FUNCTION BuildRegExpressList( aRegList ) +STATIC FUNCTION hbide_buildRegExpressList( aRegList ) + AAdd( aRegList, { MSG_TYPE_WARN, hb_RegexComp( ".*: warning.*" ) } ) AAdd( aRegList, { MSG_TYPE_WARN, hb_RegexComp( ".*\) Warning W.*" ) } ) AAdd( aRegList, { MSG_TYPE_WARN, hb_RegexComp( "^Warning W([0-9]+).*" ) } ) @@ -558,7 +571,7 @@ STATIC FUNCTION BuildRegExpressList( aRegList ) * Catch source file name & line error from an msg status from compiler result. * 29/12/2009 - 13:22:29 - vailtom */ -FUNCTION ParseFNfromStatusMsg( cText, cFileName, nLine, lValidText ) +FUNCTION hbide_parseFNfromStatusMsg( cText, cFileName, nLine, lValidText ) LOCAL regLineN := hb_RegexComp( ".*(\(([0-9]+)\)|:([0-9]+):|\s([0-9]+):).*" ) LOCAL aList LOCAL nPos @@ -643,7 +656,7 @@ FUNCTION ParseFNfromStatusMsg( cText, cFileName, nLine, lValidText ) * * 28/12/2009 - 16:17:37 */ -FUNCTION ConvertBuildStatusMsgToHtml( cText, oWidget ) +FUNCTION hbide_convertBuildStatusMsgToHtml( cText, oWidget ) LOCAL aColors := { CLR_MSG_ERR, CLR_MSG_INFO, CLR_MSG_WARN } LOCAL aLines LOCAL cLine @@ -651,11 +664,9 @@ FUNCTION ConvertBuildStatusMsgToHtml( cText, oWidget ) IF aRegList == NIL aRegList := {} - BuildRegExpressList( aRegList ) + hbide_BuildRegExpressList( aRegList ) End - oWidget:clear() - cText := StrTran( cText, Chr( 13 ) + Chr( 10 ), Chr( 10 ) ) cText := StrTran( cText, Chr( 13 ) , Chr( 10 ) ) cText := StrTran( cText, Chr( 10 ) + Chr( 10 ), Chr( 10 ) ) @@ -686,12 +697,12 @@ FUNCTION ConvertBuildStatusMsgToHtml( cText, oWidget ) /*----------------------------------------------------------------------*/ -FUNCTION FilesToSources( aFiles ) +FUNCTION hbide_filesToSources( aFiles ) LOCAL aSrc := {} LOCAL s FOR EACH s IN aFiles - IF IsValidSource( s ) + IF hbide_isValidSource( s ) aadd( aSrc, s ) ENDIF NEXT @@ -700,7 +711,7 @@ FUNCTION FilesToSources( aFiles ) /*----------------------------------------------------------------------*/ -FUNCTION ParseKeyValPair( s, cKey, cVal ) +FUNCTION hbide_parseKeyValPair( s, cKey, cVal ) LOCAL n, lYes := .f. IF ( n := at( "=", s ) ) > 0 @@ -713,30 +724,28 @@ FUNCTION ParseKeyValPair( s, cKey, cVal ) /*----------------------------------------------------------------------*/ -FUNCTION IdeDbg( ... ) +FUNCTION hbide_dbg( ... ) HB_TRACE( HB_TR_ALWAYS, ... ) RETURN nil /*----------------------------------------------------------------------*/ - /* * Return the next untitled filename available. * 01/01/2010 - 19:40:17 - vailtom */ -FUNCTION GetNextUntitled() +FUNCTION hbide_getNextUntitled() STATIC nCount := 0 nCount ++ RETURN nCount /*----------------------------------------------------------------------*/ - /* * Return the next TAB_ID or IDE_ID available. * 02/01/2010 - 10:47:16 - vailtom */ -FUNCTION GetNextUniqueID() +FUNCTION hbide_getNextUniqueID() STATIC nCount := 0 - + IF nCount > 4294967295 nCount := 0 ENDIF @@ -747,7 +756,7 @@ FUNCTION GetNextUniqueID() * Check if cFilename has a extension... and add cDefaultExt if not exist. * 01/01/2010 - 20:48:10 - vailtom */ -FUNCTION CheckDefaultExtension( cFileName, cDefaultExt ) +FUNCTION hbide_checkDefaultExtension( cFileName, cDefaultExt ) LOCAL cPath, cFile, cExt hb_fNameSplit( cFileName, @cPath, @cFile, @cExt ) IF Empty( cExt ) @@ -757,7 +766,7 @@ FUNCTION CheckDefaultExtension( cFileName, cDefaultExt ) /*----------------------------------------------------------------------*/ -FUNCTION hbide_PathProc( cPathR, cPathA ) +FUNCTION hbide_pathProc( cPathR, cPathA ) LOCAL cDirA LOCAL cDirR, cDriveR, cNameR, cExtR @@ -781,3 +790,126 @@ FUNCTION hbide_PathProc( cPathR, cPathA ) /*----------------------------------------------------------------------*/ +function hbide_toString( x, lLineFeed, lInherited, lType, cFile, lForceLineFeed ) + LOCAL s := '' + LOCAL t := valtype( x ) + LOCAL i, j + + DEFAULT lLineFeed TO .T. + DEFAULT lInherited TO .F. + DEFAULT lType TO .F. + DEFAULT cFile TO "" + DEFAULT lForceLineFeed TO .F. + + do case + case ( t == "C" ) + s := iif( lType, "[C]=", "" ) + '"' + x + '"' + case ( t == "N" ) + s := iif( lType, "[N]=", "" ) + alltrim(str( x )) + case ( t == "D" ) + s := iif( lType, "[D]=", "" ) + "ctod('"+ dtoc(x) +"')" + case ( t == "L" ) + s := iif( lType, "[L]=", "" ) + iif( x, '.T.', '.F.' ) + case ( t == "M" ) + s := iif( lType, "[M]=", "" ) + '"' + x + '"' + case ( t == "B" ) + s := iif( lType, "[B]=", "" ) + '{|| ... }' + case ( t == "U" ) + s := iif( lType, "[U]=", "" ) + 'NIL' + case ( t == "A" ) + s := iif( lType, "[A]=", "" ) + "{" + if len(x) = 0 + s += " " + else + s += iif( valtype( x[1] ) = "A" .or. lForceLineFeed, CRLF, "" ) + j := len(x) + + for i := 1 to j + s += iif( valtype( x[i] ) == "A", " ", " " ) + iif( lForceLineFeed, " ", "" ) + hbide_toString( x[i], .F. ) + s += iif( i <> j, ",", "" ) + if lLineFeed + if !lInherited .and. ( valtype( x[i] ) == "A" .or. lForceLineFeed ) + s += CRLF + endif + endif + next + endif + s += iif( !lForceLineFeed, " ", "" ) + "}" + + case ( t == "O" ) + if lInherited + && É necessário linkar \harbour\lib\xhb.lib + **s := iif( lType, "[O]=", "" ) + hb_dumpvar( x ) + iif( lLineFeed, CRLF, "" ) + s := '' + iif( lLineFeed, CRLF, "" ) + else + s := iif( lType, "[O]=", "" ) + x:ClassName()+'():New()' + iif( lLineFeed, CRLF, "" ) + endif + endcase + + if !empty( cFile ) + memowrit( cFile, s ) + endif + + return s + +/*----------------------------------------------------------------------*/ + +FUNCTION hbide_help( nOption ) + LOCAL txt_ := {} + LOCAL tit_ := '' + + SWITCH nOption + CASE 1 + tit_ := 'About hbIde' + AAdd( txt_, "Harbour IDE ( hbIDE )" ) + AAdd( txt_, "Developed by" ) + AAdd( txt_, "Pritpal Bedi ( pritpal@vouchcac.com )" ) + AAdd( txt_, "" ) + AAdd( txt_, "built with:" ) + AAdd( txt_, HB_VERSION() ) + AAdd( txt_, HB_COMPILER() ) + AAdd( txt_, "Qt " + QT_VERSION_STR() ) + AAdd( txt_, "" ) + AAdd( txt_, "Visit the project website at:" ) + AAdd( txt_, "http://www.harbour-project.org/" ) + EXIT + + CASE 2 + tit_ := 'Mailing List' + AAdd( txt_, "Harbour Developers Mailing List" ) + AAdd( txt_, "" ) + AAdd( txt_, "Please visit the home page:" ) + AAdd( txt_, "http://lists.harbour-project.org/pipermail/harbour/" ) + EXIT + + CASE 3 + tit_ := 'Mailing List' + AAdd( txt_, "Harbour Users Mailing List" ) + AAdd( txt_, "" ) + AAdd( txt_, "Please visit the home page:" ) + AAdd( txt_, "http://lists.harbour-project.org/pipermail/harbour/" ) + EXIT + + CASE 4 + tit_ := 'About Harbour' + AAdd( txt_, "About Harbour" ) + AAdd( txt_, "" ) + AAdd( txt_, '"The Harbour Project is a Free Open Source Software effort to build' ) + AAdd( txt_, 'a multiplatform Clipper language compiler. Harbour consists of the' ) + AAdd( txt_, 'xBase language compiler and the runtime libraries with different' ) + AAdd( txt_, 'terminal plugins and different databases (not just DBF)"' ) + AAdd( txt_, "" ) + AAdd( txt_, "Get downloads, samples, contribs and much more at:" ) + AAdd( txt_, "http://www.harbour-project.org/" ) + EXIT + + END + + IF !Empty( txt_ ) + MsgBox( hbide_arrayToMemo( txt_ ), tit_ ) + ENDIF + + RETURN nil + +/*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbide/ideobject.prg b/harbour/contrib/hbide/ideobject.prg new file mode 100644 index 0000000000..6675416f00 --- /dev/null +++ b/harbour/contrib/hbide/ideobject.prg @@ -0,0 +1,150 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * + * Copyright 2009-2010 Pritpal Bedi + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/* + * EkOnkar + * ( The LORD is ONE ) + * + * Harbour-Qt IDE + * + * Pritpal Bedi + * 03Jan2010 + */ +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ + +#include "hbide.ch" +#include "common.ch" +#include "hbclass.ch" + +/*----------------------------------------------------------------------*/ + +CLASS IdeObject + + ACCESS pSlots INLINE hbxbp_getSlotsPtr() + ACCESS pEvents INLINE hbxbp_getEventsPtr() + + DATA oIde + DATA oUI + + ACCESS qCurEdit INLINE ::oIde:qCurEdit + ACCESS qTabWidget INLINE ::oIde:oDA:oTabWidget:oWidget + + ACCESS cWrkProject INLINE ::oIde:cWrkProject + ACCESS aProjects INLINE ::oIde:aProjects + ACCESS aINI INLINE ::oIde:aINI + + ACCESS oDlg INLINE ::oIde:oDlg + ACCESS oDA INLINE ::oIde:oDA + + ACCESS oDockPT INLINE ::oIde:oDockPT + ACCESS oProjTree INLINE ::oIde:oProjTree + ACCESS oProjRoot INLINE ::oIde:oProjRoot + ACCESS aProjData INLINE ::oIde:aProjData + + ACCESS oDockED INLINE ::oIde:oDockED + ACCESS oEditTree INLINE ::oIde:oEditTree + ACCESS oOpenedSources INLINE ::oIde:oOpenedSources + + ACCESS oDockR INLINE ::oIde:oDockR + ACCESS oFuncList INLINE ::oIde:oFuncList + + ACCESS oDockB INLINE ::oIde:oDockB + ACCESS oCompileResult INLINE ::oIde:oCompileResult + + ACCESS oDockB1 INLINE ::oIde:oDockB1 + ACCESS oLinkResult INLINE ::oIde:oLinkResult + + ACCESS oDockB2 INLINE ::oIde:oDockB2 + ACCESS oOutputResult INLINE ::oIde:oOutputResult + + ACCESS resPath INLINE ::oIde:resPath + ACCESS pathSep INLINE ::oIde:pathSep + ACCESS oFont INLINE ::oIde:oFont + ACCESS oThemes INLINE ::oIde:oThemes + ACCESS aTabs INLINE ::oIde:aTabs + + ACCESS lProjTreeVisible INLINE ::oIde:lProjTreeVisible + ACCESS lDockRVisible INLINE ::oIde:lDockRVisible + ACCESS lDockBVisible INLINE ::oIde:lDockBVisible + ACCESS lTabCloseRequested INLINE ::oIde:lTabCloseRequested + ACCESS oSBar INLINE ::oIde:oSBar + + METHOD new() VIRTUAL + METHOD create() VIRTUAL + METHOD destroy() VIRTUAL + + ERROR HANDLER OnError() + + ENDCLASS + +/*----------------------------------------------------------------------*/ + +METHOD IdeObject:onError( ... ) + LOCAL cMsg + + cMsg := __GetMessage() + IF SubStr( cMsg, 1, 1 ) == "_" + cMsg := SubStr( cMsg, 2 ) + ENDIF + + IF left( cMsg, 2 ) == "Q_" + RETURN ::oUI:&cMsg( ... ) + ELSE + RETURN ::oIde:&cMsg( ... ) + ENDIF + + RETURN nil + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg new file mode 100644 index 0000000000..64b6d235ba --- /dev/null +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -0,0 +1,872 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * + * Copyright 2009-2010 Pritpal Bedi + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/* + * EkOnkar + * ( The LORD is ONE ) + * + * Harbour-Qt IDE + * + * Pritpal Bedi + * 03Jan2010 + */ +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ + +#include "hbide.ch" +#include "hbqt.ch" +#include "common.ch" +#include "hbclass.ch" + +/*----------------------------------------------------------------------*/ + +CLASS IdeProjManager INHERIT IdeObject + + DATA cSaveTo + DATA aPrjProps INIT {} + + DATA qProcess + DATA nStarted INIT 0 + DATA cFileOut + DATA cFileErr + + METHOD new() + METHOD create() + METHOD destroy() + + METHOD populate() + METHOD loadProperties() + METHOD fetchProperties() + METHOD save() + METHOD updateHbp() + METHOD addSources() + METHOD getCurrentProject() + METHOD setCurrentProject() + METHOD selectCurrentProject() + METHOD closeProject() + METHOD promptForPath() + METHOD launchProject() + METHOD buildProject() + METHOD buildProjectViaQt() + METHOD readProcessInfo() + + ENDCLASS + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:new( oIde ) + + ::oIde := oIde + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:create( oIde ) + + DEFAULT oIde TO ::oIde + + ::oIde := oIde + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:destroy() + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:populate() + LOCAL cProject + + FOR EACH cProject IN ::aINI[ INI_PROJECTS ] + ::loadProperties( cProject, .f., .f., .T. ) + NEXT + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:loadProperties( cProject, lNew, lFetch, lUpdateTree ) + LOCAL n, t, cWrkProject + + DEFAULT cProject TO "" + DEFAULT lNew TO .F. + DEFAULT lFetch TO .T. + DEFAULT lUpdateTree TO .F. + + /* Never touch original project file sent */ + + ::aPrjProps := {} + ::cSaveTo := "" + + IF lNew + lFetch := .t. + ELSE + IF empty( cProject ) + cProject := hbide_fetchAFile( ::oDlg, "Load Project...", { { "Harbour IDE Projects (*.hbi)", "*.hbi" } } ) + ENDIF + IF empty( cProject ) + RETURN Self + ENDIF + ENDIF + + n := 0 + IF !empty( cProject ) + cWrkProject := hbide_pathNormalized( cProject ) /* 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 ) ) + ENDIF + ENDIF + + IF lFetch + ::fetchProperties() + IF !empty( ::cSaveTo ) .and. file( ::cSaveTo ) + cProject := ::cSaveTo + ::aPrjProps := hbide_fetchHbiStructFromFile( hbide_pathToOSPath( cProject ) ) /* Reload from file */ + ENDIF + ENDIF + + IF n == 0 + aadd( ::oIde:aProjects, { lower( cProject ), cProject, aclone( ::aPrjProps ) } ) + IF lUpdateTree + ::updateProjectTree( ::aPrjProps ) + ENDIF + hbide_mnuAddFileToMRU( ::oIde, cProject, INI_RECENTPROJECTS ) + ELSE + ::aProjects[ n, 3 ] := aclone( ::aPrjProps ) + IF lUpdateTree + ::updateProjectTree( ::aPrjProps ) + ENDIF + IF lUpdateTree .AND. ::aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] <> t + MsgBox( "::removeProjectFromTree( ::aPrjProps )" ) + ENDIF + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:fetchProperties() + LOCAL cPrjLoc := hb_dirBase() + "projects" + + ::oUI := XbpQtUiLoader():new( ::oDlg ) + ::oUI:file := ::resPath + "projectproperties.ui" + ::oUI:create() + + ::oUI:q_comboPrjType:addItem( "Executable" ) + ::oUI:q_comboPrjType:addItem( "Library" ) + ::oUI:q_comboPrjType:addItem( "Dll" ) + + DO CASE + CASE empty( ::aPrjProps ) + ::oUI:q_comboPrjType:setCurrentIndex( 0 ) + CASE ::aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Lib" + ::oUI:q_comboPrjType:setCurrentIndex( 1 ) + CASE ::aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Dll" + ::oUI:q_comboPrjType:setCurrentIndex( 2 ) + OTHERWISE + ::oUI:q_comboPrjType:setCurrentIndex( 0 ) + ENDCASE + + ::oUI:signal( "buttonCn" , "clicked()", {|| ::oUI:oWidget:close() } ) + ::oUI:signal( "buttonSave" , "clicked()", {|| ::save( .F. ) } ) + ::oUI:signal( "buttonSaveExit", "clicked()", {|| ::save( .T. ) } ) + ::oUI:signal( "buttonSelect" , "clicked()", {|| ::addSources() } ) + ::oUI:signal( "tabWidget" , "currentChanged(int)", {|o,p| ::updateHbp( p, o ) } ) + + // TODO: Loading lookup.png inside these buttons... + ::oUI:signal( "buttonChoosePrjLoc", "clicked()", {|| ::PromptForPath( 'editPrjLoctn', 'Choose the Project Location...', 'editOutName', "editWrkFolder", "editDstFolder" ) } ) + ::oUI:signal( "buttonChooseWd" , "clicked()", {|| ::PromptForPath( 'editWrkFolder', 'Choose a Working Folder...' ) } ) + ::oUI:signal( "buttonChooseDest" , "clicked()", {|| ::PromptForPath( 'editDstFolder', 'Choose a Destination Folder...' ) } ) + + IF empty( ::aPrjProps ) + /* + * When they click on the button to confirm the name of the project, we + * will adjust the other parameters. (vailtoms) + * 25/12/2009 - 20:40:22 + */ + ::oUI:q_editPrjLoctn:setText( StrTran( cPrjLoc, '\', '/' ) ) + + ELSE + ::oUI:q_editPrjTitle:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_TITLE ] ) + ::oUI:q_editPrjLoctn:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_LOCATION ] ) + ::oUI:q_editWrkFolder:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_WRKFOLDER ] ) + ::oUI:q_editDstFolder:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_DSTFOLDER ] ) + ::oUI:q_editOutName:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_OUTPUT ] ) + + ::oUI:q_editFlags:setPlainText( hbide_arrayToMemo( ::aPrjProps[ PRJ_PRP_FLAGS , 1 ] ) ) + ::oUI:q_editSources:setPlainText( hbide_arrayToMemo( ::aPrjProps[ PRJ_PRP_SOURCES , 1 ] ) ) + ::oUI:q_editMetaData:setPlainText( hbide_arrayToMemo( ::aPrjProps[ PRJ_PRP_METADATA, 1 ] ) ) + ::oUI:q_editCompilers:setPlainText( memoread( hb_dirBase() + "hbide.env" ) ) + + #if 0 + ::oUI:q_editLaunchParams:setText() + ::oUI:q_editLaunchExe:setText() + ::oUI:q_editHbp:setPlainText() + #endif + ENDIF + + IF empty( ::aPrjProps ) + ::oUI:oWidget:setWindowTitle( 'New Project...' ) + ELSE + ::oUI:oWidget:setWindowTitle( 'Properties for "' + ::oUI:q_editPrjTitle:Text() + '"' ) + ENDIF + + ::setPosByIni( ::oUI:oWidget, PropsDialogGeometry ) + // + ::oUI:exec() + // + ::aIni[ INI_HBIDE, PropsDialogGeometry ] := hbide_posAndSize( ::oUI:oWidget ) + + ::oUI:destroy() + ::oUI := NIL + + ::manageFocusInEditor() + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:save( lCanClose ) + LOCAL a_, a4_1 + LOCAL typ_:= { "Executable", "Lib", "Dll" } + LOCAL txt_:= {} + LOCAL lOk + + * Validate certain parameters before continuing ... (vailtom) + IF Empty( ::oUI:q_editOutName:text() ) + IF Empty( ::oUI:q_editPrjTitle:text() ) + MsgBox( 'Invalid Output FileName!' ) + ::oUI:q_editOutName:setFocus() + RETURN .F. + ENDIF + ::oUI:q_editOutName:setText( ::oUI:q_editPrjTitle:text() ) + ENDIF + + IF Empty( ::oUI:q_editPrjTitle:text() ) + ::oUI:q_editPrjTitle:setText( ::oUI:q_editOutName:text() ) + ENDIF + + IF !hbide_isValidPath( ::oUI:q_editPrjLoctn:text(), 'Project Location' ) + ::oUI:q_editPrjLoctn:setFocus() + RETURN .F. + ENDIF + + IF !hbide_isValidPath( ::oUI:q_editWrkFolder:text(), 'Working Folder' ) + ::oUI:q_editWrkFolder:setText( ::oUI:q_editPrjLoctn:text() ) + RETURN .F. + ENDIF + + IF !hbide_isValidPath( ::oUI:q_editDstFolder:text(), 'Destination Folder' ) + ::oUI:q_editDstFolder:setText( ::oUI:q_editPrjLoctn:text() ) + RETURN .F. + ENDIF + + aadd( txt_, "[ PROPERTIES ]" ) + aadd( txt_, "Type = " + typ_[ ::oUI:q_comboPrjType:currentIndex()+1 ] ) + aadd( txt_, "Title = " + ::oUI:q_editPrjTitle:text() ) + aadd( txt_, "Location = " + ::oUI:q_editPrjLoctn:text() ) + aadd( txt_, "WorkingFolder = " + ::oUI:q_editWrkFolder:text() ) + aadd( txt_, "DestinationFolder = " + ::oUI:q_editDstFolder:text() ) + aadd( txt_, "Output = " + ::oUI:q_editOutName:text() ) + aadd( txt_, "LaunchParams = " + ::oUI:q_editLaunchParams:text() ) + aadd( txt_, "LaunchProgram = " + ::oUI:q_editLaunchExe:text() ) + aadd( txt_, " " ) + + aadd( txt_, "[ FLAGS ]" ) + a_:= hbide_memoToArray( ::oUI:q_editFlags:toPlainText() ); aeval( a_, {|e| aadd( txt_, e ) } ) ; aadd( txt_, " " ) + aadd( txt_, "[ SOURCES ]" ) + a_:= hbide_memoToArray( ::oUI:q_editSources:toPlainText() ); aeval( a_, {|e| aadd( txt_, e ) } ) ; aadd( txt_, " " ) + aadd( txt_, "[ METADATA ]" ) + a_:= hbide_memoToArray( ::oUI:q_editMetaData:toPlainText() ); aeval( a_, {|e| aadd( txt_, e ) } ) ; aadd( txt_, " " ) + + /* Setup Meta Keys */ + a4_1 := hbide_setupMetaKeys( a_ ) + + ::cSaveTo := hbide_parseWithMetaData( ::oUI:q_editPrjLoctn:text(), a4_1 ) + ; + ::pathSep + ; + hbide_parseWithMetaData( ::oUI:q_editOutName:text(), a4_1 ) + ; + ".hbi" + ::cSaveTo := hbide_pathToOSPath( ::cSaveTo ) + + IF ( lOk := hbide_createTarget( ::cSaveTo, txt_ ) ) + *MsgBox( 'The project file was saved successfully: ' + ::cSaveTo, 'Saving project ...' ) + hb_MemoWrit( hb_dirBase() + "hbide.env", ::oUI:q_editCompilers:toPlainText() ) + ELSE + MsgBox( 'Error saving project file: ' + ::cSaveTo, 'Error saving project ...' ) + ENDIF + + IF lCanClose .AND. lOk + ::oUI:oWidget:close() + ENDIF + + RETURN lOk + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:updateHbp( iIndex ) + LOCAL a_, a4_1, txt_, s + LOCAL cExt + + IF iIndex != 3 + RETURN nil + ENDIF + + a_:= hb_atokens( strtran( ::oUI:q_editMetaData:toPlainText(), chr( 13 ) ), _EOL ) + a4_1 := hbide_setupMetaKeys( a_ ) + + txt_:= {} + /* This block will be absent when submitting to hbmk engine */ + aadd( txt_, "# " + hbide_parseWithMetaData( ::oUI:q_editWrkFolder:text(), a4_1 ) + ::pathSep + ; + hbide_parseWithMetaData( ::oUI:q_editOutName:text(), a4_1 ) + ".hbp" ) + aadd( txt_, " " ) + + /* Flags */ + a_:= hb_atokens( ::oUI:q_editFlags:toPlainText(), _EOL ) + FOR EACH s IN a_ + s := alltrim( s ) + IF !( "#" == left( s,1 ) ) .and. !empty( s ) + s := hbide_parseWithMetaData( s, a4_1 ) + aadd( txt_, s ) + ENDIF + NEXT + aadd( txt_, " " ) + + /* Sources */ + a_:= hb_atokens( ::oUI:q_editSources:toPlainText(), _EOL ) + FOR EACH s IN a_ + s := alltrim( s ) + IF !( "#" == left( s,1 ) ) .and. !empty( s ) + s := hbide_parseWithMetaData( s, a4_1 ) + hb_FNameSplit( s, , , @cExt ) + IF lower( cExt ) $ ".c,.cpp,.prg,.rc,.res" + aadd( txt_, s ) + ENDIF + ENDIF + NEXT + aadd( txt_, " " ) + + /* Final assault */ + ::oUI:q_editHbp:setPlainText( hbide_arrayToMemo( txt_ ) ) + + RETURN txt_ + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:addSources() + LOCAL aFiles, a_, b_, a4_1, s + + IF !empty( aFiles := ::selectSource( "openmany" ) ) + a_:= hbide_memoToArray( ::oUI:q_editMetaData:toPlainText() ) + a4_1 := hbide_setupMetaKeys( a_ ) + + a_:= hbide_memoToArray( ::oUI:q_editSources:toPlainText() ) + + b_:={} + aeval( aFiles, {|e| aadd( b_, hbide_applyMetaData( e, a4_1 ) ) } ) + + FOR EACH s IN b_ + IF ascan( a_, s ) == 0 + aadd( a_, s ) + ENDIF + NEXT + + ::oUI:q_editSources:setPlainText( hbide_arrayToMemo( a_ ) ) + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ +/* Set current project for build - vailtom + * 26/12/2009 - 02:19:38 + */ +METHOD IdeProjManager:setCurrentProject( cProjectName ) + LOCAL aPrjProps, n + LOCAL cOldProject := ::cWrkProject + LOCAL lValid := .T. + + IF Empty( cProjectName ) + ::cWrkProject := '' + + ELSEIF ( n := ascan( ::aProjects, {|e_| e_[ 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] == cProjectName } ) ) > 0 + aPrjProps := ::aProjects[ n, 3 ] + ::cWrkProject := aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] + + ELSE + MsgBox( 'Invalid project selected: "' + cProjectName + '"' ) + lValid := .F. + ENDIF + + IF lValid + IF !Empty( ::oSBar ) + ::oSBar:getItem( SB_PNL_PROJECT ):caption := ::cWrkProject + ENDIF + + ::oIde:updateTitleBar() + ::oIde:updateProjectMenu() + ENDIF + + RETURN cOldProject + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:getCurrentProject() + + IF !Empty( ::cWrkProject ) + RETURN ::cWrkProject + ENDIF + + IF Empty( ::aProjects ) + MsgBox( "No longer available projects!" ) + RETURN ::cWrkProject + ENDIF + + IF Len( ::aProjects ) == 1 + RETURN ::aProjects[ 1, 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] + ENDIF + + RETURN ::selectCurrentProject() + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:selectCurrentProject() + LOCAL oDlg, i, p, t + + IF Empty( ::aProjects ) + MsgBox( "No longer available projects!" ) + RETURN ::cWrkProject + ENDIF + + oDlg := XbpQtUiLoader():new( ::oDlg ) + oDlg:file := ::oIde:resPath + "selectproject.ui" + oDlg:create() + + * Fill ComboBox with current project names + FOR i := 1 TO Len( ::aProjects ) + p := ::aProjects[i] + t := p[ 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] + + IF !Empty( t ) + oDlg:qObj[ "cbProjects" ]:addItem( t ) + ENDIF + NEXT + + oDlg:signal( "btnOk" , "clicked()", {|| ::setCurrentProject( oDlg:qObj[ "cbProjects" ]:currentText() ), oDlg:oWidget:close() } ) + oDlg:signal( "btnCancel", "clicked()", {|| oDlg:oWidget:close() } ) + + oDlg:exec() + oDlg:destroy() + oDlg := NIL + + RETURN ::cWrkProject + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:closeProject( cProject ) + LOCAL nPos + + IF Empty( ::aProjects ) + MsgBox( "No longer available projects!" ) + RETURN Self + ENDIF + + DEFAULT cProject TO ::getCurrentProject() + + nPos := ascan( ::aProjects, {|e_| e_[ 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] == cProject } ) + + IF ( nPos < 0 ) + MsgBox( 'Invalid project: "' + cProject + '"' ) + RETURN Self + ENDIF + + * aadd( ::aProjects, { lower( cProject ), cProject, aclone( ::aPrjProps ) } ) + + ::aPrjProps := {} + ::updateProjectTree( ::aProjects[ nPos, 3 ], .T. ) + hb_adel( ::aProjects, nPos, .T. ) + ::setCurrentProject( '' ) + + RETURN Self + +/*----------------------------------------------------------------------*/ +/* Prompt for user to select a existing folder + * 25/12/2009 - 19:03:09 - vailtom + */ +METHOD IdeProjManager:promptForPath( cObjPathName, cTitle, cObjFileName, cObjPath2, cObjPath3 ) + LOCAL cTemp, cPath, cFile + + IF !hb_isChar( cObjFileName ) + cTemp := ::oUI:qObj[ cObjPathName ]:Text() + cPath := hbide_fetchADir( ::oDlg, cTitle, cTemp ) + cPath := StrTran( cPath, "\", "/" ) + + ELSE + cTemp := ::oUI:qObj[ cObjPathName ]:Text() + cTemp := hbide_fetchAFile( ::oDlg, cTitle, { { "Harbour IDE Projects", "*.hbi" } }, cTemp ) + + IF !Empty( cTemp ) + cTemp := strtran( cTemp, "\", '/' ) + + hb_fNameSplit( cTemp, @cPath, @cFile ) + + ::oUI:qObj[ cObjFileName ]:setText( cFile ) + ENDIF + ENDIF + + IF !Empty( cPath ) + IF Right( cPath, 1 ) == '/' + cPath := Left( cPath, Len( cPath ) - 1 ) + ENDIF + ::oUI:qObj[ cObjPathName ]:setText( cPath ) + + IF hb_isChar( cObjPath2 ) .AND. Empty( ::oUI:qObj[ cObjPath2 ]:Text() ) + ::oUI:qObj[ cObjPath2 ]:setText( cPath ) + ENDIF + + IF hb_isChar( cObjPath3 ) .AND. Empty( ::oUI:qObj[ cObjPath3 ]:Text() ) + ::oUI:qObj[ cObjPath3 ]:setText( cPath ) + ENDIF + ENDIF + + ::oUI:qObj[ cObjPathName ]:setFocus() + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:buildProjectViaQt( cProject ) + + ::buildProject( cProject, , , , .t. ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) + LOCAL cOutput, cErrors, n, aPrj, cHbpPath, aHbp, qStringList + LOCAL cTmp, nResult + LOCAL nseconds + LOCAL cTargetFN + LOCAL cPath + LOCAL cFileName + LOCAL lDelHbp + + DEFAULT lLaunch TO .F. + DEFAULT lRebuild TO .F. + DEFAULT lPPO TO .F. + DEFAULT lViaQt TO .F. + + lDelHbp := lPPO + + IF lPPO .AND. ::getCurrentTab() == 0 + MsgBox( 'No file open issue to be compiled!' ) + RETURN Self + End + + 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 } ) + aPrj := ::aProjects[ n,3 ] + aHbp := {} + + 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 ) + + /* + * Creates a temporary file to avoid erase the file. Hbp correct this project. + * 26/12/2009 - 04:17:56 - vailtom + */ + IF lDelHbp + cHbpPath := cTargetFN + '.' + hb_md5( alltrim( str( seconds() ) ) ) + ".hbp" + ELSE + cHbpPath := cTargetFN + ".hbp" + End + + DO CASE + CASE aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Lib" + aadd( aHbp, "-hblib" ) + CASE aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Dll" + aadd( aHbp, "-hbdyn" ) + ENDCASE + + aadd( aHbp, "-o" + cTargetFN ) + aadd( aHbp, "-q" ) + aadd( aHbp, "-trace" ) + aadd( aHbp, "-info" ) + + IF lRebuild + aadd( aHbp, "-rebuild" ) + End + + aeval( aPrj[ PRJ_PRP_FLAGS, 2 ], {|e| aadd( aHbp, e ) } ) + + IF !( lPPO ) + aeval( hbide_filesToSources( aPrj[ PRJ_PRP_SOURCES, 2 ] ), {|e| aadd( aHbp, e ) } ) + + ELSE + aadd( aHbp, "-hbcmp -s -p" ) + + n := ::getCurrentTab() + + hb_FNameSplit( ::aTabs[ n, 5 ], @cPath, @cFileName, @cTmp ) + + IF !( lower( cTmp ) $ ".prg,?" ) + MsgBox( 'Operation not supported for this file type: "'+cTmp+'"' ) + RETURN Self + 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, 5 ] ) + + FErase( cFileName ) + ENDIF + + IF !hbide_createTarget( cHbpPath, aHbp ) + cTmp := 'Error saving: ' + cHbpPath + + ELSE + ::lDockBVisible := .t. + ::oDockB2:show() + ::oOutputResult:oWidget:clear() + + nSeconds := seconds() // time elapsed + + cTmp := "Project : " + cProject + CRLF + ; + "Launch : " + iif( lLaunch, 'Yes', 'No' ) + CRLF + ; + "Rebuild : " + iif( lRebuild, 'Yes', 'No' ) + CRLF + ; + "Started at : " + time() + CRLF + ; + '-----------------------------------------------------------------' + CRLF + + IF lViaQt + qStringList := QStringList():new() + qStringList:append( cHbpPath ) + + ::qProcess := QProcess():new() + //::qProcess:setProcessChannelMode( 0 ) + //::qProcess:setReadChannel( 0 ) + + ::cFileOut := hbide_pathToOSPath( cTargetFN + '.' + hb_md5( alltrim( str( seconds() ) ) ) + ".out" ) + ::cFileErr := hbide_pathToOSPath( cTargetFN + '.' + hb_md5( alltrim( str( seconds() ) ) ) + ".err" ) + + ::qProcess:setStandardOutputFile( ::cFileOut ) + ::qProcess:setStandardErrorFile( ::cFileErr ) + + Qt_Slots_Connect( ::pSlots, ::qProcess, "readyReadStandardOutput()", {|o,i| ::readProcessInfo( 2, i, o ) } ) + Qt_Slots_Connect( ::pSlots, ::qProcess, "readyReadStandardError()" , {|o,i| ::readProcessInfo( 3, i, o ) } ) + Qt_Slots_Connect( ::pSlots, ::qProcess, "finished(int,int)" , {|o,i,ii| ::readProcessInfo( 4, i, ii, o ) } ) + + ::oOutputResult:oWidget:clear() + ::oOutputResult:oWidget:append( cTmp ) + ::nStarted := seconds() + + ::qProcess:start( "hbmk2", qStringList ) + + ELSE + cOutput := "" ; cErrors := "" + nResult := hb_processRun( ( "hbmk2 " + cHbpPath ), , @cOutput, @cErrors ) + + * Show detailed status about compile process... + cTmp += cOutput + CRLF + cTmp += IIF( empty( cErrors ), "", cErrors ) + CRLF + cTmp += "errorlevel: " + hb_ntos( nResult ) + CRLF + cTmp += '-----------------------------------------------------------------' + CRLF + cTmp += 'Finished at ' + time() + CRLF + cTmp += "Done in " + ltrim( str( seconds() - nseconds ) ) +" seconds." + CRLF + + hbide_convertBuildStatusMsgToHtml( cTmp, ::oOutputResult:oWidget ) + + IF ( nResult == 0 ) .AND. ( lLaunch ) + ::LaunchProject( cProject ) + ENDIF + ENDIF + + ENDIF + + IF lDelHbp + FErase( cHbpPath ) + ENDIF + + IF lPPO .AND. File( cFileName ) + ::aEdits[ 1 ]:showPPO( cFileName ) + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:readProcessInfo( nMode, i, ii ) + LOCAL cLine, cTmp + + DO CASE + CASE nMode == 1 + + + CASE nMode == 2 + ::qProcess:setReadChannel( 0 ) + cLine := space( 4096 ) + ::qProcess:readLine( @cLine, 4096 ) + IF !empty( cLine ) + ::oOutputResult:oWidget:append( cLine ) + ENDIF + + CASE nMode == 3 + ::qProcess:setReadChannel( 1 ) + cLine := space( 4096 ) + ::qProcess:readLine( @cLine, 4096 ) + + IF !empty( cLine ) + IF ( "Warning" $ cLine ) + cLine := '' + cLine + '' + ELSEIF ( "Error" $ cLine ) + cLine := '' + cLine + '' + ENDIF + + ::oOutputResult:oWidget:append( cLine ) + ENDIF + + CASE nMode == 4 + cTmp := memoread( ::cFileOut ) + hbide_convertBuildStatusMsgToHtml( cTmp, ::oOutputResult:oWidget ) + cTmp := memoread( ::cFileErr ) + hbide_convertBuildStatusMsgToHtml( cTmp, ::oOutputResult:oWidget ) + + cTmp := '-----------------------------------------------------------------' + CRLF + cTmp += "Exit Code : " + hb_ntos( i ) + " Exit Status : " + hb_ntos( ii ) + CRLF + cTmp += '-----------------------------------------------------------------' + CRLF + cTmp += 'Finished at : ' + time() + " Done in : " + hb_ntos( seconds() - ::nStarted ) +" seconds." + CRLF + + ::oOutputResult:oWidget:append( cTmp ) + + Qt_Slots_disConnect( ::pSlots, ::qProcess, "finished(int,int)" ) + Qt_Slots_disConnect( ::pSlots, ::qProcess, "readyReadStandardOutput()" ) + Qt_Slots_disConnect( ::pSlots, ::qProcess, "readyReadStandardError()" ) + + ::qProcess:kill() + ::qProcess:pPtr := 0 + ::qProcess := NIL + + ferase( ::cFileOut ) + ferase( ::cFileErr ) + ENDCASE + + RETURN nil + +/*----------------------------------------------------------------------*/ +/* + * Launch selected project. + * 03/01/2010 - 09:24:50 + */ +METHOD IdeProjManager:LaunchProject( cProject ) + LOCAL qProcess + LOCAL cTargetFN + LOCAL 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 } ) + 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 ) + +#ifdef __PLATFORM__WINDOWS + IF aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Executable" + cTargetFN += '.exe' + ENDIF +#endif + + IF !File( cTargetFN ) + cTmp := "Launch application error: file not found " + cTargetFN + "!" + + ELSEIF aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Executable" + cTmp := "Launch application " + cTargetFN + "... " + + qProcess := QProcess():new() + qProcess:startDetached_2( cTargetFN ) + qProcess:waitForStarted() + qProcess:pPtr := 0 + qProcess := NIL + ELSE + cTmp := "Launch application " + cTargetFN + "... (not applicable)" + ENDIF + + ::oOutputResult:oWidget:append( cTmp ) + RETURN Self + +/*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbide/idesaveload.prg b/harbour/contrib/hbide/idesaveload.prg index 708877ec70..cb835f99a6 100644 --- a/harbour/contrib/hbide/idesaveload.prg +++ b/harbour/contrib/hbide/idesaveload.prg @@ -70,118 +70,90 @@ /*----------------------------------------------------------------------*/ -FUNCTION saveINI( oIde ) - LOCAL nTab, pTab, n, txt_, qEdit, qHScr, qVScr, qSet, cTheme +FUNCTION hbide_saveINI( oIde ) + LOCAL nTab, pTab, n, txt_, qHScr, qVScr, oEdit, qCursor LOCAL nTabs := oIde:qTabWidget:count() - //LOCAL qBArray txt_:= {} // Properties aadd( txt_, "[HBIDE]" ) - aadd( txt_, "MainWindowGeometry = " + PosAndSize( oIde:oDlg:oWidget ) ) + aadd( txt_, " " ) + aadd( txt_, "MainWindowGeometry = " + hbide_posAndSize( oIde:oDlg:oWidget ) ) aadd( txt_, "ProjectTreeVisible = " + IIF( oIde:lProjTreeVisible, "YES", "NO" ) ) - aadd( txt_, "ProjectTreeGeometry = " + PosAndSize( oIde:oProjTree:oWidget ) ) + aadd( txt_, "ProjectTreeGeometry = " + hbide_posAndSize( oIde:oProjTree:oWidget ) ) aadd( txt_, "FunctionListVisible = " + IIF( oIde:lDockRVisible, "YES", "NO" ) ) - aadd( txt_, "FunctionListGeometry = " + PosAndSize( oIde:oFuncList:oWidget ) ) + aadd( txt_, "FunctionListGeometry = " + hbide_posAndSize( oIde:oFuncList:oWidget ) ) aadd( txt_, "RecentTabIndex = " + hb_ntos( oIde:qTabWidget:currentIndex() ) ) aadd( txt_, "CurrentProject = " + "" ) aadd( txt_, "GotoDialogGeometry = " + oIde:aIni[ INI_HBIDE, GotoDialogGeometry ] ) aadd( txt_, "PropsDialogGeometry = " + oIde:aIni[ INI_HBIDE, PropsDialogGeometry ] ) aadd( txt_, "FindDialogGeometry = " + oIde:aIni[ INI_HBIDE, FindDialogGeometry ] ) aadd( txt_, "ThemesDialogGeometry = " + oIde:aIni[ INI_HBIDE, ThemesDialogGeometry ] ) - - qSet := QSettings():new( "Harbour", "HbIde" ) - qSet:setValue( "state", oIde:oDlg:oWidget:saveState() ) - - #if 0 - qBArray := QByteArray() - qBArray:pPtr := oIde:oDlg:oWidget:saveState() - HB_TRACE( HB_TR_ALWAYS, "QByteArray", 1 ) - HB_TRACE( HB_TR_ALWAYS, "QByteArray", qBArray:size(), qBArray:isNull() ) - HB_TRACE( HB_TR_ALWAYS, "QByteArray", 2, qBArray:constData() ) - - aadd( txt_, "State = " + qBArray:data_1() ) - #endif - aadd( txt_, " " ) - // Projects aadd( txt_, "[PROJECTS]" ) + aadd( txt_, " " ) FOR n := 1 TO len( oIde:aProjects ) aadd( txt_, oIde:aProjects[ n, 2 ] ) NEXT aadd( txt_, " " ) - // Files aadd( txt_, "[FILES]" ) + aadd( txt_, " " ) FOR n := 1 TO nTabs pTab := oIde:qTabWidget:widget( n-1 ) nTab := ascan( oIde:aTabs, {|e_| hbqt_IsEqualGcQtPointer( e_[ 1 ]:oWidget:pPtr, pTab ) } ) - - * Ignores untitled or temporary files... - IF Empty( oIde:aTabs[ nTab, TAB_SOURCEFILE ] ) - LOOP + oEdit := oIde:aTabs[ nTab, TAB_OEDITOR ] + + IF !Empty( oEdit:sourceFile ) .and. !( ".ppo" == lower( oEdit:cExt ) ) + + qHScr := QScrollBar():configure( oEdit:qEdit:horizontalScrollBar() ) + 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() ) + "," + ; + oEdit:cTheme + "," ) ENDIF - - qEdit := oIde:aTabs[ nTab, TAB_QEDIT ] - qHScr := QScrollBar():configure( qEdit:horizontalScrollBar() ) - qVScr := QScrollBar():configure( qEdit:verticalScrollBar() ) - oIde:qCursor := QTextCursor():configure( qEdit:textCursor() ) - - cTheme := oIde:aTabs[ nTab, TAB_OEDITOR ]:cTheme - - aadd( txt_, oIde:aTabs[ nTab, TAB_SOURCEFILE ] +","+ ; - hb_ntos( oIde:qCursor:position() ) +","+ ; - hb_ntos( qHScr:value() ) + "," + ; - hb_ntos( qVScr:value() ) + "," + ; - cTheme + "," ; - ) NEXT aadd( txt_, " " ) - // Find aadd( txt_, "[FIND]" ) + aadd( txt_, " " ) FOR n := 1 TO len( oIde:aIni[ INI_FIND ] ) aadd( txt_, oIde:aIni[ INI_FIND, n ] ) NEXT aadd( txt_, " " ) - // Replace aadd( txt_, "[REPLACE]" ) + aadd( txt_, " " ) FOR n := 1 TO len( oIde:aIni[ INI_REPLACE ] ) aadd( txt_, oIde:aIni[ INI_REPLACE, n ] ) NEXT aadd( txt_, " " ) - // RecentFiles - aadd( txt_, "[RecentFiles]" ) + aadd( txt_, "[RECENTFILES]" ) + aadd( txt_, " " ) FOR n := 1 TO len( oIde:aIni[ INI_RECENTFILES ] ) aadd( txt_, oIde:aIni[ INI_RECENTFILES, n ] ) NEXT aadd( txt_, " " ) - // RecentProjects - aadd( txt_, "[RecentProjects]" ) + aadd( txt_, "[RECENTPROJECTS]" ) + aadd( txt_, " " ) FOR n := 1 TO len( oIde:aIni[ INI_RECENTPROJECTS ] ) aadd( txt_, oIde:aIni[ INI_RECENTPROJECTS , n ] ) NEXT aadd( txt_, " " ) -//[RecentFiles] -//j:/hbide.2/projects/samples/sample1.prg -//j:/hbide.2/projects/samples/sample2.prg -//j:/hbide.2/projects/samples/sample3.prg - -//[RecentPROJECTS] -//C:/harbour/contrib/hbide/projects/hbide.hbi -//J:/hbide.2/projects/samples/sample1.hbi - - RETURN CreateTarget( oIde:cProjIni, txt_ ) + RETURN hbide_createTarget( oIde:cProjIni, txt_ ) /*----------------------------------------------------------------------*/ -FUNCTION loadINI( oIde, cHbideIni ) - LOCAL aElem, s, n, nPart, cKey, cVal, a_, lValid, nPos +FUNCTION hbide_loadINI( oIde, cHbideIni ) + LOCAL aElem, s, n, nPart, cKey, cVal, a_ LOCAL aIdeEle := { "mainwindowgeometry" , "projecttreevisible" , "projecttreegeometry", ; "functionlistvisible", "functionlistgeometry", "recenttabindex" , ; "currentproject" , "gotodialoggeometry" , "propsdialoggeometry", ; @@ -189,25 +161,23 @@ FUNCTION loadINI( oIde, cHbideIni ) DEFAULT cHbideIni TO "hbide.ini" - lValid := .F. - IF ! hb_FileExists( cHbideIni ) cHbideIni := hb_dirBase() + "hbide.ini" ENDIF - oIde:cProjIni := cHbideIni oIde:aIni := Array( INI_SECTIONS_COUNT ) - oIde:aIni[1] := afill( array( INI_HBIDE_VRBLS ), "" ) - + oIde:aIni[ 1 ] := afill( array( INI_HBIDE_VRBLS ), "" ) + // FOR n := 2 TO INI_SECTIONS_COUNT - oIde:aIni[n] := Array(0) + oIde:aIni[ n ] := Array( 0 ) NEXT IF hb_FileExists( oIde:cProjIni ) - aElem := ReadSource( oIde:cProjIni ) + aElem := hbide_readSource( oIde:cProjIni ) FOR EACH s IN aElem + s := alltrim( s ) IF !empty( s ) /* @@ -217,37 +187,30 @@ FUNCTION loadINI( oIde, cHbideIni ) * section. * 01/01/2010 - 16:38:22 - vailtom */ - SWITCH Upper(s) + SWITCH Upper( s ) + CASE "[HBIDE]" nPart := INI_HBIDE - lValid := .T. EXIT CASE "[PROJECTS]" nPart := INI_PROJECTS - lValid := .T. EXIT CASE "[FILES]" nPart := INI_FILES - lValid := .T. EXIT CASE "[FIND]" nPart := INI_FIND - lValid := .T. EXIT CASE "[REPLACE]" nPart := INI_REPLACE - lValid := .T. EXIT CASE "[RECENTFILES]" nPart := INI_RECENTFILES - lValid := .T. EXIT CASE "[RECENTPROJECTS]" nPart := INI_RECENTPROJECTS - lValid := .T. EXIT OTHERWISE - /* * If none of the previous sections are valid, do not let it * process. This prevents the HBIDE read a section that is @@ -256,13 +219,10 @@ FUNCTION loadINI( oIde, cHbideIni ) * for '[* PROJECTS]' and see how it behaves incorrectly. * 01/01/2010 - 18:09:40 - vailtom */ - IF Left( s, 1 ) == '[' - lValid := .F. - End - DO CASE - CASE !lValid + CASE Left( s, 1 ) == '[' * Nothing todo! + CASE nPart == INI_HBIDE IF ( n := at( "=", s ) ) > 0 cKey := alltrim( substr( s, 1, n-1 ) ) @@ -272,11 +232,9 @@ FUNCTION loadINI( oIde, cHbideIni ) oIde:aIni[ nPart, n ] := cVal /* Further process */ ENDIF ENDIF - EXIT CASE nPart == INI_PROJECTS aadd( oIde:aIni[ nPart ], s ) - oIde:loadProjectProperties( s, .f., .f., .f. ) CASE nPart == INI_FILES a_:= hb_atokens( s, "," ) @@ -291,30 +249,30 @@ FUNCTION loadINI( oIde, cHbideIni ) a_[ 3 ] := val( a_[ 3 ] ) a_[ 4 ] := val( a_[ 4 ] ) a_[ 5 ] := a_[ 5 ] - + * Ignores invalid filenames... - IF !Empty( a_[1] ) + IF !Empty( a_[ 1 ] ) aadd( oIde:aIni[ nPart ], a_ ) ENDIF CASE nPart == INI_FIND aadd( oIde:aIni[ nPart ], s ) + CASE nPart == INI_REPLACE aadd( oIde:aIni[ nPart ], s ) CASE nPart == INI_RECENTPROJECTS .OR. ; nPart == INI_RECENTFILES - - IF Len( oIde:aIni[ nPart ] ) < 15 - s := PathNormalized(s) - nPos := aScan( oIde:aIni[ nPart ], {|f| PathNormalized( f ) == s } ) - - IF nPos < 0 + + IF Len( oIde:aIni[ nPart ] ) < 25 + s := hbide_pathNormalized( s, .f. ) + IF aScan( oIde:aIni[ nPart ], {|e| hbide_pathNormalized( e, .f. ) == s } ) == 0 AAdd( oIde:aIni[ nPart ], s ) ENDIF ENDIF - + ENDCASE + EXIT ENDSWITCH ENDIF NEXT @@ -323,3 +281,4 @@ FUNCTION loadINI( oIde, cHbideIni ) RETURN Nil /*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbide/idethemes.prg b/harbour/contrib/hbide/idethemes.prg index cf64b5dec8..ced2d55693 100644 --- a/harbour/contrib/hbide/idethemes.prg +++ b/harbour/contrib/hbide/idethemes.prg @@ -82,7 +82,7 @@ /*----------------------------------------------------------------------*/ -FUNCTION LoadThemes( oIde ) +FUNCTION hbide_loadThemes( oIde ) IF empty( oIde:cIniThemes ) oIde:cIniThemes := hb_dirBase() + "hbide.hbt" @@ -94,10 +94,8 @@ FUNCTION LoadThemes( oIde ) /*----------------------------------------------------------------------*/ -CLASS IdeThemes +CLASS IdeThemes INHERIT IdeObject - VAR oIde - VAR oUI VAR lDefault INIT .t. VAR cIniFile INIT "" @@ -163,7 +161,7 @@ METHOD IdeThemes:create( oIde, cIniFile ) ::cIniFile := cIniFile /* next always load default themes */ - ::aIni := LoadDefaultThemes() + ::aIni := hbide_loadDefaultThemes() ::parseINI() /* first load user defined themes */ @@ -231,7 +229,7 @@ METHOD IdeThemes:contains( cTheme ) METHOD IdeThemes:load( cFile ) IF hb_isChar( cFile ) .AND. !empty( cFile ) .AND. hb_FileExists( cFile ) - ::aIni:= ReadSource( cFile ) + ::aIni:= hbide_readSource( cFile ) ::parseINI() ::lDefault := .f. ENDIF @@ -250,7 +248,7 @@ METHOD IdeThemes:save( lAsk ) ENDIF IF lAsk - cFile := SaveAFile( ::oIde:oDlg, ; + cFile := hbide_saveAFile( ::oIde:oDlg, ; "Select a File to Save Themes (.hbt)", ; { { "Harbour IDE Themes", "*.hbt" } }, ; ::cIniFile, ; @@ -320,7 +318,6 @@ METHOD IdeThemes:setMultiLineCommentRule( qHiliter, cTheme ) LOCAL aAttr IF !empty( aAttr := ::getThemeAttribute( "CommentsAndRemarks", cTheme ) ) - idedbg( " CommentsAndRemarks " ) qHiliter:setHBMultiLineCommentFormat( ::buildSyntaxFormat( aAttr ) ) ENDIF @@ -392,7 +389,7 @@ METHOD IdeThemes:fetch() ::oUI:signal( "checkUnderline", "stateChanged(int)" , {|o,i| ::updateAttribute( THM_ATR_ULINE , i, o ) } ) ::oUI:signal( "buttonClose" , "clicked()", ; - {|| ::oIde:aIni[ INI_HBIDE, ThemesDialogGeometry ] := PosAndSize( ::oUI:oWidget ), ::oUI:hide() } ) + {|| ::oIde:aIni[ INI_HBIDE, ThemesDialogGeometry ] := hbide_posAndSize( ::oUI:oWidget ), ::oUI:hide() } ) ::oIde:setPosAndSizeByIni( ::oUI:oWidget, ThemesDialogGeometry ) @@ -653,7 +650,7 @@ METHOD IdeThemes:parseINI( lAppend ) IF ( n := at( ":", s ) ) > 0 cKey := alltrim( strtran( substr( s, n+1 ), "]" ) ) ENDIF - HB_TRACE( HB_TR_ALWAYS, cKey ) +// HB_TRACE( HB_TR_ALWAYS, cKey ) IF !empty( cKey ) nPart := 3 IF ( nTheme := ascan( ::aThemes, {|e_| e_[ 1 ] == cKey } ) ) == 0 @@ -666,7 +663,7 @@ METHOD IdeThemes:parseINI( lAppend ) OTHERWISE DO CASE CASE nPart == 1 /* Controls */ - IF ParseKeyValPair( s, @cKey, @cVal ) + IF hbide_parseKeyValPair( s, @cKey, @cVal ) IF ( n := ascan( ::aControls, cKey ) ) > 0 ::aControls[ n, 2 ] := cVal ELSE @@ -674,7 +671,7 @@ METHOD IdeThemes:parseINI( lAppend ) ENDIF ENDIF CASE nPart == 2 /* Items */ - IF ParseKeyValPair( s, @cKey, @cVal ) + IF hbide_parseKeyValPair( s, @cKey, @cVal ) IF ( n := ascan( ::aThemes, cKey ) ) > 0 ::aThemes[ n, 2 ] := cVal ELSE @@ -682,7 +679,7 @@ METHOD IdeThemes:parseINI( lAppend ) ENDIF ENDIF CASE nPart == 3 /* Theams */ - IF ParseKeyValPair( s, @cKey, @cVal ) + IF hbide_parseKeyValPair( s, @cKey, @cVal ) aV := FillAttrbs() aVal := hb_aTokens( cVal, "," ) FOR n := 1 TO THM_NUM_ATTRBS @@ -797,7 +794,7 @@ STATIC FUNCTION GetSource() /*----------------------------------------------------------------------*/ -STATIC FUNCTION SetSyntaxAttrbs( qHiliter, cPattern, cName, nR, nG, nB, lItalic, lBold, lUnderline ) +STATIC FUNCTION hbide_setSyntaxAttrbs( qHiliter, cPattern, cName, nR, nG, nB, lItalic, lBold, lUnderline ) LOCAL qFormat qFormat := QTextCharFormat():new() @@ -819,74 +816,7 @@ STATIC FUNCTION SetSyntaxAttrbs( qHiliter, cPattern, cName, nR, nG, nB, lItalic, /*----------------------------------------------------------------------*/ -FUNCTION SetSyntaxHilighting( qEdit, qHiliter ) - LOCAL b_, qFormat, s - - HB_SYMBOL_UNUSED( qEdit ) - - /* Compiler Directives */ - b_:= { "include","ifdef","else","endif","command","xcommand","translate","xtranslate" } - s := ""; aeval( b_, {|e| s += iif( empty( s ), "", "|" ) + "#" + upper( e ) + "\b|#" + e + "\b" } ) - SetSyntaxAttrbs( qHiliter, s, "PreprocessorDirectives", 120, 26, 213, .t., .t., .f. ) - - /* Harbour Keywords */ - b_:= { 'function','return','static','local','default', ; - 'if','else','elseif','endif','end', ; - 'docase','case','endcase','otherwise', ; - 'do','while','exit',; - 'for','each','next','step','to',; - 'class','endclass','method','data','var','destructor','inline','assign','access',; - 'inherit','init','create','virtual',; - 'begin','sequence','try','catch','always','recover','hb_symbol_unused' } - s := ""; aeval( b_, {|e| s += iif( empty( s ), "", "|" ) + "\b" + upper( e ) + "\b|\b" + e + "\b" } ) - //SetSyntaxAttrbs( qHiliter, s, "HarbourKeywords" , 40, 120, 240, .f., .t., .f. ) - SetSyntaxAttrbs( qHiliter, s, "HarbourKeywords" , 192, 0, 0, .f., .t., .f. ) - - #if 0 - /* C Language Keywords - Only for C or CPP sources - mutually exclusive with Harbour Sources */ - b_:= { "char", "class", "const", "double", "enum", "explicit", "friend", "inline", ; - "int", "long", "namespace", "operator", "private", "protected", "public", ; - "short", "signals", "signed", "slots", "static", "struct", "template", ; - "typedef", "typename", "union", "unsigned", "virtual", "void", "volatile" } - s := ""; aeval( b_, {|e| s += iif( empty( s ), "", "|" ) + "\b" } ) - SetSyntaxAttrbs( qHiliter, s, "CLanguageKeywords" , 40, 120, 240, .f., .t., .f. ) - #endif - - /* Operators */ - s := "\:\=|\:|\+|\-|\\|\*|\ IN\ |\ in\ |\=|\>|\<|\^|\%|\$|\&|\@|\.or\.|\.and\.|\.OR\.|\.AND\.|\!" - SetSyntaxAttrbs( qHiliter, s, "Operators" , 255, 120, 0, .f., .f., .f. ) - - /* Numerics */ - s := "\b[0-9.]+\b" - SetSyntaxAttrbs( qHiliter, s, "NumericConstants" , 127, 127, 127, .f., .f., .f. ) - - /* Brackets and Braces */ - s := "\(|\)|\{|\}|\[|\]|\|" - SetSyntaxAttrbs( qHiliter, s, "BracketsAndBraces" , 0, 0, 192, .f., .f., .f. ) - - /* Functions in General */ - s := "\b[A-Za-z0-9_]+(?=\()" - SetSyntaxAttrbs( qHiliter, s, "FunctionsBody" , 0, 0, 255, .f., .f., .f. ) - - /* Strings */ - s := [\".*\"|\'.*\'] - SetSyntaxAttrbs( qHiliter, s, "TerminatedStrings" , 0, 127, 0, .f., .f., .f. ) - - /* Single Line Comments */ - s := "//[^\n]*" - SetSyntaxAttrbs( qHiliter, s, "CommentsAndRemarks" , 190, 190, 190, .f., .f., .f. ) - - /* Multiline comments */ - qFormat := QTextCharFormat():new() - qFormat:setFontItalic( .t. ) - qFormat:setForeGround( QBrush():new( "QColor", QColor():new( 190,190,190 ) ) ) - qHiliter:setHBMultiLineCommentFormat( qFormat ) - - RETURN nil - -/*----------------------------------------------------------------------*/ - -STATIC FUNCTION LoadDefaultThemes() +STATIC FUNCTION hbide_loadDefaultThemes() LOCAL aIni := {} IF .t. diff --git a/harbour/contrib/hbide/projects/hbide.hbi b/harbour/contrib/hbide/projects/hbide.hbi index f3e80c7261..ae96c67806 100644 --- a/harbour/contrib/hbide/projects/hbide.hbi +++ b/harbour/contrib/hbide/projects/hbide.hbi @@ -21,9 +21,9 @@ LaunchProgram = -workdir=projects/${hb_plat}/${hb_comp}/hbide [ SOURCES ] -# PRG Sources # hbide.prg +ideobject.prg idestylesheets.prg idetags.prg idemisc.prg @@ -34,22 +34,13 @@ LaunchProgram = idesaveload.prg iderequests.prg idethemes.prg - -# C Sources +ideprojmanager.prg # ideparseexpr.c - -# Miscellaneous Files # hbide.ch hbide.ini [ METADATA ] -# Meta Key/Value pair accepts any valid Harbour defined -# function call returning a string value, thus making meta-data -# protocol extremely powerful. In case of any error in evaluating -# value expression will return itself as string value. -# So OR -# will return the same string as # IdeSrc = hb_dirBase() diff --git a/harbour/contrib/hbide/resources/insert-datetime.png b/harbour/contrib/hbide/resources/insert-datetime.png new file mode 100644 index 0000000000..1104c345e5 Binary files /dev/null and b/harbour/contrib/hbide/resources/insert-datetime.png differ diff --git a/harbour/contrib/hbide/resources/insert-external-file.png b/harbour/contrib/hbide/resources/insert-external-file.png new file mode 100644 index 0000000000..1f6838b8e8 Binary files /dev/null and b/harbour/contrib/hbide/resources/insert-external-file.png differ diff --git a/harbour/contrib/hbide/resources/insert-procname.png b/harbour/contrib/hbide/resources/insert-procname.png new file mode 100644 index 0000000000..1ae4c16cc7 Binary files /dev/null and b/harbour/contrib/hbide/resources/insert-procname.png differ diff --git a/harbour/contrib/hbide/resources/readonly.png b/harbour/contrib/hbide/resources/readonly.png new file mode 100644 index 0000000000..b1de3b63a4 Binary files /dev/null and b/harbour/contrib/hbide/resources/readonly.png differ diff --git a/harbour/contrib/hbide/resources/tabreadonly.png b/harbour/contrib/hbide/resources/tabreadonly.png index 78ceedb4d5..1d215a8abf 100644 Binary files a/harbour/contrib/hbide/resources/tabreadonly.png and b/harbour/contrib/hbide/resources/tabreadonly.png differ diff --git a/harbour/contrib/hbxbp/xbpqtuiloader.prg b/harbour/contrib/hbxbp/xbpqtuiloader.prg index c8bbcc4e03..75d005d475 100644 --- a/harbour/contrib/hbxbp/xbpqtuiloader.prg +++ b/harbour/contrib/hbxbp/xbpqtuiloader.prg @@ -115,6 +115,8 @@ METHOD XbpQtUiLoader:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ::xbpWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) IF !empty( ::file ) .and. file( ::file ) + hb_hCaseMatch( ::qObj, .f. ) + ::loadContents( ::file ) ::oWidget := ::loadUI( ::file ) @@ -122,6 +124,7 @@ METHOD XbpQtUiLoader:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible IF !empty( ::oWidget ) ::loadWidgets() ENDIF + ENDIF RETURN Self @@ -256,7 +259,11 @@ METHOD OnError( ... ) HBXBP_DEBUG( "OnError", cMsg ) - xReturn := ::oWidget:&cMsg( ... ) + IF left( cMsg, 2 ) == "Q_" + xReturn := ::qObj[ substr( cMsg, 3 ) ] + ELSE + xReturn := ::oWidget:&cMsg( ... ) + ENDIF RETURN xReturn