Пример #1
0
        public override void OnMouseDown(DrawArea drawArea, MouseEventArgs e)
        {
            Point p;

            if (drawArea.SnapEnable)
            {
                p = drawArea.BackTrackMouse(new Point(drawArea.FittoSnap(e.X, drawArea.SnapX), drawArea.FittoSnap(e.Y, drawArea.SnapY)));
            }
            else
            {
                p = drawArea.BackTrackMouse(new Point(e.X, e.Y));
            }
            DrawRectangle o;

            //if (drawArea.CurrentPen == null)
            //    AddNewObject(drawArea,(o =  new DrawRectangle(p.X, p.Y, 1, 1, drawArea.LineColor, drawArea.FillColor, drawArea.DrawFilled, drawArea.LineWidth)));
            //else
            //AddNewObject(drawArea, (o = new DrawRectangle(drawArea.ParentTabGraphicPageControl.Pages(),p.X, p.Y, 1, 1, drawArea.PenType, drawArea.FillColor, drawArea.DrawFilled)));
            AddNewObject(drawArea, (o = new DrawRectangle(drawArea.ParentTabGraphicPageControl.Pages(), p.X, p.Y, 1, 1)));

            o.Dirty = true;
            drawArea.Pages.Dirty = true;
            o.oIndex             = drawArea.Pages.GetNewobjectoIndex();
            DCS.Forms.MainForm.Instance().m_propertyGrid.SelectedObject = o;
            DCS.Forms.MainForm.Instance().m_propertyGrid.Refresh();
        }
Пример #2
0
        public override void OnMouseDown(DrawArea drawArea, MouseEventArgs e)
        {
            Point p;

            Trace.WriteLine("Line OnMouseDown X=" + e.X.ToString() + " Y=", e.Y.ToString());
            if (drawArea.SnapEnable)
            {
                p = drawArea.BackTrackMouse(new Point(drawArea.FittoSnap(e.X, drawArea.SnapX), drawArea.FittoSnap(e.Y, drawArea.SnapY)));
            }
            else
            {
                p = drawArea.BackTrackMouse(new Point(e.X, e.Y));
            }
            Trace.WriteLine("Line OnMouseDown pX=" + p.X.ToString() + " pY=" + p.Y.ToString());
            DrawLine o;

            if (drawArea.PenType == DrawingPens.PenType.Generic)
            {
                //AddNewObject(drawArea, new DrawLine(p.X, p.Y, p.X + 1, p.Y + 1, drawArea.LineColor, drawArea.LineWidth));

                AddNewObject(drawArea, (o = new DrawLine(drawArea.Pages, p.X, p.Y, p.X + 1, p.Y + 1)));
            }
            else
            {
                //AddNewObject(drawArea, new DrawLine(p.X, p.Y, p.X + 1, p.Y + 1, drawArea.PenType));
                AddNewObject(drawArea, (o = new DrawLine(drawArea.Pages, p.X, p.Y, p.X + 1, p.Y + 1)));
            }
            o.Dirty = true;
            drawArea.Pages.Dirty = true;
            o.oIndex             = drawArea.Pages.GetNewobjectoIndex();
            DCS.Forms.MainForm.Instance().m_propertyGrid.SelectedObject = o;
            DCS.Forms.MainForm.Instance().m_propertyGrid.Refresh();
        }
Пример #3
0
        public override void OnMouseMove(DrawArea drawArea, MouseEventArgs e)
        {
            //drawArea.Cursor = m_Cursor;

            if (e.Button == MouseButtons.Left)
            {
                //Trace.WriteLine("Line OnMouseMove X=" + e.X.ToString() + " Y="+ e.Y.ToString());
                Point p;
                if (drawArea.SnapEnable)
                {
                    p = drawArea.BackTrackMouse(new Point(drawArea.FittoSnap(e.X, drawArea.SnapX), drawArea.FittoSnap(e.Y, drawArea.SnapY)));
                }
                else
                {
                    p = drawArea.BackTrackMouse(new Point(e.X, e.Y));
                }
                //Trace.WriteLine("Line OnMouseMove pX=" + p.X.ToString() + " pY="+ p.Y.ToString());
                int index = drawArea.ParentTabGraphicPageControl.NoOfObjectsinPage - 1;
                drawArea.Pages.GetObject(drawArea.Pages.ActivePageNo, index).MoveHandleTo(p, 2);
                drawArea.Refresh();
            }
        }
Пример #4
0
        public override void OnMouseDown(DrawArea drawArea, MouseEventArgs e)
        {
            Point p;

            if (drawArea.SnapEnable)
            {
                p = drawArea.BackTrackMouse(new Point(drawArea.FittoSnap(e.X, drawArea.SnapX), drawArea.FittoSnap(e.Y, drawArea.SnapY)));
            }
            else
            {
                p = drawArea.BackTrackMouse(new Point(e.X, e.Y));
            }
            DrawImage o;

            AddNewObject(drawArea, (o = new DrawImage(drawArea.Pages, p.X, p.Y)));

            o.Dirty = true;
            drawArea.Pages.Dirty = true;
            o.oIndex             = drawArea.Pages.GetNewobjectoIndex();
            DCS.Forms.MainForm.Instance().m_propertyGrid.SelectedObject = o;
            DCS.Forms.MainForm.Instance().m_propertyGrid.Refresh();
        }
Пример #5
0
        /// <summary>
        /// Right mouse button is released
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public override void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
#if EWSAPP
            int newx;
            int newy;


            switch (selectMode)
            {
            case SelectionMode.NetSelection:
                Trace.WriteLine("ToolPointer OnMouseUp MouseButtons.Left SelectionMode.NetSelection");
                drawArea.Pages.SelectInRectangle(drawArea.NetRectangle);

                selectMode = SelectionMode.None;

                drawArea.DrawNetRectangle = false;
                if (resizedObject != null)
                {
                    // after resizing
                    resizedObject.Normalize();
                    resizedObject = null;
                }

                drawArea.Capture = false;
                drawArea.Refresh();

                if (commandChangeState != null && wasMove)
                {
                    // Keep state after moving/resizing and add command to history
                    commandChangeState.NewState(drawArea.Pages.GraphicPagesList[drawArea.ActivePageNo]);
                    drawArea.Pages.AddCommandToHistory(commandChangeState);
                    commandChangeState = null;
                }
                lastPoint = drawArea.BackTrackMouse(e.Location);
                break;

            case SelectionMode.Size:
                Trace.WriteLine("ToolPointer OnMouseUp MouseButtons.Left SelectionMode.Size");
                break;

            case SelectionMode.Move:
                newx = e.X - FirstPoint.X;
                newy = e.Y - FirstPoint.Y;
                //newx = drawArea.FittoSnap(e.X, drawArea.SnapX);
                //newy = drawArea.FittoSnap(e.Y, drawArea.SnapY);
                if ((newx != 0) || (newy != 0))
                {
                    if (drawArea.SnapEnable)
                    {
                        foreach (DrawObject o in drawArea.Pages.GraphicPagesList[drawArea.ActivePageNo].Selection)
                        {
                            //o.MoveTo(drawArea.FittoSnap(o._rectangle.X + newx, drawArea.SnapX), drawArea.FittoSnap(o._rectangle.Y + newy, drawArea.SnapY));
                            int _x = o.rectangle.X;
                            _x = o.rectangle.X + newx;
                            _x = drawArea.FittoSnap(o.rectangle.X, drawArea.SnapX);
                            int _y = o.rectangle.Y;
                            _y = o.rectangle.Y + newy;
                            _y = drawArea.FittoSnap(o.rectangle.Y, drawArea.SnapY);

                            o.MoveTo(_x, _y);
                            if ((o is DrawFBDBox))
                            {
                                ((DrawFBDBox)o).UpdateWireConnections();
                            }
                        }
                    }

                    drawArea.Cursor = Cursors.SizeAll;
                    drawArea.Refresh();
                    drawArea.Pages.Dirty = true;
                }
                break;

            default:

                break;
            }

            selectMode      = SelectionMode.None;
            drawArea.Cursor = Cursors.Default;
#endif
        }