diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0e93035ead..e64c697c24 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,22 @@ The license applies to all entries newer than 2009-04-28. */ +2011-04-11 09:36 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtcore/qth/HBQEvents.qth + - Removed: tracelogs. + + * contrib/hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp + ! Optimizations only. + + * contrib/hbxbp/xbpbrowse.prg + * contrib/hbxbp/xbpdialog.prg + * contrib/hbxbp/xbpgeneric.prg + * contrib/hbxbp/xbpparthandler.prg + + Implemented: Xbase++ compatible MDI engine. + Now Xbase++ code can be compiled and run with this feature, Shum ? + TODO: fix some small artifacts when XbpDialog() is made a MDI client. + Resuming it back to desktop it is ok. + 2011-04-10 12:43 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbapicdp.h * harbour/src/rtl/cdpapi.c diff --git a/harbour/contrib/hbqt/qtcore/qth/HBQEvents.qth b/harbour/contrib/hbqt/qtcore/qth/HBQEvents.qth index e9c02ad4a9..459c857b76 100644 --- a/harbour/contrib/hbqt/qtcore/qth/HBQEvents.qth +++ b/harbour/contrib/hbqt/qtcore/qth/HBQEvents.qth @@ -52,11 +52,11 @@ static HB_GARBAGE_FUNC( hbqt_gcMark_HBQEvents ) for( i = t_slots->listBlock.size() - 1; i >= 0 ; i-- ) { - HB_TRACE( HB_TR_ALWAYS, ( "hbqt_gcMark_HBQEvents marking %d", i ) ); +// HB_TRACE( HB_TR_ALWAYS, ( "hbqt_gcMark_HBQEvents marking %d", i ) ); if( t_slots->listBlock[ i ] != NULL ) { hb_gcMark( t_slots->listBlock[ i ] ); - HB_TRACE( HB_TR_ALWAYS, ( " MARKED %d ptr=%p", i, (void *)t_slots->listBlock.at( i ) ) ); +// HB_TRACE( HB_TR_ALWAYS, ( " MARKED %d ptr=%p", i, (void *)t_slots->listBlock.at( i ) ) ); } } } diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp index 9aea67bbd4..a7d3321288 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp @@ -97,19 +97,16 @@ QVariant hbqt_fetchData( PHB_ITEM block, int type, int role, int par1, int par2 { vv = hb_itemGetL( ret ); HB_TRACE( HB_TR_DEBUG, ( " fetchData[ l = %i ]", hb_itemGetL( ret ) ) ); - hb_itemRelease( ret ); } else if( hb_itemType( ret ) & HB_IT_DOUBLE ) { vv = hb_itemGetND( ret ); HB_TRACE( HB_TR_DEBUG, ( " fetchData[ d = %f ]", hb_itemGetND( ret ) ) ); - hb_itemRelease( ret ); } else if( hb_itemType( ret ) & HB_IT_NUMERIC ) { vv = hb_itemGetNI( ret ); HB_TRACE( HB_TR_DEBUG, ( " fetchData[ n = %i ]", hb_itemGetNI( ret ) ) ); - hb_itemRelease( ret ); } else if( hb_itemType( ret ) & HB_IT_OBJECT ) { @@ -132,8 +129,9 @@ QVariant hbqt_fetchData( PHB_ITEM block, int type, int role, int par1, int par2 else if( p->type == HBQT_TYPE_QFont ) vv = * ( ( QFont * ) ( p->ph ) ); - hb_itemRelease( ret ); } + if( ret ) + hb_itemRelease( ret ); hb_vmRequestRestore(); } @@ -176,30 +174,22 @@ QVariant HBQAbstractItemModel::data( const QModelIndex & index, int role ) const if( !index.isValid() ) return QVariant(); - QVariant ret = hbqt_fetchData( block, HBQT_QAIM_data, role, index.column(), index.row() ); - - return ret; + return hbqt_fetchData( block, HBQT_QAIM_data, role, index.column(), index.row() ); } QVariant HBQAbstractItemModel::headerData( int section, Qt::Orientation orientation, int role ) const { - QVariant ret = hbqt_fetchData( block, HBQT_QAIM_headerData, role, orientation, section ); - - return ret; + return hbqt_fetchData( block, HBQT_QAIM_headerData, role, orientation, section ); } int HBQAbstractItemModel::rowCount( const QModelIndex & /*parent = QModelIndex()*/ ) const { - QVariant ret = hbqt_fetchData( block, HBQT_QAIM_rowCount, 0, 0, 0 ); - - return ret.toInt() ; + return hbqt_fetchData( block, HBQT_QAIM_rowCount, 0, 0, 0 ).toInt(); } int HBQAbstractItemModel::columnCount( const QModelIndex & /*parent = QModelIndex()*/ ) const { - QVariant ret = hbqt_fetchData( block, HBQT_QAIM_columnCount, 0, 0, 0 ); - - return ret.toInt() ; + return hbqt_fetchData( block, HBQT_QAIM_columnCount, 0, 0, 0 ).toInt(); } QModelIndex HBQAbstractItemModel::index( int row, int column, const QModelIndex & parent ) const diff --git a/harbour/contrib/hbxbp/xbpbrowse.prg b/harbour/contrib/hbxbp/xbpbrowse.prg index 66747393d9..52e1b7ae00 100644 --- a/harbour/contrib/hbxbp/xbpbrowse.prg +++ b/harbour/contrib/hbxbp/xbpbrowse.prg @@ -774,16 +774,14 @@ METHOD XbpBrowse:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::oFooterView := QHeaderView( Qt_Horizontal ) // ::oFooterView:setHighlightSections( .F. ) - ::oFooterView:setMinimumHeight( 20 ) ::oFooterView:setMaximumHeight( 20 ) ::oFooterView:setResizeMode( QHeaderView_Fixed ) ::oFooterView:setFocusPolicy( Qt_NoFocus ) // ::oFooterModel := HBQAbstractItemModel( {|t,role,x,y| ::supplyInfo( 142, t, role, x, y ) } ) - + // ::oFooterView:setModel( ::oFooterModel ) - ::oFooterView:setFocusPolicy( Qt_NoFocus ) /* Widget for ::setLeftFrozen( aColumns ) */ ::buildLeftFreeze() @@ -1240,7 +1238,7 @@ METHOD XbpBrowse:navigate( p1, p2 ) METHOD XbpBrowse:supplyInfo( nMode, nCall, nRole, nX, nY ) - IF nCall == HBQT_QAIM_headerData .and. nX == Qt_Vertical + IF nCall == HBQT_QAIM_headerData .AND. nX == Qt_Vertical RETURN NIL ENDIF @@ -1263,9 +1261,9 @@ METHOD XbpBrowse:supplyInfo( nMode, nCall, nRole, nX, nY ) ENDIF RETURN ::rowCount ELSEIF nCall == HBQT_QAIM_data - RETURN ::fetchColumnInfo( nCall,nRole, 0, nY+1, nX+1 ) + RETURN ::fetchColumnInfo( nCall, nRole, 0, nY+1, nX+1 ) ELSEIF nCall == HBQT_QAIM_headerData - RETURN ::fetchColumnInfo( nCall,nRole, 0, 0 , nY+1 ) + RETURN ::fetchColumnInfo( nCall, nRole, 0, 0, nY+1 ) ENDIF RETURN nil @@ -1276,9 +1274,9 @@ METHOD XbpBrowse:supplyInfo( nMode, nCall, nRole, nX, nY ) ENDIF RETURN ::colCount ELSEIF nCall == HBQT_QAIM_data - RETURN ::fetchColumnInfo( nCall,nRole, 1, nY+1, nX+1 ) + RETURN ::fetchColumnInfo( nCall, nRole, 1, nY+1, nX+1 ) ELSEIF nCall == HBQT_QAIM_headerData - RETURN ::fetchColumnInfo( nCall,nRole, 1, 0 , nY+1 ) + RETURN ::fetchColumnInfo( nCall, nRole, 1, 0, nY+1 ) ENDIF RETURN nil @@ -1343,7 +1341,7 @@ METHOD XbpBrowse:supplyInfo( nMode, nCall, nRole, nX, nY ) ENDCASE - RETURN nil + RETURN NIL /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbxbp/xbpdialog.prg b/harbour/contrib/hbxbp/xbpdialog.prg index dbc6377925..bb7acce528 100644 --- a/harbour/contrib/hbxbp/xbpdialog.prg +++ b/harbour/contrib/hbxbp/xbpdialog.prg @@ -117,12 +117,17 @@ CLASS XbpDialog FROM XbpWindow DATA aMinSize METHOD minSize( aSize ) SETGET + DATA oMdi + DATA nFlags + ENDCLASS /*----------------------------------------------------------------------*/ METHOD XbpDialog:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + DEFAULT oParent TO AppDeskTop() + ::xbpWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::resizeMode := 0 @@ -155,13 +160,6 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::oWidget:setObjectName( "mainWindow" ) ENDIF - IF !empty( ::title ) - ::oWidget:setWindowTitle( ::title ) - ENDIF - IF hb_isChar( ::icon ) - ::oWidget:setWindowIcon( ::icon ) - ENDIF - IF !empty( ::qtObject ) ::drawingArea:qtObject := ::oWidget:centralWidget() ::drawingArea:create() @@ -172,12 +170,12 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) nFlags := ::oWidget:windowFlags() nnFlags := nFlags - IF !( ::maxButton ) + IF ! ::maxButton IF hb_bitAnd( nFlags, Qt_WindowMaximizeButtonHint ) == Qt_WindowMaximizeButtonHint nFlags -= Qt_WindowMaximizeButtonHint ENDIF ENDIF - IF !( ::minButton ) + IF ! ::minButton IF hb_bitAnd( nFlags, Qt_WindowMinimizeButtonHint ) == Qt_WindowMinimizeButtonHint nFlags -= Qt_WindowMinimizeButtonHint ENDIF @@ -195,8 +193,21 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::oWidget:setWindowFlags( nFlags ) ENDIF + IF !empty( ::title ) + ::oWidget:setWindowTitle( ::title ) + ENDIF + IF hb_isChar( ::icon ) + ::oWidget:setWindowIcon( ::icon ) + ENDIF + + ::nFlags := nFlags + IF __objGetClsName( ::oParent ) == "XBPDRAWINGAREA" + ::setParent( ::oParent ) + ELSE + ::setPosAndSize() + ENDIF + //::setQtProperty() - ::setPosAndSize() IF ::visible ::show() ENDIF @@ -225,6 +236,11 @@ METHOD XbpDialog:destroy() HB_TRACE( HB_TR_DEBUG, ". " ) HB_TRACE( HB_TR_DEBUG, "<<<<<<<<<< XbpDialog:destroy B >>>>>>>>>>" ) + IF ! empty( ::oMdi ) +// ::oParent:oWidget:removeSubWindow( ::oMdi ) + ::oMdi := NIL + ENDIF + ::disconnectWindowEvents() ::oWidget:disconnect( QEvent_Close ) ::oWidget:disconnect( QEvent_WindowActivate ) @@ -375,6 +391,8 @@ CLASS XbpDrawingArea INHERIT XbpWindow METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + DATA oBrush + ENDCLASS /*----------------------------------------------------------------------*/ @@ -397,11 +415,16 @@ METHOD XbpDrawingArea:create( oParent, oOwner, aPos, aSize, aPresParams, lVisibl IF ! empty( ::qtObject ) ::oWidget := ::qtObject:oWidget ELSE + #if 0 ::oWidget := QWidget() + #else + ::oWidget := QMdiArea() + ::oBrush := QApplication():palette():button() + ::oWidget:setBackground( ::oBrush ) + #endif ENDIF ::oWidget:setMouseTracking( .T. ) - // ::oWidget:setFocusPolicy( Qt_StrongFocus ) ::oWidget:setFocusPolicy( Qt_NoFocus ) ::oWidget:setObjectName( hbxbp_getNextID( "XBaseDrawingArea" ) ) diff --git a/harbour/contrib/hbxbp/xbpgeneric.prg b/harbour/contrib/hbxbp/xbpgeneric.prg index 013b3dda5e..0e8a4d98e2 100644 --- a/harbour/contrib/hbxbp/xbpgeneric.prg +++ b/harbour/contrib/hbxbp/xbpgeneric.prg @@ -293,8 +293,7 @@ FUNCTION SetAppFocus( oXbp ) FUNCTION AppDesktop() IF s_oDeskTop == NIL - s_oDeskTop := XbpWindow():new() - s_oDeskTop:oWidget := HbpAppDesktop():new():create() + s_oDeskTop := HbpAppDesktop():new():create() ENDIF RETURN s_oDeskTop diff --git a/harbour/contrib/hbxbp/xbpparthandler.prg b/harbour/contrib/hbxbp/xbpparthandler.prg index 794f8e3190..9262e62b6c 100644 --- a/harbour/contrib/hbxbp/xbpparthandler.prg +++ b/harbour/contrib/hbxbp/xbpparthandler.prg @@ -92,7 +92,7 @@ CLASS XbpPartHandler METHOD delChild( oXbp ) METHOD setName( nNameId ) METHOD setOwner( oXbp ) - METHOD setParent( oXbp ) + METHOD setParent( oParent ) METHOD notifier() @@ -251,11 +251,22 @@ METHOD setOwner( oXbp ) CLASS XbpPartHandler /*----------------------------------------------------------------------*/ -METHOD setParent( oXbp ) CLASS XbpPartHandler +METHOD setParent( oParent ) CLASS XbpPartHandler LOCAL oOldXbp := ::oParent - IF valtype( oXbp ) == "O" - ::oParent := oXbp + IF valtype( oParent ) == "O" + IF __objHasMsg( Self, "OMDI" ) + IF ! empty( ::oMdi ) + ::oParent:oWidget:removeSubWindow( ::oWidget ) //::oMdi ) + ::oWidget:setWindowFlags( ::nFlags ) + ::oMdi:close() + ::oMdi := NIL + ELSEIF __objGetClsName( oParent ) == "XBPDRAWINGAREA" + ::oMdi := oParent:oWidget:addSubWindow( ::oWidget ) + ENDIF + ::oWidget:show() + ENDIF + ::oParent := oParent ENDIF RETURN oOldXbp