diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b2e76b585e..48666cab20 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,19 @@ The license applies to all entries newer than 2009-04-28. */ +2012-08-24 10:13 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/docks.prg + * contrib/hbide/edit.prg + * contrib/hbide/main.prg + + Implemented: in-place toolbar of actions belonging to selected text. + The moment selection of text is initiatiated, either via keyboard + or mouse, a highlighted toolbar will follow the current cursor + position containing actions pertaining to selected text. The toolbar + will hide itself as soon as selection process is over. This seems + to be natural as such but opinions are welcome. Also I foresee + some other attributes which can be implemented on this protocol, + which may follow in next commits. + 2012-08-24 16:17 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/contrib/make.hb * enable concurrent compilation of contrib projects when -j diff --git a/harbour/contrib/hbide/docks.prg b/harbour/contrib/hbide/docks.prg index e71eb87067..694fae9738 100644 --- a/harbour/contrib/hbide/docks.prg +++ b/harbour/contrib/hbide/docks.prg @@ -128,6 +128,7 @@ CLASS IdeDocks INHERIT IdeObject DATA aBtnDocks INIT {} DATA oBtnTabClose + DATA qSelToolbar DATA qMdiToolBar DATA qMdiToolBarL DATA aViewsInfo INIT {} @@ -205,6 +206,7 @@ CLASS IdeDocks INHERIT IdeObject METHOD setToolbarSize( nSize ) METHOD buildCuiEdWidget() METHOD buildUISrcDock() + METHOD buildSelectedTextToolbar() ENDCLASS @@ -534,6 +536,8 @@ METHOD IdeDocks:buildDialog() ::buildSystemTray() + ::buildSelectedTextToolbar() + RETURN Self /*----------------------------------------------------------------------*/ @@ -2043,3 +2047,45 @@ METHOD IdeDocks:buildUISrcDock() RETURN Self /*----------------------------------------------------------------------*/ + +METHOD IdeDocks:buildSelectedTextToolbar() + LOCAL qTBar + + ::qSelToolbar := HbqToolbar():new( "ToolbarSelectedText", ::oDlg:oWidget ) + ::qSelToolbar:orientation := Qt_Horizontal + //::qSelToolbar:size := QSize( val( ::oINI:cToolbarSize ), val( ::oINI:cToolbarSize ) ) + ::qSelToolbar:create( "SelectedText_Toolbar" ) + ::qSelToolbar:setObjectName( "ToolbarSelectedText" ) + ::qSelToolbar:setWindowTitle( "Toolbar: Selected Text" ) + ::qSelToolbar:setWindowFlags( hb_bitOr( Qt_Tool, Qt_FramelessWindowHint ) ) + ::qSelToolbar:setMovable( .T. ) + ::qSelToolbar:setFloatable( .T. ) + ::oDlg:oWidget:addToolBar( Qt_TopToolBarArea, ::qSelToolbar:oWidget ) + ::qSelToolbar:hide() + ::qSelToolbar:setStyleSheet( "" ) + ::qSelToolbar:setStyleSheet( "background-color: yellow;" ) + + qTBar := ::qSelToolbar + + qTBar:addToolButton( "Undo" , "Undo" , hbide_image( "undo" ), {|| ::oEM:undo() }, .f. ) + qTBar:addToolButton( "Redo" , "Redo" , hbide_image( "redo" ), {|| ::oEM:redo() }, .f. ) + qTBar:addSeparator() + qTBar:addToolButton( "Cut" , "Cut" , hbide_image( "cut" ), {|| ::oEM:cut() }, .f. ) + qTBar:addToolButton( "Copy" , "Copy" , hbide_image( "copy" ), {|| ::oEM:copy() }, .f. ) + qTBar:addSeparator() + qTBar:addToolButton( "ToUpper" , "To Upper" , hbide_image( "toupper" ), {|| ::oEM:convertSelection( "ToUpper" ) }, .f. ) + qTBar:addToolButton( "ToLower" , "To Lower" , hbide_image( "tolower" ), {|| ::oEM:convertSelection( "ToLower" ) }, .f. ) + qTBar:addToolButton( "InvertCase", "Invert Case" , hbide_image( "invertcase" ), {|| ::oEM:convertSelection( "Invert" ) }, .f. ) + qTBar:addSeparator() + qTBar:addToolButton( "BlockCmnt" , "Block Comment" , hbide_image( "blockcomment" ), {|| ::oEM:blockComment() }, .f. ) + qTBar:addToolButton( "StreamCmnt", "Stream Comment" , hbide_image( "streamcomment" ), {|| ::oEM:streamComment() }, .f. ) + qTBar:addSeparator() + qTBar:addToolButton( "IndentR" , "Indent Right" , hbide_image( "blockindentr" ), {|| ::oEM:indent( 1 ) }, .f. ) + qTBar:addToolButton( "IndentL" , "Indent Left" , hbide_image( "blockindentl" ), {|| ::oEM:indent( -1 ) }, .f. ) + qTBar:addSeparator() + qTBar:addToolButton( "Sgl2Dbl" , "Single to Double Quotes" , hbide_image( "sgl2dblquote" ), {|| ::oEM:convertDQuotes() }, .f. ) + qTBar:addToolButton( "Dbl2Sgl" , "Double to Single Quotes" , hbide_image( "dbl2sglquote" ), {|| ::oEM:convertQuotes() }, .f. ) + + RETURN Self + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/edit.prg b/harbour/contrib/hbide/edit.prg index 7af4dff48d..2445856990 100644 --- a/harbour/contrib/hbide/edit.prg +++ b/harbour/contrib/hbide/edit.prg @@ -411,7 +411,7 @@ METHOD IdeEdit:connectEditSignals() /*----------------------------------------------------------------------*/ METHOD IdeEdit:execEvent( nMode, p, p1 ) - LOCAL qAct, n, qCursor, cAct, lOtherEdit + LOCAL qAct, n, qCursor, cAct, lOtherEdit, qRect HB_SYMBOL_UNUSED( p1 ) @@ -453,6 +453,15 @@ METHOD IdeEdit:execEvent( nMode, p, p1 ) ::oDK:setStatusText( SB_PNL_SELECTEDCHARS, 0 ) ENDIF + IF ::aSelectionInfo[ 1 ] > -1 + qRect := ::qEdit:cursorRect() + ::oDK:qSelToolbar:move( ::qEdit:viewport():mapToGlobal( QPoint( qRect:x() - 100, qRect:y() + qRect:height() ) ) ) + ::oDK:qSelToolbar:adjustSize() + ::oDK:qSelToolbar:show() + ELSE + ::oDK:qSelToolbar:hide() + ENDIF + ::unHighlight() ::oUpDn:show( Self ) EXIT diff --git a/harbour/contrib/hbide/main.prg b/harbour/contrib/hbide/main.prg index d919b9b14a..9c35a795e4 100644 --- a/harbour/contrib/hbide/main.prg +++ b/harbour/contrib/hbide/main.prg @@ -765,6 +765,7 @@ METHOD HbIde:create( aParams ) /* Fill auto completion lists - it must be the last action and be present here always */ ::oEM:updateCompleter() + ::oDK:qSelToolbar:hide() DO WHILE .t. nEvent := AppEvent( @mp1, @mp2, @oXbp )