From: Jeffrey D. <ha...@us...> - 2003-09-17 23:11:08
|
Log Message: ----------- Transparent views (yummy!) set \<view (options) transparent=\true\\> in xml Modified Files: -------------- /cvsroot/decaldev/source/Inject: Inject.idl Panel.cpp Panel.h RootLayer.cpp View.cpp View.h Revision Data ------------- Index: Inject.idl =================================================================== RCS file: /cvsroot/decaldev/source/Inject/Inject.idl,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- Inject.idl 27 Aug 2003 19:02:19 -0000 1.38 +++ Inject.idl 17 Sep 2003 23:10:06 -0000 1.39 @@ -42,6 +42,11 @@ eRenderReformatNext = 0x20 }; +enum eViewFlags +{ + eTransparent = 0x01, +}; + enum eFontOptions { eFontBold = 0x01, @@ -538,6 +543,7 @@ [helpstring("method LoadView")] HRESULT LoadView(long nViewID, IView *pView, IUnknown *pSchema); [helpstring("method Deactivate")] HRESULT Deactivate(); [propputref, helpstring("property Sink")] HRESULT Sink([in] IPanelSink* newVal); + [helpstring("method LoadViewEx")] HRESULT LoadViewEx(long nViewID, IView *pView, IUnknown *pSchema, long lViewFlags); }; [ Index: Panel.cpp =================================================================== RCS file: /cvsroot/decaldev/source/Inject/Panel.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Panel.cpp 30 May 2003 01:49:29 -0000 1.13 +++ Panel.cpp 17 Sep 2003 23:10:06 -0000 1.14 @@ -18,6 +18,7 @@ m_bSizingXR( false ), m_bSizingYT( false ), m_bSizingYB( false ), +m_bTransparent( false ), m_pcView( NULL ), m_Alpha( 255 ) { @@ -137,8 +138,8 @@ RECT rc_pat = { 0, 0, rc.right - rc.left, rc.bottom - rc.top }; static POINT pt_pat = { 0, 0 }; - - m_pBackground->PatBlt( pCanvas, &rc_pat, &pt_pat ); + if( ! m_bTransparent ) + m_pBackground->PatBlt( pCanvas, &rc_pat, &pt_pat ); // Draw the borders RECT rc_border_top = { 0, 0, rc.right - rc.left, szBorder.cy }, @@ -345,6 +346,20 @@ _ASSERTE( pSchema != NULL ); long nAssigned; + + // Set up the layer - note that it is not visible + return pView->LoadControl( m_pSite, nViewID, pSchema, &nAssigned ); +} + +STDMETHODIMP cPanel::LoadViewEx(long nViewID, IView *pView, IUnknown *pSchema, long lViewFlags) +{ + _ASSERTE( pView != NULL ); + _ASSERTE( pSchema != NULL ); + + long nAssigned; + + if( lViewFlags & eTransparent ) + m_bTransparent = true; // Set up the layer - note that it is not visible return pView->LoadControl( m_pSite, nViewID, pSchema, &nAssigned ); Index: Panel.h =================================================================== RCS file: /cvsroot/decaldev/source/Inject/Panel.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Panel.h 17 Apr 2002 00:26:36 -0000 1.6 +++ Panel.h 17 Sep 2003 23:10:06 -0000 1.7 @@ -50,6 +50,7 @@ bool m_bSizingXR; bool m_bSizingYT; bool m_bSizingYB; + bool m_bTransparent; void hideView(); @@ -72,6 +73,7 @@ // IPanel public: STDMETHOD(LoadView)(long nPlugin, IView *pView, IUnknown *pSchema); + STDMETHOD(LoadViewEx)(long nPlugin, IView *pView, IUnknown *pSchema, long lViewFlags); STDMETHOD(get_ActiveView)(/*[out, retval]*/ long *pVal); STDMETHOD(AddView)(long nPluginID, ILayer *pLayer); STDMETHOD(RemoveView)(long nID); Index: RootLayer.cpp =================================================================== RCS file: /cvsroot/decaldev/source/Inject/RootLayer.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- RootLayer.cpp 14 Mar 2003 04:22:08 -0000 1.6 +++ RootLayer.cpp 17 Sep 2003 23:10:06 -0000 1.7 @@ -164,7 +164,7 @@ pView->m_pRoot = this; pView->m_nViewID = m_nNextViewID ++; - pView->loadSchema( strXML, &pRootControl ); + long lViewFlags = pView->loadSchema( strXML, &pRootControl ); if( pRootControl.p ) { @@ -177,7 +177,7 @@ m_pBars->AddBar( pView->m_nViewID, &pView->m_VP ); // Last, create all the controls - pView->m_pPanel->LoadView( pView->m_nViewID, pView, pRootControl ); + pView->m_pPanel->LoadViewEx( pView->m_nViewID, pView, pRootControl, lViewFlags ); if( cManager::_p->m_bXMLViewViewer ) { @@ -185,6 +185,7 @@ pView->Activate( ); } } + else { pView->Release( ); Index: View.cpp =================================================================== RCS file: /cvsroot/decaldev/source/Inject/View.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- View.cpp 14 Sep 2003 00:12:07 -0000 1.19 +++ View.cpp 17 Sep 2003 23:10:06 -0000 1.20 @@ -24,7 +24,7 @@ cManager::_p->clearDestroyList( ); } -void cView::loadSchema( BSTR strSchema, IUnknown **ppRootControl ) +long cView::loadSchema( BSTR strSchema, IUnknown **ppRootControl ) { USES_CONVERSION; @@ -70,15 +70,17 @@ _ASSERTE( FALSE ); pDoc.Release( ); - return; + return 0; } // Get the root element and check it out - loadSchemaObject( pDoc->documentElement, ppRootControl ); + long lViewFlags = loadSchemaObject( pDoc->documentElement, ppRootControl ); pDoc.Release( ); + + return lViewFlags; } -void cView::loadSchemaObject( IUnknown *pObject, IUnknown **ppRootControl ) +long cView::loadSchemaObject( IUnknown *pObject, IUnknown **ppRootControl ) { MSXML::IXMLDOMElementPtr pRoot = pObject; @@ -91,7 +93,8 @@ vLeft = pRoot->getAttribute( _T( "left" ) ), vTop = pRoot->getAttribute( _T( "top" ) ), vWidth = pRoot->getAttribute( _T( "width" ) ), - vHeight = pRoot->getAttribute( _T( "height" ) ); + vHeight = pRoot->getAttribute( _T( "height" ) ), + vTrans = pRoot->getAttribute( _T( "transparent" ) ); // We *must* have a title _ASSERTE( vTitle.vt == VT_BSTR ); @@ -130,7 +133,15 @@ else m_VP.height = static_cast< long >(vHeight); - m_VP.alpha = -1; + if(vTrans.vt == VT_NULL) + m_bTransparent = false; + else + m_bTransparent = static_cast< bool >( vTrans ); + + if( m_bTransparent ) + m_VP.alpha = 255; + else + m_VP.alpha = -1; m_VP.label = _bstr_t(vTitle.bstrVal).copy(); @@ -140,6 +151,13 @@ _ASSERTE( pControl.GetInterfacePtr() != NULL ); pControl->QueryInterface( ppRootControl ); + + long lViewFlags = 0; + + if( m_bTransparent ) + lViewFlags |= eTransparent; + + return lViewFlags; } STDMETHODIMP cView::get_Control(BSTR strName, IControl **pVal) @@ -197,7 +215,7 @@ STDMETHODIMP cView::LoadControl(ILayerSite *pParent, long nID, IUnknown *pSource, long *pAssignedID) { - // Usual parameter validation + // Usual parameter validation _ASSERTE( pParent != NULL ); _ASSERTE( pSource != NULL ); _ASSERTE( pAssignedID != NULL ); @@ -271,9 +289,9 @@ STDMETHODIMP cView::LoadSchema(BSTR strXMLSchema) { - long nPreviousView; - m_pPanel->get_ActiveView( &nPreviousView ); - m_pPanel->RemoveView( m_nViewID ); + long nPreviousView; + m_pPanel->get_ActiveView( &nPreviousView ); + m_pPanel->RemoveView( m_nViewID ); CComPtr< IUnknown > pRootControl; loadSchema( strXMLSchema, &pRootControl ); @@ -281,8 +299,13 @@ // Set the bar params m_pRoot->m_pBars->put_Bar( m_nViewID, &m_VP ); + long lViewFlags = 0; + + if( m_bTransparent ) + lViewFlags |= eTransparent; + // Last, create all the controls - m_pPanel->LoadView( m_nViewID, this, pRootControl ); + m_pPanel->LoadViewEx( m_nViewID, this, pRootControl, lViewFlags ); if( nPreviousView == m_nViewID ) // Reactivate the view Index: View.h =================================================================== RCS file: /cvsroot/decaldev/source/Inject/View.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- View.h 21 Mar 2003 17:08:27 -0000 1.9 +++ View.h 17 Sep 2003 23:10:06 -0000 1.10 @@ -35,6 +35,7 @@ CComPtr< IPanel > m_pPanel; ViewParams m_VP; + bool m_bTransparent; // Named controls struct cNamedControl @@ -46,8 +47,8 @@ typedef std::list< cNamedControl > cNamedControlList; cNamedControlList m_controls; - void loadSchema( BSTR strText, IUnknown **ppRootControl ); - void loadSchemaObject( IUnknown *pObject, IUnknown **ppRootControl ); + long loadSchema( BSTR strText, IUnknown **ppRootControl ); + long loadSchemaObject( IUnknown *pObject, IUnknown **ppRootControl ); BEGIN_COM_MAP(cView) COM_INTERFACE_ENTRY(IView) |