Пример #1
0
////////////////////////////////////////////////////////////////////////////
// Animations drag/drop
////////////////////////////////////////////////////////////////////////////
LRESULT AnimatorBar::OnBeginDrag(WPARAM wParam, LPARAM lParam)
{
	XHTMLTREEMSGDATA *pMsg = (XHTMLTREEMSGDATA *) wParam;
	ASSERT(pMsg);

	XHTMLTREEDRAGMSGDATA *pData = (XHTMLTREEDRAGMSGDATA *) lParam;

	LRESULT lResult = 0;

	if (pMsg && pData)
	{
		// If it's an angle, and there's no other angles..
		CAnimation* pAnimation = (CAnimation*)animations.GetItemData(pData->hItem);

		if (pAnimation->IsAngle())
		{
			// Get parent
			CAnimation* pParent = (CAnimation*)animations.GetItemData(animations.GetParentItem(pData->hItem));

			if (pParent->m_SubAnimations.size() == 1)
				lResult = 1;
		}
	}

	return lResult;	// return 0 to allow drag
}
Пример #2
0
void AnimatorBar::RemoveAnimation()
{
	HTREEITEM Item = animations.GetSelectedItem();
	if(!Item) 
		return;

	HTREEITEM Parent = animations.GetParentItem(Item);

	CAnimation* pChildAnim = (CAnimation*)animations.GetItemData(Item);
	CAnimation* pParentAnim;

	if(Parent)
		pParentAnim = (CAnimation*)animations.GetItemData(Parent);
	else
	{
		pParentAnim = m_pAnimation;

		if (pParentAnim->m_SubAnimations.size() == 1)
		{
			message_bar.Attach(this);
			message_bar.SetHighlightOnMouseOver();
			message_bar.SetWrapText();
			message_bar.SetText(AB_CANNOTDELETEANIMATIONDESC);

			return;
		}
	}

	if (pChildAnim->IsAngle())
	{
		// Do a quick check for other angles
		bool bFound = false;

		for(list<CAnimation>::iterator i = pParentAnim->m_SubAnimations.begin(); i != pParentAnim->m_SubAnimations.end(); i ++)
			if(i->IsAngle() && i->m_FixedID != pChildAnim->m_FixedID)
				bFound = true;

		if (!bFound)
		{
			message_bar.Attach(this);
			message_bar.SetHighlightOnMouseOver();
			message_bar.SetWrapText();
			message_bar.SetText(AB_CANNOTDELETEANGLEDESC);

			return;
		}
	}

	for(list<CAnimation>::iterator i = pParentAnim->m_SubAnimations.begin();
		i != pParentAnim->m_SubAnimations.end();
		i ++)
	{
		if(&(*i) == pChildAnim)
		{
			pParentAnim->m_SubAnimations.erase(i);
			i = pParentAnim->m_SubAnimations.end();
		}
	}

	AnimationHasChanged();
	UpdateFilmStrip();
	UpdateAnimations(NULL, NULL, NULL, -2);
}