From f093d0a28bf01510b9cc6c4ad2665aee336c1dbe Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Mon, 17 May 2010 06:09:28 +0000 Subject: [PATCH] 2010-15-16 23:02 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/hbide.prg * contrib/hbide/idemisc.prg * contrib/hbide/ideobject.prg * contrib/hbide/ideprojmanager.prg * contrib/hbide/idesources.prg + Implemented: "new" source opens a file save dialog to provide a valid name with extention. Syntax highlighting will be based on that. + Implemented: "new" project opens a Select Path dialog to designate the project location. The path obtained as such is posted in the "Project Location field of "Project Properties". --- harbour/ChangeLog | 12 ++++++++++++ harbour/contrib/hbide/hbide.prg | 1 + harbour/contrib/hbide/idemisc.prg | 23 +++++++++++++++++++++++ harbour/contrib/hbide/ideobject.prg | 1 + harbour/contrib/hbide/ideprojmanager.prg | 14 +++++++++++--- harbour/contrib/hbide/idesources.prg | 11 ++++++++++- 6 files changed, 58 insertions(+), 4 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index cfa39fec0a..33f75b9a24 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,18 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-15-16 23:02 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/hbide.prg + * contrib/hbide/idemisc.prg + * contrib/hbide/ideobject.prg + * contrib/hbide/ideprojmanager.prg + * contrib/hbide/idesources.prg + + Implemented: "new" source opens a file save dialog to provide + a valid name with extention. Syntax highlighting will be based on that. + + Implemented: "new" project opens a Select Path dialog to + designate the project location. The path obtained as such is + posted in the "Project Location field of "Project Properties". + 2010-15-16 21:05 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/resources/tabreadonly.png ! Changed: to reflect clearly visible readonly status. diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index c2c57caf5c..03147e8155 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -229,6 +229,7 @@ CLASS HbIde DATA lLineNumbersVisible INIT .t. DATA lCurrentLineHighlightEnabled INIT .t. + DATA cWrkFolderLast INIT "" DATA cWrkProject INIT "" DATA cWrkTheme INIT "" DATA cWrkCodec INIT "" diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 2a65fdadba..c7e9b85afe 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -551,6 +551,11 @@ FUNCTION hbide_pathStripLastSlash( cPath ) /*----------------------------------------------------------------------*/ +FUNCTION hbide_pathAppendLastSlash( cPath ) + RETURN iif( right( cPath, 1 ) $ "\/", cPath, cPath + hb_osPathSeparator() ) + +/*----------------------------------------------------------------------*/ + FUNCTION hbide_pathToOSPath( cPath ) LOCAL n @@ -1980,3 +1985,21 @@ FUNCTION hbide_parseToolComponents( cCompositeTool ) RETURN a_ /*----------------------------------------------------------------------*/ + +FUNCTION hbide_SetWrkFolderLast( cPathFile ) + LOCAL cPth, cOldPath + + STATIC cPath + IF empty( cPath ) + cPath := hb_dirBase() + ENDIF + cOldPath := cPath + + IF hb_isChar( cPathFile ) + hb_fNameSplit( cPathFile, @cPth ) + cPath := cPth + ENDIF + RETURN cOldPath + +/*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbide/ideobject.prg b/harbour/contrib/hbide/ideobject.prg index a5affc7661..0ab4f82af0 100644 --- a/harbour/contrib/hbide/ideobject.prg +++ b/harbour/contrib/hbide/ideobject.prg @@ -139,6 +139,7 @@ CLASS IdeObject ACCESS cWrkHarbour INLINE ::oIde:cWrkHarbour ACCESS cPathShortcuts INLINE ::oIde:cPathShortcuts ACCESS cTextExtensions INLINE ::oIde:cTextExtensions + ACCESS cWrkFolderLast INLINE ::oIde:cWrkFolderLast // ACCESS resPath INLINE ::oIde:resPath ACCESS pathSep INLINE ::oIde:pathSep diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index 473b151ccb..412de5e4c6 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -324,7 +324,7 @@ METHOD IdeProjManager:getProperties() /*----------------------------------------------------------------------*/ METHOD IdeProjManager:loadProperties( cProjFileName, lNew, lFetch, lUpdateTree ) - LOCAL nAlready + LOCAL nAlready, cProjPath DEFAULT cProjFileName TO "" DEFAULT lNew TO .F. @@ -364,8 +364,17 @@ METHOD IdeProjManager:loadProperties( cProjFileName, lNew, lFetch, lUpdateTree ) ENDIF IF lFetch + IF lNew + IF empty( cProjPath := hbide_fetchADir( ::oDlg, "Project Path", hbide_SetWrkFolderLast() ) ) + RETURN Self + ENDIF + cProjPath := hbide_pathAppendLastSlash( cProjPath ) + hbide_SetWrkFolderLast( cProjPath ) + ENDIF /* Access/Assign via this object */ ::oProject := IdeProject():new( ::oIDE, ::aPrjProps ) + ::oProject:location := cProjPath + ::oProject:projPath := cProjPath // ::oPropertiesDock:hide() ::oPropertiesDock:show() @@ -627,7 +636,6 @@ METHOD IdeProjManager:updateHbp( iIndex ) /*----------------------------------------------------------------------*/ METHOD IdeProjManager:fetchProperties() - LOCAL cPrjLoc := hb_dirBase() + "projects" IF empty( ::oProject ) ::oProject := IdeProject():new( ::oIDE, ::aPrjProps ) @@ -641,7 +649,7 @@ METHOD IdeProjManager:fetchProperties() ::oUI:q_comboPrjType:setCurrentIndex( 0 ) ::oUI:q_editPrjTitle :setText( "" ) - ::oUI:q_editPrjLoctn :setText( hbide_pathNormalized( cPrjLoc, .F. ) ) + ::oUI:q_editPrjLoctn :setText( hbide_pathNormalized( ::oProject:location, .F. ) ) ::oUI:q_editWrkFolder:setText( "" ) ::oUI:q_editDstFolder:setText( "" ) ::oUI:q_editBackup :setText( "" ) diff --git a/harbour/contrib/hbide/idesources.prg b/harbour/contrib/hbide/idesources.prg index 3207352dae..f297b9a773 100644 --- a/harbour/contrib/hbide/idesources.prg +++ b/harbour/contrib/hbide/idesources.prg @@ -232,15 +232,24 @@ METHOD IdeSourcesManager:saveSource( nTab, lCancel, lAs ) /*----------------------------------------------------------------------*/ METHOD IdeSourcesManager:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme, cView, lAlert, lVisible, aBookMarks ) + LOCAL lNew DEFAULT lAlert TO .T. DEFAULT lVisible TO .T. + IF ( lNew := empty( cSourceFile ) ) + cSourceFile := hbide_saveAFile( ::oDlg, "Provide source filename", /*aFltr*/, hbide_SetWrkFolderLast(), /*cDftSuffix*/ ) + IF empty( cSourceFile ) + RETURN Self + ENDIF + hbide_SetWrkFolderLast( cSourceFile ) + ENDIF + IF !Empty( cSourceFile ) IF !( hbide_isValidText( cSourceFile ) ) MsgBox( 'File type unknown or unsupported: ' + cSourceFile ) RETURN .f. - ELSEIF !hb_FileExists( cSourceFile ) + ELSEIF ! lNew .AND. ! hb_FileExists( cSourceFile ) MsgBox( 'File not found: ' + cSourceFile ) RETURN .f. ENDIF