public override bool OnMouseDown(ImagePanel aSender, MouseEventArgs e)
        {
            GetCursor(e.X, e.Y, out mMode);
            if (e.Button == MouseButtons.Left)
            {
                if (mMode != Mode.None)
                {
                    CommandSystem.AddRollback(Project);
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                switch (mMode)
                {
                    case Mode.Rotate:
                        Project.GridRotate = 0;
                        aSender.Invalidate();
                        break;
                }

                mMode = Mode.None;
            }

            mMousePosition.X = e.X;
            mMousePosition.Y = e.Y;

            return true;
        }
 public override bool OnMouseMove(ImagePanel aSender, MouseEventArgs e)
 {
     if (mDragLine != null)
     {
         mDragLine.EndMarker = Project.FindMarker(e.X, e.Y);
         mDragLine.MousePosition = new PointF(e.X, e.Y);
         aSender.Invalidate();
     }
     return true;
 }
 public override bool OnMouseMove(ImagePanel aSender, MouseEventArgs e)
 {
     if (mSelected != -1 && e.Button == MouseButtons.Left)
     {
         Marker marker = Project.GetMarker(mSelected);
         mNewLocation = new PointF(e.X, e.Y);
         marker.Location = mNewLocation;
         aSender.Invalidate();
         return false;
     }
     return true;
 }
 public override bool OnMouseClick(ImagePanel aSender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         int selected = Project.FindLine(e.X, e.Y);
         if (selected != -1)
         {
             CommandSystem.RemoveLine(Project, selected);
             aSender.Invalidate();
             return false;
         }
     }
     return true;
 }
        public override bool OnMouseClick(ImagePanel aSender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                int selected = Project.FindMarker(e.X, e.Y);
                if (selected == -1)
                {
                    CommandSystem.AddMarker(Project, e.X, e.Y);
                    selected = Project.FindMarker(e.X, e.Y);
                }

                if (mDragLine == null)
                {
                    mDragLine = new DragLine(selected, new PointF(e.X, e.Y));
                }
                else
                {
                    CommandSystem.AddLine(Project, mDragLine.StartMarker, selected);
                    mDragLine = null;
                }
                aSender.Invalidate();
                return false;
            }

            if (e.Button == MouseButtons.Right)
            {
                if (mDragLine != null)
                {
                    mDragLine = null;
                    aSender.Invalidate();
                    return false;
                }
            }

            return true;
        }
 public override bool OnMouseDown(ImagePanel aSender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         mSelected = Project.FindMarker(e.X, e.Y);
         if (mSelected != -1)
         {
             Marker marker = Project.GetMarker(mSelected);
             mOldLocation = marker.Location;
             mNewLocation = marker.Location;
             mShowFlightZone = marker.ShowFlightZone;
             marker.ShowFlightZone = true;
             aSender.Invalidate();
         }
         return false;
     }
     return true;
 }
 public override bool OnMouseClick(ImagePanel aSender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         int selected = Project.FindMarker(e.X, e.Y);
         if (selected == -1)
         {
             CommandSystem.AddMarker(Project, e.X, e.Y);
         }
         else
         {
             CommandSystem.MarkerToggleFlightZone(Project, selected);
         }
         aSender.Invalidate();
         return false;
     }
     return true;
 }
        public override bool OnMouseUp(ImagePanel aSender, MouseEventArgs e)
        {
            if (mSelected != -1)
            {
                // revert the 'action'.
                Marker marker = Project.GetMarker(mSelected);
                marker.ShowFlightZone = mShowFlightZone;
                marker.Location = mOldLocation;

                // notify the command system of our intent.
                if (mOldLocation != mNewLocation)
                {
                    CommandSystem.MoveMarker(Project, mSelected, mOldLocation, mNewLocation);
                }

                // redraw ;).
                aSender.Invalidate();
                mSelected = -1;
            }
            return true;
        }
        public override bool OnMouseMove(ImagePanel aSender, MouseEventArgs e)
        {
            if (mMode != Mode.None)
            {
                int dx = e.X - mMousePosition.X;
                int dy = e.Y - mMousePosition.Y;

                switch (mMode)
                {
                    case Mode.MoveCenter:
                        mBounds.Offset(dx, dy);
                        Project.Offset(dx, dy);
                        break;
                    case Mode.Rotate:
                        Project.Rotate(mBounds.Center.X, mBounds.Center.Y, dy * 0.005f);
                        mBounds.Rotate(dy * 0.005f);
                        break;
                    case Mode.MoveLeft:
                        mBounds.X.X = Math.Max(mBounds.Center.X - e.X, minSize);
                        break;
                    case Mode.MoveRight:
                        mBounds.X.X = Math.Max(mBounds.Center.X + e.X, minSize);
                        break;
                    case Mode.MoveTop:
                        mBounds.Y.Y = Math.Max(mBounds.Center.Y - e.Y, minSize);
                        break;
                    case Mode.MoveBottom:
                        mBounds.Y.Y = Math.Max(mBounds.Center.Y + e.Y, minSize);
                        break;
                    case Mode.MoveTopLeft:
                        break;
                    case Mode.MoveTopRight:
                        break;
                    case Mode.MoveBottomLeft:
                        break;
                    case Mode.MoveBottomRight:
                        break;
                }

                aSender.Invalidate();
            }
            else
            {
                Mode mode;
                aSender.Cursor = GetCursor(e.X, e.Y, out mode);
            }
            mMousePosition.X = e.X;
            mMousePosition.Y = e.Y;
            return false;
        }
 public override bool OnMouseUp(ImagePanel aSender, MouseEventArgs e)
 {
     if (mMode != Mode.None)
     {
         mMode = Mode.None;
         mBounds = new Bound(Project.BoundingRect);
         aSender.Invalidate();
     }
     return true;
 }
        public override bool OnMouseMove(ImagePanel aSender, MouseEventArgs e)
        {
            if (mMode != Mode.None)
            {
                int dx = e.X - mMousePosition.X;
                int dy = e.Y - mMousePosition.Y;

                switch (mMode)
                {
                    case Mode.MoveCenter:
                        mBounds.Offset(dx, dy);
                        Project.MoveGrid(dx, dy);
                        break;
                    case Mode.Rotate:
                        Project.RotateGrid(dy * 0.005f);
                        break;
                    case Mode.MoveLeft:
                    case Mode.MoveRight:
                        mBounds.Size -= (dx * 3);
                        Project.GridSize = Math.Max(minSize, (int)mBounds.Size);
                        mBounds.Size = Project.GridSize;
                        break;
                    case Mode.MoveTop:
                    case Mode.MoveBottom:
                        mBounds.Size -= (dy * 3);
                        Project.GridSize = Math.Max(minSize, (int)mBounds.Size);
                        mBounds.Size = Project.GridSize;
                        break;
                }

                aSender.Invalidate();
            }
            else
            {
                Mode mode;
                aSender.Cursor = GetCursor(e.X, e.Y, out mode);
            }
            mMousePosition.X = e.X;
            mMousePosition.Y = e.Y;
            return false;
        }
 public override bool OnMouseUp(ImagePanel aSender, MouseEventArgs e)
 {
     if (mMode != Mode.None)
     {
         mMode = Mode.None;
         mBounds = new GridBound(Project.GridOffset, Project.GridSize);
         aSender.Invalidate();
     }
     return true;
 }