2012-07-14 13:50 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/ideedit.prg
* contrib/hbide/ideeditor.prg
* contrib/hbide/idefindreplace.prg
* contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp
* contrib/hbqt/qtgui/hbqt_hbqplaintextedit.h
* contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth
- Deleted some methods.
% Optimized code flow.
This fixes many minor glitches in editing.
This commit is contained in:
@@ -16,6 +16,17 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-07-14 13:50 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbide/ideedit.prg
|
||||
* contrib/hbide/ideeditor.prg
|
||||
* contrib/hbide/idefindreplace.prg
|
||||
* contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp
|
||||
* contrib/hbqt/qtgui/hbqt_hbqplaintextedit.h
|
||||
* contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth
|
||||
- Deleted some methods.
|
||||
% Optimized code flow.
|
||||
This fixes many minor glitches in editing.
|
||||
|
||||
2012-07-14 03:59 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbqt/hbmk2_qt.hb
|
||||
- Reverted: a minor change in logic which produced regression at a
|
||||
|
||||
@@ -72,21 +72,21 @@
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#define customContextMenuRequested 1
|
||||
#define textChanged 2
|
||||
#define copyAvailable 3
|
||||
#define modificationChanged 4
|
||||
#define redoAvailable 5
|
||||
#define selectionChanged 6
|
||||
#define undoAvailable 7
|
||||
#define updateRequest 8
|
||||
#define cursorPositionChanged 9
|
||||
#define __customContextMenuRequested 1
|
||||
#define __textChanged 2
|
||||
#define __copyAvailable 3
|
||||
#define __modificationChanged 4
|
||||
#define __redoAvailable 5
|
||||
#define __selectionChanged 6
|
||||
#define __undoAvailable 7
|
||||
#define __updateRequest 8
|
||||
#define __cursorPositionChanged 9
|
||||
|
||||
#define timerTimeout 23
|
||||
#define __timerTimeout 23
|
||||
|
||||
#define selectionMode_stream 1
|
||||
#define selectionMode_column 2
|
||||
#define selectionMode_line 3
|
||||
#define __selectionMode_stream 1
|
||||
#define __selectionMode_column 2
|
||||
#define __selectionMode_line 3
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -212,10 +212,10 @@ CLASS IdeEdit INHERIT IdeObject
|
||||
METHOD isModified() INLINE ::oEditor:qDocument:isModified()
|
||||
METHOD setFont()
|
||||
METHOD markCurrentFunction()
|
||||
METHOD copyBlockContents( aCord )
|
||||
METHOD pasteBlockContents( nMode )
|
||||
METHOD copyBlockContents()
|
||||
METHOD pasteBlockContents()
|
||||
METHOD insertBlockContents( aCord )
|
||||
METHOD deleteBlockContents( aCord )
|
||||
METHOD deleteBlockContents( k )
|
||||
METHOD zoom( nKey )
|
||||
METHOD blockConvert( cMode )
|
||||
METHOD dispStatusInfo()
|
||||
@@ -320,7 +320,7 @@ METHOD IdeEdit:create( oIde, oEditor, nMode )
|
||||
|
||||
::qTimer := QTimer()
|
||||
::qTimer:setInterval( 2000 )
|
||||
::qTimer:connect( "timeout()", {|| ::execEvent( timerTimeout ) } )
|
||||
::qTimer:connect( "timeout()", {|| ::execEvent( __timerTimeout ) } )
|
||||
|
||||
RETURN Self
|
||||
|
||||
@@ -378,17 +378,17 @@ METHOD IdeEdit:disconnectEditSignals()
|
||||
|
||||
METHOD IdeEdit:connectEditSignals()
|
||||
|
||||
::qEdit:connect( "customContextMenuRequested(QPoint)", {|p | ::execEvent( 1, p ) } )
|
||||
::qEdit:connect( "selectionChanged()" , {|p | ::execEvent( 6, p ) } )
|
||||
::qEdit:connect( "cursorPositionChanged()" , {| | ::execEvent( 9, ) } )
|
||||
::qEdit:connect( "copyAvailable(bool)" , {|p | ::execEvent( 3, p ) } )
|
||||
::qEdit:connect( "customContextMenuRequested(QPoint)", {|p | ::execEvent( __customContextMenuRequested, p ) } )
|
||||
::qEdit:connect( "selectionChanged()" , {|p | ::execEvent( __selectionChanged, p ) } )
|
||||
::qEdit:connect( "cursorPositionChanged()" , {| | ::execEvent( __cursorPositionChanged, ) } )
|
||||
::qEdit:connect( "copyAvailable(bool)" , {|p | ::execEvent( __copyAvailable, p ) } )
|
||||
|
||||
#if 0
|
||||
::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 ) } )
|
||||
::qEdit:connect( "modificationChanged(bool)" , {|p | ::execEvent( __modificationChanged, p ) } )
|
||||
::qEdit:connect( "textChanged()" , {| | ::execEvent( __textChanged ) } )
|
||||
::qEdit:connect( "updateRequest(QRect,int)" , {|p,p1| ::execEvent( __updateRequest, p, p1 ) } )
|
||||
::qEdit:connect( "redoAvailable(bool)" , {|p | ::execEvent( __redoAvailable, p ) } )
|
||||
::qEdit:connect( "undoAvailable(bool)" , {|p | ::execEvent( __undoAvailable, p ) } )
|
||||
#endif
|
||||
|
||||
RETURN NIL
|
||||
@@ -409,7 +409,7 @@ METHOD IdeEdit:execEvent( nMode, p, p1 )
|
||||
|
||||
SWITCH nMode
|
||||
|
||||
CASE timerTimeout
|
||||
CASE __timerTimeout
|
||||
IF empty( ::cProto )
|
||||
::hidePrototype()
|
||||
ELSE
|
||||
@@ -417,42 +417,39 @@ METHOD IdeEdit:execEvent( nMode, p, p1 )
|
||||
ENDIF
|
||||
EXIT
|
||||
|
||||
CASE cursorPositionChanged
|
||||
CASE __cursorPositionChanged
|
||||
::oEditor:dispEditInfo( ::qEdit ) /* Is a MUST */
|
||||
::markCurrentFunction() /* Optimized */
|
||||
EXIT
|
||||
|
||||
CASE selectionChanged
|
||||
CASE __selectionChanged
|
||||
lOtherEdit := ! ( ::oEditor:qCqEdit == ::qEdit )
|
||||
IF lOtherEdit
|
||||
::oEditor:qCqEdit := ::qEdit
|
||||
::oEditor:qCoEdit := Self
|
||||
|
||||
::unHighlight()
|
||||
|
||||
IF HB_ISOBJECT( ::oEditor:qHiliter )
|
||||
::oEditor:qHiliter:hbSetEditor( ::qEdit )
|
||||
::qEdit:hbSetHighlighter( ::oEditor:qHiliter )
|
||||
ENDIF
|
||||
ENDIF
|
||||
#if 0 /* Disabled for now, has a big speed disadvantage */
|
||||
::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
|
||||
#endif
|
||||
|
||||
::unHighlight()
|
||||
::oUpDn:show( Self )
|
||||
EXIT
|
||||
|
||||
CASE copyAvailable
|
||||
CASE __copyAvailable
|
||||
IF p .AND. ::lCopyWhenDblClicked
|
||||
::qEdit:copy()
|
||||
ENDIF
|
||||
::lCopyWhenDblClicked := .f.
|
||||
EXIT
|
||||
|
||||
CASE customContextMenuRequested
|
||||
CASE __customContextMenuRequested
|
||||
::oEM:aActions[ 17, 2 ]:setEnabled( !empty( qCursor:selectedText() ) )
|
||||
|
||||
n := ascan( ::oEditor:aEdits, {|o| o == Self } )
|
||||
@@ -524,21 +521,21 @@ METHOD IdeEdit:execEvent( nMode, p, p1 )
|
||||
EXIT
|
||||
|
||||
#if 0
|
||||
CASE textChanged
|
||||
CASE __textChanged
|
||||
// HB_TRACE( HB_TR_ALWAYS, "textChanged()" )
|
||||
// ::oEditor:setTabImage( ::qEdit )
|
||||
// ::handlePreviousWord( ::lUpdatePrevWord )
|
||||
EXIT
|
||||
CASE modificationChanged
|
||||
CASE __modificationChanged
|
||||
::oEditor:setTabImage( ::qEdit )
|
||||
EXIT
|
||||
CASE redoAvailable
|
||||
CASE __redoAvailable
|
||||
//HB_TRACE( HB_TR_DEBUG, "redoAvailable(bool)", p )
|
||||
EXIT
|
||||
CASE undoAvailable
|
||||
CASE __undoAvailable
|
||||
//HB_TRACE( HB_TR_DEBUG, "undoAvailable(bool)", p )
|
||||
EXIT
|
||||
CASE updateRequest
|
||||
CASE __updateRequest
|
||||
EXIT
|
||||
#endif
|
||||
ENDSWITCH
|
||||
@@ -568,7 +565,6 @@ METHOD IdeEdit:execKeyEvent( nMode, nEvent, p, p1 )
|
||||
|
||||
SWITCH ( key )
|
||||
|
||||
|
||||
CASE Qt_Key_F3
|
||||
IF ! lCtrl .AND. ! lAlt
|
||||
::oFR:find( .f. )
|
||||
@@ -663,15 +659,15 @@ METHOD IdeEdit:execKeyEvent( nMode, nEvent, p, p1 )
|
||||
::loadFuncHelp()
|
||||
|
||||
ELSEIF p == 21011
|
||||
::copyBlockContents( p1 )
|
||||
::copyBlockContents()
|
||||
|
||||
ELSEIF p == 21012
|
||||
::pasteBlockContents( p1 )
|
||||
::pasteBlockContents()// p1 )
|
||||
|
||||
ELSEIF p == 21013
|
||||
::insertBlockContents( p1 )
|
||||
|
||||
ELSEIF p == 21014
|
||||
ELSEIF p == 21014 /* ->hbCut() */
|
||||
::deleteBlockContents( p1 )
|
||||
|
||||
ELSEIF p == 21017 /* Sends Block Info { t,l,b,r,mode,state } hbGetBlockInfo() */
|
||||
@@ -749,7 +745,6 @@ METHOD IdeEdit:highlightPage()
|
||||
METHOD IdeEdit:dispStatusInfo()
|
||||
LOCAL nMode
|
||||
|
||||
::qEdit:hbGetSelectionInfo()
|
||||
nMode := ::aSelectionInfo[ 5 ]
|
||||
::oDK:setButtonState( "SelectionMode", nMode > 1 )
|
||||
::oDK:setStatusText( SB_PNL_STREAM, iif( nMode == 2, "Column", iif( nMode == 3, "Line", "Stream" ) ) )
|
||||
@@ -869,12 +864,14 @@ STATIC FUNCTION hbide_qCursorDownInsert( qCursor )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEdit:copyBlockContents( aCord )
|
||||
LOCAL nT, nL, nB, nR, nW, i, cLine, nMode, qClip
|
||||
METHOD IdeEdit:copyBlockContents()
|
||||
LOCAL nT, nL, nB, nR, nW, i, cLine, nMode, qClip, aCord
|
||||
LOCAL cClip := ""
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, "IdeEdit:copyBlockContents( aCord )" )
|
||||
|
||||
aCord := ::aSelectionInfo
|
||||
|
||||
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
|
||||
nMode := aCord[ 5 ]
|
||||
|
||||
@@ -886,7 +883,7 @@ METHOD IdeEdit:copyBlockContents( aCord )
|
||||
cLine := strtran( cLine, chr( 13 ) )
|
||||
cLine := strtran( cLine, chr( 10 ) )
|
||||
|
||||
IF nMode == selectionMode_stream
|
||||
IF nMode == __selectionMode_stream
|
||||
IF aCord[ 1 ] > aCord[ 3 ] // Selection - bottom to top
|
||||
IF i == nT .AND. i == nB
|
||||
cLine := substr( cLine, min( aCord[ 2 ], aCord[ 4 ] ) + 1, nW )
|
||||
@@ -905,10 +902,10 @@ METHOD IdeEdit:copyBlockContents( aCord )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
ELSEIF nMode == selectionMode_column
|
||||
ELSEIF nMode == __selectionMode_column
|
||||
cLine := pad( substr( cLine, nL + 1, nW ), nW )
|
||||
|
||||
ELSEIF nMode == selectionMode_line
|
||||
ELSEIF nMode == __selectionMode_line
|
||||
// Nothing to do, complete line is already pulled
|
||||
|
||||
ENDIF
|
||||
@@ -927,12 +924,15 @@ METHOD IdeEdit:copyBlockContents( aCord )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEdit:pasteBlockContents( nMode )
|
||||
LOCAL i, nCol, qCursor, nMaxCol, aCopy, a_, nPasteMode
|
||||
METHOD IdeEdit:pasteBlockContents()
|
||||
LOCAL i, nCol, qCursor, nMaxCol, aCopy, a_, nPasteMode, nMode
|
||||
|
||||
IF ::lReadOnly
|
||||
RETURN Self
|
||||
ENDIF
|
||||
|
||||
nMode := ::aSelectionInfo[ 5 ]
|
||||
|
||||
aCopy := hb_ATokens( StrTran( QClipboard():text(), Chr( 13 ) + Chr( 10 ), _EOL ), _EOL )
|
||||
IF empty( aCopy )
|
||||
RETURN Self
|
||||
@@ -949,14 +949,14 @@ METHOD IdeEdit:pasteBlockContents( nMode )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
nPasteMode := iif( empty( nPasteMode ), selectionMode_stream, nPasteMode )
|
||||
nPasteMode := iif( empty( nPasteMode ), __selectionMode_stream, nPasteMode )
|
||||
qCursor := ::qEdit:textCursor()
|
||||
nCol := qCursor:columnNumber()
|
||||
|
||||
qCursor:beginEditBlock()
|
||||
//
|
||||
SWITCH nPasteMode
|
||||
CASE selectionMode_column
|
||||
CASE __selectionMode_column
|
||||
FOR i := 1 TO Len( aCopy )
|
||||
qCursor:insertText( aCopy[ i ] )
|
||||
IF i < Len( aCopy )
|
||||
@@ -972,7 +972,7 @@ METHOD IdeEdit:pasteBlockContents( nMode )
|
||||
ENDIF
|
||||
NEXT
|
||||
EXIT
|
||||
CASE selectionMode_stream
|
||||
CASE __selectionMode_stream
|
||||
FOR i := 1 TO Len( aCopy )
|
||||
qCursor:insertText( aCopy[ i ] )
|
||||
IF i < Len( aCopy )
|
||||
@@ -980,7 +980,7 @@ METHOD IdeEdit:pasteBlockContents( nMode )
|
||||
ENDIF
|
||||
NEXT
|
||||
EXIT
|
||||
CASE selectionMode_line
|
||||
CASE __selectionMode_line
|
||||
qCursor:movePosition( QTextCursor_StartOfLine, QTextCursor_MoveAnchor )
|
||||
FOR i := 1 TO Len( aCopy )
|
||||
qCursor:insertText( aCopy[ i ] )
|
||||
@@ -1039,19 +1039,19 @@ METHOD IdeEdit:insertBlockContents( aCord )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEdit:deleteBlockContents( aCord )
|
||||
LOCAL nT, nL, nB, nR, i, cLine, qCursor, k, nSelMode
|
||||
METHOD IdeEdit:deleteBlockContents( k )
|
||||
LOCAL nT, nL, nB, nR, i, cLine, qCursor, nSelMode, aCord
|
||||
|
||||
IF ::lReadOnly
|
||||
RETURN Self
|
||||
ENDIF
|
||||
|
||||
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
|
||||
k := aCord[ 7 ]
|
||||
k := iif( empty( k ), Qt_Key_X, k )
|
||||
IF k == Qt_Key_X
|
||||
::copyBlockContents( aCord )
|
||||
::copyBlockContents()
|
||||
ENDIF
|
||||
aCord := ::aSelectionInfo
|
||||
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
|
||||
|
||||
nSelMode := aCord[ 5 ]
|
||||
|
||||
@@ -1059,7 +1059,7 @@ METHOD IdeEdit:deleteBlockContents( aCord )
|
||||
qCursor:beginEditBlock()
|
||||
|
||||
IF k == Qt_Key_Backspace
|
||||
IF nSelMode == selectionMode_column
|
||||
IF nSelMode == __selectionMode_column
|
||||
FOR i := nT TO nB
|
||||
cLine := ::getLine( i + 1 )
|
||||
cLine := pad( substr( cLine, 1, nL - 1 ), nL - 1 ) + substr( cLine, nL + 1 )
|
||||
@@ -1069,7 +1069,7 @@ METHOD IdeEdit:deleteBlockContents( aCord )
|
||||
ENDIF
|
||||
ELSE
|
||||
IF k == Qt_Key_Delete .OR. k == Qt_Key_X
|
||||
IF nSelMode == selectionMode_column
|
||||
IF nSelMode == __selectionMode_column
|
||||
FOR i := nT TO nB
|
||||
cLine := ::getLine( i + 1 )
|
||||
cLine := pad( substr( cLine, 1, nL ), nL ) + substr( cLine, nR + 1 )
|
||||
@@ -1077,20 +1077,20 @@ METHOD IdeEdit:deleteBlockContents( aCord )
|
||||
NEXT
|
||||
hbide_qPositionCursor( qCursor, nT, nL )
|
||||
|
||||
ELSEIF nSelMode == selectionMode_stream
|
||||
ELSEIF nSelMode == __selectionMode_stream
|
||||
hbide_qPositionCursor( qCursor, nT, nL )
|
||||
qCursor:movePosition( QTextCursor_Down , QTextCursor_KeepAnchor, nB - nT )
|
||||
qCursor:movePosition( QTextCursor_StartOfLine, QTextCursor_KeepAnchor )
|
||||
qCursor:movePosition( QTextCursor_Right , QTextCursor_KeepAnchor, nR )
|
||||
qCursor:removeSelectedText()
|
||||
::qEdit:hbSetSelectionInfo( { -1,-1,-1,-1,1 } )
|
||||
::qEdit:hbSetSelectionInfo( { -1, -1, -1, -1, 1 } )
|
||||
|
||||
ELSEIF nSelMode == selectionMode_line
|
||||
ELSEIF nSelMode == __selectionMode_line
|
||||
hbide_qPositionCursor( qCursor, nT, nL )
|
||||
qCursor:movePosition( QTextCursor_Down , QTextCursor_KeepAnchor, nB - nT + 1 )
|
||||
qCursor:movePosition( QTextCursor_StartOfLine, QTextCursor_KeepAnchor )
|
||||
qCursor:removeSelectedText()
|
||||
::qEdit:hbSetSelectionInfo( { -1,-1,-1,-1,1 } )
|
||||
::qEdit:hbSetSelectionInfo( { -1, -1, -1, -1, 1 } )
|
||||
::isLineSelectionON := .f.
|
||||
|
||||
ENDIF
|
||||
@@ -1113,7 +1113,7 @@ METHOD IdeEdit:blockComment()
|
||||
RETURN Self
|
||||
ENDIF
|
||||
|
||||
::qEdit:hbGetSelectionInfo(); aCord := ::aSelectionInfo
|
||||
aCord := ::aSelectionInfo
|
||||
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
|
||||
nW := nR - nL
|
||||
|
||||
@@ -1125,14 +1125,14 @@ METHOD IdeEdit:blockComment()
|
||||
cLine := ::getLine( i + 1 )
|
||||
|
||||
DO CASE
|
||||
CASE nMode == selectionMode_stream .OR. nMode == selectionMode_line
|
||||
CASE nMode == __selectionMode_stream .OR. nMode == __selectionMode_line
|
||||
IF substr( cLine, 1, nLen ) == cComment
|
||||
cLine := substr( cLine, nLen + 1 )
|
||||
ELSE
|
||||
cLine := cComment + cLine
|
||||
ENDIF
|
||||
|
||||
CASE nMode == selectionMode_column
|
||||
CASE nMode == __selectionMode_column
|
||||
IF substr( cLine, nL + 1, nLen ) == cComment
|
||||
cLine := pad( substr( cLine, 1, nL ), nL ) + substr( cLine, nL + nLen + 1 )
|
||||
ELSE
|
||||
@@ -1158,8 +1158,7 @@ METHOD IdeEdit:streamComment()
|
||||
RETURN Self
|
||||
ENDIF
|
||||
|
||||
::qEdit:hbGetSelectionInfo(); aCord := ::aSelectionInfo
|
||||
|
||||
aCord := ::aSelectionInfo
|
||||
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
|
||||
nW := nR - nL
|
||||
|
||||
@@ -1171,14 +1170,14 @@ METHOD IdeEdit:streamComment()
|
||||
cLine := ::getLine( i + 1 )
|
||||
|
||||
DO CASE
|
||||
CASE nMode == selectionMode_stream
|
||||
CASE nMode == __selectionMode_stream
|
||||
IF i == nT
|
||||
cLine := substr( cLine, 1, nL ) + "/* " + substr( cLine, nL + 1 )
|
||||
ELSEIF i == nB
|
||||
cLine := substr( cLine, 1, nR ) + " */" + substr( cLine, nR + 1 )
|
||||
ENDIF
|
||||
|
||||
CASE nMode == selectionMode_line
|
||||
CASE nMode == __selectionMode_line
|
||||
IF i == nT
|
||||
cLine := "/* " + cLine
|
||||
ELSEIF i == nB
|
||||
@@ -1204,7 +1203,7 @@ METHOD IdeEdit:blockIndent( nDirctn )
|
||||
RETURN Self
|
||||
ENDIF
|
||||
|
||||
::qEdit:hbGetSelectionInfo(); aCord := ::aSelectionInfo
|
||||
aCord := ::aSelectionInfo
|
||||
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
|
||||
nW := nR - nL
|
||||
|
||||
@@ -1216,7 +1215,7 @@ METHOD IdeEdit:blockIndent( nDirctn )
|
||||
cLine := ::getLine( i + 1 )
|
||||
|
||||
DO CASE
|
||||
CASE nMode == selectionMode_stream .OR. nMode == selectionMode_line
|
||||
CASE nMode == __selectionMode_stream .OR. nMode == __selectionMode_line
|
||||
IF nDirctn == -1
|
||||
IF left( cLine, 1 ) == " "
|
||||
cLine := substr( cLine, 2 )
|
||||
@@ -1225,7 +1224,7 @@ METHOD IdeEdit:blockIndent( nDirctn )
|
||||
cLine := " " + cLine
|
||||
ENDIF
|
||||
|
||||
CASE nMode == selectionMode_column
|
||||
CASE nMode == __selectionMode_column
|
||||
cLineSel := pad( substr( cLine, nL + 1, nW ), nW )
|
||||
IF nDirctn == -1
|
||||
IF left( cLineSel, 1 ) == " "
|
||||
@@ -1255,7 +1254,7 @@ METHOD IdeEdit:blockConvert( cMode )
|
||||
RETURN Self
|
||||
ENDIF
|
||||
|
||||
::qEdit:hbGetSelectionInfo(); aCord := ::aSelectionInfo
|
||||
aCord := ::aSelectionInfo
|
||||
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
|
||||
nW := nR - nL
|
||||
|
||||
@@ -1267,7 +1266,7 @@ METHOD IdeEdit:blockConvert( cMode )
|
||||
cLine := ::getLine( i + 1 )
|
||||
|
||||
DO CASE
|
||||
CASE nMode == selectionMode_stream
|
||||
CASE nMode == __selectionMode_stream
|
||||
IF nT == nB
|
||||
cLine := substr( cLine, 1, nL ) + hbide_convertALine( substr( cLine, nL + 1, nW ), cMode ) + substr( cLine, nL + 1 + nW )
|
||||
ELSE
|
||||
@@ -1280,10 +1279,10 @@ METHOD IdeEdit:blockConvert( cMode )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
CASE nMode == selectionMode_column
|
||||
CASE nMode == __selectionMode_column
|
||||
cLine := pad( substr( cLine, 1, nL ), nL ) + hbide_convertALine( pad( substr( cLine, nL + 1, nW ), nW ), cMode ) + substr( cLine, nR + 1 )
|
||||
|
||||
CASE nMode == selectionMode_line
|
||||
CASE nMode == __selectionMode_line
|
||||
cLine := hbide_convertALine( cLine, cMode )
|
||||
|
||||
ENDCASE
|
||||
@@ -1303,7 +1302,7 @@ METHOD IdeEdit:getSelectedText()
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, "IdeEdit:getSelectedText()", ProcName( 1 ), procName( 2 ) )
|
||||
|
||||
::qEdit:hbGetSelectionInfo(); aCord := ::aSelectionInfo
|
||||
aCord := ::aSelectionInfo
|
||||
hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR )
|
||||
nMode := aCord[ 5 ]
|
||||
|
||||
@@ -1311,7 +1310,7 @@ METHOD IdeEdit:getSelectedText()
|
||||
FOR i := nT TO nB
|
||||
cLine := ::getLine( i + 1 )
|
||||
|
||||
IF nMode == selectionMode_stream
|
||||
IF nMode == __selectionMode_stream
|
||||
IF i == nT .AND. i == nB
|
||||
cLine := substr( cLine, nL + 1, nR - nL )
|
||||
ELSEIF i == nT
|
||||
@@ -1320,10 +1319,10 @@ METHOD IdeEdit:getSelectedText()
|
||||
cLine := substr( cLine, 1, nR + 1 )
|
||||
ENDIF
|
||||
|
||||
ELSEIF nMode == selectionMode_column
|
||||
ELSEIF nMode == __selectionMode_column
|
||||
cLine := pad( substr( cLine, nL + 1, nW ), nW )
|
||||
|
||||
ELSEIF nMode == selectionMode_line
|
||||
ELSEIF nMode == __selectionMode_line
|
||||
// Nothing to do, complete line is already pulled
|
||||
|
||||
ENDIF
|
||||
@@ -1532,27 +1531,26 @@ METHOD IdeEdit:cut()
|
||||
IF ::lReadOnly
|
||||
RETURN Self
|
||||
ENDIF
|
||||
::qEdit:hbCut( Qt_Key_X )
|
||||
::deleteBlockContents( Qt_Key_X )
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEdit:copy()
|
||||
::qEdit:hbCopy()
|
||||
::copyBlockContents()
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEdit:paste()
|
||||
|
||||
IF ::lReadOnly
|
||||
RETURN Self
|
||||
ENDIF
|
||||
|
||||
::qEdit:hbGetSelectionInfo()
|
||||
IF ::aSelectionInfo[ 1 ] > -1
|
||||
::qEdit:hbCut( Qt_Key_Delete )
|
||||
::deleteBlockContents( Qt_Key_Delete )
|
||||
ENDIF
|
||||
::qEdit:hbPaste()
|
||||
::pasteBlockContents()
|
||||
|
||||
RETURN Self
|
||||
|
||||
@@ -2750,7 +2748,6 @@ FUNCTION hbide_formatProto( cProto )
|
||||
n1 := at( ")", cProto )
|
||||
|
||||
IF n > 0 .AND. n1 > 0
|
||||
|
||||
cArgs := substr( cProto, n + 1, n1 - n - 1 )
|
||||
cArgs := strtran( cArgs, ",", "<font color=red><b>" + "," + "</b></font>" )
|
||||
cProto := "<p style='white-space:pre'>" + "<b>" + substr( cProto, 1, n - 1 ) + "</b>" + ;
|
||||
|
||||
@@ -1282,6 +1282,7 @@ CLASS IdeEditor INHERIT IdeObject
|
||||
METHOD prepareBufferToSave( cBuffer )
|
||||
METHOD reload()
|
||||
METHOD vssExecute( cAction )
|
||||
METHOD updateComponents()
|
||||
|
||||
ENDCLASS
|
||||
|
||||
@@ -1709,6 +1710,23 @@ HB_TRACE( HB_TR_DEBUG, "IdeEditor:execEvent( cMode, p )" )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEditor:updateComponents()
|
||||
LOCAL qCoEdit := ::qCoEdit
|
||||
|
||||
::setDocumentProperties()
|
||||
qCoEdit:relayMarkButtons()
|
||||
qCoEdit:updateTitleBar()
|
||||
qCoEdit:toggleLineNumbers()
|
||||
qCoEdit:toggleHorzRuler()
|
||||
qCoEdit:toggleCurrentLineHighlightMode()
|
||||
qCoEdit:dispStatusInfo()
|
||||
::oUpDn:show()
|
||||
::changeThumbnail()
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeEditor:activateTab( mp1, mp2, oXbp )
|
||||
LOCAL oEdit
|
||||
|
||||
@@ -1716,15 +1734,7 @@ METHOD IdeEditor:activateTab( mp1, mp2, oXbp )
|
||||
HB_SYMBOL_UNUSED( mp2 )
|
||||
|
||||
IF !empty( oEdit := ::oEM:getEditorByTabObject( oXbp ) )
|
||||
oEdit:setDocumentProperties()
|
||||
oEdit:qCoEdit:relayMarkButtons()
|
||||
oEdit:qCoEdit:updateTitleBar()
|
||||
oEdit:qCoEdit:toggleLineNumbers()
|
||||
oEdit:qCoEdit:toggleHorzRuler()
|
||||
oEdit:qCoEdit:toggleCurrentLineHighlightMode()
|
||||
oEdit:qCoEdit:dispStatusInfo()
|
||||
::oUpDn:show()
|
||||
oEdit:changeThumbnail()
|
||||
oEdit:updateComponents()
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
@@ -69,6 +69,12 @@
|
||||
#include "hbclass.ch"
|
||||
#include "hbqtgui.ch"
|
||||
|
||||
#define __buttonPrev_clicked 1
|
||||
#define __buttonNext_clicked 2
|
||||
#define __buttonFirst_clicked 3
|
||||
#define __buttonLast_clicked 4
|
||||
#define __buttonAll_clicked 5
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
CLASS IdeUpDown INHERIT IdeObject
|
||||
@@ -76,9 +82,9 @@ CLASS IdeUpDown INHERIT IdeObject
|
||||
METHOD new( oIde )
|
||||
METHOD create( oIde )
|
||||
METHOD destroy()
|
||||
METHOD show()
|
||||
METHOD show( oEdit )
|
||||
METHOD position()
|
||||
METHOD execEvent( cEvent, p )
|
||||
METHOD execEvent( nEvent, p )
|
||||
|
||||
ENDCLASS
|
||||
|
||||
@@ -111,11 +117,11 @@ METHOD IdeUpDown:position()
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUpDown:show()
|
||||
LOCAL oEdit
|
||||
METHOD IdeUpDown:show( oEdit )
|
||||
|
||||
IF !empty( oEdit := ::oEM:getEditObjectCurrent() )
|
||||
oEdit:qEdit:hbGetSelectionInfo()
|
||||
DEFAULT oEdit TO ::oEM:getEditObjectCurrent()
|
||||
|
||||
IF ! empty( oEdit )
|
||||
IF oEdit:aSelectionInfo[ 1 ] > -1
|
||||
::oUI:setEnabled( .t. )
|
||||
ELSE
|
||||
@@ -140,29 +146,31 @@ METHOD IdeUpDown:create( oIde )
|
||||
|
||||
::oUI:buttonPrev:setIcon( QIcon( hbide_image( "go-prev" ) ) )
|
||||
::oUI:buttonPrev:setToolTip( "Find Previous" )
|
||||
::oUI:buttonPrev:connect( "clicked()", {|| ::execEvent( "buttonPrev_clicked" ) } )
|
||||
::oUI:buttonPrev:connect( "clicked()", {|| ::execEvent( __buttonPrev_clicked ) } )
|
||||
//
|
||||
::oUI:buttonNext:setIcon( QIcon( hbide_image( "go-next" ) ) )
|
||||
::oUI:buttonNext:setToolTip( "Find Next" )
|
||||
::oUI:buttonNext:connect( "clicked()", {|| ::execEvent( "buttonNext_clicked" ) } )
|
||||
::oUI:buttonNext:connect( "clicked()", {|| ::execEvent( __buttonNext_clicked ) } )
|
||||
//
|
||||
::oUI:buttonFirst:setIcon( QIcon( hbide_image( "go-first" ) ) )
|
||||
::oUI:buttonFirst:setToolTip( "Find First" )
|
||||
::oUI:buttonFirst:connect( "clicked()", {|| ::execEvent( "buttonFirst_clicked" ) } )
|
||||
::oUI:buttonFirst:connect( "clicked()", {|| ::execEvent( __buttonFirst_clicked ) } )
|
||||
//
|
||||
::oUI:buttonLast:setIcon( QIcon( hbide_image( "go-last" ) ) )
|
||||
::oUI:buttonLast:setToolTip( "Find Last" )
|
||||
::oUI:buttonLast:connect( "clicked()", {|| ::execEvent( "buttonLast_clicked" ) } )
|
||||
::oUI:buttonLast:connect( "clicked()", {|| ::execEvent( __buttonLast_clicked ) } )
|
||||
//
|
||||
::oUI:buttonAll:setIcon( QIcon( hbide_image( "hilight-all" ) ) )
|
||||
::oUI:buttonAll:setToolTip( "Highlight All" )
|
||||
::oUI:buttonAll:connect( "clicked()", {|| ::execEvent( "buttonAll_clicked" ) } )
|
||||
::oUI:buttonAll:connect( "clicked()", {|| ::execEvent( __buttonAll_clicked ) } )
|
||||
|
||||
::oUI:setEnabled( .f. )
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUpDown:execEvent( cEvent, p )
|
||||
METHOD IdeUpDown:execEvent( nEvent, p )
|
||||
LOCAL cText, oEdit
|
||||
|
||||
HB_SYMBOL_UNUSED( p )
|
||||
@@ -173,26 +181,27 @@ METHOD IdeUpDown:execEvent( cEvent, p )
|
||||
IF !empty( oEdit := ::oEM:getEditObjectCurrent() )
|
||||
cText := oEdit:getSelectedText()
|
||||
ENDIF
|
||||
|
||||
IF !empty( cText )
|
||||
SWITCH cEvent
|
||||
CASE "buttonPrev_clicked"
|
||||
SWITCH nEvent
|
||||
|
||||
CASE __buttonPrev_clicked
|
||||
oEdit:findEx( cText, QTextDocument_FindBackward, 0 )
|
||||
EXIT
|
||||
CASE "buttonNext_clicked"
|
||||
CASE __buttonNext_clicked
|
||||
oEdit:findEx( cText, 0, 0 )
|
||||
EXIT
|
||||
CASE "buttonFirst_clicked"
|
||||
CASE __buttonFirst_clicked
|
||||
oEdit:findEx( cText, 0, 1 )
|
||||
EXIT
|
||||
CASE "buttonLast_clicked"
|
||||
CASE __buttonLast_clicked
|
||||
oEdit:findEx( cText, QTextDocument_FindBackward, 2 )
|
||||
EXIT
|
||||
CASE "buttonAll_clicked"
|
||||
CASE __buttonAll_clicked
|
||||
oEdit:highlightAll( cText )
|
||||
EXIT
|
||||
ENDSWITCH
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -208,6 +208,42 @@ HBQPlainTextEdit::~HBQPlainTextEdit()
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
int HBQPlainTextEdit::hbFirstVisibleColumn()
|
||||
{
|
||||
return ( horizontalScrollBar()->value() / fontMetrics().averageCharWidth() );
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void HBQPlainTextEdit::hbGetViewportInfo()
|
||||
{
|
||||
if( block )
|
||||
{
|
||||
PHB_ITEM p1 = hb_itemPutNI( NULL, 21017 );
|
||||
PHB_ITEM p2 = hb_itemNew( NULL );
|
||||
|
||||
hb_arrayNew( p2, 6 );
|
||||
|
||||
int t = firstVisibleBlock().blockNumber();
|
||||
int c = hbFirstVisibleColumn();
|
||||
int rows = viewport()->height() / fontMetrics().height();
|
||||
int cols = viewport()->width() / fontMetrics().averageCharWidth();
|
||||
|
||||
hb_arraySetNI( p2, 1, t );
|
||||
hb_arraySetNI( p2, 2, c );
|
||||
hb_arraySetNI( p2, 3, rows );
|
||||
hb_arraySetNI( p2, 4, cols );
|
||||
hb_arraySetNI( p2, 5, textCursor().blockNumber() );
|
||||
hb_arraySetNI( p2, 6, textCursor().columnNumber() );
|
||||
|
||||
hb_vmEvalBlockV( block, 2, p1, p2 );
|
||||
hb_itemRelease( p1 );
|
||||
hb_itemRelease( p2 );
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void HBQPlainTextEdit::hbShowPrototype( const QString & tip, int rows, int cols )
|
||||
{
|
||||
if( ! isCompletionTipsActive ){
|
||||
@@ -285,13 +321,6 @@ void HBQPlainTextEdit::hbApplyKey( int key, Qt::KeyboardModifiers modifiers, con
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void HBQPlainTextEdit::hbTogglePersistentSelection()
|
||||
{
|
||||
isSelectionPersistent = ! isSelectionPersistent;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void HBQPlainTextEdit::hbRefresh()
|
||||
{
|
||||
repaint();
|
||||
@@ -383,6 +412,15 @@ static bool isNavableKey( int k )
|
||||
k == Qt::Key_Home || k == Qt::Key_End || k == Qt::Key_PageUp || k == Qt::Key_PageDown );
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* Selection Manipulation */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void HBQPlainTextEdit::hbTogglePersistentSelection()
|
||||
{
|
||||
isSelectionPersistent = ! isSelectionPersistent;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
bool HBQPlainTextEdit::isCursorInSelection()
|
||||
@@ -401,16 +439,40 @@ bool HBQPlainTextEdit::isCursorInSelection()
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void HBQPlainTextEdit::hbPostSelectionInfo()
|
||||
{
|
||||
if( block )
|
||||
{
|
||||
PHB_ITEM p1 = hb_itemPutNI( NULL, 21000 );
|
||||
PHB_ITEM p2 = hb_itemNew( NULL );
|
||||
|
||||
hb_arrayNew( p2, 7 );
|
||||
|
||||
hb_arraySetNI( p2, 1, rowBegins );
|
||||
hb_arraySetNI( p2, 2, columnBegins );
|
||||
hb_arraySetNI( p2, 3, rowEnds );
|
||||
hb_arraySetNI( p2, 4, columnEnds );
|
||||
hb_arraySetNI( p2, 5, selectionMode );
|
||||
hb_arraySetNI( p2, 6, selectionState );
|
||||
hb_arraySetNI( p2, 7, 0 );
|
||||
|
||||
hb_vmEvalBlockV( block, 2, p1, p2 );
|
||||
hb_itemRelease( p1 );
|
||||
hb_itemRelease( p2 );
|
||||
}
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void HBQPlainTextEdit::hbClearSelection()
|
||||
{
|
||||
setCursorWidth( 1 );
|
||||
|
||||
rowBegins = -1;
|
||||
rowEnds = -1;
|
||||
columnBegins = -1;
|
||||
columnEnds = -1;
|
||||
|
||||
emit selectionChanged();
|
||||
hbPostSelectionInfo();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -418,61 +480,12 @@ void HBQPlainTextEdit::hbClearSelection()
|
||||
void HBQPlainTextEdit::hbSelectAll()
|
||||
{
|
||||
setCursorWidth( 1 );
|
||||
|
||||
rowBegins = 0;
|
||||
rowEnds = document()->blockCount();
|
||||
columnBegins = 0;
|
||||
columnEnds = 0;
|
||||
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void HBQPlainTextEdit::hbHitTest( const QPoint & pt )
|
||||
{
|
||||
QTextCursor ct = cursorForPosition( QPoint( 2,2 ) );
|
||||
int t = ct.blockNumber();
|
||||
int c = ct.columnNumber();
|
||||
|
||||
hitTestRow = t + ( pt.y() / fontMetrics().height() );
|
||||
hitTestColumn = c + ( pt.x() / fontMetrics().averageCharWidth() );
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
int HBQPlainTextEdit::hbFirstVisibleColumn()
|
||||
{
|
||||
return ( horizontalScrollBar()->value() / fontMetrics().averageCharWidth() );
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void HBQPlainTextEdit::hbGetViewportInfo()
|
||||
{
|
||||
if( block )
|
||||
{
|
||||
PHB_ITEM p1 = hb_itemPutNI( NULL, 21017 );
|
||||
PHB_ITEM p2 = hb_itemNew( NULL );
|
||||
|
||||
hb_arrayNew( p2, 6 );
|
||||
|
||||
int t = firstVisibleBlock().blockNumber();
|
||||
int c = hbFirstVisibleColumn();
|
||||
int rows = viewport()->height() / fontMetrics().height();
|
||||
int cols = viewport()->width() / fontMetrics().averageCharWidth();
|
||||
|
||||
hb_arraySetNI( p2, 1, t );
|
||||
hb_arraySetNI( p2, 2, c );
|
||||
hb_arraySetNI( p2, 3, rows );
|
||||
hb_arraySetNI( p2, 4, cols );
|
||||
hb_arraySetNI( p2, 5, textCursor().blockNumber() );
|
||||
hb_arraySetNI( p2, 6, textCursor().columnNumber() );
|
||||
|
||||
hb_vmEvalBlockV( block, 2, p1, p2 );
|
||||
hb_itemRelease( p1 );
|
||||
hb_itemRelease( p2 );
|
||||
}
|
||||
hbPostSelectionInfo();
|
||||
repaint();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -484,56 +497,7 @@ void HBQPlainTextEdit::hbSetSelectionInfo( PHB_ITEM selectionInfo )
|
||||
rowEnds = hb_arrayGetNI( selectionInfo, 3 );
|
||||
columnEnds = hb_arrayGetNI( selectionInfo, 4 );
|
||||
selectionMode = hb_arrayGetNI( selectionInfo, 5 );
|
||||
#if 0
|
||||
PHB_ITEM pSome = hb_arrayGetItemPtr( selectionInfo, 6 );
|
||||
//if( hb_itemType( pSome ) & HB_IT_LOGICAL )
|
||||
{
|
||||
if( hb_itemGetL( pSome ) )
|
||||
{
|
||||
QTextCursor c( textCursor() );
|
||||
c.clearSelection();
|
||||
}
|
||||
}
|
||||
pSome = hb_arrayGetItemPtr( selectionInfo, 7 );
|
||||
//if( hb_itemType( pSome ) & HB_IT_LOGICAL )
|
||||
{
|
||||
if( hb_itemGetL( pSome ) )
|
||||
{
|
||||
emit selectionChanged();
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
{
|
||||
emit selectionChanged();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void HBQPlainTextEdit::hbGetSelectionInfo()
|
||||
{
|
||||
if( block )
|
||||
{
|
||||
PHB_ITEM p1 = hb_itemPutNI( NULL, 21000 );
|
||||
PHB_ITEM p2 = hb_itemNew( NULL );
|
||||
|
||||
hb_arrayNew( p2, 6 );
|
||||
|
||||
hb_arraySetNI( p2, 1, rowBegins );
|
||||
hb_arraySetNI( p2, 2, columnBegins );
|
||||
hb_arraySetNI( p2, 3, rowEnds );
|
||||
hb_arraySetNI( p2, 4, columnEnds );
|
||||
hb_arraySetNI( p2, 5, selectionMode );
|
||||
hb_arraySetNI( p2, 6, selectionState );
|
||||
|
||||
hb_vmEvalBlockV( block, 2, p1, p2 );
|
||||
hb_itemRelease( p1 );
|
||||
hb_itemRelease( p2 );
|
||||
}
|
||||
hbPostSelectionInfo();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -549,7 +513,7 @@ void HBQPlainTextEdit::hbSetSelectionMode( int mode, bool byApplication )
|
||||
isColumnSelectionON = false;
|
||||
isLineSelectionON = false;
|
||||
hbClearSelection();
|
||||
// repaint();
|
||||
repaint();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -660,7 +624,7 @@ void HBQPlainTextEdit::hbSetSelectionMode( int mode, bool byApplication )
|
||||
}
|
||||
}
|
||||
}
|
||||
emit selectionChanged();
|
||||
hbPostSelectionInfo();
|
||||
repaint(); /* Only once when mode is changed from stream to column , so no issues */
|
||||
}
|
||||
|
||||
@@ -720,29 +684,29 @@ void HBQPlainTextEdit::hbToStream()
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void HBQPlainTextEdit::hbHitTest( const QPoint & pt )
|
||||
{
|
||||
QTextCursor ct = cursorForPosition( QPoint( 2,2 ) );
|
||||
int t = ct.blockNumber();
|
||||
int c = ct.columnNumber();
|
||||
|
||||
hitTestRow = t + ( pt.y() / fontMetrics().height() );
|
||||
hitTestColumn = c + ( pt.x() / fontMetrics().averageCharWidth() );
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void HBQPlainTextEdit::hbCut( int k )
|
||||
{
|
||||
if( block )
|
||||
{
|
||||
PHB_ITEM p1 = hb_itemPutNI( NULL, 21014 );
|
||||
PHB_ITEM p2 = hb_itemNew( NULL );
|
||||
|
||||
hb_arrayNew( p2, 7 );
|
||||
hb_arraySetNI( p2, 1, rowBegins );
|
||||
hb_arraySetNI( p2, 2, columnBegins );
|
||||
hb_arraySetNI( p2, 3, rowEnds );
|
||||
hb_arraySetNI( p2, 4, columnEnds );
|
||||
hb_arraySetNI( p2, 5, selectionMode );
|
||||
hb_arraySetNI( p2, 6, selectionState );
|
||||
hb_arraySetNI( p2, 7, k );
|
||||
|
||||
PHB_ITEM p2 = hb_itemPutNI( NULL, k );
|
||||
hb_vmEvalBlockV( block, 2, p1, p2 );
|
||||
hb_itemRelease( p1 );
|
||||
hb_itemRelease( p2 );
|
||||
#if 0
|
||||
if( selectionMode == selectionMode_column ) //&& k == 0 )
|
||||
columnEnds = columnBegins;
|
||||
#endif
|
||||
|
||||
hbClearSelection();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -757,20 +721,8 @@ void HBQPlainTextEdit::hbCopy()
|
||||
if( block )
|
||||
{
|
||||
PHB_ITEM p1 = hb_itemPutNI( NULL, 21011 );
|
||||
PHB_ITEM p2 = hb_itemNew( NULL );
|
||||
|
||||
hb_arrayNew( p2, 7 );
|
||||
hb_arraySetNI( p2, 1, rowBegins );
|
||||
hb_arraySetNI( p2, 2, columnBegins );
|
||||
hb_arraySetNI( p2, 3, rowEnds );
|
||||
hb_arraySetNI( p2, 4, columnEnds );
|
||||
hb_arraySetNI( p2, 5, selectionMode );
|
||||
hb_arraySetNI( p2, 6, selectionState );
|
||||
hb_arraySetNI( p2, 7, 0 );
|
||||
|
||||
hb_vmEvalBlockV( block, 2, p1, p2 );
|
||||
hb_vmEvalBlockV( block, 1, p1 );
|
||||
hb_itemRelease( p1 );
|
||||
hb_itemRelease( p2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -785,10 +737,8 @@ void HBQPlainTextEdit::hbPaste()
|
||||
if( block )
|
||||
{
|
||||
PHB_ITEM p1 = hb_itemPutNI( NULL, 21012 );
|
||||
PHB_ITEM p2 = hb_itemPutNI( NULL, selectionMode );
|
||||
hb_vmEvalBlockV( block, 1, p1, p2 );
|
||||
hb_vmEvalBlockV( block, 1, p1 );
|
||||
hb_itemRelease( p1 );
|
||||
hb_itemRelease( p2 );
|
||||
|
||||
if( ! isSelectionPersistent )
|
||||
{
|
||||
@@ -873,7 +823,7 @@ void HBQPlainTextEdit::dropEvent( QDropEvent *event )
|
||||
selectionState = 0;
|
||||
hbClearSelection();
|
||||
hbPaste();
|
||||
emit selectionChanged();
|
||||
hbPostSelectionInfo();
|
||||
}
|
||||
/* It is a hack. Without this editing caret is lost ??? */
|
||||
QMimeData * data = new QMimeData();
|
||||
@@ -946,8 +896,7 @@ void HBQPlainTextEdit::mouseDoubleClickEvent( QMouseEvent *event )
|
||||
selectionMode = selectionMode_stream;
|
||||
c.clearSelection();
|
||||
setTextCursor( c );
|
||||
emit selectionChanged();
|
||||
hbGetSelectionInfo(); /* Wrong name : should been hbPostSelectionInfo */
|
||||
hbPostSelectionInfo();
|
||||
}
|
||||
|
||||
if( block )
|
||||
@@ -990,9 +939,8 @@ void HBQPlainTextEdit::mousePressEvent( QMouseEvent *event )
|
||||
selectionState = 1;
|
||||
setCursorWidth( 1 );
|
||||
selectionMode = selectionMode_stream;
|
||||
emit selectionChanged();
|
||||
hbGetSelectionInfo();
|
||||
// repaint(); /* Not required as per QPlainTextEdit::mousePressEvent( event ); */
|
||||
hbPostSelectionInfo();
|
||||
// repaint(); /* Not required as per QPlainTextEdit::mousePressEvent( event ); */
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1057,7 +1005,7 @@ void HBQPlainTextEdit::mouseReleaseEvent( QMouseEvent *event )
|
||||
}
|
||||
selectionState = 1;
|
||||
setCursorWidth( 1 );
|
||||
emit selectionChanged();
|
||||
hbPostSelectionInfo();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -1073,7 +1021,7 @@ void HBQPlainTextEdit::mouseMoveEvent( QMouseEvent *event )
|
||||
if( selectionMode == selectionMode_line )
|
||||
{
|
||||
selectionMode = selectionMode_stream;
|
||||
hbGetSelectionInfo();
|
||||
hbPostSelectionInfo();
|
||||
}
|
||||
if( event->buttons() & Qt::LeftButton )
|
||||
{
|
||||
@@ -1121,8 +1069,6 @@ void HBQPlainTextEdit::mouseMoveEvent( QMouseEvent *event )
|
||||
columnBegins = c.columnNumber();
|
||||
rowEnds = rowBegins;
|
||||
columnEnds = columnBegins;
|
||||
|
||||
emit selectionChanged();
|
||||
QPlainTextEdit::mouseMoveEvent( event );
|
||||
}
|
||||
else
|
||||
@@ -1143,8 +1089,9 @@ void HBQPlainTextEdit::mouseMoveEvent( QMouseEvent *event )
|
||||
}
|
||||
c.clearSelection();
|
||||
setTextCursor( c );
|
||||
// repaint(); /* NOT REQUIRED : QPlainTextEdit::mouseMoveEvent( event ); */
|
||||
// repaint(); /* NOT REQUIRED : QPlainTextEdit::mouseMoveEvent( event ); */
|
||||
}
|
||||
hbPostSelectionInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1294,7 +1241,7 @@ bool HBQPlainTextEdit::hbKeyPressSelection( QKeyEvent * event )
|
||||
{
|
||||
selectionMode = selectionMode_stream;
|
||||
selectionState = 0;
|
||||
hbGetSelectionInfo();
|
||||
hbPostSelectionInfo();
|
||||
}
|
||||
if( selectionState == 0 )
|
||||
{
|
||||
@@ -1319,7 +1266,7 @@ bool HBQPlainTextEdit::hbKeyPressSelection( QKeyEvent * event )
|
||||
columnBegins = c.columnNumber();
|
||||
rowEnds = rowBegins;
|
||||
columnEnds = columnBegins;
|
||||
emit selectionChanged();
|
||||
hbPostSelectionInfo();
|
||||
}
|
||||
|
||||
QKeyEvent * ev = new QKeyEvent( event->type(), event->key(), ctrl ? Qt::ControlModifier : Qt::NoModifier, event->text() );
|
||||
@@ -1400,7 +1347,7 @@ bool HBQPlainTextEdit::hbKeyPressSelection( QKeyEvent * event )
|
||||
break;
|
||||
}
|
||||
}
|
||||
emit selectionChanged();
|
||||
hbPostSelectionInfo();
|
||||
repaint(); /* A Must Here , otherwise selection will not be reflected */
|
||||
return true;
|
||||
}
|
||||
@@ -1485,23 +1432,23 @@ bool HBQPlainTextEdit::hbKeyPressSelection( QKeyEvent * event )
|
||||
{
|
||||
if( selectionState > 0 )
|
||||
{
|
||||
emit selectionChanged();
|
||||
setCursorWidth( 1 );
|
||||
selectionState = 0;
|
||||
if( columnEnds == columnBegins )
|
||||
{
|
||||
hbClearSelection();
|
||||
}
|
||||
hbPostSelectionInfo();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( selectionState > 0 )
|
||||
{
|
||||
emit selectionChanged();
|
||||
setCursorWidth( 1 );
|
||||
selectionState = 0;
|
||||
hbClearSelection();
|
||||
hbPostSelectionInfo();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
@@ -1516,7 +1463,7 @@ bool HBQPlainTextEdit::hbKeyPressSelection( QKeyEvent * event )
|
||||
QPlainTextEdit::keyPressEvent( event );
|
||||
QTextCursor c( textCursor() );
|
||||
rowEnds = c.blockNumber();
|
||||
r//epaint();
|
||||
//repaint();
|
||||
return true;
|
||||
}
|
||||
else if( ! isSelectionPersistent )
|
||||
|
||||
@@ -125,6 +125,7 @@ public:
|
||||
void hbUpdateHorzRulerHeight( int height );
|
||||
void hbSetHighLighter( HBQSyntaxHighlighter * hilighter ){ highlighter = hilighter; };
|
||||
void hbHighlightPage();
|
||||
void hbPostSelectionInfo();
|
||||
|
||||
int firstVisibleBlockNumber() { return QPlainTextEdit::firstVisibleBlock().blockNumber(); };
|
||||
int lastVisibleBlockNumber();
|
||||
@@ -176,7 +177,7 @@ private:
|
||||
bool isCompletionTipsActive;
|
||||
bool isInDrag;
|
||||
QPoint dragStartPosition;
|
||||
|
||||
|
||||
protected:
|
||||
bool event( QEvent * event );
|
||||
void resizeEvent( QResizeEvent * event );
|
||||
@@ -224,7 +225,6 @@ public slots:
|
||||
void hbCopy();
|
||||
void hbPaste();
|
||||
void hbToStream();
|
||||
void hbGetSelectionInfo();
|
||||
void hbSetSelectionMode( int mode, bool on );
|
||||
void hbSetSelectionInfo( PHB_ITEM selectionInfo );
|
||||
void hbSetSelectionColor( const QColor & color );
|
||||
|
||||
@@ -97,11 +97,7 @@ HB_FUNC( QT_HBQPLAINTEXTEDIT )
|
||||
void hbSetCurrentLineColor( const QColor & color )
|
||||
void hbSetLineAreaBkColor( const QColor & color )
|
||||
void hbRefresh()
|
||||
void hbCut( int key )
|
||||
void hbCopy()
|
||||
void hbPaste()
|
||||
void hbSetSelectionMode( int mode, bool on )
|
||||
void hbGetSelectionInfo()
|
||||
void hbSetSelectionInfo( PHB_ITEM selectionInfo )
|
||||
void hbSetSelectionColor( const QColor & color )
|
||||
void hbSetMatchBraces( bool all )
|
||||
|
||||
Reference in New Issue
Block a user