예제 #1
0
void wxSFMultiSelRect::OnTopHandle(wxSFShapeHandle& handle)
{
	if(GetParentCanvas()  && !AnyHeightExceeded(wxPoint(0, -handle.GetDelta().y)))
	{
	    wxXS::RealPointList::compatibility_iterator ptnode;
	    wxSFLineShape* pLine;
	    wxRealPoint* pt;

		double dy, sy = (GetRectSize().y - 2*sfDEFAULT_ME_OFFSET - handle.GetDelta().y)/(GetRectSize().y - 2*sfDEFAULT_ME_OFFSET);

		ShapeList m_lstSelection;
		GetParentCanvas()->GetSelectedShapes(m_lstSelection);

		ShapeList::compatibility_iterator node = m_lstSelection.GetFirst();
		while(node)
		{
			wxSFShapeBase* pShape = node->GetData();

            if(!pShape->IsKindOf(CLASSINFO(wxSFLineShape)))
            {
                if(pShape->ContainsStyle(sfsPOSITION_CHANGE))
                {
                    if(pShape->GetParentShape())
                    {
                        pShape->SetRelativePosition(pShape->GetRelativePosition().x, pShape->GetRelativePosition().y*sy);
                    }
                    else
                    {
                        double dy = handle.GetDelta().y - (pShape->GetAbsolutePosition().y - (GetAbsolutePosition().y + sfDEFAULT_ME_OFFSET))/(GetRectSize().y - 2*sfDEFAULT_ME_OFFSET)*handle.GetDelta().y;
                        pShape->MoveBy(0, dy);
                    }
                }

                if(pShape->ContainsStyle(sfsSIZE_CHANGE))pShape->Scale(1, sy, sfWITHCHILDREN);
				
				if( ! pShape->ContainsStyle( sfsNO_FIT_TO_CHILDREN ) ) pShape->FitToChildren();
            }
            else
            {
                if(pShape->ContainsStyle(sfsPOSITION_CHANGE))
                {
                    pLine = (wxSFLineShape*)pShape;
                    ptnode = pLine->GetControlPoints().GetFirst();
                    while(ptnode)
                    {
                        pt = ptnode->GetData();
                        dy = handle.GetDelta().y - (pt->y - (GetAbsolutePosition().y + sfDEFAULT_ME_OFFSET))/(GetRectSize().y - 2*sfDEFAULT_ME_OFFSET)*handle.GetDelta().y;
                        pt->y += dy;
                        pt->y = floor(pt->y);
                        ptnode = ptnode->GetNext();
                    }
                }
            }

            node = node->GetNext();
		}
	}
}
예제 #2
0
void wxSFMultiSelRect::OnRightHandle(wxSFShapeHandle& handle)
{
	if(GetParentCanvas() && !AnyWidthExceeded(handle.GetDelta()))
	{
	    wxXS::RealPointList::compatibility_iterator ptnode;
	    wxSFLineShape* pLine;
	    wxRealPoint* pt;

		double dx, sx = (GetRectSize().x - 2*sfDEFAULT_ME_OFFSET + handle.GetDelta().x)/(GetRectSize().x - 2*sfDEFAULT_ME_OFFSET);

		ShapeList m_lstSelection;
		GetParentCanvas()->GetSelectedShapes(m_lstSelection);

		ShapeList::compatibility_iterator node = m_lstSelection.GetFirst();
		while(node)
		{
			wxSFShapeBase* pShape = node->GetData();

			// scale main parent shape
			if(!pShape->IsKindOf(CLASSINFO(wxSFLineShape)))
			{
			    dx = (pShape->GetAbsolutePosition().x - (GetAbsolutePosition().x + sfDEFAULT_ME_OFFSET))/(GetRectSize().x - 2*sfDEFAULT_ME_OFFSET)*handle.GetDelta().x;

				if(pShape->ContainsStyle(sfsSIZE_CHANGE))pShape->Scale(sx, 1, sfWITHCHILDREN);
                if(pShape->ContainsStyle(sfsPOSITION_CHANGE))pShape->MoveBy(dx, 0);
				
				if( ! pShape->ContainsStyle( sfsNO_FIT_TO_CHILDREN ) ) pShape->FitToChildren();
			}
			else
			{
			    if(pShape->ContainsStyle(sfsPOSITION_CHANGE))
			    {
                    pLine = (wxSFLineShape*)pShape;
                    ptnode = pLine->GetControlPoints().GetFirst();
                    while(ptnode)
                    {
                        pt = ptnode->GetData();
                        dx = ( pt->x - (GetAbsolutePosition().x + sfDEFAULT_ME_OFFSET))/(GetRectSize().x - 2*sfDEFAULT_ME_OFFSET)*handle.GetDelta().x;
                        pt->x += dx;
                        pt->x = floor(pt->x);
                        ptnode = ptnode->GetNext();
                    }
			    }
			}

			node = node->GetNext();
		}
	}
}
예제 #3
0
void wxSFRectShape::OnBottomHandle(wxSFShapeHandle& handle)
{
	// HINT: overload it for custom actions...

	//m_nRectSize.y = handle.GetPosition().y - GetAbsolutePosition().y;
	m_nRectSize.y += handle.GetDelta().y;
}
예제 #4
0
void wxSFRectShape::OnTopHandle(wxSFShapeHandle& handle)
{
	// HINT: overload it for custom actions...

    wxSFShapeBase *pChild;

	//double dy = (double)handle.GetPosition().y - GetAbsolutePosition().y;
	double dy = (double)handle.GetDelta().y;

	// update position of children
	if( !ContainsStyle( sfsLOCK_CHILDREN ) )
	{
		SerializableList::compatibility_iterator node = GetFirstChildNode();
		while(node)
		{
			pChild = (wxSFShapeBase*)node->GetData();
			if( pChild->GetVAlign() == valignNONE )
			{
				pChild->MoveBy(0, -dy);
			}
			node = node->GetNext();
		}
	}
	// update position and size of the shape
	m_nRectSize.y -= dy;
	m_nRelativePosition.y += dy;
}
예제 #5
0
void wxSFRectShape::OnRightHandle(wxSFShapeHandle& handle)
{
	// HINT: overload it for custom actions...

	//m_nRectSize.x = handle.GetPosition().x - GetAbsolutePosition().x;
	m_nRectSize.x += handle.GetDelta().x;
}
예제 #6
0
void SampleShape::OnHandle(wxSFShapeHandle& handle)
{
	wxSFSample2Frame::Log( wxSFSample2Frame::logHandleEvent, wxString::Format( wxT("Called handler: 'OnHandle()', Shape ID: %d, Handle type: %d, Delta: %d, %d\n"), GetId(), (int)handle.GetType(), handle.GetDelta().x, handle.GetDelta().y ) );
	
	// call original handler if required
	wxSFRectShape::OnHandle(handle);
}