void AutomationEvent::mouseDown (const MouseEvent& e)
{
    if (! owner) return;

    SelectedItemSet<MidiGridItem*> selection = owner->getLassoSelection ();
    if (! selection.isSelected (this))
        owner->selectNote (this, true);

    if (e.mods.isLeftButtonDown())
    {
		for (int i = 0; i < selection.getNumSelected (); i++)
		{
			MidiGridItem* component = selection.getSelectedItem (i);
			component->startDragging (component == this ? e : e.getEventRelativeTo (component));
			owner->repaint();
		}
    }
}
void PianoGridNote::mouseDown (const MouseEvent& e)
{
   if (! owner) return;

   SelectedItemSet<MidiGridItem*> selection = owner->getLassoSelection ();
   if (! selection.isSelected (this))
   {
      owner->selectNote (this, !e.mods.isShiftDown());
      selection = owner->getLassoSelection();
   }

    if (e.mods.isLeftButtonDown())
    {
        if (e.x >= getWidth() - 2)
        {
            for (int i = 0; i < selection.getNumSelected (); i++)
            {
                PianoGridNote* component = dynamic_cast<PianoGridNote*>(selection.getSelectedItem (i));
				if (component)
					component->startResizing (e);
            }
        }
        else
        {
            for (int i = 0; i < selection.getNumSelected (); i++)
            {
                MidiGridItem* component = selection.getSelectedItem (i);
                component->startDragging (component == this ? e : e.getEventRelativeTo (component));
            }
        }

        DBG ("Note: " + String (note) + " " + String (beat) + " " + String (length));
    }
    else if (e.mods.isMiddleButtonDown())
    {
        for (int i = 0; i < selection.getNumSelected (); i++)
        {
            PianoGridNote* component = dynamic_cast<PianoGridNote*>(selection.getSelectedItem (i));
			if (component)
				component->startVelocity (e);
        }
    }
}