2010-01-04 01:58 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbide/hbide.hbp
  * contrib/hbide/hbide.prg
  * contrib/hbide/ideactions.prg
  * contrib/hbide/idedocks.prg
  * contrib/hbide/ideeditor.prg
  * contrib/hbide/idefindreplace.prg
  * contrib/hbide/idemisc.prg
  * contrib/hbide/ideobject.prg
  * contrib/hbide/ideprojmanager.prg
  * contrib/hbide/idesaveload.prg
  * contrib/hbide/idethemes.prg
  * contrib/hbide/projects/hbide.hbi

  + contrib/hbide/resources/insert-datetime.png
  + contrib/hbide/resources/insert-external-file.png
  + contrib/hbide/resources/insert-procname.png
  + contrib/hbide/resources/readonly.png
  * contrib/hbide/resources/tabreadonly.png

  * contrib/hbxbp/xbpqtuiloader.prg
 
    A lot of changes are in effect including the patch 
    sent by Vailton. The code is in the middle of restructing
    phase and may take several days to finish. Till the I request
    you all to bear with me and may expect some bumps too.
    Please do not update this code until I finish preliminaries.

    To sumup this commit includes:
    ! Thourough reclassification of classes and separation of
      code fragments in a way that not two developers collide
      with each other. One may takeup one segment and the other another.

    + Used hbide_* namespace and have changed almost every function.

    + Implemented, though not in a way I wanted, building a project
      via Qt's process classes. You will see a refreshing difference.

    + A major breakthrough in XbpQtUiLoader() class implementation.
      Now you can access the child widgets of a .ui component per
      this syntax:
          oUI:qObj[ "checkMatchCase" ]:setChecked( .t. )
                    =>
          oUI:q_checkMatchCase:seChecked( .t. )
              ^^
      just prefix object name with "q_" ( Q + Underscore ).
      This greatly simmplifies coding and allows to exploit child
      widgets as real-time objects.
This commit is contained in:
Pritpal Bedi
2010-01-04 10:15:18 +00:00
parent 166273b0dd
commit 9c0bf52ee1
20 changed files with 1859 additions and 1284 deletions

View File

@@ -17,6 +17,56 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-01-04 01:58 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbide/hbide.hbp
* contrib/hbide/hbide.prg
* contrib/hbide/ideactions.prg
* contrib/hbide/idedocks.prg
* contrib/hbide/ideeditor.prg
* contrib/hbide/idefindreplace.prg
* contrib/hbide/idemisc.prg
* contrib/hbide/ideobject.prg
* contrib/hbide/ideprojmanager.prg
* contrib/hbide/idesaveload.prg
* contrib/hbide/idethemes.prg
* contrib/hbide/projects/hbide.hbi
+ contrib/hbide/resources/insert-datetime.png
+ contrib/hbide/resources/insert-external-file.png
+ contrib/hbide/resources/insert-procname.png
+ contrib/hbide/resources/readonly.png
* contrib/hbide/resources/tabreadonly.png
* contrib/hbxbp/xbpqtuiloader.prg
A lot of changes are in effect including the patch
sent by Vailton. The code is in the middle of restructing
phase and may take several days to finish. Till the I request
you all to bear with me and may expect some bumps too.
Please do not update this code until I finish preliminaries.
To sumup this commit includes:
! Thourough reclassification of classes and separation of
code fragments in a way that not two developers collide
with each other. One may takeup one segment and the other another.
+ Used hbide_* namespace and have changed almost every function.
+ Implemented, though not in a way I wanted, building a project
via Qt's process classes. You will see a refreshing difference.
+ A major breakthrough in XbpQtUiLoader() class implementation.
Now you can access the child widgets of a .ui component per
this syntax:
oUI:qObj[ "checkMatchCase" ]:setChecked( .t. )
=>
oUI:q_checkMatchCase:seChecked( .t. )
^^
just prefix object name with "q_" ( Q + Underscore ).
This greatly simmplifies coding and allows to exploit child
widgets as real-time objects.
2010-01-03 21:19 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/hbqt_hbevents.cpp
* contrib/hbqt/hbqt_hbslots.cpp

View File

@@ -139,5 +139,11 @@
#define TAB_QDOCUMENT 6
#define TAB_OEDITOR 7
#define TRE_OITEM 1
#define TRE_TYPE 2 // Path | Source File | Project | Opened File
#define TRE_OPARENT 3
#define TRE_ORIGINAL 4
#define TRE_DATA 5
#endif

View File

@@ -15,6 +15,7 @@
-ldflag={msvc}-defaultlib:libcmt.lib
hbide.prg
ideobject.prg
idestylesheets.prg
idetags.prg
idemisc.prg
@@ -25,5 +26,6 @@ idedocks.prg
idesaveload.prg
iderequests.prg
idethemes.prg
ideprojmanager.prg
ideparseexpr.c

File diff suppressed because it is too large Load Diff

View File

@@ -160,8 +160,8 @@ STATIC FUNCTION mnuNormalizeItem( cCaption )
LOCAL p
/* Retrieve and update the ICON name for this menu item */
IF ( (p := Rat( '|', cCaption ) ) != 00 )
cIco := Substr( cCaption, p+1 )
IF ( ( p := Rat( '|', cCaption ) ) != 00 )
cIco := Substr( cCaption, p + 1 )
cIco := alltrim( cIco )
cCaption := Substr( cCaption, 1, p - 1 )
@@ -184,7 +184,7 @@ STATIC FUNCTION mnuNormalizeItem( cCaption )
/* Update the key shortcut for this menu item */
IF ( ( p := Rat( ',', cCaption ) ) != 00 )
cKey := Substr( cCaption, p+1 )
cKey := Substr( cCaption, p + 1 )
cCaption := Substr( cCaption, 1, p - 1 )
cCaption := alltrim( cCaption )
@@ -199,14 +199,13 @@ STATIC FUNCTION mnuNormalizeItem( cCaption )
cKey := ''
ENDIF
cCaption := cIco + cCaption + cKey
RETURN cCaption
RETURN ( cIco + cCaption + cKey )
/*----------------------------------------------------------------------*/
/*
* This pseudo function helps to create is a menu item with text and shortcut.
*/
#define _T( x ) ( mnuNormalizeItem(x) )
#define _T( x ) ( mnuNormalizeItem( x ) )
FUNCTION buildMainMenu( oWnd, oIde )
LOCAL oMenuBar, oSubMenu, oSub1, oSubMenu2
@@ -219,25 +218,25 @@ FUNCTION buildMainMenu( oWnd, oIde )
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~File"
oSubMenu2 := XbpMenu():new( oSubMenu ):create()
oSubMenu2:addItem( { _T( "~Source, ^N | new.png" ) , {|| oIde:executeAction( "New" ) } } )
oSubMenu2:addItem( { _T( "~Project | project.png" ) , {|| oIde:executeAction( "NewProject" ) } } )
oMenuBar:addItem( { oSubMenu2, _T( "~New" ) } )
oMenuBar:aMenuItems[ oMenuBar:numItems(), 2 ]:seticon( oIde:resPath + 'new.png' )
oSubMenu2 := XbpMenu():new( oSubMenu ):create()
oSubMenu2:addItem( { _T( "~Source, ^N | new.png" ) , {|| oIde:executeAction( "New" ) } } )
oSubMenu2:addItem( { _T( "~Project | project.png" ) , {|| oIde:executeAction( "NewProject" ) } } )
oMenuBar:addItem( { oSubMenu2, _T( "~New" ) } )
oMenuBar:aMenuItems[ oMenuBar:numItems(), 2 ]:seticon( oIde:resPath + 'new.png' )
// oSubMenu:addItem( { _T( "~New File, ^N | new.png" ) , {|| oIde:executeAction( "New" ) } } )
// oSubMenu:addItem( { _T( "New Pro~ject, Sh+^N | project.png" ) , {|| oIde:executeAction( "NewProject" ) } } )
oSubMenu:addItem( { _T( "~Open, ^O | open.png" ) , {|| oIde:executeAction( "Open" ) } } )
oSubMenu:addItem( { _T( "Open Projec~t" ) , {|| oIde:executeAction( "LoadProject" ) } } )
MenuAddSep( oSubMenu )
hbide_menuAddSep( oSubMenu )
oSubMenu2 := XbpMenu():new( oSubMenu ):create()
oSubMenu2:itemSelected := {| nIndex, cFile | cFile := oIde:aIni[ INI_RECENTFILES, nIndex ], ;
oIde:editSource( cFile ) }
lEmpty := .T.
FOR n := 1 TO Len( oIde:aIni[ INI_RECENTFILES ] )
f := PathNormalized( oIde:aIni[ INI_RECENTFILES, n ], .F. )
f := hbide_pathNormalized( oIde:aIni[ INI_RECENTFILES, n ], .F. )
lEmpty := .F.
oSubMenu2:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + f ) , nil } )
IF !File(f)
@@ -256,7 +255,7 @@ FUNCTION buildMainMenu( oWnd, oIde )
lEmpty := .T.
FOR n := 1 TO Len( oIde:aIni[ INI_RECENTPROJECTS ] )
f := PathNormalized( oIde:aIni[ INI_RECENTPROJECTS, n ], .F. )
f := hbide_pathNormalized( oIde:aIni[ INI_RECENTPROJECTS, n ], .F. )
lEmpty := .F.
oSubMenu2:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + f ) , nil } )
IF !File(f)
@@ -269,7 +268,7 @@ FUNCTION buildMainMenu( oWnd, oIde )
ENDIF
oMenuBar:addItem( { oSubMenu2, _T( "Recent Projects" ) } )
MenuAddSep( oSubMenu )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "~Save, ^S | save.png" ) , {|| oIde:executeAction( "Save" ) } } )
oSubMenu:addItem( { _T( "Save ~As | saveas.png" ) , {|| oIde:executeAction( "SaveAs" ) } } )
@@ -278,68 +277,65 @@ FUNCTION buildMainMenu( oWnd, oIde )
oSubMenu:addItem( { _T( "Clos~e All | closeall.png" ) , {|| oIde:executeAction( "CloseAll" ) } } )
oSubMenu:addItem( { _T( "Close ~Others| closeexcept.png" ) , {|| oIde:executeAction( "CloseOther" ) } } )
oSubMenu:addItem( { _T( "~Revert to Saved, Sh+^R" ) , {|| oIde:executeAction( "Revert" ) } } )
MenuAddSep( oSubMenu )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "~Export as HTML* | exporthtml.png" ), {|| oIde:executeAction( "" ) } } )
oSubMenu:disableItem( oSubMenu:numItems )
* oSubMenu:addItem( { _T( "~Export as HTML* | exporthtml.png" ), {|| oIde:executeAction( "" ) } } )
oSubMenu:addItem( { _T( "~Print, ^P | print.png" ) , {|| oIde:executeAction( "Print" ) } } )
MenuAddSep( oSubMenu )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Sa~ve and Exit, Sh+^W" ) , {|| oIde:executeAction( "SaveExit" ) } } )
oSubMenu:addItem( { _T( "E~xit | exit.png" ) , {|| oIde:executeAction( "Exit" ) } } )
oMenuBar:addItem( { oSubMenu, NIL } )
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Edit"
oSubMenu:addItem( { _T( "Undo | undo.png" ) , {|| oIde:executeAction( "Undo" ) } } )
oSubMenu:addItem( { _T( "Redo | redo.png" ) , {|| oIde:executeAction( "Redo" ) } } )
MenuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Cut | cut.png" ) , {|| oIde:executeAction( "Cut" ) } } )
oSubMenu:addItem( { _T( "Copy | copy.png" ) , {|| oIde:executeAction( "Copy" ) } } )
oSubMenu:addItem( { _T( "Paste| paste.png" ) , {|| oIde:executeAction( "Paste" ) } } )
oSubMenu:addItem( { _T( "Duplicate Line*" ) , {|| oIde:executeAction( "" ) } } )
oSubMenu:addItem( { _T( "Select All | selectall.png" ) , {|| oIde:executeAction( "SelectAll" ) } } )
MenuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Find/Replace, ^F | find.png" ) , {|| oIde:executeAction( "Find" ) } } )
oSubMenu:addItem( { _T( "Go To Line..., ^G| gotoline.png" ) , {|| oIde:executeAction( "Goto" ) } } )
MenuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Insert*" ) , {|| oIde:executeAction( "" ) } } )
MenuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Set as Readonly*" ) , {|| oIde:executeAction( "" ) } } )
oSubMenu:addItem( { _T( "~Undo | undo.png" ) , {|| oIde:executeAction( "Undo" ) } } )
oSubMenu:addItem( { _T( "~Redo | redo.png" ) , {|| oIde:executeAction( "Redo" ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "C~ut | cut.png" ) , {|| oIde:executeAction( "Cut" ) } } )
oSubMenu:addItem( { _T( "~Copy | copy.png" ) , {|| oIde:executeAction( "Copy" ) } } )
oSubMenu:addItem( { _T( "~Paste| paste.png" ) , {|| oIde:executeAction( "Paste" ) } } )
oSubMenu:addItem( { _T( "Select ~All | selectall.png" ) , {|| oIde:executeAction( "SelectAll" ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "~Find/Replace, ^F | find.png" ) , {|| oIde:executeAction( "Find" ) } } )
oSubMenu:addItem( { _T( "~Go To Line..., ^G| gotoline.png" ) , {|| oIde:executeAction( "Goto" ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu2 := XbpMenu():new( oSubMenu ):create()
oSubMenu2:addItem( { _T( "~Date && Time, Sh+F7| insert-datetime.png" ) , {|| oIde:executeAction( "InsertDateTime" ) } } )
oSubMenu2:addItem( { _T( "~Random Function Name, Sh+^F8| insert-procname.png" ) , {|| oIde:executeAction( "InsertRandomName" ) } } )
oSubMenu2:addItem( { _T( "~External File at cursor| insert-external-file.png" ) , {|| oIde:executeAction( "InsertExternalFile" ) } } )
oMenuBar:addItem( { oSubMenu2, _T( "~Insert" ) } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Switch Read~Only Mode | readonly.png" ) , {|| oIde:executeAction( "switchReadOnly" ) } } )
oMenuBar:addItem( { oSubMenu, NIL } )
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Project"
oSubMenu:addItem( { _T( "Add to Project...*| projectadd.png" ), {|| oIde:executeAction( "" ) } } )
oSubMenu:addItem( { _T( "Remove from Project...* | projectdel.png" ), {|| oIde:executeAction( "" ) } } )
MenuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Close" ) , {|| oIde:executeAction( "CloseProject" ) } } )
MenuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Select Main Module...* | setmain.png" ), {|| oIde:executeAction( "" ) } } )
oSubMenu:addItem( { _T( "Project Properties" ) , {|| oIde:executeAction( "Properties" ) } } )
MenuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Select Current Project*" ) , {|| oIde:executeAction( "" ) } } )
oSubMenu:addItem( { _T( "Drop Current from Tree*" ) , {|| oIde:executeAction( "" ) } } )
oSubMenu:addItem( { _T( "Properties" ) , {|| oIde:executeAction( "Properties" ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Add File* | projectadd.png" ) , {|| oIde:executeAction( "" ) } } )
oSubMenu:addItem( { _T( "Remove File* | projectdel.png" ) , {|| oIde:executeAction( "" ) } } )
oSubMenu:addItem( { _T( "Select Main Module | setmain.png" ) , {|| oIde:executeAction( "" ) } } )
oSubMenu:disableItem( oSubMenu:numItems )
hbide_menuAddSep( oSubMenu )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Change Current Project" ) , {|| oIde:executeAction( "SelectProject" ) } } )
oSubMenu:addItem( { _T( "Close Current Project" ) , {|| oIde:executeAction( "CloseProject" ) } } )
oMenuBar:addItem( { oSubMenu, NIL } )
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Build"
#if 0
oSubMenu:addItem( { _T( "Build,^F9" ) , {|| oIde:executeAction( "SaveBuild" ) } } )
oSubMenu:addItem( { _T( "Build and Run, F9 | run.png" ) , {|| oIde:executeAction( "SaveBuildLaunch" ) } } )
oSubMenu:addItem( { _T( "Re-build | clean.png" ) , {|| oIde:executeAction( "SaveRebuild" ) } } )
oSubMenu:addItem( { _T( "Re-build and Run, Sh+^F9 | cleanrun.png" ), {|| oIde:executeAction( "SaveRebuildLaunch" ) } } )
#else
oSubMenu:addItem( { _T( "Build, ^F9 | build.png" ) , {|| oIde:executeAction( "SaveBuild" ) } } )
oSubMenu:addItem( { _T( "Build and Launch, F9 | buildlaunch.png" ), {|| oIde:executeAction( "SaveBuildLaunch" ) } } )
oSubMenu:addItem( { _T( "Re-build | rebuild.png" ) , {|| oIde:executeAction( "SaveRebuild" ) } } )
oSubMenu:addItem( { _T( "Re-build and Launch, Sh+^F9 | rebuildlaunch.png" ), {|| oIde:executeAction( "SaveRebuildLaunch" ) } } )
#endif
MenuAddSep( oSubMenu )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Save and Compile Current File | compile.png"), {|| oIde:executeAction( "SaveCompileCurrent" ) } } )
oSubMenu:addItem( { _T( "Save and Compile to PPO | ppo.png" ), {|| oIde:executeAction( "CompilePPO" ) } } )
MenuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Run*, ^F10" ) , {|| oIde:executeAction( "" ) } } )
oSubMenu:addItem( { _T( "Run without Debug*, Sh+^F10 | runnodebug.png" ), {|| oIde:executeAction( "" ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Launch, ^F10" ) , {|| oIde:executeAction( "LaunchProject" ) } } )
* oSubMenu:addItem( { _T( "Run without Debug*, Sh+^F10 | runnodebug.png" ), {|| oIde:executeAction( "" ) } } )
oMenuBar:addItem( { oSubMenu, NIL } )
oSubMenu := XbpMenu():new( oMenuBar ):create()
@@ -430,7 +426,7 @@ FUNCTION buildMainMenu( oWnd, oIde )
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Tools"
oSubMenu:addItem( { _T( "Configure Tools...*" ) , {|| oIde:executeAction( "" ) } } )
MenuAddSep( oSubMenu )
hbide_menuAddSep( oSubMenu )
// TODO: Load custom TOOLS LINK from .INI file
#ifdef __PLATFORM__WINDOWS
oSubMenu:addItem( { _T( "Command Prompt...*" ) , {|| oIde:executeAction( "" ) } } )
@@ -448,23 +444,22 @@ FUNCTION buildMainMenu( oWnd, oIde )
/* Help */
oSubMenu := XbpMenu():new( oMenuBar ):create()
oSubMenu:title := "~Help"
oSubMenu:addItem( { _T( "About hbIDE | vr-16x16.png" ) , {|| oIde:Help( 1 ) } } )
oSubMenu:addItem( { _T( "About Harbour | hb-16x16.png" ) , {|| oIde:Help(4) } } )
MenuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Harbour Users (Mailing Lists) | list-users.png" ) , {|| oIde:Help(3) } } )
oSubMenu:addItem( { _T( "Harbour Developers (Mailing Lists) | list-developers.png" ), {|| oIde:Help(2) } } )
oSubMenu:addItem( { _T( "About hbIDE | vr-16x16.png" ) , {|| hbide_help( 1 ) } } )
oSubMenu:addItem( { _T( "About Harbour | hb-16x16.png" ) , {|| hbide_help( 4 ) } } )
hbide_menuAddSep( oSubMenu )
oSubMenu:addItem( { _T( "Harbour Users (Mailing Lists) | list-users.png" ) , {|| hbide_help( 3 ) } } )
oSubMenu:addItem( { _T( "Harbour Developers (Mailing Lists) | list-developers.png" ), {|| hbide_help( 2 ) } } )
oMenuBar:addItem( { oSubMenu, NIL } )
Return Nil
/*----------------------------------------------------------------------*/
/*
*
* 02/01/2010 - 22:44:19
*/
#define QMF_POPUP 1
STATIC FUNCTION mnuUpdateMRUpopup( oIde, nType )
STATIC FUNCTION hbide_mnuUpdateMRUpopup( oIde, nType )
LOCAL oMenuBar
LOCAL lEmpty
LOCAL oItem
@@ -507,7 +502,7 @@ STATIC FUNCTION mnuUpdateMRUpopup( oIde, nType )
oItem[4]:delAllItems()
FOR n := 1 TO Len( oIde:aIni[ nType ] )
c := PathNormalized( oIde:aIni[ nType , n ], .F. )
c := hbide_pathNormalized( oIde:aIni[ nType , n ], .F. )
lEmpty := .F.
oItem[4]:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + c ) , nil } )
@@ -526,20 +521,21 @@ STATIC FUNCTION mnuUpdateMRUpopup( oIde, nType )
ENDIF
RETURN nil
/*----------------------------------------------------------------------*/
/*
* Add a file name to MRU menu item.
* 02/01/2010 - 23:23:22 - vailtom
*/
FUNCTION mnuAddFileToMRU( oIde, cFileName, nType )
FUNCTION hbide_mnuAddFileToMRU( oIde, cFileName, nType )
LOCAL nPos
IF nType != INI_RECENTPROJECTS .AND. nType != INI_RECENTFILES
RETURN nil
ENDIF
cFileName := PathNormalized( cFileName )
cFileName := hbide_pathNormalized( cFileName )
nPos := aScan( oIde:aIni[ nType ], {|f| PathNormalized( f ) == cFileName } )
nPos := aScan( oIde:aIni[ nType ], {|f| hbide_pathNormalized( f ) == cFileName } )
IF nPos > 0
hb_aDel( oIde:aIni[ nType ], nPos, .T. )
@@ -554,5 +550,37 @@ FUNCTION mnuAddFileToMRU( oIde, cFileName, nType )
aSize( oIde:aIni[ nType ], 15 )
ENDIF
mnuUpdateMRUpopup( oIde, nType )
hbide_mnuUpdateMRUpopup( oIde, nType )
RETURN nil
/*----------------------------------------------------------------------*/
/*
* Find a menu item with same caption as passed on argument.
* 03/01/2010 - 13:12:42
*/
FUNCTION hbide_mnuFindItem( oIde, cCaption )
LOCAL oMenuBar
LOCAL oItem
LOCAL n, c
IF Empty(oIde:oDlg )
RETURN nil
ENDIF
oMenuBar := oIde:oDlg:MenuBar()
cCaption := Alltrim( Upper( cCaption ) )
FOR n := 1 TO oMenuBar:numItems()
oItem := oMenuBar:aMenuItems[ n ]
c := Upper( oItem[3] )
c := StrTran( c, '~', '' )
c := StrTran( c, '&', '' )
IF cCaption == alltrim( c )
RETURN oItem
ENDIF
NEXT
RETURN nil
/*----------------------------------------------------------------------*/

View File

@@ -71,40 +71,10 @@
/*----------------------------------------------------------------------*/
CLASS IdeDocks
ACCESS pSlots INLINE hbxbp_getSlotsPtr()
ACCESS pEvents INLINE hbxbp_GetEventsPtr()
CLASS IdeDockS INHERIT IdeObject
DATA nPass INIT 0
DATA oIde
ACCESS oDlg INLINE ::oIde:oDlg
ACCESS oDA INLINE ::oIde:oDA
ACCESS oDockPT INLINE ::oIde:oDockPT
ACCESS oProjTree INLINE ::oIde:oProjTree
ACCESS oProjRoot INLINE ::oIde:oProjRoot
ACCESS aProjData INLINE ::oIde:aProjData
ACCESS aProjects INLINE ::oIde:aProjects
ACCESS oDockED INLINE ::oIde:oDockED
ACCESS oEditTree INLINE ::oIde:oEditTree
ACCESS oOpenedSources INLINE ::oIde:oOpenedSources
ACCESS oDockR INLINE ::oIde:oDockR
ACCESS oFuncList INLINE ::oIde:oFuncList
ACCESS oDockB INLINE ::oIde:oDockB
ACCESS oCompileResult INLINE ::oIde:oCompileResult
ACCESS oDockB1 INLINE ::oIde:oDockB1
ACCESS oLinkResult INLINE ::oIde:oLinkResult
ACCESS oDockB2 INLINE ::oIde:oDockB2
ACCESS oOutputResult INLINE ::oIde:oOutputResult
METHOD new()
METHOD create()
METHOD destroy()
@@ -188,7 +158,7 @@ METHOD IdeDocks:buildProjectTree()
::oProjRoot:expand( .t. )
//
FOR i := 1 TO len( ::aProjects )
::oIde:appendProjectInTree( ::aProjects[ i, 3 ] )
::oIde:updateProjectTree( ::aProjects[ i, 3 ] )
NEXT
/* Insert Project Tree Into Dock Widget */
@@ -362,7 +332,7 @@ METHOD IdeDocks:outputDoubleClicked( lSelected )
qCursor := QTextCursor():configure( ::oOutputResult:oWidget:textCursor() )
cText := QTextBlock():configure( qCursor:block() ):text()
IF ParseFNfromStatusMsg( cText, @cSource, @nLine, .T. )
IF hbide_parseFNfromStatusMsg( cText, @cSource, @nLine, .T. )
::oIde:editSource( cSource )
qCursor := QTextCursor():configure( ::oIde:qCurEdit:textCursor() )
nLine := iif( nLine < 1, 0, nLine - 1 )

View File

@@ -73,12 +73,7 @@
/*----------------------------------------------------------------------*/
CLASS IdeEditor
ACCESS pSlots INLINE hbxbp_getSlotsPtr()
ACCESS pEvents INLINE hbxbp_GetEventsPtr()
DATA oIde
CLASS IdeEditor INHERIT IdeObject
DATA oTab
DATA cPath
@@ -101,8 +96,6 @@ CLASS IdeEditor
DATA nVPos INIT 0
DATA nID
ACCESS qTabWidget INLINE ::oIde:oDA:oTabWidget:oWidget
DATA qCursor
METHOD new()
@@ -132,7 +125,7 @@ METHOD IdeEditor:new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
::nHPos := nHPos
::nVPos := nVPos
::cTheme := cTheme
::nID := GetNextUniqueID()
::nID := hbide_getNextUniqueID()
RETURN Self
/*----------------------------------------------------------------------*/
@@ -147,7 +140,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
DEFAULT cTheme TO ::cTheme
::oIde := oIde
::SourceFile := PathNormalized( cSourceFile, .F. )
::SourceFile := hbide_pathNormalized( cSourceFile, .F. )
::nPos := nPos
::nHPos := nHPos
::nVPos := nVPos
@@ -163,7 +156,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
::qEdit := QPlainTextEdit():new( ::oTab:oWidget )
::qEdit:setPlainText( hb_memoRead( ::sourceFile ) )
::qEdit:setLineWrapMode( QTextEdit_NoWrap )
::qEdit:setFont( ::oIde:oFont:oWidget )
::qEdit:setFont( ::oFont:oWidget )
::qEdit:ensureCursorVisible()
* ::qEdit:setStyleSheet( GetStyleSheet( "QPlainTextEdit" ) )
@@ -177,7 +170,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
::oTab:oWidget:setLayout( ::qLayout )
IF ::cType != "U"
::qHiliter := ::oIde:oThemes:SetSyntaxHilighting( ::qEdit, @::cTheme )
::qHiliter := ::oThemes:SetSyntaxHilighting( ::qEdit, @::cTheme )
ENDIF
Qt_Slots_Connect( ::pSlots, ::qEdit , "textChanged()" , {|| ::setTabImage() } )
@@ -197,7 +190,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
QScrollBar():configure( ::qEdit:verticalScrollBar() ):setValue( ::nVPos )
/* Populate Tabs Array */
aadd( ::oIde:aTabs, { ::oTab, ::qEdit, ::qHiliter, ::qLayout, ::sourceFile, ::qDocument, Self } )
aadd( ::aTabs, { ::oTab, ::qEdit, ::qHiliter, ::qLayout, ::sourceFile, ::qDocument, Self } )
::oIde:nCurTab := len( ::oIde:aTabs )
@@ -212,6 +205,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
::nColumn := ::qCursor:columnNumber()
::qTabWidget:setStyleSheet( GetStyleSheet( "QTabWidget" ) )
::setTabImage()
RETURN Self
@@ -282,17 +276,12 @@ METHOD IdeEditor:removeTabPage()
// ::oTab := nil
ENDIF
n := aScan( ::oIde:aProjData, {|e_| e_[ 4 ] == cSource } )
IF ( n > 0 )
::oIde:aProjData[ n,3 ]:delItem( ::oIde:aProjData[ n,1 ] )
hb_aDel( ::oIde:aProjData, n, .T. )
IF ( n := aScan( ::oIde:aProjData, {|e_| e_[ 4 ] == cSource } ) ) > 0
::aProjData[ n,3 ]:delItem( ::oIde:aProjData[ n,1 ] )
hb_aDel( ::aProjData, n, .T. )
ENDIF
n := aScan( ::oIde:aEdits, {|e_| e_:nID == ::nID } )
IF ( n > 0 )
IF ( n := aScan( ::oIde:aEdits, {|e_| e_:nID == ::nID } ) ) > 0
hb_aDel( ::oIde:aEdits, n, .T. )
ENDIF
@@ -304,11 +293,11 @@ METHOD IdeEditor:removeTabPage()
* aEdits - OK
*
*/
IF ::oIde:qTabWidget:count() == 0
IF ::oIde:lDockRVisible
::oIde:oDockR:hide()
::oIde:lDockRVisible := .f.
End
IF ::qTabWidget:count() == 0
IF ::lDockRVisible
::oDockR:hide()
::lDockRVisible := .f.
ENDIF
ENDIF
RETURN Self
@@ -320,7 +309,7 @@ METHOD IdeEditor:buildTabPage( cSource )
::oTab := XbpTabPage():new( ::oIde:oDA, , { 5,5 }, { 700,400 }, , .t. )
IF Empty( cSource )
::oTab:caption := "Untitled " + hb_ntos( GetNextUntitled() )
::oTab:caption := "Untitled " + hb_ntos( hbide_getNextUntitled() )
ELSE
::oTab:caption := ::cFile + ::cExt
ENDIF
@@ -348,7 +337,7 @@ METHOD IdeEditor:activateTab( mp1, mp2, oXbp )
::oIde:aSources := { ::oIde:aTabs[ ::oIde:nCurTab, TAB_SOURCEFILE ] }
::oIde:createTags()
::oIde:updateFuncList()
::oIde:aTabs[ mp2, TAB_OEDITOR ]:dispEditInfo()
::aTabs[ mp2, TAB_OEDITOR ]:dispEditInfo()
::oIde:updateTitleBar()
::oIde:manageFocusInEditor()
ENDIF
@@ -402,7 +391,8 @@ METHOD IdeEditor:dispEditInfo()
::oIde:oSBar:getItem( SB_PNL_LINE ):caption := s
::oIde:oSBar:getItem( SB_PNL_COLUMN ):caption := "Col " + hb_ntos( ::qCursor:columnNumber() + 1 )
::oIde:oSBar:getItem( SB_PNL_INS ):caption := iif( ::qEdit:overwriteMode() , " ", "Ins" )
::oIde:oSBar:getItem( SB_PNL_MODIFIED ):caption := iif( ::qDocument:isModified(), "Modified", " " )
::oIde:oSBar:getItem( SB_PNL_MODIFIED ):caption := iif( ::qDocument:isModified(), "Modified", iif( ::qEdit:isReadOnly(), "ReadOnly", " " ) )
::oIde:oSBar:getItem( SB_PNL_STREAM ):caption := "Stream"
::oIde:oSBar:getItem( SB_PNL_EDIT ):caption := "Edit"
@@ -413,10 +403,19 @@ METHOD IdeEditor:dispEditInfo()
METHOD IdeEditor:setTabImage()
LOCAL nIndex := ::qTabWidget:indexOf( ::oTab:oWidget )
LOCAL lModified := ::qDocument:isModified()
LOCAL lReadOnly := ::qEdit:isReadOnly()
LOCAL cIcon
::qTabWidget:setTabIcon( nIndex, ::oIde:resPath + iif( lModified, "tabmodified.png", "tabunmodified.png" ) )
IF lModified
cIcon := "tabmodified.png"
ELSEIF lReadOnly
cIcon := "tabreadonly.png"
ELSE
cIcon := "tabunmodified.png"
ENDIF
::oIde:oSBar:getItem( SB_PNL_MODIFIED ):caption := iif( lModified, "Modified", " " )
::qTabWidget:setTabIcon( nIndex, ::resPath + cIcon )
::oSBar:getItem( SB_PNL_MODIFIED ):caption := iif( lModified, "Modified", iif( lReadOnly, "ReadOnly", " " ) )
RETURN Self
@@ -465,10 +464,10 @@ METHOD IdeEditor:applyTheme( cTheme )
IF ::cType != "U"
IF empty( cTheme )
cTheme := ::oIde:oThemes:selectTheme()
cTheme := ::oThemes:selectTheme()
ENDIF
IF ::oIde:oThemes:contains( cTheme )
IF ::oThemes:contains( cTheme )
::cTheme := cTheme
::qHiliter := ::oIde:oThemes:SetSyntaxHilighting( ::qEdit, @::cTheme )
ENDIF

View File

@@ -71,12 +71,7 @@
/*----------------------------------------------------------------------*/
CLASS IdeFindReplace
DATA oIde
DATA oFR
ACCESS qCurEdit INLINE ::oIde:qCurEdit
CLASS IdeFindReplace INHERIT IdeObject
METHOD new()
METHOD create()
@@ -107,36 +102,36 @@ METHOD IdeFindReplace:create( oIde )
::oIde := oIde
::oFR := XbpQtUiLoader():new( ::oIde:oDlg )
::oFR:file := ::oIde:resPath + "finddialog.ui"
::oFR:create()
::oFR:setWindowFlags( Qt_Sheet )
::oUI := XbpQtUiLoader():new( ::oIde:oDlg )
::oUI:file := ::oIde:resPath + "finddialog.ui"
::oUI:create()
::oUI:setWindowFlags( Qt_Sheet )
aeval( ::oIde:aIni[ INI_FIND ], {|e| ::oFR:qObj[ "comboFindWhat" ]:addItem( e ) } )
aeval( ::oIde:aIni[ INI_REPLACE ], {|e| ::oFR:qObj[ "comboReplaceWith" ]:addItem( e ) } )
aeval( ::oIde:aIni[ INI_FIND ], {|e| ::oUI:q_comboFindWhat:addItem( e ) } )
aeval( ::oIde:aIni[ INI_REPLACE ], {|e| ::oUI:q_comboReplaceWith:addItem( e ) } )
::oFR:qObj[ "radioFromCursor" ]:setChecked( .t. )
::oFR:qObj[ "radioDown" ]:setChecked( .t. )
::oUI:q_radioFromCursor:setChecked( .t. )
::oUI:q_radioDown:setChecked( .t. )
::oFR:signal( "buttonFind" , "clicked()", {|| ::onClickFind() } )
::oFR:signal( "buttonReplace", "clicked()", {|| ::onClickReplace() } )
::oFR:signal( "buttonClose" , "clicked()", ;
{|| ::oIde:aIni[ INI_HBIDE, FindDialogGeometry ] := PosAndSize( ::oFR:oWidget ), ::oFR:hide() } )
::oUI:signal( "buttonFind" , "clicked()", {|| ::onClickFind() } )
::oUI:signal( "buttonReplace", "clicked()", {|| ::onClickReplace() } )
::oUI:signal( "buttonClose" , "clicked()", ;
{|| ::oIde:aIni[ INI_HBIDE, FindDialogGeometry ] := hbide_posAndSize( ::oUI:oWidget ), ::oUI:hide() } )
::oFR:signal( "comboFindWhat", "currentIndexChanged(text)", ;
::oUI:signal( "comboFindWhat", "currentIndexChanged(text)", ;
{|o,p| o := o, ::oIde:oSBar:getItem( SB_PNL_SEARCH ):caption := "FIND: " + p } )
::oFR:signal( "checkListOnly", "stateChanged(int)", {|o,p| o := o, ;
::oFR:qObj[ "comboReplaceWith" ]:setEnabled( p == 0 ), ;
iif( p == 1, ::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. ), NIL ) } )
::oUI:signal( "checkListOnly", "stateChanged(int)", {|o,p| o := o, ;
::oUI:q_comboReplaceWith:setEnabled( p == 0 ), ;
iif( p == 1, ::oUI:q_buttonReplace:setEnabled( .f. ), NIL ) } )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeFindReplace:destroy()
::oFR:hide()
::oFR:oWidget:pPtr := 0
::oUI:hide()
::oUI:oWidget:pPtr := 0
RETURN Self
@@ -144,13 +139,13 @@ METHOD IdeFindReplace:destroy()
METHOD IdeFindReplace:show()
::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. )
::oFR:qObj[ "checkGlobal" ]:setEnabled( .f. )
::oFR:qObj[ "checkNoPrompting" ]:setEnabled( .f. )
::oFR:qObj[ "checkListOnly" ]:setChecked( .f. )
::oIde:setPosByIni( ::oFR:oWidget, FindDialogGeometry )
::oFR:qObj[ "comboFindWhat" ]:setFocus()
::oFR:show()
::oUI:q_buttonReplace:setEnabled( .f. )
::oUI:q_checkGlobal:setEnabled( .f. )
::oUI:q_checkNoPrompting:setEnabled( .f. )
::oUI:q_checkListOnly:setChecked( .f. )
::oIde:setPosByIni( ::oUI:oWidget, FindDialogGeometry )
::oUI:q_comboFindWhat:setFocus()
::oUI:show()
RETURN Self
@@ -160,7 +155,7 @@ METHOD IdeFindReplace:onClickReplace()
::updateFindReplaceData( "replace" )
IF ::oFR:qObj[ "comboReplaceWith" ]:isEnabled()
IF ::oUI:q_comboReplaceWith:isEnabled()
::replace()
ENDIF
@@ -196,20 +191,20 @@ METHOD IdeFindReplace:replace()
LOCAL nFound
IF !empty( ::qCurEdit )
cReplWith := QLineEdit():configure( ::oFR:qObj[ "comboReplaceWith" ]:lineEdit() ):text()
cReplWith := QLineEdit():configure( ::oUI:q_comboReplaceWith:lineEdit() ):text()
::replaceSelection( cReplWith )
IF ::oFR:qObj[ "checkGlobal" ]:isChecked()
IF ::oFR:qObj[ "checkNoPrompting" ]:isChecked()
IF ::oUI:q_checkGlobal:isChecked()
IF ::oUI:q_checkNoPrompting:isChecked()
nFound := 1
DO WHILE ::find( .f. )
nFound++
::replaceSelection( cReplWith )
ENDDO
::oIde:oSBar:getItem( SB_PNL_MAIN ):caption := '<font color="2343212"><b>Replaced [' + hb_ntos( nFound ) + "] : "+ cReplWith + "</b></font>"
::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. )
::oFR:qObj[ "checkGlobal" ]:setChecked( .f. )
::oFR:qObj[ "checkNoPrompting" ]:setChecked( .f. )
::oSBar:getItem( SB_PNL_MAIN ):caption := '<font color="2343212"><b>Replaced [' + hb_ntos( nFound ) + "] : "+ cReplWith + "</b></font>"
::oUI:q_buttonReplace:setEnabled( .f. )
::oUI:q_checkGlobal:setChecked( .f. )
::oUI:q_checkNoPrompting:setChecked( .f. )
ELSE
::find()
ENDIF
@@ -225,8 +220,8 @@ METHOD IdeFindReplace:onClickFind()
::updateFindReplaceData( "find" )
IF ::oFR:qObj[ "radioEntire" ]:isChecked()
::oFR:qObj[ "radioFromCursor" ]:setChecked( .t. )
IF ::oUI:q_radioEntire:isChecked()
::oUI:q_radioFromCursor:setChecked( .t. )
qCursor := QTextCursor():configure( ::qCurEdit:textCursor() )
nPos := qCursor:position()
@@ -241,13 +236,13 @@ METHOD IdeFindReplace:onClickFind()
ENDIF
IF lFound
::oFR:qObj[ "buttonReplace" ]:setEnabled( .t. )
::oFR:qObj[ "checkGlobal" ]:setEnabled( .t. )
::oFR:qObj[ "checkNoPrompting" ]:setEnabled( .t. )
::oUI:q_buttonReplace:setEnabled( .t. )
::oUI:q_checkGlobal:setEnabled( .t. )
::oUI:q_checkNoPrompting:setEnabled( .t. )
ELSE
::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. )
::oFR:qObj[ "checkGlobal" ]:setEnabled( .f. )
::oFR:qObj[ "checkNoPrompting" ]:setEnabled( .f. )
::oUI:q_buttonReplace:setEnabled( .f. )
::oUI:q_checkGlobal:setEnabled( .f. )
::oUI:q_checkNoPrompting:setEnabled( .f. )
ENDIF
RETURN Self
@@ -256,18 +251,18 @@ METHOD IdeFindReplace:onClickFind()
METHOD IdeFindReplace:find( lWarn )
LOCAL nFlags
LOCAL cText := QLineEdit():configure( ::oFR:qObj[ "comboFindWhat" ]:lineEdit() ):text()
LOCAL cText := QLineEdit():configure( ::oUI:q_comboFindWhat:lineEdit() ):text()
LOCAL lFound := .f.
DEFAULT lWarn TO .t.
IF !empty( cText )
nFlags := 0
nFlags += iif( ::oFR:qObj[ "checkMatchCase" ]:isChecked(), QTextDocument_FindCaseSensitively, 0 )
nFlags += iif( ::oFR:qObj[ "radioUp" ]:isChecked(), QTextDocument_FindBackward, 0 )
nFlags += iif( ::oUI:q_checkMatchCase:isChecked(), QTextDocument_FindCaseSensitively, 0 )
nFlags += iif( ::oUI:q_radioUp:isChecked(), QTextDocument_FindBackward, 0 )
IF !( lFound := ::qCurEdit:find( cText, nFlags ) ) .and. lWarn
ShowWarning( "Cannot find : " + cText )
hbide_showWarning( "Cannot find : " + cText )
ENDIF
ENDIF
@@ -279,21 +274,21 @@ METHOD IdeFindReplace:updateFindReplaceData( cMode )
LOCAL cData
IF cMode == "find"
cData := QLineEdit():configure( ::oFR:qObj[ "comboFindWhat" ]:lineEdit() ):text()
cData := QLineEdit():configure( ::oUI:q_comboFindWhat:lineEdit() ):text()
IF !empty( cData )
IF ascan( ::oIde:aIni[ INI_FIND ], {|e| e == cData } ) == 0
hb_ains( ::oIde:aIni[ INI_FIND ], 1, cData, .t. )
::oFR:qObj[ "comboFindWhat" ]:insertItem( 0, cData )
::oUI:q_comboFindWhat:insertItem( 0, cData )
ENDIF
ENDIF
//
::oIde:oSBar:getItem( SB_PNL_SEARCH ):caption := "FIND: " + cData
::oSBar:getItem( SB_PNL_SEARCH ):caption := "FIND: " + cData
ELSE
cData := QLineEdit():configure( ::oFR:qObj[ "comboReplaceWith" ]:lineEdit() ):text()
cData := QLineEdit():configure( ::oUI:q_comboReplaceWith:lineEdit() ):text()
IF !empty( cData )
IF ascan( ::oIde:aIni[ INI_REPLACE ], cData ) == 0
hb_ains( ::oIde:aIni[ INI_REPLACE ], 1, cData, .t. )
::oFR:qObj[ "comboReplaceWith" ]:insertItem( 0, cData )
::oUI:q_comboReplaceWith:insertItem( 0, cData )
ENDIF
ENDIF
ENDIF

View File

@@ -92,12 +92,12 @@ PROCEDURE AppSys()
/*----------------------------------------------------------------------*/
PROCEDURE JustACall()
PROCEDURE hbide_justACall()
RETURN
/*----------------------------------------------------------------------*/
FUNCTION ExecPopup( aPops, aPos, qParent )
FUNCTION hbide_execPopup( aPops, aPos, qParent )
LOCAL i, qPop, qPoint, qAct, nAct, cAct, xRet, pAct
qPop := QMenu():new( IIF( hb_isObject( qParent ), qParent, NIL ) )
@@ -126,7 +126,7 @@ FUNCTION ExecPopup( aPops, aPos, qParent )
/*----------------------------------------------------------------------*/
FUNCTION MenuAddSep( oMenu )
FUNCTION hbide_menuAddSep( oMenu )
oMenu:addItem( { NIL, NIL, XBPMENUBAR_MIS_SEPARATOR, NIL } )
@@ -134,7 +134,7 @@ FUNCTION MenuAddSep( oMenu )
/*----------------------------------------------------------------------*/
FUNCTION CreateTarget( cFile, txt_ )
FUNCTION hbide_createTarget( cFile, txt_ )
LOCAL hHandle := fcreate( cFile )
LOCAL cNewLine := hb_OsNewLine()
@@ -147,14 +147,14 @@ FUNCTION CreateTarget( cFile, txt_ )
/*----------------------------------------------------------------------*/
FUNCTION PosAndSize( qWidget )
FUNCTION hbide_posAndSize( qWidget )
RETURN hb_ntos( qWidget:x() ) + "," + hb_ntos( qWidget:y() ) + "," + ;
hb_ntos( qWidget:width() ) + "," + hb_ntos( qWidget:height() ) + ","
/*----------------------------------------------------------------------*/
FUNCTION ShowWarning( cMsg, cInfo, cTitle )
FUNCTION hbide_showWarning( cMsg, cInfo, cTitle )
LOCAL oMB
DEFAULT cTitle TO "Information"
@@ -173,7 +173,7 @@ FUNCTION ShowWarning( cMsg, cInfo, cTitle )
/*----------------------------------------------------------------------*/
FUNCTION GetYesNo( cMsg, cInfo, cTitle )
FUNCTION hbide_getYesNo( cMsg, cInfo, cTitle )
LOCAL oMB
DEFAULT cTitle TO "Option Please!"
@@ -193,7 +193,7 @@ FUNCTION GetYesNo( cMsg, cInfo, cTitle )
/*----------------------------------------------------------------------*/
FUNCTION GetYesNoCancel( cMsg, cInfo, cTitle )
FUNCTION hbide_getYesNoCancel( cMsg, cInfo, cTitle )
LOCAL oMB
DEFAULT cTitle TO "Option Please!"
@@ -213,7 +213,7 @@ FUNCTION GetYesNoCancel( cMsg, cInfo, cTitle )
/*----------------------------------------------------------------------*/
FUNCTION FetchAFile( oWnd, cTitle, aFlt, cDftDir, cDftSuffix )
FUNCTION hbide_fetchAFile( oWnd, cTitle, aFlt, cDftDir, cDftSuffix )
LOCAL oDlg, cFile
DEFAULT cTitle TO "Please Select a File"
@@ -235,7 +235,7 @@ FUNCTION FetchAFile( oWnd, cTitle, aFlt, cDftDir, cDftSuffix )
/*----------------------------------------------------------------------*/
FUNCTION SaveAFile( oWnd, cTitle, aFlt, cDftFile, cDftSuffix )
FUNCTION hbide_saveAFile( oWnd, cTitle, aFlt, cDftFile, cDftSuffix )
LOCAL oDlg, cFile
DEFAULT cTitle TO "Please Select a File"
@@ -257,7 +257,7 @@ FUNCTION SaveAFile( oWnd, cTitle, aFlt, cDftFile, cDftSuffix )
/* Function to user select a existing folder
* 25/12/2009 - 19:10:41 - vailtom
*/
FUNCTION FetchADir( oWnd, cTitle, cDftDir )
FUNCTION hbide_fetchADir( oWnd, cTitle, cDftDir )
LOCAL oDlg, cFile
DEFAULT cTitle TO "Please Select a Folder"
@@ -280,16 +280,18 @@ FUNCTION FetchADir( oWnd, cTitle, cDftDir )
/*----------------------------------------------------------------------*/
FUNCTION ReadSource( cTxtFile )
FUNCTION hbide_readSource( cTxtFile )
LOCAL cFileBody := hb_MemoRead( cTxtFile )
HB_TRACE( HB_TR_DEBUG, cFileBody )
cFileBody := StrTran( cFileBody, Chr( 13 ) )
RETURN hb_ATokens( cFileBody, Chr( 10 ) )
/*----------------------------------------------------------------------*/
FUNCTION EvalAsString( cExp )
FUNCTION hbide_evalAsString( cExp )
LOCAL cValue
BEGIN SEQUENCE WITH { || break() }
@@ -306,17 +308,17 @@ FUNCTION EvalAsString( cExp )
/*----------------------------------------------------------------------*/
FUNCTION FetchHbiStructFromBuffer( cBuffer )
RETURN PullHbiStruct( hb_atokens( cBuffer, _EOL ) )
FUNCTION hbide_fetchHbiStructFromBuffer( cBuffer )
RETURN hbide_pullHbiStruct( hb_atokens( cBuffer, _EOL ) )
/*----------------------------------------------------------------------*/
FUNCTION FetchHbiStructFromFile( cProject )
RETURN PullHbiStruct( ReadSource( cProject ) )
FUNCTION hbide_fetchHbiStructFromFile( cProject )
RETURN hbide_pullHbiStruct( hbide_readSource( cProject ) )
/*----------------------------------------------------------------------*/
STATIC FUNCTION PullHbiStruct( a_ )
STATIC FUNCTION hbide_pullHbiStruct( a_ )
LOCAL n, s, nPart, cKey, cVal, ss
LOCAL aPrp := { "Type", "Title", "Location", "WorkingFolder", "DestinationFolder", ;
"Output", "LaunchParams", "LaunchProgram" }
@@ -334,7 +336,7 @@ STATIC FUNCTION PullHbiStruct( a_ )
FOR EACH ss IN a_
s := alltrim( ss )
IF .t.
IF !empty( s )
DO CASE
CASE s == "[ PROPERTIES ]"
nPart := PRJ_PRP_PROPERTIES
@@ -359,13 +361,13 @@ STATIC FUNCTION PullHbiStruct( a_ )
CASE nPart == PRJ_PRP_SOURCES
aadd( a3_0, s )
//HB_TRACE( HB_TR_ALWAYS, s )
CASE nPart == PRJ_PRP_METADATA
aadd( a4_0, s )
IF !( "#" == left( s,1 ) )
IF ( n := at( "=", s ) ) > 0
cKey := alltrim( substr( s, 1, n-1 ) )
cVal := EvalAsString( alltrim( substr( s, n+1 ) ) )
cVal := hbide_evalAsString( alltrim( substr( s, n+1 ) ) )
aadd( a4_1, { "<"+ cKey +">", cVal } )
ENDIF
ENDIF
@@ -376,21 +378,22 @@ STATIC FUNCTION PullHbiStruct( a_ )
/* General Properties */
FOR EACH s IN a1_0
aadd( a1_1, ParseWithMetaData( s, a4_1 ) )
aadd( a1_1, hbide_parseWithMetaData( s, a4_1 ) )
NEXT
/* Parse Flags */
IF !empty( a2_0 )
FOR EACH s IN a2_0
aadd( a2_1, ParseWithMetaData( s, a4_1 ) )
aadd( a2_1, hbide_parseWithMetaData( s, a4_1 ) )
NEXT
ENDIF
/* Parse Files */
IF !empty( a3_0 )
FOR EACH s IN a3_0
//HB_TRACE( HB_TR_ALWAYS, "Files ", s )
IF !( "#" == left( s,1 ) ) .and. !empty( s )
aadd( a3_1, ParseWithMetaData( s, a4_1 ) )
aadd( a3_1, hbide_parseWithMetaData( s, a4_1 ) )
ENDIF
NEXT
ENDIF
@@ -401,7 +404,7 @@ STATIC FUNCTION PullHbiStruct( a_ )
/*----------------------------------------------------------------------*/
FUNCTION SetupMetaKeys( a_ )
FUNCTION hbide_setupMetaKeys( a_ )
LOCAL s, n, cKey, cVal
LOCAL a4_1 := {}
@@ -409,7 +412,7 @@ FUNCTION SetupMetaKeys( a_ )
IF !( "#" == left( s,1 ) )
IF ( n := at( "=", s ) ) > 0
cKey := alltrim( substr( s, 1, n-1 ) )
cVal := EvalAsString( alltrim( substr( s, n+1 ) ) )
cVal := hbide_evalAsString( alltrim( substr( s, n+1 ) ) )
aadd( a4_1, { "<"+ cKey +">", cVal } )
ENDIF
ENDIF
@@ -419,12 +422,12 @@ FUNCTION SetupMetaKeys( a_ )
/*----------------------------------------------------------------------*/
FUNCTION ApplyMetaData( s, a_ )
FUNCTION hbide_applyMetaData( s, a_ )
LOCAL k
IF ! Empty( a_ )
FOR EACH k IN a_
s := StrTran( s, PathNormalized( k[ 2 ], .f. ), k[ 1 ] )
s := StrTran( s, hbide_pathNormalized( k[ 2 ], .f. ), k[ 1 ] )
NEXT
ENDIF
@@ -432,7 +435,7 @@ FUNCTION ApplyMetaData( s, a_ )
/*----------------------------------------------------------------------*/
FUNCTION ParseWithMetaData( s, a_ )
FUNCTION hbide_parseWithMetaData( s, a_ )
LOCAL k
IF ! Empty( a_ )
@@ -445,7 +448,7 @@ FUNCTION ParseWithMetaData( s, a_ )
/*----------------------------------------------------------------------*/
FUNCTION ArrayToMemo( a_ )
FUNCTION hbide_arrayToMemo( a_ )
LOCAL s := ""
aeval( a_, {|e| s += e + CRLF } )
@@ -456,7 +459,7 @@ FUNCTION ArrayToMemo( a_ )
/*----------------------------------------------------------------------*/
FUNCTION MemoToArray( s )
FUNCTION hbide_memoToArray( s )
LOCAL aLine := hb_ATokens( StrTran( RTrim( s ), CRLF, _EOL ), _EOL )
LOCAL nNewSize := 0
LOCAL line
@@ -474,7 +477,7 @@ FUNCTION MemoToArray( s )
/*----------------------------------------------------------------------*/
FUNCTION IsValidPath( cPath, cPathDescr )
FUNCTION hbide_isValidPath( cPath, cPathDescr )
DEFAULT cPathDescr TO ''
@@ -491,18 +494,18 @@ FUNCTION IsValidPath( cPath, cPathDescr )
/*----------------------------------------------------------------------*/
FUNCTION IsValidText( cSourceFile )
FUNCTION hbide_isValidText( cSourceFile )
LOCAL cExt
hb_fNameSplit( cSourceFile, , , @cExt )
cExt := lower( cExt )
RETURN ( cExt $ ".c,.cpp,.prg,.h,.ch,.txt,.log,.ini,.env,.ppo,"+;
".cc,.hbc,.hbp,.hbm,.xml,.bat,.sh" )
".cc,.hbc,.hbp,.hbm,.xml,.bat,.sh,.rc" )
/*----------------------------------------------------------------------*/
FUNCTION IsValidSource( cSourceFile )
FUNCTION hbide_isValidSource( cSourceFile )
LOCAL cExt
hb_fNameSplit( cSourceFile, , , @cExt )
@@ -512,7 +515,7 @@ FUNCTION IsValidSource( cSourceFile )
/*----------------------------------------------------------------------*/
FUNCTION PathNormalized( cPath, lLower )
FUNCTION hbide_pathNormalized( cPath, lLower )
LOCAL S
DEFAULT lLower TO .T.
@@ -521,6 +524,15 @@ FUNCTION PathNormalized( cPath, lLower )
RETURN IIF( lLower, lower( s ), s )
/*----------------------------------------------------------------------*/
FUNCTION hbide_pathToOSPath( cPath )
cPath := strtran( cPath, "/", hb_osPathSeparator() )
cPath := strtran( cPath, "\", hb_osPathSeparator() )
RETURN cPath
/*----------------------------------------------------------------------*/
/*
* This function fills an array with the list of regular expressions that will
@@ -535,7 +547,8 @@ FUNCTION PathNormalized( cPath, lLower )
#define CLR_MSG_INFO 'brown'
#define CLR_MSG_WARN 'blue'
STATIC FUNCTION BuildRegExpressList( aRegList )
STATIC FUNCTION hbide_buildRegExpressList( aRegList )
AAdd( aRegList, { MSG_TYPE_WARN, hb_RegexComp( ".*: warning.*" ) } )
AAdd( aRegList, { MSG_TYPE_WARN, hb_RegexComp( ".*\) Warning W.*" ) } )
AAdd( aRegList, { MSG_TYPE_WARN, hb_RegexComp( "^Warning W([0-9]+).*" ) } )
@@ -558,7 +571,7 @@ STATIC FUNCTION BuildRegExpressList( aRegList )
* Catch source file name & line error from an msg status from compiler result.
* 29/12/2009 - 13:22:29 - vailtom
*/
FUNCTION ParseFNfromStatusMsg( cText, cFileName, nLine, lValidText )
FUNCTION hbide_parseFNfromStatusMsg( cText, cFileName, nLine, lValidText )
LOCAL regLineN := hb_RegexComp( ".*(\(([0-9]+)\)|:([0-9]+):|\s([0-9]+):).*" )
LOCAL aList
LOCAL nPos
@@ -643,7 +656,7 @@ FUNCTION ParseFNfromStatusMsg( cText, cFileName, nLine, lValidText )
*
* 28/12/2009 - 16:17:37
*/
FUNCTION ConvertBuildStatusMsgToHtml( cText, oWidget )
FUNCTION hbide_convertBuildStatusMsgToHtml( cText, oWidget )
LOCAL aColors := { CLR_MSG_ERR, CLR_MSG_INFO, CLR_MSG_WARN }
LOCAL aLines
LOCAL cLine
@@ -651,11 +664,9 @@ FUNCTION ConvertBuildStatusMsgToHtml( cText, oWidget )
IF aRegList == NIL
aRegList := {}
BuildRegExpressList( aRegList )
hbide_BuildRegExpressList( aRegList )
End
oWidget:clear()
cText := StrTran( cText, Chr( 13 ) + Chr( 10 ), Chr( 10 ) )
cText := StrTran( cText, Chr( 13 ) , Chr( 10 ) )
cText := StrTran( cText, Chr( 10 ) + Chr( 10 ), Chr( 10 ) )
@@ -686,12 +697,12 @@ FUNCTION ConvertBuildStatusMsgToHtml( cText, oWidget )
/*----------------------------------------------------------------------*/
FUNCTION FilesToSources( aFiles )
FUNCTION hbide_filesToSources( aFiles )
LOCAL aSrc := {}
LOCAL s
FOR EACH s IN aFiles
IF IsValidSource( s )
IF hbide_isValidSource( s )
aadd( aSrc, s )
ENDIF
NEXT
@@ -700,7 +711,7 @@ FUNCTION FilesToSources( aFiles )
/*----------------------------------------------------------------------*/
FUNCTION ParseKeyValPair( s, cKey, cVal )
FUNCTION hbide_parseKeyValPair( s, cKey, cVal )
LOCAL n, lYes := .f.
IF ( n := at( "=", s ) ) > 0
@@ -713,30 +724,28 @@ FUNCTION ParseKeyValPair( s, cKey, cVal )
/*----------------------------------------------------------------------*/
FUNCTION IdeDbg( ... )
FUNCTION hbide_dbg( ... )
HB_TRACE( HB_TR_ALWAYS, ... )
RETURN nil
/*----------------------------------------------------------------------*/
/*
* Return the next untitled filename available.
* 01/01/2010 - 19:40:17 - vailtom
*/
FUNCTION GetNextUntitled()
FUNCTION hbide_getNextUntitled()
STATIC nCount := 0
nCount ++
RETURN nCount
/*----------------------------------------------------------------------*/
/*
* Return the next TAB_ID or IDE_ID available.
* 02/01/2010 - 10:47:16 - vailtom
*/
FUNCTION GetNextUniqueID()
FUNCTION hbide_getNextUniqueID()
STATIC nCount := 0
IF nCount > 4294967295
nCount := 0
ENDIF
@@ -747,7 +756,7 @@ FUNCTION GetNextUniqueID()
* Check if cFilename has a extension... and add cDefaultExt if not exist.
* 01/01/2010 - 20:48:10 - vailtom
*/
FUNCTION CheckDefaultExtension( cFileName, cDefaultExt )
FUNCTION hbide_checkDefaultExtension( cFileName, cDefaultExt )
LOCAL cPath, cFile, cExt
hb_fNameSplit( cFileName, @cPath, @cFile, @cExt )
IF Empty( cExt )
@@ -757,7 +766,7 @@ FUNCTION CheckDefaultExtension( cFileName, cDefaultExt )
/*----------------------------------------------------------------------*/
FUNCTION hbide_PathProc( cPathR, cPathA )
FUNCTION hbide_pathProc( cPathR, cPathA )
LOCAL cDirA
LOCAL cDirR, cDriveR, cNameR, cExtR
@@ -781,3 +790,126 @@ FUNCTION hbide_PathProc( cPathR, cPathA )
/*----------------------------------------------------------------------*/
function hbide_toString( x, lLineFeed, lInherited, lType, cFile, lForceLineFeed )
LOCAL s := ''
LOCAL t := valtype( x )
LOCAL i, j
DEFAULT lLineFeed TO .T.
DEFAULT lInherited TO .F.
DEFAULT lType TO .F.
DEFAULT cFile TO ""
DEFAULT lForceLineFeed TO .F.
do case
case ( t == "C" )
s := iif( lType, "[C]=", "" ) + '"' + x + '"'
case ( t == "N" )
s := iif( lType, "[N]=", "" ) + alltrim(str( x ))
case ( t == "D" )
s := iif( lType, "[D]=", "" ) + "ctod('"+ dtoc(x) +"')"
case ( t == "L" )
s := iif( lType, "[L]=", "" ) + iif( x, '.T.', '.F.' )
case ( t == "M" )
s := iif( lType, "[M]=", "" ) + '"' + x + '"'
case ( t == "B" )
s := iif( lType, "[B]=", "" ) + '{|| ... }'
case ( t == "U" )
s := iif( lType, "[U]=", "" ) + 'NIL'
case ( t == "A" )
s := iif( lType, "[A]=", "" ) + "{"
if len(x) = 0
s += " "
else
s += iif( valtype( x[1] ) = "A" .or. lForceLineFeed, CRLF, "" )
j := len(x)
for i := 1 to j
s += iif( valtype( x[i] ) == "A", " ", " " ) + iif( lForceLineFeed, " ", "" ) + hbide_toString( x[i], .F. )
s += iif( i <> j, ",", "" )
if lLineFeed
if !lInherited .and. ( valtype( x[i] ) == "A" .or. lForceLineFeed )
s += CRLF
endif
endif
next
endif
s += iif( !lForceLineFeed, " ", "" ) + "}"
case ( t == "O" )
if lInherited
&& É necessário linkar \harbour\lib\xhb.lib
**s := iif( lType, "[O]=", "" ) + hb_dumpvar( x ) + iif( lLineFeed, CRLF, "" )
s := '' + iif( lLineFeed, CRLF, "" )
else
s := iif( lType, "[O]=", "" ) + x:ClassName()+'():New()' + iif( lLineFeed, CRLF, "" )
endif
endcase
if !empty( cFile )
memowrit( cFile, s )
endif
return s
/*----------------------------------------------------------------------*/
FUNCTION hbide_help( nOption )
LOCAL txt_ := {}
LOCAL tit_ := ''
SWITCH nOption
CASE 1
tit_ := 'About hbIde'
AAdd( txt_, "<b>Harbour IDE ( hbIDE )</b>" )
AAdd( txt_, "Developed by" )
AAdd( txt_, "Pritpal Bedi ( pritpal@vouchcac.com )" )
AAdd( txt_, "" )
AAdd( txt_, "built with:" )
AAdd( txt_, HB_VERSION() )
AAdd( txt_, HB_COMPILER() )
AAdd( txt_, "Qt " + QT_VERSION_STR() )
AAdd( txt_, "" )
AAdd( txt_, "Visit the project website at:" )
AAdd( txt_, "<a href='http://www.harbour-project.org/'>http://www.harbour-project.org/</a>" )
EXIT
CASE 2
tit_ := 'Mailing List'
AAdd( txt_, "<b>Harbour Developers Mailing List</b>" )
AAdd( txt_, "" )
AAdd( txt_, "Please visit the home page:" )
AAdd( txt_, "<a href='http://lists.harbour-project.org/pipermail/harbour/'>http://lists.harbour-project.org/pipermail/harbour/</a>" )
EXIT
CASE 3
tit_ := 'Mailing List'
AAdd( txt_, "<b>Harbour Users Mailing List</b>" )
AAdd( txt_, "" )
AAdd( txt_, "Please visit the home page:" )
AAdd( txt_, "<a href='http://lists.harbour-project.org/pipermail/harbour/'>http://lists.harbour-project.org/pipermail/harbour/</a>" )
EXIT
CASE 4
tit_ := 'About Harbour'
AAdd( txt_, "<b>About Harbour</b>" )
AAdd( txt_, "" )
AAdd( txt_, '"The Harbour Project is a Free Open Source Software effort to build' )
AAdd( txt_, 'a multiplatform Clipper language compiler. Harbour consists of the' )
AAdd( txt_, 'xBase language compiler and the runtime libraries with different' )
AAdd( txt_, 'terminal plugins and different databases (not just DBF)"' )
AAdd( txt_, "" )
AAdd( txt_, "Get downloads, samples, contribs and much more at:" )
AAdd( txt_, "<a href='http://www.harbour-project.org/'>http://www.harbour-project.org/</a>" )
EXIT
END
IF !Empty( txt_ )
MsgBox( hbide_arrayToMemo( txt_ ), tit_ )
ENDIF
RETURN nil
/*----------------------------------------------------------------------*/

View File

@@ -0,0 +1,150 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
*
* Copyright 2009-2010 Pritpal Bedi <pritpal@vouchcac.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*
* EkOnkar
* ( The LORD is ONE )
*
* Harbour-Qt IDE
*
* Pritpal Bedi <pritpal@vouchcac.com>
* 03Jan2010
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbide.ch"
#include "common.ch"
#include "hbclass.ch"
/*----------------------------------------------------------------------*/
CLASS IdeObject
ACCESS pSlots INLINE hbxbp_getSlotsPtr()
ACCESS pEvents INLINE hbxbp_getEventsPtr()
DATA oIde
DATA oUI
ACCESS qCurEdit INLINE ::oIde:qCurEdit
ACCESS qTabWidget INLINE ::oIde:oDA:oTabWidget:oWidget
ACCESS cWrkProject INLINE ::oIde:cWrkProject
ACCESS aProjects INLINE ::oIde:aProjects
ACCESS aINI INLINE ::oIde:aINI
ACCESS oDlg INLINE ::oIde:oDlg
ACCESS oDA INLINE ::oIde:oDA
ACCESS oDockPT INLINE ::oIde:oDockPT
ACCESS oProjTree INLINE ::oIde:oProjTree
ACCESS oProjRoot INLINE ::oIde:oProjRoot
ACCESS aProjData INLINE ::oIde:aProjData
ACCESS oDockED INLINE ::oIde:oDockED
ACCESS oEditTree INLINE ::oIde:oEditTree
ACCESS oOpenedSources INLINE ::oIde:oOpenedSources
ACCESS oDockR INLINE ::oIde:oDockR
ACCESS oFuncList INLINE ::oIde:oFuncList
ACCESS oDockB INLINE ::oIde:oDockB
ACCESS oCompileResult INLINE ::oIde:oCompileResult
ACCESS oDockB1 INLINE ::oIde:oDockB1
ACCESS oLinkResult INLINE ::oIde:oLinkResult
ACCESS oDockB2 INLINE ::oIde:oDockB2
ACCESS oOutputResult INLINE ::oIde:oOutputResult
ACCESS resPath INLINE ::oIde:resPath
ACCESS pathSep INLINE ::oIde:pathSep
ACCESS oFont INLINE ::oIde:oFont
ACCESS oThemes INLINE ::oIde:oThemes
ACCESS aTabs INLINE ::oIde:aTabs
ACCESS lProjTreeVisible INLINE ::oIde:lProjTreeVisible
ACCESS lDockRVisible INLINE ::oIde:lDockRVisible
ACCESS lDockBVisible INLINE ::oIde:lDockBVisible
ACCESS lTabCloseRequested INLINE ::oIde:lTabCloseRequested
ACCESS oSBar INLINE ::oIde:oSBar
METHOD new() VIRTUAL
METHOD create() VIRTUAL
METHOD destroy() VIRTUAL
ERROR HANDLER OnError()
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD IdeObject:onError( ... )
LOCAL cMsg
cMsg := __GetMessage()
IF SubStr( cMsg, 1, 1 ) == "_"
cMsg := SubStr( cMsg, 2 )
ENDIF
IF left( cMsg, 2 ) == "Q_"
RETURN ::oUI:&cMsg( ... )
ELSE
RETURN ::oIde:&cMsg( ... )
ENDIF
RETURN nil
/*----------------------------------------------------------------------*/

View File

@@ -0,0 +1,872 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
*
* Copyright 2009-2010 Pritpal Bedi <pritpal@vouchcac.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*
* EkOnkar
* ( The LORD is ONE )
*
* Harbour-Qt IDE
*
* Pritpal Bedi <pritpal@vouchcac.com>
* 03Jan2010
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbide.ch"
#include "hbqt.ch"
#include "common.ch"
#include "hbclass.ch"
/*----------------------------------------------------------------------*/
CLASS IdeProjManager INHERIT IdeObject
DATA cSaveTo
DATA aPrjProps INIT {}
DATA qProcess
DATA nStarted INIT 0
DATA cFileOut
DATA cFileErr
METHOD new()
METHOD create()
METHOD destroy()
METHOD populate()
METHOD loadProperties()
METHOD fetchProperties()
METHOD save()
METHOD updateHbp()
METHOD addSources()
METHOD getCurrentProject()
METHOD setCurrentProject()
METHOD selectCurrentProject()
METHOD closeProject()
METHOD promptForPath()
METHOD launchProject()
METHOD buildProject()
METHOD buildProjectViaQt()
METHOD readProcessInfo()
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:new( oIde )
::oIde := oIde
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:create( oIde )
DEFAULT oIde TO ::oIde
::oIde := oIde
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:destroy()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:populate()
LOCAL cProject
FOR EACH cProject IN ::aINI[ INI_PROJECTS ]
::loadProperties( cProject, .f., .f., .T. )
NEXT
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:loadProperties( cProject, lNew, lFetch, lUpdateTree )
LOCAL n, t, cWrkProject
DEFAULT cProject TO ""
DEFAULT lNew TO .F.
DEFAULT lFetch TO .T.
DEFAULT lUpdateTree TO .F.
/* Never touch original project file sent */
::aPrjProps := {}
::cSaveTo := ""
IF lNew
lFetch := .t.
ELSE
IF empty( cProject )
cProject := hbide_fetchAFile( ::oDlg, "Load Project...", { { "Harbour IDE Projects (*.hbi)", "*.hbi" } } )
ENDIF
IF empty( cProject )
RETURN Self
ENDIF
ENDIF
n := 0
IF !empty( cProject )
cWrkProject := hbide_pathNormalized( cProject ) /* normalize project name */
IF ( n := ascan( ::aProjects, {|e_| hbide_pathNormalized( e_[ 1 ] ) == cWrkProject } ) ) > 0
::aPrjProps := ::aProjects[ n, 3 ]
t := ::aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ]
ENDIF
IF empty( ::aPrjProps )
::aPrjProps := hbide_fetchHbiStructFromFile( hbide_pathToOSPath( cProject ) )
ENDIF
ENDIF
IF lFetch
::fetchProperties()
IF !empty( ::cSaveTo ) .and. file( ::cSaveTo )
cProject := ::cSaveTo
::aPrjProps := hbide_fetchHbiStructFromFile( hbide_pathToOSPath( cProject ) ) /* Reload from file */
ENDIF
ENDIF
IF n == 0
aadd( ::oIde:aProjects, { lower( cProject ), cProject, aclone( ::aPrjProps ) } )
IF lUpdateTree
::updateProjectTree( ::aPrjProps )
ENDIF
hbide_mnuAddFileToMRU( ::oIde, cProject, INI_RECENTPROJECTS )
ELSE
::aProjects[ n, 3 ] := aclone( ::aPrjProps )
IF lUpdateTree
::updateProjectTree( ::aPrjProps )
ENDIF
IF lUpdateTree .AND. ::aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] <> t
MsgBox( "::removeProjectFromTree( ::aPrjProps )" )
ENDIF
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:fetchProperties()
LOCAL cPrjLoc := hb_dirBase() + "projects"
::oUI := XbpQtUiLoader():new( ::oDlg )
::oUI:file := ::resPath + "projectproperties.ui"
::oUI:create()
::oUI:q_comboPrjType:addItem( "Executable" )
::oUI:q_comboPrjType:addItem( "Library" )
::oUI:q_comboPrjType:addItem( "Dll" )
DO CASE
CASE empty( ::aPrjProps )
::oUI:q_comboPrjType:setCurrentIndex( 0 )
CASE ::aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Lib"
::oUI:q_comboPrjType:setCurrentIndex( 1 )
CASE ::aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Dll"
::oUI:q_comboPrjType:setCurrentIndex( 2 )
OTHERWISE
::oUI:q_comboPrjType:setCurrentIndex( 0 )
ENDCASE
::oUI:signal( "buttonCn" , "clicked()", {|| ::oUI:oWidget:close() } )
::oUI:signal( "buttonSave" , "clicked()", {|| ::save( .F. ) } )
::oUI:signal( "buttonSaveExit", "clicked()", {|| ::save( .T. ) } )
::oUI:signal( "buttonSelect" , "clicked()", {|| ::addSources() } )
::oUI:signal( "tabWidget" , "currentChanged(int)", {|o,p| ::updateHbp( p, o ) } )
// TODO: Loading lookup.png inside these buttons...
::oUI:signal( "buttonChoosePrjLoc", "clicked()", {|| ::PromptForPath( 'editPrjLoctn', 'Choose the Project Location...', 'editOutName', "editWrkFolder", "editDstFolder" ) } )
::oUI:signal( "buttonChooseWd" , "clicked()", {|| ::PromptForPath( 'editWrkFolder', 'Choose a Working Folder...' ) } )
::oUI:signal( "buttonChooseDest" , "clicked()", {|| ::PromptForPath( 'editDstFolder', 'Choose a Destination Folder...' ) } )
IF empty( ::aPrjProps )
/*
* When they click on the button to confirm the name of the project, we
* will adjust the other parameters. (vailtoms)
* 25/12/2009 - 20:40:22
*/
::oUI:q_editPrjLoctn:setText( StrTran( cPrjLoc, '\', '/' ) )
ELSE
::oUI:q_editPrjTitle:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_TITLE ] )
::oUI:q_editPrjLoctn:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_LOCATION ] )
::oUI:q_editWrkFolder:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_WRKFOLDER ] )
::oUI:q_editDstFolder:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_DSTFOLDER ] )
::oUI:q_editOutName:setText( ::aPrjProps[ PRJ_PRP_PROPERTIES, 1, PRJ_PRP_OUTPUT ] )
::oUI:q_editFlags:setPlainText( hbide_arrayToMemo( ::aPrjProps[ PRJ_PRP_FLAGS , 1 ] ) )
::oUI:q_editSources:setPlainText( hbide_arrayToMemo( ::aPrjProps[ PRJ_PRP_SOURCES , 1 ] ) )
::oUI:q_editMetaData:setPlainText( hbide_arrayToMemo( ::aPrjProps[ PRJ_PRP_METADATA, 1 ] ) )
::oUI:q_editCompilers:setPlainText( memoread( hb_dirBase() + "hbide.env" ) )
#if 0
::oUI:q_editLaunchParams:setText()
::oUI:q_editLaunchExe:setText()
::oUI:q_editHbp:setPlainText()
#endif
ENDIF
IF empty( ::aPrjProps )
::oUI:oWidget:setWindowTitle( 'New Project...' )
ELSE
::oUI:oWidget:setWindowTitle( 'Properties for "' + ::oUI:q_editPrjTitle:Text() + '"' )
ENDIF
::setPosByIni( ::oUI:oWidget, PropsDialogGeometry )
//
::oUI:exec()
//
::aIni[ INI_HBIDE, PropsDialogGeometry ] := hbide_posAndSize( ::oUI:oWidget )
::oUI:destroy()
::oUI := NIL
::manageFocusInEditor()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:save( lCanClose )
LOCAL a_, a4_1
LOCAL typ_:= { "Executable", "Lib", "Dll" }
LOCAL txt_:= {}
LOCAL lOk
* Validate certain parameters before continuing ... (vailtom)
IF Empty( ::oUI:q_editOutName:text() )
IF Empty( ::oUI:q_editPrjTitle:text() )
MsgBox( 'Invalid Output FileName!' )
::oUI:q_editOutName:setFocus()
RETURN .F.
ENDIF
::oUI:q_editOutName:setText( ::oUI:q_editPrjTitle:text() )
ENDIF
IF Empty( ::oUI:q_editPrjTitle:text() )
::oUI:q_editPrjTitle:setText( ::oUI:q_editOutName:text() )
ENDIF
IF !hbide_isValidPath( ::oUI:q_editPrjLoctn:text(), 'Project Location' )
::oUI:q_editPrjLoctn:setFocus()
RETURN .F.
ENDIF
IF !hbide_isValidPath( ::oUI:q_editWrkFolder:text(), 'Working Folder' )
::oUI:q_editWrkFolder:setText( ::oUI:q_editPrjLoctn:text() )
RETURN .F.
ENDIF
IF !hbide_isValidPath( ::oUI:q_editDstFolder:text(), 'Destination Folder' )
::oUI:q_editDstFolder:setText( ::oUI:q_editPrjLoctn:text() )
RETURN .F.
ENDIF
aadd( txt_, "[ PROPERTIES ]" )
aadd( txt_, "Type = " + typ_[ ::oUI:q_comboPrjType:currentIndex()+1 ] )
aadd( txt_, "Title = " + ::oUI:q_editPrjTitle:text() )
aadd( txt_, "Location = " + ::oUI:q_editPrjLoctn:text() )
aadd( txt_, "WorkingFolder = " + ::oUI:q_editWrkFolder:text() )
aadd( txt_, "DestinationFolder = " + ::oUI:q_editDstFolder:text() )
aadd( txt_, "Output = " + ::oUI:q_editOutName:text() )
aadd( txt_, "LaunchParams = " + ::oUI:q_editLaunchParams:text() )
aadd( txt_, "LaunchProgram = " + ::oUI:q_editLaunchExe:text() )
aadd( txt_, " " )
aadd( txt_, "[ FLAGS ]" )
a_:= hbide_memoToArray( ::oUI:q_editFlags:toPlainText() ); aeval( a_, {|e| aadd( txt_, e ) } ) ; aadd( txt_, " " )
aadd( txt_, "[ SOURCES ]" )
a_:= hbide_memoToArray( ::oUI:q_editSources:toPlainText() ); aeval( a_, {|e| aadd( txt_, e ) } ) ; aadd( txt_, " " )
aadd( txt_, "[ METADATA ]" )
a_:= hbide_memoToArray( ::oUI:q_editMetaData:toPlainText() ); aeval( a_, {|e| aadd( txt_, e ) } ) ; aadd( txt_, " " )
/* Setup Meta Keys */
a4_1 := hbide_setupMetaKeys( a_ )
::cSaveTo := hbide_parseWithMetaData( ::oUI:q_editPrjLoctn:text(), a4_1 ) + ;
::pathSep + ;
hbide_parseWithMetaData( ::oUI:q_editOutName:text(), a4_1 ) + ;
".hbi"
::cSaveTo := hbide_pathToOSPath( ::cSaveTo )
IF ( lOk := hbide_createTarget( ::cSaveTo, txt_ ) )
*MsgBox( 'The project file was saved successfully: ' + ::cSaveTo, 'Saving project ...' )
hb_MemoWrit( hb_dirBase() + "hbide.env", ::oUI:q_editCompilers:toPlainText() )
ELSE
MsgBox( 'Error saving project file: ' + ::cSaveTo, 'Error saving project ...' )
ENDIF
IF lCanClose .AND. lOk
::oUI:oWidget:close()
ENDIF
RETURN lOk
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:updateHbp( iIndex )
LOCAL a_, a4_1, txt_, s
LOCAL cExt
IF iIndex != 3
RETURN nil
ENDIF
a_:= hb_atokens( strtran( ::oUI:q_editMetaData:toPlainText(), chr( 13 ) ), _EOL )
a4_1 := hbide_setupMetaKeys( a_ )
txt_:= {}
/* This block will be absent when submitting to hbmk engine */
aadd( txt_, "# " + hbide_parseWithMetaData( ::oUI:q_editWrkFolder:text(), a4_1 ) + ::pathSep + ;
hbide_parseWithMetaData( ::oUI:q_editOutName:text(), a4_1 ) + ".hbp" )
aadd( txt_, " " )
/* Flags */
a_:= hb_atokens( ::oUI:q_editFlags:toPlainText(), _EOL )
FOR EACH s IN a_
s := alltrim( s )
IF !( "#" == left( s,1 ) ) .and. !empty( s )
s := hbide_parseWithMetaData( s, a4_1 )
aadd( txt_, s )
ENDIF
NEXT
aadd( txt_, " " )
/* Sources */
a_:= hb_atokens( ::oUI:q_editSources:toPlainText(), _EOL )
FOR EACH s IN a_
s := alltrim( s )
IF !( "#" == left( s,1 ) ) .and. !empty( s )
s := hbide_parseWithMetaData( s, a4_1 )
hb_FNameSplit( s, , , @cExt )
IF lower( cExt ) $ ".c,.cpp,.prg,.rc,.res"
aadd( txt_, s )
ENDIF
ENDIF
NEXT
aadd( txt_, " " )
/* Final assault */
::oUI:q_editHbp:setPlainText( hbide_arrayToMemo( txt_ ) )
RETURN txt_
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:addSources()
LOCAL aFiles, a_, b_, a4_1, s
IF !empty( aFiles := ::selectSource( "openmany" ) )
a_:= hbide_memoToArray( ::oUI:q_editMetaData:toPlainText() )
a4_1 := hbide_setupMetaKeys( a_ )
a_:= hbide_memoToArray( ::oUI:q_editSources:toPlainText() )
b_:={}
aeval( aFiles, {|e| aadd( b_, hbide_applyMetaData( e, a4_1 ) ) } )
FOR EACH s IN b_
IF ascan( a_, s ) == 0
aadd( a_, s )
ENDIF
NEXT
::oUI:q_editSources:setPlainText( hbide_arrayToMemo( a_ ) )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
/* Set current project for build - vailtom
* 26/12/2009 - 02:19:38
*/
METHOD IdeProjManager:setCurrentProject( cProjectName )
LOCAL aPrjProps, n
LOCAL cOldProject := ::cWrkProject
LOCAL lValid := .T.
IF Empty( cProjectName )
::cWrkProject := ''
ELSEIF ( n := ascan( ::aProjects, {|e_| e_[ 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] == cProjectName } ) ) > 0
aPrjProps := ::aProjects[ n, 3 ]
::cWrkProject := aPrjProps[ PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ]
ELSE
MsgBox( 'Invalid project selected: "' + cProjectName + '"' )
lValid := .F.
ENDIF
IF lValid
IF !Empty( ::oSBar )
::oSBar:getItem( SB_PNL_PROJECT ):caption := ::cWrkProject
ENDIF
::oIde:updateTitleBar()
::oIde:updateProjectMenu()
ENDIF
RETURN cOldProject
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:getCurrentProject()
IF !Empty( ::cWrkProject )
RETURN ::cWrkProject
ENDIF
IF Empty( ::aProjects )
MsgBox( "No longer available projects!" )
RETURN ::cWrkProject
ENDIF
IF Len( ::aProjects ) == 1
RETURN ::aProjects[ 1, 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ]
ENDIF
RETURN ::selectCurrentProject()
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:selectCurrentProject()
LOCAL oDlg, i, p, t
IF Empty( ::aProjects )
MsgBox( "No longer available projects!" )
RETURN ::cWrkProject
ENDIF
oDlg := XbpQtUiLoader():new( ::oDlg )
oDlg:file := ::oIde:resPath + "selectproject.ui"
oDlg:create()
* Fill ComboBox with current project names
FOR i := 1 TO Len( ::aProjects )
p := ::aProjects[i]
t := p[ 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ]
IF !Empty( t )
oDlg:qObj[ "cbProjects" ]:addItem( t )
ENDIF
NEXT
oDlg:signal( "btnOk" , "clicked()", {|| ::setCurrentProject( oDlg:qObj[ "cbProjects" ]:currentText() ), oDlg:oWidget:close() } )
oDlg:signal( "btnCancel", "clicked()", {|| oDlg:oWidget:close() } )
oDlg:exec()
oDlg:destroy()
oDlg := NIL
RETURN ::cWrkProject
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:closeProject( cProject )
LOCAL nPos
IF Empty( ::aProjects )
MsgBox( "No longer available projects!" )
RETURN Self
ENDIF
DEFAULT cProject TO ::getCurrentProject()
nPos := ascan( ::aProjects, {|e_| e_[ 3, PRJ_PRP_PROPERTIES, 2, E_oPrjTtl ] == cProject } )
IF ( nPos < 0 )
MsgBox( 'Invalid project: "' + cProject + '"' )
RETURN Self
ENDIF
* aadd( ::aProjects, { lower( cProject ), cProject, aclone( ::aPrjProps ) } )
::aPrjProps := {}
::updateProjectTree( ::aProjects[ nPos, 3 ], .T. )
hb_adel( ::aProjects, nPos, .T. )
::setCurrentProject( '' )
RETURN Self
/*----------------------------------------------------------------------*/
/* Prompt for user to select a existing folder
* 25/12/2009 - 19:03:09 - vailtom
*/
METHOD IdeProjManager:promptForPath( cObjPathName, cTitle, cObjFileName, cObjPath2, cObjPath3 )
LOCAL cTemp, cPath, cFile
IF !hb_isChar( cObjFileName )
cTemp := ::oUI:qObj[ cObjPathName ]:Text()
cPath := hbide_fetchADir( ::oDlg, cTitle, cTemp )
cPath := StrTran( cPath, "\", "/" )
ELSE
cTemp := ::oUI:qObj[ cObjPathName ]:Text()
cTemp := hbide_fetchAFile( ::oDlg, cTitle, { { "Harbour IDE Projects", "*.hbi" } }, cTemp )
IF !Empty( cTemp )
cTemp := strtran( cTemp, "\", '/' )
hb_fNameSplit( cTemp, @cPath, @cFile )
::oUI:qObj[ cObjFileName ]:setText( cFile )
ENDIF
ENDIF
IF !Empty( cPath )
IF Right( cPath, 1 ) == '/'
cPath := Left( cPath, Len( cPath ) - 1 )
ENDIF
::oUI:qObj[ cObjPathName ]:setText( cPath )
IF hb_isChar( cObjPath2 ) .AND. Empty( ::oUI:qObj[ cObjPath2 ]:Text() )
::oUI:qObj[ cObjPath2 ]:setText( cPath )
ENDIF
IF hb_isChar( cObjPath3 ) .AND. Empty( ::oUI:qObj[ cObjPath3 ]:Text() )
::oUI:qObj[ cObjPath3 ]:setText( cPath )
ENDIF
ENDIF
::oUI:qObj[ cObjPathName ]:setFocus()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:buildProjectViaQt( cProject )
::buildProject( cProject, , , , .t. )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt )
LOCAL cOutput, cErrors, n, aPrj, cHbpPath, aHbp, qStringList
LOCAL cTmp, nResult
LOCAL nseconds
LOCAL cTargetFN
LOCAL cPath
LOCAL cFileName
LOCAL lDelHbp
DEFAULT lLaunch TO .F.
DEFAULT lRebuild TO .F.
DEFAULT lPPO TO .F.
DEFAULT lViaQt TO .F.
lDelHbp := lPPO
IF lPPO .AND. ::getCurrentTab() == 0
MsgBox( 'No file open issue to be compiled!' )
RETURN Self
End
IF empty( cProject )
cProject := ::oPM:getCurrentProject()
ENDIF
IF empty( cProject )
RETURN Self
ENDIF
n := ascan( ::aProjects, {|e_, x| x := e_[ 3 ], x[ 1,2,PRJ_PRP_TITLE ] == cProject } )
aPrj := ::aProjects[ n,3 ]
aHbp := {}
cTargetFN := aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_LOCATION ] + ::pathSep + aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_OUTPUT ]
cTargetFN := StrTran( cTargetFN, '/', ::pathSep )
cTargetFN := StrTran( cTargetFN, '\', ::pathSep )
/*
* Creates a temporary file to avoid erase the file. Hbp correct this project.
* 26/12/2009 - 04:17:56 - vailtom
*/
IF lDelHbp
cHbpPath := cTargetFN + '.' + hb_md5( alltrim( str( seconds() ) ) ) + ".hbp"
ELSE
cHbpPath := cTargetFN + ".hbp"
End
DO CASE
CASE aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Lib"
aadd( aHbp, "-hblib" )
CASE aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Dll"
aadd( aHbp, "-hbdyn" )
ENDCASE
aadd( aHbp, "-o" + cTargetFN )
aadd( aHbp, "-q" )
aadd( aHbp, "-trace" )
aadd( aHbp, "-info" )
IF lRebuild
aadd( aHbp, "-rebuild" )
End
aeval( aPrj[ PRJ_PRP_FLAGS, 2 ], {|e| aadd( aHbp, e ) } )
IF !( lPPO )
aeval( hbide_filesToSources( aPrj[ PRJ_PRP_SOURCES, 2 ] ), {|e| aadd( aHbp, e ) } )
ELSE
aadd( aHbp, "-hbcmp -s -p" )
n := ::getCurrentTab()
hb_FNameSplit( ::aTabs[ n, 5 ], @cPath, @cFileName, @cTmp )
IF !( lower( cTmp ) $ ".prg,?" )
MsgBox( 'Operation not supported for this file type: "'+cTmp+'"' )
RETURN Self
ENDIF
cFileName := cPath + cFileName + '.ppo'
// TODO: We have to test if the current file is part of a project, and we
// pull your settings, even though this is not the active project - vailtom
aadd( aHbp, ::aTabs[ n, 5 ] )
FErase( cFileName )
ENDIF
IF !hbide_createTarget( cHbpPath, aHbp )
cTmp := 'Error saving: ' + cHbpPath
ELSE
::lDockBVisible := .t.
::oDockB2:show()
::oOutputResult:oWidget:clear()
nSeconds := seconds() // time elapsed
cTmp := "Project : " + cProject + CRLF + ;
"Launch : " + iif( lLaunch, 'Yes', 'No' ) + CRLF + ;
"Rebuild : " + iif( lRebuild, 'Yes', 'No' ) + CRLF + ;
"Started at : " + time() + CRLF + ;
'-----------------------------------------------------------------' + CRLF
IF lViaQt
qStringList := QStringList():new()
qStringList:append( cHbpPath )
::qProcess := QProcess():new()
//::qProcess:setProcessChannelMode( 0 )
//::qProcess:setReadChannel( 0 )
::cFileOut := hbide_pathToOSPath( cTargetFN + '.' + hb_md5( alltrim( str( seconds() ) ) ) + ".out" )
::cFileErr := hbide_pathToOSPath( cTargetFN + '.' + hb_md5( alltrim( str( seconds() ) ) ) + ".err" )
::qProcess:setStandardOutputFile( ::cFileOut )
::qProcess:setStandardErrorFile( ::cFileErr )
Qt_Slots_Connect( ::pSlots, ::qProcess, "readyReadStandardOutput()", {|o,i| ::readProcessInfo( 2, i, o ) } )
Qt_Slots_Connect( ::pSlots, ::qProcess, "readyReadStandardError()" , {|o,i| ::readProcessInfo( 3, i, o ) } )
Qt_Slots_Connect( ::pSlots, ::qProcess, "finished(int,int)" , {|o,i,ii| ::readProcessInfo( 4, i, ii, o ) } )
::oOutputResult:oWidget:clear()
::oOutputResult:oWidget:append( cTmp )
::nStarted := seconds()
::qProcess:start( "hbmk2", qStringList )
ELSE
cOutput := "" ; cErrors := ""
nResult := hb_processRun( ( "hbmk2 " + cHbpPath ), , @cOutput, @cErrors )
* Show detailed status about compile process...
cTmp += cOutput + CRLF
cTmp += IIF( empty( cErrors ), "", cErrors ) + CRLF
cTmp += "errorlevel: " + hb_ntos( nResult ) + CRLF
cTmp += '-----------------------------------------------------------------' + CRLF
cTmp += 'Finished at ' + time() + CRLF
cTmp += "Done in " + ltrim( str( seconds() - nseconds ) ) +" seconds." + CRLF
hbide_convertBuildStatusMsgToHtml( cTmp, ::oOutputResult:oWidget )
IF ( nResult == 0 ) .AND. ( lLaunch )
::LaunchProject( cProject )
ENDIF
ENDIF
ENDIF
IF lDelHbp
FErase( cHbpPath )
ENDIF
IF lPPO .AND. File( cFileName )
::aEdits[ 1 ]:showPPO( cFileName )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeProjManager:readProcessInfo( nMode, i, ii )
LOCAL cLine, cTmp
DO CASE
CASE nMode == 1
CASE nMode == 2
::qProcess:setReadChannel( 0 )
cLine := space( 4096 )
::qProcess:readLine( @cLine, 4096 )
IF !empty( cLine )
::oOutputResult:oWidget:append( cLine )
ENDIF
CASE nMode == 3
::qProcess:setReadChannel( 1 )
cLine := space( 4096 )
::qProcess:readLine( @cLine, 4096 )
IF !empty( cLine )
IF ( "Warning" $ cLine )
cLine := '<font color=blue>' + cLine + '</font>'
ELSEIF ( "Error" $ cLine )
cLine := '<font color=red>' + cLine + '</font>'
ENDIF
::oOutputResult:oWidget:append( cLine )
ENDIF
CASE nMode == 4
cTmp := memoread( ::cFileOut )
hbide_convertBuildStatusMsgToHtml( cTmp, ::oOutputResult:oWidget )
cTmp := memoread( ::cFileErr )
hbide_convertBuildStatusMsgToHtml( cTmp, ::oOutputResult:oWidget )
cTmp := '-----------------------------------------------------------------' + CRLF
cTmp += "Exit Code : " + hb_ntos( i ) + " Exit Status : " + hb_ntos( ii ) + CRLF
cTmp += '-----------------------------------------------------------------' + CRLF
cTmp += 'Finished at : ' + time() + " Done in : " + hb_ntos( seconds() - ::nStarted ) +" seconds." + CRLF
::oOutputResult:oWidget:append( cTmp )
Qt_Slots_disConnect( ::pSlots, ::qProcess, "finished(int,int)" )
Qt_Slots_disConnect( ::pSlots, ::qProcess, "readyReadStandardOutput()" )
Qt_Slots_disConnect( ::pSlots, ::qProcess, "readyReadStandardError()" )
::qProcess:kill()
::qProcess:pPtr := 0
::qProcess := NIL
ferase( ::cFileOut )
ferase( ::cFileErr )
ENDCASE
RETURN nil
/*----------------------------------------------------------------------*/
/*
* Launch selected project.
* 03/01/2010 - 09:24:50
*/
METHOD IdeProjManager:LaunchProject( cProject )
LOCAL qProcess
LOCAL cTargetFN
LOCAL cTmp, aPrj, n
IF empty( cProject )
cProject := ::oPM:getCurrentProject()
ENDIF
IF empty( cProject )
RETURN Self
ENDIF
n := ascan( ::aProjects, {|e_, x| x := e_[ 3 ], x[ 1,2,PRJ_PRP_TITLE ] == cProject } )
aPrj := ::aProjects[ n,3 ]
cTargetFN := aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_LOCATION ] + ::pathSep + aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_OUTPUT ]
cTargetFN := StrTran( cTargetFN, '/', ::pathSep )
cTargetFN := StrTran( cTargetFN, '\', ::pathSep )
#ifdef __PLATFORM__WINDOWS
IF aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Executable"
cTargetFN += '.exe'
ENDIF
#endif
IF !File( cTargetFN )
cTmp := "Launch application error: file not found " + cTargetFN + "!"
ELSEIF aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Executable"
cTmp := "Launch application " + cTargetFN + "... "
qProcess := QProcess():new()
qProcess:startDetached_2( cTargetFN )
qProcess:waitForStarted()
qProcess:pPtr := 0
qProcess := NIL
ELSE
cTmp := "Launch application " + cTargetFN + "... (not applicable)"
ENDIF
::oOutputResult:oWidget:append( cTmp )
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -70,118 +70,90 @@
/*----------------------------------------------------------------------*/
FUNCTION saveINI( oIde )
LOCAL nTab, pTab, n, txt_, qEdit, qHScr, qVScr, qSet, cTheme
FUNCTION hbide_saveINI( oIde )
LOCAL nTab, pTab, n, txt_, qHScr, qVScr, oEdit, qCursor
LOCAL nTabs := oIde:qTabWidget:count()
//LOCAL qBArray
txt_:= {}
// Properties
aadd( txt_, "[HBIDE]" )
aadd( txt_, "MainWindowGeometry = " + PosAndSize( oIde:oDlg:oWidget ) )
aadd( txt_, " " )
aadd( txt_, "MainWindowGeometry = " + hbide_posAndSize( oIde:oDlg:oWidget ) )
aadd( txt_, "ProjectTreeVisible = " + IIF( oIde:lProjTreeVisible, "YES", "NO" ) )
aadd( txt_, "ProjectTreeGeometry = " + PosAndSize( oIde:oProjTree:oWidget ) )
aadd( txt_, "ProjectTreeGeometry = " + hbide_posAndSize( oIde:oProjTree:oWidget ) )
aadd( txt_, "FunctionListVisible = " + IIF( oIde:lDockRVisible, "YES", "NO" ) )
aadd( txt_, "FunctionListGeometry = " + PosAndSize( oIde:oFuncList:oWidget ) )
aadd( txt_, "FunctionListGeometry = " + hbide_posAndSize( oIde:oFuncList:oWidget ) )
aadd( txt_, "RecentTabIndex = " + hb_ntos( oIde:qTabWidget:currentIndex() ) )
aadd( txt_, "CurrentProject = " + "" )
aadd( txt_, "GotoDialogGeometry = " + oIde:aIni[ INI_HBIDE, GotoDialogGeometry ] )
aadd( txt_, "PropsDialogGeometry = " + oIde:aIni[ INI_HBIDE, PropsDialogGeometry ] )
aadd( txt_, "FindDialogGeometry = " + oIde:aIni[ INI_HBIDE, FindDialogGeometry ] )
aadd( txt_, "ThemesDialogGeometry = " + oIde:aIni[ INI_HBIDE, ThemesDialogGeometry ] )
qSet := QSettings():new( "Harbour", "HbIde" )
qSet:setValue( "state", oIde:oDlg:oWidget:saveState() )
#if 0
qBArray := QByteArray()
qBArray:pPtr := oIde:oDlg:oWidget:saveState()
HB_TRACE( HB_TR_ALWAYS, "QByteArray", 1 )
HB_TRACE( HB_TR_ALWAYS, "QByteArray", qBArray:size(), qBArray:isNull() )
HB_TRACE( HB_TR_ALWAYS, "QByteArray", 2, qBArray:constData() )
aadd( txt_, "State = " + qBArray:data_1() )
#endif
aadd( txt_, " " )
// Projects
aadd( txt_, "[PROJECTS]" )
aadd( txt_, " " )
FOR n := 1 TO len( oIde:aProjects )
aadd( txt_, oIde:aProjects[ n, 2 ] )
NEXT
aadd( txt_, " " )
// Files
aadd( txt_, "[FILES]" )
aadd( txt_, " " )
FOR n := 1 TO nTabs
pTab := oIde:qTabWidget:widget( n-1 )
nTab := ascan( oIde:aTabs, {|e_| hbqt_IsEqualGcQtPointer( e_[ 1 ]:oWidget:pPtr, pTab ) } )
* Ignores untitled or temporary files...
IF Empty( oIde:aTabs[ nTab, TAB_SOURCEFILE ] )
LOOP
oEdit := oIde:aTabs[ nTab, TAB_OEDITOR ]
IF !Empty( oEdit:sourceFile ) .and. !( ".ppo" == lower( oEdit:cExt ) )
qHScr := QScrollBar():configure( oEdit:qEdit:horizontalScrollBar() )
qVScr := QScrollBar():configure( oEdit:qEdit:verticalScrollBar() )
qCursor := QTextCursor():configure( oEdit:qEdit:textCursor() )
aadd( txt_, oIde:aTabs[ nTab, TAB_SOURCEFILE ] + "," + ;
hb_ntos( qCursor:position() ) + "," + ;
hb_ntos( qHScr:value() ) + "," + ;
hb_ntos( qVScr:value() ) + "," + ;
oEdit:cTheme + "," )
ENDIF
qEdit := oIde:aTabs[ nTab, TAB_QEDIT ]
qHScr := QScrollBar():configure( qEdit:horizontalScrollBar() )
qVScr := QScrollBar():configure( qEdit:verticalScrollBar() )
oIde:qCursor := QTextCursor():configure( qEdit:textCursor() )
cTheme := oIde:aTabs[ nTab, TAB_OEDITOR ]:cTheme
aadd( txt_, oIde:aTabs[ nTab, TAB_SOURCEFILE ] +","+ ;
hb_ntos( oIde:qCursor:position() ) +","+ ;
hb_ntos( qHScr:value() ) + "," + ;
hb_ntos( qVScr:value() ) + "," + ;
cTheme + "," ;
)
NEXT
aadd( txt_, " " )
// Find
aadd( txt_, "[FIND]" )
aadd( txt_, " " )
FOR n := 1 TO len( oIde:aIni[ INI_FIND ] )
aadd( txt_, oIde:aIni[ INI_FIND, n ] )
NEXT
aadd( txt_, " " )
// Replace
aadd( txt_, "[REPLACE]" )
aadd( txt_, " " )
FOR n := 1 TO len( oIde:aIni[ INI_REPLACE ] )
aadd( txt_, oIde:aIni[ INI_REPLACE, n ] )
NEXT
aadd( txt_, " " )
// RecentFiles
aadd( txt_, "[RecentFiles]" )
aadd( txt_, "[RECENTFILES]" )
aadd( txt_, " " )
FOR n := 1 TO len( oIde:aIni[ INI_RECENTFILES ] )
aadd( txt_, oIde:aIni[ INI_RECENTFILES, n ] )
NEXT
aadd( txt_, " " )
// RecentProjects
aadd( txt_, "[RecentProjects]" )
aadd( txt_, "[RECENTPROJECTS]" )
aadd( txt_, " " )
FOR n := 1 TO len( oIde:aIni[ INI_RECENTPROJECTS ] )
aadd( txt_, oIde:aIni[ INI_RECENTPROJECTS , n ] )
NEXT
aadd( txt_, " " )
//[RecentFiles]
//j:/hbide.2/projects/samples/sample1.prg
//j:/hbide.2/projects/samples/sample2.prg
//j:/hbide.2/projects/samples/sample3.prg
//[RecentPROJECTS]
//C:/harbour/contrib/hbide/projects/hbide.hbi
//J:/hbide.2/projects/samples/sample1.hbi
RETURN CreateTarget( oIde:cProjIni, txt_ )
RETURN hbide_createTarget( oIde:cProjIni, txt_ )
/*----------------------------------------------------------------------*/
FUNCTION loadINI( oIde, cHbideIni )
LOCAL aElem, s, n, nPart, cKey, cVal, a_, lValid, nPos
FUNCTION hbide_loadINI( oIde, cHbideIni )
LOCAL aElem, s, n, nPart, cKey, cVal, a_
LOCAL aIdeEle := { "mainwindowgeometry" , "projecttreevisible" , "projecttreegeometry", ;
"functionlistvisible", "functionlistgeometry", "recenttabindex" , ;
"currentproject" , "gotodialoggeometry" , "propsdialoggeometry", ;
@@ -189,25 +161,23 @@ FUNCTION loadINI( oIde, cHbideIni )
DEFAULT cHbideIni TO "hbide.ini"
lValid := .F.
IF ! hb_FileExists( cHbideIni )
cHbideIni := hb_dirBase() + "hbide.ini"
ENDIF
oIde:cProjIni := cHbideIni
oIde:aIni := Array( INI_SECTIONS_COUNT )
oIde:aIni[1] := afill( array( INI_HBIDE_VRBLS ), "" )
oIde:aIni[ 1 ] := afill( array( INI_HBIDE_VRBLS ), "" )
//
FOR n := 2 TO INI_SECTIONS_COUNT
oIde:aIni[n] := Array(0)
oIde:aIni[ n ] := Array( 0 )
NEXT
IF hb_FileExists( oIde:cProjIni )
aElem := ReadSource( oIde:cProjIni )
aElem := hbide_readSource( oIde:cProjIni )
FOR EACH s IN aElem
s := alltrim( s )
IF !empty( s )
/*
@@ -217,37 +187,30 @@ FUNCTION loadINI( oIde, cHbideIni )
* section.
* 01/01/2010 - 16:38:22 - vailtom
*/
SWITCH Upper(s)
SWITCH Upper( s )
CASE "[HBIDE]"
nPart := INI_HBIDE
lValid := .T.
EXIT
CASE "[PROJECTS]"
nPart := INI_PROJECTS
lValid := .T.
EXIT
CASE "[FILES]"
nPart := INI_FILES
lValid := .T.
EXIT
CASE "[FIND]"
nPart := INI_FIND
lValid := .T.
EXIT
CASE "[REPLACE]"
nPart := INI_REPLACE
lValid := .T.
EXIT
CASE "[RECENTFILES]"
nPart := INI_RECENTFILES
lValid := .T.
EXIT
CASE "[RECENTPROJECTS]"
nPart := INI_RECENTPROJECTS
lValid := .T.
EXIT
OTHERWISE
/*
* If none of the previous sections are valid, do not let it
* process. This prevents the HBIDE read a section that is
@@ -256,13 +219,10 @@ FUNCTION loadINI( oIde, cHbideIni )
* for '[* PROJECTS]' and see how it behaves incorrectly.
* 01/01/2010 - 18:09:40 - vailtom
*/
IF Left( s, 1 ) == '['
lValid := .F.
End
DO CASE
CASE !lValid
CASE Left( s, 1 ) == '['
* Nothing todo!
CASE nPart == INI_HBIDE
IF ( n := at( "=", s ) ) > 0
cKey := alltrim( substr( s, 1, n-1 ) )
@@ -272,11 +232,9 @@ FUNCTION loadINI( oIde, cHbideIni )
oIde:aIni[ nPart, n ] := cVal /* Further process */
ENDIF
ENDIF
EXIT
CASE nPart == INI_PROJECTS
aadd( oIde:aIni[ nPart ], s )
oIde:loadProjectProperties( s, .f., .f., .f. )
CASE nPart == INI_FILES
a_:= hb_atokens( s, "," )
@@ -291,30 +249,30 @@ FUNCTION loadINI( oIde, cHbideIni )
a_[ 3 ] := val( a_[ 3 ] )
a_[ 4 ] := val( a_[ 4 ] )
a_[ 5 ] := a_[ 5 ]
* Ignores invalid filenames...
IF !Empty( a_[1] )
IF !Empty( a_[ 1 ] )
aadd( oIde:aIni[ nPart ], a_ )
ENDIF
CASE nPart == INI_FIND
aadd( oIde:aIni[ nPart ], s )
CASE nPart == INI_REPLACE
aadd( oIde:aIni[ nPart ], s )
CASE nPart == INI_RECENTPROJECTS .OR. ;
nPart == INI_RECENTFILES
IF Len( oIde:aIni[ nPart ] ) < 15
s := PathNormalized(s)
nPos := aScan( oIde:aIni[ nPart ], {|f| PathNormalized( f ) == s } )
IF nPos < 0
IF Len( oIde:aIni[ nPart ] ) < 25
s := hbide_pathNormalized( s, .f. )
IF aScan( oIde:aIni[ nPart ], {|e| hbide_pathNormalized( e, .f. ) == s } ) == 0
AAdd( oIde:aIni[ nPart ], s )
ENDIF
ENDIF
ENDCASE
EXIT
ENDSWITCH
ENDIF
NEXT
@@ -323,3 +281,4 @@ FUNCTION loadINI( oIde, cHbideIni )
RETURN Nil
/*----------------------------------------------------------------------*/

View File

@@ -82,7 +82,7 @@
/*----------------------------------------------------------------------*/
FUNCTION LoadThemes( oIde )
FUNCTION hbide_loadThemes( oIde )
IF empty( oIde:cIniThemes )
oIde:cIniThemes := hb_dirBase() + "hbide.hbt"
@@ -94,10 +94,8 @@ FUNCTION LoadThemes( oIde )
/*----------------------------------------------------------------------*/
CLASS IdeThemes
CLASS IdeThemes INHERIT IdeObject
VAR oIde
VAR oUI
VAR lDefault INIT .t.
VAR cIniFile INIT ""
@@ -163,7 +161,7 @@ METHOD IdeThemes:create( oIde, cIniFile )
::cIniFile := cIniFile
/* next always load default themes */
::aIni := LoadDefaultThemes()
::aIni := hbide_loadDefaultThemes()
::parseINI()
/* first load user defined themes */
@@ -231,7 +229,7 @@ METHOD IdeThemes:contains( cTheme )
METHOD IdeThemes:load( cFile )
IF hb_isChar( cFile ) .AND. !empty( cFile ) .AND. hb_FileExists( cFile )
::aIni:= ReadSource( cFile )
::aIni:= hbide_readSource( cFile )
::parseINI()
::lDefault := .f.
ENDIF
@@ -250,7 +248,7 @@ METHOD IdeThemes:save( lAsk )
ENDIF
IF lAsk
cFile := SaveAFile( ::oIde:oDlg, ;
cFile := hbide_saveAFile( ::oIde:oDlg, ;
"Select a File to Save Themes (.hbt)", ;
{ { "Harbour IDE Themes", "*.hbt" } }, ;
::cIniFile, ;
@@ -320,7 +318,6 @@ METHOD IdeThemes:setMultiLineCommentRule( qHiliter, cTheme )
LOCAL aAttr
IF !empty( aAttr := ::getThemeAttribute( "CommentsAndRemarks", cTheme ) )
idedbg( " CommentsAndRemarks " )
qHiliter:setHBMultiLineCommentFormat( ::buildSyntaxFormat( aAttr ) )
ENDIF
@@ -392,7 +389,7 @@ METHOD IdeThemes:fetch()
::oUI:signal( "checkUnderline", "stateChanged(int)" , {|o,i| ::updateAttribute( THM_ATR_ULINE , i, o ) } )
::oUI:signal( "buttonClose" , "clicked()", ;
{|| ::oIde:aIni[ INI_HBIDE, ThemesDialogGeometry ] := PosAndSize( ::oUI:oWidget ), ::oUI:hide() } )
{|| ::oIde:aIni[ INI_HBIDE, ThemesDialogGeometry ] := hbide_posAndSize( ::oUI:oWidget ), ::oUI:hide() } )
::oIde:setPosAndSizeByIni( ::oUI:oWidget, ThemesDialogGeometry )
@@ -653,7 +650,7 @@ METHOD IdeThemes:parseINI( lAppend )
IF ( n := at( ":", s ) ) > 0
cKey := alltrim( strtran( substr( s, n+1 ), "]" ) )
ENDIF
HB_TRACE( HB_TR_ALWAYS, cKey )
// HB_TRACE( HB_TR_ALWAYS, cKey )
IF !empty( cKey )
nPart := 3
IF ( nTheme := ascan( ::aThemes, {|e_| e_[ 1 ] == cKey } ) ) == 0
@@ -666,7 +663,7 @@ METHOD IdeThemes:parseINI( lAppend )
OTHERWISE
DO CASE
CASE nPart == 1 /* Controls */
IF ParseKeyValPair( s, @cKey, @cVal )
IF hbide_parseKeyValPair( s, @cKey, @cVal )
IF ( n := ascan( ::aControls, cKey ) ) > 0
::aControls[ n, 2 ] := cVal
ELSE
@@ -674,7 +671,7 @@ METHOD IdeThemes:parseINI( lAppend )
ENDIF
ENDIF
CASE nPart == 2 /* Items */
IF ParseKeyValPair( s, @cKey, @cVal )
IF hbide_parseKeyValPair( s, @cKey, @cVal )
IF ( n := ascan( ::aThemes, cKey ) ) > 0
::aThemes[ n, 2 ] := cVal
ELSE
@@ -682,7 +679,7 @@ METHOD IdeThemes:parseINI( lAppend )
ENDIF
ENDIF
CASE nPart == 3 /* Theams */
IF ParseKeyValPair( s, @cKey, @cVal )
IF hbide_parseKeyValPair( s, @cKey, @cVal )
aV := FillAttrbs()
aVal := hb_aTokens( cVal, "," )
FOR n := 1 TO THM_NUM_ATTRBS
@@ -797,7 +794,7 @@ STATIC FUNCTION GetSource()
/*----------------------------------------------------------------------*/
STATIC FUNCTION SetSyntaxAttrbs( qHiliter, cPattern, cName, nR, nG, nB, lItalic, lBold, lUnderline )
STATIC FUNCTION hbide_setSyntaxAttrbs( qHiliter, cPattern, cName, nR, nG, nB, lItalic, lBold, lUnderline )
LOCAL qFormat
qFormat := QTextCharFormat():new()
@@ -819,74 +816,7 @@ STATIC FUNCTION SetSyntaxAttrbs( qHiliter, cPattern, cName, nR, nG, nB, lItalic,
/*----------------------------------------------------------------------*/
FUNCTION SetSyntaxHilighting( qEdit, qHiliter )
LOCAL b_, qFormat, s
HB_SYMBOL_UNUSED( qEdit )
/* Compiler Directives */
b_:= { "include","ifdef","else","endif","command","xcommand","translate","xtranslate" }
s := ""; aeval( b_, {|e| s += iif( empty( s ), "", "|" ) + "#" + upper( e ) + "\b|#" + e + "\b" } )
SetSyntaxAttrbs( qHiliter, s, "PreprocessorDirectives", 120, 26, 213, .t., .t., .f. )
/* Harbour Keywords */
b_:= { 'function','return','static','local','default', ;
'if','else','elseif','endif','end', ;
'docase','case','endcase','otherwise', ;
'do','while','exit',;
'for','each','next','step','to',;
'class','endclass','method','data','var','destructor','inline','assign','access',;
'inherit','init','create','virtual',;
'begin','sequence','try','catch','always','recover','hb_symbol_unused' }
s := ""; aeval( b_, {|e| s += iif( empty( s ), "", "|" ) + "\b" + upper( e ) + "\b|\b" + e + "\b" } )
//SetSyntaxAttrbs( qHiliter, s, "HarbourKeywords" , 40, 120, 240, .f., .t., .f. )
SetSyntaxAttrbs( qHiliter, s, "HarbourKeywords" , 192, 0, 0, .f., .t., .f. )
#if 0
/* C Language Keywords - Only for C or CPP sources - mutually exclusive with Harbour Sources */
b_:= { "char", "class", "const", "double", "enum", "explicit", "friend", "inline", ;
"int", "long", "namespace", "operator", "private", "protected", "public", ;
"short", "signals", "signed", "slots", "static", "struct", "template", ;
"typedef", "typename", "union", "unsigned", "virtual", "void", "volatile" }
s := ""; aeval( b_, {|e| s += iif( empty( s ), "", "|" ) + "\b" } )
SetSyntaxAttrbs( qHiliter, s, "CLanguageKeywords" , 40, 120, 240, .f., .t., .f. )
#endif
/* Operators */
s := "\:\=|\:|\+|\-|\\|\*|\ IN\ |\ in\ |\=|\>|\<|\^|\%|\$|\&|\@|\.or\.|\.and\.|\.OR\.|\.AND\.|\!"
SetSyntaxAttrbs( qHiliter, s, "Operators" , 255, 120, 0, .f., .f., .f. )
/* Numerics */
s := "\b[0-9.]+\b"
SetSyntaxAttrbs( qHiliter, s, "NumericConstants" , 127, 127, 127, .f., .f., .f. )
/* Brackets and Braces */
s := "\(|\)|\{|\}|\[|\]|\|"
SetSyntaxAttrbs( qHiliter, s, "BracketsAndBraces" , 0, 0, 192, .f., .f., .f. )
/* Functions in General */
s := "\b[A-Za-z0-9_]+(?=\()"
SetSyntaxAttrbs( qHiliter, s, "FunctionsBody" , 0, 0, 255, .f., .f., .f. )
/* Strings */
s := [\".*\"|\'.*\']
SetSyntaxAttrbs( qHiliter, s, "TerminatedStrings" , 0, 127, 0, .f., .f., .f. )
/* Single Line Comments */
s := "//[^\n]*"
SetSyntaxAttrbs( qHiliter, s, "CommentsAndRemarks" , 190, 190, 190, .f., .f., .f. )
/* Multiline comments */
qFormat := QTextCharFormat():new()
qFormat:setFontItalic( .t. )
qFormat:setForeGround( QBrush():new( "QColor", QColor():new( 190,190,190 ) ) )
qHiliter:setHBMultiLineCommentFormat( qFormat )
RETURN nil
/*----------------------------------------------------------------------*/
STATIC FUNCTION LoadDefaultThemes()
STATIC FUNCTION hbide_loadDefaultThemes()
LOCAL aIni := {}
IF .t.

View File

@@ -21,9 +21,9 @@ LaunchProgram =
-workdir=<IdeSrc>projects/${hb_plat}/${hb_comp}/hbide
[ SOURCES ]
# PRG Sources
#
<IdeSrc>hbide.prg
<IdeSrc>ideobject.prg
<IdeSrc>idestylesheets.prg
<IdeSrc>idetags.prg
<IdeSrc>idemisc.prg
@@ -34,22 +34,13 @@ LaunchProgram =
<IdeSrc>idesaveload.prg
<IdeSrc>iderequests.prg
<IdeSrc>idethemes.prg
# C Sources
<IdeSrc>ideprojmanager.prg
#
<IdeSrc>ideparseexpr.c
# Miscellaneous Files
#
<IdeSrc>hbide.ch
<IdeSrc>hbide.ini
[ METADATA ]
# Meta Key/Value pair accepts any valid Harbour defined
# function call returning a string value, thus making meta-data
# protocol extremely powerful. In case of any error in evaluating
# value expression will return itself as string value.
# So <SomeKey = "SomeValue" > OR <SomeKey = SomeValue>
# will return the same string as <SomeValue>
#
IdeSrc = hb_dirBase()

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -115,6 +115,8 @@ METHOD XbpQtUiLoader:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
::xbpWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
IF !empty( ::file ) .and. file( ::file )
hb_hCaseMatch( ::qObj, .f. )
::loadContents( ::file )
::oWidget := ::loadUI( ::file )
@@ -122,6 +124,7 @@ METHOD XbpQtUiLoader:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible
IF !empty( ::oWidget )
::loadWidgets()
ENDIF
ENDIF
RETURN Self
@@ -256,7 +259,11 @@ METHOD OnError( ... )
HBXBP_DEBUG( "OnError", cMsg )
xReturn := ::oWidget:&cMsg( ... )
IF left( cMsg, 2 ) == "Q_"
xReturn := ::qObj[ substr( cMsg, 3 ) ]
ELSE
xReturn := ::oWidget:&cMsg( ... )
ENDIF
RETURN xReturn