⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sitewatc.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: sitewatc.cpp,v 1.2.12.2 2004/07/13 18:31:00 bobclark Exp $ *  * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. *  * The contents of this file, and the files included with this file, * are subject to the current version of the RealNetworks Public * Source License (the "RPSL") available at * http://www.helixcommunity.org/content/rpsl unless you have licensed * the file under the current version of the RealNetworks Community * Source License (the "RCSL") available at * http://www.helixcommunity.org/content/rcsl, in which case the RCSL * will apply. You may also obtain the license terms directly from * RealNetworks.  You may not use this file except in compliance with * the RPSL or, if you have a valid RCSL with RealNetworks applicable * to this file, the RCSL.  Please see the applicable RPSL or RCSL for * the rights, obligations and limitations governing use of the * contents of the file. *  * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL") in which case the provisions of the GPL are applicable * instead of those above. If you wish to allow use of your version of * this file only under the terms of the GPL, and not to allow others * to use your version of this file under the terms of either the RPSL * or RCSL, indicate your decision by deleting the provisions above * and replace them with the notice and other provisions required by * the GPL. If you do not delete the provisions above, a recipient may * use your version of this file under the terms of any one of the * RPSL, the RCSL or the GPL. *  * This file is part of the Helix DNA Technology. RealNetworks is the * developer of the Original Code and owns the copyrights in the * portions it created. *  * This file, and the files included with this file, is distributed * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET * ENJOYMENT OR NON-INFRINGEMENT. *  * Technology Compatibility Kit Test Suite(s) Location: *    http://www.helixcommunity.org/content/tck *  * Contributor(s): *  * ***** END LICENSE BLOCK ***** */// system#include <math.h>#include <time.h>     // smlparse.h dependency// include#include "hxtypes.h"#include "hxwintyp.h"#include "hxcom.h"#include "hxwin.h"#include "smiltype.h"#include "hxengin.h"#include "hxcore.h"  // smldoc.h   dependency#include "hxgroup.h" // smldoc.h   dependency#include "hxsite2.h" // smldoc.h   dependency#include "ihxpckts.h" // smldoc.h   dependency#include "hxvport.h" // smldoc.h   dependency#include "hxclsnk.h" // smldoc.h   dependency#include "hxmmrkr.h" // smldoc.h   dependency#include "hxinter.h" // smldoc.h   dependency#include "hxxml.h"   // smlparse.h dependency#include "hxerror.h"// pnmisc#include "hxwinver.h" // smlparse.h dependency#include "hxtick.h"// pncont#include "hxstring.h"#include "hxmap.h"#include "hxslist.h"// rnxmllib#include "hxxmlprs.h" // smlparse.h dependency// rmasmil#include "smlelem.h"#include "smlparse.h"// smlrendr#include "evnthook.h" // smldoc.h   dependency#include "siteuser.h" // smldoc.h   dependency#include "passivsw.h" // smldoc.h   dependency#include "layout.h"#include "smldoc.h"#include "sitewatc.h"// pndebug#include "smlrmlog.h"#include "hxheap.h"#ifdef _DEBUG#undef HX_THIS_FILE		static const char HX_THIS_FILE[] = __FILE__;#endifCSmilSiteWatcher::CSmilSiteWatcher(CSmilDocumentRenderer* pDoc,                                   const char*            pID,                                   BOOL                   bIsChildSite,                                   const char*            pSourceID) :    m_id(pID),    m_SourceID(pSourceID){    // Initialize the members    m_lRefCount              = 0;    m_pDoc                   = pDoc;    m_pSite                  = NULL;    m_Rect.m_dLeft           = 0.0;    m_Rect.m_eLeftType       = CSS2TypeAuto;    m_Rect.m_dTop            = 0.0;    m_Rect.m_eTopType        = CSS2TypeAuto;    m_Rect.m_dRight          = 0.0;    m_Rect.m_eRightType      = CSS2TypeAuto;    m_Rect.m_dBottom         = 0.0;    m_Rect.m_eBottomType     = CSS2TypeAuto;    m_Rect.m_dWidth          = 0.0;    m_Rect.m_eWidthType      = CSS2TypeAuto;    m_Rect.m_dHeight         = 0.0;    m_Rect.m_eHeightType     = CSS2TypeAuto;    m_RegPoint.m_dLeft       = 0.0;    m_RegPoint.m_eLeftType   = CSS2TypeAuto;    m_RegPoint.m_dTop        = 0.0;    m_RegPoint.m_eTopType    = CSS2TypeAuto;    m_RegPoint.m_dRight      = 0.0;    m_RegPoint.m_eRightType  = CSS2TypeAuto;    m_RegPoint.m_dBottom     = 0.0;    m_RegPoint.m_eBottomType = CSS2TypeAuto;    m_RegPoint.m_eRegAlign   = RegAlignTopLeft;    m_MediaSize.cx           = 0;    m_MediaSize.cy           = 0;    m_eResizeBehavior        = ResizeZoom;    m_dZoomScaleFactorX      = 1.0;    m_dZoomScaleFactorY      = 1.0;    m_bIsChildSite           = bIsChildSite;    m_bChangingSize          = FALSE;    m_bFirstSizeChange       = TRUE;    m_bMediaSizeSet          = FALSE;    m_bMediaIsBrush          = FALSE;    // Initialize the RegPoint    if(m_pDoc)    {        m_pDoc->AddRef();        // RegPoints can come from two places - they can        // either be idrefs or they can be predefined        CSmilSource* pSource = m_pDoc->getSource(pSourceID);        if (pSource)        {            // Check if this is a <brush>            if (pSource->m_pNode &&                pSource->m_pNode->m_tag == SMILBrush)            {                m_bMediaIsBrush = TRUE;            }            // Copy the Layout rect. This is the subregion            // positioning rect which was specified on the            // media element (i.e. - <img ... left="20" .../>)            m_Rect = pSource->m_Rect;            // Get the regPoint            if (pSource->m_bRegPointIsPredef)            {                // Since the regPoint is predefined, then                // there is no regAlign from the <regPoint>.                // Therefore, we need to use the regAlign                // that was specified with the source                m_RegPoint.m_eRegAlign = pSource->m_eRegAlign;                // For predefined regPoints, they are always                // expressed in percentages, not in absolute lengths                m_RegPoint.m_eLeftType = CSS2TypePercentage;                m_RegPoint.m_eTopType  = CSS2TypePercentage;                // Compute the regPoint                switch (pSource->m_ePredefRegPoint)                {                    case RegAlignTopLeft:                        {                            m_RegPoint.m_dLeft = 0.0;                            m_RegPoint.m_dTop  = 0.0;                        }                        break;                    case RegAlignTopMid:                        {                            m_RegPoint.m_dLeft = 50.0;                            m_RegPoint.m_dTop  =  0.0;                        }                        break;                    case RegAlignTopRight:                        {                            m_RegPoint.m_dLeft = 100.0;                            m_RegPoint.m_dTop  =   0.0;                        }                        break;                    case RegAlignMidLeft:                        {                            m_RegPoint.m_dLeft =  0.0;                            m_RegPoint.m_dTop  = 50.0;                        }                        break;                    case RegAlignCenter:                        {                            m_RegPoint.m_dLeft = 50.0;                            m_RegPoint.m_dTop  = 50.0;                        }                        break;                    case RegAlignMidRight:                        {                            m_RegPoint.m_dLeft = 100.0;                            m_RegPoint.m_dTop  =  50.0;                        }                        break;                    case RegAlignBottomLeft:                        {                            m_RegPoint.m_dLeft =   0.0;                            m_RegPoint.m_dTop  = 100.0;                        }                        break;                    case RegAlignBottomMid:                        {                            m_RegPoint.m_dLeft =  50.0;                            m_RegPoint.m_dTop  = 100.0;                        }                        break;                    case RegAlignBottomRight:                        {                            m_RegPoint.m_dLeft = 100.0;                            m_RegPoint.m_dTop  = 100.0;                        }                        break;                }            }            else            {                // The regPoint is not predefined, but rather                // is an idref to a <regPoint> element. So look                // up that element                CSmilRegPoint* pRegPt = m_pDoc->getRegPoint(pSource->m_RegPoint);                if (pRegPt)                {                    // We simply need to copy the RegPoint struct                    // from the CSmilRegPoint element                    m_RegPoint = pRegPt->m_RegPoint;                    // <regPoint> elements have a default "regAlign"                    // attribute. However, the media object element                    // can override this regAlign value.                    if (pSource->m_bRegAlignSpecified)                    {                        // The media object element DID specify                        // a regAlign attribute, so this attribute                        // overrides the regAlign attribute in the                        // <regPoint> element.                        m_RegPoint.m_eRegAlign = pSource->m_eRegAlign;                    }                }            }            // Now we can compute the fit attribute. The default            // fit attribute is specified with the <region>. However,            // the media object element can override this attribute.            // So first we need to get the region.            CSmilBasicRegion* pRegion = m_pDoc->getRegionByID(m_id);            if (pRegion)            {                // Initially assign the region's fit value                m_eFit = pRegion->m_eFit;            }            // Now if the source has specified a fit            // value, then override the region's fit value            if (pSource->m_bFitSpecified)            {                m_eFit = pSource->m_eFit;            }        }    }}CSmilSiteWatcher::~CSmilSiteWatcher(){    close();}HX_RESULT CSmilSiteWatcher::close(){    HX_RELEASE(m_pDoc);    HX_RELEASE(m_pSite);    return HXR_OK;}void CSmilSiteWatcher::SetZoomScaleFactors(double dX, double dY){    if (dX > 0.0)    {        m_dZoomScaleFactorX = dX;    }    if (dY > 0.0)    {        m_dZoomScaleFactorY = dY;    }}void CSmilSiteWatcher::SetResizeBehavior(ResizeBehavior eBehavior){    m_eResizeBehavior = eBehavior;}STDMETHODIMP CSmilSiteWatcher::QueryInterface(REFIID riid, void** ppvObj){    HX_RESULT retVal = HXR_OK;    if(IsEqualIID(riid, IID_IUnknown))    {        AddRef();        *ppvObj = this;    }    else if(IsEqualIID(riid, IID_IHXSiteWatcher))    {        AddRef();        *ppvObj = (IHXSiteWatcher*) this;    }    else    {        *ppvObj = NULL;        retVal  = HXR_NOINTERFACE;    }    return retVal;}STDMETHODIMP_(ULONG32) CSmilSiteWatcher::AddRef(){    return InterlockedIncrement(&m_lRefCount);}STDMETHODIMP_(ULONG32) CSmilSiteWatcher::Release(){    if(InterlockedDecrement(&m_lRefCount) > 0)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -