2012-01-03 14:39 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/hbide/ideconsole.prg
    * Minor.

  * contrib/hbide/finddialog.ui
    * Changed: the appearance and a bit of functionality of 
        "Find & Replace" dialog. It was occupying larger desktop
         territory than needed, which, at times is too precious.

  * contrib/hbide/idefindreplace.prg
    * Reworked: the way "Find What" edit control of "Find & Replace"
        dialog was behaving. Now it is almost at par with XMate.
    * Fixed: the window coordinates were not being maintained either 
        with repositioning or close via "X" button.
This commit is contained in:
Pritpal Bedi
2012-01-03 22:46:41 +00:00
parent accac7cd8e
commit 76ce999013
4 changed files with 172 additions and 129 deletions

View File

@@ -16,6 +16,21 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-01-03 14:39 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/ideconsole.prg
* Minor.
* contrib/hbide/finddialog.ui
* Changed: the appearance and a bit of functionality of
"Find & Replace" dialog. It was occupying larger desktop
territory than needed, which, at times is too precious.
* contrib/hbide/idefindreplace.prg
* Reworked: the way "Find What" edit control of "Find & Replace"
dialog was behaving. Now it is almost at par with XMate.
* Fixed: the window coordinates were not being maintained either
with repositioning or close via "X" button.
2012-01-03 15:40 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* harbour/src/rtl/filebuf.c
! fixed next three integer overflows exploited by HB64 locking mode.

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>415</width>
<height>166</height>
<width>333</width>
<height>155</height>
</rect>
</property>
<property name="windowTitle">
@@ -16,9 +16,9 @@
<widget class="QPushButton" name="buttonFind">
<property name="geometry">
<rect>
<x>332</x>
<y>8</y>
<width>75</width>
<x>272</x>
<y>6</y>
<width>51</width>
<height>24</height>
</rect>
</property>
@@ -29,18 +29,21 @@
<bool>false</bool>
</property>
<property name="default">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton" name="buttonReplace">
<property name="geometry">
<rect>
<x>332</x>
<y>106</y>
<width>75</width>
<x>272</x>
<y>98</y>
<width>51</width>
<height>24</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Replace</string>
</property>
@@ -54,21 +57,27 @@
<widget class="QPushButton" name="buttonClose">
<property name="geometry">
<rect>
<x>332</x>
<y>136</y>
<width>77</width>
<x>272</x>
<y>124</y>
<width>51</width>
<height>24</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Close</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
<widget class="QComboBox" name="comboReplaceWith">
<property name="geometry">
<rect>
<x>70</x>
<y>108</y>
<x>10</x>
<y>100</y>
<width>253</width>
<height>22</height>
</rect>
@@ -80,12 +89,15 @@
<widget class="QCheckBox" name="checkGlobal">
<property name="geometry">
<rect>
<x>70</x>
<y>136</y>
<x>10</x>
<y>128</y>
<width>71</width>
<height>19</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Global</string>
</property>
@@ -93,34 +105,24 @@
<widget class="QCheckBox" name="checkNoPrompting">
<property name="geometry">
<rect>
<x>192</x>
<y>136</y>
<x>132</x>
<y>128</y>
<width>89</width>
<height>19</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>No prompting</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>12</x>
<y>108</y>
<width>53</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Replace:</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>70</x>
<y>60</y>
<x>10</x>
<y>52</y>
<width>161</width>
<height>41</height>
</rect>
@@ -137,6 +139,9 @@
<height>19</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Start from cursor position</string>
</property>
@@ -150,6 +155,9 @@
<height>19</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Entire file</string>
</property>
@@ -158,8 +166,8 @@
<widget class="QGroupBox" name="groupBox_3">
<property name="geometry">
<rect>
<x>240</x>
<y>60</y>
<x>180</x>
<y>52</y>
<width>81</width>
<height>41</height>
</rect>
@@ -176,6 +184,9 @@
<height>19</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>up</string>
</property>
@@ -189,6 +200,9 @@
<height>19</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Down</string>
</property>
@@ -197,12 +211,15 @@
<widget class="QCheckBox" name="checkMatchCase">
<property name="geometry">
<rect>
<x>70</x>
<y>36</y>
<x>10</x>
<y>32</y>
<width>81</width>
<height>19</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Match case</string>
</property>
@@ -210,12 +227,15 @@
<widget class="QCheckBox" name="checkListOnly">
<property name="geometry">
<rect>
<x>192</x>
<y>36</y>
<x>132</x>
<y>32</y>
<width>71</width>
<height>19</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>List only</string>
</property>
@@ -223,8 +243,8 @@
<widget class="QComboBox" name="comboFindWhat">
<property name="geometry">
<rect>
<x>70</x>
<y>10</y>
<x>10</x>
<y>8</y>
<width>253</width>
<height>22</height>
</rect>
@@ -233,19 +253,6 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>51</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Find what:</string>
</property>
</widget>
</widget>
<resources/>
<connections/>

View File

@@ -1035,10 +1035,6 @@ METHOD hbCUIEditor:operate()
keyboard( chr( K_UP ) )
DO WHILE .t.
IF hbide_setExitCuiEd()
EXIT
ENDIF
::nRowPrev := ::nRowCur
::nColPrev := ::nColCur
::xRefresh := OBJ_REFRESH_NIL
@@ -1048,7 +1044,7 @@ METHOD hbCUIEditor:operate()
DO WHILE .t.
::nLastKey := inkey( 0, INKEY_ALL + HB_INKEY_GTEVENT )
IF ::nLastKey <> K_MOUSEMOVE
IF ::nLastKey <> 0 .OR. ::nLastKey <> K_MOUSEMOVE
EXIT
ENDIF
ENDDO

View File

@@ -413,6 +413,8 @@ METHOD IdeSearchReplace:startFromTop()
CLASS IdeFindReplace INHERIT IdeObject
DATA qLineEdit
DATA qReplaceEdit
DATA cText
METHOD new( oIde )
METHOD create( oIde )
@@ -421,7 +423,7 @@ CLASS IdeFindReplace INHERIT IdeObject
METHOD onClickReplace()
METHOD replaceSelection( cReplWith )
METHOD replace()
METHOD onClickFind()
METHOD onClickFind( nFrom )
METHOD find( lWarn )
METHOD updateFindReplaceData( cMode )
@@ -441,6 +443,8 @@ METHOD IdeFindReplace:destroy()
IF !empty( ::oUI )
::qLineEdit:disConnect( "returnPressed()" )
::qLineEdit:disConnect( "textChanged(QString)" )
::qReplaceEdit:disConnect( "returnPressed()" )
::oUI:destroy()
ENDIF
@@ -464,6 +468,8 @@ METHOD IdeFindReplace:create( oIde )
::oUI:q_radioFromCursor:setChecked( .t. )
::oUI:q_radioDown:setChecked( .t. )
::oUI:connect( QEvent_Close, {|| ::oIde:oINI:cFindDialogGeometry := hbide_posAndSize( ::oUI:oWidget ) } )
::oUI:q_buttonFind :connect( "clicked()", {|| ::onClickFind() } )
::oUI:q_buttonReplace:connect( "clicked()", {|| ::onClickReplace() } )
::oUI:q_buttonClose :connect( "clicked()", {|| ::oIde:oINI:cFindDialogGeometry := hbide_posAndSize( ::oUI:oWidget ), ::oUI:hide() } )
@@ -474,32 +480,107 @@ METHOD IdeFindReplace:create( oIde )
iif( p == 1, ::oUI:q_buttonReplace:setEnabled( .f. ), NIL ) } )
::qLineEdit := ::oUI:q_comboFindWhat:lineEdit()
::qLineEdit:connect( "returnPressed()", {|| iif( empty( ::cText ), NIL, ;
::qLineEdit:setText( ::cText ) ), ::cText := "", ::onClickFind( 1 ) } )
::qReplaceEdit := ::oUI:q_comboReplaceWith:lineEdit()
::qReplaceEdit:connect( "returnPressed()", {|| ::onClickReplace() } )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeFindReplace:show()
LOCAL cText
IF ! ::oUI:isHidden()
::oIde:oINI:cFindDialogGeometry := hbide_posAndSize( ::oUI:oWidget )
::oUI:hide()
ENDIF
::oIde:setPosByIniEx( ::oUI:oWidget, ::oINI:cFindDialogGeometry )
::oUI:q_buttonReplace:setEnabled( .f. )
::oUI:q_checkGlobal:setEnabled( .f. )
::oUI:q_checkNoPrompting:setEnabled( .f. )
::oUI:q_checkListOnly:setChecked( .f. )
::oIde:setPosByIniEx( ::oUI:oWidget, ::oINI:cFindDialogGeometry )
::oUI:q_comboFindWhat:setFocus()
IF !empty( cText := ::oEM:getSelectedText() )
::qLineEdit:setText( cText )
IF ! empty( ::cText := ::oEM:getSelectedText() )
::qLineEdit:setText( ::cText )
::updateFindReplaceData( "find" )
ENDIF
::qLineEdit:selectAll()
::oUI:show()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeFindReplace:onClickFind( nFrom )
LOCAL lFound, nPos, qCursor
DEFAULT nFrom TO 0 // Click on Find Button
IF nFrom == 0
::updateFindReplaceData( "find" )
ENDIF
IF ::oUI:q_radioEntire:isChecked()
::oUI:q_radioFromCursor:setChecked( .t. )
qCursor := ::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
::oUI:q_buttonReplace:setEnabled( .t. )
::oUI:q_checkGlobal:setEnabled( .t. )
::oUI:q_checkNoPrompting:setEnabled( .t. )
ELSE
::oUI:q_buttonReplace:setEnabled( .f. )
::oUI:q_checkGlobal:setEnabled( .f. )
::oUI:q_checkNoPrompting:setEnabled( .f. )
::oUI:hide()
::oUI:show()
::oUI:q_comboFindWhat:setFocus()
::qLineEdit:selectAll()
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeFindReplace:find( lWarn )
LOCAL nFlags, qfocus
LOCAL cText := ::oUI:q_comboFindWhat:lineEdit():text()
LOCAL lFound := .f.
DEFAULT lWarn TO .t.
IF ! empty( cText )
nFlags := 0
nFlags += iif( ::oUI:q_checkMatchCase:isChecked(), QTextDocument_FindCaseSensitively, 0 )
nFlags += iif( ::oUI:q_radioUp:isChecked(), QTextDocument_FindBackward, 0 )
IF ! ( lFound := ::oEM:getEditObjectCurrent():findEx( cText, nFlags ) ) .AND. lWarn
qFocus := ::oUI:focusWidget()
hbide_showWarning( "Cannot find : " + cText )
qFocus:setFocus( 0 )
ENDIF
ENDIF
RETURN lFound
/*----------------------------------------------------------------------*/
METHOD IdeFindReplace:onClickReplace()
::updateFindReplaceData( "replace" )
@@ -518,17 +599,16 @@ METHOD IdeFindReplace:replaceSelection( cReplWith )
DEFAULT cReplWith TO ""
qCursor := ::qCurEdit:textCursor()
IF qCursor:hasSelection() .and. !empty( cBuffer := qCursor:selectedText() )
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 ) )
qCursor:setPosition( nB + len( cReplWith ) )
::qCurEdit:setTextCursor( qCursor )
qCursor:endEditBlock()
::oEM:getEditObjectCurrent():clearSelection()
ENDIF
RETURN Self
@@ -564,72 +644,17 @@ METHOD IdeFindReplace:replace()
/*----------------------------------------------------------------------*/
METHOD IdeFindReplace:onClickFind()
LOCAL lFound, nPos, qCursor
::updateFindReplaceData( "find" )
IF ::oUI:q_radioEntire:isChecked()
::oUI:q_radioFromCursor:setChecked( .t. )
qCursor := ::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
::oUI:q_buttonReplace:setEnabled( .t. )
::oUI:q_checkGlobal:setEnabled( .t. )
::oUI:q_checkNoPrompting:setEnabled( .t. )
ELSE
::oUI:q_buttonReplace:setEnabled( .f. )
::oUI:q_checkGlobal:setEnabled( .f. )
::oUI:q_checkNoPrompting:setEnabled( .f. )
::oUI:q_buttonFind:activateWindow()
::oUI:q_buttonFind:setFocus()
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeFindReplace:find( lWarn )
LOCAL nFlags
LOCAL cText := ::oUI:q_comboFindWhat:lineEdit():text()
LOCAL lFound := .f.
DEFAULT lWarn TO .t.
IF !empty( cText )
nFlags := 0
nFlags += iif( ::oUI:q_checkMatchCase:isChecked(), QTextDocument_FindCaseSensitively, 0 )
nFlags += iif( ::oUI:q_radioUp:isChecked(), QTextDocument_FindBackward, 0 )
IF !( lFound := ::oEM:getEditObjectCurrent():findEx( cText, nFlags ) ) .AND. lWarn
hbide_showWarning( "Cannot find : " + cText )
ENDIF
ENDIF
RETURN lFound
/*----------------------------------------------------------------------*/
METHOD IdeFindReplace:updateFindReplaceData( cMode )
LOCAL cData
LOCAL cData, nIndex
IF cMode == "find"
cData := ::oUI:q_comboFindWhat:lineEdit():text()
IF !empty( cData )
IF ascan( ::oINI:aFind, {|e| e == cData } ) == 0
IF ! empty( cData )
IF ( nIndex := ascan( ::oINI:aFind, {|e| e == cData } ) ) == 0
hb_ains( ::oINI:aFind, 1, cData, .t. )
::oUI:q_comboFindWhat:insertItem( 0, cData )
ELSE
::oUI:q_comboFindWhat:setCurrentIndex( nIndex - 1 )
ENDIF
ENDIF
//