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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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() )
|
||||
|
||||
@@ -324,6 +324,7 @@
|
||||
<file>resources/dc_method.png</file>
|
||||
<file>resources/dc_class.png</file>
|
||||
<file>resources/dc_procedure.png</file>
|
||||
<file>resources/stringify.png</file>
|
||||
<file>docs/faq.htm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
BIN
harbour/contrib/hbide/resources/stringify.png
Normal file
BIN
harbour/contrib/hbide/resources/stringify.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 245 B |
Reference in New Issue
Block a user