2009-07-14 19:06 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbxbp/xbpfontdialog.prg
* contrib/hbxbp/xbprtf.prg
+ Implemented :print( oXbpPrinter, lOnlySelection ) in XbpRTF() class.
TODO: <lOnlySelection> is not functional yet.
+ Implemented :selFont GETSET METHOD - Harbour Extension - this accepts
XbpFont() object as new font.
* contrib/hbxbp/tests/demoxbp.prg
+ Demonstrated the use of XbpFontDialog() with XbpRTF().
1. Click on <Rtf> tab.
2. Select some text.
3. Click on <Font> Push Button - it will open Font Dialog on the left-top corner.
4. Move around in the font dialog, select every factor available, change it,
you will see the effects on selected text in <Rtf>.
This commit is contained in:
@@ -17,6 +17,22 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-07-14 19:06 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* contrib/hbxbp/xbpfontdialog.prg
|
||||
* contrib/hbxbp/xbprtf.prg
|
||||
+ Implemented :print( oXbpPrinter, lOnlySelection ) in XbpRTF() class.
|
||||
TODO: <lOnlySelection> is not functional yet.
|
||||
+ Implemented :selFont GETSET METHOD - Harbour Extension - this accepts
|
||||
XbpFont() object as new font.
|
||||
|
||||
* contrib/hbxbp/tests/demoxbp.prg
|
||||
+ Demonstrated the use of XbpFontDialog() with XbpRTF().
|
||||
1. Click on <Rtf> tab.
|
||||
2. Select some text.
|
||||
3. Click on <Font> Push Button - it will open Font Dialog on the left-top corner.
|
||||
4. Move around in the font dialog, select every factor available, change it,
|
||||
you will see the effects on selected text in <Rtf>.
|
||||
|
||||
2009-07-15 03:28 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* source/pp/Makefile
|
||||
* config/hpux/global.cf
|
||||
|
||||
@@ -1234,6 +1234,8 @@ FUNCTION Build_Rtf( oWnd )
|
||||
LOCAL sz_:= oWnd:currentSize()
|
||||
LOCAL nW := 50, nG := 8, nH := 20, nT := sz_[2]-55
|
||||
|
||||
//--------------------------------//
|
||||
|
||||
oBtn := XbpPushButton():new( oWnd, , {10+(nW+nG)*0, nT}, {nW,nH} )
|
||||
oBtn:caption := 'Image'
|
||||
oBtn:create()
|
||||
@@ -1266,6 +1268,8 @@ FUNCTION Build_Rtf( oWnd )
|
||||
oBtn:create()
|
||||
oBtn:activate := {|| oRtf:selItalic := .t. }
|
||||
|
||||
//-----------------------------------//
|
||||
|
||||
oBtn := XbpPushButton():new( oWnd, , {10+(nW+nG)*0, nT-25}, {nW,nH} )
|
||||
oBtn:caption := 'Load'
|
||||
oBtn:create()
|
||||
@@ -1286,9 +1290,28 @@ FUNCTION Build_Rtf( oWnd )
|
||||
oBtn:create()
|
||||
oBtn:activate := {|x| x := oRTF:selFontSize, IF( x == 0, x := 11, ), oRTF:selFontSize := x-1 }
|
||||
|
||||
//------------------------//
|
||||
oBtn := XbpPushButton():new( oWnd, , {10+(nW+nG)*4, nT-25}, {nW,nH} )
|
||||
oBtn:caption := 'Print'
|
||||
oBtn:create()
|
||||
oBtn:activate := {|| oRTF:print( , .t. ) }
|
||||
|
||||
oBtn := XbpPushButton():new( oWnd, , {10+(nW+nG)*5, nT-25}, {nW,nH} )
|
||||
oBtn:caption := 'Replace'
|
||||
oBtn:create()
|
||||
oBtn:activate := {|x| x := oRTF:selText, oRTF:selText := "Harbour" }
|
||||
|
||||
//-----------------------------------//
|
||||
|
||||
oBtn := XbpPushButton():new( oWnd, , {10+(nW+nG)*0, nT-50}, {nW,nH} )
|
||||
oBtn:caption := 'Font'
|
||||
oBtn:create()
|
||||
oBtn:activate := {|| RtfApplyFont( oRtf ) }
|
||||
|
||||
|
||||
|
||||
//-----------------------------------//
|
||||
oRTF := XbpRtf():new( oWnd )
|
||||
oRTF:create( , , { 10,10 }, { sz_[ 1 ]-23, sz_[ 2 ]-100 } )
|
||||
oRTF:create( , , { 10,10 }, { sz_[ 1 ]-23, sz_[ 2 ]-125 } )
|
||||
|
||||
oRTF:setColorBG( GraMakeRGBColor( {255,255,200} ) )
|
||||
oRTF:setFontCompoundName( "12.Times" )
|
||||
@@ -1396,3 +1419,14 @@ STATIC FUNCTION RtfSaveDocument( oRTF )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
STATIC FUNCTION RtfApplyFont( oRTF )
|
||||
LOCAL oDlg
|
||||
|
||||
oDlg := XbpFontDialog():new( oRTF, , , , { 20,20 } )
|
||||
oDlg:create()
|
||||
oDlg:activateApply := {|oFont| oRTF:selFont := oFont }
|
||||
oDlg:display( 0 )
|
||||
|
||||
RETURN nil
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -232,6 +232,11 @@ METHOD XbpFontDialog:exeBlock( nEvent, p1 )
|
||||
ELSE
|
||||
::oWidget:accept()
|
||||
ENDIF
|
||||
|
||||
CASE nEvent == 4 /* SIMULATE sl_activateApply for timebeing */
|
||||
IF hb_isBlock( ::sl_activateApply )
|
||||
eval( ::sl_activateApply, ::XbpFontObject(), NIL, self )
|
||||
ENDIF
|
||||
ENDCASE
|
||||
|
||||
RETURN nRet
|
||||
|
||||
@@ -134,7 +134,7 @@ CLASS XbpRtf INHERIT XbpWindow
|
||||
METHOD redo()
|
||||
METHOD insertText( cText )
|
||||
METHOD insertImage( cImageFile )
|
||||
|
||||
METHOD selFont SETGET
|
||||
/*</Harbour Extensions >*/
|
||||
|
||||
DATA sl_xbeRTF_Change
|
||||
@@ -328,9 +328,15 @@ METHOD XbpRtf:paste()
|
||||
|
||||
METHOD XbpRtf:print( oXbpPrinter, lOnlySelection )
|
||||
|
||||
HB_SYMBOL_UNUSED( oXbpPrinter )
|
||||
HB_SYMBOL_UNUSED( lOnlySelection )
|
||||
IF !hb_isObject( oXbpPrinter )
|
||||
oXbpPrinter := XbpPrinter():new():create()
|
||||
ENDIF
|
||||
|
||||
IF hb_isLogical( lOnlySelection ) .and. lOnlySelection
|
||||
::oWidget:print( QT_PTROF( oXbpPrinter:oWidget ) )
|
||||
ELSE
|
||||
::oWidget:print( QT_PTROF( oXbpPrinter:oWidget ) )
|
||||
ENDIF
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -469,6 +475,22 @@ METHOD XbpRtf:selColor( ... )
|
||||
ENDIF
|
||||
RETURN xRet
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
// This is Harour Extension
|
||||
//
|
||||
METHOD XbpRtf:selFont( ... ) // ""
|
||||
LOCAL xRet := NIL
|
||||
LOCAL aP := hb_aParams()
|
||||
|
||||
IF len( aP ) >= 1 .and. hb_isObject( aP[ 1 ] )
|
||||
::oTextCharFormat:pPtr := ::oCurCursor:charFormat()
|
||||
IF ::oTextCharFormat:isValid()
|
||||
::oTextCharFormat:setFont( QT_PTROF( aP[ 1 ]:oWidget ) )
|
||||
::oCurCursor:setCharFormat( QT_PTROF( ::oTextCharFormat ) )
|
||||
ENDIF
|
||||
ENDIF
|
||||
RETURN xRet
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD XbpRtf:selFontName( ... ) // ""
|
||||
@@ -617,8 +639,12 @@ METHOD XbpRtf:selText( ... ) // ""
|
||||
LOCAL xRet := ""
|
||||
LOCAL aP := hb_aParams()
|
||||
|
||||
IF len( aP ) >= 1
|
||||
|
||||
IF( ::oCurCursor:hasSelection() )
|
||||
xRet := ::oCurCursor:selectedText()
|
||||
ENDIF
|
||||
IF len( aP ) >= 1 .and. hb_isChar( aP[ 1 ] )
|
||||
::oCurCursor:removeSelectedText()
|
||||
::oCurCursor:insertText( aP[ 1 ] )
|
||||
ENDIF
|
||||
RETURN xRet
|
||||
|
||||
|
||||
Reference in New Issue
Block a user