2011-06-15 13:45 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/hbide/ideeditor.prg
    ! Fixed: relaoding a source now correctly sets the READONLY 
      attribute associated with the file and also positions the cursor 
      approximately at the same position as it was before.
      This helps in keeping the same session if a file is checked 
      in/out of some version control systems which sets the attribute
      to read-only when checked in.
This commit is contained in:
Pritpal Bedi
2011-06-15 20:49:41 +00:00
parent f69e9a36ae
commit 31fc070ee5
2 changed files with 32 additions and 7 deletions

View File

@@ -16,6 +16,15 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-06-15 13:45 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/ideeditor.prg
! Fixed: relaoding a source now correctly sets the READONLY
attribute associated with the file and also positions the cursor
approximately at the same position as it was before.
This helps in keeping the same session if a file is checked
in/out of some version control systems which sets the attribute
to read-only when checked in.
2011-06-15 12:50 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/idechangelog.prg
! Fixed: a silly comparison in prev commit.

View File

@@ -1351,11 +1351,6 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, a
::oEdit:qEdit:connect( "updateRequest(QRect,int)", {|| ::scrollThumbnail() } )
::qDocument := ::qEdit:document()
#if 0
IF !( ::cType == "U" )
::qHiliter := ::oTH:SetSyntaxHilighting( ::oEdit:qEdit, @::cTheme )
ENDIF
#endif
::qCursor := ::qEdit:textCursor()
/* Populate Tabs Array */
@@ -1540,10 +1535,31 @@ METHOD IdeEditor:prepareBufferToLoad( cBuffer )
/*----------------------------------------------------------------------*/
METHOD IdeEditor:reload()
LOCAL nAttr, nPos, qCursor, nHPos, nVPos
qCursor := ::qEdit:textCursor()
nPos := qCursor:position()
nHPos := ::qEdit:horizontalScrollBar():value()
nVPos := ::qEdit:verticalScrollBar():value()
IF hb_fGetAttr( ::sourceFile, @nAttr )
::lReadOnly := hb_bitAnd( nAttr, FC_READONLY ) == FC_READONLY
ENDIF
::oEdit:setReadOnly( ::lReadOnly )
::qTabWidget:setTabIcon( ::qTabWidget:indexOf( ::oTab:oWidget ), ;
hbide_image( iif( ::lReadOnly, "tabreadonly", "tabunmodified" ) ) )
::qEdit:clear()
::qEdit:setPlainText( ::prepareBufferToLoad( hb_memoread( ::sourceFile ) ) )
qCursor:setPosition( nPos )
::qEdit:setTextCursor( qCursor )
::qEdit:horizontalScrollBar():setValue( nHPos )
::qEdit:verticalScrollBar():setValue( nVPos )
RETURN Self
/*----------------------------------------------------------------------*/
@@ -1555,11 +1571,11 @@ METHOD IdeEditor:setDocumentProperties()
IF !( ::lLoaded ) /* First Time */
::qEdit:setPlainText( ::prepareBufferToLoad( hb_memoread( ::sourceFile ) ) )
#if 1
IF !( ::cType == "U" )
::qHiliter := ::oTH:setSyntaxHilighting( ::qEdit, @::cTheme )
ENDIF
#endif
qCursor:setPosition( ::nPos )
::qEdit:setTextCursor( qCursor )