用于EagleEye3.0 规则集漏报和误报测试的示例项目,项目收集于github和gitee
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

184 lines
7.0 KiB

5 months ago
<EFBFBD><EFBFBD>#include "stdafx.h"
#include "souistd.h"
#include <strsafe.h>
#include <process.h>
#include "SAnimImg.h"
#include <Strsafe.h>
namespace SOUI
{
SAnimImg::SAnimImg(void):
m_pAniIn(NULL),
m_pAniOut(NULL),
m_iInterval(50),
m_aniStatus(STATUS_NOR),
m_iFrame(0),
m_nElapseTime(0),
m_iAutorun(-1),
m_bWaitrun(FALSE),
m_iHitTest(0),
m_nAutoElapseTime(0)
{
m_style.m_bTrackMouseEvent = true;//
}
SAnimImg::~SAnimImg(void)
{
}
void SAnimImg::OnPaint(IRenderTarget *pRT)
{
CRect rcSkin = GetClientRect();
if(m_aniStatus == STATUS_IN && m_pAniIn)
{
m_pAniIn->DrawByIndex(pRT,rcSkin,m_iFrame);
}else if(m_aniStatus == STATUS_OUT && m_pAniOut)
{
m_pAniOut->DrawByIndex(pRT,rcSkin,m_iFrame);
}
else if (m_pAniIn)
{//؞<EFBFBD><EFBFBD>>f:yin<EFBFBD>R;u<EFBFBD>v,{NE^
m_pAniIn->DrawByIndex(pRT,rcSkin,0);
}
}
void SAnimImg::OnMouseHover(WPARAM wParam, CPoint ptPos)
{
m_iHitTest++;
m_aniStatus = STATUS_IN;
m_iFrame = 0;
m_nElapseTime = 0;
m_nAutoElapseTime = 0;
Invalidate();
__super::OnMouseHover(wParam,ptPos);
}
void SAnimImg::OnMouseLeave()
{
m_iHitTest--;//<EFBFBD><EFBFBD>U_ <EFBFBD>hMOn <EFBFBD>:N0h<EFBFBD>:y<EFBFBD>]<EFBFBD>~<EFBFBD>y<EFBFBD>Q
__super::OnMouseLeave();
}
int SAnimImg::OnCreate(void*)
{
__super::OnCreate(NULL);
GetContainer()->RegisterTimelineHandler(this);
if (m_iAutorun >= 0)
{
m_bWaitrun = true;
m_iAutorun1000 = m_iAutorun * 1000;//<EFBFBD>MQ<EFBFBD>S Y*1000
}
return 0;
}
void SAnimImg::OnDestroy()
{
GetContainer()->UnregisterTimelineHandler(this);
__super::OnDestroy();
}
void SAnimImg::OnNextFrame()
{
if (m_aniStatus > 0)
{//in<EFBFBD>Tout<EFBFBD>r`Mb<EFBFBD><EFBFBD>pe
m_nElapseTime+=10;
if(m_nElapseTime>=m_iInterval)
{
NextImage();
m_nElapseTime = 0;
}
}
if (m_bWaitrun)
{//R<EFBFBD>d>e!j_
m_nAutoElapseTime+=10;
if (m_nAutoElapseTime >= m_iAutorun1000)
{
m_nAutoElapseTime = 0;
m_iFrame = 0;
m_bWaitrun = false;
m_aniStatus = STATUS_IN;
}
}
}
void SAnimImg::NextImage()
{
switch (m_aniStatus)
{
case STATUS_IN:
{
if (!m_pAniIn)
break;
if(++m_iFrame >= m_pAniIn->GetStates()-1)
{
switch (m_iAutorun)
{
case -1:
m_iFrame = m_pAniIn->GetStates() - 1;
if (m_iHitTest <= 0)//<EFBFBD>^<EFBFBD><EFBFBD> NO\<EFBFBD>N0'T
{//^<EFBFBD>R<EFBFBD>d>e!j_ <EFBFBD><EFBFBD>Q<EFBFBD> <EFBFBD>h<EFBFBD>]<EFBFBD>~<EFBFBD>y<EFBFBD>Q <EFBFBD><EFBFBD>d>e<EFBFBD>y<EFBFBD>Q<EFBFBD>R;u
if (m_pAniOut)
{//<EFBFBD><EFBFBD>n<EFBFBD>Nout<EFBFBD>v<EFBFBD><EFBFBD>Mbw<EFBFBD>\O(u
m_aniStatus = STATUS_OUT;
m_iFrame = 0;
m_nElapseTime = 0;
Invalidate();
}
}
break;
case 0:
m_iFrame = 0;//R<EFBFBD>d>e!j_ <EFBFBD><EFBFBD>v<EFBFBD>c<EFBFBD><EFBFBD>0R0'^
default:
m_aniStatus = STATUS_NOR;//R<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>d>e!j_ <EFBFBD>Rbc0R\Pbk<EFBFBD>r`
m_bWaitrun = true;
}
}
Invalidate();
}
break;
case STATUS_OUT:
{
if (m_pAniOut)//2<EFBFBD>bk<EFBFBD>l g<EFBFBD><EFBFBD>nani_out <EFBFBD><EFBFBD>Q<EFBFBD>
{
if(m_iFrame< m_pAniOut->GetStates()-1)
{
m_iFrame++;
Invalidate();
}
else
{// <EFBFBD>h<EFBFBD>]<EFBFBD>~<EFBFBD>y<EFBFBD>Q <EFBFBD>؏<EFBFBD>S0Rck8^<EFBFBD>r`
m_aniStatus = STATUS_NOR;
}
}
}
break;
default:
break;
}
}
CSize SAnimImg::GetDesiredSize(LPCRECT pRcContainer)
{
if (m_pAniIn)
{
CSize szRet = m_pAniIn->GetSkinSize();;
if(m_pLayoutParam->IsSpecifiedSize(Horz))
{
szRet.cx = m_pLayoutParam->GetSpecifiedSize(Horz).toPixelSize(GetScale());
}
if(m_pLayoutParam->IsSpecifiedSize(Vert))
{
szRet.cy = m_pLayoutParam->GetSpecifiedSize(Vert).toPixelSize(GetScale());
}
return szRet;
}
return NULL;
}
}