From 77bf020de0536c408bb41af30686ad56350e47b4 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sun, 12 Jul 2009 14:44:41 +0000 Subject: [PATCH] 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 tab to demonstrate various features. + Demonstrated non-Xbase++ compatible feature :insertImage(). Just play. --- harbour/ChangeLog | 13 +++++++ harbour/contrib/hbxbp/tests/demoxbp.prg | 50 ++++++++++++++++++++++-- harbour/contrib/hbxbp/xbp.ch | 10 ++--- harbour/contrib/hbxbp/xbpgeneric.prg | 2 +- harbour/contrib/hbxbp/xbprtf.prg | 51 +++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 9 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d0c83fff87..942c63bcff 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -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 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 diff --git a/harbour/contrib/hbxbp/tests/demoxbp.prg b/harbour/contrib/hbxbp/tests/demoxbp.prg index 245ae2c640..4ef3223ddd 100644 --- a/harbour/contrib/hbxbp/tests/demoxbp.prg +++ b/harbour/contrib/hbxbp/tests/demoxbp.prg @@ -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 + +/*----------------------------------------------------------------------*/ + + diff --git a/harbour/contrib/hbxbp/xbp.ch b/harbour/contrib/hbxbp/xbp.ch index 010f3cba4d..4654ad23c7 100644 --- a/harbour/contrib/hbxbp/xbp.ch +++ b/harbour/contrib/hbxbp/xbp.ch @@ -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 diff --git a/harbour/contrib/hbxbp/xbpgeneric.prg b/harbour/contrib/hbxbp/xbpgeneric.prg index 5596871999..5f3c2c84e5 100644 --- a/harbour/contrib/hbxbp/xbpgeneric.prg +++ b/harbour/contrib/hbxbp/xbpgeneric.prg @@ -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 } ) diff --git a/harbour/contrib/hbxbp/xbprtf.prg b/harbour/contrib/hbxbp/xbprtf.prg index e45b3f71c0..b52c283abb 100644 --- a/harbour/contrib/hbxbp/xbprtf.prg +++ b/harbour/contrib/hbxbp/xbprtf.prg @@ -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 ) + + /**/ + 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 + +/*----------------------------------------------------------------------*/