2010-01-05 02:59 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbxbp/xbpmenubar.prg
  * contrib/hbxbp/xbptoolbar.prg
    + Implemented to accept QAction() as menu constructor.
      Before only cCaption or XbpMenu() were accepted.

  * contrib/hbide/hbide.ch
  * contrib/hbide/hbide.prg
  * contrib/hbide/ideactions.prg
  * contrib/hbide/idedocks.prg
  * contrib/hbide/idemisc.prg
  * contrib/hbide/ideobject.prg
  * contrib/hbide/ideprojmanager.prg
    ! Next round of reforms.

    + Implemented IdeActions() class which forms the basis 
      of IDE's menus and toolbars. Now we have greater control
      over the uniformity of different actions hooked into 
      different interface elements, i.e., menu option, toolbar
      option or popup option. The same visual experience is 
      presented in all the three flavours. 

      It also implies that we can switch on/off any action 
      only at one place. For example, if you issue this command:
         ::oAC:getAction( "Save" ):setEnabled( .f. )
      then the option will be grayed in any flavour of user 
      interaction, viz., menu, toolbar, or context menu.

      The code is much cleaner and paves the way to be reloaded
      with various means.
This commit is contained in:
Pritpal Bedi
2010-01-05 11:15:07 +00:00
parent 6dfe3f612f
commit 24e67cf403
10 changed files with 650 additions and 177 deletions

View File

@@ -17,6 +17,37 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-01-05 02:59 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbxbp/xbpmenubar.prg
* contrib/hbxbp/xbptoolbar.prg
+ Implemented to accept QAction() as menu constructor.
Before only cCaption or XbpMenu() were accepted.
* contrib/hbide/hbide.ch
* contrib/hbide/hbide.prg
* contrib/hbide/ideactions.prg
* contrib/hbide/idedocks.prg
* contrib/hbide/idemisc.prg
* contrib/hbide/ideobject.prg
* contrib/hbide/ideprojmanager.prg
! Next round of reforms.
+ Implemented IdeActions() class which forms the basis
of IDE's menus and toolbars. Now we have greater control
over the uniformity of different actions hooked into
different interface elements, i.e., menu option, toolbar
option or popup option. The same visual experience is
presented in all the three flavours.
It also implies that we can switch on/off any action
only at one place. For example, if you issue this command:
::oAC:getAction( "Save" ):setEnabled( .f. )
then the option will be grayed in any flavour of user
interaction, viz., menu, toolbar, or context menu.
The code is much cleaner and paves the way to be reloaded
with various means.
2010-01-05 03:51 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapicdp.h
* removed unused in current code HB_CODEPAGE_INIT() macro

View File

@@ -146,5 +146,12 @@
#define TRE_ORIGINAL 4
#define TRE_DATA 5
#define ACT_NAME 1
#define ACT_TEXT 2
#define ACT_IMAGE 3
#define ACT_SHORTCUT 4
#define ACT_CHECKABLE 5
#define ACT_VISINMENU 6
#endif

View File

@@ -117,6 +117,7 @@ CLASS HbIde
DATA oFR
DATA oDK
DATA oED
DATA oAC
DATA mp1, mp2, oXbp, nEvent
DATA aTabs INIT {}
@@ -286,8 +287,13 @@ METHOD HbIde:create( cProjIni )
::oDK := IdeDocks():new():create( Self )
/* Build IDE's Main Window */
::oDK:buildDialog()
::oDK:buildMainMenu()
::oDK:buildToolBar()
/* Build Actions */
::oAC := IdeActions():new( Self ):create()
/* Build Toolbar */
::oAC:buildToolBar()
/* Build Main Menu */
::oAC:buildMainMenu()
//::oDK:buildMainMenu()
::oDK:buildStatusBar()
::oDK:buildDockWidgets()
@@ -421,14 +427,14 @@ METHOD HbIde:execAction( cKey )
CASE cKey == "LaunchProject"
::oPM:launchProject()
CASE cKey == "SaveBuild"
CASE cKey == "Build"
::oPM:buildProject( '', .F., .F. )
CASE cKey == "SaveBuildLaunch"
CASE cKey == "BuildLaunch"
::oPM:buildProject( '', .T., .F. )
CASE cKey == "SaveRebuild"
CASE cKey == "Rebuild"
::oPM:buildProject( '', .F., .T. )
CASE cKey == "SaveRebuildLaunch"
CASE cKey == "RebuildLaunch"
::oPM:buildProject( '', .T., .T. )
CASE cKey == "Compile"
@@ -988,7 +994,7 @@ METHOD HbIde:updateProjectTree( aPrj, lRemove )
RETURN Self
ENDIF
nPos := aScan( ::aProjData, {|e_| e_[ 2 ] == "Project Name" .and. e_[ 4 ] == cProject } )
nPos := aScan( ::aProjData, {|e_| e_[ TRE_TYPE ] == "Project Name" .and. e_[ TRE_ORIGINAL ] == cProject } )
cType := aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ]
DO CASE
@@ -1028,11 +1034,11 @@ METHOD HbIde:updateProjectTree( aPrj, lRemove )
* 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?
::aProjData[ j, TRE_TYPE ] != 'Path' .OR. ; // Is not an path?
::aProjData[ j, TRE_DATA ] != cProject // Is not from same project?
LOOP
ENDIF
AAdd( aPath, { ::aProjData[ j, 4 ], ::aProjData[ j, 1 ]} )
AAdd( aPath, { ::aProjData[ j, TRE_ORIGINAL ], ::aProjData[ j, 1 ]} )
NEXT
* Add new nodes with file names to tree...
@@ -1054,8 +1060,8 @@ METHOD HbIde:updateProjectTree( aPrj, lRemove )
oPP := aPath[ nPath,2 ]
cFile := cFile + cExt
nPos := aScan( ::aProjData, {|e_| e_[ 2 ] == "Source File" .AND. ;
e_[ 4 ] == aSrc[ j ] } )
nPos := aScan( ::aProjData, {|e_| e_[ TRE_TYPE ] == "Source File" .AND. ;
e_[ TRE_ORIGINAL ] == aSrc[ j ] } )
IF nPos == 00
aadd( ::aProjData, { oPP:addItem( cFile ), "Source File", oPP, aSrc[ j ], cProject } )
ENDIF
@@ -1065,18 +1071,18 @@ METHOD HbIde:updateProjectTree( aPrj, lRemove )
FOR j := 1 TO LEN( ::aProjData )
* Is not from same project?
IF !hb_isChar( ::aProjData[ j, 5 ] ) .OR. ;
::aProjData[ j, 5 ] != cProject
IF !hb_isChar( ::aProjData[ j, TRE_DATA ] ) .OR. ;
::aProjData[ j, TRE_DATA ] != cProject
LOOP
ENDIF
* It is a path?
IF ::aProjData[ j, 2 ] == 'Path'
cPathA := ::aProjData[ j, 4 ]
cPathA := ::aProjData[ j, TRE_ORIGINAL ]
nPath := aScan( aInUse, {|e_| e_ == cPathA } )
IF nPath == 00
::aProjData[ j, 3 ]:delItem( ::aProjData[ j, 1 ] )
::aProjData[ j, TRE_OPARENT ]:delItem( ::aProjData[ j, 1 ] )
hb_aDel( ::aProjData, j, .T. )
ENDIF
@@ -1085,11 +1091,11 @@ METHOD HbIde:updateProjectTree( aPrj, lRemove )
* It is a filename?
IF ::aProjData[ j, 2 ] == 'Source File'
cFile := ::aProjData[ j, 4 ]
cFile := ::aProjData[ j, TRE_ORIGINAL ]
nPos := aScan( aSrc, {|e_| e_ == cFile } )
IF nPos == 00
::aProjData[ j, 3 ]:delItem( ::aProjData[ j, 1 ] )
::aProjData[ j, TRE_OPARENT ]:delItem( ::aProjData[ j, TRE_OITEM ] )
hb_aDel( ::aProjData, j, .T. )
ENDIF
@@ -1134,7 +1140,7 @@ METHOD HbIde:addSourceInTree( cSourceFile )
ENDIF
aadd( ::aProjData, { oParent:addItem( cFile+cExt ), "Opened Source", oParent, ;
cSourceFile, hbide_pathNormalized( cSourceFile ) } )
cSourceFile, hbide_pathNormalized( cSourceFile ) } )
RETURN Self
/*----------------------------------------------------------------------*/
@@ -1216,21 +1222,20 @@ 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" , {|| ::oPM:setCurrentProject( oXbpTreeItem:caption ) } } )
aadd( aPops, { "Set as Current" , {|| ::oPM:setCurrentProject( oXbpTreeItem:caption ) } } )
End
aadd( aPops, { "Properties" , {|| ::oPM:loadProperties( cHbi, .f., .t., .t. ) } } )
aadd( aPops, { ::oAC:getAction( "Properties" ), {|| ::oPM:loadProperties( cHbi, .f., .t., .t. ) } } )
aadd( aPops, { "" } )
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, { "Save and Build ( Qt )" , {|| ::oPM:buildProjectViaQt( oXbpTreeItem:caption ) } } )
// aadd( aPops, { "" } )
aadd( aPops, { ::oAC:getAction( "Build" ), {|| ::oPM:buildProject( oXbpTreeItem:caption, .F., , , .T. ) } } )
aadd( aPops, { ::oAC:getAction( "BuildLaunch" ), {|| ::oPM:buildProject( oXbpTreeItem:caption, .T., , , .T. ) } } )
aadd( aPops, { ::oAC:getAction( "ReBuild" ), {|| ::oPM:buildProject( oXbpTreeItem:caption, .F., .T., , .T. ) } } )
aadd( aPops, { ::oAC:getAction( "ReBuildLaunch" ), {|| ::oPM:buildProject( oXbpTreeItem:caption, .T., .T., , .T. ) } } )
aadd( aPops, { "" } )
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, { "Launch" , {|| ::oPM:launchProject( oXbpTreeItem:caption ) } } )
aadd( aPops, { "" } )
aadd( aPops, { "Launch" , {|| ::oPM:launchProject( oXbpTreeItem:caption ) } } )
aadd( aPops, { "" } )
aadd( aPops, { "Close This Project" , {|| ::oPM:closeProject( oXbpTreeItem:caption ) } } )
aadd( aPops, { "Close This Project" , {|| ::oPM:closeProject( oXbpTreeItem:caption ) } } )
//
hbide_ExecPopup( aPops, mp1, ::oProjTree:oWidget )

View File

@@ -65,148 +65,417 @@
/*----------------------------------------------------------------------*/
#include "common.ch"
#include "hbclass.ch"
#include "xbp.ch"
#include "inkey.ch"
#include "hbide.ch"
/*----------------------------------------------------------------------*/
FUNCTION buildToolBar( oWnd, oIde )
LOCAL oTBar
LOCAL cResPath := hb_DirBase() + "resources" + hb_OsPathSeparator()
#define _T( x ) ( mnuNormalizeItem( x ) )
oTBar := XbpToolBar():new( oWnd )
/*----------------------------------------------------------------------*/
CLASS IdeActions INHERIT IdeObject
DATA hActions INIT hb_hash()
METHOD new()
METHOD create()
METHOD buildMainMenu()
METHOD buildToolBar()
METHOD buildActions()
METHOD getAction()
METHOD loadActions()
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD IdeActions:new( oIde )
hb_hCaseMatch( ::hActions, .f. )
::oIde := oIde
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeActions:create( oIde )
DEFAULT oIde TO ::oIde
::oIde := oIde
::buildActions()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeActions:getAction( cKey )
IF hb_hHasKey( ::hActions, cKey )
RETURN ::hActions[ cKey ]
ENDIF
RETURN nil
/*----------------------------------------------------------------------*/
METHOD IdeActions:buildActions()
LOCAL qAction, aAct, k, a_
aAct := ::loadActions()
FOR EACH a_ IN aAct
qAction := QAction():new( ::qDlg )
qAction:setText( strtran( a_[ ACT_TEXT ], "~", "&" ) )
IF !empty( a_[ ACT_IMAGE ] )
qAction:setIcon( ::resPath + a_[ ACT_IMAGE ] + ".png" )
ENDIF
IF !empty( a_[ ACT_SHORTCUT ] )
k := a_[ ACT_SHORTCUT ]
k := strtran( k, "Sh+", "Shift+" )
k := strtran( k, "SH+", "Shift+" )
k := strtran( k, "^" , "Ctrl+" )
qAction:setShortcut( QKeySequence():new( k ) )
ENDIF
qAction:setTooltip( strtran( a_[ ACT_TEXT ], "~", "" ) )
::hActions[ a_[ ACT_NAME ] ] := qAction
NEXT
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeActions:loadActions()
LOCAL aAct := {}
// <Text> can be loaded from .ini or similar mechanism given <Name>
//
// Name Text Image Shortcut Checkable IconVisInMenu
//
aadd( aAct, { "Exit" , "E~xit" , "exit" , "Sh+^W", "No", "Yes" } )
aadd( aAct, { "New" , "~Source" , "new" , "^N" , "No", "Yes" } )
aadd( aAct, { "Open" , "~Open" , "open" , "^O" , "No", "Yes" } )
aadd( aAct, { "Save" , "~Save" , "save" , "^S" , "No", "Yes" } )
aadd( aAct, { "Close" , "~Close" , "close" , "^W" , "No", "Yes" } )
aadd( aAct, { "Print" , "~Print" , "print" , "^P" , "No", "Yes" } )
aadd( aAct, { "Compile" , "Co~mpile" , "compile" , "" , "No", "Yes" } )
aadd( aAct, { "CompilePPO" , "Com~pile to PPO" , "ppo" , "" , "No", "Yes" } )
aadd( aAct, { "Build" , "Build Project" , "build" , "" , "No", "Yes" } )
aadd( aAct, { "BuildLaunch" , "Build and Launch" , "buildlaunch" , "" , "No", "Yes" } )
aadd( aAct, { "Rebuild" , "Rebuild Project" , "rebuild" , "" , "No", "Yes" } )
aadd( aAct, { "RebuildLaunch" , "Rebuild and Launch" , "rebuildlaunch" , "" , "No", "Yes" } )
aadd( aAct, { "ToggleProjectTree" , "Toggle Project Tree" , "properties" , "" , "No", "Yes" } )
aadd( aAct, { "ToggleBuildInfo" , "Toggle Build Info" , "builderror" , "" , "No", "Yes" } )
aadd( aAct, { "ToggleFuncList" , "Toggle Function List" , "modulelist" , "" , "No", "Yes" } )
aadd( aAct, { "Undo" , "~Undo" , "undo" , "" , "No", "Yes" } )
aadd( aAct, { "Redo" , "~Redo" , "redo" , "" , "No", "Yes" } )
aadd( aAct, { "Cut" , "C~ut" , "cut" , "" , "No", "Yes" } )
aadd( aAct, { "Copy" , "~Copy" , "copy" , "" , "No", "Yes" } )
aadd( aAct, { "Paste" , "~Paste" , "paste" , "" , "No", "Yes" } )
aadd( aAct, { "SelectAll" , "Select ~All" , "selectall" , "" , "No", "Yes" } )
aadd( aAct, { "SelectionMode" , "Toggle Selection Mode" , "stream" , "" , "No", "Yes" } )
aadd( aAct, { "Find" , "~Find / Replace" , "find" , "^F" , "No", "Yes" } )
aadd( aAct, { "Search" , "Search" , "search" , "" , "No", "Yes" } )
aadd( aAct, { "SetMark" , "Set Mark" , "placeremovemark", "" , "No", "Yes" } )
aadd( aAct, { "GotoMark" , "Goto Mark" , "gotomark" , "" , "No", "Yes" } )
aadd( aAct, { "Goto" , "~Goto Line" , "gotoline" , "^G" , "No", "Yes" } )
aadd( aAct, { "ToUpper" , "To Upper" , "toupper" , "" , "No", "Yes" } )
aadd( aAct, { "ToLower" , "To Lower" , "tolower" , "" , "No", "Yes" } )
aadd( aAct, { "Invert" , "Invert" , "invertcase" , "" , "No", "Yes" } )
aadd( aAct, { "MatchPairs" , "Match Pairs" , "matchobj" , "" , "No", "Yes" } )
aadd( aAct, { "ZoomIn" , "ZoomIn" , "zoomin" , "" , "No", "Yes" } )
aadd( aAct, { "ZoomOut" , "ZoomOut" , "zoomout" , "" , "No", "Yes" } )
//
aadd( aAct, { "NewProject" , "~Project" , "project" , "" , "No", "Yes" } )
aadd( aAct, { "LoadProject" , "Open Projec~t" , "" , "" , "No", "Yes" } )
aadd( aAct, { "SaveAs" , "Save ~As" , "saveas" , "" , "No", "Yes" } )
aadd( aAct, { "SaveAll" , "Save A~ll" , "saveall" , "Sh+^s", "No", "Yes" } )
aadd( aAct, { "CloseAll" , "Clos~e All" , "closeall" , "" , "No", "Yes" } )
aadd( aAct, { "Revert" , "~Revert to Saved" , "" , "Sh+^R", "No", "Yes" } )
aadd( aAct, { "ExportHTML" , "~Export to HTML" , "exporthtml" , "" , "No", "Yes" } )
aadd( aAct, { "InsertDateTime" , "~Date && Time" , "insert-datetime", "Sh+F7", "No", "Yes" } )
aadd( aAct, { "InsertRandomName" , "~Random Function Name" , "insert-procname", "Sh+F8", "No", "Yes" } )
aadd( aAct, { "InsertExternalFile", "~External File at Cursor" , "insert-external-file", "", "No", "Yes" } )
aadd( aAct, { "switchReadOnly" , "Switch Read~Only Mode" , "readonly" , "" , "No", "Yes" } )
aadd( aAct, { "Properties" , "Properties" , "" , "" , "No", "Yes" } )
aadd( aAct, { "ProjAddSource" , "Add Source to Project" , "projectadd" , "" , "No", "Yes" } )
aadd( aAct, { "ProjRemSource" , "Remove Source" , "projectdel" , "" , "No", "Yes" } )
aadd( aAct, { "ProjMainModule" , "Select Main Module" , "setmain" , "" , "No", "Yes" } )
aadd( aAct, { "SelectProject" , "Select Current Project" , "" , "" , "No", "Yes" } )
aadd( aAct, { "CloseProject" , "Close Current Project" , "" , "" , "No", "Yes" } )
aadd( aAct, { "Build" , "Build Project" , "build" , "^F9" , "No", "Yes" } )
aadd( aAct, { "BuildLaunch" , "Build and Launch Project" , "buildlaunch" , "F9" , "No", "Yes" } )
aadd( aAct, { "ReBuild" , "Rebuild Project" , "rebuild" , "" , "No", "Yes" } )
aadd( aAct, { "ReBuildLaunch" , "Rebuild and Launch Project" , "rebuildlaunch" , "" , "No", "Yes" } )
aadd( aAct, { "CompileCurrent" , "Compile Current Source" , "compile" , "" , "No", "Yes" } )
aadd( aAct, { "CompilePPO" , "Compile Current Source to PPO", "ppo" , "" , "No", "Yes" } )
aadd( aAct, { "LaunchProject" , "Launch Project" , "" , "^F10" , "No", "Yes" } )
aadd( aAct, { "ConfigureTools" , "Configure Tools...*" , "" , "" , "No", "Yes" } )
#ifdef __PLATFORM__WINDOWS
aadd( aAct, { "CommandPrompt" , "Command Prompt...*" , "" , "" , "No", "Yes" } )
#else
aadd( aAct, { "Terminal" , "Terminal" , "" , "" , "No", "Yes" } )
#endif
aadd( aAct, { "ManageThemes" , "Manage Themes" , "" , "" , "No", "Yes" } )
aadd( aAct, { "DefaultTheme" , "Set Default Theme" , "" , "" , "No", "Yes" } )
aadd( aAct, { "AboutIDE" , "About Harbour IDE" , "vr-16x16" , "" , "No", "Yes" } )
aadd( aAct, { "AboutHarbour" , "Abouthb Harbour" , "hb-16x16" , "" , "No", "Yes" } )
aadd( aAct, { "HarbourUsersList" , "Harbour Users (Mailing Lists)", "list-users" , "" , "No", "Yes" } )
aadd( aAct, { "HarbourDevList" , "Harbour Developers (Mailing Lists)", "list-developers", "", "No", "Yes" } )
RETURN aAct
/*----------------------------------------------------------------------*/
METHOD IdeActions:buildToolBar()
LOCAL oTBar, nSep := XBPTOOLBAR_BUTTON_SEPARATOR
oTBar := XbpToolBar():new( ::oDlg )
oTBar:imageWidth := 22
oTBar:imageHeight := 22
oTBar:create( , , { 0, oWnd:currentSize()[ 2 ]-60 }, { oWnd:currentSize()[ 1 ], 60 } )
oTBar:create( , , { 0, ::oDlg:currentSize()[ 2 ]-60 }, { ::oDlg:currentSize()[ 1 ], 60 } )
oTBar:setStyleSheet( GetStyleSheet( "QToolBar" ) )
oTBar:oWidget:setMaximumHeight( 28 )
oTBar:addItem( "Exit" , cResPath + "exit.png" , , , , , "Exit" )
oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR )
oTBar:addItem( "New" , cResPath + "new.png" , , , , , "New" )
oTBar:addItem( "Open" , cResPath + "open.png" , , , , , "Open" )
oTBar:addItem( "Save" , cResPath + "save.png" , , , , , "Save" )
* oTBar:addItem( "Save As" , cResPath + "saveas.png" , , , , , "SaveAs" )
* oTBar:addItem( "Save All" , cResPath + "saveall.png" , , , , , "SaveAll" )
oTBar:addItem( "Close" , cResPath + "close.png" , , , , , "Close" )
* oTBar:addItem( "Close all" , cResPath + "closeall.png" , , , , , "CloseAll" )
oTBar:addItem( "Print" , cResPath + "print.png" , , , , , "Print" )
oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR )
oTBar:addItem( "Compile" , cResPath + "compile.png" , , , , , "Compile" )
oTBar:addItem( "Compile to PPO" , cResPath + "ppo.png" , , , , , "CompilePPO" )
#if 0
* oTBar:addItem( "Build Project" , cResPath + "build.png" , , , , , "SaveBuild" )
oTBar:addItem( "Build and Run" , cResPath + "run.png" , , , , , "SaveBuildLaunch" )
oTBar:addItem( "Build and Run without Debug", cResPath + "runnodebug.png" , , , , , "SaveBuildLaunch" )
oTBar:addItem( "Rebuild Project" , cResPath + "clean.png" , , , , , "SaveRebuild" )
oTBar:addItem( "Rebuild and Launch Project" , cResPath + "cleanrun.png" , , , , , "SaveRebuildLaunch" )
#else
oTBar:addItem( "Build Project" , cResPath + "build.png" , , , , , "SaveBuild" )
oTBar:addItem( "Build and Run Project" , cResPath + "buildlaunch.png" , , , , , "SaveBuildLaunch" )
oTBar:addItem( "Rebuild Project" , cResPath + "rebuild.png" , , , , , "SaveRebuild" )
oTBar:addItem( "Rebuild and Launch Project" , cResPath + "rebuildlaunch.png" , , , , , "SaveRebuildLaunch" )
#endif
//
oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR )
oTBar:addItem( "Show/hide Project Tree" , cResPath + "properties.png" , , , , , "ToggleProjectTree" )
oTBar:addItem( "Show/hide Build Info" , cResPath + "builderror.png" , , , , , "ToggleBuildInfo" )
oTBar:addItem( "Show/hide Function List" , cResPath + "modulelist.png" , , , , , "ToggleFuncList" )
//
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( "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( "Find" , cResPath + "find.png" , , , , , "Find" )
oTBar:addItem( "Search" , cResPath + "search.png" , , , , , "Search" )
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( "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 )
#if 0
oTBar:addItem( "ZoomIn" , cResPath + "zoomin.png" , , , , , "ZoomIn" )
oTBar:addItem( "ZoomOut" , cResPath + "zoomout.png" , , , , , "ZoomOut" )
oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR )
#endif
oTBar:buttonClick := {|oButton| ::oIde:execAction( oButton:key ) }
oTBar:transparentColor := GraMakeRGBColor( { 0,255,255 } ) // GRA_CLR_INVALID
oTBar:buttonClick := {|oButton| oIde:execAction( oButton:key ) }
oTBar:addItem( ::getAction( "Exit" ), , , , , , "Exit" )
oTBar:addItem( , , , , , nSep )
oTBar:addItem( ::getAction( "New" ), , , , , , "New" )
oTBar:addItem( ::getAction( "Open" ), , , , , , "Open" )
oTBar:addItem( ::getAction( "Save" ), , , , , , "Save" )
oTBar:addItem( ::getAction( "Close" ), , , , , , "Close" )
oTBar:addItem( ::getAction( "Print" ), , , , , , "Print" )
oTBar:addItem( , , , , , nSep )
oTBar:addItem( ::getAction( "Compile" ), , , , , , "Compile" )
oTBar:addItem( ::getAction( "CompilePPO" ), , , , , , "CompilePPO" )
oTBar:addItem( ::getAction( "Build" ), , , , , , "Build" )
oTBar:addItem( ::getAction( "BuildLaunch" ), , , , , , "BuildLaunch" )
oTBar:addItem( ::getAction( "Rebuild" ), , , , , , "Rebuild" )
oTBar:addItem( ::getAction( "RebuildLaunch" ), , , , , , "RebuildLaunch" )
oTBar:addItem( , , , , , nSep )
oTBar:addItem( ::getAction( "ToggleProjectTree" ), , , , , , "ToggleProjectTree" )
oTBar:addItem( ::getAction( "ToggleBuildInfo" ), , , , , , "ToggleBuildInfo" )
oTBar:addItem( ::getAction( "ToggleFuncList" ), , , , , , "ToggleFuncList" )
oTBar:addItem( , , , , , nSep )
oTBar:addItem( ::getAction( "Undo" ), , , , , , "Undo" )
oTBar:addItem( ::getAction( "Redo" ), , , , , , "Redo" )
oTBar:addItem( , , , , , nSep )
oTBar:addItem( ::getAction( "Cut" ), , , , , , "Cut" )
oTBar:addItem( ::getAction( "Copy" ), , , , , , "Copy" )
oTBar:addItem( ::getAction( "Paste" ), , , , , , "Paste" )
oTBar:addItem( ::getAction( "SelectAll" ), , , , , , "SelectAll" )
oTBar:addItem( ::getAction( "SelectionMode" ), , , , , , "SelectionMode" )
oTBar:addItem( , , , , , nSep )
oTBar:addItem( ::getAction( "Find" ), , , , , , "Find" )
oTBar:addItem( ::getAction( "Search" ), , , , , , "Search" )
oTBar:addItem( , , , , , nSep )
oTBar:addItem( ::getAction( "SetMark" ), , , , , , "SetMark" )
oTBar:addItem( ::getAction( "GotoMark" ), , , , , , "GotoMark" )
oTBar:addItem( ::getAction( "Goto" ), , , , , , "Goto" )
oTBar:addItem( , , , , , nSep )
oTBar:addItem( ::getAction( "ToUpper" ), , , , , , "ToUpper" )
oTBar:addItem( ::getAction( "ToLower" ), , , , , , "ToLower" )
oTBar:addItem( ::getAction( "Invert" ), , , , , , "Invert" )
oTBar:addItem( ::getAction( "MatchPairs" ), , , , , , "MatchPairs" )
oTBar:addItem( , , , , , nSep )
RETURN oTBar
RETURN Self
/*----------------------------------------------------------------------*/
/*
* 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 )
METHOD IdeActions:buildMainMenu()
LOCAL oMenuBar, oSubMenu, oSubMenu2, n, f, lEmpty
LOCAL oIde := ::oIde
cCaption := Substr( cCaption, 1, p - 1 )
cCaption := Alltrim( cCaption )
oMenuBar := ::oDlg:MenuBar()
oMenuBar:setStyleSheet( GetStyleSheet( "QMenuBar" ) )
* cIco := s_resPath + Alltrim( cIco ) ---> "s_resPath" is need here!
IF !Empty( cIco )
cIco := StrTran( cIco, '/', hb_OsPathSeparator() )
cIco := StrTran( cIco, '\', hb_OsPathSeparator() )
/*----------------------------------------------------------------------------*/
/* File */
/*----------------------------------------------------------------------------*/
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~File"
IF !( hb_OsPathSeparator() $ cIco )
cIco := hb_DirBase() + "resources" + hb_OsPathSeparator() + cIco + "|"
ELSE
cIco := cIco + "|"
Endif
Endif
ELSE
cIco := ''
oSubMenu2 := XbpMenu():new( oSubMenu ):create()
oSubMenu2:addItem( { ::getAction( "New" ), {|| oIde:execAction( "New" ) } } )
oSubMenu2:addItem( { ::getAction( "NewProject" ), {|| oIde:execAction( "NewProject" ) } } )
oMenuBar:addItem( { oSubMenu2, _T( "~New" ) } )
oMenuBar:aMenuItems[ oMenuBar:numItems(), 2 ]:setIcon( oIde:resPath + 'new.png' )
oSubMenu:addItem( { ::getAction( "Open" ), {|| oIde:execAction( "Open" ) } } )
oSubMenu:addItem( { ::getAction( "LoadProject" ), {|| oIde:execAction( "LoadProject" ) } } )
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 := hbide_pathNormalized( oIde:aIni[ INI_RECENTFILES, n ], .F. )
lEmpty := .F.
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:disableItem( 1 )
ENDIF
oMenuBar:addItem( { oSubMenu2, _T( "Recent Files" ) } )
/* 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 := ''
oSubMenu2 := XbpMenu():new( oSubMenu ):create()
oSubMenu2:itemSelected := {| nIndex, cFile | cFile := oIde:aIni[ INI_RECENTPROJECTS, nIndex ], ;
oIde:loadProjectProperties( cFile, .F., .F., .T. ) }
lEmpty := .T.
FOR n := 1 TO Len( oIde:aIni[ INI_RECENTPROJECTS ] )
f := hbide_pathNormalized( oIde:aIni[ INI_RECENTPROJECTS, n ], .F. )
lEmpty := .F.
oSubMenu2:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + f ) , nil } )
IF !hb_FileExists(f)
oSubMenu2:disableItem( n )
ENDIF
NEXT
IF lEmpty
oSubMenu2:addItem( { _T( "** No recent projects found **" ) , nil } )
oSubMenu2:disableItem( 1 )
ENDIF
oMenuBar:addItem( { oSubMenu2, _T( "Recent Projects" ) } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { ::getAction( "Save" ), {|| oIde:execAction( "Save" ) } } )
oSubMenu:addItem( { ::getAction( "SaveAs" ), {|| oIde:execAction( "SaveAs" ) } } )
oSubMenu:addItem( { ::getAction( "SaveAll" ), {|| oIde:execAction( "SaveAll" ) } } )
oSubMenu:addItem( { ::getAction( "Close" ), {|| oIde:execAction( "Close" ) } } )
oSubMenu:addItem( { ::getAction( "CloseAll" ), {|| oIde:execAction( "CloseAll" ) } } )
oSubMenu:addItem( { ::getAction( "CloseOther" ), {|| oIde:execAction( "CloseOther" ) } } )
oSubMenu:addItem( { ::getAction( "Revert" ), {|| oIde:execAction( "Revert" ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { ::getAction( "ExportHTML" ), {|| oIde:execAction( "ExportHTML" ) } } )
oSubMenu:addItem( { ::getAction( "Print" ), {|| oIde:execAction( "Print" ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { ::getAction( "SaveExit" ), {|| oIde:execAction( "SaveExit" ) } } )
oSubMenu:addItem( { ::getAction( "Exit" ), {|| oIde:execAction( "Exit" ) } } )
oMenuBar:addItem( { oSubMenu, NIL } )
/*----------------------------------------------------------------------------*/
/* Edit */
/*----------------------------------------------------------------------------*/
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Edit"
oSubMenu:addItem( { ::getAction( "Undo" ), {|| oIde:execAction( "Undo" ) } } )
oSubMenu:addItem( { ::getAction( "Redo" ), {|| oIde:execAction( "Redo" ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { ::getAction( "Cut" ), {|| oIde:execAction( "Cut" ) } } )
oSubMenu:addItem( { ::getAction( "Copy" ), {|| oIde:execAction( "Copy" ) } } )
oSubMenu:addItem( { ::getAction( "Paste" ), {|| oIde:execAction( "Paste" ) } } )
oSubMenu:addItem( { ::getAction( "SelectAll" ), {|| oIde:execAction( "SelectAll" ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { ::getAction( "Find" ), {|| oIde:execAction( "Find" ) } } )
oSubMenu:addItem( { ::getAction( "Goto" ), {|| oIde:execAction( "Goto" ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu2 := XbpMenu():new( oSubMenu ):create()
oSubMenu2:addItem( { ::getAction( "InsertDateTime" ), {|| oIde:execAction( "InsertDateTime" ) } } )
oSubMenu2:addItem( { ::getAction( "InsertRandomName" ), {|| oIde:execAction( "InsertRandomName" ) } } )
oSubMenu2:addItem( { ::getAction( "InsertExternalFile" ), {|| oIde:execAction( "InsertExternalFile" ) } } )
oMenuBar:addItem( { oSubMenu2, _T( "~Insert" ) } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { ::getAction( "switchReadOnly" ), {|| oIde:execAction( "switchReadOnly" ) } } )
oMenuBar:addItem( { oSubMenu, NIL } )
/*----------------------------------------------------------------------------*/
/* Project */
/*----------------------------------------------------------------------------*/
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Project"
oSubMenu:addItem( { ::getAction( "Properties" ), {|| oIde:execAction( "Properties" ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { ::getAction( "ProjAddSource" ), {|| oIde:execAction( "ProjAddSource" ) } } )
oSubMenu:addItem( { ::getAction( "ProjRemSource" ), {|| oIde:execAction( "ProjRemSource" ) } } )
oSubMenu:addItem( { ::getAction( "ProjMainModule" ), {|| oIde:execAction( "ProjMainModule" ) } } )
oSubMenu:disableItem( oSubMenu:numItems )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { ::getAction( "SelectProject" ), {|| oIde:execAction( "SelectProject" ) } } )
oSubMenu:addItem( { ::getAction( "CloseProject" ), {|| oIde:execAction( "CloseProject" ) } } )
oMenuBar:addItem( { oSubMenu, NIL } )
/*----------------------------------------------------------------------------*/
/* Build */
/*----------------------------------------------------------------------------*/
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Build"
oSubMenu:addItem( { ::getAction( "Build" ), {|| oIde:execAction( "Build" ) } } )
oSubMenu:addItem( { ::getAction( "BuildLaunch" ), {|| oIde:execAction( "BuildLaunch" ) } } )
oSubMenu:addItem( { ::getAction( "Rebuild" ), {|| oIde:execAction( "Rebuild" ) } } )
oSubMenu:addItem( { ::getAction( "RebuildLaunch" ), {|| oIde:execAction( "RebuildLaunch" ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { ::getAction( "SaveCompileCurrent" ), {|| oIde:execAction( "SaveCompileCurrent" ) } } )
oSubMenu:addItem( { ::getAction( "CompilePPO" ), {|| oIde:execAction( "CompilePPO" ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { ::getAction( "LaunchProject" ), {|| oIde:execAction( "LaunchProject" ) } } )
oMenuBar:addItem( { oSubMenu, NIL } )
/*----------------------------------------------------------------------------*/
/* Tools */
/*----------------------------------------------------------------------------*/
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Tools"
oSubMenu:addItem( { ::getAction( "ConfigureTools" ), {|| oIde:execAction( "ConfigureTools" ) } } )
hbide_menuAddSep( oSubMenu )
#ifdef __PLATFORM__WINDOWS
oSubMenu:addItem( { ::getAction( "CommandPrompt" ), {|| oIde:execAction( "CommandPrompt" ) } } )
#else
oSubMenu:addItem( { ::getAction( "Terminal" ), {|| oIde:execAction( "Terminal" ) } } )
#endif
oMenuBar:addItem( { oSubMenu, NIL } )
/*----------------------------------------------------------------------------*/
/* Options */
/*----------------------------------------------------------------------------*/
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Options"
oSubMenu:addItem( { ::getAction( "ManageThemes" ), {|| oIde:oThemes:fetch() } } )
oSubMenu:addItem( { ::getAction( "DefaultTheme" ), {|| oIde:oThemes:setWrkTheme() } } )
oMenuBar:addItem( { oSubMenu, NIL } )
/*----------------------------------------------------------------------------*/
/* Codec */
/*----------------------------------------------------------------------------*/
oSubMenu := hbide_buildCodecMenu( oIde, oMenuBar )
oMenuBar:addItem( { oSubMenu, NIL } )
/*----------------------------------------------------------------------------*/
/* Help */
/*----------------------------------------------------------------------------*/
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Help"
oSubMenu:addItem( { ::getAction( "AboutIDE" ), {|| hbide_help( 1 ) } } )
oSubMenu:addItem( { ::getAction( "AboutHarbour" ), {|| hbide_help( 4 ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { ::getAction( "HarbourUsersList" ), {|| hbide_help( 3 ) } } )
oSubMenu:addItem( { ::getAction( "HarbourDevList" ), {|| hbide_help( 2 ) } } )
oMenuBar:addItem( { oSubMenu, NIL } )
RETURN Self
RETURN ( cIco + cCaption + cKey )
/*----------------------------------------------------------------------*/
/*
* This pseudo function helps to create is a menu item with text and shortcut.
*/
#define _T( x ) ( mnuNormalizeItem( x ) )
//
/*----------------------------------------------------------------------*/
FUNCTION buildMainMenu( oWnd, oIde )
@@ -223,10 +492,11 @@ FUNCTION buildMainMenu( oWnd, oIde )
oSubMenu:title := "~File"
oSubMenu2 := XbpMenu():new( oSubMenu ):create()
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' )
oMenuBar:aMenuItems[ oMenuBar:numItems(), 2 ]:setIcon( oIde:resPath + 'new.png' )
// oSubMenu:addItem( { _T( "~New File, ^N | new.png" ) , {|| oIde:execAction( "New" ) } } )
// oSubMenu:addItem( { _T( "New Pro~ject, Sh+^N | project.png" ) , {|| oIde:execAction( "NewProject" ) } } )
@@ -338,10 +608,10 @@ FUNCTION buildMainMenu( oWnd, oIde )
/*----------------------------------------------------------------------------*/
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Build"
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" ) } } )
oSubMenu:addItem( { _T( "Build, ^F9 | build.png" ) , {|| oIde:execAction( "Build" ) } } )
oSubMenu:addItem( { _T( "Build and Launch, F9 | buildlaunch.png" ) , {|| oIde:execAction( "BuildLaunch" ) } } )
oSubMenu:addItem( { _T( "Re-build | rebuild.png" ) , {|| oIde:execAction( "Rebuild" ) } } )
oSubMenu:addItem( { _T( "Re-build and Launch, Sh+^F9 | rebuildlaunch.png" ), {|| oIde:execAction( "RebuildLaunch" ) } } )
hbide_menuAddSep( oSubMenu )
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" ) } } )
@@ -482,6 +752,60 @@ STATIC FUNCTION hbide_buildCodecMenu( oIde, oMenuBar )
RETURN oSubMenu
/*----------------------------------------------------------------------*/
/*
* 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
RETURN ( cIco + cCaption + cKey )
/*----------------------------------------------------------------------*/
/*
* 02/01/2010 - 22:44:19
@@ -613,3 +937,15 @@ FUNCTION hbide_mnuFindItem( oIde, cCaption )
RETURN nil
/*----------------------------------------------------------------------*/
FUNCTION hbide_getAction( oIde )
LOCAL oAction
oAction := QAction():new( oIde:oDlg:oWidget )
oAction:setText( "Nnnnnew" )
oAction:setIcon( hb_DirBase() + "resources" + hb_OsPathSeparator() + "new.png" )
oAction:setShortcut( QKeySequence():new( "Ctrl+N" ) )
RETURN oAction
/*----------------------------------------------------------------------*/

View File

@@ -83,7 +83,6 @@ CLASS IdeDockS INHERIT IdeObject
METHOD buildDialog()
METHOD buildMainMenu()
METHOD buildToolBar()
METHOD buildStatusBar()
METHOD buildDockWidgets()
@@ -173,14 +172,6 @@ METHOD IdeDocks:buildMainMenu()
/*----------------------------------------------------------------------*/
METHOD IdeDocks:buildToolBar()
::oIde:oTBar := buildToolBar( ::oDlg, ::oIde )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeDocks:buildDockWidgets()
::buildProjectTree()

View File

@@ -98,7 +98,8 @@ PROCEDURE hbide_justACall()
/*----------------------------------------------------------------------*/
FUNCTION hbide_execPopup( aPops, aPos, qParent )
LOCAL i, qPop, qPoint, qAct, nAct, cAct, xRet, pAct
LOCAL i, qPop, qPoint, qAct, cAct, xRet, pAct, a_
//, nAct
qPop := QMenu():new( IIF( hb_isObject( qParent ), qParent, NIL ) )
@@ -106,7 +107,11 @@ FUNCTION hbide_execPopup( aPops, aPos, qParent )
IF empty( aPops[ i,1 ] )
qPop:addSeparator()
ELSE
qPop:addAction( aPops[ i, 1 ] )
IF hb_isObject( aPops[ i, 1 ] )
qPop:addAction_4( aPops[ i, 1 ] )
ELSE
qPop:addAction( aPops[ i, 1 ] )
ENDIF
ENDIF
NEXT
@@ -115,9 +120,30 @@ FUNCTION hbide_execPopup( aPops, aPos, qParent )
qAct := QAction():configure( pAct )
IF !empty( qAct:pPtr ) .and. !empty( cAct := qAct:text() )
IF ( nAct := ascan( aPops, {|e_| e_[ 1 ] == cAct } ) ) > 0
xRet := eval( aPops[ nAct,2 ] )
FOR EACH a_ IN aPops
IF hb_isObject( a_[ 1 ] )
IF a_[ 1 ]:text() == cAct
xRet := eval( aPops[ a_:__enumIndex(), 2 ] )
EXIT
ENDIF
ELSE
IF a_[ 1 ] == cAct
xRet := eval( aPops[ a_:__enumIndex(), 2 ] )
EXIT
ENDIF
ENDIF
NEXT
#if 0
IF hb_isObject( aPops[ i, 1 ] )
IF ( nAct := ascan( aPops, {|e_| e_[ 1 ]:text() == cAct } ) ) > 0
xRet := eval( aPops[ nAct,2 ] )
ENDIF
ELSE
IF ( nAct := ascan( aPops, {|e_| e_[ 1 ] == cAct } ) ) > 0
xRet := eval( aPops[ nAct,2 ] )
ENDIF
ENDIF
#endif
ENDIF
qPop:pPtr := 0
@@ -948,3 +974,43 @@ FUNCTION hbide_findProjTreeItem( oIde, cNodeText, cType )
/*----------------------------------------------------------------------*/
FUNCTION hbide_expandChildren( oIde, oItem )
LOCAL a_
oItem:expand( .t. )
FOR EACH a_ IN oIde:aProjData
IF a_[ TRE_OPARENT ] == oItem
a_[ TRE_OITEM ]:expand( .t. )
ENDIF
NEXT
RETURN nil
/*----------------------------------------------------------------------*/
FUNCTION hbide_collapseProjects( oIde )
LOCAL a_
FOR EACH a_ IN oIde:aProjData
IF a_[ TRE_TYPE ] == "Project Name"
a_[ TRE_OITEM ]:expand( .f. )
ENDIF
NEXT
RETURN nil
/*----------------------------------------------------------------------*/
FUNCTION hbide_expandProjects( oIde )
LOCAL a_
FOR EACH a_ IN oIde:aProjData
IF a_[ TRE_TYPE ] == "Project Name"
hbide_expandChildren( oIde, a_[ TRE_OITEM ] )
ENDIF
NEXT
RETURN nil
/*----------------------------------------------------------------------*/

View File

@@ -82,6 +82,7 @@ CLASS IdeObject
ACCESS oED INLINE ::oIde:oED
ACCESS oPM INLINE ::oIde:oPM
ACCESS oDK INLINE ::oIde:oDK
ACCESS oAC INLINE ::oIde:oAC
ACCESS qCurEdit INLINE ::oIde:qCurEdit
ACCESS oCurEditor INLINE ::oIde:oCurEditor
@@ -95,6 +96,7 @@ CLASS IdeObject
ACCESS aINI INLINE ::oIde:aINI
ACCESS oDlg INLINE ::oIde:oDlg
ACCESS qDlg INLINE ::oIde:oDlg:oWidget
ACCESS oDA INLINE ::oIde:oDA
ACCESS oDockPT INLINE ::oIde:oDockPT

View File

@@ -474,6 +474,7 @@ METHOD IdeProjManager:setCurrentProject( cProjectName )
IF !empty( ::cWrkProject )
IF !empty( oItem := hbide_findProjTreeItem( ::oIde, ::cWrkProject, "Project Name" ) )
oItem:oWidget:setForeground( 0, ::qBrushWrkProject )
hbide_expandChildren( ::oIde, oItem )
ENDIF
ENDIF
ENDIF

View File

@@ -305,7 +305,7 @@ METHOD xbpMenuBar:placeItem( xCaption, bAction, nStyle, nAttrb, nMode, nPos )
cType := valtype( xCaption )
DO CASE
CASE cType == "U" .or. empty( xCaption ) .or. nStyle == XBPMENUBAR_MIS_SEPARATOR
CASE cType == "U" .OR. empty( xCaption ) .OR. nStyle == XBPMENUBAR_MIS_SEPARATOR
oAction := QAction()
IF lInsert
oAction:pPtr := ::oWidget:insertSeparator()
@@ -341,22 +341,15 @@ METHOD xbpMenuBar:placeItem( xCaption, bAction, nStyle, nAttrb, nMode, nPos )
CASE nAttrb == XBPMENUBAR_MIA_CHECKED
oAction:setCheckable( .t. )
oAction:setChecked( .t. )
CASE nAttrb == XBPMENUBAR_MIA_DISABLED
oAction:setDisabled( .t. )
CASE nAttrb == XBPMENUBAR_MIA_HILITED
::oWidget:setActiveAction( oAction )
CASE nAttrb == XBPMENUBAR_MIA_DEFAULT
::oWidget:setDefaultAction( oAction )
CASE nAttrb == XBPMENUBAR_MIA_FRAMED
CASE nAttrb == XBPMENUBAR_MIA_OWNERDRAW
CASE nAttrb == XBPMENUBAR_MIA_NODISMISS
ENDCASE
IF nStyle == XBPMENUBAR_MIS_STATIC
@@ -371,6 +364,40 @@ METHOD xbpMenuBar:placeItem( xCaption, bAction, nStyle, nAttrb, nMode, nPos )
aItem := { QMF_STRING, nMenuItemID, xCaption, bAction, oAction }
CASE cType == "O" .AND. __ObjGetClsName( xCaption ) == "QACTION"
oAction := xCaption
::Connect( oAction, "triggered(bool)", {|| ::exeBlock( nMenuItemID ) } )
::Connect( oAction, "hovered()" , {|| ::exeHovered( nMenuItemID ) } )
DO CASE
CASE nAttrb == XBPMENUBAR_MIA_CHECKED
oAction:setCheckable( .t. )
oAction:setChecked( .t. )
CASE nAttrb == XBPMENUBAR_MIA_DISABLED
oAction:setDisabled( .t. )
CASE nAttrb == XBPMENUBAR_MIA_HILITED
::oWidget:setActiveAction( oAction )
CASE nAttrb == XBPMENUBAR_MIA_DEFAULT
::oWidget:setDefaultAction( oAction )
CASE nAttrb == XBPMENUBAR_MIA_FRAMED
CASE nAttrb == XBPMENUBAR_MIA_OWNERDRAW
CASE nAttrb == XBPMENUBAR_MIA_NODISMISS
ENDCASE
IF nStyle == XBPMENUBAR_MIS_STATIC
oAction:setDisabled( .t. )
ENDIF
IF nMode == QTC_MENUITEM_ADD
::oWidget:addAction_4( oAction )
ELSE
::oWidget:insertAction( pOldAct, oAction )
ENDIF
aItem := { QMF_STRING, nMenuItemID, oAction:text(), bAction, oAction }
CASE cType == "O"
cCaption := IF( bAction == NIL, xCaption:title, bAction )
aItem := { QMF_POPUP, xCaption:oWidget, cCaption, xCaption, NIL }

View File

@@ -247,6 +247,7 @@ METHOD XbpToolbar:sendToolbarMessage()
METHOD XbpToolbar:addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nStyle, cKey, nMapRGB )
LOCAL oBtn
LOCAL isAction := hb_isObject( cCaption ) .AND. __ObjGetClsName( cCaption ) == "QACTION"
HB_SYMBOL_UNUSED( xDisabledImage )
HB_SYMBOL_UNUSED( xHotImage )
@@ -255,7 +256,7 @@ METHOD XbpToolbar:addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nS
DEFAULT nStyle TO XBPTOOLBAR_BUTTON_DEFAULT
oBtn := XbpToolbarButton():new( cCaption, nStyle, cKey )
oBtn := XbpToolbarButton():new( iif( isAction, cCaption:text(), cCaption ), nStyle, cKey )
oBtn:index := ::numItems + 1
oBtn:command := 100 + oBtn:index
@@ -264,12 +265,18 @@ METHOD XbpToolbar:addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nS
::oWidget:addSeparator()
ELSE
/* Create an action */
oBtn:oAction := QAction():new( ::oWidget )
oBtn:oAction:setText( cCaption )
IF isAction
oBtn:oAction := cCaption
ELSE
/* Create an action */
oBtn:oAction := QAction():new( ::oWidget )
oBtn:oAction:setText( cCaption )
IF valtype( xImage ) == "C" .and. hb_FileExists( xImage )
oBtn:oAction:setIcon( xImage )
ENDIF
IF valtype( xImage ) == "C" .and. hb_FileExists( xImage )
oBtn:oAction:setIcon( xImage )
ENDIF
/* Attach codeblock to be triggered */