From 7d5641e868b22510414d64cc61d83e3c5b515fc2 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sat, 21 Aug 2010 02:05:24 +0000 Subject: [PATCH] 2010-08-20 19:04 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/idemisc.prg * contrib/hbide/idereportsmanager.prg % Dragging the icons on left-toolbar of ideReports Designer place a rectangular object on the page, experimentations. --- harbour/ChangeLog | 6 ++ harbour/contrib/hbide/idemisc.prg | 11 +++ harbour/contrib/hbide/idereportsmanager.prg | 84 ++++++++++++++++++--- 3 files changed, 89 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 188d919968..20629d2afd 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,12 @@ The license applies to all entries newer than 2009-04-28. */ +2010-08-20 19:04 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/idemisc.prg + * contrib/hbide/idereportsmanager.prg + % Dragging the icons on left-toolbar of ideReports Designer + place a rectangular object on the page, experimentations. + 2010-08-20 11:12 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * package/mpkg_win_nightly.bat * Change cwd to batch dir. diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index ee3643387c..fd4be24f07 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -2120,3 +2120,14 @@ FUNCTION hbide_buildToolbarButton( qToolbar, aBtn ) /*----------------------------------------------------------------------*/ +FUNCTION hbide_getNextID( cType ) + + STATIC hIDs := {=>} + + IF ! hb_hHasKey( hIDs, cType ) + hIDs[ cType ] := 0 + ENDIF + + RETURN ++hIDs[ cType ] + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idereportsmanager.prg b/harbour/contrib/hbide/idereportsmanager.prg index 3c3fdb59d1..84b139ebee 100644 --- a/harbour/contrib/hbide/idereportsmanager.prg +++ b/harbour/contrib/hbide/idereportsmanager.prg @@ -155,7 +155,9 @@ CLASS IdeReportsManager INHERIT IdeObject METHOD buildDesignReport() METHOD setPageSize() METHOD setPaper() - METHOD addRect( qPos, cType, cName ) + METHOD addRect( qPos, cType ) + METHOD addField( qPos, cAlias, cField ) + METHOD addObject( qPos, cType ) ENDCLASS @@ -438,11 +440,25 @@ METHOD IdeReportsManager:execEvent( cEvent, p, p1, p2 ) HB_TRACE( HB_TR_ALWAYS, "application/x-toolbaricon", p2[ 1 ], p2[ 2 ], p2[ 3 ] ) p2[ 2 ] := lower( p2[ 2 ] ) IF p2[ 2 ] == "rect" - ::addRect( QPoint():from( qEvent:scenePos() ), "field" ) + ::addRect( QPoint():from( qEvent:scenePos() ), "Band" ) ENDIF ELSEIF qMime:hasFormat( "application/x-toolbaricon" ) HB_TRACE( HB_TR_ALWAYS, "application/x-toolbaricon", qMime:data(), qMime:html() ) + SWITCH qMime:html() + CASE "Image" + ::addObject( QPoint():from( qEvent:scenePos() ), "Image" ) + EXIT + CASE "Chart" + ::addObject( QPoint():from( qEvent:scenePos() ), "Chart" ) + EXIT + CASE "Gradient" + ::addObject( QPoint():from( qEvent:scenePos() ), "Gradient" ) + EXIT + CASE "Barcode" + ::addObject( QPoint():from( qEvent:scenePos() ), "Barcode" ) + EXIT + ENDSWITCH ELSE ENDIF ENDCASE @@ -477,7 +493,7 @@ METHOD IdeReportsManager:setPaper() ::qPaper := HBQGraphicsRectItem():new() ::qPaper:hbSetBlock( {|p,p1,p2| ::execEvent( "graphicsPaper_block", p, p1, p2 ) } ) - ::qPaper:setFlag( QGraphicsItem_ItemIsMovable, .f. ) + ::qPaper:setFlag( QGraphicsItem_ItemIsMovable , .f. ) ::qPaper:setFlag( QGraphicsItem_ItemIsSelectable, .f. ) ::qPaper:setAcceptDrops( .t. ) @@ -495,22 +511,16 @@ METHOD IdeReportsManager:setPaper() /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:addRect( qPos, cType, cName ) - LOCAL oWidget - - STATIC nID := 0 +METHOD IdeReportsManager:addRect( qPos, cType ) + LOCAL oWidget, cName STATIC nW := 400 STATIC nH := 300 - HB_SYMBOL_UNUSED( qPos ) - HB_SYMBOL_UNUSED( cType ) - nW -= 30 nH -= 30 - DEFAULT cName TO "Rect_" - cName += hb_ntos( ++nID ) + cName := cType + "_" + hb_ntos( hbide_getNextID( cType ) ) oWidget := HBQGraphicsRectItem():new() oWidget:hbSetBlock( {|p,p1,p2| ::execEvent( "graphicsPaper_block", p, p1, p2 ) } ) @@ -534,6 +544,56 @@ METHOD IdeReportsManager:addRect( qPos, cType, cName ) /*----------------------------------------------------------------------*/ +METHOD IdeReportsManager:addObject( qPos, cType ) + LOCAL oWidget, cName + LOCAL nW := 50 + LOCAL nH := 30 + + cName := cType + "_" + hb_ntos( hbide_getNextID( cType ) ) + + oWidget := HBQGraphicsRectItem():new() + oWidget:hbSetBlock( {|p,p1,p2| ::execEvent( "graphicsPaper_block", p, p1, p2 ) } ) + oWidget:setFlag( QGraphicsItem_ItemIsMovable , .t. ) + oWidget:setFlag( QGraphicsItem_ItemIsSelectable, .t. ) + oWidget:setPen( QPen():new( Qt_NoPen ) ) + + SWITCH cType + CASE "Barcode" + oWidget:setBrush( QBrush():new( "QColor", QColor():new( 120,200,245 ) ) ) + EXIT + CASE "Chart" + nW := 100 ; nH := 40 + oWidget:setBrush( QBrush():new( "QColor", QColor():new( 200,14,127 ) ) ) + EXIT + CASE "Image" + nW := 120 ; nH := 100 + oWidget:setBrush( QBrush():new( "QColor", QColor():new( 255,180,112 ) ) ) + EXIT + CASE "Gradient" + nW := 90 ; nH := 70 + oWidget:setBrush( QBrush():new( "QColor", QColor():new( 120,255,145 ) ) ) + EXIT + ENDSWITCH + + ::qScene:addItem( oWidget ) + + oWidget:setRect_1( 0, 0, nW, nH ) + IF !empty( qPos ) + oWidget:setPos( qPos ) + ENDIF + ::hItems[ cName ] := oWidget + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeReportsManager:addField( qPos, cAlias, cField ) + HB_SYMBOL_UNUSED( qPos ) + HB_SYMBOL_UNUSED( cAlias ) + HB_SYMBOL_UNUSED( cField ) + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeReportsManager:buildTabBar() ::qTabBar := QTabBar():new()