From 2467c93273edcd61e354f722650450b88c1c196d Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 29 Dec 2009 01:32:57 +0000 Subject: [PATCH] 2009-12-28 17:29 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/hbide.prg * contrib/hbide/ideactions.prg * contrib/hbide/idedocks.prg * contrib/hbide/idemisc.prg + Applied Vailton's patch. It sets the menu's in right perspective. Actions will follow shortly. --- harbour/ChangeLog | 8 ++ harbour/contrib/hbide/hbide.prg | 27 ++--- harbour/contrib/hbide/ideactions.prg | 174 +++++++++++++++++++++++---- harbour/contrib/hbide/idedocks.prg | 6 +- harbour/contrib/hbide/idemisc.prg | 53 ++++++++ 5 files changed, 219 insertions(+), 49 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 28a91f71a9..38e1758bfc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,14 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-12-28 17:29 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/hbide.prg + * contrib/hbide/ideactions.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/idemisc.prg + + Applied Vailton's patch. It sets the menu's in right perspective. + Actions will follow shortly. + 2009-12-28 15:32 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/hbide.hbp * contrib/hbide/hbide.prg diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index c6859847f9..96f6239b1a 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -304,13 +304,11 @@ METHOD HbIde:create( cProjIni ) ::buildStatusBar() - //::setPosAndSizeByIni( ::oProjTree:oWidget, ProjectTreeGeometry ) - ::oFR := IdeFindReplace():new():create( Self ) #if 0 qSet := QSettings():new( "Harbour", "HbIde" ) -HB_TRACE( HB_TR_ALWAYS, "QSettings", qSet:applicationName(), qSet:value( "state" ) ) + HB_TRACE( HB_TR_ALWAYS, "QSettings", qSet:applicationName(), qSet:value( "state" ) ) ::oDlg:oWidget:restoreState( QByteArray():configure( qSet:value( "state" ) ) ) #endif @@ -318,7 +316,6 @@ HB_TRACE( HB_TR_ALWAYS, "QSettings", qSet:applicationName(), qSet:value( "state" ::loadSources() - /* Enter Xbase++ Event Loop - working */ DO WHILE .t. ::nEvent := AppEvent( @::mp1, @::mp2, @::oXbp ) @@ -327,10 +324,7 @@ HB_TRACE( HB_TR_ALWAYS, "QSettings", qSet:applicationName(), qSet:value( "state" EXIT ENDIF - // HBXBP_DEBUG( ::nEvent, ::mp1, ::mp2 ) - IF ::nEvent == xbeP_Close - //::saveConfig() SaveINI( Self ) ::closeAllSources() EXIT @@ -396,12 +390,6 @@ HB_TRACE( HB_TR_ALWAYS, "QSettings", qSet:applicationName(), qSet:value( "state" HBXBP_DEBUG( "EXITING after destroy ....", memory( 1001 ), hbqt_getMemUsed() ) - /* A NOTE: - - ::qSplitter and ::qLayout are released automatically - when ~MainWindow() is called and GC engine reports it as relaesed. - This is a good testimony that all the memory is recaptured properly. - */ RETURN self /*----------------------------------------------------------------------*/ @@ -500,7 +488,7 @@ METHOD HbIde:executeAction( cKey ) ENDIF CASE cKey == "Find" IF !empty( ::qCurEdit ) - ::oFR:show() + ::findReplace( .t. ) ENDIF CASE cKey == "SetMark" CASE cKey == "GotoMark" @@ -1682,7 +1670,7 @@ METHOD HbIde:buildProject( cProject, lLaunch, lRebuild, lPPO ) n := ::getCurrentTab() - hb_FNameSplit( ::aTabs[ n, TAB_SOURCEFILE ], @cPath, @cFileName, @cTmp ) + hb_FNameSplit( ::aTabs[ n, 5 ], @cPath, @cFileName, @cTmp ) IF !( lower( cTmp ) $ ".prg,?" ) MsgBox( 'Operation not supported for this file type: "'+cTmp+'"' ) @@ -1693,7 +1681,7 @@ METHOD HbIde:buildProject( cProject, lLaunch, lRebuild, lPPO ) // TODO: We have to test if the current file is part of a project, and we // pull your settings, even though this is not the active project - vailtom - aadd( aHbp, ::aTabs[ n, TAB_SOURCEFILE ] ) + aadd( aHbp, ::aTabs[ n, 5 ] ) FErase( cFileName ) End @@ -1710,7 +1698,7 @@ METHOD HbIde:buildProject( cProject, lLaunch, lRebuild, lPPO ) CRLF + ; 'Started at ' + time() + CRLF + ; '-----------------------------------------------------------------' + CRLF - cCmd := "hbmk2.exe " + cHbpPath + " //gtnul" + cCmd := "hbmk2.exe " + cHbpPath nseconds := seconds() // time elapsed nResult := hb_processRun( cCmd, , @cOutput, @cErrors ) @@ -1721,7 +1709,7 @@ METHOD HbIde:buildProject( cProject, lLaunch, lRebuild, lPPO ) cTmp += "errorlevel: " + hb_ntos( nResult ) + CRLF cTmp += '-----------------------------------------------------------------' + CRLF cTmp += 'Finished at ' + time() + CRLF - cTmp += "Done in " + ltrim(str(seconds()-nseconds)) +" seconds." + CRLF + cTmp += "Done in " + ltrim( str( seconds() - nseconds ) ) +" seconds." + CRLF IF (nResult == 0) .AND. (lLaunch) cTmp += CRLF @@ -1744,8 +1732,7 @@ METHOD HbIde:buildProject( cProject, lLaunch, lRebuild, lPPO ) End End - ::oOutputResult:oWidget:clear() - ::oOutputResult:oWidget:appendPlainText( cTmp ) + ::oOutputResult:oWidget:setHtml( ConvertBuildStatusMsgToHtml( cTmp ) ) IF lDelHbp FErase( cHbpPath ) diff --git a/harbour/contrib/hbide/ideactions.prg b/harbour/contrib/hbide/ideactions.prg index e1901e4d3b..43463d24a4 100644 --- a/harbour/contrib/hbide/ideactions.prg +++ b/harbour/contrib/hbide/ideactions.prg @@ -66,6 +66,7 @@ #include "common.ch" #include "xbp.ch" +#include "inkey.ch" /*----------------------------------------------------------------------*/ @@ -82,7 +83,7 @@ FUNCTION buildToolBar( oWnd, oIde ) oTBar:oWidget:setMaximumHeight( 30 ) oTBar:addItem( "Exit" , cResPath + "exit.png" , , , , , "Exit" ) - oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) oTBar:addItem( "Toggle Project Tree" , cResPath + "properties.png" , , , , , "ToggleProjectTree" ) oTBar:addItem( "New" , cResPath + "new.png" , , , , , "New" ) oTBar:addItem( "Open" , cResPath + "open.png" , , , , , "Open" ) @@ -90,7 +91,7 @@ FUNCTION buildToolBar( oWnd, oIde ) oTBar:addItem( "Close" , cResPath + "close.png" , , , , , "Close" ) * oTBar:addItem( "Close all" , cResPath + "close.png" , , , , , "Close all" ) oTBar:addItem( "Print" , cResPath + "print.png" , , , , , "Print" ) - oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) oTBar:addItem( "Compile" , cResPath + "compile.png" , , , , , "Compile" ) oTBar:addItem( "Compile to PPO" , cResPath + "ppo.png" , , , , , "CompilePPO" ) oTBar:addItem( "Build Project" , cResPath + "build.png" , , , , , "SaveBuild" ) @@ -100,32 +101,32 @@ FUNCTION buildToolBar( oWnd, oIde ) oTBar:addItem( "Show/Hide Build Error Info" , cResPath + "builderror.png" , , , , , "11" ) oTBar:addItem( "Module Function List" , cResPath + "modulelist.png" , , , , , "12" ) // - oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) oTBar:addItem( "Undo" , cResPath + "undo.png" , , , , , "Undo" ) oTBar:addItem( "Redo" , cResPath + "redo.png" , , , , , "Redo" ) - oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) oTBar:addItem( "Cut" , cResPath + "cut.png" , , , , , "Cut" ) oTBar:addItem( "Copy" , cResPath + "copy.png" , , , , , "Copy" ) oTBar:addItem( "Paste" , cResPath + "paste.png" , , , , , "Paste" ) oTBar:addItem( "Select All" , cResPath + "selectall.png" , , , , , "SelectAll" ) oTBar:addItem( "Column/Stream Selection" , cResPath + "stream.png" , , , , , "19" ) - oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) oTBar:addItem( "Find" , cResPath + "find.png" , , , , , "Find" ) oTBar:addItem( "Search" , cResPath + "search.png" , , , , , "Search" ) - oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) oTBar:addItem( "Place/Remove Mark" , cResPath + "placeremovemark.png", , , , , "SetMark" ) oTBar:addItem( "Goto Mark" , cResPath + "gotomark.png" , , , , , "GotoMark" ) oTBar:addItem( "Goto Line" , cResPath + "gotoline.png" , , , , , "Goto" ) - oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) oTBar:addItem( "To Upper" , cResPath + "toupper.png" , , , , , "ToUpper" ) oTBar:addItem( "To Lower" , cResPath + "tolower.png" , , , , , "ToLower" ) oTBar:addItem( "Invert Case" , cResPath + "invertcase.png" , , , , , "Invert" ) oTBar:addItem( "Match Pairs" , cResPath + "matchobj.png" , , , , , "28" ) - oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) #if 0 oTBar:addItem( "ZoomIn" , cResPath + "zoomin.png" , , , , , "ZoomIn" ) oTBar:addItem( "ZoomOut" , cResPath + "zoomout.png" , , , , , "ZoomOut" ) - oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) #endif oTBar:transparentColor := GraMakeRGBColor( { 0,255,255 } ) // GRA_CLR_INVALID @@ -135,6 +136,66 @@ FUNCTION buildToolBar( oWnd, oIde ) /*----------------------------------------------------------------------*/ +/* + * Normalizes a caption for an menu item with shortcut (or not). + * TODO: add support for translation of menu items AND support changing shortcuts + * loading from a text file for customing hotkeys AND icons. (vailtom) + * 27/12/2009 - 16:05:32 - vailtom + */ +STATIC; +FUNCTION mnuNormalizeItem( cCaption ) + LOCAL cKey + LOCAL cIco + LOCAL p + + /* Retrieve and update the ICON name for this menu item */ + IF ( (p := Rat( '|', cCaption )) != 00 ) + cIco := Substr( cCaption, p+1 ) + cIco := alltrim( cIco ) + + cCaption := Substr( cCaption, 1, p-1 ) + cCaption := Alltrim( cCaption ) + + * cIco := s_resPath + Alltrim( cIco ) ---> "s_resPath" is need here! + IF !Empty( cIco ) + cIco := StrTran( cIco, '/', hb_OsPathSeparator() ) + cIco := StrTran( cIco, '\', hb_OsPathSeparator() ) + + IF !( hb_OsPathSeparator() $ cIco ) + cIco := hb_DirBase() + "resources" + hb_OsPathSeparator() + cIco + "|" + ELSE + cIco := cIco + "|" + Endif + Endif + ELSE + cIco := '' + ENDIF + + /* Update the key shortcut for this menu item */ + IF ( (p := Rat( ',', cCaption )) != 00 ) + cKey := Substr( cCaption, p+1 ) + cCaption := Substr( cCaption, 1, p-1 ) + cCaption := alltrim( cCaption ) + + cKey := alltrim( cKey ) + cKey := StrTran( cKey, '^', 'Ctrl+' ) + cKey := StrTran( cKey, 'Sh+', 'Shift+' ) + + IF !Empty( cKey ) + cKey := Chr( K_TAB ) + cKey + End + ELSE + cKey := '' + ENDIF + + cCaption := cIco + cCaption + cKey + RETURN cCaption + +/* This pseudo function helps to create is a menu item with text and shortcut.*/ +#define _T( x ) ( mnuNormalizeItem(x) ) + +/* This functions build the main menu for hbide. + */ FUNCTION buildMainMenu( oWnd, oIde ) LOCAL oMenuBar, oSubMenu, oSub1 @@ -142,32 +203,76 @@ FUNCTION buildMainMenu( oWnd, oIde ) oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~File" - oSubMenu:addItem( { "New" , {|| oIde:executeAction( "New" ) } } ) - oSubMenu:addItem( { "Open" , {|| oIde:executeAction( "Open" ) } } ) - oSubMenu:addItem( { "Save" , {|| oIde:executeAction( "Save" ) } } ) - oSubMenu:addItem( { "Close" , {|| oIde:executeAction( "Close" ) } } ) - oSubMenu:addItem( { "Close all" , {|| oIde:executeAction( "CloseAll" ) } } ) + oSubMenu:addItem( { _T( "New, ^N | new.png" ) , {|| oIde:executeAction( "New" ) } } ) + oSubMenu:addItem( { _T( "Open, ^O | open.png" ) , {|| oIde:executeAction( "Open" ) } } ) + oSubMenu:addItem( { _T( "Recent Files*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Recent Projects*" ) , {|| oIde:executeAction( "" ) } } ) MenuAddSep( oSubMenu ) - oSubMenu:addItem( { "Print" , {|| oIde:executeAction( "Print" ) } } ) + + oSubMenu:addItem( { _T( "Save, ^S | save.png" ) , {|| oIde:executeAction( "Save" ) } } ) + oSubMenu:addItem( { _T( "Save As*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Save All*, Sh+^S" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Close, ^W | close.png" ) , {|| oIde:executeAction( "Close" ) } } ) + oSubMenu:addItem( { _T( "Close All" ) , {|| oIde:executeAction( "CloseAll" ) } } ) + oSubMenu:addItem( { _T( "Close Other*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Revert to Saved*, Sh+^R" ) , {|| oIde:executeAction( "" ) } } ) MenuAddSep( oSubMenu ) - oSubMenu:addItem( { "Exit" , {|| oIde:executeAction( "Exit" ) } } ) + + oSubMenu:addItem( { _T( "Export as HTML*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Print*, ^P | print.png" ) , {|| oIde:executeAction( "" ) } } ) + MenuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "Save and Exit*, Sh+^W" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Exit | exit.png" ) , {|| oIde:executeAction( "Exit" ) } } ) + oMenuBar:addItem( { oSubMenu, NIL } ) + + oSubMenu := XbpMenu():new( oMenuBar ):create() + oSubMenu:title := "~Edit" + oSubMenu:addItem( { _T( "Undo*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Redo*" ) , {|| oIde:executeAction( "" ) } } ) + MenuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "Cut*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Copy*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Paste*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Duplicate Line*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Select All*" ) , {|| oIde:executeAction( "" ) } } ) + MenuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "Find/Replace*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Go To Line...*" ) , {|| oIde:executeAction( "" ) } } ) + MenuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "Insert*" ) , {|| oIde:executeAction( "" ) } } ) + MenuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "Set as Readonly*" ) , {|| oIde:executeAction( "" ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~Project" - oSubMenu:addItem( { "New" , {|| oIde:executeAction( "NewProject" ) } } ) - oSubMenu:addItem( { "Load Project..." , {|| oIde:executeAction( "LoadProject" ) } } ) - oSubMenu:addItem( { "Close Project" , {|| oIde:executeAction( "CloseProject" ) } } ) + oSubMenu:addItem( { _T( "Add to Project...*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Remove from Project...*" ) , {|| oIde:executeAction( "" ) } } ) MenuAddSep( oSubMenu ) - oSubMenu:addItem( { "Save and Build" , {|| oIde:executeAction( "SaveBuild" ) } } ) - oSubMenu:addItem( { "Save, Build and Launch" , {|| oIde:executeAction( "SaveBuildLaunch" ) } } ) - oSubMenu:addItem( { "Save and Re-build" , {|| oIde:executeAction( "SaveRebuild" ) } } ) - oSubMenu:addItem( { "Save, Re-build and Launch" , {|| oIde:executeAction( "SaveRebuildLaunch" ) } } ) + oSubMenu:addItem( { _T( "New" ) , {|| oIde:executeAction( "NewProject" ) } } ) + oSubMenu:addItem( { _T( "Load" ) , {|| oIde:executeAction( "LoadProject" ) } } ) + oSubMenu:addItem( { _T( "Close" ) , {|| oIde:executeAction( "CloseProject" ) } } ) MenuAddSep( oSubMenu ) - oSubMenu:addItem( { "Save and Compile Current File", {|| oIde:executeAction( "SaveCompileCurrent" ) } } ) - oSubMenu:addItem( { "Save and Compile to PPO" , {|| oIde:executeAction( "CompilePPO" ) } } ) + oSubMenu:addItem( { _T( "Select Main Module...*" ) , {|| oIde:executeAction( "" ) } } ) MenuAddSep( oSubMenu ) - oSubMenu:addItem( { "Project Properties" , {|| oIde:executeAction( "Properties" ) } } ) + 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( "" ) } } ) + oMenuBar:addItem( { oSubMenu, NIL } ) + + oSubMenu := XbpMenu():new( oMenuBar ):create() + oSubMenu:title := "~Build" + oSubMenu:addItem( { _T( "Build,^F9" ) , {|| oIde:executeAction( "SaveBuild" ) } } ) + oSubMenu:addItem( { _T( "Build and Launch, F9" ) , {|| oIde:executeAction( "SaveBuildLaunch" ) } } ) + oSubMenu:addItem( { _T( "Re-build" ) , {|| oIde:executeAction( "SaveRebuild" ) } } ) + oSubMenu:addItem( { _T( "Re-build and Launch, Sh+^F9" ) , {|| oIde:executeAction( "SaveRebuildLaunch" ) } } ) + MenuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "Save and Compile Current File") , {|| oIde:executeAction( "SaveCompileCurrent" ) } } ) + oSubMenu:addItem( { _T( "Save and Compile to PPO" ) , {|| oIde:executeAction( "CompilePPO" ) } } ) + MenuAddSep( oSubMenu ) + oSubMenu:addItem( { _T( "Run*, ^F10" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Run without Debug*, Sh+^F10" ) , {|| oIde:executeAction( "" ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) oSubMenu := XbpMenu():new( oMenuBar ):create() @@ -254,6 +359,23 @@ FUNCTION buildMainMenu( oWnd, oIde ) oSubMenu:addItem( { "WINSAMI2 " , {|| oIde:setCodec( "WINSAMI2" ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) + oSubMenu := XbpMenu():new( oMenuBar ):create() + oSubMenu:title := "~Tools" + oSubMenu:addItem( { _T( "Configure Tools...*" ) , {|| oIde:executeAction( "" ) } } ) + MenuAddSep( oSubMenu ) + // TODO: Load custom TOOLS LINK from .INI file +#ifdef __PLATFORM__WINDOWS + oSubMenu:addItem( { _T( "Command Prompt...*" ) , {|| oIde:executeAction( "" ) } } ) +#else + oSubMenu:addItem( { _T( "Terminal" ) , {|| oIde:executeAction( "" ) } } ) +#endif + oMenuBar:addItem( { oSubMenu, NIL } ) + + oSubMenu := XbpMenu():new( oMenuBar ):create() + oSubMenu:title := "~Help" + oSubMenu:addItem( { _T( "About...*" ) , {|| oIde:executeAction( "" ) } } ) + oMenuBar:addItem( { oSubMenu, NIL } ) + Return Nil /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index 7862f0d347..03edbdca57 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -330,9 +330,9 @@ METHOD IdeDocks:buildOutputResults() ::oDockB2:oWidget:setWindowTitle( "Output Console" ) ::oDockB2:oWidget:setFocusPolicy( Qt_NoFocus ) - ::oIde:oOutputResult := XbpMLE():new( ::oDockB2 ):create( , , { 0,0 }, { 100, 400 }, , .t. ) - ::oOutputResult:wordWrap := .f. - //::oOutputResult:dataLink := {|x| IIf( x==NIL, cText, cText := x ) } + ::oIde:oOutputResult := XbpRtf():new( ::oDockB2 ):create( , , { 0,0 }, { 100, 400 }, , .t. ) + ::oOutputResult:oWidget:setAcceptRichText( .t. ) + ::oOutputResult:oWidget:setReadOnly( .T. ) ::oDockB2:oWidget:setWidget( ::oOutputResult:oWidget ) diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 8929f3c2ba..675751dab8 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -463,6 +463,59 @@ FUNCTION PathNormalized( cPath, lLower ) RETURN IF( lLower, lower( s ), s ) +/*----------------------------------------------------------------------*/ +/* + * This function parses compiler result and hightlight errors & warnings using + * regular expressions. + * + * More about Qt Color names: + * http://www.w3.org/TR/SVG/types.html#ColorKeywords + * + * 28/12/2009 - 16:17:37 + */ +FUNCTION ConvertBuildStatusMsgToHtml( cText ) + LOCAL aLines + LOCAL cLine + LOCAL aRegWarns := {} + LOCAL aRegErrors := {} + + 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) ) + + /* Convert some chars to valid HTML chars */ + DO WHILE "<" $ cText + cText := StrTran( cText, "<", "<" ) + ENDDO + + DO WHILE ">" $ cText + cText := StrTran( cText, ">", ">" ) + ENDDO + + aLines := hb_aTokens( cText, Chr(10) ) + cText := '
'
+
+   AAdd( aRegWarns, hb_RegexComp( ".*: warning.*" ) )
+   AAdd( aRegWarns, hb_RegexComp( ".*\) Warning W.*" ) )
+
+   AAdd( aRegErrors, hb_RegexComp( ".*: error.*" ) )
+   AAdd( aRegErrors, hb_RegexComp( ".*\) Error E.*" ) )
+   
+   FOR EACH cLine IN aLines
+       IF Empty( cLine )
+          *
+       ELSEIF aScan( aRegWarns,   {| reg | !Empty(hb_RegEx( reg, cLine )) } ) > 0
+          cLine := '' + cLine + ''
+
+       ELSEIF aScan( aRegErrors, {| reg | !Empty(hb_RegEx( reg, cLine )) } ) > 0
+          cLine := '' + cLine + ''
+       End
+       cText += cLine + '
' + End + + cText += '
' + RETURN cText + /*----------------------------------------------------------------------*/ FUNCTION FilesToSources( aFiles )