2010-15-16 21:05 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbide/resources/tabreadonly.png
    ! Changed: to reflect clearly visible readonly status.

  * contrib/hbide/ideedit.prg
  * contrib/hbide/ideeditor.prg
    + Implemented: <MainMenu><Edit><Switch ReadOnly Mode> plus 
        file's "readonly" attribute obtained by hb_fGetAttr() == 33
        ( please correct me if it is not OK on all systems ).
        
        "Switch ReadOnly Mode" toggles the readonly status of the 
        current source in focus only if on disk attribute is normal.
        ReadOnly status is permanent if disk attribute equals 33 and 
        cannot be toggled.

        While in readonly mode, cut/paste/alter operation are suspened,
        only copy operation is supported. Copy can be performed with
        mouse and keyboard both and all three modes are available.
This commit is contained in:
Pritpal Bedi
2010-05-17 04:33:03 +00:00
parent 967945e86e
commit 1a264692f1
4 changed files with 93 additions and 20 deletions

View File

@@ -17,6 +17,25 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-15-16 21:05 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbide/resources/tabreadonly.png
! Changed: to reflect clearly visible readonly status.
* contrib/hbide/ideedit.prg
* contrib/hbide/ideeditor.prg
+ Implemented: <MainMenu><Edit><Switch ReadOnly Mode> plus
file's "readonly" attribute obtained by hb_fGetAttr() == 33
( please correct me if it is not OK on all systems ).
"Switch ReadOnly Mode" toggles the readonly status of the
current source in focus only if on disk attribute is normal.
ReadOnly status is permanent if disk attribute equals 33 and
cannot be toggled.
While in readonly mode, cut/paste/alter operation are suspened,
only copy operation is supported. Copy can be performed with
mouse and keyboard both and all three modes are available.
2010-05-17 00:59 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/sddfb/sddfb.hbi
! Sync with recent fix in contrib/hbfbird/hbfbird.hbi.

View File

@@ -110,26 +110,27 @@ CLASS IdeEdit INHERIT IdeObject
DATA aBookMarks INIT {}
DATA lModified INIT .F.
DATA lIndentIt INIT .f.
DATA lUpdatePrevWord INIT .f.
DATA lCopyWhenDblClicked INIT .f.
DATA lIndentIt INIT .F.
DATA lUpdatePrevWord INIT .F.
DATA lCopyWhenDblClicked INIT .F.
DATA cCurLineText INIT ""
DATA cProto INIT ""
DATA qTimer
DATA nProtoLine INIT -1
DATA nProtoCol INIT -1
DATA isSuspended INIT .f.
DATA isSuspended INIT .F.
DATA fontFamily INIT "Courier New"
DATA pointSize INIT 10
DATA currentPointSize INIT 10
DATA qFont
DATA aBlockCopyContents INIT {}
DATA isLineSelectionON INIT .f.
DATA aSelectionInfo INIT { -1,-1,-1,-1,0,0 }
DATA isLineSelectionON INIT .F.
DATA aSelectionInfo INIT { -1,-1,-1,-1,1,0 }
DATA isColumnSelectionON INIT .f.
DATA isColumnSelectionON INIT .F.
DATA lReadOnly INIT .F.
METHOD new( oEditor, nMode )
METHOD create( oEditor, nMode )
@@ -147,7 +148,7 @@ CLASS IdeEdit INHERIT IdeObject
METHOD selectAll()
METHOD toggleSelectionMode()
METHOD setReadOnly()
METHOD setReadOnly( lReadOnly )
METHOD setNewMark()
METHOD gotoMark( nIndex )
METHOD duplicateLine()
@@ -809,6 +810,10 @@ METHOD IdeEdit:copyBlockContents( aCord )
METHOD IdeEdit:pasteBlockContents( nMode )
LOCAL i, nCol, qCursor, nMaxCol, aCopy, a_, nPasteMode
IF ::lReadOnly
RETURN Self
ENDIF
aCopy := hbide_memoToArray( QClipboard():new():text() )
IF empty( aCopy )
RETURN Self
@@ -874,6 +879,10 @@ METHOD IdeEdit:pasteBlockContents( nMode )
METHOD IdeEdit:insertBlockContents( aCord )
LOCAL nT, nL, nB, nR, nW, i, cLine, cKey, qCursor
IF ::lReadOnly
RETURN Self
ENDIF
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
nW := nR - nL
@@ -913,6 +922,10 @@ METHOD IdeEdit:insertBlockContents( aCord )
METHOD IdeEdit:deleteBlockContents( aCord )
LOCAL nT, nL, nB, nR, nW, i, cLine, qCursor, k, nSelMode
IF ::lReadOnly
RETURN Self
ENDIF
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
k := aCord[ 7 ]
k := iif( empty( k ), Qt_Key_X, k )
@@ -921,7 +934,7 @@ METHOD IdeEdit:deleteBlockContents( aCord )
ENDIF
nSelMode := aCord[ 5 ]
//HB_TRACE( HB_TR_ALWAYS, nT, nL, nB, nR, nSelMode )
qCursor := QTextCursor():from( ::qEdit:textCursor() )
qCursor:beginEditBlock()
@@ -976,6 +989,10 @@ METHOD IdeEdit:blockComment()
LOCAL cComment := "// "
LOCAL nLen := len( cComment )
IF ::lReadOnly
RETURN Self
ENDIF
::qEdit:hbGetSelectionInfo(); aCord := ::aSelectionInfo
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
nW := nR - nL
@@ -1017,6 +1034,10 @@ METHOD IdeEdit:blockComment()
METHOD IdeEdit:streamComment()
LOCAL nT, nL, nB, nR, nW, i, cLine, qCursor, aCord, nMode, q_
IF ::lReadOnly
RETURN Self
ENDIF
::qEdit:hbGetSelectionInfo(); aCord := ::aSelectionInfo
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
@@ -1059,6 +1080,10 @@ METHOD IdeEdit:streamComment()
METHOD IdeEdit:blockIndent( nDirctn )
LOCAL nT, nL, nB, nR, nW, i, cLine, qCursor, aCord, q_, nMode, cLineSel
IF ::lReadOnly
RETURN Self
ENDIF
::qEdit:hbGetSelectionInfo(); aCord := ::aSelectionInfo
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
nW := nR - nL
@@ -1106,6 +1131,10 @@ METHOD IdeEdit:blockIndent( nDirctn )
METHOD IdeEdit:blockConvert( cMode )
LOCAL nT, nL, nB, nR, nW, i, cLine, qCursor, aCord, q_, nMode
IF ::lReadOnly
RETURN Self
ENDIF
::qEdit:hbGetSelectionInfo(); aCord := ::aSelectionInfo
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
nW := nR - nL
@@ -1276,6 +1305,9 @@ METHOD IdeEdit:undo()
/*----------------------------------------------------------------------*/
METHOD IdeEdit:cut()
IF ::lReadOnly
RETURN Self
ENDIF
::qEdit:hbCut( Qt_Key_X )
RETURN Self
@@ -1288,6 +1320,9 @@ METHOD IdeEdit:copy()
/*----------------------------------------------------------------------*/
METHOD IdeEdit:paste()
IF ::lReadOnly
RETURN Self
ENDIF
::qEdit:hbPaste()
RETURN Self
@@ -1299,8 +1334,16 @@ METHOD IdeEdit:selectAll()
/*----------------------------------------------------------------------*/
METHOD IdeEdit:setReadOnly()
::qEdit:setReadOnly( .t. ) // ! ::qEdit:isReadOnly() )
METHOD IdeEdit:setReadOnly( lReadOnly )
IF ::oEditor:lReadOnly
lReadOnly := .t.
ELSE
IF ! hb_isLogical( lReadOnly )
lReadOnly := ! ::qEdit:isReadOnly()
ENDIF
ENDIF
::lReadOnly := lReadOnly
::qEdit:setReadOnly( lReadOnly )
::oEditor:setTabImage()
RETURN Self

View File

@@ -1021,6 +1021,7 @@ CLASS IdeEditor INHERIT IdeObject
DATA nnRow INIT -99
DATA qEvents
DATA lReadOnly INIT .F.
METHOD new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView )
METHOD create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, aBookMarks )
@@ -1064,7 +1065,7 @@ METHOD IdeEditor:new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView )
/*----------------------------------------------------------------------*/
METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, aBookMarks )
LOCAL cFileTemp
LOCAL cFileTemp, nAttr
DEFAULT oIde TO ::oIde
DEFAULT cSourceFile TO ::sourceFile
@@ -1098,6 +1099,9 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, a
ferase( cFileTemp )
ENDIF
ENDIF
IF hb_fGetAttr( cSourceFile, @nAttr )
::lReadOnly := ( nAttr == 33 )
ENDIF
::cType := upper( strtran( ::cExt, ".", "" ) )
::cType := iif( ::cType $ "PRG,C,CPP,H,CH,PPO", ::cType, "U" )
@@ -1136,6 +1140,10 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, a
::oEM:addSourceInTree( ::sourceFile, ::cView )
::qTabWidget:setStyleSheet( GetStyleSheet( "QTabWidget", ::nAnimantionMode ) )
IF ::lReadOnly
::oEdit:setReadOnly( .t. )
::qEdit:setTextInteractionFlags( Qt_TextSelectableByMouse + Qt_TextSelectableByKeyboard )
ENDIF
::setTabImage()
RETURN Self
@@ -1214,7 +1222,8 @@ METHOD IdeEditor:setDocumentProperties()
QTextDocument():configure( ::qEdit:document() ):setModified( .f. )
::qTabWidget:setTabIcon( ::qTabWidget:indexOf( ::oTab:oWidget ), ::resPath + "tabunmodified.png" )
::qTabWidget:setTabIcon( ::qTabWidget:indexOf( ::oTab:oWidget ), ;
hbide_image( iif( ::lReadOnly, "tabreadonly", "tabunmodified" ) ) )
::lLoaded := .T.
IF ::cType $ "PRG,C,CPP,H,CH"
@@ -1387,17 +1396,19 @@ METHOD IdeEditor:setTabImage( qEdit )
nIndex := ::qTabWidget:indexOf( ::oTab:oWidget )
lModified := ::qDocument:isModified()
lReadOnly := qEdit:isReadOnly()
lReadOnly := iif( ::lReadOnly, ::lReadOnly, qEdit:isReadOnly() )
IF lModified
cIcon := "tabmodified.png"
ELSEIF lReadOnly
cIcon := "tabreadonly.png"
IF lReadOnly
cIcon := "tabreadonly"
ELSE
cIcon := "tabunmodified.png"
IF lModified
cIcon := "tabmodified"
ELSE
cIcon := "tabunmodified"
ENDIF
ENDIF
::qTabWidget:setTabIcon( nIndex, ::resPath + cIcon )
::qTabWidget:setTabIcon( nIndex, hbide_image( cIcon ) )
::oDK:setStatusText( SB_PNL_MODIFIED, iif( lModified, "Modified", iif( lReadOnly, "ReadOnly", " " ) ) )
RETURN Self

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 118 B