2009-12-28 13:43 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbqt/hbqt_misc.prg
% Fixed small omission, thanks Vailton.
* contrib/hbxbp/xbprtf.prg
% Fixed wrong Qt call, thanks Vailton.
* contrib/hbide/hbide.hbp
* contrib/hbide/hbide.prg
+ contrib/hbide/idefindreplace.prg
! Separated Find/Replace class.
2nd round of reforms.
More follows.
This commit is contained in:
@@ -17,6 +17,19 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-12-28 13:43 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* contrib/hbqt/hbqt_misc.prg
|
||||
% Fixed small omission, thanks Vailton.
|
||||
* contrib/hbxbp/xbprtf.prg
|
||||
% Fixed wrong Qt call, thanks Vailton.
|
||||
|
||||
* contrib/hbide/hbide.hbp
|
||||
* contrib/hbide/hbide.prg
|
||||
+ contrib/hbide/idefindreplace.prg
|
||||
! Separated Find/Replace class.
|
||||
2nd round of reforms.
|
||||
More follows.
|
||||
|
||||
2009-12-28 20:48 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* src/vm/fm.c
|
||||
* include/hbapi.h
|
||||
|
||||
@@ -20,4 +20,5 @@ idetags.prg
|
||||
idemisc.prg
|
||||
ideactions.prg
|
||||
ideeditor.prg
|
||||
idefindreplace.prg
|
||||
ideparseexpr.c
|
||||
|
||||
@@ -98,8 +98,7 @@ PROCEDURE Main( cProjIni )
|
||||
s_resPath := hb_DirBase() + "resources" + hb_OsPathSeparator()
|
||||
s_pathSep := hb_OsPathSeparator()
|
||||
|
||||
oIde := HbIde():new( cProjIni )
|
||||
oIde:create()
|
||||
oIde := HbIde():new( cProjIni ):create()
|
||||
oIde:destroy()
|
||||
|
||||
RETURN
|
||||
@@ -225,13 +224,6 @@ CLASS HbIde
|
||||
|
||||
DATA oProps
|
||||
DATA oFR
|
||||
METHOD find()
|
||||
METHOD onClickFind()
|
||||
METHOD replace()
|
||||
METHOD replaceSelection()
|
||||
METHOD onClickReplace()
|
||||
METHOD findReplace()
|
||||
METHOD updateFindReplaceData()
|
||||
|
||||
METHOD manageFocusInEditor()
|
||||
METHOD convertSelection()
|
||||
@@ -327,7 +319,7 @@ METHOD HbIde:create( cProjIni )
|
||||
|
||||
//::setPosAndSizeByIni( ::oProjTree:oWidget, ProjectTreeGeometry )
|
||||
|
||||
::findReplace( .f. )
|
||||
::oFR := IdeFindReplace():new():create( Self )
|
||||
|
||||
#if 0
|
||||
qSet := QSettings():new( "Harbour", "HbIde" )
|
||||
@@ -377,15 +369,15 @@ HB_TRACE( HB_TR_ALWAYS, "QSettings", qSet:applicationName(), qSet:value( "state"
|
||||
|
||||
CASE ::mp1 == xbeK_CTRL_F
|
||||
IF !empty( ::qCurEdit )
|
||||
::findReplace( .t. )
|
||||
::oFR:show()
|
||||
ENDIF
|
||||
CASE ::mp1 == xbeK_CTRL_N
|
||||
IF !empty( ::qCurEdit )
|
||||
::find()
|
||||
::oFR:find()
|
||||
ENDIF
|
||||
CASE ::mp1 == xbeK_CTRL_R
|
||||
IF !empty( ::qCurEdit )
|
||||
::replace()
|
||||
::oFR:replace()
|
||||
ENDIF
|
||||
CASE ::mp1 == xbeK_TAB
|
||||
IF !empty( ::qCurEdit )
|
||||
@@ -398,9 +390,7 @@ HB_TRACE( HB_TR_ALWAYS, "QSettings", qSet:applicationName(), qSet:value( "state"
|
||||
::oXbp:handleEvent( ::nEvent, ::mp1, ::mp2 )
|
||||
ENDDO
|
||||
|
||||
IF !empty( ::oFR )
|
||||
::oFR:destroy()
|
||||
ENDIF
|
||||
::oFR:destroy()
|
||||
|
||||
/* Very important - destroy resources */
|
||||
HBXBP_DEBUG( "======================================================" )
|
||||
@@ -1565,7 +1555,7 @@ METHOD HbIde:executeAction( cKey )
|
||||
ENDIF
|
||||
CASE cKey == "Find"
|
||||
IF !empty( ::qCurEdit )
|
||||
::findReplace( .t. )
|
||||
::oFR:show()
|
||||
ENDIF
|
||||
CASE cKey == "SetMark"
|
||||
CASE cKey == "GotoMark"
|
||||
@@ -2227,195 +2217,6 @@ METHOD HbIde:readProcessInfo( nMode, iBytes )
|
||||
|
||||
RETURN nil
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
// Find / Replace
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD HbIde:onClickReplace()
|
||||
|
||||
::updateFindReplaceData( "replace" )
|
||||
|
||||
IF ::oFR:qObj[ "comboReplaceWith" ]:isEnabled()
|
||||
::replace()
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD HbIde:replaceSelection( cReplWith )
|
||||
LOCAL nB, nL, cBuffer
|
||||
|
||||
DEFAULT cReplWith TO ""
|
||||
|
||||
::qCursor := QTextCursor():configure( ::qCurEdit:textCursor() )
|
||||
IF ::qCursor:hasSelection() .and. !empty( cBuffer := ::qCursor:selectedText() )
|
||||
nL := len( cBuffer )
|
||||
nB := ::qCursor:position() - nL
|
||||
|
||||
::qCursor:beginEditBlock()
|
||||
::qCursor:removeSelectedText()
|
||||
::qCursor:insertText( cReplWith )
|
||||
::qCursor:setPosition( nB )
|
||||
::qCursor:movePosition( QTextCursor_NextCharacter, QTextCursor_KeepAnchor, len( cReplWith ) )
|
||||
::qCurEdit:setTextCursor( ::qCursor )
|
||||
::qCursor:endEditBlock()
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD HbIde:replace()
|
||||
LOCAL cReplWith
|
||||
LOCAL nFound
|
||||
|
||||
IF !empty( ::qCurEdit )
|
||||
cReplWith := QLineEdit():configure( ::oFR:qObj[ "comboReplaceWith" ]:lineEdit() ):text()
|
||||
::replaceSelection( cReplWith )
|
||||
|
||||
IF ::oFR:qObj[ "checkGlobal" ]:isChecked()
|
||||
IF ::oFR:qObj[ "checkNoPrompting" ]:isChecked()
|
||||
nFound := 1
|
||||
DO WHILE ::find( .f. )
|
||||
nFound++
|
||||
::replaceSelection( cReplWith )
|
||||
ENDDO
|
||||
::oSBar:getItem( SB_PNL_MAIN ):caption := '<font color="2343212"><b>Replaced [' + hb_ntos( nFound ) + "] : "+ cReplWith + "</b></font>"
|
||||
::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. )
|
||||
::oFR:qObj[ "checkGlobal" ]:setChecked( .f. )
|
||||
::oFR:qObj[ "checkNoPrompting" ]:setChecked( .f. )
|
||||
ELSE
|
||||
::find()
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD HbIde:onClickFind()
|
||||
LOCAL lFound, nPos
|
||||
|
||||
::updateFindReplaceData( "find" )
|
||||
|
||||
IF ::oFR:qObj[ "radioEntire" ]:isChecked()
|
||||
::oFR:qObj[ "radioFromCursor" ]:setChecked( .t. )
|
||||
::qCursor := QTextCursor():configure( ::qCurEdit:textCursor() )
|
||||
nPos := ::qCursor:position()
|
||||
|
||||
::qCursor:setPosition( 0 )
|
||||
::qCurEdit:setTextCursor( ::qCursor )
|
||||
IF !( lFound := ::find() )
|
||||
::qCursor:setPosition( nPos )
|
||||
::qCurEdit:setTextCursor( ::qCursor )
|
||||
ENDIF
|
||||
ELSE
|
||||
lFound := ::find()
|
||||
ENDIF
|
||||
|
||||
IF lFound
|
||||
::oFR:qObj[ "buttonReplace" ]:setEnabled( .t. )
|
||||
::oFR:qObj[ "checkGlobal" ]:setEnabled( .t. )
|
||||
::oFR:qObj[ "checkNoPrompting" ]:setEnabled( .t. )
|
||||
ELSE
|
||||
::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. )
|
||||
::oFR:qObj[ "checkGlobal" ]:setEnabled( .f. )
|
||||
::oFR:qObj[ "checkNoPrompting" ]:setEnabled( .f. )
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD HbIde:find( lWarn )
|
||||
LOCAL nFlags
|
||||
LOCAL cText := QLineEdit():configure( ::oFR:qObj[ "comboFindWhat" ]:lineEdit() ):text()
|
||||
LOCAL lFound := .f.
|
||||
|
||||
DEFAULT lWarn TO .t.
|
||||
|
||||
IF !empty( cText )
|
||||
nFlags := 0
|
||||
nFlags += iif( ::oFR:qObj[ "checkMatchCase" ]:isChecked(), QTextDocument_FindCaseSensitively, 0 )
|
||||
nFlags += iif( ::oFR:qObj[ "radioUp" ]:isChecked(), QTextDocument_FindBackward, 0 )
|
||||
|
||||
IF !( lFound := ::qCurEdit:find( cText, nFlags ) ) .and. lWarn
|
||||
ShowWarning( "Cannot find : " + cText )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN lFound
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD HbIde:updateFindReplaceData( cMode )
|
||||
LOCAL cData
|
||||
|
||||
IF cMode == "find"
|
||||
cData := QLineEdit():configure( ::oFR:qObj[ "comboFindWhat" ]:lineEdit() ):text()
|
||||
IF !empty( cData )
|
||||
IF ascan( ::aIni[ INI_FIND ], {|e| e == cData } ) == 0
|
||||
hb_ains( ::aIni[ INI_FIND ], 1, cData, .t. )
|
||||
::oFR:qObj[ "comboFindWhat" ]:insertItem( 0, cData )
|
||||
ENDIF
|
||||
ENDIF
|
||||
//
|
||||
::oSBar:getItem( SB_PNL_SEARCH ):caption := "FIND: " + cData
|
||||
ELSE
|
||||
cData := QLineEdit():configure( ::oFR:qObj[ "comboReplaceWith" ]:lineEdit() ):text()
|
||||
IF !empty( cData )
|
||||
IF ascan( ::aIni[ INI_REPLACE ], cData ) == 0
|
||||
hb_ains( ::aIni[ INI_REPLACE ], 1, cData, .t. )
|
||||
::oFR:qObj[ "comboReplaceWith" ]:insertItem( 0, cData )
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD HbIde:findReplace( lShow )
|
||||
|
||||
IF empty( ::oFR )
|
||||
::oFR := XbpQtUiLoader():new( ::oDlg )
|
||||
::oFR:file := s_resPath + "finddialog.ui"
|
||||
::oFR:create()
|
||||
::oFR:setWindowFlags( Qt_Sheet )
|
||||
|
||||
aeval( ::aIni[ INI_FIND ], {|e| ::oFR:qObj[ "comboFindWhat" ]:addItem( e ) } )
|
||||
aeval( ::aIni[ INI_REPLACE ], {|e| ::oFR:qObj[ "comboReplaceWith" ]:addItem( e ) } )
|
||||
|
||||
::oFR:qObj[ "radioFromCursor" ]:setChecked( .t. )
|
||||
::oFR:qObj[ "radioDown" ]:setChecked( .t. )
|
||||
|
||||
::oFR:signal( "buttonFind" , "clicked()", {|| ::onClickFind() } )
|
||||
::oFR:signal( "buttonReplace", "clicked()", {|| ::onClickReplace() } )
|
||||
::oFR:signal( "buttonClose" , "clicked()", ;
|
||||
{|| ::aIni[ INI_HBIDE, FindDialogGeometry ] := PosAndSize( ::oFR:oWidget ), ::oFR:hide() } )
|
||||
|
||||
::oFR:signal( "comboFindWhat", "currentIndexChanged(text)", {|o,p| o := o, ::oSBar:getItem( SB_PNL_SEARCH ):caption := "FIND: " + p } )
|
||||
|
||||
::oFR:signal( "checkListOnly", "stateChanged(int)", {|o,p| o := o, ;
|
||||
::oFR:qObj[ "comboReplaceWith" ]:setEnabled( p == 0 ), ;
|
||||
iif( p == 1, ::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. ), NIL ) } )
|
||||
|
||||
// Comment out following line to generate run-time error
|
||||
// ::oFR:qObj[ "checkGlobal" ]:seteEnabled( .f. )
|
||||
ENDIF
|
||||
|
||||
IF lShow
|
||||
::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. )
|
||||
::oFR:qObj[ "checkGlobal" ]:setEnabled( .f. )
|
||||
::oFR:qObj[ "checkNoPrompting" ]:setEnabled( .f. )
|
||||
::oFR:qObj[ "checkListOnly" ]:setChecked( .f. )
|
||||
::setPosByIni( ::oFR:oWidget, FindDialogGeometry )
|
||||
::oFR:qObj[ "comboFindWhat" ]:setFocus()
|
||||
::oFR:show()
|
||||
ENDIF
|
||||
RETURN Nil
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD HbIde:goto()
|
||||
|
||||
308
harbour/contrib/hbide/idefindreplace.prg
Normal file
308
harbour/contrib/hbide/idefindreplace.prg
Normal file
@@ -0,0 +1,308 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
*
|
||||
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* EkOnkar
|
||||
* ( The LORD is ONE )
|
||||
*
|
||||
* Harbour-Qt IDE
|
||||
*
|
||||
* Pritpal Bedi <pritpal@vouchcac.com>
|
||||
* 17Nov2009
|
||||
*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Many thanks to Vailton Renato for adding new functionalities.
|
||||
*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include "hbide.ch"
|
||||
#include "common.ch"
|
||||
#include "hbclass.ch"
|
||||
#include "hbqt.ch"
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
CLASS IdeFindReplace
|
||||
|
||||
DATA oIde
|
||||
DATA oFR
|
||||
|
||||
ACCESS qCurEdit INLINE ::oIde:qCurEdit
|
||||
|
||||
METHOD new()
|
||||
METHOD create()
|
||||
METHOD destroy()
|
||||
METHOD show()
|
||||
METHOD onClickReplace()
|
||||
METHOD replaceSelection()
|
||||
METHOD replace()
|
||||
METHOD onClickFind()
|
||||
METHOD find()
|
||||
METHOD updateFindReplaceData()
|
||||
|
||||
ENDCLASS
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeFindReplace:new( oIde )
|
||||
|
||||
::oIde := oIde
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeFindReplace:create( oIde )
|
||||
|
||||
DEFAULT oIde TO ::oIde
|
||||
|
||||
::oIde := oIde
|
||||
|
||||
::oFR := XbpQtUiLoader():new( ::oIde:oDlg )
|
||||
::oFR:file := ::oIde:resPath + "finddialog.ui"
|
||||
::oFR:create()
|
||||
::oFR:setWindowFlags( Qt_Sheet )
|
||||
|
||||
aeval( ::oIde:aIni[ INI_FIND ], {|e| ::oFR:qObj[ "comboFindWhat" ]:addItem( e ) } )
|
||||
aeval( ::oIde:aIni[ INI_REPLACE ], {|e| ::oFR:qObj[ "comboReplaceWith" ]:addItem( e ) } )
|
||||
|
||||
::oFR:qObj[ "radioFromCursor" ]:setChecked( .t. )
|
||||
::oFR:qObj[ "radioDown" ]:setChecked( .t. )
|
||||
|
||||
::oFR:signal( "buttonFind" , "clicked()", {|| ::onClickFind() } )
|
||||
::oFR:signal( "buttonReplace", "clicked()", {|| ::onClickReplace() } )
|
||||
::oFR:signal( "buttonClose" , "clicked()", ;
|
||||
{|| ::oIde:aIni[ INI_HBIDE, FindDialogGeometry ] := PosAndSize( ::oFR:oWidget ), ::oFR:hide() } )
|
||||
|
||||
::oFR:signal( "comboFindWhat", "currentIndexChanged(text)", ;
|
||||
{|o,p| o := o, ::oIde:oSBar:getItem( SB_PNL_SEARCH ):caption := "FIND: " + p } )
|
||||
|
||||
::oFR:signal( "checkListOnly", "stateChanged(int)", {|o,p| o := o, ;
|
||||
::oFR:qObj[ "comboReplaceWith" ]:setEnabled( p == 0 ), ;
|
||||
iif( p == 1, ::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. ), NIL ) } )
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeFindReplace:destroy()
|
||||
|
||||
::oFR:hide()
|
||||
::oFR:oWidget:pPtr := 0
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeFindReplace:show()
|
||||
|
||||
::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. )
|
||||
::oFR:qObj[ "checkGlobal" ]:setEnabled( .f. )
|
||||
::oFR:qObj[ "checkNoPrompting" ]:setEnabled( .f. )
|
||||
::oFR:qObj[ "checkListOnly" ]:setChecked( .f. )
|
||||
::oIde:setPosByIni( ::oFR:oWidget, FindDialogGeometry )
|
||||
::oFR:qObj[ "comboFindWhat" ]:setFocus()
|
||||
::oFR:show()
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeFindReplace:onClickReplace()
|
||||
|
||||
::updateFindReplaceData( "replace" )
|
||||
|
||||
IF ::oFR:qObj[ "comboReplaceWith" ]:isEnabled()
|
||||
::replace()
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeFindReplace:replaceSelection( cReplWith )
|
||||
LOCAL nB, nL, cBuffer, qCursor
|
||||
|
||||
DEFAULT cReplWith TO ""
|
||||
|
||||
qCursor := QTextCursor():configure( ::qCurEdit:textCursor() )
|
||||
IF qCursor:hasSelection() .and. !empty( cBuffer := qCursor:selectedText() )
|
||||
nL := len( cBuffer )
|
||||
nB := qCursor:position() - nL
|
||||
|
||||
qCursor:beginEditBlock()
|
||||
qCursor:removeSelectedText()
|
||||
qCursor:insertText( cReplWith )
|
||||
qCursor:setPosition( nB )
|
||||
qCursor:movePosition( QTextCursor_NextCharacter, QTextCursor_KeepAnchor, len( cReplWith ) )
|
||||
::qCurEdit:setTextCursor( qCursor )
|
||||
qCursor:endEditBlock()
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeFindReplace:replace()
|
||||
LOCAL cReplWith
|
||||
LOCAL nFound
|
||||
|
||||
IF !empty( ::qCurEdit )
|
||||
cReplWith := QLineEdit():configure( ::oFR:qObj[ "comboReplaceWith" ]:lineEdit() ):text()
|
||||
::replaceSelection( cReplWith )
|
||||
|
||||
IF ::oFR:qObj[ "checkGlobal" ]:isChecked()
|
||||
IF ::oFR:qObj[ "checkNoPrompting" ]:isChecked()
|
||||
nFound := 1
|
||||
DO WHILE ::find( .f. )
|
||||
nFound++
|
||||
::replaceSelection( cReplWith )
|
||||
ENDDO
|
||||
::oIde:oSBar:getItem( SB_PNL_MAIN ):caption := '<font color="2343212"><b>Replaced [' + hb_ntos( nFound ) + "] : "+ cReplWith + "</b></font>"
|
||||
::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. )
|
||||
::oFR:qObj[ "checkGlobal" ]:setChecked( .f. )
|
||||
::oFR:qObj[ "checkNoPrompting" ]:setChecked( .f. )
|
||||
ELSE
|
||||
::find()
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeFindReplace:onClickFind()
|
||||
LOCAL lFound, nPos, qCursor
|
||||
|
||||
::updateFindReplaceData( "find" )
|
||||
|
||||
IF ::oFR:qObj[ "radioEntire" ]:isChecked()
|
||||
::oFR:qObj[ "radioFromCursor" ]:setChecked( .t. )
|
||||
qCursor := QTextCursor():configure( ::qCurEdit:textCursor() )
|
||||
nPos := qCursor:position()
|
||||
|
||||
qCursor:setPosition( 0 )
|
||||
::qCurEdit:setTextCursor( qCursor )
|
||||
IF !( lFound := ::find() )
|
||||
::qCursor:setPosition( nPos )
|
||||
::qCurEdit:setTextCursor( qCursor )
|
||||
ENDIF
|
||||
ELSE
|
||||
lFound := ::find()
|
||||
ENDIF
|
||||
|
||||
IF lFound
|
||||
::oFR:qObj[ "buttonReplace" ]:setEnabled( .t. )
|
||||
::oFR:qObj[ "checkGlobal" ]:setEnabled( .t. )
|
||||
::oFR:qObj[ "checkNoPrompting" ]:setEnabled( .t. )
|
||||
ELSE
|
||||
::oFR:qObj[ "buttonReplace" ]:setEnabled( .f. )
|
||||
::oFR:qObj[ "checkGlobal" ]:setEnabled( .f. )
|
||||
::oFR:qObj[ "checkNoPrompting" ]:setEnabled( .f. )
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeFindReplace:find( lWarn )
|
||||
LOCAL nFlags
|
||||
LOCAL cText := QLineEdit():configure( ::oFR:qObj[ "comboFindWhat" ]:lineEdit() ):text()
|
||||
LOCAL lFound := .f.
|
||||
|
||||
DEFAULT lWarn TO .t.
|
||||
|
||||
IF !empty( cText )
|
||||
nFlags := 0
|
||||
nFlags += iif( ::oFR:qObj[ "checkMatchCase" ]:isChecked(), QTextDocument_FindCaseSensitively, 0 )
|
||||
nFlags += iif( ::oFR:qObj[ "radioUp" ]:isChecked(), QTextDocument_FindBackward, 0 )
|
||||
|
||||
IF !( lFound := ::qCurEdit:find( cText, nFlags ) ) .and. lWarn
|
||||
ShowWarning( "Cannot find : " + cText )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN lFound
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeFindReplace:updateFindReplaceData( cMode )
|
||||
LOCAL cData
|
||||
|
||||
IF cMode == "find"
|
||||
cData := QLineEdit():configure( ::oFR:qObj[ "comboFindWhat" ]:lineEdit() ):text()
|
||||
IF !empty( cData )
|
||||
IF ascan( ::oIde:aIni[ INI_FIND ], {|e| e == cData } ) == 0
|
||||
hb_ains( ::oIde:aIni[ INI_FIND ], 1, cData, .t. )
|
||||
::oFR:qObj[ "comboFindWhat" ]:insertItem( 0, cData )
|
||||
ENDIF
|
||||
ENDIF
|
||||
//
|
||||
::oIde:oSBar:getItem( SB_PNL_SEARCH ):caption := "FIND: " + cData
|
||||
ELSE
|
||||
cData := QLineEdit():configure( ::oFR:qObj[ "comboReplaceWith" ]:lineEdit() ):text()
|
||||
IF !empty( cData )
|
||||
IF ascan( ::oIde:aIni[ INI_REPLACE ], cData ) == 0
|
||||
hb_ains( ::oIde:aIni[ INI_REPLACE ], 1, cData, .t. )
|
||||
::oFR:qObj[ "comboReplaceWith" ]:insertItem( 0, cData )
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -134,6 +134,8 @@ FUNCTION hbqt_showError( cMsg )
|
||||
ELSE
|
||||
IF SubStr( cMsg, 1, 1 ) == "_"
|
||||
s := SubStr( cMsg, 2 )
|
||||
ELSE
|
||||
s := cMsg
|
||||
ENDIF
|
||||
hbqt_messageBox( ":" + s, "Message not found - " + ProcName( 2 ) + ":" + hb_ntos( ProcLine( 2 ) ) )
|
||||
ENDIF
|
||||
|
||||
@@ -700,7 +700,7 @@ METHOD XbpRtf:textRTF( ... ) // ""
|
||||
LOCAL aP := hb_aParams()
|
||||
|
||||
IF len( aP ) == 1 .and. hb_isChar( aP[ 1 ] )
|
||||
::oWidget:setHtmlText( aP[ 1 ] )
|
||||
::oWidget:setHTML( aP[ 1 ] )
|
||||
ENDIF
|
||||
|
||||
IF len( aP ) >= 1
|
||||
|
||||
Reference in New Issue
Block a user