Ejemplo n.º 1
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CommandDelete command = new CommandDelete(drawArea.GraphicsList);

            if (drawArea.GraphicsList.DeleteSelection())
            {
                drawArea.SetDirty();
                drawArea.Refresh();
                drawArea.AddCommandToHistory(command);
            }
        }
Ejemplo n.º 2
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int           x       = drawArea.TheLayers.ActiveLayerIndex;
            CommandDelete command = new CommandDelete(drawArea.TheLayers);

            if (drawArea.TheLayers[x].Graphics.DeleteSelection())
            {
                drawArea.Refresh();
                drawArea.AddCommandToHistory(command);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Show Properties dialog. Return true if list is changed
        /// </summary>
        /// <param name="parent"></param>
        /// <returns></returns>
        public bool ShowPropertiesDialog(DrawArea parent)
        {
            if (SelectionCount < 1)
            {
                return(false);
            }

            GraphicsProperties properties = GetProperties();
            PropertiesDialog   dlg        = new PropertiesDialog();

            dlg.Properties = properties;

            CommandChangeState c = new CommandChangeState(this);

            if (dlg.ShowDialog(parent) != DialogResult.OK)
            {
                return(false);
            }

            if (ApplyProperties(properties))
            {
                c.NewState(this);
                parent.AddCommandToHistory(c);
            }

            return(true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Right mouse button is released
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public override void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
            int al = drawArea.TheLayers.ActiveLayerIndex;

            if (selectMode == SelectionMode.NetSelection)
            {
                // Group selection
                drawArea.TheLayers[al].Graphics.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.TheLayers);
                drawArea.AddCommandToHistory(commandChangeState);
                commandChangeState = null;
            }
            lastPoint = drawArea.BackTrackMouse(e.Location);
        }
Ejemplo n.º 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 (selectMode == SelectionMode.NetSelection)
            {
                // Remove old selection rectangle
                ControlPaint.DrawReversibleFrame(
                    drawArea.RectangleToScreen(DrawRectangle.GetNormalizedRectangle(startPoint, lastPoint)),
                    Color.Black,
                    FrameStyle.Dashed);

                // Make group selection
                drawArea.GraphicsList.SelectInRectangle(
                    DrawRectangle.GetNormalizedRectangle(startPoint, lastPoint));

                selectMode = SelectionMode.None;
            }

            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.GraphicsList);
                drawArea.AddCommandToHistory(commandChangeState);
                commandChangeState = null;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Left mouse is released.
        /// New object is created and resized.
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public override void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
            drawArea.GraphicsList[0].Normalize();
            drawArea.AddCommandToHistory(new CommandAdd(drawArea.GraphicsList[0]));
            drawArea.ActiveTool = DrawArea.DrawToolType.Pointer;

            drawArea.Capture = false;
            drawArea.Refresh();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Left mouse is released.
        /// New object is created and resized.
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public override void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
            drawArea.GraphicsList[0].Normalize();
            drawArea.AddCommandToHistory(new CommandAdd(drawArea.GraphicsList[0]));
            drawArea.ActiveTool = DrawArea.DrawToolType.Pointer;

            drawArea.Capture = false;
            drawArea.Refresh();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Left mouse is released.
        /// New object is created and resized.
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public override void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
            int al = drawArea.TheLayers.ActiveLayerIndex;

            if (drawArea.TheLayers[al].Graphics.Count > 0)
            {
                drawArea.TheLayers[al].Graphics[0].Normalize();
            }

            if ((drawArea.ActiveTool != DrawArea.DrawToolType.Polygon) ||
                ((drawArea.ActiveTool == DrawArea.DrawToolType.Polygon) && (e.Button == MouseButtons.Right)))
            {
                drawArea.ActiveTool = DrawArea.DrawToolType.Pointer;
                drawArea.AddDrawObject?.BeginInvoke(mDrawObject, null, null);
                drawArea.AddCommandToHistory(new CommandAdd(mDrawObject));
                mDrawObject = null;
            }

            drawArea.Capture = false;
            drawArea.Invalidate();
        }
Ejemplo n.º 9
0
        public override void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
            int al = drawArea.TheLayers.ActiveLayerIndex;

            Point p = drawArea.BackTrackMouse(new Point(e.X, e.Y));

            if (drawArea.TheLayers[al].Graphics.Count > 0)
                drawArea.TheLayers[al].Graphics[0].Normalize();
            if (startPoint.X < p.X && startPoint.Y < p.Y)
                AddNewObject(drawArea, new DrawPie(startPoint.X, startPoint.Y, p.X - startPoint.X, p.Y - startPoint.Y, System.Drawing.Color.Lime, System.Drawing.Color.Lime, true, drawArea.LineWidth, 0, 45));
            else if (startPoint.X < p.X && startPoint.Y > p.Y)
                AddNewObject(drawArea, new DrawPie(startPoint.X, startPoint.Y, p.X - startPoint.X, startPoint.Y-p.Y, System.Drawing.Color.Lime, System.Drawing.Color.Lime, true, drawArea.LineWidth, 0, -45));
            else if (startPoint.X > p.X && startPoint.Y < p.Y)
                AddNewObject(drawArea, new DrawPie(startPoint.X, startPoint.Y, startPoint.X-p.X, p.Y - startPoint.Y, System.Drawing.Color.Lime, System.Drawing.Color.Lime, true, drawArea.LineWidth, 180, -45));
            else if (startPoint.X > p.X && startPoint.Y > p.Y)
                AddNewObject(drawArea, new DrawPie(startPoint.X, startPoint.Y, startPoint.X-p.X, startPoint.Y-p.Y, System.Drawing.Color.Lime, System.Drawing.Color.Lime, true, drawArea.LineWidth, 180, 45));
            drawArea.AddCommandToHistory(new CommandAdd(drawArea.TheLayers[drawArea.TheLayers.ActiveLayerIndex].Graphics[0]));
            drawArea.ActiveTool = DrawToolType.Pointer;

            drawArea.Capture = false;
            drawArea.Refresh();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Show Properties dialog. Return true if list is changed
        /// </summary>
        /// <param name="parent"></param>
        /// <returns></returns>
        public bool ShowPropertiesDialog(DrawArea parent)
        {
            if (SelectionCount < 1)
                return false;

            GraphicsProperties properties = GetProperties();
            PropertiesDialog dlg = new PropertiesDialog();
            dlg.Properties = properties;

            CommandChangeState c = new CommandChangeState(this);

            if (dlg.ShowDialog(parent) != DialogResult.OK)
                return false;

            if ( ApplyProperties(properties) )
            {
                c.NewState(this);
                parent.AddCommandToHistory(c);
            }

            return true;
        }