void ComponentOverlay::applyToTarget ()
{
    if (target != NULL)
    {

        Component* c = (Component*) target.getComponent ();
        c->setBounds (getBounds ());

        if (startBounds.getTopLeft() == c->getBounds().getTopLeft())
        {
            for (int i = 0; i < c->getNumChildComponents(); i++)
            {
                Component* comp = c->getChildComponent (i);
                const float x = ((float)c->getWidth() / (float)startBounds.getWidth());
                const float y = ((float)c->getHeight() / (float)startBounds.getHeight());
                const float left = childBounds[i].getX() * x;
                const float top = childBounds[i].getY() * y;
                const float width = childBounds[i].getWidth() * x;
                const float height = childBounds[i].getHeight() * y;
                comp->setBounds (left, top, width, height);

            }
        }

        userChangedBounds ();
    }
}
void ChildAlias::applyToTarget ()
{
    if (!target.hasBeenDeleted ())
    {
        Component* c = (Component*) target.getComponent ();
        c->setBounds (getBounds ());
        userChangedBounds ();
    }
}
void ChildAlias::applyToTarget (String triggeredFrom)
{
   if (target != NULL)
      //!target.hasBeenDeleted ())
   {
        Component* c = (Component*) target.getComponent ();
		((CabbageMainPanel*)(getTarget()->getParentComponent()))->childBounds.clear();
		((CabbageMainPanel*)(getTarget()->getParentComponent()))->origChildBounds.clear();

		if(type.containsIgnoreCase("CabbageGroupbox")||
			type.containsIgnoreCase("CabbageImage"))
			c->toBack();
			
		else 
		c->toFront(true);

		//if just resizing is taking place we need to resize child components..
		if(startBounds.getTopLeft()==c->getBounds().getTopLeft())
		for(int i=0;i<c->getNumChildComponents();i++){
			float x = ((float)c->getWidth()/(float)startBounds.getWidth());
			float y = ((float)c->getHeight()/(float)startBounds.getHeight());
			
			c->getChildComponent(i)->setBounds(origBounds[i].getX()*x, 
												origBounds[i].getY()*y,
												origBounds[i].getWidth()*x,
												origBounds[i].getHeight()*y);
			((CabbageMainPanel*)(getTarget()->getParentComponent()))->childBounds.add(c->getChildComponent(i)->getBounds());
			((CabbageMainPanel*)(getTarget()->getParentComponent()))->origChildBounds.add(origBounds[i]);
		}
		//Logger::writeToLog("ComponentEditor:"+String(((CabbageMainPanel*)(getTarget()->getParentComponent()))->childBounds.size()));
		//Logger::writeToLog("Number of children: "+String(((CabbageMainPanel*)(getTarget()->getParentComponent()))->childBounds.size()));
	  ((CabbageMainPanel*)(getTarget()->getParentComponent()))->sendActionMessage("Message sent from CabbageMainPanel");
	  c->setBounds (getBounds ());
      userChangedBounds ();
   }
}