2009-07-12 07:38 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* harbour/contrib/hbxbp/xbp.ch
    ! Minor formatting.
  * harbour/contrib/hbxbp/xbpgeneric.prg
    ! A small fix.
  * harbour/contrib/hbxbp/xbprtf.prg
    + Implemented :insertImage( cImageFilename ) member - an Harbour extension.
      
  * harbour/contrib/hbxbp/tests/demoxbp.prg
    ! Added pushbuttons in <Rtf> tab to demonstrate various features.
    + Demonstrated non-Xbase++ compatible feature :insertImage().
      Just play.
This commit is contained in:
Pritpal Bedi
2009-07-12 14:44:41 +00:00
parent 5ab31f724c
commit 77bf020de0
5 changed files with 117 additions and 9 deletions

View File

@@ -17,6 +17,19 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-07-12 07:38 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/hbxbp/xbp.ch
! Minor formatting.
* harbour/contrib/hbxbp/xbpgeneric.prg
! A small fix.
* harbour/contrib/hbxbp/xbprtf.prg
+ Implemented :insertImage( cImageFilename ) member - an Harbour extension.
* harbour/contrib/hbxbp/tests/demoxbp.prg
! Added pushbuttons in <Rtf> tab to demonstrate various features.
+ Demonstrated non-Xbase++ compatible feature :insertImage().
Just play.
2009-07-12 07:32 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbourr/contrib/hbqt/QPrinter.cpp
* harbourr/contrib/hbqt/QTextCursor.cpp

View File

@@ -1220,11 +1220,44 @@ FUNCTION Build_PrintDialog( oWnd )
/*----------------------------------------------------------------------*/
FUNCTION Build_Rtf( oWnd )
LOCAL oRTF
LOCAL oRTF, oBtn
LOCAL sz_:= oWnd:currentSize()
oBtn := XbpPushButton():new( oWnd, , {10,sz_[2]-70}, {50,35} )
oBtn:caption := 'Image'
oBtn:create()
oBtn:activate := {|| RtfInsertImage( oRtf ) }
oBtn := XbpPushButton():new( oWnd, , {10+60,sz_[2]-70}, {50,35} )
oBtn:caption := 'Undo'
oBtn:create()
oBtn:activate := {|| oRtf:undo() }
oBtn := XbpPushButton():new( oWnd, , {10+120,sz_[2]-70}, {50,35} )
oBtn:caption := 'Redo'
oBtn:create()
#ifdef __HARBOUR__
oBtn:activate := {|| oRtf:redo() }
#endif
oBtn := XbpPushButton():new( oWnd, , {10+180,sz_[2]-70}, {50,35} )
oBtn:caption := 'ULine'
oBtn:create()
oBtn:activate := {|| oRtf:selUnderline := .t. }
oBtn := XbpPushButton():new( oWnd, , {10+240,sz_[2]-70}, {50,35} )
oBtn:caption := 'Bold'
oBtn:create()
oBtn:activate := {|| oRtf:selBold := .t. }
oBtn := XbpPushButton():new( oWnd, , {10+295,sz_[2]-70}, {45,35} )
oBtn:caption := 'Italic'
oBtn:create()
oBtn:activate := {|| oRtf:selItalic := .t. }
oRTF := XbpRtf():new( oWnd )
oRTF:create( , , { 10,10 }, { sz_[ 1 ]-23, sz_[ 2 ]-50 } )
oRTF:create( , , { 10,10 }, { sz_[ 1 ]-23, sz_[ 2 ]-90 } )
oRTF:setColorBG( GraMakeRGBColor( {255,255,200} ) )
oRTF:setFontCompoundName( "12.Times" )
@@ -1268,8 +1301,19 @@ FUNCTION Build_Rtf( oWnd )
// Reset the text cursor
//
oRTF:SelStart := Len( oRTF:Text )
oRTF:insertImage( 'copy.png' )
RETURN nil
/*----------------------------------------------------------------------*/
STATIC FUNCTION RtfInsertImage( oRtf )
// Proivide a selection dialog
oRtf:insertImage( "abs3.png" )
RETURN nil
/*----------------------------------------------------------------------*/

View File

@@ -283,12 +283,12 @@
#define XBPBMP_DEF_COMPRESSION -1
#define XBPPDLG_PRINT_MARK 1
#define XBPPDLG_PRINT_ALLPAGES 2
#define XBPPDLG_PRINT_PAGERANGE 3
#define XBPPDLG_PRINT_MARK 1
#define XBPPDLG_PRINT_ALLPAGES 2
#define XBPPDLG_PRINT_PAGERANGE 3
#define XBPPDLG_MODE_DRIVER 1
#define XBPPDLG_MODE_APPLICATION 2
#define XBPPDLG_MODE_DRIVER 1
#define XBPPDLG_MODE_APPLICATION 2
#define XBP_SCROLLBAR_NONE 0
#define XBP_SCROLLBAR_HORIZ 1

View File

@@ -365,7 +365,7 @@ FUNCTION ConvertAFact( cMode, nFrom, xValue )
aadd( a_, { GRA_CLR_BLUE , Qt_blue } )
aadd( a_, { GRA_CLR_RED , Qt_red } )
aadd( a_, { GRA_CLR_PINK , Qt_magenta } )
aadd( a_, { GRA_CLR_GREEN , Qt_darkGreen } )
aadd( a_, { GRA_CLR_GREEN , Qt_green } )
aadd( a_, { GRA_CLR_CYAN , Qt_cyan } )
aadd( a_, { GRA_CLR_YELLOW , Qt_yellow } )
aadd( a_, { GRA_CLR_DARKGRAY , Qt_darkGray } )

View File

@@ -130,6 +130,13 @@ CLASS XbpRtf INHERIT XbpWindow
METHOD selTabs( nTab, nPos )
METHOD span( cCharacters, bForward, bExclude )
/*< Harbour Extensions >*/
METHOD redo()
METHOD insertText( cText )
METHOD insertImage( cImageFile )
/*</Harbour Extensions >*/
DATA sl_xbeRTF_Change
METHOD change() SETGET
@@ -193,6 +200,8 @@ METHOD XbpRtf:exeBlock( nEvent, p1 )
CASE nEvent == 1
CASE nEvent == 2
CASE nEvent == 3
::oTextCursor:configure( ::oWidget:textCursor() )
::oCurCursor := ::oTextCursor
CASE nEvent == 4
CASE nEvent == 5
CASE nEvent == 6 /* Xbase++ Implements */
@@ -236,16 +245,25 @@ METHOD XbpRtf:saveFile( cFile )
/*----------------------------------------------------------------------*/
METHOD XbpRtf:clear()
::oWidget:clear()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:copy()
::oWidget:copy()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:cut()
::oWidget:cut()
RETURN Self
/*----------------------------------------------------------------------*/
@@ -285,11 +303,17 @@ METHOD XbpRtf:getLineStart( nLine )
/*----------------------------------------------------------------------*/
METHOD XbpRtf:undo()
::oWidget:undo()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:paste()
::oWidget:paste()
RETURN Self
/*----------------------------------------------------------------------*/
@@ -303,6 +327,14 @@ METHOD XbpRtf:print( oXbpPrinter, lOnlySelection )
/*----------------------------------------------------------------------*/
METHOD XbpRtf:redo()
::oWidget:redo()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selTabs( nTab, nPos )
HB_SYMBOL_UNUSED( nTab )
@@ -628,3 +660,22 @@ METHOD XbpRtf:textRTF( ... ) // ""
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:insertText( cText )
::oWidget:insertPlainText( cText )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:insertImage( cImageFilename )
//::oTextCursor:configure( ::oWidget:textCursor() )
//::oCurCursor := ::oTextCursor
::oCurCursor:insertImage( cImageFilename )
RETURN Self
/*----------------------------------------------------------------------*/