2011-01-30 19:55 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/hbide/ideformat.prg
    ! Provided: to view formatted results of select text.
      Now if "Selected Text" checkbox is checked then only 
      selected source is supplied for the formatting.
This commit is contained in:
Pritpal Bedi
2011-01-31 03:58:36 +00:00
parent 2709aa1385
commit 7ba6bc0dff
2 changed files with 39 additions and 15 deletions

View File

@@ -16,6 +16,12 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-01-30 19:55 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/ideformat.prg
! Provided: to view formatted results of select text.
Now if "Selected Text" checkbox is checked then only
selected source is supplied for the formatting.
2011-01-30 19:41 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/ideeditor.prg
* contrib/hbide/idemisc.prg

View File

@@ -84,6 +84,7 @@ CLASS IdeFormat INHERIT IdeObject
METHOD destroy()
METHOD show()
METHOD execEvent( cEvent, p )
METHOD format( nMode )
ENDCLASS
@@ -150,33 +151,21 @@ METHOD IdeFormat:show()
/*----------------------------------------------------------------------*/
METHOD IdeFormat:execEvent( cEvent, p )
LOCAL oEdit, aText, cBuffer
HB_SYMBOL_UNUSED( p )
SWITCH cEvent
CASE "checkSelOnly_changed"
::lSelOnly := ::oUI:q_checkSelOnly:checkState() == 1
::lSelOnly := p > 0
EXIT
CASE "buttonStart_clicked"
IF !empty( oEdit := ::oEM:getEditObjectCurrent() )
IF ::lSelOnly
ELSE
cBuffer := oEdit:qEdit:toPlainText()
ENDIF
aText := hb_aTokens( strtran( cBuffer, chr( 13 ) ), chr( 10 ) )
::oFormat:reFormat( aText )
::qEdit:setPlainText( hbide_arrayToMemo( aText ) )
ENDIF
::format( 1 )
EXIT
CASE "buttonUpdSrc_clicked"
::format( 2 )
EXIT
CASE "buttonCancel_clicked"
@@ -191,3 +180,32 @@ METHOD IdeFormat:execEvent( cEvent, p )
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD IdeFormat:format( nMode )
LOCAL oEdit, aText, cBuffer
IF !empty( oEdit := ::oEM:getEditObjectCurrent() )
IF ::lSelOnly
cBuffer := oEdit:getSelectedText()
ELSE
cBuffer := oEdit:qEdit:toPlainText()
ENDIF
aText := hb_aTokens( strtran( cBuffer, chr( 13 ) ), chr( 10 ) )
#ifdef __PRITPAL__
IF nMode == 1
FormatCode( aText, 3 )
ELSE
::oFormat:reFormat( aText )
ENDIF
#else
::oFormat:reFormat( aText )
#endif
::qEdit:setPlainText( hbide_arrayToMemo( aText ) )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/