From 4618f04be4903c293b49220d3623484787ed5409 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sat, 19 Jun 2010 01:17:42 +0000 Subject: [PATCH] 2010-06-18 18:14 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/hbide.ch * contrib/hbide/hbide.prg * contrib/hbide/ideactions.prg * contrib/hbide/idedocks.prg * contrib/hbide/ideeditor.prg * contrib/hbide/ideenviron.prg * contrib/hbide/idefindreplace.prg * contrib/hbide/idefunctions.prg * contrib/hbide/ideobject.prg * contrib/hbide/ideprojmanager.prg * contrib/hbide/idesaveload.prg * contrib/hbide/ideshortcuts.prg * contrib/hbide/idesources.prg * contrib/hbide/idetools.prg + Remodelled: ::aINI - hbide.ini variables container. It is now encapsulated in a object - ::aINI => ::oINI. This implementation has made this construct extendible to any extent. Earlier it was a real mess to add one more option on top of the existing one. --- harbour/ChangeLog | 21 + harbour/contrib/hbide/hbide.ch | 52 -- harbour/contrib/hbide/hbide.prg | 81 +- harbour/contrib/hbide/ideactions.prg | 65 +- harbour/contrib/hbide/idedocks.prg | 14 +- harbour/contrib/hbide/ideeditor.prg | 4 +- harbour/contrib/hbide/ideenviron.prg | 14 +- harbour/contrib/hbide/idefindreplace.prg | 37 +- harbour/contrib/hbide/idefunctions.prg | 2 +- harbour/contrib/hbide/ideobject.prg | 1 - harbour/contrib/hbide/ideprojmanager.prg | 16 +- harbour/contrib/hbide/idesaveload.prg | 1056 ++++++++-------------- harbour/contrib/hbide/ideshortcuts.prg | 4 +- harbour/contrib/hbide/idesources.prg | 8 +- harbour/contrib/hbide/idetools.prg | 38 +- 15 files changed, 527 insertions(+), 886 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e7c29b71ef..16730a5278 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,27 @@ The license applies to all entries newer than 2009-04-28. */ +2010-06-18 18:14 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/hbide.ch + * contrib/hbide/hbide.prg + * contrib/hbide/ideactions.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/ideenviron.prg + * contrib/hbide/idefindreplace.prg + * contrib/hbide/idefunctions.prg + * contrib/hbide/ideobject.prg + * contrib/hbide/ideprojmanager.prg + * contrib/hbide/idesaveload.prg + * contrib/hbide/ideshortcuts.prg + * contrib/hbide/idesources.prg + * contrib/hbide/idetools.prg + + Remodelled: ::aINI - hbide.ini variables container. + It is now encapsulated in a object - ::aINI => ::oINI. + This implementation has made this construct extendible to + any extent. Earlier it was a real mess to add one more + option on top of the existing one. + 2010-06-18 16:12 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/filesys.c * include/hbapifs.h diff --git a/harbour/contrib/hbide/hbide.ch b/harbour/contrib/hbide/hbide.ch index 2469f9734d..6ce84b6efd 100644 --- a/harbour/contrib/hbide/hbide.ch +++ b/harbour/contrib/hbide/hbide.ch @@ -68,58 +68,6 @@ #define HBIDE_RUN_MODE_HBP 2 #define HBIDE_RUN_MODE_PRG 3 -#define INI_HBIDE 1 -#define INI_PROJECTS 2 -#define INI_FILES 3 -#define INI_FIND 4 -#define INI_REPLACE 5 -#define INI_RECENTFILES 6 -#define INI_RECENTPROJECTS 7 -#define INI_FOLDERS 8 -#define INI_VIEWS 9 -#define INI_TAGGEDPROJECTS 10 -#define INI_GENERAL 11 -#define INI_TOOLS 12 -#define INI_USERTOOLBARS 13 - -#define INI_SECTIONS_COUNT 13 - - -/* INI_HBIDE */ -#define MainWindowGeometry 1 -#define ProjectTreeVisible 2 -#define ProjectTreeGeometry 3 -#define FunctionListVisible 4 -#define FunctionListGeometry 5 -#define RecentTabIndex 6 -#define CurrentProject 7 -#define GotoDialogGeometry 8 -#define PropsDialogGeometry 9 -#define FindDialogGeometry 10 -#define ThemesDialogGeometry 11 -#define CurrentTheme 12 -#define CurrentCodec 13 -#define PathMk2 14 -#define PathEnv 15 -#define CurrentEnvironment 16 -#define FindInFilesDialogGeometry 17 -#define CurrentFind 18 -#define CurrentFolderFind 19 -#define CurrentReplace 20 -#define CurrentView 21 -#define CurrentHarbour 22 -#define CurrentShortcuts 23 -#define TextFileExtensions 24 -#define CurrentLineHighlightMode 25 -#define LineNumbersDisplayMode 26 -#define HorzRulerDisplayMode 27 -#define ToolsDialogGeometry 28 -#define IdeTheme 29 -#define IdeAnimated 30 - - -#define INI_HBIDE_VRBLS 30 - /* .hbi structure constants */ #define PRJ_PRP_PROPERTIES 1 #define PRJ_PRP_FLAGS 2 diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 0d5f02620a..803e63c227 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -156,7 +156,6 @@ CLASS HbIde DATA mp1, mp2, oXbp, nEvent DATA aTabs INIT {} - DATA aINI INIT {} DATA aViews INIT {} DATA aProjData INIT {} DATA aPrpObjs INIT {} @@ -298,9 +297,10 @@ CLASS HbIde METHOD new( aParams ) METHOD create( aParams ) METHOD destroy() - METHOD setPosAndSizeByIni( qWidget, nPart ) - METHOD setPosByIni( qWidget, nPart ) - METHOD setSizeByIni( qWidget, nPart ) + // + METHOD setPosAndSizeByIniEx( qWidget, cParams ) + METHOD setPosByIniEx( qWidget, cParams ) + // METHOD manageFocusInEditor() METHOD removeProjectTree( aPrj ) METHOD updateProjectTree( aPrj ) @@ -347,7 +347,7 @@ METHOD HbIde:new( aParams ) /*----------------------------------------------------------------------*/ METHOD HbIde:create( aParams ) - LOCAL qPixmap, qSplash, n, cView + LOCAL qPixmap, qSplash, cView qPixmap := QPixmap():new( hb_dirBase() + "resources" + hb_osPathSeparator() + "hbidesplash.png" ) qSplash := QSplashScreen():new() @@ -357,14 +357,6 @@ METHOD HbIde:create( aParams ) ::showApplicationCursor( Qt_BusyCursor ) QApplication():new():processEvents() - /* Initiate the place holders */ - ::aINI := array( INI_SECTIONS_COUNT ) - ::aINI[ 1 ] := afill( array( INI_HBIDE_VRBLS ), "" ) - // - FOR n := 2 TO INI_SECTIONS_COUNT - ::aIni[ n ] := array( 0 ) - NEXT - DEFAULT aParams TO ::aParams ::aParams := aParams ::parseParams() @@ -391,10 +383,12 @@ METHOD HbIde:create( aParams ) IF ::nRunMode == HBIDE_RUN_MODE_INI ::oINI:load( ::cProjIni ) ENDIF + #if 0 /* Load IDE Settings */ /* TODO: delete */ IF ::nRunMode == HBIDE_RUN_MODE_INI hbide_loadINI( Self, ::cProjIni ) ENDIF + #endif /* Load User Dictionaries */ hbide_loadUserDictionaries( Self ) @@ -403,22 +397,11 @@ METHOD HbIde:create( aParams ) ::oSC := IdeShortcuts():new( Self ):create() /* Insert command line projects */ - aeval( ::aHbpOnCmdLine, {|e| aadd( ::aINI[ INI_PROJECTS ], e ) } ) +// aeval( ::aHbpOnCmdLine, {|e| aadd( ::aINI[ INI_PROJECTS ], e ) } ) + aeval( ::aHbpOnCmdLine, {|e| aadd( ::oINI:aProjFiles, e ) } ) /* Insert command line sources */ - aeval( ::aSrcOnCmdLine, {|e| aadd( ::aINI[ INI_FILES ], hbide_parseSourceComponents( e ) ) } ) - - /* Set variables from last session */ - ::cWrkTheme := ::aINI[ INI_HBIDE, CurrentTheme ] - ::cWrkCodec := ::aINI[ INI_HBIDE, CurrentCodec ] - ::cWrkEnvironment := ::aINI[ INI_HBIDE, CurrentEnvironment ] - ::cWrkFind := ::aINI[ INI_HBIDE, CurrentFind ] - ::cWrkFolderFind := ::aINI[ INI_HBIDE, CurrentFolderFind ] - ::cWrkReplace := ::aINI[ INI_HBIDE, CurrentReplace ] - ::cWrkView := ::aINI[ INI_HBIDE, CurrentView ] - ::cWrkHarbour := ::aINI[ INI_HBIDE, CurrentHarbour ] - ::lCurrentLineHighlightEnabled := iif( ::aINI[ INI_HBIDE, CurrentLineHighlightMode ] == "NO", .f., .t. ) - ::lLineNumbersVisible := iif( ::aINI[ INI_HBIDE, LineNumbersDisplayMode ] == "NO", .f., .t. ) - ::lHorzRulerVisible := iif( ::aINI[ INI_HBIDE, HorzRulerDisplayMode ] == "NO", .f., .t. ) +// aeval( ::aSrcOnCmdLine, {|e| aadd( ::aINI[ INI_FILES ], hbide_parseSourceComponents( e ) ) } ) + aeval( ::aSrcOnCmdLine, {|e| aadd( ::oINI:aFiles, hbide_parseSourceComponents( e ) ) } ) /* Store to restore when all preliminary operations are completed */ cView := ::cWrkView @@ -475,13 +458,12 @@ METHOD HbIde:create( aParams ) ::oHM := IdeHome():new():create( Self ) /* Fill various elements of the IDE */ - ::cWrkProject := ::aINI[ INI_HBIDE, CurrentProject ] ::oPM:populate() ::oSM:loadSources() #if 0 ::oDK:setView( ::cWrkView ) - IF !empty( ::aIni[ INI_FILES ] ) - ::oEM:setSourceVisibleByIndex( max( 0, val( ::aIni[ INI_HBIDE, RecentTabIndex ] ) ) + IF !empty( ::oIni:aFiles ) + ::oEM:setSourceVisibleByIndex( max( 0, val( ::oIni:cRecentTabIndex ) ) ENDIF #endif @@ -514,8 +496,8 @@ METHOD HbIde:create( aParams ) /* Request Main Window to Appear on the Screen */ ::oHM:refresh() - ::oDK:animateComponents( val( ::aINI[ INI_HBIDE, IdeAnimated ] ) ) - ::oSetup:setSystemStyle( ::aINI[ INI_HBIDE, IdeTheme ] ) + ::oDK:animateComponents( val( ::oINI:cIdeAnimated ) ) + ::oSetup:setSystemStyle( ::oINI:cIdeTheme ) ::oDlg:Show() IF ::nRunMode == HBIDE_RUN_MODE_PRG @@ -534,7 +516,7 @@ METHOD HbIde:create( aParams ) qSplash:close() /* Load tags last tagged projects */ - ::oFN:loadTags( ::aINI[ INI_TAGGEDPROJECTS ] ) + ::oFN:loadTags( ::oINI:aTaggedProjects ) #if 0 /* Can be controlled through setup */ hbide_loadPlugins( Self, "1.0" ) @@ -545,13 +527,15 @@ METHOD HbIde:create( aParams ) IF ::nEvent == xbeP_Quit HB_TRACE( HB_TR_ALWAYS, "---------------- xbeP_Quit" ) - hbide_saveINI( Self ) ; ::oINI:save() + //hbide_saveINI( Self ) ; ::oINI:save() + ::oINI:save() EXIT ENDIF IF ::nEvent == xbeP_Close HB_TRACE( HB_TR_ALWAYS, "================ xbeP_Close" ) - hbide_saveINI( Self ) ; ::oINI:save() + //hbide_saveINI( Self ) ; ::oINI:save() + ::oINI:save() ::oSM:closeAllSources() EXIT @@ -994,11 +978,11 @@ METHOD HbIde:execProjectAction( cKey ) /*----------------------------------------------------------------------*/ -METHOD HbIde:setPosAndSizeByIni( qWidget, nPart ) +METHOD HbIde:setPosAndSizeByIniEx( qWidget, cParams ) LOCAL aRect - IF !empty( ::aIni[ INI_HBIDE, nPart ] ) - aRect := hb_atokens( ::aIni[ INI_HBIDE, nPart ], "," ) + IF !empty( cParams ) + aRect := hb_atokens( cParams, "," ) aeval( aRect, {|e,i| aRect[ i ] := val( e ) } ) qWidget:move( aRect[ 1 ], aRect[ 2 ] ) @@ -1009,11 +993,11 @@ METHOD HbIde:setPosAndSizeByIni( qWidget, nPart ) /*----------------------------------------------------------------------*/ -METHOD HbIde:setPosByIni( qWidget, nPart ) +METHOD HbIde:setPosByIniEx( qWidget, cParams ) LOCAL aRect - IF !empty( ::aIni[ INI_HBIDE, nPart ] ) - aRect := hb_atokens( ::aIni[ INI_HBIDE, nPart ], "," ) + IF !empty( cParams ) + aRect := hb_atokens( cParams, "," ) aeval( aRect, {|e,i| aRect[ i ] := val( e ) } ) qWidget:move( aRect[ 1 ], aRect[ 2 ] ) @@ -1023,19 +1007,6 @@ METHOD HbIde:setPosByIni( qWidget, nPart ) /*----------------------------------------------------------------------*/ -METHOD HbIde:setSizeByIni( qWidget, nPart ) - LOCAL aRect - - IF !empty( ::aIni[ INI_HBIDE, nPart ] ) - aRect := hb_atokens( ::aIni[ INI_HBIDE, nPart ], "," ) - aeval( aRect, {|e,i| aRect[ i ] := val( e ) } ) - qWidget:resize( aRect[ 3 ], aRect[ 4 ] ) - ENDIF - - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD HbIde:manageFocusInEditor() LOCAL qEdit diff --git a/harbour/contrib/hbide/ideactions.prg b/harbour/contrib/hbide/ideactions.prg index 8096e007fd..6bd87cb78d 100644 --- a/harbour/contrib/hbide/ideactions.prg +++ b/harbour/contrib/hbide/ideactions.prg @@ -407,11 +407,11 @@ METHOD IdeActions:buildMainMenu() hbide_menuAddSep( oSubMenu ) oSubMenu2 := XbpMenu():new( oSubMenu ):create() - oSubMenu2:itemSelected := {| nIndex, cFile | cFile := oIde:aIni[ INI_RECENTFILES, nIndex ], ; + oSubMenu2:itemSelected := {| nIndex, cFile | cFile := oIde:oIni:aRecentFiles[ nIndex ], ; oIde:oEM:editSource( cFile ) } - IF !empty( oIde:aIni[ INI_RECENTFILES ] ) - FOR n := 1 TO Len( oIde:aIni[ INI_RECENTFILES ] ) - f := hbide_pathNormalized( oIde:aIni[ INI_RECENTFILES, n ], .F. ) + IF !empty( oIde:oIni:aRecentFiles ) + FOR n := 1 TO Len( oIde:oIni:aRecentFiles ) + f := hbide_pathNormalized( oIde:oIni:aRecentFiles[ n ], .F. ) oSubMenu2:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + f ), nil } ) IF !hb_FileExists( f ) oSubMenu2:disableItem( n ) @@ -424,11 +424,11 @@ METHOD IdeActions:buildMainMenu() oMenuBar:addItem( { oSubMenu2, _T( "Recent Files" ) } ) oSubMenu2 := XbpMenu():new( oSubMenu ):create() - oSubMenu2:itemSelected := {| nIndex, cFile | cFile := oIde:aIni[ INI_RECENTPROJECTS, nIndex ], ; + oSubMenu2:itemSelected := {| nIndex, cFile | cFile := oIde:oIni:aRecentProjects[ nIndex ], ; ::oPM:loadProperties( cFile, .F., .F., .T. ) } - IF !empty( oIde:aIni[ INI_RECENTPROJECTS ] ) - FOR n := 1 TO Len( oIde:aIni[ INI_RECENTPROJECTS ] ) - f := hbide_pathNormalized( oIde:aIni[ INI_RECENTPROJECTS, n ], .F. ) + IF !empty( oIde:oIni:aRecentProjects ) + FOR n := 1 TO Len( oIde:oIni:aRecentProjects ) + f := hbide_pathNormalized( oIde:oIni:aRecentProjects[ n ], .F. ) oSubMenu2:addItem( { _T( '~' + hb_NumToHex( n ) + '. ' + f ) , nil } ) IF !hb_FileExists( f ) oSubMenu2:disableItem( n ) @@ -768,30 +768,31 @@ STATIC FUNCTION mnuNormalizeItem( cCaption ) * Add a file name to MRU menu item. * 02/01/2010 - 23:23:22 - vailtom */ -FUNCTION hbide_mnuAddFileToMRU( oIde, cFileName, nType ) - LOCAL nPos, cFileNormal - - IF nType != INI_RECENTPROJECTS .AND. nType != INI_RECENTFILES - RETURN nil - ENDIF +FUNCTION hbide_mnuAddFileToMRU( oIde, cFileName, cType ) + LOCAL nPos, cFileNormal, a_ cFileNormal := hbide_pathNormalized( cFileName ) - IF ( nPos := aScan( oIde:aIni[ nType ], {|f| hbide_pathNormalized( f ) == cFileNormal } ) ) > 0 - hb_aDel( oIde:aIni[ nType ], nPos, .T. ) + IF cType == "recent_projects" + a_:= oIde:oINI:aRecentProjects + ELSE + a_:= oIde:oINI:aRecentFiles ENDIF - ASize( oIde:aIni[ nType ], len( oIde:aIni[ nType ] ) + 1 ) - AIns( oIde:aIni[ nType ], 1 ) + IF ( nPos := aScan( a_, {|f| hbide_pathNormalized( f ) == cFileNormal } ) ) > 0 + hb_aDel( a_, nPos, .T. ) + ENDIF - oIde:aIni[ nType,1 ] := cFileName + ASize( a_, len( a_ ) + 1 ) + AIns( a_, 1 ) + a_[ 1 ] := cFileName - IF Len( oIde:aIni[ nType ] ) > 25 - aSize( oIde:aIni[ nType ], 25 ) + IF Len( a_ ) > 25 + aSize( a_, 25 ) ENDIF IF nPos == 0 - hbide_mnuUpdateMRUpopup( oIde, nType ) + hbide_mnuUpdateMRUpopup( oIde, cType ) ENDIF RETURN nil @@ -801,16 +802,22 @@ FUNCTION hbide_mnuAddFileToMRU( oIde, cFileName, nType ) */ #define QMF_POPUP 1 -STATIC FUNCTION hbide_mnuUpdateMRUpopup( oIde, nType ) - LOCAL oMenuBar, oItem, cFindStr, nPos, n, c +STATIC FUNCTION hbide_mnuUpdateMRUpopup( oIde, cType ) + LOCAL oMenuBar, oItem, cFindStr, nPos, n, c, a_ IF Empty( oIde:oDlg ) RETURN NIL ENDIF + IF cType == "recent_projects" + a_:= oIde:oINI:aRecentProjects + ELSE + a_:= oIde:oINI:aRecentFiles + ENDIF + oMenuBar := oIde:oDlg:MenuBar() nPos := 0 - cFindStr := iif( nType == INI_RECENTFILES, 'RECENT FILES', 'RECENT PROJECTS' ) + cFindStr := iif( cType == "recent_files", 'RECENT FILES', 'RECENT PROJECTS' ) FOR n := 1 TO oMenuBar:numItems() IF oMenuBar:aMenuItems[ n, 1 ] != QMF_POPUP @@ -834,9 +841,9 @@ STATIC FUNCTION hbide_mnuUpdateMRUpopup( oIde, nType ) oItem[ 4 ]:delAllItems() - IF !empty( oIde:aIni[ nType ] ) - FOR n := 1 TO Len( oIde:aIni[ nType ] ) - c := hbide_pathNormalized( oIde:aIni[ nType, n ], .F. ) + IF !empty( a_ ) + FOR n := 1 TO Len( a_ ) + c := hbide_pathNormalized( a_[ n ], .F. ) oItem[ 4 ]:addItem( { _T( '~' + hb_NumToHex( n ) + '. ' + c ), nil } ) @@ -845,7 +852,7 @@ STATIC FUNCTION hbide_mnuUpdateMRUpopup( oIde, nType ) ENDIF NEXT ELSE - IF nType == INI_RECENTFILES + IF cType == "recent_files" oItem[ 4 ]:addAction( "** No recent files found **" ) ELSE oItem[ 4 ]:addAction( "** No recent projects found **" ) diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index 043e12e4d5..63fab1382b 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -251,9 +251,7 @@ METHOD IdeDocks:buildDialog() aSize := AppDesktop():currentSize() ::oDlg:setPos( { ( aSize[ 1 ] - ::oDlg:currentSize()[ 1 ] ) / 2, ; ( aSize[ 2 ] - ::oDlg:currentSize()[ 2 ] ) / 2 } ) - - ::oIde:setPosAndSizeByIni( ::oDlg:oWidget, MainWindowGeometry ) - //::oDlg:Show() + ::oIde:setPosAndSizeByIniEx( ::oDlg:oWidget, ::oINI:cMainWindowGeometry ) /* StatusBar */ ::buildStatusBar() @@ -276,7 +274,7 @@ METHOD IdeDocks:buildDialog() /* View Panels */ ::buildViewWidget( "Stats" ) /* At stayrtup displaying various statistics */ ::buildViewWidget( "Main" ) /* Main Panel to hold editor tabs */ - FOR EACH s IN ::aINI[ INI_VIEWS ] + FOR EACH s IN ::oINI:aViews ::buildViewWidget( s ) /* All other panels user created */ NEXT @@ -516,10 +514,10 @@ METHOD IdeDocks:setView( cView ) CASE "New..." cView := hbide_fetchAString( ::qViewsCombo, cView, "Name the View", "New View" ) IF cView != "New..." .AND. cView != "Stats" .AND. cView != "Main" - IF ascan( ::aINI[ INI_VIEWS ], {|e| e == cView } ) > 0 + IF ascan( ::oINI:aViews, {|e| e == cView } ) > 0 MsgBox( "View: " + cView + ", already exists" ) ELSE - aadd( ::aINI[ INI_VIEWS ], cView ) + aadd( ::oIde:oINI:aViews, cView ) ::oTM:addPanelsMenu( cView ) ::buildViewWidget( cView ) ::addPanelButton( cView ) @@ -640,7 +638,7 @@ METHOD IdeDocks:buildToolBarPanels() ::oDlg:oWidget:addToolBar( Qt_LeftToolBarArea, ::qTBarPanels ) ::addPanelButton( "Main" ) - FOR EACH s IN ::aINI[ INI_VIEWS ] + FOR EACH s IN ::oINI:aViews ::addPanelButton( s ) NEXT @@ -1264,7 +1262,7 @@ METHOD IdeDocks:animateComponents( nMode ) nMode := ::nAnimantionMode ENDIF ::oIde:nAnimantionMode := nMode - ::oIde:aINI[ INI_HBIDE, IdeAnimated ] := hb_ntos( ::nAnimantionMode ) + ::oIde:oINI:cIdeAnimated := hb_ntos( ::nAnimantionMode ) ::oDlg:menubar():setStyleSheet( GetStyleSheet( "QMenuBar", nMode ) ) diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index 41e17b2dc6..d1fb7fe3fb 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -947,9 +947,9 @@ METHOD IdeEditsManager:goto( nLine ) qGo:setLabelText( "Goto Line Number [1-" + hb_ntos( nRows ) + "]" ) qGo:setWindowTitle( "Harbour" ) - ::setPosByIni( qGo, GotoDialogGeometry ) + ::oIde:setPosByIniEx( qGo, ::oINI:cGotoDialogGeometry ) qGo:exec() - ::aIni[ INI_HBIDE, GotoDialogGeometry ] := hbide_posAndSize( qGo ) + ::oIde:oINI:cGotoDialogGeometry := hbide_posAndSize( qGo ) nLine := qGo:intValue() ENDIF diff --git a/harbour/contrib/hbide/ideenviron.prg b/harbour/contrib/hbide/ideenviron.prg index ade8d17a5f..4d6fde6f90 100644 --- a/harbour/contrib/hbide/ideenviron.prg +++ b/harbour/contrib/hbide/ideenviron.prg @@ -119,7 +119,7 @@ METHOD IdeEnvironments:create( oIDE, cEnvFile ) ::cEnvFile := cEnvFile IF empty( ::cEnvFile ) - cFile := ::oIde:aINI[ INI_HBIDE, PathEnv ] + cFile := ::oINI:cPathEnv cFile := iif( empty( cFile ), cFile, hbide_pathAppendLastSlash( cFile ) ) IF empty( cFile ) cFile := oIde:cProjIni @@ -130,7 +130,7 @@ METHOD IdeEnvironments:create( oIDE, cEnvFile ) hb_fNameSplit( ::cEnvFile, @cPath ) ::oIDE:cWrkPathEnv := hbide_pathNormalized( cPath, .f. ) - ::oIde:aINI[ INI_HBIDE, PathEnv ] := ::oIDE:cWrkPathEnv + ::oIde:oINI:cPathEnv := ::oIDE:cWrkPathEnv IF !empty( ::cEnvFile ) .AND. hb_fileExists( ::cEnvFile ) ::parse( ::cEnvFile ) @@ -257,9 +257,9 @@ METHOD IdeEnvironments:show() #endif ENDIF - ::oUI:q_editPathMk2 :setText( ::aINI[ INI_HBIDE, PathMk2 ] ) - ::oUI:q_editPathEnv :setText( ::aINI[ INI_HBIDE, PathEnv ] ) - ::oUI:q_editCompilers:setPlainText( hb_memoread( hbide_pathFile( ::aINI[ INI_HBIDE, PathEnv ], "hbide.env" ) ) ) + ::oUI:q_editPathMk2 :setText( ::oINI:cPathMk2 ) + ::oUI:q_editPathEnv :setText( ::oINI:cPathEnv ) + ::oUI:q_editCompilers:setPlainText( hb_memoread( hbide_pathFile( ::oINI:cPathEnv, "hbide.env" ) ) ) RETURN Self @@ -305,8 +305,8 @@ METHOD IdeEnvironments:saveEnv() cPathMk2 := oUIEnv:q_editPathMk2:text() cPathEnv := oUIEnv:q_editPathEnv:text() - ::oIDE:aINI[ INI_HBIDE, PathMk2 ] := cPathMk2 - ::oIDE:aINI[ INI_HBIDE, PathEnv ] := cPathEnv + ::oIDE:oINI:cPathMk2 := cPathMk2 + ::oIDE:oINI:cPathEnv := cPathEnv // ::oIDE:cWrkPathMk2 := cPathMk2 ::oIDE:cWrkPathEnv := cPathEnv diff --git a/harbour/contrib/hbide/idefindreplace.prg b/harbour/contrib/hbide/idefindreplace.prg index d5aeeeee49..df1d4167f2 100644 --- a/harbour/contrib/hbide/idefindreplace.prg +++ b/harbour/contrib/hbide/idefindreplace.prg @@ -460,8 +460,8 @@ METHOD IdeFindReplace:create( oIde ) ::oUI := HbQtUI():new( hbide_uic( "finddialog" ), ::oIde:oDlg:oWidget ):build() ::oUI:setWindowFlags( Qt_Sheet ) - aeval( ::oIde:aIni[ INI_FIND ], {|e| ::oUI:q_comboFindWhat:addItem( e ) } ) - aeval( ::oIde:aIni[ INI_REPLACE ], {|e| ::oUI:q_comboReplaceWith:addItem( e ) } ) + aeval( ::oINI:aFind , {|e| ::oUI:q_comboFindWhat:addItem( e ) } ) + aeval( ::oINI:aReplace, {|e| ::oUI:q_comboReplaceWith:addItem( e ) } ) ::oUI:q_radioFromCursor:setChecked( .t. ) ::oUI:q_radioDown:setChecked( .t. ) @@ -469,8 +469,7 @@ METHOD IdeFindReplace:create( oIde ) ::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() } ) + {|| ::oIde:oINI:cFindDialogGeometry := hbide_posAndSize( ::oUI:oWidget ), ::oUI:hide() } ) ::oUI:signal( "comboFindWhat", "editTextChanged(QString)", {|| ::oUI:q_radioEntire:setChecked( .t. ) } ) @@ -495,7 +494,7 @@ METHOD IdeFindReplace:show() ::oUI:q_checkGlobal:setEnabled( .f. ) ::oUI:q_checkNoPrompting:setEnabled( .f. ) ::oUI:q_checkListOnly:setChecked( .f. ) - ::oIde:setPosByIni( ::oUI:oWidget, FindDialogGeometry ) + ::oIde:setPosByIniEx( ::oUI:oWidget, ::oINI:cFindDialogGeometry ) ::oUI:q_comboFindWhat:setFocus() IF !empty( cText := ::oEM:getSelectedText() ) @@ -636,8 +635,8 @@ METHOD IdeFindReplace:updateFindReplaceData( cMode ) IF cMode == "find" 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. ) + IF ascan( ::oINI:aFind, {|e| e == cData } ) == 0 + hb_ains( ::oINI:aFind, 1, cData, .t. ) ::oUI:q_comboFindWhat:insertItem( 0, cData ) ENDIF ENDIF @@ -646,8 +645,8 @@ METHOD IdeFindReplace:updateFindReplaceData( cMode ) ELSE 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. ) + IF ascan( ::oINI:aReplace, cData ) == 0 + hb_ains( ::oINI:aReplace, 1, cData, .t. ) ::oUI:q_comboReplaceWith:insertItem( 0, cData ) ENDIF ENDIF @@ -777,17 +776,17 @@ METHOD IdeFindInFiles:buildUI() ::oUI:q_buttonFolder:setIcon( ::resPath + "folder.png" ) - aeval( ::oIde:aIni[ INI_FIND ], {|e| ::oUI:q_comboExpr:addItem( e ) } ) - aeval( ::oIde:aIni[ INI_REPLACE ], {|e| ::oUI:q_comboRepl:addItem( e ) } ) - aeval( ::oIde:aIni[ INI_FOLDERS ], {|e| ::oUI:q_comboFolder:addItem( e ) } ) + aeval( ::oINI:aFind , {|e| ::oUI:q_comboExpr:addItem( e ) } ) + aeval( ::oINI:aReplace, {|e| ::oUI:q_comboRepl:addItem( e ) } ) + aeval( ::oINI:aFolders, {|e| ::oUI:q_comboFolder:addItem( e ) } ) - n := ascan( ::oIde:aIni[ INI_FIND ], {|e| e == ::cWrkFind } ) + n := ascan( ::oINI:aFind, {|e| e == ::cWrkFind } ) ::oUI:q_comboExpr:setCurrentIndex( n-1 ) - n := ascan( ::oIde:aIni[ INI_REPLACE ], {|e| e == ::cWrkReplace } ) + n := ascan( ::oINI:aReplace, {|e| e == ::cWrkReplace } ) ::oUI:q_comboRepl:setCurrentIndex( n - 1 ) - n := ascan( ::oIde:aIni[ INI_FOLDERS ], {|e| e == ::cWrkFolderFind } ) + n := ascan( ::oIni:aFolders, {|e| e == ::cWrkFolderFind } ) ::oUI:q_comboFolder:setCurrentIndex( n - 1 ) ::oUI:q_comboFolder:setEnabled( .f. ) ::oUI:q_checkFolders:setChecked( .f. ) @@ -895,8 +894,8 @@ METHOD IdeFindInFiles:execEvent( cEvent, p ) qLineEdit := QLineEdit():configure( ::oUI:q_comboFolder:lineEdit() ) qLineEdit:setText( cPath ) - IF ascan( ::oIde:aIni[ INI_FOLDERS ], {|e| e == cPath } ) == 0 - hb_ains( ::oIde:aIni[ INI_FOLDERS ], 1, cPath, .t. ) + IF ascan( ::oINI:aFolders, {|e| e == cPath } ) == 0 + hb_ains( ::oINI:aFolders, 1, cPath, .t. ) ENDIF ::oUI:q_comboFolder:insertItem( 0, cPath ) ENDIF @@ -1185,8 +1184,8 @@ METHOD IdeFindInFiles:find() ::oUI:q_buttonFind:setEnabled( .t. ) IF ::nFounds > 0 - IF ascan( ::oIde:aIni[ INI_FIND ], {|e| e == ::cOrigExpr } ) == 0 - hb_ains( ::oIde:aIni[ INI_FIND ], 1, ::cOrigExpr, .t. ) + IF ascan( ::oINI:aFind, {|e| e == ::cOrigExpr } ) == 0 + hb_ains( ::oINI:aFind, 1, ::cOrigExpr, .t. ) ::oUI:q_comboFolder:insertItem( 0, ::cOrigExpr ) ENDIF ::oIde:cWrkFind := ::cOrigExpr diff --git a/harbour/contrib/hbide/idefunctions.prg b/harbour/contrib/hbide/idefunctions.prg index b61f152202..a89997875f 100644 --- a/harbour/contrib/hbide/idefunctions.prg +++ b/harbour/contrib/hbide/idefunctions.prg @@ -488,7 +488,7 @@ METHOD IdeFunctions:buildTags() FOR EACH cProjectTitle IN a_ ::tagProject( cProjectTitle ) NEXT - ::oIde:aINI[ INI_TAGGEDPROJECTS ] := a_ + ::oIde:oINI:aTaggedProjects := a_ ::clearProjects() ENDIF diff --git a/harbour/contrib/hbide/ideobject.prg b/harbour/contrib/hbide/ideobject.prg index 95185d0bb8..6b397435c6 100644 --- a/harbour/contrib/hbide/ideobject.prg +++ b/harbour/contrib/hbide/ideobject.prg @@ -149,7 +149,6 @@ CLASS IdeObject ACCESS nAnimantionMode INLINE ::oIde:nAnimantionMode ACCESS aProjects INLINE ::oIde:aProjects - ACCESS aINI INLINE ::oIde:aINI ACCESS aSources INLINE ::oIde:aSources ACCESS aEditorPath INLINE ::oIde:aEditorPath ACCESS aProjData INLINE ::oIde:aProjData diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index a1dc68edb4..91790fdcc7 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -182,11 +182,11 @@ METHOD IdeProject:new( oIDE, aProps ) ::dotHbp := "" ::compilers := "" - IF !empty( oIDE:aINI[ INI_HBIDE, PathMk2 ] ) - ::cPathMk2 := oIDE:aINI[ INI_HBIDE, PathMk2 ] + IF !empty( oIDE:oINI:cPathMk2 ) + ::cPathMk2 := oIDE:oINI:cPathMk2 ENDIF - IF !empty( oIDE:aINI[ INI_HBIDE, PathEnv ] ) - ::cPathEnv := oIDE:aINI[ INI_HBIDE, PathEnv ] + IF !empty( oIDE:oINI:cPathEnv ) + ::cPathEnv := oIDE:oINI:cPathEnv ENDIF FOR EACH cSource IN ::sources @@ -305,7 +305,7 @@ METHOD IdeProjManager:destroy() METHOD IdeProjManager:populate() LOCAL cProject - FOR EACH cProject IN ::aINI[ INI_PROJECTS ] + FOR EACH cProject IN ::oINI:aProjFiles ::loadProperties( cProject, .f., .f., .T. ) NEXT @@ -389,7 +389,7 @@ METHOD IdeProjManager:loadProperties( cProjFileName, lNew, lFetch, lUpdateTree ) IF lUpdateTree ::oIDE:updateProjectTree( ::aPrjProps ) ENDIF - hbide_mnuAddFileToMRU( ::oIDE, cProjFileName, INI_RECENTPROJECTS ) + hbide_mnuAddFileToMRU( ::oIDE, cProjFileName, "recent_projects" ) ELSE ::aProjects[ nAlready, 3 ] := aclone( ::aPrjProps ) IF lUpdateTree @@ -579,7 +579,7 @@ METHOD IdeProjManager:save( lCanClose ) IF ::lUpdateTree ::oIDE:updateProjectTree( ::aPrjProps ) ENDIF - hbide_mnuAddFileToMRU( ::oIDE, ::cSaveTo, INI_RECENTPROJECTS ) + hbide_mnuAddFileToMRU( ::oIDE, ::cSaveTo, "recent_projects" ) ELSE ::aProjects[ nAlready, 3 ] := aclone( ::aPrjProps ) IF ::lUpdateTree @@ -1137,7 +1137,7 @@ METHOD IdeProjManager:removeProject( cProjectTitle ) nPos := ascan( ::aProjects, {|e_| e_[ 2 ] == cProjFileName } ) IF nPos > 0 hb_adel( ::aProjects, nPos, .T. ) - hbide_saveINI( ::oIDE ) + ::oINI:save() ENDIF ENDIF diff --git a/harbour/contrib/hbide/idesaveload.prg b/harbour/contrib/hbide/idesaveload.prg index 550e9d9886..db81b76468 100644 --- a/harbour/contrib/hbide/idesaveload.prg +++ b/harbour/contrib/hbide/idesaveload.prg @@ -71,267 +71,110 @@ /*----------------------------------------------------------------------*/ -STATIC FUNCTION hbide_saveSettings( oIde ) - LOCAL cPath +#define INI_HBIDE 1 +#define INI_PROJECTS 2 +#define INI_FILES 3 +#define INI_FIND 4 +#define INI_REPLACE 5 +#define INI_RECENTFILES 6 +#define INI_RECENTPROJECTS 7 +#define INI_FOLDERS 8 +#define INI_VIEWS 9 +#define INI_TAGGEDPROJECTS 10 +#define INI_GENERAL 11 +#define INI_TOOLS 12 +#define INI_USERTOOLBARS 13 - hb_fNameSplit( oIde:cProjIni, @cPath ) - hbqt_QMainWindow_saveSettings( cPath + "settings.ide", "hbidesettings", oIde:oDlg:oWidget:pPtr ) +#define INI_SECTIONS_COUNT 13 +#define INI_HBIDE_VRBLS 30 - RETURN nil +/*----------------------------------------------------------------------*/ +// +// Class IdeINI +// +/*----------------------------------------------------------------------*/ + +CLASS IdeINI INHERIT IdeObject + + DATA aINI INIT {} + + DATA cMainWindowGeometry INIT "" + DATA cGotoDialogGeometry INIT "" + DATA cFindDialogGeometry INIT "" + DATA cToolsDialogGeometry INIT "" + DATA cSetupDialogGeometry INIT "" + DATA cShortcutsDialogGeometry INIT "" + // + DATA cCurrentLineHighlightMode INIT "" + DATA cLineNumbersDisplayMode INIT "" + DATA cHorzRulerDisplayMode INIT "" + // + DATA cRecentTabIndex INIT "" + // + DATA cIdeTheme INIT "" + DATA cIdeAnimated INIT "" + // + DATA cPathMk2 INIT "" + DATA cPathEnv INIT "" + DATA cCurrentProject INIT "" + DATA cCurrentTheme INIT "" + DATA cCurrentCodec INIT "" + DATA cCurrentEnvironment INIT "" + DATA cCurrentFind INIT "" + DATA cCurrentFolderFind INIT "" + DATA cCurrentReplace INIT "" + DATA cCurrentView INIT "" + DATA cCurrentHarbour INIT "" + DATA cCurrentShortcuts INIT "" + // + DATA cTextFileExtensions INIT "" + + DATA aProjFiles INIT {} + DATA aFiles INIT {} + DATA aFind INIT {} + DATA aReplace INIT {} + DATA aRecentProjects INIT {} + DATA aRecentFiles INIT {} + DATA aFolders INIT {} + DATA aViews INIT {} + DATA aTaggedProjects INIT {} + DATA aTools INIT {} + DATA aUserToolbars INIT {} + + METHOD new( oIde ) + METHOD create( oIde ) + METHOD load( cHbideIni ) + METHOD save( cHbideIni ) + + ENDCLASS /*----------------------------------------------------------------------*/ -FUNCTION hbide_restSettings( oIde ) - LOCAL cPath - - hb_fNameSplit( oIde:cProjIni, @cPath ) - hbqt_QMainWindow_restSettings( cPath + "settings.ide", "hbidesettings", oIde:oDlg:oWidget:pPtr ) - - RETURN nil +METHOD IdeINI:new( oIde ) + ::oIde := oIde + RETURN Self /*----------------------------------------------------------------------*/ -FUNCTION hbide_getEditInfoAsString( oEdit ) - LOCAL qHScr := QScrollBar():configure( oEdit:qEdit:horizontalScrollBar() ) - LOCAL qVScr := QScrollBar():configure( oEdit:qEdit:verticalScrollBar() ) - LOCAL qCursor := QTextCursor():configure( oEdit:qEdit:textCursor() ) - LOCAL cBMarks := hbide_nArray2string( oEdit:oEdit:aBookMarks ) - - RETURN hbide_pathNormalized( oEdit:sourceFile, .f. ) + "," + ; - hb_ntos( qCursor:position() ) + "," + ; - hb_ntos( qHScr:value() ) + "," + ; - hb_ntos( qVScr:value() ) + "," + ; - oEdit:cTheme + "," + ; - oEdit:cView + "," + ; - cBMarks + "," +METHOD IdeINI:create( oIde ) + DEFAULT oIde TO ::oIde + ::oIde := oIde + RETURN Self /*----------------------------------------------------------------------*/ -FUNCTION hbide_saveINI( oIde ) - LOCAL j, nTab, pTab, n, txt_, oEdit, nTabs, nn, s +METHOD IdeINI:load( cHbideIni ) + LOCAL aElem, s, nPart, cKey, cVal, a_ -HB_TRACE( HB_TR_ALWAYS, "hbide_saveINI( oIde )", 0, oIde:nRunMode, oIde:cProjIni ) - IF oIde:nRunMode != HBIDE_RUN_MODE_INI - RETURN Nil - ENDIF + ::oIde:cProjIni := hbide_getIniPath( cHbideIni ) - txt_:= {} - // Properties - aadd( txt_, "[HBIDE]" ) - aadd( txt_, " " ) - aadd( txt_, "MainWindowGeometry=" + hbide_posAndSize( oIde:oDlg:oWidget ) ) - aadd( txt_, "ProjectTreeVisible=" + iif( oIde:lProjTreeVisible, "YES", "NO" ) ) - aadd( txt_, "FunctionListVisible=" + iif( oIde:lDockRVisible, "YES", "NO" ) ) - aadd( txt_, "RecentTabIndex=" + hb_ntos( oIde:qTabWidget:currentIndex() ) ) - aadd( txt_, "CurrentProject=" + oIde:cWrkProject ) - aadd( txt_, "GotoDialogGeometry=" + oIde:aIni[ INI_HBIDE, GotoDialogGeometry ] ) - aadd( txt_, "FindDialogGeometry=" + oIde:aIni[ INI_HBIDE, FindDialogGeometry ] ) - aadd( txt_, "CurrentTheme=" + oIde:cWrkTheme ) - aadd( txt_, "CurrentCodec=" + oIde:cWrkCodec ) - aadd( txt_, "PathMk2=" + oIde:aIni[ INI_HBIDE, PathMk2 ] ) - aadd( txt_, "PathEnv=" + oIde:aIni[ INI_HBIDE, PathEnv ] ) - aadd( txt_, "CurrentEnvironment=" + oIde:cWrkEnvironment ) - aadd( txt_, "CurrentFind=" + oIde:cWrkFind ) - aadd( txt_, "CurrentFolderFind=" + oIde:cWrkFolderFind ) - aadd( txt_, "CurrentReplace=" + oIde:cWrkReplace ) - aadd( txt_, "CurrentView=" + oIde:cWrkView ) - aadd( txt_, "CurrentHarbour=" + oIde:cWrkHarbour ) - aadd( txt_, "CurrentShortcuts=" + oIde:cPathShortcuts ) - aadd( txt_, "TextFileExtensions=" + oIde:cTextExtensions ) - aadd( txt_, "FindInFilesDialogGeometry=" + oIde:aIni[ INI_HBIDE, FindInFilesDialogGeometry ] ) - aadd( txt_, "FindInFilesDialogGeometry=" + oIde:aIni[ INI_HBIDE, FindInFilesDialogGeometry ] ) - aadd( txt_, "CurrentLineHighlightMode=" + iif( oIde:lCurrentLineHighlightEnabled, "YES", "NO" ) ) - aadd( txt_, "LineNumbersDisplayMode=" + iif( oIde:lLineNumbersVisible, "YES", "NO" ) ) - aadd( txt_, "HorzRulerDisplayMode=" + iif( oIde:lHorzRulerVisible, "YES", "NO" ) ) - aadd( txt_, "ToolsDialogGeometry=" + oIde:aIni[ INI_HBIDE, ToolsDialogGeometry ] ) - aadd( txt_, "IdeTheme=" + oIde:aIni[ INI_HBIDE, IdeTheme ] ) - aadd( txt_, "IdeAnimated=" + oIde:aIni[ INI_HBIDE, IdeAnimated ] ) - aadd( txt_, " " ) - - aadd( txt_, "[PROJECTS]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( oIde:aProjects ) - aadd( txt_, "project_" + hb_ntos( n ) + "=" + hbide_pathNormalized( oIde:aProjects[ n, 2 ] ) ) - NEXT - aadd( txt_, " " ) - - /*------------------- FILES -------------------*/ - aadd( txt_, "[FILES]" ) - aadd( txt_, " " ) - nn := 0 - FOR j := 2 TO len( oIde:aViews ) - oIde:lClosing := .t. - oIde:oDK:setView( oIde:aViews[ j ]:oWidget:objectName() ) - - nTabs := oIde:qTabWidget:count() - FOR n := 1 TO nTabs - pTab := oIde:qTabWidget:widget( n - 1 ) - nTab := ascan( oIde:aTabs, {|e_| hbqt_IsEqualGcQtPointer( e_[ 1 ]:oWidget:pPtr, pTab ) } ) - oEdit := oIde:aTabs[ nTab, TAB_OEDITOR ] - - IF !Empty( oEdit:sourceFile ) .AND. !( ".ppo" == lower( oEdit:cExt ) ) - IF oEdit:lLoaded - aadd( txt_, "file_" + hb_ntos( ++nn ) + "=" + hbide_getEditInfoAsString( oEdit ) ) - - ELSE - aadd( txt_, "file_" + hb_ntos( ++nn ) + "=" + hbide_pathNormalized( oEdit:sourceFile, .f. ) + "," + ; - hb_ntos( oEdit:nPos ) + "," + ; - hb_ntos( oEdit:nHPos ) + "," + ; - hb_ntos( oEdit:nVPos ) + "," + ; - oEdit:cTheme + "," + ; - oEdit:cView + "," + ; - hbide_nArray2string( oEdit:oEdit:aBookMarks ) + "," ) - ENDIF - ENDIF - NEXT - NEXT - - aadd( txt_, " " ) - - aadd( txt_, "[FIND]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( oIde:aIni[ INI_FIND ] ) - aadd( txt_, "find_" + hb_ntos( n ) + "=" + oIde:aIni[ INI_FIND, n ] ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[REPLACE]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( oIde:aIni[ INI_REPLACE ] ) - aadd( txt_, "replace_" + hb_ntos( n ) + "=" + oIde:aIni[ INI_REPLACE, n ] ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[RECENTFILES]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( oIde:aIni[ INI_RECENTFILES ] ) - aadd( txt_, "recentfile_" + hb_ntos( n ) + "=" + hbide_pathNormalized( oIde:aIni[ INI_RECENTFILES, n ], .f. ) ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[RECENTPROJECTS]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( oIde:aIni[ INI_RECENTPROJECTS ] ) - aadd( txt_, "recentproject_" + hb_ntos( n ) + "=" + hbide_pathNormalized( oIde:aIni[ INI_RECENTPROJECTS, n ], .f. ) ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[FOLDERS]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( oIde:aIni[ INI_FOLDERS ] ) - aadd( txt_, "folder_" + hb_ntos( n ) + "=" + hbide_pathNormalized( oIde:aIni[ INI_FOLDERS, n ], .f. ) ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[VIEWS]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( oIde:aIni[ INI_VIEWS ] ) - aadd( txt_, "view_" + hb_ntos( n ) + "=" + oIde:aIni[ INI_VIEWS, n ] ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[TAGGEDPROJECTS]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( oIde:aIni[ INI_TAGGEDPROJECTS ] ) - aadd( txt_, "taggedproject_" + hb_ntos( n ) + "=" + oIde:aIni[ INI_TAGGEDPROJECTS, n ] ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[TOOLS]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( oIde:aIni[ INI_TOOLS ] ) - s := oIde:aIni[ INI_TOOLS, n, 1 ] + "," + oIde:aIni[ INI_TOOLS, n, 2 ] + "," + oIde:aIni[ INI_TOOLS, n, 3 ] + "," + ; - oIde:aIni[ INI_TOOLS, n, 4 ] + "," + oIde:aIni[ INI_TOOLS, n, 5 ] + "," + oIde:aIni[ INI_TOOLS, n, 6 ] + "," + ; - oIde:aIni[ INI_TOOLS, n, 7 ] + "," + oIde:aIni[ INI_TOOLS, n, 8 ] + "," + oIde:aIni[ INI_TOOLS, n, 9 ] + "," + ; - oIde:aIni[ INI_TOOLS, n, 10 ] - aadd( txt_, "tool_" + hb_ntos( n ) + "=" + s ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[USERTOOLBARS]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( oIde:aIni[ INI_USERTOOLBARS ] ) - s := hbide_array2string( oIde:aIni[ INI_USERTOOLBARS, n ], "," ) - aadd( txt_, "usertoolbars_" + hb_ntos( n ) + "=" + s ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[General]" ) - aadd( txt_, " " ) - - hbide_createTarget( oIde:cProjIni, txt_ ) - - RETURN hbide_saveSettings( oIde ) - -/*----------------------------------------------------------------------*/ - -FUNCTION hbide_getIniPath( cHbideIni ) - LOCAL cPath, cIni - - IF empty( cHbideIni ) - IF ! hb_FileExists( cIni := hb_dirBase() + "hbide.ini" ) - #if defined( __PLATFORM__WINDOWS ) - cPath := hbide_DirAddPathSep( GetEnv( "APPDATA" ) ) + "hbide\" - #elif defined( __PLATFORM__UNIX ) - cPath := hbide_DirAddPathSep( GetEnv( "HOME" ) ) + ".hbide/" - #elif defined( __PLATFORM__OS2 ) - cPath := hbide_DirAddPathSep( GetEnv( "HOME" ) ) + ".hbide/" - #endif - IF ! hb_dirExists( cPath ) - MakeDir( cPath ) - ENDIF - cIni := cPath + "hbide.ini" - ENDIF - ELSE - cIni := cHbideIni - ENDIF - - RETURN cIni - -/*----------------------------------------------------------------------*/ - -FUNCTION hbide_loadINI( oIde, cHbideIni ) - LOCAL aElem, s, n, nPart, cKey, cVal, a_ - LOCAL aIdeEle := { "mainwindowgeometry" , "projecttreevisible" , "projecttreegeometry", ; - "functionlistvisible", "functionlistgeometry", "recenttabindex" , ; - "currentproject" , "gotodialoggeometry" , "propsdialoggeometry", ; - "finddialoggeometry" , "themesdialoggeometry", "currenttheme" , ; - "currentcodec" , "pathmk2" , "pathenv" , ; - "currentenvironment" , "findinfilesdialoggeometry", "currentfind" , ; - "currentreplace" , "currentfolderfind" , "currentview" , ; - "currentharbour" , "currentshortcuts" , "textfileextensions" , ; - "currentlinehighlightmode", "linenumbersdisplaymode", "horzrulerdisplaymode", ; - "toolsdialoggeometry", "idetheme" , "ideanimated" ; - } - - #if 0 - IF empty( cHbideIni ) - IF hb_fileExists( "hbide.ini" ) - /* Please Check for *nixes */ - //cHbideIni := hb_curDrive() + hb_osDriveSeparator() + hb_osPathSeparator() + CurDir() + hb_osPathSeparator() + "hbide.ini" - cHbideIni := "hbide.ini" - ELSE - cHbideIni := hb_dirBase() + "hbide.ini" - ENDIF - ENDIF - oIde:cProjIni := cHbideIni - #endif - oIde:cProjIni := hbide_getIniPath( cHbideIni ) - - IF hb_FileExists( oIde:cProjIni ) - aElem := hbide_readSource( oIde:cProjIni ) + IF hb_FileExists( ::oIde:cProjIni ) + aElem := hbide_readSource( ::oIde:cProjIni ) FOR EACH s IN aElem s := alltrim( s ) IF !empty( s ) - /* - * OPT: Optimizations using SWITCH and converting section name to - * Uppercase - if the user change the name of the section in the file - * .INI manually, this ensures that the HBIDE continue finding the - * section. - * 01/01/2010 - 16:38:22 - vailtom - */ SWITCH Upper( s ) CASE "[GENERAL]" @@ -374,14 +217,6 @@ FUNCTION hbide_loadINI( oIde, cHbideIni ) nPart := INI_USERTOOLBARS EXIT OTHERWISE - /* - * If none of the previous sections are valid, do not let it - * process. This prevents the HBIDE read a section that is - * commented out or is invalid in the file .ini - For example, - * open the file .ini file and change the name of the [PROJECTS] - * for '[* PROJECTS]' and see how it behaves incorrectly. - * 01/01/2010 - 18:09:40 - vailtom - */ DO CASE CASE Left( s, 1 ) $ '#[' * Nothing todo! @@ -391,72 +226,111 @@ FUNCTION hbide_loadINI( oIde, cHbideIni ) CASE nPart == INI_HBIDE IF hbide_parseKeyValPair( s, @cKey, @cVal ) - cKey := lower( cKey ) - IF ( n := ascan( aIdeEle, cKey ) ) > 0 - oIde:aIni[ nPart, n ] := cVal /* Further process */ - ENDIF + + SWITCH cKey + + CASE "MainWindowGeometry" ; ::cMainWindowGeometry := cVal ; EXIT + CASE "GotoDialogGeometry" ; ::cGotoDialogGeometry := cVal ; EXIT + CASE "FindDialogGeometry" ; ::cFindDialogGeometry := cVal ; EXIT + CASE "ToolsDialogGeometry" ; ::cToolsDialogGeometry := cVal ; EXIT + CASE "SetupDialogGeometry" ; ::cSetupDialogGeometry := cVal ; EXIT + CASE "ShortcutsDialogGeometry" ; ::cShortcutsDialogGeometry := cVal ; EXIT + // + CASE "CurrentLineHighlightMode" ; ::cCurrentLineHighlightMode := cVal ; EXIT + CASE "LineNumbersDisplayMode" ; ::cLineNumbersDisplayMode := cVal ; EXIT + CASE "HorzRulerDisplayMode" ; ::cHorzRulerDisplayMode := cVal ; EXIT + // + CASE "RecentTabIndex" ; ::cRecentTabIndex := cVal ; EXIT + // + CASE "IdeTheme" ; ::cIdeTheme := cVal ; EXIT + CASE "IdeAnimated" ; ::cIdeAnimated := cVal ; EXIT + // /* Subject to be identified under this object only */ + CASE "PathMk2" ; ::cPathMk2 := cVal ; EXIT + CASE "PathEnv" ; ::cPathEnv := cVal ; EXIT + // + CASE "CurrentProject" ; ::oIde:cWrkProject := cVal ; EXIT + CASE "CurrentTheme" ; ::oIde:cWrkTheme := cVal ; EXIT + CASE "CurrentCodec" ; ::oIde:cWrkCodec := cVal ; EXIT + CASE "CurrentEnvironment" ; ::oIde:cWrkEnvironment := cVal ; EXIT + CASE "CurrentFind" ; ::oIde:cWrkFind := cVal ; EXIT + CASE "CurrentFolderFind" ; ::oIde:cWrkFolderFind := cVal ; EXIT + CASE "CurrentReplace" ; ::oIde:cWrkReplace := cVal ; EXIT + CASE "CurrentView" ; ::oIde:cWrkView := cVal ; EXIT + CASE "CurrentHarbour" ; ::oIde:cWrkHarbour := cVal ; EXIT + CASE "CurrentShortcuts" ; ::oIde:cPathShortcuts := cVal ; EXIT + CASE "TextFileExtensions" ; ::oIde:cTextExtensions := cVal ; EXIT + + ENDSWITCH ENDIF CASE nPart == INI_PROJECTS IF hbide_parseKeyValPair( s, @cKey, @cVal ) - aadd( oIde:aIni[ nPart ], cVal ) + aadd( ::aProjFiles, cVal ) ENDIF CASE nPart == INI_FILES IF hbide_parseKeyValPair( s, @cKey, @cVal ) a_:= hbide_parseSourceComponents( cVal ) IF !Empty( a_[ 1 ] ) - aadd( oIde:aIni[ nPart ], a_ ) + aadd( ::aFiles, a_ ) ENDIF ENDIF CASE nPart == INI_FIND IF hbide_parseKeyValPair( s, @cKey, @cVal ) - aadd( oIde:aIni[ nPart ], cVal ) + aadd( ::aFind, cVal ) ENDIF CASE nPart == INI_REPLACE IF hbide_parseKeyValPair( s, @cKey, @cVal ) - aadd( oIde:aIni[ nPart ], cVal ) + aadd( ::aReplace, cVal ) ENDIF - CASE nPart == INI_RECENTPROJECTS .OR. ; - nPart == INI_RECENTFILES - + CASE nPart == INI_RECENTPROJECTS IF hbide_parseKeyValPair( s, @cKey, @cVal ) - IF Len( oIde:aIni[ nPart ] ) < 25 + IF Len( ::aRecentProjects ) < 25 cVal := hbide_pathNormalized( cVal, .f. ) - IF aScan( oIde:aIni[ nPart ], {|e| hbide_pathNormalized( e, .f. ) == cVal } ) == 0 - AAdd( oIde:aIni[ nPart ], cVal ) + IF aScan( ::aRecentProjects, {|e| hbide_pathNormalized( e, .f. ) == cVal } ) == 0 + AAdd( ::aRecentProjects, cVal ) + ENDIF + ENDIF + ENDIF + + CASE nPart == INI_RECENTFILES + IF hbide_parseKeyValPair( s, @cKey, @cVal ) + IF Len( ::aRecentFiles ) < 25 + cVal := hbide_pathNormalized( cVal, .f. ) + IF aScan( ::aRecentFiles, {|e| hbide_pathNormalized( e, .f. ) == cVal } ) == 0 + AAdd( ::aRecentFiles, cVal ) ENDIF ENDIF ENDIF CASE nPart == INI_FOLDERS IF hbide_parseKeyValPair( s, @cKey, @cVal ) - aadd( oIde:aIni[ nPart ], cVal ) + aadd( ::aFolders, cVal ) ENDIF CASE nPart == INI_VIEWS IF hbide_parseKeyValPair( s, @cKey, @cVal ) - aadd( oIde:aIni[ nPart ], cVal ) + aadd( ::aViews, cVal ) ENDIF CASE nPart == INI_TAGGEDPROJECTS IF hbide_parseKeyValPair( s, @cKey, @cVal ) - aadd( oIde:aIni[ nPart ], cVal ) + aadd(::aTaggedProjects, cVal ) ENDIF CASE nPart == INI_TOOLS IF hbide_parseKeyValPair( s, @cKey, @cVal ) a_:= hbide_parseToolComponents( cVal ) - aadd( oIde:aIni[ nPart ], a_ ) + aadd( ::aTools, a_ ) ENDIF CASE nPart == INI_USERTOOLBARS IF hbide_parseKeyValPair( s, @cKey, @cVal ) a_:= hbide_parseUserToolbarComponents( cVal ) - aadd( oIde:aIni[ nPart ], a_ ) + aadd( ::aUserToolbars, a_ ) ENDIF ENDCASE @@ -466,7 +340,232 @@ FUNCTION hbide_loadINI( oIde, cHbideIni ) NEXT ENDIF - RETURN Nil + ::oIde:lCurrentLineHighlightEnabled := iif( ::oINI:cCurrentLineHighlightMode == "NO", .f., .t. ) + ::oIde:lLineNumbersVisible := iif( ::oINI:cLineNumbersDisplayMode == "NO", .f., .t. ) + ::oIde:lHorzRulerVisible := iif( ::oINI:cHorzRulerDisplayMode == "NO", .f., .t. ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeINI:save( cHbideIni ) + LOCAL j, nTab, pTab, n, txt_, oEdit, nTabs, nn, a_ + + DEFAULT cHbideIni TO ::oIde:cProjIni + + HB_TRACE( HB_TR_ALWAYS, "IdeINI:saveINI( cHbideIni )" ) + + IF ::oIde:nRunMode != HBIDE_RUN_MODE_INI + RETURN Nil + ENDIF + + txt_:= {} + + aadd( txt_, "[HBIDE]" ) + aadd( txt_, " " ) + // + aadd( txt_, "MainWindowGeometry" + "=" + hbide_posAndSize( ::oDlg:oWidget ) ) + aadd( txt_, "GotoDialogGeometry" + "=" + ::cGotoDialogGeometry ) + aadd( txt_, "FindDialogGeometry" + "=" + ::cFindDialogGeometry ) + aadd( txt_, "ToolsDialogGeometry" + "=" + ::cToolsDialogGeometry ) + aadd( txt_, "ShortcutsDialogGeometry" + "=" + ::cShortcutsDialogGeometry ) + aadd( txt_, "SetupDialogGeometry" + "=" + ::cSetupDialogGeometry ) + // + aadd( txt_, "CurrentLineHighlightMode" + "=" + iif( ::lCurrentLineHighlightEnabled, "YES", "NO" ) ) + aadd( txt_, "LineNumbersDisplayMode" + "=" + iif( ::lLineNumbersVisible, "YES", "NO" ) ) + aadd( txt_, "HorzRulerDisplayMode" + "=" + iif( ::lHorzRulerVisible, "YES", "NO" ) ) + // + aadd( txt_, "RecentTabIndex" + "=" + hb_ntos( ::qTabWidget:currentIndex() ) ) + // + aadd( txt_, "IdeTheme" + "=" + ::cIdeTheme ) + aadd( txt_, "IdeAnimated" + "=" + ::cIdeAnimated ) + + aadd( txt_, "PathMk2" + "=" + ::cPathMk2 ) + aadd( txt_, "PathEnv" + "=" + ::cPathEnv ) + // + aadd( txt_, "CurrentProject" + "=" + ::oIde:cWrkProject ) + aadd( txt_, "CurrentTheme" + "=" + ::oIde:cWrkTheme ) + aadd( txt_, "CurrentCodec" + "=" + ::oIde:cWrkCodec ) + aadd( txt_, "CurrentEnvironment" + "=" + ::oIde:cWrkEnvironment ) + aadd( txt_, "CurrentFind" + "=" + ::oIde:cWrkFind ) + aadd( txt_, "CurrentFolderFind" + "=" + ::oIde:cWrkFolderFind ) + aadd( txt_, "CurrentReplace" + "=" + ::oIde:cWrkReplace ) + aadd( txt_, "CurrentView" + "=" + ::oIde:cWrkView ) + aadd( txt_, "CurrentHarbour" + "=" + ::oIde:cWrkHarbour ) + aadd( txt_, "CurrentShortcuts" + "=" + ::oIde:cPathShortcuts ) + aadd( txt_, "TextFileExtensions" + "=" + ::oIde:cTextExtensions ) + // + aadd( txt_, " " ) + + aadd( txt_, "[PROJECTS]" ) + aadd( txt_, " " ) + FOR n := 1 TO len( ::oIde:aProjects ) + aadd( txt_, "project_" + hb_ntos( n ) + "=" + hbide_pathNormalized( ::oIde:aProjects[ n, 2 ], .f. ) ) + NEXT + aadd( txt_, " " ) + + /*------------------- FILES -------------------*/ + aadd( txt_, "[FILES]" ) + aadd( txt_, " " ) + nn := 0 + FOR j := 2 TO len( ::oIde:aViews ) + ::oIde:lClosing := .t. + ::oDK:setView( ::oIde:aViews[ j ]:oWidget:objectName() ) + + nTabs := ::oIde:qTabWidget:count() + FOR n := 1 TO nTabs + pTab := ::oIde:qTabWidget:widget( n - 1 ) + nTab := ascan( ::oIde:aTabs, {|e_| hbqt_IsEqualGcQtPointer( e_[ 1 ]:oWidget:pPtr, pTab ) } ) + oEdit := ::oIde:aTabs[ nTab, TAB_OEDITOR ] + + IF !Empty( oEdit:sourceFile ) .AND. !( ".ppo" == lower( oEdit:cExt ) ) + IF oEdit:lLoaded + aadd( txt_, "file_" + hb_ntos( ++nn ) + "=" + hbide_getEditInfoAsString( oEdit ) ) + + ELSE + aadd( txt_, "file_" + hb_ntos( ++nn ) + "=" + hbide_pathNormalized( oEdit:sourceFile, .f. ) + "," + ; + hb_ntos( oEdit:nPos ) + "," + ; + hb_ntos( oEdit:nHPos ) + "," + ; + hb_ntos( oEdit:nVPos ) + "," + ; + oEdit:cTheme + "," + ; + oEdit:cView + "," + ; + hbide_nArray2string( oEdit:oEdit:aBookMarks ) + "," ) + ENDIF + ENDIF + NEXT + NEXT + aadd( txt_, " " ) + + aadd( txt_, "[FIND]" ) + aadd( txt_, " " ) + FOR n := 1 TO len( ::aFind ) + aadd( txt_, "find_" + hb_ntos( n ) + "=" + ::aFind[ n ] ) + NEXT + aadd( txt_, " " ) + + aadd( txt_, "[REPLACE]" ) + aadd( txt_, " " ) + FOR n := 1 TO len( ::aReplace ) + aadd( txt_, "replace_" + hb_ntos( n ) + "=" + ::aReplace[ n ] ) + NEXT + aadd( txt_, " " ) + + aadd( txt_, "[RECENTFILES]" ) + aadd( txt_, " " ) + FOR n := 1 TO len( ::aRecentFiles ) + aadd( txt_, "recentfile_" + hb_ntos( n ) + "=" + hbide_pathNormalized( ::aRecentFiles[ n ], .f. ) ) + NEXT + aadd( txt_, " " ) + + aadd( txt_, "[RECENTPROJECTS]" ) + aadd( txt_, " " ) + FOR n := 1 TO len( ::aRecentProjects ) + aadd( txt_, "recentproject_" + hb_ntos( n ) + "=" + hbide_pathNormalized( ::aRecentProjects[ n ], .f. ) ) + NEXT + aadd( txt_, " " ) + + aadd( txt_, "[FOLDERS]" ) + aadd( txt_, " " ) + FOR n := 1 TO len( ::aFolders ) + aadd( txt_, "folder_" + hb_ntos( n ) + "=" + hbide_pathNormalized( ::aFolders[ n ], .f. ) ) + NEXT + aadd( txt_, " " ) + + aadd( txt_, "[VIEWS]" ) + aadd( txt_, " " ) + FOR n := 1 TO len( ::aViews ) + aadd( txt_, "view_" + hb_ntos( n ) + "=" + ::aViews[ n ] ) + NEXT + aadd( txt_, " " ) + + aadd( txt_, "[TAGGEDPROJECTS]" ) + aadd( txt_, " " ) + FOR n := 1 TO len( ::aTaggedProjects ) + aadd( txt_, "taggedproject_" + hb_ntos( n ) + "=" + ::aTaggedProjects[ n ] ) + NEXT + aadd( txt_, " " ) + + aadd( txt_, "[TOOLS]" ) + aadd( txt_, " " ) + FOR EACH a_ IN ::aTools + aadd( txt_, "tool_" + hb_ntos( a_:__enumIndex() ) + "=" + hbide_array2string( a_, "," ) ) + NEXT + aadd( txt_, " " ) + + aadd( txt_, "[USERTOOLBARS]" ) + aadd( txt_, " " ) + FOR n := 1 TO len( ::aUserToolbars ) + aadd( txt_, "usertoolbars_" + hb_ntos( n ) + "=" + hbide_array2string( ::aUserToolbars[ n ], "," ) ) + NEXT + aadd( txt_, " " ) + + aadd( txt_, "[General]" ) + aadd( txt_, " " ) + + hbide_createTarget( ::oIde:cProjIni, txt_ ) + + RETURN hbide_saveSettings( ::oIde ) + +/*----------------------------------------------------------------------*/ + +STATIC FUNCTION hbide_saveSettings( oIde ) + LOCAL cPath + + hb_fNameSplit( oIde:cProjIni, @cPath ) + hbqt_QMainWindow_saveSettings( cPath + "settings.ide", "hbidesettings", oIde:oDlg:oWidget:pPtr ) + + RETURN nil + +/*----------------------------------------------------------------------*/ + +FUNCTION hbide_restSettings( oIde ) + LOCAL cPath + + hb_fNameSplit( oIde:cProjIni, @cPath ) + hbqt_QMainWindow_restSettings( cPath + "settings.ide", "hbidesettings", oIde:oDlg:oWidget:pPtr ) + + RETURN nil + +/*----------------------------------------------------------------------*/ + +FUNCTION hbide_getEditInfoAsString( oEdit ) + LOCAL qHScr := QScrollBar():configure( oEdit:qEdit:horizontalScrollBar() ) + LOCAL qVScr := QScrollBar():configure( oEdit:qEdit:verticalScrollBar() ) + LOCAL qCursor := QTextCursor():configure( oEdit:qEdit:textCursor() ) + LOCAL cBMarks := hbide_nArray2string( oEdit:oEdit:aBookMarks ) + + RETURN hbide_pathNormalized( oEdit:sourceFile, .f. ) + "," + ; + hb_ntos( qCursor:position() ) + "," + ; + hb_ntos( qHScr:value() ) + "," + ; + hb_ntos( qVScr:value() ) + "," + ; + oEdit:cTheme + "," + ; + oEdit:cView + "," + ; + cBMarks + "," + +/*----------------------------------------------------------------------*/ + +FUNCTION hbide_getIniPath( cHbideIni ) + LOCAL cPath, cIni + + IF empty( cHbideIni ) + IF ! hb_FileExists( cIni := hb_dirBase() + "hbide.ini" ) + #if defined( __PLATFORM__WINDOWS ) + cPath := hbide_DirAddPathSep( GetEnv( "APPDATA" ) ) + "hbide\" + #elif defined( __PLATFORM__UNIX ) + cPath := hbide_DirAddPathSep( GetEnv( "HOME" ) ) + ".hbide/" + #elif defined( __PLATFORM__OS2 ) + cPath := hbide_DirAddPathSep( GetEnv( "HOME" ) ) + ".hbide/" + #endif + IF ! hb_dirExists( cPath ) + MakeDir( cPath ) + ENDIF + cIni := cPath + "hbide.ini" + ENDIF + ELSE + cIni := cHbideIni + ENDIF + + RETURN cIni /*----------------------------------------------------------------------*/ @@ -592,7 +691,9 @@ FUNCTION hbide_saveShortcuts( oIde, a_, cFileShortcuts ) RETURN hb_fileExists( cFileShortcuts ) /*----------------------------------------------------------------------*/ +// // Class IdeSetup +// /*----------------------------------------------------------------------*/ CLASS IdeSetup INHERIT IdeObject @@ -684,12 +785,13 @@ METHOD IdeSetup:show() ::oUI:q_comboStyle:setCurrentIndex( 0 ) ::connect( ::oUI:q_comboStyle, "currentIndexChanged(int)", {|p| ::execEvent( "comboStyle_currentIndexChanged", p ) } ) - ::oUI:q_checkAnimated:setChecked( val( ::oIde:aINI[ INI_HBIDE, IdeAnimated ] ) > 0 ) + ::oUI:q_checkAnimated:setChecked( val( ::oIde:oINI:cIdeAnimated ) > 0 ) ::connect( ::oUI:q_checkAnimated, "stateChanged(int)", {|i| ::execEvent( "checkAnimated_stateChanged", i ) } ) ::oUI:hide() ENDIF + ::oIde:setPosByIniEx( ::oUI:oWidget, ::oINI:cSetupDialogGeometry ) ::oUI:exec() RETURN Self @@ -703,6 +805,7 @@ METHOD IdeSetup:execEvent( cEvent, p ) CASE "checkAnimated_stateChanged" ::oDK:animateComponents( iif( p == 0, 0, 1 ) ) EXIT + CASE "treeWidget_itemSelectionChanged" qItem := QTreeWidgetItem():from( ::oUI:q_treeWidget:currentItem() ) IF ( nIndex := ascan( ::aTree, qItem:text() ) ) > 0 @@ -711,12 +814,13 @@ METHOD IdeSetup:execEvent( cEvent, p ) EXIT CASE "buttonClose_clicked" + ::oIde:oINI:cSetupDialogGeometry := hbide_posAndSize( ::oUI:oWidget ) ::oUI:done( 1 ) EXIT CASE "comboStyle_currentIndexChanged" IF ( nIndex := ::oUI:q_comboStyle:currentIndex() ) > -1 - ::oIde:aINI[ INI_HBIDE, IdeTheme ] := ::aStyles[ nIndex + 1 ] + ::oIde:oINI:cIdeTheme := ::aStyles[ nIndex + 1 ] ::setSystemStyle( ::aStyles[ nIndex + 1 ] ) ENDIF EXIT @@ -785,409 +889,3 @@ METHOD IdeSetup:setBaseColor() RETURN Self /*----------------------------------------------------------------------*/ -/*----------------------------------------------------------------------*/ -/*----------------------------------------------------------------------*/ -// -// Class IdeINI -// -/*----------------------------------------------------------------------*/ -/*----------------------------------------------------------------------*/ -/*----------------------------------------------------------------------*/ - -CLASS IdeINI INHERIT IdeObject - - DATA aINI INIT {} - - DATA cMainWindowGeometry INIT "" - DATA cGotoDialogGeometry INIT "" - DATA cFindDialogGeometry INIT "" - DATA cToolsDialogGeometry INIT "" - DATA cRecentTabIndex INIT "" - DATA cPathMk2 INIT "" - DATA cPathEnv INIT "" - DATA cCurrentProject INIT "" - DATA cCurrentTheme INIT "" - DATA cCurrentCodec INIT "" - DATA cCurrentEnvironment INIT "" - DATA cCurrentFind INIT "" - DATA cCurrentFolderFind INIT "" - DATA cCurrentReplace INIT "" - DATA cCurrentView INIT "" - DATA cCurrentHarbour INIT "" - DATA cCurrentShortcuts INIT "" - DATA cCurrentLineHighlightMode INIT "" - DATA cTextFileExtensions INIT "" - DATA cLineNumbersDisplayMode INIT "" - DATA cHorzRulerDisplayMode INIT "" - DATA cIdeTheme INIT "" - DATA cIdeAnimated INIT "" - - DATA aProjects INIT {} - DATA aFiles INIT {} - DATA aFind INIT {} - DATA aReplace INIT {} - DATA aRecentProjects INIT {} - DATA aRecentFiles INIT {} - DATA aFolders INIT {} - DATA aViews INIT {} - DATA aTaggedProjects INIT {} - DATA aTools INIT {} - DATA aUserToolbars INIT {} - - METHOD new( oIde ) - METHOD create( oIde ) - METHOD load( cHbideIni ) - METHOD save( cHbideIni ) - - ENDCLASS - -/*----------------------------------------------------------------------*/ - -METHOD IdeINI:new( oIde ) - ::oIde := oIde - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeINI:create( oIde ) - DEFAULT oIde TO ::oIde - ::oIde := oIde - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeINI:load( cHbideIni ) - LOCAL aElem, s, nPart, cKey, cVal, a_ - - ::oIde:cProjIni := hbide_getIniPath( cHbideIni ) - - IF hb_FileExists( ::oIde:cProjIni ) - aElem := hbide_readSource( ::oIde:cProjIni ) - - FOR EACH s IN aElem - - s := alltrim( s ) - IF !empty( s ) - SWITCH Upper( s ) - - CASE "[GENERAL]" - nPart := INI_GENERAL - EXIT - CASE "[HBIDE]" - nPart := INI_HBIDE - EXIT - CASE "[PROJECTS]" - nPart := INI_PROJECTS - EXIT - CASE "[FILES]" - nPart := INI_FILES - EXIT - CASE "[FIND]" - nPart := INI_FIND - EXIT - CASE "[REPLACE]" - nPart := INI_REPLACE - EXIT - CASE "[RECENTFILES]" - nPart := INI_RECENTFILES - EXIT - CASE "[RECENTPROJECTS]" - nPart := INI_RECENTPROJECTS - EXIT - CASE "[FOLDERS]" - nPart := INI_FOLDERS - EXIT - CASE "[VIEWS]" - nPart := INI_VIEWS - EXIT - CASE "[TAGGEDPROJECTS]" - nPart := INI_TAGGEDPROJECTS - EXIT - CASE "[TOOLS]" - nPart := INI_TOOLS - EXIT - CASE "[USERTOOLBARS]" - nPart := INI_USERTOOLBARS - EXIT - OTHERWISE - DO CASE - CASE Left( s, 1 ) $ '#[' - * Nothing todo! - - CASE nPart == INI_GENERAL - * Qt Setttings, do nothing. - - CASE nPart == INI_HBIDE - IF hbide_parseKeyValPair( s, @cKey, @cVal ) - - SWITCH cKey - - CASE "MainWindowGeometry" ; ::cMainWindowGeometry := cVal ; EXIT - CASE "GotoDialogGeometry" ; ::cGotoDialogGeometry := cVal ; EXIT - CASE "FindDialogGeometry" ; ::cFindDialogGeometry := cVal ; EXIT - CASE "ToolsDialogGeometry" ; ::cToolsDialogGeometry := cVal ; EXIT - // - CASE "CurrentLineHighlightMode" ; ::cCurrentLineHighlightMode := cVal ; EXIT - CASE "LineNumbersDisplayMode" ; ::cLineNumbersDisplayMode := cVal ; EXIT - CASE "HorzRulerDisplayMode" ; ::cHorzRulerDisplayMode := cVal ; EXIT - // - CASE "RecentTabIndex" ; ::cRecentTabIndex := cVal ; EXIT - // - CASE "IdeTheme" ; ::cIdeTheme := cVal ; EXIT - CASE "IdeAnimated" ; ::cIdeAnimated := cVal ; EXIT - // /* Subject to be identified under this object only */ - CASE "PathMk2" ; ::oIde:cWrkPathMk2 := cVal ; EXIT - CASE "PathEnv" ; ::oIde:cWrkPathEnv := cVal ; EXIT - CASE "CurrentProject" ; ::oIde:cWrkProject := cVal ; EXIT - CASE "CurrentTheme" ; ::oIde:cWrkTheme := cVal ; EXIT - CASE "CurrentCodec" ; ::oIde:cWrkCodec := cVal ; EXIT - CASE "CurrentEnvironment" ; ::oIde:cWrkEnvironment := cVal ; EXIT - CASE "CurrentFind" ; ::oIde:cWrkFind := cVal ; EXIT - CASE "CurrentFolderFind" ; ::oIde:cWrkFolderFind := cVal ; EXIT - CASE "CurrentReplace" ; ::oIde:cWrkReplace := cVal ; EXIT - CASE "CurrentView" ; ::oIde:cWrkView := cVal ; EXIT - CASE "CurrentHarbour" ; ::oIde:cWrkHarbour := cVal ; EXIT - CASE "CurrentShortcuts" ; ::oIde:cPathShortcuts := cVal ; EXIT - CASE "TextFileExtensions" ; ::oIde:cTextExtensions := cVal ; EXIT - - ENDSWITCH - ENDIF - - CASE nPart == INI_PROJECTS - IF hbide_parseKeyValPair( s, @cKey, @cVal ) - aadd( ::aProjects, cVal ) - ENDIF - - CASE nPart == INI_FILES - IF hbide_parseKeyValPair( s, @cKey, @cVal ) - a_:= hbide_parseSourceComponents( cVal ) - IF !Empty( a_[ 1 ] ) - aadd( ::aFiles, a_ ) - ENDIF - ENDIF - - CASE nPart == INI_FIND - IF hbide_parseKeyValPair( s, @cKey, @cVal ) - aadd( ::aFind, cVal ) - ENDIF - - CASE nPart == INI_REPLACE - IF hbide_parseKeyValPair( s, @cKey, @cVal ) - aadd( ::aReplace, cVal ) - ENDIF - - CASE nPart == INI_RECENTPROJECTS - IF hbide_parseKeyValPair( s, @cKey, @cVal ) - IF Len( ::aRecentProjects ) < 25 - cVal := hbide_pathNormalized( cVal, .f. ) - IF aScan( ::aRecentProjects, {|e| hbide_pathNormalized( e, .f. ) == cVal } ) == 0 - AAdd( ::aRecentProjects, cVal ) - ENDIF - ENDIF - ENDIF - - CASE nPart == INI_RECENTFILES - IF hbide_parseKeyValPair( s, @cKey, @cVal ) - IF Len( ::aRecentFiles ) < 25 - cVal := hbide_pathNormalized( cVal, .f. ) - IF aScan( ::aRecentFiles, {|e| hbide_pathNormalized( e, .f. ) == cVal } ) == 0 - AAdd( ::aRecentFiles, cVal ) - ENDIF - ENDIF - ENDIF - - CASE nPart == INI_FOLDERS - IF hbide_parseKeyValPair( s, @cKey, @cVal ) - aadd( ::aFolders, cVal ) - ENDIF - - CASE nPart == INI_VIEWS - IF hbide_parseKeyValPair( s, @cKey, @cVal ) - aadd( ::aViews, cVal ) - ENDIF - - CASE nPart == INI_TAGGEDPROJECTS - IF hbide_parseKeyValPair( s, @cKey, @cVal ) - aadd(::aTaggedProjects, cVal ) - ENDIF - - CASE nPart == INI_TOOLS - IF hbide_parseKeyValPair( s, @cKey, @cVal ) - a_:= hbide_parseToolComponents( cVal ) - aadd( ::aTools, a_ ) - ENDIF - - CASE nPart == INI_USERTOOLBARS - IF hbide_parseKeyValPair( s, @cKey, @cVal ) - a_:= hbide_parseUserToolbarComponents( cVal ) - aadd( ::aUserToolbars, a_ ) - ENDIF - - ENDCASE - EXIT - ENDSWITCH - ENDIF - NEXT - ENDIF - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeINI:save( cHbideIni ) - LOCAL j, nTab, pTab, n, txt_, oEdit, nTabs, nn, a_ - - DEFAULT cHbideIni TO ::oIde:cProjIni - - HB_TRACE( HB_TR_ALWAYS, "IdeINI:saveINI( cHbideIni )" ) - - IF ::oIde:nRunMode != HBIDE_RUN_MODE_INI - RETURN Nil - ENDIF - - txt_:= {} - - aadd( txt_, "[HBIDE]" ) - aadd( txt_, " " ) - // - aadd( txt_, "MainWindowGeometry" + "=" + hbide_posAndSize( ::oDlg:oWidget ) ) - aadd( txt_, "GotoDialogGeometry" + "=" + ::cGotoDialogGeometry ) - aadd( txt_, "FindDialogGeometry" + "=" + ::cFindDialogGeometry ) - aadd( txt_, "ToolsDialogGeometry" + "=" + ::cToolsDialogGeometry ) - // - aadd( txt_, "CurrentLineHighlightMode" + "=" + iif( ::lCurrentLineHighlightEnabled, "YES", "NO" ) ) - aadd( txt_, "LineNumbersDisplayMode" + "=" + iif( ::lLineNumbersVisible, "YES", "NO" ) ) - aadd( txt_, "HorzRulerDisplayMode" + "=" + iif( ::lHorzRulerVisible, "YES", "NO" ) ) - // - aadd( txt_, "RecentTabIndex" + "=" + hb_ntos( ::qTabWidget:currentIndex() ) ) - // - aadd( txt_, "IdeTheme" + "=" + ::cIdeTheme ) - aadd( txt_, "IdeAnimated" + "=" + ::cIdeAnimated ) - - aadd( txt_, "PathMk2" + "=" + ::oIde:cWrkPathMk2 ) - aadd( txt_, "PathEnv" + "=" + ::oIde:cWrkPathEnv ) - aadd( txt_, "CurrentProject" + "=" + ::oIde:cWrkProject ) - aadd( txt_, "CurrentTheme" + "=" + ::oIde:cWrkTheme ) - aadd( txt_, "CurrentCodec" + "=" + ::oIde:cWrkCodec ) - aadd( txt_, "CurrentEnvironment" + "=" + ::oIde:cWrkEnvironment ) - aadd( txt_, "CurrentFind" + "=" + ::oIde:cWrkFind ) - aadd( txt_, "CurrentFolderFind" + "=" + ::oIde:cWrkFolderFind ) - aadd( txt_, "CurrentReplace" + "=" + ::oIde:cWrkReplace ) - aadd( txt_, "CurrentView" + "=" + ::oIde:cWrkView ) - aadd( txt_, "CurrentHarbour" + "=" + ::oIde:cWrkHarbour ) - aadd( txt_, "CurrentShortcuts" + "=" + ::oIde:cPathShortcuts ) - aadd( txt_, "TextFileExtensions" + "=" + ::oIde:cTextExtensions ) - // - aadd( txt_, " " ) - - aadd( txt_, "[PROJECTS]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( ::oIde:aProjects ) - aadd( txt_, "project_" + hb_ntos( n ) + "=" + hbide_pathNormalized( ::oIde:aProjects[ n, 2 ], .f. ) ) - NEXT - aadd( txt_, " " ) - - /*------------------- FILES -------------------*/ - aadd( txt_, "[FILES]" ) - aadd( txt_, " " ) - nn := 0 - FOR j := 2 TO len( ::aViews ) - ::oIde:lClosing := .t. - ::oIde:oDK:setView( ::aViews[ j ]:oWidget:objectName() ) - - nTabs := ::qTabWidget:count() - FOR n := 1 TO nTabs - pTab := ::qTabWidget:widget( n - 1 ) - nTab := ascan( ::aTabs, {|e_| hbqt_IsEqualGcQtPointer( e_[ 1 ]:oWidget:pPtr, pTab ) } ) - oEdit := ::aTabs[ nTab, TAB_OEDITOR ] - - IF !Empty( oEdit:sourceFile ) .AND. !( ".ppo" == lower( oEdit:cExt ) ) - IF oEdit:lLoaded - aadd( txt_, "file_" + hb_ntos( ++nn ) + "=" + hbide_getEditInfoAsString( oEdit ) ) - - ELSE - aadd( txt_, "file_" + hb_ntos( ++nn ) + "=" + hbide_pathNormalized( oEdit:sourceFile, .f. ) + "," + ; - hb_ntos( oEdit:nPos ) + "," + ; - hb_ntos( oEdit:nHPos ) + "," + ; - hb_ntos( oEdit:nVPos ) + "," + ; - oEdit:cTheme + "," + ; - oEdit:cView + "," + ; - hbide_nArray2string( oEdit:oEdit:aBookMarks ) + "," ) - ENDIF - ENDIF - NEXT - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[FIND]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( ::aFind ) - aadd( txt_, "find_" + hb_ntos( n ) + "=" + ::aFind[ n ] ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[REPLACE]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( ::aReplace ) - aadd( txt_, "replace_" + hb_ntos( n ) + "=" + ::aReplace[ n ] ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[RECENTFILES]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( ::aRecentFiles ) - aadd( txt_, "recentfile_" + hb_ntos( n ) + "=" + hbide_pathNormalized( ::aRecentFiles[ n ], .f. ) ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[RECENTPROJECTS]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( ::aRecentProjects ) - aadd( txt_, "recentproject_" + hb_ntos( n ) + "=" + hbide_pathNormalized( ::aRecentProjects[ n ], .f. ) ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[FOLDERS]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( ::aFolders ) - aadd( txt_, "folder_" + hb_ntos( n ) + "=" + hbide_pathNormalized( ::aFolders[ n ], .f. ) ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[VIEWS]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( ::aViews ) - aadd( txt_, "view_" + hb_ntos( n ) + "=" + ::aViews[ n ] ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[TAGGEDPROJECTS]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( ::aTaggedProjects ) - aadd( txt_, "taggedproject_" + hb_ntos( n ) + "=" + ::aTaggedProjects[ n ] ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[TOOLS]" ) - aadd( txt_, " " ) - FOR EACH a_ IN ::aTools - aadd( txt_, "tool_" + hb_ntos( a_:__enumIndex() ) + "=" + hbide_array2string( a_, "," ) ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[USERTOOLBARS]" ) - aadd( txt_, " " ) - FOR n := 1 TO len( ::aUserToolbars ) - aadd( txt_, "usertoolbars_" + hb_ntos( n ) + "=" + hbide_array2string( ::aUserToolbars[ n ], "," ) ) - NEXT - aadd( txt_, " " ) - - aadd( txt_, "[General]" ) - aadd( txt_, " " ) - - //hbide_createTarget( oIde:cProjIni, txt_ ) - //hbide_createTarget( "e:\temp\test.ini", txt_ ) - - RETURN cHbideIni //hbide_saveSettings( ::oIde ) - -/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/ideshortcuts.prg b/harbour/contrib/hbide/ideshortcuts.prg index b98b718c75..12aa74ee75 100644 --- a/harbour/contrib/hbide/ideshortcuts.prg +++ b/harbour/contrib/hbide/ideshortcuts.prg @@ -292,9 +292,9 @@ METHOD IdeShortcuts:show() IF empty( ::oUI ) ::buildUI() ::populateData( 1 ) - ::oIde:setPosAndSizeByIni( ::oUI:oWidget, FindInFilesDialogGeometry ) ENDIF + ::oIde:setPosAndSizeByIniEx( ::oUI:oWidget, ::oINI:cShortcutsDialogGeometry ) ::oUI:show() ::oUI:raise() @@ -557,7 +557,7 @@ METHOD IdeShortcuts:buildUI() ::oUI:oWidget:installEventFilter( ::pEvents ) - Qt_Events_Connect( ::pEvents, ::oUI:oWidget, QEvent_Close, {|| ::oIde:aIni[ INI_HBIDE, FindInFilesDialogGeometry ] := hbide_posAndSize( ::oUI:oWidget ) } ) + Qt_Events_Connect( ::pEvents, ::oUI:oWidget, QEvent_Close, {|| ::oIde:oINI:cShortcutsDialogGeometry := hbide_posAndSize( ::oUI:oWidget ) } ) oTbl := ::oUI:q_tableMacros /* Build Table Header */ QHeaderView():from( oTbl:verticalHeader() ):hide() diff --git a/harbour/contrib/hbide/idesources.prg b/harbour/contrib/hbide/idesources.prg index d9181edff2..bf39d0b4e5 100644 --- a/harbour/contrib/hbide/idesources.prg +++ b/harbour/contrib/hbide/idesources.prg @@ -113,13 +113,13 @@ METHOD IdeSourcesManager:create( oIde ) METHOD IdeSourcesManager:loadSources() LOCAL a_ - IF !empty( ::aIni[ INI_FILES ] ) - FOR EACH a_ IN ::aIni[ INI_FILES ] + IF !empty( ::oIni:aFiles ) + FOR EACH a_ IN ::oIni:aFiles /* File nPos nVPos nHPos cTheme cView lAlert lVisible, aBookMarks */ ::editSource( a_[ 1 ], a_[ 2 ], a_[ 3 ], a_[ 4 ], a_[ 5 ], a_[ 6 ], .t., .f., a_[ 7 ] ) NEXT ::oDK:setView( ::cWrkView ) - ::oEM:setSourceVisibleByIndex( max( 0, val( ::aIni[ INI_HBIDE, RecentTabIndex ] ) ) ) + ::oEM:setSourceVisibleByIndex( max( 0, val( ::oIni:cRecentTabIndex ) ) ) ENDIF RETURN Self @@ -275,7 +275,7 @@ METHOD IdeSourcesManager:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme, cV ENDIF IF !Empty( cSourceFile ) .AND. !hbide_isSourcePPO( cSourceFile ) - hbide_mnuAddFileToMRU( Self, cSourceFile, INI_RECENTFILES ) + hbide_mnuAddFileToMRU( Self, cSourceFile, "recent_files" ) ENDIF RETURN .t. diff --git a/harbour/contrib/hbide/idetools.prg b/harbour/contrib/hbide/idetools.prg index f3b330fa28..61830cdb65 100644 --- a/harbour/contrib/hbide/idetools.prg +++ b/harbour/contrib/hbide/idetools.prg @@ -85,8 +85,8 @@ CLASS IdeToolsManager INHERIT IdeObject DATA aBtns INIT {} DATA aToolbars INIT { NIL,NIL,NIL,NIL,NIL } - ACCESS aTools INLINE ::aINI[ INI_TOOLS ] - ACCESS aUserToolBars INLINE ::aINI[ INI_USERTOOLBARS ] + ACCESS aTools INLINE ::oINI:aTools + ACCESS aUserToolBars INLINE ::oINI:aUserToolbars METHOD new( oIde ) METHOD create( oIde ) @@ -132,13 +132,13 @@ METHOD IdeToolsManager:create( oIde ) oAct:setMenu( QMenu():new() ) ENDIF - IF empty( ::aINI[ INI_USERTOOLBARS ] ) - asize( ::aINI[ INI_USERTOOLBARS ], 5 ) - DEFAULT ::aINI[ INI_USERTOOLBARS, 1 ] TO { "","YES","","","YES","YES","YES" } - DEFAULT ::aINI[ INI_USERTOOLBARS, 2 ] TO { "","YES","","","YES","YES","YES" } - DEFAULT ::aINI[ INI_USERTOOLBARS, 3 ] TO { "","YES","","","YES","YES","YES" } - DEFAULT ::aINI[ INI_USERTOOLBARS, 4 ] TO { "","YES","","","YES","YES","YES" } - DEFAULT ::aINI[ INI_USERTOOLBARS, 5 ] TO { "","YES","","","YES","YES","YES" } + IF empty( ::oINI:aUserToolbars ) + asize( ::oINI:aUserToolbars, 5 ) + DEFAULT ::oINI:aUserToolbars[ 1 ] TO { "","YES","","","YES","YES","YES" } + DEFAULT ::oINI:aUserToolbars[ 2 ] TO { "","YES","","","YES","YES","YES" } + DEFAULT ::oINI:aUserToolbars[ 3 ] TO { "","YES","","","YES","YES","YES" } + DEFAULT ::oINI:aUserToolbars[ 4 ] TO { "","YES","","","YES","YES","YES" } + DEFAULT ::oINI:aUserToolbars[ 5 ] TO { "","YES","","","YES","YES","YES" } ENDIF RETURN Self @@ -274,9 +274,9 @@ METHOD IdeToolsManager:show() ENDIF ::clearList() - ::populateList( ::aINI[ INI_TOOLS ] ) + ::populateList( ::oINI:aTools ) ::oUI:q_listNames:setCurrentRow( 0 ) - ::oIde:setPosByIni( ::oUI:oWidget, ToolsDialogGeometry ) + ::oIde:setPosByIniEx( ::oUI:oWidget, ::oINI:cToolsDialogGeometry ) ::oUI:show() RETURN Nil @@ -285,7 +285,7 @@ METHOD IdeToolsManager:show() METHOD IdeToolsManager:execEvent( cMode, p ) LOCAL cFile, cFileName, nIndex, qItem, cName, nRow - LOCAL aTools := ::aINI[ INI_TOOLS ] + LOCAL aTools := ::oINI:aTools HB_SYMBOL_UNUSED( p ) @@ -337,7 +337,7 @@ METHOD IdeToolsManager:execEvent( cMode, p ) qItem := QListWidgetItem():from( ::oUI:q_listNames:currentItem() ) cName := qItem:text() IF ( nIndex := ascan( aTools, {|e_| e_[ 1 ] == cName } ) ) > 0 - hb_adel( ::aINI[ INI_TOOLS ], nIndex, .t. ) + hb_adel( ::oINI:aTools, nIndex, .t. ) ::clearList() ::populateList() ENDIF @@ -379,7 +379,7 @@ METHOD IdeToolsManager:execEvent( cMode, p ) ENDIF EXIT CASE "buttonClose_clicked" - ::oIde:aIni[ INI_HBIDE, ToolsDialogGeometry ] := hbide_posAndSize( ::oUI:oWidget ) + ::oIde:oINI:cToolsDialogGeometry := hbide_posAndSize( ::oUI:oWidget ) ::oUI:done( 1 ) EXIT CASE "User_Toolbar_clicked" @@ -557,11 +557,11 @@ METHOD IdeToolsManager:ini2controls( nIndex ) METHOD IdeToolsManager:controls2ini( nIndex ) IF empty( nIndex ) - aadd( ::aINI[ INI_TOOLS ], {} ) - nIndex := len( ::aINI[ INI_TOOLS ] ) + aadd( ::oINI:aTools, {} ) + nIndex := len( ::oINI:aTools ) ENDIF - ::aINI[ INI_TOOLS, nIndex ] := { ::oUI:q_editName:text() , ; + ::oINI:aTools[ nIndex ] := { ::oUI:q_editName:text() , ; hbide_pathNormalized( ::oUI:q_editCmdLine:text() ), ; hbide_pathNormalized( ::oUI:q_editParams:text() ), ; hbide_pathNormalized( ::oUI:q_editStayIn:text() ), ; @@ -588,7 +588,7 @@ METHOD IdeToolsManager:clearList() METHOD IdeToolsManager:populateList( aList ) LOCAL a_ - DEFAULT aList TO ::aINI[ INI_TOOLS ] + DEFAULT aList TO ::oINI:aTools FOR EACH a_ IN aList ::oUI:q_listNames:addItem( a_[ 1 ] ) @@ -624,7 +624,7 @@ METHOD IdeToolsManager:buildPanelsButton() ::qPanelsMenu := QMenu():new() ::addPanelsMenu( "Main" ) - FOR EACH cView IN ::aINI[ INI_VIEWS ] + FOR EACH cView IN ::oINI:aViews ::addPanelsMenu( cView ) NEXT ::qPanelsButton := QToolButton():new()