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

* contrib/hbide/hbide.prg
  * contrib/hbide/ideactions.prg
  * contrib/hbide/ideeditor.prg
  * contrib/hbide/idethemes.prg
    ! Fixed some flow artifacts, mainly in "Files" management.
This commit is contained in:
Pritpal Bedi
2010-01-07 17:01:25 +00:00
parent d89181934b
commit 94ba515062
5 changed files with 85 additions and 47 deletions

View File

@@ -17,6 +17,13 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-01-07 08:58 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbide/hbide.prg
* contrib/hbide/ideactions.prg
* contrib/hbide/ideeditor.prg
* contrib/hbide/idethemes.prg
! Fixed some flow artifacts, mainly in "Files" management.
2010-01-07 16:10 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbnetio/utils/netiosrv.hbp
* utils/hbformat/hbformat.hbp

View File

@@ -220,6 +220,7 @@ CLASS HbIde
METHOD manageProjectContext()
METHOD loadSources()
METHOD openSource()
METHOD editSource()
METHOD selectSource()
METHOD closeSource()
@@ -415,7 +416,7 @@ METHOD HbIde:create( cProjIni )
/*----------------------------------------------------------------------*/
METHOD HbIde:execAction( cKey )
LOCAL aPrj, cHbi, cTmp, n, aSrc
LOCAL aPrj, cHbi, cTmp, n
DO CASE
CASE cKey == "Exit"
@@ -461,13 +462,11 @@ METHOD HbIde:execAction( cKey )
CASE cKey == "New"
::editSource( '' )
CASE cKey == "Open"
IF !empty( aSrc := ::selectSource( "openmany" ) )
aEval( aSrc, {|e| ::editSource( e ) } )
ENDIF
::openSource()
CASE cKey == "Save"
::saveSource( ::getCurrentTab(), , .f. )
::saveSource( ::getCurrentTab(), .f., .f. )
CASE cKey == "SaveAs"
::saveSourceAs( ::getCurrentTab(), , .t. )
::saveSource( ::getCurrentTab(), .t., .t. )
CASE cKey == "SaveAll"
::saveAllSources()
CASE cKey == "SaveExit"
@@ -596,7 +595,8 @@ METHOD HbIde:loadSources()
IF !empty( ::aIni[ INI_FILES ] )
FOR EACH a_ IN ::aIni[ INI_FILES ]
::editSource( a_[ 1 ], a_[ 2 ], a_[ 3 ], a_[ 4 ], a_[ 5 ] )
/* File nPos nVPos nHPos cTheme lAlert lVisible */
::editSource( a_[ 1 ], a_[ 2 ], a_[ 3 ], a_[ 4 ], a_[ 5 ], .t., .f. )
NEXT
::oED:setSourceVisibleByIndex( val( ::aIni[ INI_HBIDE, RecentTabIndex ] ) )
ENDIF
@@ -677,9 +677,10 @@ METHOD HbIde:saveSource( nTab, lCancel, lAs )
/*----------------------------------------------------------------------*/
METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme, lAlert )
METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme, lAlert, lVisible )
DEFAULT lAlert TO .T.
DEFAULT lAlert TO .T.
DEFAULT lVisible TO .T.
IF !Empty( cSourceFile )
IF !( hbide_isValidText( cSourceFile ) )
@@ -706,6 +707,9 @@ METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme, lAlert )
DEFAULT nVPos TO 0
::oED:buildEditor( cSourceFile, nPos, nHPos, nVPos, cTheme )
IF lVisible
::oED:setSourceVisible( cSourceFile )
ENDIF
IF !Empty( cSourceFile )
hbide_mnuAddFileToMRU( Self, cSourceFile, INI_RECENTFILES )
@@ -852,6 +856,21 @@ METHOD HbIde:revertSource( nTab )
/*----------------------------------------------------------------------*/
METHOD HbIde:openSource()
LOCAL aSrc, cSource
hbide_dbg( "openSource()" )
IF !empty( aSrc := ::selectSource( "openmany" ) )
FOR EACH cSource IN aSrc
::editSource( cSource )
NEXT
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD HbIde:selectSource( cMode, cFile, cTitle )
LOCAL oDlg, cPath
@@ -872,7 +891,7 @@ METHOD HbIde:selectSource( cMode, cFile, cTitle )
cFile := oDlg:open( , , .t. )
ELSEIF cMode == "save"
oDlg:title := iif( !hb_isChar(cTitle), "Save as...", cTitle )
oDlg:title := iif( !hb_isChar( cTitle ), "Save as...", cTitle )
oDlg:center := .t.
oDlg:defExtension:= 'prg'

View File

@@ -309,7 +309,7 @@ METHOD IdeActions:buildToolBar()
/*----------------------------------------------------------------------*/
METHOD IdeActions:buildMainMenu()
LOCAL oMenuBar, oSubMenu, oSubMenu2, n, f, lEmpty
LOCAL oMenuBar, oSubMenu, oSubMenu2, n, f
LOCAL oIde := ::oIde
oMenuBar := ::oDlg:MenuBar()
@@ -336,16 +336,15 @@ METHOD IdeActions:buildMainMenu()
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 := hbide_pathNormalized( oIde:aIni[ INI_RECENTFILES, n ], .F. )
lEmpty := .F.
oSubMenu2:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + f ), nil } )
IF !hb_FileExists(f)
oSubMenu2:disableItem( n )
ENDIF
NEXT
IF lEmpty
IF !empty( oIde:aIni[ INI_RECENTFILES ] )
FOR n := 1 TO Len( oIde:aIni[ INI_RECENTFILES ] )
f := hbide_pathNormalized( oIde:aIni[ INI_RECENTFILES, n ], .F. )
oSubMenu2:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + f ), nil } )
IF !hb_FileExists( f )
oSubMenu2:disableItem( n )
ENDIF
NEXT
ELSE
oSubMenu2:addItem( { _T( "** No recent files found **" ) , nil } )
oSubMenu2:disableItem( 1 )
ENDIF
@@ -354,16 +353,15 @@ METHOD IdeActions:buildMainMenu()
oSubMenu2 := XbpMenu():new( oSubMenu ):create()
oSubMenu2:itemSelected := {| nIndex, cFile | cFile := oIde:aIni[ INI_RECENTPROJECTS, nIndex ], ;
::oPM:loadProperties( cFile, .F., .F., .T. ) }
lEmpty := .T.
FOR n := 1 TO Len( oIde:aIni[ INI_RECENTPROJECTS ] )
f := hbide_pathNormalized( oIde:aIni[ INI_RECENTPROJECTS, n ], .F. )
lEmpty := .F.
oSubMenu2:addItem( { _T( '~' + hb_NumToHex(n) + '. ' + f ) , nil } )
IF !hb_FileExists(f)
oSubMenu2:disableItem( n )
ENDIF
NEXT
IF lEmpty
IF !empty( oIde:aIni[ INI_RECENTPROJECTS ] )
FOR n := 1 TO Len( oIde:aIni[ INI_RECENTPROJECTS ] )
f := hbide_pathNormalized( oIde:aIni[ INI_RECENTPROJECTS, n ], .F. )
oSubMenu2:addItem( { _T( '~' + hb_NumToHex( n ) + '. ' + f ) , nil } )
IF !hb_FileExists( f )
oSubMenu2:disableItem( n )
ENDIF
NEXT
ELSE
oSubMenu2:addItem( { _T( "** No recent projects found **" ) , nil } )
oSubMenu2:disableItem( 1 )
ENDIF

View File

@@ -140,7 +140,7 @@ METHOD IdeEditsManager:getEditorCurrent()
METHOD IdeEditsManager:getEditorByIndex( nIndex ) /* Index is 0 based */
LOCAL pTab, a_
IF hb_isNumeric( nIndex ) .AND. nIndex > 0 .AND. nIndex < ::qTabWidget:count()
IF hb_isNumeric( nIndex ) .AND. nIndex >= 0 .AND. nIndex < ::qTabWidget:count()
pTab := ::qTabWidget:widget( nIndex )
FOR EACH a_ IN ::aTabs
IF !empty( a_[ TAB_OTAB ] ) .AND. hbqt_IsEqualGcQtPointer( a_[ TAB_OTAB ]:oWidget:pPtr, pTab )
@@ -225,14 +225,11 @@ METHOD IdeEditsManager:setSourceVisible( cSource )
/*----------------------------------------------------------------------*/
METHOD IdeEditsManager:setSourceVisibleByIndex( nIndex )
METHOD IdeEditsManager:setSourceVisibleByIndex( nIndex ) /* nIndex is 0 based */
IF ::qTabWidget:count() > 0 .AND. ::qTabWidget:count() > nIndex /* nIndex is 0 based */
IF ::qTabWidget:currentIndex() != nIndex
::qTabWidget:setCurrentIndex( nIndex )
ELSE
::getEditorByIndex( nIndex ):setDocumentProperties()
ENDIF
IF ::qTabWidget:count() > 0 .AND. ::qTabWidget:count() > nIndex
::qTabWidget:setCurrentIndex( nIndex )
::getEditorByIndex( nIndex ):setDocumentProperties()
ENDIF
RETURN .f.
@@ -559,6 +556,7 @@ CLASS IdeEditor INHERIT IdeObject
METHOD closeTab()
METHOD dispEditInfo()
METHOD onBlockCountChanged()
METHOD onContentsChanged()
METHOD setTabImage()
METHOD applyTheme()
METHOD setDocumentProperties()
@@ -627,6 +625,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
Qt_Slots_Connect( ::pSlots, ::qEdit , "textChanged()" , {|| ::setTabImage() } )
Qt_Slots_Connect( ::pSlots, ::qEdit , "cursorPositionChanged()", {|| ::dispEditInfo() } )
Qt_Slots_Connect( ::pSlots, ::qDocument, "blockCountChanged(int)" , {|o,i| ::onBlockCountChanged( i, o ) } )
Qt_Slots_Connect( ::pSlots, ::qDocument, "contentsChanged()" , {|| ::onContentsChanged() } )
::qEdit:show()
::qCursor := QTextCursor():configure( ::qEdit:textCursor() )
@@ -642,10 +641,6 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
::qTabWidget:setStyleSheet( GetStyleSheet( "QTabWidget" ) )
::setTabImage()
hbide_dbg( " ." )
hbide_dbg( ".......................................", cSourceFile )
hbide_dbg( " ." )
RETURN Self
/*----------------------------------------------------------------------*/
@@ -653,15 +648,22 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
METHOD IdeEditor:setDocumentProperties()
LOCAL qCursor
hbide_dbg( " ." )
qCursor := QTextCursor():configure( ::qEdit:textCursor() )
IF !( ::lLoaded ) /* First Time */
hbide_dbg( "......................................." )
::lLoaded := .T.
::qEdit:setPlainText( hb_memoRead( ::sourceFile ) )
qCursor:setPosition( ::nPos )
::qEdit:setTextCursor( qCursor )
QScrollBar():configure( ::qEdit:horizontalScrollBar() ):setValue( ::nHPos )
QScrollBar():configure( ::qEdit:verticalScrollBar() ):setValue( ::nVPos )
hbide_dbg( "........................................................" )
ENDIF
::nBlock := qCursor:blockNumber()
@@ -675,6 +677,8 @@ METHOD IdeEditor:setDocumentProperties()
::oIde:manageFocusInEditor()
hbide_dbg( " ." )
RETURN Self
/*----------------------------------------------------------------------*/
@@ -827,6 +831,14 @@ METHOD IdeEditor:closeTab( mp1, mp2, oXbp )
/*----------------------------------------------------------------------*/
METHOD IdeEditor:onContentsChanged()
hbide_dbg( "onContentsChanged()" )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeEditor:onBlockCountChanged( nNewBlocks )
LOCAL nLine

View File

@@ -350,12 +350,12 @@ METHOD IdeThemes:setSyntaxRule( qHiliter, cName, cPattern, aAttr )
METHOD IdeThemes:setSyntaxFormat( qHiliter, cName, aAttr )
qHiliter:setHBFormat( cName, ::buildSyntaxFormat( aAttr ) )
qHiliter:rehighlight()
// qHiliter:rehighlight()
RETURN Self
/*----------------------------------------------------------------------*/
/* setSyntaxHilighting */
METHOD IdeThemes:setSyntaxHilighting( qEdit, cTheme, lNew )
LOCAL a_, aAttr, qHiliter
@@ -369,6 +369,8 @@ METHOD IdeThemes:setSyntaxHilighting( qEdit, cTheme, lNew )
HB_SYMBOL_UNUSED( lNew )
::setForeBackGround( qEdit, cTheme )
qHiliter := HBQSyntaxHighlighter():new( qEdit:document() )
FOR EACH a_ IN ::aPatterns
@@ -377,7 +379,6 @@ METHOD IdeThemes:setSyntaxHilighting( qEdit, cTheme, lNew )
ENDIF
NEXT
::setMultiLineCommentRule( qHiliter, cTheme )
::setForeBackGround( qEdit, cTheme )
RETURN qHiliter
@@ -532,8 +533,8 @@ METHOD IdeThemes:updateColor()
::qEdit:setStyleSheet( s )
ELSEIF aAttr[ 1 ] == "CommentsAndRemarks"
::setSyntaxFormat( ::qHiliter, aAttr[ 1 ], aAttr[ 2 ] )
::setMultiLineCommentRule( ::qHiliter, ::aThemes[ ::nCurTheme, 1 ] )
::setSyntaxFormat( ::qHiliter, aAttr[ 1 ], aAttr[ 2 ] )
ELSE
::setSyntaxFormat( ::qHiliter, aAttr[ 1 ], aAttr[ 2 ] )
@@ -554,6 +555,7 @@ METHOD IdeThemes:updateAttribute( nAttr, iState )
::aThemes[ ::nCurTheme, 2, ::nCurItem, 2, nAttr ] := ( iState == 2 )
::setSyntaxFormat( ::qHiliter, aAttr[ 1 ], aAttr[ 2 ] )
::qHiliter:rehighlight()
RETURN Self