2010-01-11 08:12 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbide/ideeditor.prg
  * contrib/hbide/idesources.prg
  * contrib/hbide/resources/projectproperties.ui
    ! Re-worked "New" file management.
This commit is contained in:
Pritpal Bedi
2010-01-11 16:15:05 +00:00
parent eaa5203f84
commit 340253c3cf
4 changed files with 38 additions and 19 deletions

View File

@@ -17,6 +17,12 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-01-11 08:12 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbide/ideeditor.prg
* contrib/hbide/idesources.prg
* contrib/hbide/resources/projectproperties.ui
! Re-worked "New" file management.
2010-01-11 16:24 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
+ harbour/contrib/hbnetio/tests/netiot02.prg
+ added yet another example of NETIO client.

View File

@@ -646,6 +646,7 @@ CLASS IdeEditor INHERIT IdeObject
DATA nVPos INIT 0
DATA nID
DATA aTab INIT {}
DATA qCursor
METHOD new()
@@ -668,6 +669,13 @@ CLASS IdeEditor INHERIT IdeObject
METHOD IdeEditor:new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
DEFAULT oIde TO ::oIde
DEFAULT cSourceFile TO ::sourceFile
DEFAULT nPos TO ::nPos
DEFAULT nHPos TO ::nHPos
DEFAULT nVPos TO ::nVPos
DEFAULT cTheme TO ::cTheme
::oIde := oIde
::sourceFile := cSourceFile
::nPos := nPos
@@ -744,12 +752,12 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
::qCursor := QTextCursor():configure( ::qEdit:textCursor() )
/* Populate Tabs Array */
aadd( ::aTabs, { ::oTab, ::qEdit, ::qHiliter, ::qLayout, ::sourceFile, ::qDocument, Self } )
::aTab := { ::oTab, ::qEdit, ::qHiliter, ::qLayout, ::sourceFile, ::qDocument, Self }
aadd( ::aTabs, ::aTab )
::oIde:nCurTab := len( ::oIde:aTabs )
/* Populate right at creation */
//::oIde:addSourceInTree( ::sourceFile )
::oEM:addSourceInTree( ::sourceFile )
::qTabWidget:setStyleSheet( GetStyleSheet( "QTabWidget" ) )
@@ -910,7 +918,7 @@ METHOD IdeEditor:closeTab( mp1, mp2, oXbp )
* Requested tab exists?
IF !Empty( mp2 )
::oIde:closeSource( mp2 )
::oSM:closeSource( mp2 )
ENDIF
RETURN Self

View File

@@ -130,7 +130,7 @@ METHOD IdeSourcesManager:loadSources()
*/
METHOD IdeSourcesManager:saveSource( nTab, lCancel, lAs )
LOCAL oEdit, lNew, cBuffer, qDocument, nIndex, cSource
LOCAL cFileToSave, cFile, cExt, cNewFile
LOCAL cFileToSave, cFile, cExt, cNewFile, oItem
DEFAULT nTab TO ::oIde:getCurrentTab()
DEFAULT lAs TO .F.
@@ -138,6 +138,7 @@ METHOD IdeSourcesManager:saveSource( nTab, lCancel, lAs )
lCancel := .F.
IF !empty( oEdit := ::oEM:getEditorByTabPosition( nTab ) )
nIndex := ::qTabWidget:indexOf( oEdit:oTab:oWidget )
cSource := oEdit:sourceFile
lNew := Empty( cSource ) .OR. lAs
@@ -157,40 +158,44 @@ METHOD IdeSourcesManager:saveSource( nTab, lCancel, lAs )
cFileToSave := iif( lNew, cNewFile, cSource )
qDocument := oEdit:qDocument
cBuffer := oEdit:qEdit:toPlainText()
/*
* 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()
//
IF !hb_memowrit( cFileToSave, cBuffer )
MsgBox( "Error saving the file " + oEdit:sourceFile + ".",, 'Error saving file!' )
lCancel := .T.
RETURN .F.
ENDIF
IF lNew
hb_fNameSplit( cFileToSave, , @cFile, @cExt )
hb_fNameSplit( cFileToSave, , @cFile, @cExt )
::aTabs[ nTab, TAB_SOURCEFILE ] := cFileToSave
oEdit:sourceFile := cFileToSave
IF lNew
oEdit:aTab[ TAB_SOURCEFILE ] := cFileToSave
oEdit:sourceFile := cFileToSave
oEdit:oTab:Caption := cFile + cExt
::qTabWidget:setTabText( nIndex, cFile + cExt )
::qTabWidget:setTabTooltip( nIndex, cSource )
ENDIF
IF empty( cSource )
/* The file is not populated in editors tree. Inject */
::addSourceInTree( oEdit:sourceFile )
ELSEIF lNew
/* Rename the existing nodes in tree */
::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()
nIndex := ::qTabWidget:indexOf( oEdit:oTab:oWidget )
::qTabWidget:setTabIcon( nIndex, ::resPath + "tabunmodified.png" )
::oSBar:getItem( SB_PNL_MODIFIED ):caption := " "
ENDIF

View File

@@ -26,7 +26,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tabGeneral">
<attribute name="title">