2012-07-12 09:26 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/ideedit.prg
* contrib/hbide/ideeditor.prg
! Optimizations: what exactly should get fired with which event.
User must experience speed improvement while navigating and
editing the sources.
; NOTE: this is the first commit in series of enhancements,
optimizations and improvements in HbIDE. Please speak out
your expectations, concerns, suggestions, what-ever, about
HbIDE. Next few weeks I will be working on this tool only.
This commit is contained in:
@@ -16,6 +16,18 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-07-12 09:26 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbide/ideedit.prg
|
||||
* contrib/hbide/ideeditor.prg
|
||||
! Optimizations: what exactly should get fired with which event.
|
||||
User must experience speed improvement while navigating and
|
||||
editing the sources.
|
||||
|
||||
; NOTE: this is the first commit in series of enhancements,
|
||||
optimizations and improvements in HbIDE. Please speak out
|
||||
your expectations, concerns, suggestions, what-ever, about
|
||||
HbIDE. Next few weeks I will be working on this tool only.
|
||||
|
||||
2012-04-12 18:22 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
|
||||
* harbour/src/common/hbdate.c
|
||||
* increased stability of hb_dateDecode() for date values having year > 9999
|
||||
|
||||
@@ -136,6 +136,7 @@ CLASS IdeEdit INHERIT IdeObject
|
||||
DATA isColumnSelectionON INIT .F.
|
||||
DATA lReadOnly INIT .F.
|
||||
DATA isHighLighted INIT .f.
|
||||
DATA cLastWord, cCurWord
|
||||
|
||||
METHOD new( oIde, oEditor, nMode )
|
||||
METHOD create( oIde, oEditor, nMode )
|
||||
@@ -248,6 +249,7 @@ CLASS IdeEdit INHERIT IdeObject
|
||||
METHOD parseCodeCompletion( cSyntax )
|
||||
|
||||
METHOD highlightPage()
|
||||
METHOD reformatLine( nPos, nAdded, nDeleted )
|
||||
|
||||
ENDCLASS
|
||||
|
||||
@@ -376,14 +378,14 @@ METHOD IdeEdit:disconnectEditSignals()
|
||||
METHOD IdeEdit:connectEditSignals()
|
||||
|
||||
::qEdit:connect( "customContextMenuRequested(QPoint)", {|p | ::execEvent( 1, p ) } )
|
||||
::qEdit:connect( "textChanged()" , {| | ::execEvent( 2, ) } )
|
||||
::qEdit:connect( "selectionChanged()" , {|p | ::execEvent( 6, p ) } )
|
||||
::qEdit:connect( "cursorPositionChanged()" , {| | ::execEvent( 9, ) } )
|
||||
::qEdit:connect( "copyAvailable(bool)" , {|p | ::execEvent( 3, p ) } )
|
||||
|
||||
#if 0
|
||||
::qEdit:connect( "updateRequest(QRect,int)" , {|p,p1| ::execEvent( updateRequest, p, p1 ) } )
|
||||
::qEdit:connect( "modificationChanged(bool)" , {|p | ::execEvent( 4, p ) } )
|
||||
::qEdit:connect( "textChanged()" , {| | ::execEvent( 2, ) } )
|
||||
::qEdit:connect( "updateRequest(QRect,int)" , {|p,p1| ::execEvent( updateRequest, p, p1 ) } )
|
||||
::qEdit:connect( "redoAvailable(bool)" , {|p | ::execEvent( 5, p ) } )
|
||||
::qEdit:connect( "undoAvailable(bool)" , {|p | ::execEvent( 7, p ) } )
|
||||
#endif
|
||||
@@ -393,7 +395,7 @@ METHOD IdeEdit:connectEditSignals()
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEdit:execEvent( nMode, p, p1 )
|
||||
LOCAL qAct, n, qCursor, cProto, nRows, nCols, cAct
|
||||
LOCAL qAct, n, qCursor, cAct
|
||||
|
||||
HB_SYMBOL_UNUSED( p1 )
|
||||
|
||||
@@ -406,6 +408,55 @@ METHOD IdeEdit:execEvent( nMode, p, p1 )
|
||||
|
||||
SWITCH nMode
|
||||
|
||||
CASE timerTimeout
|
||||
IF empty( ::cProto )
|
||||
::hidePrototype()
|
||||
ELSE
|
||||
::showPrototype()
|
||||
ENDIF
|
||||
EXIT
|
||||
|
||||
CASE cursorPositionChanged
|
||||
::oEditor:dispEditInfo( ::qEdit ) /* Is a MUST */
|
||||
::markCurrentFunction() /* Optimized */
|
||||
EXIT
|
||||
|
||||
CASE selectionChanged
|
||||
::oEditor:qCqEdit := ::qEdit
|
||||
::oEditor:qCoEdit := Self
|
||||
|
||||
/* Book Marks reach-out buttons */
|
||||
::relayMarkButtons()
|
||||
::updateTitleBar()
|
||||
|
||||
::toggleCurrentLineHighlightMode()
|
||||
::toggleLineNumbers()
|
||||
::toggleHorzRuler()
|
||||
::dispStatusInfo()
|
||||
|
||||
::qEdit:hbGetSelectionInfo()
|
||||
IF ::aSelectionInfo[ 1 ] > -1 .AND. ::aSelectionInfo[ 1 ] == ::aSelectionInfo[ 3 ]
|
||||
::oDK:setStatusText( SB_PNL_SELECTEDCHARS, Len( ::getSelectedText() ) )
|
||||
ELSE
|
||||
::oDK:setStatusText( SB_PNL_SELECTEDCHARS, 0 )
|
||||
ENDIF
|
||||
::oUpDn:show()
|
||||
::unHighlight()
|
||||
|
||||
IF HB_ISOBJECT( ::oEditor:qHiliter )
|
||||
::oEditor:qHiliter:hbSetEditor( ::qEdit )
|
||||
::qEdit:hbSetHighlighter( ::oEditor:qHiliter )
|
||||
::qEdit:hbHighlightPage()
|
||||
ENDIF
|
||||
EXIT
|
||||
|
||||
CASE copyAvailable
|
||||
IF p .AND. ::lCopyWhenDblClicked
|
||||
::qEdit:copy()
|
||||
ENDIF
|
||||
::lCopyWhenDblClicked := .f.
|
||||
EXIT
|
||||
|
||||
CASE customContextMenuRequested
|
||||
::oEM:aActions[ 17, 2 ]:setEnabled( !empty( qCursor:selectedText() ) )
|
||||
|
||||
@@ -477,81 +528,14 @@ METHOD IdeEdit:execEvent( nMode, p, p1 )
|
||||
ENDSWITCH
|
||||
EXIT
|
||||
|
||||
CASE textChanged
|
||||
//HB_TRACE( HB_TR_DEBUG, "textChanged()" )
|
||||
::oEditor:setTabImage( ::qEdit )
|
||||
EXIT
|
||||
|
||||
CASE selectionChanged
|
||||
//HB_TRACE( HB_TR_DEBUG, "selectionChanged()" )
|
||||
|
||||
::oEditor:qCqEdit := ::qEdit
|
||||
::oEditor:qCoEdit := Self
|
||||
|
||||
/* Book Marks reach-out buttons */
|
||||
::relayMarkButtons()
|
||||
::updateTitleBar()
|
||||
|
||||
::toggleCurrentLineHighlightMode()
|
||||
::toggleLineNumbers()
|
||||
::toggleHorzRuler()
|
||||
::dispStatusInfo()
|
||||
|
||||
::qEdit:hbGetSelectionInfo()
|
||||
IF ::aSelectionInfo[ 1 ] > -1 .AND. ::aSelectionInfo[ 1 ] == ::aSelectionInfo[ 3 ]
|
||||
::oDK:setStatusText( SB_PNL_SELECTEDCHARS, Len( ::getSelectedText() ) )
|
||||
ELSE
|
||||
::oDK:setStatusText( SB_PNL_SELECTEDCHARS, 0 )
|
||||
ENDIF
|
||||
::oUpDn:show()
|
||||
::unHighlight()
|
||||
|
||||
IF HB_ISOBJECT( ::oEditor:qHiliter )
|
||||
::oEditor:qHiliter:hbSetEditor( ::qEdit )
|
||||
::qEdit:hbSetHighlighter( ::oEditor:qHiliter )
|
||||
::qEdit:hbHighlightPage()
|
||||
ENDIF
|
||||
|
||||
EXIT
|
||||
|
||||
CASE cursorPositionChanged
|
||||
//HB_TRACE( HB_TR_DEBUG, "cursorPositionChanged()", ::nProtoLine, ::nProtoCol, ::isSuspended, ::getLineNo(), ::getColumnNo(), ::cProto )
|
||||
::oEditor:dispEditInfo( ::qEdit )
|
||||
::handlePreviousWord( ::lUpdatePrevWord )
|
||||
::handleCurrentIndent()
|
||||
|
||||
::markCurrentFunction()
|
||||
|
||||
IF ::nProtoLine != -1
|
||||
IF ::getLineNo() == ::nProtoLine .AND. ::getColumnNo() >= ::nProtoCol + 1
|
||||
IF !empty( cProto := hbide_formatProto_1( ::cProtoOrg, ::getLine(), ::nProtoCol, ::getColumnNo(), @nRows, @nCols ) )
|
||||
::cProto := cProto
|
||||
::nProtoRows := nRows
|
||||
::nProtoCols := nCols
|
||||
::showProtoType()
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
EXIT
|
||||
|
||||
CASE copyAvailable
|
||||
IF p .AND. ::lCopyWhenDblClicked
|
||||
::qEdit:copy()
|
||||
ENDIF
|
||||
::lCopyWhenDblClicked := .f.
|
||||
EXIT
|
||||
|
||||
CASE timerTimeout
|
||||
IF empty( ::cProto )
|
||||
::hidePrototype()
|
||||
ELSE
|
||||
::showPrototype()
|
||||
ENDIF
|
||||
EXIT
|
||||
|
||||
#if 0
|
||||
CASE textChanged
|
||||
// HB_TRACE( HB_TR_ALWAYS, "textChanged()" )
|
||||
// ::oEditor:setTabImage( ::qEdit )
|
||||
// ::handlePreviousWord( ::lUpdatePrevWord )
|
||||
EXIT
|
||||
CASE modificationChanged
|
||||
//HB_TRACE( HB_TR_DEBUG, "modificationChanged(bool)", p )
|
||||
::oEditor:setTabImage( ::qEdit )
|
||||
EXIT
|
||||
CASE redoAvailable
|
||||
//HB_TRACE( HB_TR_DEBUG, "redoAvailable(bool)", p )
|
||||
@@ -1432,14 +1416,16 @@ METHOD IdeEdit:toPreviousFunction()
|
||||
METHOD IdeEdit:markCurrentFunction()
|
||||
LOCAL n
|
||||
|
||||
IF ::nPrevLineNo1 != ::getLineNo()
|
||||
::nPrevLineNo1 := ::getLineNo()
|
||||
|
||||
IF ( n := ::currentFunctionIndex() ) > 0
|
||||
::oIde:oFuncList:setItemColorFG( ::aTags[ n,7 ], { 255,0,0 } )
|
||||
::oIde:oFuncList:setVisible( ::aTags[ n,7 ] )
|
||||
IF ::oFuncDock:oWidget:isVisible()
|
||||
IF ::nPrevLineNo1 != ::getLineNo()
|
||||
::nPrevLineNo1 := ::getLineNo()
|
||||
IF ( n := ::currentFunctionIndex() ) > 0
|
||||
::oIde:oFuncList:setItemColorFG( ::aTags[ n,7 ], { 255,0,0 } )
|
||||
::oIde:oFuncList:setVisible( ::aTags[ n,7 ] )
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -2174,6 +2160,40 @@ METHOD IdeEdit:insertText( cText )
|
||||
ENDIF
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* called via qDocument:contentsChange(*/
|
||||
|
||||
METHOD IdeEdit:reformatLine( nPos, nAdded, nDeleted )
|
||||
LOCAL cProto, nRows, nCols
|
||||
//LOCAL cWord, nColumn
|
||||
//LOCAL qCursor := ::qEdit:textCursor()
|
||||
//LOCAL cLine := ::getLine()
|
||||
|
||||
HB_SYMBOL_UNUSED( nPos )
|
||||
HB_SYMBOL_UNUSED( nAdded )
|
||||
HB_SYMBOL_UNUSED( nDeleted )
|
||||
|
||||
//nColumn := qCursor:columnNumber() + 1
|
||||
//cWord := ::getWord()
|
||||
|
||||
//HB_TRACE( HB_TR_ALWAYS, nPos, nAdded, nDeleted, nColumn, len( cWord ), cWord )
|
||||
|
||||
::handlePreviousWord( ::lUpdatePrevWord )
|
||||
::handleCurrentIndent()
|
||||
|
||||
IF ::nProtoLine != -1
|
||||
IF ::getLineNo() == ::nProtoLine .AND. ::getColumnNo() >= ::nProtoCol + 1
|
||||
IF !empty( cProto := hbide_formatProto_1( ::cProtoOrg, ::getLine(), ::nProtoCol, ::getColumnNo(), @nRows, @nCols ) )
|
||||
::cProto := cProto
|
||||
::nProtoRows := nRows
|
||||
::nProtoCols := nCols
|
||||
::showProtoType()
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEdit:handlePreviousWord( lUpdatePrevWord )
|
||||
|
||||
@@ -1267,7 +1267,7 @@ CLASS IdeEditor INHERIT IdeObject
|
||||
METHOD split( nOrient, oEditP )
|
||||
METHOD relay( oEdit )
|
||||
METHOD destroy()
|
||||
METHOD execEvent( cEvent, p )
|
||||
METHOD execEvent( cEvent, p, p1, p2 )
|
||||
METHOD setDocumentProperties()
|
||||
METHOD activateTab( mp1, mp2, oXbp )
|
||||
METHOD buildTabPage( cSource )
|
||||
@@ -1386,9 +1386,10 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, a
|
||||
::qEdit:setTextInteractionFlags( Qt_TextSelectableByMouse + Qt_TextSelectableByKeyboard )
|
||||
ENDIF
|
||||
|
||||
::qDocument:connect( "modificationChanged(bool)" , {|p| ::execEvent( "qDocModificationChanged", p ) } )
|
||||
::qDocument:connect( "contentsChange(int,int,int)", {|p,p1,p2| ::execEvent( "qDocContentsChange", p, p1, p2 ) } )
|
||||
|
||||
::qDocument:setModified( .f. )
|
||||
::qTabWidget:setTabIcon( ::qTabWidget:indexOf( ::oTab:oWidget ), ;
|
||||
QIcon( hbide_image( iif( ::lReadOnly, "tabreadonly", "tabunmodified" ) ) ) )
|
||||
|
||||
RETURN Self
|
||||
|
||||
@@ -1409,8 +1410,6 @@ METHOD IdeEditor:destroy()
|
||||
/* This code is reached under normal circumstances, so delete auto saved file */
|
||||
ferase( hbide_pathToOSPath( ::cPath + ::cFile + ::cExt + ".tmp" ) )
|
||||
|
||||
// ::qHiliter := NIL
|
||||
|
||||
::qCqEdit := NIL
|
||||
::qCoEdit := NIL
|
||||
::qEdit := NIL
|
||||
@@ -1606,9 +1605,7 @@ METHOD IdeEditor:reload()
|
||||
ENDIF
|
||||
|
||||
::oEdit:setReadOnly( ::lReadOnly )
|
||||
|
||||
::qTabWidget:setTabIcon( ::qTabWidget:indexOf( ::oTab:oWidget ), ;
|
||||
QIcon( hbide_image( iif( ::lReadOnly, "tabreadonly", "tabunmodified" ) ) ) )
|
||||
::setTabImage()
|
||||
|
||||
::qEdit:clear()
|
||||
::qEdit:setPlainText( ::prepareBufferToLoad( hb_memoread( ::sourceFile ) ) )
|
||||
@@ -1642,8 +1639,6 @@ METHOD IdeEditor:setDocumentProperties()
|
||||
|
||||
::qEdit:document():setModified( .f. )
|
||||
|
||||
::qTabWidget:setTabIcon( ::qTabWidget:indexOf( ::oTab:oWidget ), ;
|
||||
QIcon( hbide_image( iif( ::lReadOnly, "tabreadonly", "tabunmodified" ) ) ) )
|
||||
::lLoaded := .T.
|
||||
|
||||
IF HB_ISOBJECT( ::qHiliter )
|
||||
@@ -1677,17 +1672,25 @@ METHOD IdeEditor:setDocumentProperties()
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEditor:execEvent( cEvent, p )
|
||||
METHOD IdeEditor:execEvent( cEvent, p, p1, p2 )
|
||||
LOCAL cFileTemp, aPops := {}
|
||||
|
||||
p := p
|
||||
|
||||
IF ::lQuitting
|
||||
RETURN Self
|
||||
ENDIF
|
||||
|
||||
SWITCH cEvent
|
||||
|
||||
CASE "qDocModificationChanged"
|
||||
::setTabImage()
|
||||
EXIT
|
||||
|
||||
CASE "qDocContentsChange"
|
||||
IF p1 + p2 > 0
|
||||
::oEdit:reformatLine( p, p1, p2 )
|
||||
ENDIF
|
||||
EXIT
|
||||
|
||||
CASE "qTimeSave_timeout"
|
||||
IF ::qDocument:isModified()
|
||||
cFileTemp := hbide_pathToOSPath( ::cPath + ::cFile + ::cExt + ".tmp" )
|
||||
|
||||
Reference in New Issue
Block a user