diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 18ecb589fa..d79b8a8c2d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,17 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-04 14:31 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/hbide.prg + * contrib/hbide/ideactions.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/ideobject.prg + * contrib/hbide/ideprojmanager.prg + * contrib/hbide/idethemes.prg + ! Continued reforms. + ! Menu options are working again. + 2010-01-04 23:28 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + Will now ignore hbdebug and hbcplr static Harbour libs when diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index f17b616acb..3433cad208 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -114,6 +114,9 @@ CLASS HbIde ACCESS pEvents INLINE hbxbp_getEventsPtr() DATA oPM + DATA oFR + DATA oDK + DATA oED DATA mp1, mp2, oXbp, nEvent DATA aTabs INIT {} @@ -188,7 +191,6 @@ CLASS HbIde DATA aProjects INIT {} DATA cWrkProject INIT '' DATA oProps - DATA oFR DATA cProcessInfo DATA qProcess @@ -206,9 +208,7 @@ CLASS HbIde METHOD setPosAndSizeByIni() METHOD setPosByIni() - METHOD buildDialog() - METHOD buildStatusBar() - METHOD executeAction() + METHOD execAction() METHOD manageFuncContext() METHOD manageProjectContext() @@ -240,11 +240,8 @@ CLASS HbIde METHOD manageFocusInEditor() METHOD convertSelection() METHOD insertText() - METHOD printPreview() - METHOD paintRequested() METHOD loadUI() - METHOD goto() METHOD setCodec() METHOD findEditByFileName() @@ -283,8 +280,20 @@ METHOD HbIde:create( cProjIni ) /* Load IDE Settings */ hbide_loadINI( Self, cProjIni ) + /* Setup DOCKing windows and ancilliary windows */ + ::oDK := IdeDocks():new():create( Self ) /* Build IDE's Main Window */ - ::BuildDialog() ; ::oDa := ::oDlg:drawingArea ; SetAppWindow( ::oDlg ) ; ::oDlg:Show() + ::oDK:buildDialog() + ::oDK:buildMainMenu() + ::oDK:buildToolBar() + ::oDK:buildStatusBar() + ::oDK:buildDockWidgets() + + /* Once create Find/Replace dialog */ + ::oFR := IdeFindReplace():new():create( Self ) + + /* Edits Manager */ + ::oED := IdeEditsManager():new( Self ):create() /* Load IDE|User defined Themes */ hbide_loadThemes( Self ) @@ -295,9 +304,6 @@ METHOD HbIde:create( cProjIni ) ::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 ) @@ -311,23 +317,11 @@ METHOD HbIde:create( cProjIni ) /* Just to spare some GC calls */ ::qCursor := QTextCursor():new() - /* Editor's Font */ + /* Editor's Font - TODO: User Managed Interface */ ::oFont := XbpFont():new() ::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 ) - /* Request Main Window to Appear on the Screen */ ::oDlg:Show() @@ -364,9 +358,7 @@ METHOD HbIde:create( cProjIni ) ::closeSource() CASE ::mp1 == xbeK_CTRL_G - IF !empty( ::qCurEdit ) - ::goto() - ENDIF + ::oED:goto() CASE ::mp1 == xbeK_CTRL_F IF !empty( ::qCurEdit ) @@ -390,26 +382,26 @@ METHOD HbIde:create( cProjIni ) ::oFR:destroy() /* Very important - destroy resources */ - HBXBP_DEBUG( "======================================================" ) - HBXBP_DEBUG( "Before ::oDlg:destroy()", memory( 1001 ), hbqt_getMemUsed() ) - HBXBP_DEBUG( " " ) + hbide_dbg( "======================================================" ) + hbide_dbg( "Before ::oDlg:destroy()", memory( 1001 ), hbqt_getMemUsed() ) + hbide_dbg( " " ) ::oDlg:destroy() - HBXBP_DEBUG( " " ) - HBXBP_DEBUG( "After ::oDlg:destroy()", memory( 1001 ), hbqt_getMemUsed() ) - HBXBP_DEBUG( "======================================================" ) + hbide_dbg( " " ) + hbide_dbg( "After ::oDlg:destroy()", memory( 1001 ), hbqt_getMemUsed() ) + hbide_dbg( "======================================================" ) ::qCursor:pPtr := 0 ::oFont := NIL - HBXBP_DEBUG( "EXITING after destroy ....", memory( 1001 ), hbqt_getMemUsed() ) + hbide_dbg( "EXITING after destroy ....", memory( 1001 ), hbqt_getMemUsed() ) RETURN self /*----------------------------------------------------------------------*/ -METHOD HbIde:executeAction( cKey ) +METHOD HbIde:execAction( cKey ) LOCAL aPrj, cHbi, Tmp, n DO CASE @@ -483,9 +475,7 @@ METHOD HbIde:executeAction( cKey ) CASE cKey == "CloseOther" ::closeAllOthers() CASE cKey == "Print" - IF !empty( ::qCurEdit ) - ::printPreview() - ENDIF + ::oED:printPreview() CASE cKey == "Undo" IF !empty( ::qCurEdit ) ::qCurEdit:undo() @@ -523,9 +513,7 @@ METHOD HbIde:executeAction( cKey ) CASE cKey == "SetMark" CASE cKey == "GotoMark" CASE cKey == "Goto" - IF !empty( ::qCurEdit ) - ::goto() - ENDIF + ::oED:goto() CASE cKey == "ToUpper" ::convertSelection( cKey ) CASE cKey == "ToLower" @@ -927,7 +915,7 @@ METHOD HbIde:saveAllSources() METHOD HbIde:saveAndExit() IF ::saveSource() - ::executeAction( "Exit" ) + ::execAction( "Exit" ) ENDIF RETURN Self @@ -1415,67 +1403,6 @@ METHOD HbIde:manageProjectContext( mp1, mp2, oXbpTreeItem ) ::manageFocusInEditor() RETURN Self -/*----------------------------------------------------------------------*/ -// Status Bar -/*----------------------------------------------------------------------*/ - -METHOD HbIde:buildStatusBar() - - ::oSBar := XbpStatusBar():new() - ::oSBar:create( ::oDlg, , { 0,0 }, { ::oDlg:currentSize()[ 1 ], 30 } ) - ::oSBar:oWidget:showMessage( "" ) - - ::oSBar:getItem( SB_PNL_MAIN ):autosize := XBPSTATUSBAR_AUTOSIZE_SPRING - - ::oSBar:addItem( "", , , , "Ready" ):oWidget:setMinimumWidth( 80 ) - ::oSBar:addItem( "", , , , "Line" ):oWidget:setMinimumWidth( 110 ) - ::oSBar:addItem( "", , , , "Column" ):oWidget:setMinimumWidth( 40 ) - ::oSBar:addItem( "", , , , "Ins" ):oWidget:setMinimumWidth( 30 ) - ::oSBar:addItem( "", , , , "M_1" ):oWidget:setMinimumWidth( 30 ) - ::oSBar:addItem( "", , , , "Modified" ):oWidget:setMinimumWidth( 50 ) - ::oSBar:addItem( "", , , , "M_2" ):oWidget:setMinimumWidth( 30 ) - ::oSBar:addItem( "", , , , "Stream" ):oWidget:setMinimumWidth( 20 ) - ::oSBar:addItem( "", , , , "Edit" ):oWidget:setMinimumWidth( 20 ) - ::oSBar:addItem( "", , , , "Search" ):oWidget:setMinimumWidth( 20 ) - ::oSBar:addItem( "", , , , "Codec" ):oWidget:setMinimumWidth( 20 ) - ::oSBar:addItem( "", , , , "Project" ):oWidget:setMinimumWidth( 20 ) - - RETURN Self - -/*----------------------------------------------------------------------*/ -// Main Window -/*----------------------------------------------------------------------*/ - -METHOD HbIde:buildDialog() - - #if 1 - LOCAL oUI - oUI := XbpQtUiLoader():new() - oUI:file := s_resPath + "mainWindow.ui" - oUI:create() - - ::oDlg := XbpDialog():new() - ::oDlg:icon := s_resPath + "vr.png" // "hbide.png" - ::oDlg:title := "Harbour-Qt IDE" - ::oDlg:qtObject := oUI:oWidget - ::oDlg:create() - #else - ::oDlg := XbpDialog():new( , , {10,10}, {1100,700}, , .f. ) - ::oDlg:icon := s_resPath + "vr.png" // "hbide.png" - ::oDlg:title := "Harbour-Qt IDE" - ::oDlg:create() - #endif - - ::oDlg:setStyleSheet( GetStyleSheet( "QMainWindow" ) ) - - ::setPosAndSizeByIni( ::oDlg:oWidget, MainWindowGeometry ) - - ::oDlg:close := {|| MsgBox( "HbIDE is about to be closed!" ), .T. } - ::oDlg:oWidget:setDockOptions( QMainWindow_AllowTabbedDocks + QMainWindow_ForceTabbedDocks ) - ::oDlg:oWidget:setTabPosition( Qt_BottomDockWidgetArea, QTabWidget_South ) - - RETURN Self - /*----------------------------------------------------------------------*/ METHOD HbIde:updateFuncList() @@ -1558,32 +1485,6 @@ METHOD HbIde:CreateTags() RETURN ( NIL ) //----------------------------------------------------------------------// -// Printing -/*----------------------------------------------------------------------*/ - -METHOD HbIde:printPreview() - LOCAL qDlg - - qDlg := QPrintPreviewDialog():new( ::oDlg:oWidget ) - qDlg:setWindowTitle( "Harbour-QT Preview Dialog" ) - Qt_Slots_Connect( ::pSlots, qDlg, "paintRequested(QPrinter)", {|o,p| ::paintRequested( p,o ) } ) - qDlg:exec() - Qt_Slots_disConnect( ::pSlots, qDlg, "paintRequested(QPrinter)" ) - - RETURN self - -/*----------------------------------------------------------------------*/ - -METHOD HbIde:paintRequested( pPrinter ) - LOCAL qPrinter - - qPrinter := QPrinter():configure( pPrinter ) - - ::qCurEdit:print( qPrinter ) - - RETURN Self - -/*----------------------------------------------------------------------*/ METHOD HbIde:loadUI( cUi ) LOCAL cUiFull := s_resPath + cUi + ".ui" @@ -1616,11 +1517,11 @@ METHOD HbIde:updateProjectMenu() * msgbox( ToString( oMenuBar:aMenuItems[ n ] )) IF Empty( ::cWrkProject ) - oItem[2]:setDisabled(.T.) + oItem[ 2 ]:setDisabled( .T. ) RETURN Self ENDIF - oItem[2]:setEnabled( .T.) + oItem[ 2 ]:setEnabled( .T. ) RETURN Self /*----------------------------------------------------------------------*/ @@ -1637,55 +1538,24 @@ METHOD HbIde:updateTitleBar() ENDIF IF !Empty( ::cWrkProject ) - cTitle += ' - ' + ::cWrkProject + '' + cTitle += " - " + ::cWrkProject + "" ENDIF IF ::nCurTab > 0 .AND. ::nCurTab <= Len( ::aTabs ) IF Empty( ::aTabs[ ::nCurTab, TAB_SOURCEFILE ] ) - cTitle += ' - [' + ::aTabs[ ::nCurTab, TAB_OTAB ]:Caption + ']' + cTitle += " - [" + ::aTabs[ ::nCurTab, TAB_OTAB ]:Caption + "]" ELSE - cTitle += ' - [' + ::aTabs[ ::nCurTab, TAB_SOURCEFILE ] + ']' + cTitle += " - [" + ::aTabs[ ::nCurTab, TAB_SOURCEFILE ] + "]" ENDIF ENDIF ::oDlg:Title := cTitle ::oDlg:oWidget:setWindowTitle( ::oDlg:Title ) + RETURN Self /*----------------------------------------------------------------------*/ -METHOD HbIde:goto() - LOCAL qGo, nLine - LOCAL qCursor := QTextCursor():configure( ::qCurEdit:textCursor() ) - - nLine := qCursor:blockNumber() - - qGo := QInputDialog():new( ::oDlg:oWidget ) - qGo:setIntMinimum( 1 ) - qGo:setIntMaximum( ::qCurDocument:blockCount() ) - qGo:setIntValue( nLine + 1 ) - qGo:setLabelText( "Goto Line Number [1-" + hb_ntos( ::qCurDocument:blockCount() ) + "]" ) - qGo:setWindowTitle( "Harbour-Qt" ) - - ::setPosByIni( qGo, GotoDialogGeometry ) - qGo:exec() - ::aIni[ INI_HBIDE, GotoDialogGeometry ] := hbide_posAndSize( qGo ) - - nLine := qGo:intValue() - nLine - - qGo:pPtr := 0 - - IF nLine < 0 - qCursor:movePosition( QTextCursor_Up, QTextCursor_MoveAnchor, abs( nLine ) + 1 ) - ELSEIF nLine > 0 - qCursor:movePosition( QTextCursor_Down, QTextCursor_MoveAnchor, nLine - 1 ) - ENDIF - ::qCurEdit:setTextCursor( qCursor ) - - RETURN nLine - -/*----------------------------------------------------------------------*/ - METHOD HbIde:setCodec( cCodec ) HbXbp_SetCodec( cCodec ) diff --git a/harbour/contrib/hbide/ideactions.prg b/harbour/contrib/hbide/ideactions.prg index cab827b83b..8015f88b72 100644 --- a/harbour/contrib/hbide/ideactions.prg +++ b/harbour/contrib/hbide/ideactions.prg @@ -143,7 +143,7 @@ FUNCTION buildToolBar( oWnd, oIde ) #endif oTBar:transparentColor := GraMakeRGBColor( { 0,255,255 } ) // GRA_CLR_INVALID - oTBar:buttonClick := {|oButton| oIde:executeAction( oButton:key ) } + oTBar:buttonClick := {|oButton| oIde:execAction( oButton:key ) } RETURN oTBar @@ -207,27 +207,31 @@ STATIC FUNCTION mnuNormalizeItem( cCaption ) */ #define _T( x ) ( mnuNormalizeItem( x ) ) +/*----------------------------------------------------------------------*/ + FUNCTION buildMainMenu( oWnd, oIde ) - LOCAL oMenuBar, oSubMenu, oSub1, oSubMenu2 - LOCAL n, f, lEmpty + LOCAL oMenuBar, oSubMenu, oSubMenu2, n, f, lEmpty oMenuBar := oWnd:MenuBar() oMenuBar:setStyleSheet( GetStyleSheet( "QMenuBar" ) ) + /*----------------------------------------------------------------------------*/ + /* File */ + /*----------------------------------------------------------------------------*/ 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" ) } } ) + oSubMenu2:addItem( { _T( "~Source, ^N | new.png" ) , {|| oIde:execAction( "New" ) } } ) + oSubMenu2:addItem( { _T( "~Project | project.png" ) , {|| oIde:execAction( "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" ) } } ) +// oSubMenu:addItem( { _T( "~New File, ^N | new.png" ) , {|| oIde:execAction( "New" ) } } ) +// oSubMenu:addItem( { _T( "New Pro~ject, Sh+^N | project.png" ) , {|| oIde:execAction( "NewProject" ) } } ) + oSubMenu:addItem( { _T( "~Open, ^O | open.png" ) , {|| oIde:execAction( "Open" ) } } ) + oSubMenu:addItem( { _T( "Open Projec~t" ) , {|| oIde:execAction( "LoadProject" ) } } ) hbide_menuAddSep( oSubMenu ) @@ -238,13 +242,13 @@ FUNCTION buildMainMenu( oWnd, oIde ) FOR n := 1 TO Len( oIde:aIni[ INI_RECENTFILES ] ) f := hbide_pathNormalized( oIde:aIni[ INI_RECENTFILES, n ], .F. ) lEmpty := .F. - oSubMenu2:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + f ) , nil } ) + oSubMenu2:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + f ), nil } ) IF !hb_FileExists(f) oSubMenu2:disableItem( n ) ENDIF NEXT IF lEmpty - oSubMenu2:addItem( { _T( "** No recent files found **" ) , nil } ) + oSubMenu2:addItem( { _T( "** No recent files found **" ) , nil } ) oSubMenu2:disableItem( 1 ) ENDIF oMenuBar:addItem( { oSubMenu2, _T( "Recent Files" ) } ) @@ -270,178 +274,114 @@ FUNCTION buildMainMenu( oWnd, oIde ) hbide_menuAddSep( oSubMenu ) - oSubMenu:addItem( { _T( "~Save, ^S | save.png" ) , {|| oIde:executeAction( "Save" ) } } ) - oSubMenu:addItem( { _T( "Save ~As | saveas.png" ) , {|| oIde:executeAction( "SaveAs" ) } } ) - oSubMenu:addItem( { _T( "Save A~ll, Sh+^S | saveall.png") , {|| oIde:executeAction( "SaveAll" ) } } ) - oSubMenu:addItem( { _T( "~Close, ^W | close.png" ) , {|| oIde:executeAction( "Close" ) } } ) - 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" ) } } ) + oSubMenu:addItem( { _T( "~Save, ^S | save.png" ) , {|| oIde:execAction( "Save" ) } } ) + oSubMenu:addItem( { _T( "Save ~As | saveas.png" ) , {|| oIde:execAction( "SaveAs" ) } } ) + oSubMenu:addItem( { _T( "Save A~ll, Sh+^S | saveall.png") , {|| oIde:execAction( "SaveAll" ) } } ) + oSubMenu:addItem( { _T( "~Close, ^W | close.png" ) , {|| oIde:execAction( "Close" ) } } ) + oSubMenu:addItem( { _T( "Clos~e All | closeall.png" ) , {|| oIde:execAction( "CloseAll" ) } } ) + oSubMenu:addItem( { _T( "Close ~Others| closeexcept.png" ) , {|| oIde:execAction( "CloseOther" ) } } ) + oSubMenu:addItem( { _T( "~Revert to Saved, Sh+^R" ) , {|| oIde:execAction( "Revert" ) } } ) hbide_menuAddSep( oSubMenu ) - * oSubMenu:addItem( { _T( "~Export as HTML* | exporthtml.png" ), {|| oIde:executeAction( "" ) } } ) - oSubMenu:addItem( { _T( "~Print, ^P | print.png" ) , {|| oIde:executeAction( "Print" ) } } ) + * oSubMenu:addItem( { _T( "~Export as HTML* | exporthtml.png" ), {|| oIde:execAction( "" ) } } ) + oSubMenu:addItem( { _T( "~Print, ^P | print.png" ) , {|| oIde:execAction( "Print" ) } } ) 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" ) } } ) + oSubMenu:addItem( { _T( "Sa~ve and Exit, Sh+^W" ) , {|| oIde:execAction( "SaveExit" ) } } ) + oSubMenu:addItem( { _T( "E~xit | exit.png" ) , {|| oIde:execAction( "Exit" ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) + /*----------------------------------------------------------------------------*/ + /* Edit */ + /*----------------------------------------------------------------------------*/ 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" ) } } ) + oSubMenu:addItem( { _T( "~Undo | undo.png" ) , {|| oIde:execAction( "Undo" ) } } ) + oSubMenu:addItem( { _T( "~Redo | redo.png" ) , {|| oIde:execAction( "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" ) } } ) + oSubMenu:addItem( { _T( "C~ut | cut.png" ) , {|| oIde:execAction( "Cut" ) } } ) + oSubMenu:addItem( { _T( "~Copy | copy.png" ) , {|| oIde:execAction( "Copy" ) } } ) + oSubMenu:addItem( { _T( "~Paste| paste.png" ) , {|| oIde:execAction( "Paste" ) } } ) + oSubMenu:addItem( { _T( "Select ~All | selectall.png" ) , {|| oIde:execAction( "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" ) } } ) + oSubMenu:addItem( { _T( "~Find/Replace, ^F | find.png" ) , {|| oIde:execAction( "Find" ) } } ) + oSubMenu:addItem( { _T( "~Go To Line..., ^G| gotoline.png" ) , {|| oIde:execAction( "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" ) } } ) + oSubMenu2:addItem( { _T( "~Date && Time, Sh+F7| insert-datetime.png" ) , {|| oIde:execAction( "InsertDateTime" ) } } ) + oSubMenu2:addItem( { _T( "~Random Function Name, Sh+^F8| insert-procname.png" ) , {|| oIde:execAction( "InsertRandomName" ) } } ) + oSubMenu2:addItem( { _T( "~External File at cursor| insert-external-file.png" ) , {|| oIde:execAction( "InsertExternalFile" ) } } ) oMenuBar:addItem( { oSubMenu2, _T( "~Insert" ) } ) hbide_menuAddSep( oSubMenu ) - oSubMenu:addItem( { _T( "Switch Read~Only Mode | readonly.png" ) , {|| oIde:executeAction( "switchReadOnly" ) } } ) + oSubMenu:addItem( { _T( "Switch Read~Only Mode | readonly.png" ) , {|| oIde:execAction( "switchReadOnly" ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) + /*----------------------------------------------------------------------------*/ + /* Project */ + /*----------------------------------------------------------------------------*/ oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~Project" - oSubMenu:addItem( { _T( "Properties" ) , {|| oIde:executeAction( "Properties" ) } } ) + oSubMenu:addItem( { _T( "Properties" ) , {|| oIde:execAction( "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:addItem( { _T( "Add File* | projectadd.png" ) , {|| oIde:execAction( "" ) } } ) + oSubMenu:addItem( { _T( "Remove File* | projectdel.png" ) , {|| oIde:execAction( "" ) } } ) + oSubMenu:addItem( { _T( "Select Main Module | setmain.png" ) , {|| oIde:execAction( "" ) } } ) 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" ) } } ) + oSubMenu:addItem( { _T( "Change Current Project" ) , {|| oIde:execAction( "SelectProject" ) } } ) + oSubMenu:addItem( { _T( "Close Current Project" ) , {|| oIde:execAction( "CloseProject" ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) + /*----------------------------------------------------------------------------*/ + /* Build */ + /*----------------------------------------------------------------------------*/ oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~Build" - 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" ) } } ) + oSubMenu:addItem( { _T( "Build, ^F9 | build.png" ) , {|| oIde:execAction( "SaveBuild" ) } } ) + oSubMenu:addItem( { _T( "Build and Launch, F9 | buildlaunch.png" ) , {|| oIde:execAction( "SaveBuildLaunch" ) } } ) + oSubMenu:addItem( { _T( "Re-build | rebuild.png" ) , {|| oIde:execAction( "SaveRebuild" ) } } ) + oSubMenu:addItem( { _T( "Re-build and Launch, Sh+^F9 | rebuildlaunch.png" ), {|| oIde:execAction( "SaveRebuildLaunch" ) } } ) 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" ) } } ) + oSubMenu:addItem( { _T( "Save and Compile Current File | compile.png") , {|| oIde:execAction( "SaveCompileCurrent" ) } } ) + oSubMenu:addItem( { _T( "Save and Compile to PPO | ppo.png" ) , {|| oIde:execAction( "CompilePPO" ) } } ) hbide_menuAddSep( oSubMenu ) - oSubMenu:addItem( { _T( "Launch, ^F10" ) , {|| oIde:executeAction( "LaunchProject" ) } } ) - * oSubMenu:addItem( { _T( "Run without Debug*, Sh+^F10 | runnodebug.png" ), {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Launch, ^F10" ) , {|| oIde:execAction( "LaunchProject" ) } } ) + * oSubMenu:addItem( { _T( "Run without Debug*, Sh+^F10 | runnodebug.png" ), {|| oIde:execAction( "" ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) - oSubMenu := XbpMenu():new( oMenuBar ):create() - oSubMenu:title := "~Codec" - oSubMenu:addItem( { "Apple Roman " , {|| oIde:setCodec( "Apple Roman" ) } } ) - oSubMenu:addItem( { "Big5 " , {|| oIde:setCodec( "Big5" ) } } ) - oSubMenu:addItem( { "Big5-HKSCS " , {|| oIde:setCodec( "Big5-HKSCS" ) } } ) - oSubMenu:addItem( { "CP949 " , {|| oIde:setCodec( "CP949" ) } } ) - oSubMenu:addItem( { "EUC-JP " , {|| oIde:setCodec( "EUC-JP" ) } } ) - oSubMenu:addItem( { "EUC-KR " , {|| oIde:setCodec( "EUC-KR" ) } } ) - oSubMenu:addItem( { "GB18030-0 " , {|| oIde:setCodec( "GB18030-0" ) } } ) - oSubMenu:addItem( { "IBM 850 " , {|| oIde:setCodec( "IBM 850" ) } } ) - oSubMenu:addItem( { "IBM 866 " , {|| oIde:setCodec( "IBM 866" ) } } ) - oSubMenu:addItem( { "IBM 874 " , {|| oIde:setCodec( "IBM 874" ) } } ) - oSubMenu:addItem( { "ISO 2022-JP " , {|| oIde:setCodec( "ISO 2022-JP" ) } } ) - - oSub1 := XbpMenu():new( oSubMenu ):create() - oSub1:title := "ISO 8859-1 to 10" - oSub1:addItem( { "-1" , {|| oIde:setCodec( "ISO 8859-1" ) } } ) - oSub1:addItem( { "-2" , {|| oIde:setCodec( "ISO 8859-2" ) } } ) - oSub1:addItem( { "-3" , {|| oIde:setCodec( "ISO 8859-3" ) } } ) - oSub1:addItem( { "-4" , {|| oIde:setCodec( "ISO 8859-4" ) } } ) - oSub1:addItem( { "-5" , {|| oIde:setCodec( "ISO 8859-5" ) } } ) - oSub1:addItem( { "-6" , {|| oIde:setCodec( "ISO 8859-6" ) } } ) - oSub1:addItem( { "-7" , {|| oIde:setCodec( "ISO 8859-7" ) } } ) - oSub1:addItem( { "-8" , {|| oIde:setCodec( "ISO 8859-8" ) } } ) - oSub1:addItem( { "-9" , {|| oIde:setCodec( "ISO 8859-9" ) } } ) - oSub1:addItem( { "-10" , {|| oIde:setCodec( "ISO 8859-10" ) } } ) - oSubMenu:addItem( { oSub1, NIL } ) - - oSub1 := XbpMenu():new( oSubMenu ):create() - oSub1:title := "ISO 8859-13 to 16" - oSub1:addItem( { "-13" , {|| oIde:setCodec( "ISO 8859-13" ) } } ) - oSub1:addItem( { "-14" , {|| oIde:setCodec( "ISO 8859-14" ) } } ) - oSub1:addItem( { "-15" , {|| oIde:setCodec( "ISO 8859-15" ) } } ) - oSub1:addItem( { "-16" , {|| oIde:setCodec( "ISO 8859-16" ) } } ) - oSubMenu:addItem( { oSub1, NIL } ) - - //oSubMenu:addItem( { "Iscii " , {|| oIde:setCodec( "Iscii" ) } } ) //-Bng, Dev, Gjr, Knd, Mlm, Ori, Pnj, Tlg, Tml - oSub1 := XbpMenu():new( oSubMenu ):create() - oSub1:title := "Iscii" - oSub1:addItem( { "-Bng" , {|| oIde:setCodec( "Iscii-Bng" ) } } ) - oSub1:addItem( { "-Dev" , {|| oIde:setCodec( "Iscii-Dev" ) } } ) - oSub1:addItem( { "-Gjr" , {|| oIde:setCodec( "Iscii-Gjr" ) } } ) - oSub1:addItem( { "-Knd" , {|| oIde:setCodec( "Iscii-Knd" ) } } ) - oSub1:addItem( { "-Mlm" , {|| oIde:setCodec( "Iscii-Mlm" ) } } ) - oSub1:addItem( { "-Ori" , {|| oIde:setCodec( "Iscii-Ori" ) } } ) - oSub1:addItem( { "-Pnj" , {|| oIde:setCodec( "Iscii-Pnj" ) } } ) - oSub1:addItem( { "-Tlg" , {|| oIde:setCodec( "Iscii-Tlg" ) } } ) - oSub1:addItem( { "-Tml" , {|| oIde:setCodec( "Iscii-Tml" ) } } ) - oSubMenu:addItem( { oSub1, NIL } ) - - oSubMenu:addItem( { "JIS X 0201 " , {|| oIde:setCodec( "JIS X 0201" ) } } ) - oSubMenu:addItem( { "JIS X 0208 " , {|| oIde:setCodec( "JIS X 0208" ) } } ) - oSubMenu:addItem( { "KOI8-R " , {|| oIde:setCodec( "KOI8-R" ) } } ) - oSubMenu:addItem( { "KOI8-U " , {|| oIde:setCodec( "KOI8-U" ) } } ) - oSubMenu:addItem( { "MuleLao-1 " , {|| oIde:setCodec( "MuleLao-1" ) } } ) - oSubMenu:addItem( { "ROMAN8 " , {|| oIde:setCodec( "ROMAN8" ) } } ) - oSubMenu:addItem( { "Shift-JIS " , {|| oIde:setCodec( "Shift-JIS" ) } } ) - oSubMenu:addItem( { "TIS-620 " , {|| oIde:setCodec( "TIS-620" ) } } ) - oSubMenu:addItem( { "TSCII " , {|| oIde:setCodec( "TSCII" ) } } ) - oSubMenu:addItem( { "UTF-8 " , {|| oIde:setCodec( "UTF-8" ) } } ) - oSubMenu:addItem( { "UTF-16 " , {|| oIde:setCodec( "UTF-16" ) } } ) - oSubMenu:addItem( { "UTF-16BE " , {|| oIde:setCodec( "UTF-16BE" ) } } ) - oSubMenu:addItem( { "UTF-16LE " , {|| oIde:setCodec( "UTF-16LE" ) } } ) - oSubMenu:addItem( { "UTF-32 " , {|| oIde:setCodec( "UTF-32" ) } } ) - oSubMenu:addItem( { "UTF-32BE " , {|| oIde:setCodec( "UTF-32BE" ) } } ) - oSubMenu:addItem( { "UTF-32LE " , {|| oIde:setCodec( "UTF-32LE" ) } } ) - - //oSubMenu:addItem( { "Windows " , {|| oIde:setCodec( "Windows" ) } } ) //-1250 to 1258 - oSub1 := XbpMenu():new( oSubMenu ):create() - oSub1:title := "Windows-1250 to 1258" - oSub1:addItem( { "-1250" , {|| oIde:setCodec( "Windows-1250" ) } } ) - oSub1:addItem( { "-1251" , {|| oIde:setCodec( "Windows-1251" ) } } ) - oSub1:addItem( { "-1252" , {|| oIde:setCodec( "Windows-1252" ) } } ) - oSub1:addItem( { "-1253" , {|| oIde:setCodec( "Windows-1253" ) } } ) - oSub1:addItem( { "-1254" , {|| oIde:setCodec( "Windows-1254" ) } } ) - oSub1:addItem( { "-1255" , {|| oIde:setCodec( "Windows-1255" ) } } ) - oSub1:addItem( { "-1256" , {|| oIde:setCodec( "Windows-1256" ) } } ) - oSub1:addItem( { "-1257" , {|| oIde:setCodec( "Windows-1257" ) } } ) - oSub1:addItem( { "-1258" , {|| oIde:setCodec( "Windows-1258" ) } } ) - oSubMenu:addItem( { oSub1, NIL } ) - - oSubMenu:addItem( { "WINSAMI2 " , {|| oIde:setCodec( "WINSAMI2" ) } } ) - oMenuBar:addItem( { oSubMenu, NIL } ) - - /* Tools */ + /*----------------------------------------------------------------------------*/ + /* Tools */ + /*----------------------------------------------------------------------------*/ oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~Tools" - oSubMenu:addItem( { _T( "Configure Tools...*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Configure Tools...*" ) , {|| oIde:execAction( "" ) } } ) hbide_menuAddSep( oSubMenu ) // TODO: Load custom TOOLS LINK from .INI file #ifdef __PLATFORM__WINDOWS - oSubMenu:addItem( { _T( "Command Prompt...*" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Command Prompt...*" ) , {|| oIde:execAction( "" ) } } ) #else - oSubMenu:addItem( { _T( "Terminal" ) , {|| oIde:executeAction( "" ) } } ) + oSubMenu:addItem( { _T( "Terminal" ) , {|| oIde:execAction( "" ) } } ) #endif oMenuBar:addItem( { oSubMenu, NIL } ) - /* Options */ + /*----------------------------------------------------------------------------*/ + /* Options */ + /*----------------------------------------------------------------------------*/ oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~Options" oSubMenu:addItem( { _T( "Themes" ) , {|| oIde:oThemes:fetch() } } ) oMenuBar:addItem( { oSubMenu, NIL } ) - /* Help */ + /*----------------------------------------------------------------------------*/ + /* Codec */ + /*----------------------------------------------------------------------------*/ + oSubMenu := hbide_buildCodecMenu( oIde, oMenuBar ) + oMenuBar:addItem( { oSubMenu, NIL } ) + + /*----------------------------------------------------------------------------*/ + /* Help */ + /*----------------------------------------------------------------------------*/ oSubMenu := XbpMenu():new( oMenuBar ):create() oSubMenu:title := "~Help" oSubMenu:addItem( { _T( "About hbIDE | vr-16x16.png" ) , {|| hbide_help( 1 ) } } ) @@ -453,6 +393,94 @@ FUNCTION buildMainMenu( oWnd, oIde ) Return Nil +/*----------------------------------------------------------------------*/ + +STATIC FUNCTION hbide_buildCodecMenu( oIde, oMenuBar ) + LOCAL oSubMenu, oSub1 + + oSubMenu := XbpMenu():new( oMenuBar ):create() + oSubMenu:title := "~Codec" + oSubMenu:addItem( { "Apple Roman " , {|| oIde:setCodec( "Apple Roman" ) } } ) + oSubMenu:addItem( { "Big5 " , {|| oIde:setCodec( "Big5" ) } } ) + oSubMenu:addItem( { "Big5-HKSCS " , {|| oIde:setCodec( "Big5-HKSCS" ) } } ) + oSubMenu:addItem( { "CP949 " , {|| oIde:setCodec( "CP949" ) } } ) + oSubMenu:addItem( { "EUC-JP " , {|| oIde:setCodec( "EUC-JP" ) } } ) + oSubMenu:addItem( { "EUC-KR " , {|| oIde:setCodec( "EUC-KR" ) } } ) + oSubMenu:addItem( { "GB18030-0 " , {|| oIde:setCodec( "GB18030-0" ) } } ) + oSubMenu:addItem( { "IBM 850 " , {|| oIde:setCodec( "IBM 850" ) } } ) + oSubMenu:addItem( { "IBM 866 " , {|| oIde:setCodec( "IBM 866" ) } } ) + oSubMenu:addItem( { "IBM 874 " , {|| oIde:setCodec( "IBM 874" ) } } ) + oSubMenu:addItem( { "ISO 2022-JP " , {|| oIde:setCodec( "ISO 2022-JP" ) } } ) + + oSub1 := XbpMenu():new( oSubMenu ):create() + oSub1:title := "ISO 8859-1 to 10" + oSub1:addItem( { "-1" , {|| oIde:setCodec( "ISO 8859-1" ) } } ) + oSub1:addItem( { "-2" , {|| oIde:setCodec( "ISO 8859-2" ) } } ) + oSub1:addItem( { "-3" , {|| oIde:setCodec( "ISO 8859-3" ) } } ) + oSub1:addItem( { "-4" , {|| oIde:setCodec( "ISO 8859-4" ) } } ) + oSub1:addItem( { "-5" , {|| oIde:setCodec( "ISO 8859-5" ) } } ) + oSub1:addItem( { "-6" , {|| oIde:setCodec( "ISO 8859-6" ) } } ) + oSub1:addItem( { "-7" , {|| oIde:setCodec( "ISO 8859-7" ) } } ) + oSub1:addItem( { "-8" , {|| oIde:setCodec( "ISO 8859-8" ) } } ) + oSub1:addItem( { "-9" , {|| oIde:setCodec( "ISO 8859-9" ) } } ) + oSub1:addItem( { "-10" , {|| oIde:setCodec( "ISO 8859-10" ) } } ) + oSubMenu:addItem( { oSub1, NIL } ) + + oSub1 := XbpMenu():new( oSubMenu ):create() + oSub1:title := "ISO 8859-13 to 16" + oSub1:addItem( { "-13" , {|| oIde:setCodec( "ISO 8859-13" ) } } ) + oSub1:addItem( { "-14" , {|| oIde:setCodec( "ISO 8859-14" ) } } ) + oSub1:addItem( { "-15" , {|| oIde:setCodec( "ISO 8859-15" ) } } ) + oSub1:addItem( { "-16" , {|| oIde:setCodec( "ISO 8859-16" ) } } ) + oSubMenu:addItem( { oSub1, NIL } ) + + oSub1 := XbpMenu():new( oSubMenu ):create() + oSub1:title := "Iscii" + oSub1:addItem( { "-Bng" , {|| oIde:setCodec( "Iscii-Bng" ) } } ) + oSub1:addItem( { "-Dev" , {|| oIde:setCodec( "Iscii-Dev" ) } } ) + oSub1:addItem( { "-Gjr" , {|| oIde:setCodec( "Iscii-Gjr" ) } } ) + oSub1:addItem( { "-Knd" , {|| oIde:setCodec( "Iscii-Knd" ) } } ) + oSub1:addItem( { "-Mlm" , {|| oIde:setCodec( "Iscii-Mlm" ) } } ) + oSub1:addItem( { "-Ori" , {|| oIde:setCodec( "Iscii-Ori" ) } } ) + oSub1:addItem( { "-Pnj" , {|| oIde:setCodec( "Iscii-Pnj" ) } } ) + oSub1:addItem( { "-Tlg" , {|| oIde:setCodec( "Iscii-Tlg" ) } } ) + oSub1:addItem( { "-Tml" , {|| oIde:setCodec( "Iscii-Tml" ) } } ) + oSubMenu:addItem( { oSub1, NIL } ) + + oSubMenu:addItem( { "JIS X 0201 " , {|| oIde:setCodec( "JIS X 0201" ) } } ) + oSubMenu:addItem( { "JIS X 0208 " , {|| oIde:setCodec( "JIS X 0208" ) } } ) + oSubMenu:addItem( { "KOI8-R " , {|| oIde:setCodec( "KOI8-R" ) } } ) + oSubMenu:addItem( { "KOI8-U " , {|| oIde:setCodec( "KOI8-U" ) } } ) + oSubMenu:addItem( { "MuleLao-1 " , {|| oIde:setCodec( "MuleLao-1" ) } } ) + oSubMenu:addItem( { "ROMAN8 " , {|| oIde:setCodec( "ROMAN8" ) } } ) + oSubMenu:addItem( { "Shift-JIS " , {|| oIde:setCodec( "Shift-JIS" ) } } ) + oSubMenu:addItem( { "TIS-620 " , {|| oIde:setCodec( "TIS-620" ) } } ) + oSubMenu:addItem( { "TSCII " , {|| oIde:setCodec( "TSCII" ) } } ) + oSubMenu:addItem( { "UTF-8 " , {|| oIde:setCodec( "UTF-8" ) } } ) + oSubMenu:addItem( { "UTF-16 " , {|| oIde:setCodec( "UTF-16" ) } } ) + oSubMenu:addItem( { "UTF-16BE " , {|| oIde:setCodec( "UTF-16BE" ) } } ) + oSubMenu:addItem( { "UTF-16LE " , {|| oIde:setCodec( "UTF-16LE" ) } } ) + oSubMenu:addItem( { "UTF-32 " , {|| oIde:setCodec( "UTF-32" ) } } ) + oSubMenu:addItem( { "UTF-32BE " , {|| oIde:setCodec( "UTF-32BE" ) } } ) + oSubMenu:addItem( { "UTF-32LE " , {|| oIde:setCodec( "UTF-32LE" ) } } ) + + oSub1 := XbpMenu():new( oSubMenu ):create() + oSub1:title := "Windows-1250 to 1258" + oSub1:addItem( { "-1250" , {|| oIde:setCodec( "Windows-1250" ) } } ) + oSub1:addItem( { "-1251" , {|| oIde:setCodec( "Windows-1251" ) } } ) + oSub1:addItem( { "-1252" , {|| oIde:setCodec( "Windows-1252" ) } } ) + oSub1:addItem( { "-1253" , {|| oIde:setCodec( "Windows-1253" ) } } ) + oSub1:addItem( { "-1254" , {|| oIde:setCodec( "Windows-1254" ) } } ) + oSub1:addItem( { "-1255" , {|| oIde:setCodec( "Windows-1255" ) } } ) + oSub1:addItem( { "-1256" , {|| oIde:setCodec( "Windows-1256" ) } } ) + oSub1:addItem( { "-1257" , {|| oIde:setCodec( "Windows-1257" ) } } ) + oSub1:addItem( { "-1258" , {|| oIde:setCodec( "Windows-1258" ) } } ) + oSubMenu:addItem( { oSub1, NIL } ) + + oSubMenu:addItem( { "WINSAMI2 " , {|| oIde:setCodec( "WINSAMI2" ) } } ) + + RETURN oSubMenu + /*----------------------------------------------------------------------*/ /* * 02/01/2010 - 22:44:19 @@ -485,7 +513,7 @@ STATIC FUNCTION hbide_mnuUpdateMRUpopup( oIde, nType ) // msgbox( ToString( oMenuBar:aMenuItems[ n ] )) oItem := oMenuBar:aMenuItems[ n ] - c := Upper( oItem[3] ) + c := Upper( oItem[ 3 ] ) c := StrTran( c, '~', '' ) c := StrTran( c, '&', '' ) @@ -499,25 +527,25 @@ STATIC FUNCTION hbide_mnuUpdateMRUpopup( oIde, nType ) RETURN nil ENDIF - oItem[4]:delAllItems() + oItem[ 4 ]:delAllItems() FOR n := 1 TO Len( oIde:aIni[ nType ] ) c := hbide_pathNormalized( oIde:aIni[ nType , n ], .F. ) lEmpty := .F. - oItem[4]:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + c ) , nil } ) + oItem[ 4 ]:addItem( { _T( '~' + hb_NumToHex( n ) + '. ' + c ) , nil } ) IF !hb_FileExists(c) - oItem[4]:disableItem( n ) + oItem[ 4 ]:disableItem( n ) ENDIF NEXT IF lEmpty IF nType == INI_RECENTFILES - oItem[4]:addAction( "** No recent files found **" ) + oItem[ 4 ]:addAction( "** No recent files found **" ) ELSE - oItem[4]:addAction( "** No recent projects found **" ) + oItem[ 4 ]:addAction( "** No recent projects found **" ) ENDIF - oItem[4]:disableItem( 1 ) + oItem[ 4 ]:disableItem( 1 ) ENDIF RETURN nil @@ -563,7 +591,7 @@ FUNCTION hbide_mnuFindItem( oIde, cCaption ) LOCAL oItem LOCAL n, c - IF Empty(oIde:oDlg ) + IF Empty( oIde:oDlg ) RETURN nil ENDIF @@ -573,7 +601,7 @@ FUNCTION hbide_mnuFindItem( oIde, cCaption ) FOR n := 1 TO oMenuBar:numItems() oItem := oMenuBar:aMenuItems[ n ] - c := Upper( oItem[3] ) + c := Upper( oItem[ 3 ] ) c := StrTran( c, '~', '' ) c := StrTran( c, '&', '' ) diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index 5c87eee1f1..09d4e2219f 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -67,6 +67,7 @@ #include "hbide.ch" #include "common.ch" #include "hbclass.ch" +#include "xbp.ch" #include "hbqt.ch" /*----------------------------------------------------------------------*/ @@ -79,6 +80,14 @@ CLASS IdeDockS INHERIT IdeObject METHOD create() METHOD destroy() + METHOD buildDialog() + + METHOD buildMainMenu() + METHOD buildToolBar() + METHOD buildStatusBar() + + METHOD buildDockWidgets() + METHOD buildProjectTree() METHOD buildEditorTree() METHOD buildFuncList() @@ -106,6 +115,71 @@ METHOD IdeDocks:create( oIde ) ::oIde := oIde + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeDocks:destroy() + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeDocks:buildDialog() + + #if 1 + LOCAL oUI + oUI := XbpQtUiLoader():new() + oUI:file := ::resPath + "mainWindow.ui" + oUI:create() + + ::oIde:oDlg := XbpDialog():new() + ::oDlg:icon := ::resPath + "vr.png" // "hbide.png" + ::oDlg:title := "Harbour-Qt IDE" + ::oDlg:qtObject := oUI:oWidget + ::oDlg:create() + #else + ::oIde:oDlg := XbpDialog():new( , , {10,10}, {1100,700}, , .f. ) + ::oDlg:icon := ::resPath + "vr.png" // "hbide.png" + ::oDlg:title := "Harbour-Qt IDE" + ::oDlg:create() + #endif + + ::oDlg:setStyleSheet( GetStyleSheet( "QMainWindow" ) ) + + ::oDlg:close := {|| MsgBox( "HbIDE is about to be closed!" ), .T. } + ::oDlg:oWidget:setDockOptions( QMainWindow_AllowTabbedDocks + QMainWindow_ForceTabbedDocks ) + ::oDlg:oWidget:setTabPosition( Qt_BottomDockWidgetArea, QTabWidget_South ) + + ::oIde:oDa := ::oDlg:drawingArea + + SetAppWindow( ::oDlg ) + + ::oIde:setPosAndSizeByIni( ::oDlg:oWidget, MainWindowGeometry ) + ::oDlg:Show() + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeDocks:buildMainMenu() + + buildMainMenu( ::oDlg, ::oIde ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeDocks:buildToolBar() + + ::oIde:oTBar := buildToolBar( ::oDlg, ::oIde ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeDocks:buildDockWidgets() + ::buildProjectTree() ::buildEditorTree() ::buildFuncList() @@ -120,12 +194,6 @@ METHOD IdeDocks:create( oIde ) /*----------------------------------------------------------------------*/ -METHOD IdeDocks:destroy() - - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD IdeDocks:buildProjectTree() LOCAL i @@ -350,3 +418,29 @@ METHOD IdeDocks:outputDoubleClicked( lSelected ) RETURN nLine /*----------------------------------------------------------------------*/ + +METHOD IdeDocks:buildStatusBar() + + ::oIde:oSBar := XbpStatusBar():new() + ::oSBar:create( ::oDlg, , { 0,0 }, { ::oDlg:currentSize()[ 1 ], 30 } ) + ::oSBar:oWidget:showMessage( "" ) + + ::oSBar:getItem( SB_PNL_MAIN ):autosize := XBPSTATUSBAR_AUTOSIZE_SPRING + + ::oSBar:addItem( "", , , , "Ready" ):oWidget:setMinimumWidth( 80 ) + ::oSBar:addItem( "", , , , "Line" ):oWidget:setMinimumWidth( 110 ) + ::oSBar:addItem( "", , , , "Column" ):oWidget:setMinimumWidth( 40 ) + ::oSBar:addItem( "", , , , "Ins" ):oWidget:setMinimumWidth( 30 ) + ::oSBar:addItem( "", , , , "M_1" ):oWidget:setMinimumWidth( 30 ) + ::oSBar:addItem( "", , , , "Modified" ):oWidget:setMinimumWidth( 50 ) + ::oSBar:addItem( "", , , , "M_2" ):oWidget:setMinimumWidth( 30 ) + ::oSBar:addItem( "", , , , "Stream" ):oWidget:setMinimumWidth( 20 ) + ::oSBar:addItem( "", , , , "Edit" ):oWidget:setMinimumWidth( 20 ) + ::oSBar:addItem( "", , , , "Search" ):oWidget:setMinimumWidth( 20 ) + ::oSBar:addItem( "", , , , "Codec" ):oWidget:setMinimumWidth( 20 ) + ::oSBar:addItem( "", , , , "Project" ):oWidget:setMinimumWidth( 20 ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index d7508365ad..1fca5feed5 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -73,6 +73,146 @@ /*----------------------------------------------------------------------*/ +CLASS IdeEditsManager INHERIT IdeObject + + METHOD new() + METHOD create() + + METHOD goto() + METHOD printPreview() + METHOD paintRequested() + METHOD showPPO() + METHOD closePPO() + + ENDCLASS + +/*----------------------------------------------------------------------*/ + +METHOD IdeEditsManager:new( oIde ) + + ::oIde := oIde + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEditsManager:create( oIde ) + + DEFAULT oIde TO ::oIde + + ::oIde := oIde + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEditsManager:printPreview() + LOCAL qDlg + + IF empty( ::qCurEdit ) + RETURN Self + ENDIF + + qDlg := QPrintPreviewDialog():new( ::oDlg:oWidget ) + qDlg:setWindowTitle( "Harbour-QT Preview Dialog" ) + Qt_Slots_Connect( ::pSlots, qDlg, "paintRequested(QPrinter)", {|o,p| ::paintRequested( p,o ) } ) + qDlg:exec() + Qt_Slots_disConnect( ::pSlots, qDlg, "paintRequested(QPrinter)" ) + + RETURN self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEditsManager:paintRequested( pPrinter ) + LOCAL qPrinter + + qPrinter := QPrinter():configure( pPrinter ) + + ::qCurEdit:print( qPrinter ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEditsManager:goto() + LOCAL qGo, nLine, qCursor + + IF empty( ::qCurEdit ) + RETURN Self + ENDIF + + qCursor := QTextCursor():configure( ::qCurEdit:textCursor() ) + nLine := qCursor:blockNumber() + + qGo := QInputDialog():new( ::oDlg:oWidget ) + qGo:setIntMinimum( 1 ) + qGo:setIntMaximum( ::qCurDocument:blockCount() ) + qGo:setIntValue( nLine + 1 ) + qGo:setLabelText( "Goto Line Number [1-" + hb_ntos( ::qCurDocument:blockCount() ) + "]" ) + qGo:setWindowTitle( "Harbour-Qt" ) + + ::setPosByIni( qGo, GotoDialogGeometry ) + qGo:exec() + ::aIni[ INI_HBIDE, GotoDialogGeometry ] := hbide_posAndSize( qGo ) + + nLine := qGo:intValue() - nLine + + qGo:pPtr := 0 + + IF nLine < 0 + qCursor:movePosition( QTextCursor_Up, QTextCursor_MoveAnchor, abs( nLine ) + 1 ) + ELSEIF nLine > 0 + qCursor:movePosition( QTextCursor_Down, QTextCursor_MoveAnchor, nLine - 1 ) + ENDIF + ::qCurEdit:setTextCursor( qCursor ) + + RETURN nLine + +/*----------------------------------------------------------------------*/ + +METHOD IdeEditsManager:showPPO( cFile ) + LOCAL qEdit, qHiliter + + IF hb_fileExists( cFile ) + qEdit := QPlainTextEdit():new() + qEdit:setPlainText( hb_memoRead( cFile ) ) + qEdit:setLineWrapMode( QTextEdit_NoWrap ) + qEdit:setFont( ::oIde:oFont:oWidget ) + qEdit:ensureCursorVisible() + + qEdit:setWindowTitle( cFile ) + qEdit:resize( 600, 400 ) + + qHiliter := ::oIde:oThemes:SetSyntaxHilighting( qEdit ) + + Qt_Events_Connect( ::pEvents, qEdit, QEvent_Close, {|| ::closePPO( qEdit, qHiliter, cFile, .t. ) } ) + + qEdit:show() + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEditsManager:closePPO( qEdit, qHiliter, cFile, lDel ) + + Qt_Events_DisConnect( ::pEvents, qEdit, QEvent_Close ) + + qHiliter:pPtr := 0 + qEdit:close() + qEdit:pPtr := 0 + + IF lDel + ferase( cFile ) + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ +// +// CLASS IdeEditor +// +/*----------------------------------------------------------------------*/ + CLASS IdeEditor INHERIT IdeObject DATA oTab @@ -110,8 +250,6 @@ CLASS IdeEditor INHERIT IdeObject METHOD onBlockCountChanged() METHOD setTabImage() METHOD applyTheme() - METHOD showPPO() - METHOD closePPO() ENDCLASS @@ -175,7 +313,6 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) Qt_Slots_Connect( ::pSlots, ::qEdit , "textChanged()" , {|| ::setTabImage() } ) Qt_Slots_Connect( ::pSlots, ::qEdit , "cursorPositionChanged()", {|| ::dispEditInfo() } ) - Qt_Slots_Connect( ::pSlots, ::qDocument, "blockCountChanged(int)" , {|o,i| ::onBlockCountChanged( i, o ) } ) ::qEdit:show() @@ -309,11 +446,10 @@ METHOD IdeEditor:buildTabPage( cSource ) ::oTab := XbpTabPage():new( ::oIde:oDA, , { 5,5 }, { 700,400 }, , .t. ) IF Empty( cSource ) - ::oTab:caption := "Untitled " + hb_ntos( hbide_getNextUntitled() ) + ::oTab:caption := "Untitled " + hb_ntos( hbide_getNextUntitled() ) ELSE - ::oTab:caption := ::cFile + ::cExt + ::oTab:caption := ::cFile + ::cExt ENDIF - ::oTab:minimized := .F. ::oTab:create() @@ -421,45 +557,6 @@ METHOD IdeEditor:setTabImage() /*----------------------------------------------------------------------*/ -METHOD IdeEditor:showPPO( cFile ) - LOCAL qEdit, qHiliter - - IF file( cFile ) - qEdit := QPlainTextEdit():new() - qEdit:setPlainText( hb_memoRead( cFile ) ) - qEdit:setLineWrapMode( QTextEdit_NoWrap ) - qEdit:setFont( ::oIde:oFont:oWidget ) - qEdit:ensureCursorVisible() - - qEdit:setWindowTitle( cFile ) - qEdit:resize( 600, 400 ) - - qHiliter := ::oIde:oThemes:SetSyntaxHilighting( qEdit ) - - Qt_Events_Connect( ::pEvents, qEdit, QEvent_Close, {|| ::closePPO( qEdit, qHiliter, cFile, .t. ) } ) - - qEdit:show() - ENDIF - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeEditor:closePPO( qEdit, qHiliter, cFile, lDel ) - - Qt_Events_DisConnect( ::pEvents, qEdit, QEvent_Close ) - - qHiliter:pPtr := 0 - qEdit:close() - qEdit:pPtr := 0 - - IF lDel - ferase( cFile ) - ENDIF - - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD IdeEditor:applyTheme( cTheme ) IF ::cType != "U" diff --git a/harbour/contrib/hbide/ideobject.prg b/harbour/contrib/hbide/ideobject.prg index 6675416f00..01bdd5fdfe 100644 --- a/harbour/contrib/hbide/ideobject.prg +++ b/harbour/contrib/hbide/ideobject.prg @@ -78,6 +78,11 @@ CLASS IdeObject DATA oIde DATA oUI + ACCESS oFR INLINE ::oIde:oFR + ACCESS oED INLINE ::oIde:oED + ACCESS oPM INLINE ::oIde:oPM + ACCESS oDK INLINE ::oIde:oDK + ACCESS qCurEdit INLINE ::oIde:qCurEdit ACCESS qTabWidget INLINE ::oIde:oDA:oTabWidget:oWidget diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index c2b3fa9ad3..4ab99fdfd7 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -444,11 +444,11 @@ METHOD IdeProjManager:setCurrentProject( cProjectName ) LOCAL lValid := .T. IF Empty( cProjectName ) - ::cWrkProject := '' + ::oIde: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 ] + ::oIde:cWrkProject := aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] ELSE MsgBox( 'Invalid project selected: "' + cProjectName + '"' ) @@ -480,6 +480,7 @@ METHOD IdeProjManager:getCurrentProject() ENDIF IF Len( ::aProjects ) == 1 + ::setCurrentProject( ::aProjects[ 1, 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] ) RETURN ::aProjects[ 1, 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] ENDIF @@ -509,7 +510,8 @@ METHOD IdeProjManager:selectCurrentProject() ENDIF NEXT - oDlg:signal( "btnOk" , "clicked()", {|| ::setCurrentProject( oDlg:qObj[ "cbProjects" ]:currentText() ), oDlg:oWidget:close() } ) + oDlg:signal( "btnOk" , "clicked()", {|| ::setCurrentProject( oDlg:qObj[ "cbProjects" ]:currentText() ), ; + oDlg:oWidget:close() } ) oDlg:signal( "btnCancel", "clicked()", {|| oDlg:oWidget:close() } ) oDlg:exec() @@ -616,26 +618,27 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) lDelHbp := lPPO - IF lPPO .AND. ::getCurrentTab() == 0 + IF lPPO .AND. ::getCurrentTab() == 0 MsgBox( 'No file open issue to be compiled!' ) RETURN Self End IF empty( cProject ) - cProject := ::oPM:getCurrentProject() + 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 ] + 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 ) + cTargetFN := hbide_pathToOSPath( cTargetFN ) +// cTargetFN := StrTran( cTargetFN, '/', ::pathSep ) +// cTargetFN := StrTran( cTargetFN, '\', ::pathSep ) /* * Creates a temporary file to avoid erase the file. Hbp correct this project. @@ -658,7 +661,7 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) aadd( aHbp, "-q" ) aadd( aHbp, "-trace" ) aadd( aHbp, "-info" ) - +hbide_dbg( cTargetFN ) IF lRebuild aadd( aHbp, "-rebuild" ) End @@ -699,11 +702,12 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) 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 + cTmp := hbide_outputLine() + CRLF + ; + "Project [ " + cProject + " ] " + ; + "Launch [ " + iif( lLaunch , 'Yes', 'No' ) + " ] " + ; + "Rebuild [ " + iif( lRebuild, 'Yes', 'No' ) + " ] " + ; + "Started [ " + time() + " ]" + CRLF + ; + hbide_outputLine() + CRLF IF lViaQt qStringList := QStringList():new() @@ -755,7 +759,7 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) ENDIF IF lPPO .AND. hb_FileExists( cFileName ) - ::aEdits[ 1 ]:showPPO( cFileName ) + ::oED:showPPO( cFileName ) ENDIF RETURN Self @@ -798,10 +802,10 @@ METHOD IdeProjManager:readProcessInfo( nMode, i, ii ) 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 + cTmp := hbide_outputLine() + CRLF + cTmp += "Exit Code [ " + hb_ntos( i ) + " ] Exit Status [ " + hb_ntos( ii ) + " ] " +; + "Finished at [ " + time() + " ] Done in [ " + hb_ntos( seconds() - ::nStarted ) +" Secs ]" + CRLF + cTmp += hbide_outputLine() + CRLF ::oOutputResult:oWidget:append( cTmp ) @@ -869,3 +873,13 @@ METHOD IdeProjManager:LaunchProject( cProject ) RETURN Self /*----------------------------------------------------------------------*/ + +STATIC FUNCTION hbide_outputLine( cLine, nOccur ) + + DEFAULT cLine TO "-" + DEFAULT nOccur TO 100 + + RETURN replicate( cLine, nOccur ) + +/*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbide/idethemes.prg b/harbour/contrib/hbide/idethemes.prg index a608cdf74c..6b72e840e2 100644 --- a/harbour/contrib/hbide/idethemes.prg +++ b/harbour/contrib/hbide/idethemes.prg @@ -170,7 +170,7 @@ METHOD IdeThemes:create( oIde, cIniFile ) /* These are the supported patterns - rest will be ignore until implemented */ /* Compiler Directives */ - b_:= { "include","ifdef","else","endif","command","xcommand","translate","xtranslate" } + b_:= { "include","define","ifndef","ifdef","else","endif","command","xcommand","translate","xtranslate" } s := ""; aeval( b_, {|e| s += iif( empty( s ), "", "|" ) + "#" + upper( e ) + "\b|#" + e + "\b" } ) aadd( ::aPatterns, { "PreprocessorDirectives", s } )