diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6a28db19b5..594cf6044a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,39 @@ The license applies to all entries newer than 2009-04-28. */ +2012-08-28 16:45 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/hbide.qrc + + contrib/hbide/resources/stringify.png + * contrib/hbide/docks.prg + * contrib/hbide/edit.prg + * contrib/hbide/editor.prg + + Implementd: Stringify a selection. + The activation is via "Stringify" icon ( added new ) next to + "Double to Single Quotes" icon on editing-instance top toolbar + or Selected-text toolbar. + + The behavior: + Column-selection Mode : + + Simply Superb + Anyway Excellent + Left Blanks + Starts Here and Ends Longer + => + "Simply Superb" + "Anyway Excellent" + " Left Blanks" + "Starts Here and Ends Longer" + + Stream-selection Mode: + Multi-line - No quotes + Single-line|word - no trimming at the right. + + This is a Long text and a part will be Selected. + ^^^^^ - Selection + > + This is a "Long "text and a part will be Selected. + 2012-08-28 14:13 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/dict.prg * contrib/hbide/functions.prg diff --git a/harbour/contrib/hbide/docks.prg b/harbour/contrib/hbide/docks.prg index f00c41dd4f..0b815d13e0 100644 --- a/harbour/contrib/hbide/docks.prg +++ b/harbour/contrib/hbide/docks.prg @@ -1276,6 +1276,7 @@ METHOD IdeDocks:buildMdiToolbar() 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. ) + qTBar:addToolButton( "Stringify" , "Stringify Selection" , hbide_image( "stringify" ), {|| ::oEM:stringify() }, .f. ) qTBar:addSeparator() qTBar:addToolButton( "AlignAt" , "Align At..." , hbide_image( "align_at" ), {|| ::oEM:alignAt() }, .f. ) @@ -2130,6 +2131,7 @@ METHOD IdeDocks:buildSelectedTextToolbar() qTBar:addToolButton( "IndentL" , "Indent Left" , hbide_image( "blockindentl" ), {|| ::oEM:indent( -1 ) }, .f. ) 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. ) + qTBar:addToolButton( "Stringify" , "Stringify Selection" , hbide_image( "stringify" ), {|| ::oEM:stringify() }, .f. ) qTBar:addToolButton( "AlignAt" , "Align At..." , hbide_image( "align_at" ), {|| ::oEM:alignAt() }, .f. ) RETURN Self diff --git a/harbour/contrib/hbide/edit.prg b/harbour/contrib/hbide/edit.prg index 269763aa1f..1addd424a1 100644 --- a/harbour/contrib/hbide/edit.prg +++ b/harbour/contrib/hbide/edit.prg @@ -256,6 +256,7 @@ CLASS IdeEdit INHERIT IdeObject METHOD matchPair( x, y ) METHOD unmatchPair() METHOD alignAt( cAt ) + METHOD stringify() ENDCLASS @@ -1288,6 +1289,40 @@ METHOD IdeEdit:blockIndent( nDirctn ) /*----------------------------------------------------------------------*/ +METHOD IdeEdit:stringify() + LOCAL nT, nL, nB, nR, nW, i, cLine, qCursor, aCord, a_, cTkn, cT1 + + IF ::lReadOnly + RETURN Self + ENDIF + aCord := ::aSelectionInfo + hbide_normalizeRect( aCord, @nT, @nL, @nB, @nR ) + nW := nR - nL + IF nW > 0 + a_:= hbide_setQCursor( ::qEdit ) ; qCursor := a_[ 1 ] + IF aCord[ 5 ] == __selectionMode_column__ + FOR i := nT TO nB + cLine := ::getLine( i + 1 ) + cTkn := SubStr( cLine, nL + 1, nR - nL ) + cT1 := Trim( cTkn ) + cTkn := '"' + cT1 + '"' + Space( Len( cTkn ) - Len( cT1 ) ) + cLine := SubStr( cLine, 1, nL ) + cTkn + SubStr( cLine, nR + 1 ) + hbide_qReplaceLine( qCursor, i, cLine ) + NEXT + ELSEIF aCord[ 1 ] == aCord[ 3 ] /* same line selection */ + cLine := qCursor:block():text() + cTkn := SubStr( cLine, nL + 1, nR - nL ) + cTkn := '"' + cTkn + '"' + cLine := SubStr( cLine, 1, nL ) + cTkn + SubStr( cLine, nR + 1 ) + hbide_qReplaceLine( qCursor, qCursor:blockNumber(), cLine ) + ENDIF + hbide_setQCursor( ::qEdit, a_ ) + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEdit:alignAt( cAt ) LOCAL nT, nL, nB, nR, nW, i, cLine, qCursor, aCord, a_, nMax, n, c1st, c2nd diff --git a/harbour/contrib/hbide/editor.prg b/harbour/contrib/hbide/editor.prg index 409ba71008..b7293a3b8d 100644 --- a/harbour/contrib/hbide/editor.prg +++ b/harbour/contrib/hbide/editor.prg @@ -195,6 +195,7 @@ CLASS IdeEditsManager INHERIT IdeObject METHOD updateFieldsList( cAlias ) METHOD getProto( cWord ) METHOD alignAt() + METHOD stringify() ENDCLASS @@ -901,6 +902,15 @@ METHOD IdeEditsManager:alignAt() /*----------------------------------------------------------------------*/ +METHOD IdeEditsManager:stringify() + LOCAL oEdit + IF !empty( oEdit := ::getEditObjectCurrent() ) + oEdit:stringify() + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEditsManager:switchToReadOnly() LOCAL oEdit IF !empty( oEdit := ::getEditObjectCurrent() ) diff --git a/harbour/contrib/hbide/hbide.qrc b/harbour/contrib/hbide/hbide.qrc index 29a7002689..94c7789501 100644 --- a/harbour/contrib/hbide/hbide.qrc +++ b/harbour/contrib/hbide/hbide.qrc @@ -324,6 +324,7 @@ resources/dc_method.png resources/dc_class.png resources/dc_procedure.png + resources/stringify.png docs/faq.htm diff --git a/harbour/contrib/hbide/resources/stringify.png b/harbour/contrib/hbide/resources/stringify.png new file mode 100644 index 0000000000..2ce1ebb7ba Binary files /dev/null and b/harbour/contrib/hbide/resources/stringify.png differ