diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 82e7530e6a..e3c2aaf69a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,25 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-06-05 11:01 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/hbqt_hbqplaintextedit.cpp + + * contrib/hbide/hbide.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideedit.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/idefindreplace.prg + * contrib/hbide/ideobject.prg + + Implemented: interface to find next/previous occurance of selected + text in the current editing instance. + + The moment some text is selected in the editor, two tool-buttons will + automatically show-up on the lower-right corner of the editing window + to facilitate you execute "find" operation for selected text up or down. + Buttons will disappear where there is no more selected text. + + The feature was requested by Antonio Linares. + 2010-06-05 17:45 UTC+0200 Xavi (jarabal/at/gmail.com) * contrib/hbwin/win_shell.c + Added protection to typedef SHNAMEMAPPING, LPSHNAMEMAPPING for MINGW64. diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 85fe8dcc2e..2249112144 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -235,6 +235,7 @@ CLASS HbIde DATA oFindDock DATA oSourceThumbnailDock DATA oQScintillaDock + DATA oUpDn DATA lProjTreeVisible INIT .t. DATA lDockRVisible INIT .f. diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index fc4d267f38..cb9e89ba6d 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -137,6 +137,7 @@ CLASS IdeDocks INHERIT IdeObject METHOD animateComponents( nMode ) METHOD buildSourceThumbnail() METHOD buildQScintilla() + METHOD buildUpDownWidget() ENDCLASS @@ -284,6 +285,7 @@ METHOD IdeDocks:buildDockWidgets() ::buildFunctionsDock() ::buildSourceThumbnail() ::buildQScintilla() + ::buildUpDownWidget() /* Bottom Docks */ ::oDlg:oWidget:tabifyDockWidget( ::oDockB:oWidget , ::oDockB1:oWidget ) @@ -330,7 +332,6 @@ METHOD IdeDocks:getADockWidget( nAreas, cObjectName, cWindowTitle, nFlags ) /*----------------------------------------------------------------------*/ - METHOD IdeDocks:execEvent( nMode, p ) DO CASE @@ -491,6 +492,15 @@ METHOD IdeDocks:buildSearchReplaceWidget() /*----------------------------------------------------------------------*/ +METHOD IdeDocks:buildUpDownWidget() + + ::oIde:oUpDn := IdeUpDown():new( ::oIde ):create() + ::oUpDn:oUI:hide() + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeDocks:buildToolBarPanels() LOCAL s, qTBtn, a_, aBtns, qAct LOCAL qSize := QSize():new( 20,20 ) @@ -892,7 +902,7 @@ METHOD IdeDocks:buildStatusBar() ::oSBar:getItem( SB_PNL_MAIN ):autosize := XBPSTATUSBAR_AUTOSIZE_SPRING - ::oSBar:addItem( "", , , , "Ready" ):oWidget:setMinimumWidth( 80 ) + ::oSBar:addItem( "", , , , "Ready" ):oWidget:setMinimumWidth( 40 ) ::oSBar:addItem( "", , , , "Line" ):oWidget:setMinimumWidth( 110 ) ::oSBar:addItem( "", , , , "Column" ):oWidget:setMinimumWidth( 40 ) ::oSBar:addItem( "", , , , "Ins" ):oWidget:setMinimumWidth( 20 ) @@ -907,6 +917,7 @@ METHOD IdeDocks:buildStatusBar() ::oSBar:addItem( "", , , , "Project" ):oWidget:setMinimumWidth( 20 ) ::oSBar:addItem( "", , , , "Theme" ):oWidget:setMinimumWidth( 20 ) + FOR i := 1 TO 6 ::oSBar:oWidget:addWidget( ::getMarkWidget( i ) ) NEXT diff --git a/harbour/contrib/hbide/ideedit.prg b/harbour/contrib/hbide/ideedit.prg index 8f71eca491..7061655d39 100644 --- a/harbour/contrib/hbide/ideedit.prg +++ b/harbour/contrib/hbide/ideedit.prg @@ -472,6 +472,7 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) ::dispStatusInfo() ::oDK:setStatusText( SB_PNL_SELECTEDCHARS, len( ::getSelectedText() ) ) + ::oUpDn:show() EXIT CASE cursorPositionChanged @@ -596,6 +597,9 @@ METHOD IdeEdit:execKeyEvent( nMode, nEvent, p, p1 ) CASE QEvent_Enter CASE QEvent_FocusIn ::resumePrototype() + IF key == QEvent_FocusIn + ::oUpDn:show() + ENDIF EXIT CASE QEvent_Leave diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index a90971a3ff..1c00e2b826 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -1330,6 +1330,8 @@ METHOD IdeEditor:setDocumentProperties() ::connect( ::qTimerSave, "timeout()", {|| ::execEvent( qTimeSave_timeout ) } ) ::qTimerSave:start() ENDIF + + ::oUpDn:show() ENDIF ::nBlock := qCursor:blockNumber() @@ -1435,6 +1437,7 @@ METHOD IdeEditor:activateTab( mp1, mp2, oXbp ) oEdit:qCoEdit:toggleLineNumbers() oEdit:qCoEdit:toggleCurrentLineHighlightMode() oEdit:qCoEdit:dispStatusInfo() + ::oUpDn:show() oEdit:changeThumbnail() ENDIF diff --git a/harbour/contrib/hbide/idefindreplace.prg b/harbour/contrib/hbide/idefindreplace.prg index 83aff3bb4f..b284b69a12 100644 --- a/harbour/contrib/hbide/idefindreplace.prg +++ b/harbour/contrib/hbide/idefindreplace.prg @@ -71,6 +71,121 @@ /*----------------------------------------------------------------------*/ +CLASS IdeUpDown INHERIT IdeObject + + METHOD new( oIde ) + METHOD create( oIde ) + METHOD destroy() + METHOD show() + METHOD position() + METHOD execEvent( cEvent, p ) + + ENDCLASS + +/*----------------------------------------------------------------------*/ + +METHOD IdeUpDown:new( oIde ) + + ::oIde := oIde + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeUpDown:position() + LOCAL qRect, qHSBar, qVSBar, qEdit + + IF !empty( qEdit := ::oEM:getEditCurrent() ) + ::oUI:setParent( qEdit ) + + qHSBar := QScrollBar():from( qEdit:horizontalScrollBar() ) + qVSBar := QScrollBar():from( qEdit:verticalScrollBar() ) + + qRect := QRect():from( qEdit:geometry() ) + + ::oUI:move( qRect:width() - ::oUI:width() - iif( qVSBar:isVisible(), qVSBar:width() , 0 ), ; + qRect:height() - ::oUI:height() - iif( qHSBar:isVisible(), qHSBar:height(), 0 ) ) + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeUpDown:show() + LOCAL oEdit + + IF !empty( oEdit := ::oEM:getEditObjectCurrent() ) + ::position() + + IF !empty( oEdit:getSelectedText() ) + ::oUI:show() + ELSE + ::oUI:hide() + ENDIF + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeUpDown:create( oIde ) + + DEFAULT oIde TO ::oIde + + ::oIde := oIde + + ::oUI := HbQtUI():new( hbide_uic( "updown" ), ::oIde:oDlg:oWidget ):build() + + ::oUI:setWindowFlags( hb_bitOr( Qt_Tool, Qt_FramelessWindowHint ) ) + ::oUI:setFocusPolicy( Qt_NoFocus ) + ::oUI:setMaximumWidth( 55 ) + + ::oUI:q_buttonUp:setIcon( hbide_image( "previous" ) ) + ::oUI:q_buttonUp:setToolTip( "Find Previous" ) + ::oUI:signal( "buttonUp", "clicked()", {|| ::execEvent( "buttonUp_clicked" ) } ) + ::oUI:q_buttonDown:setIcon( hbide_image( "next" ) ) + ::oUI:q_buttonDown:setToolTip( "Find Next" ) + ::oUI:signal( "buttonDown", "clicked()", {|| ::execEvent( "buttonDown_clicked" ) } ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeUpDown:execEvent( cEvent, p ) + LOCAL cText, oEdit + + HB_SYMBOL_UNUSED( p ) + + IF !empty( oEdit := ::oEM:getEditObjectCurrent() ) + cText := oEdit:getSelectedText() + ENDIF + + IF !empty( cText ) + SWITCH cEvent + CASE "buttonUp_clicked" + oEdit:findEx( cText, QTextDocument_FindBackward ) + EXIT + CASE "buttonDown_clicked" + oEdit:findEx( cText, 0 ) + EXIT + ENDSWITCH + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeUpDown:destroy() + + IF hb_isObject( ::oUI ) + ::oUI:destroy() + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ +// +/*----------------------------------------------------------------------*/ + CLASS IdeSearchReplace INHERIT IdeObject DATA oXbp diff --git a/harbour/contrib/hbide/ideobject.prg b/harbour/contrib/hbide/ideobject.prg index 3cea339c83..b9598d0849 100644 --- a/harbour/contrib/hbide/ideobject.prg +++ b/harbour/contrib/hbide/ideobject.prg @@ -192,6 +192,7 @@ CLASS IdeObject ACCESS oSourceThumbnailDock INLINE ::oIde:oSourceThumbnailDock ACCESS oQScintillaDock INLINE ::oIde:oQScintillaDock ACCESS oMainToolbar INLINE ::oIde:oMainToolbar + ACCESS oUpDn INLINE ::oIde:oUpDn ACCESS lProjTreeVisible INLINE ::oIde:lProjTreeVisible ACCESS lDockRVisible INLINE ::oIde:lDockRVisible diff --git a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp index eb15c8834a..ec3136cd15 100644 --- a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp +++ b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp @@ -326,6 +326,8 @@ void HBQPlainTextEdit::hbClearSelection() rowEnds = -1; columnBegins = -1; columnEnds = -1; + + emit selectionChanged(); } /*----------------------------------------------------------------------*/ @@ -786,6 +788,7 @@ void HBQPlainTextEdit::mouseReleaseEvent( QMouseEvent *event ) } selectionState = 1; setCursorWidth( 1 ); + emit selectionChanged(); } /*----------------------------------------------------------------------*/ @@ -858,6 +861,7 @@ void HBQPlainTextEdit::keyReleaseEvent( QKeyEvent * event ) if( selectionState == 2 ) { selectionState = 1; + emit selectionChanged(); } } } @@ -1123,6 +1127,7 @@ bool HBQPlainTextEdit::hbKeyPressSelection( QKeyEvent * event ) break; } } + emit selectionChanged(); repaint(); return true; }