My small contribution for "Tab by spacios"
METHOD IdeSourcesManager:saveSource( nTab, lCancel, lAs )
LOCAL oEdit, lNew, cBuffer, qDocument, nIndex, cSource
LOCAL cFileToSave, cFile, cExt, cNewFile, oItem
/* These variables must be configured by the user.*/
LOCAL lReplaceTabBySpace := .t.
LOCAL nTabLength := 3
DEFAULT nTab TO ::EM:getTabCurrent()
DEFAULT lAs TO .F.
lCancel := .F.
IF !empty( oEdit := ::oEM:getEditorByTabPosition( nTab ) )
nIndex := ::qTabWidget:indexOf( oEdit:oTab:oWidget )
cSource := oEdit:sourceFile
lNew := Empty( cSource ) .OR. lAs
IF lNew
cNewFile := ::selectSource( 'save', ;
iif( !Empty( cSource ), cSource,
hb_dirBase() + "projects\" ),;
"Save " +
oEdit:oTab:caption + " as..." )
IF empty( cNewFile )
// will check later what decision to take
RETURN .f.
ENDIF
IF hbide_pathNormalized( cNewFile ) == hbide_pathNormalized( cSource )
lNew := .f.
ENDIF
ENDIF
cFileToSave := iif( lNew, cNewFile, cSource )
qDocument := oEdit:qDocument
/*
* If the burn process fails, we should change the name of the
previous file.
* 01/01/2010 - 21:24:41 - vailtom
*/
cBuffer := oEdit:qEdit:toPlainText()
//
/*
* Replace TAB by Space
* 15/01/2010 - 13:19 - Rodrigo Machado
*/
if lReplaceTabBySpace
cBuffer := strtran(cBuffer, chr(9),space(nTabLength) )
endif
IF !hb_memowrit( cFileToSave, cBuffer )
MsgBox( "Error saving the file " + oEdit:sourceFile + ".",,
'Error saving file!' )
lCancel := .T.
RETURN .F.
ENDIF
hb_fNameSplit( cFileToSave, , @cFile, @cExt )
IF lNew
oEdit:sourceFile := cFileToSave
oEdit:oTab:Caption := cFile + cExt
::qTabWidget:setTabText( nIndex, cFile + cExt )
::qTabWidget:setTabTooltip( nIndex, cFileToSave )
IF empty( cSource )
/* The file is not populated in editors tree. Inject */
::oEM:addSourceInTree( oEdit:sourceFile )
ELSEIF lAs
/* Rename the existing nodes in tree */
IF !empty( oItem := hbide_findProjTreeItem( ::oIde,
oEdit:sourceFile, "Opened Source" ) )
oItem:oWidget:caption := cFile + cExt
ENDIF
ENDIF
ENDIF
qDocument:setModified( .f. )
::oIde:aSources := { oEdit:sourceFile }
::createTags()
::updateFuncList()
::qTabWidget:setTabIcon( nIndex, ::resPath + "tabunmodified.png" )
::oSBar:getItem( SB_PNL_MODIFIED ):caption := " "
ENDIF
RETURN .T.
¿Estas buscando algún número telefónico?
Visite: www.teleguia.com.py
*:-.,_,.-:*'``'*:-.,_,.-:*:-.,_,.-:*'``'*:-.,_,.-:
:: Rodrigo Machado ::
FlaRo Sistemas
www.flaro.net
Telef: 0673 221 480
*:-.,_,.-:*'``'*:-.,_,.-:*:-.,_,.-:*'``'*:-.,_,.-:
Sent from Asuncion, Paraguay
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour