Exemple #1
0
        /// <summary>
        ///   Right mouse button is released
        /// </summary>
        /// <param name="drawArea"> </param>
        /// <param name="e"> </param>
        public override void OnMouseUp(TransparentCanvas 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;
            }
        }
        /// <summary>
        ///   Show Properties dialog. Return true if list is changed
        /// </summary>
        /// <param name="parent"> </param>
        /// <returns> </returns>
        public bool ShowPropertiesDialog(TransparentCanvas parent)
        {
            if (SelectionCount < 1)
            {
                return(false);
            }

            GraphicsProperties properties = GetProperties();
//            var dlg = new PropertiesDialog();
//            dlg.Properties = properties;
//
            var c = new CommandChangeState(this);

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

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

            return(true);
        }
Exemple #3
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(TransparentCanvas drawArea, MouseEventArgs e)
        {
            drawArea.GraphicsList[0].Normalize();
            drawArea.AddCommandToHistory(new CommandAdd(drawArea.GraphicsList[0]));
            drawArea.ActiveTool = TransparentCanvas.DrawToolType.Pointer;

            drawArea.Capture = false;
            drawArea.Refresh();
        }
Exemple #4
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(TransparentCanvas drawArea, MouseEventArgs e)
        {
            drawArea.GraphicsList[0].Normalize();
            drawArea.AddCommandToHistory(new CommandAdd(drawArea.GraphicsList[0]));
            drawArea.ActiveTool = TransparentCanvas.DrawToolType.Pointer;

            drawArea.Capture = false;
            drawArea.Refresh();
        }
Exemple #5
0
        /// <summary>
        ///   Right mouse button is released
        /// </summary>
        /// <param name="drawArea"> </param>
        /// <param name="e"> </param>
        public override void OnMouseUp(TransparentCanvas 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;
            }
        }
        /// <summary>
        ///   Show Properties dialog. Return true if list is changed
        /// </summary>
        /// <param name="parent"> </param>
        /// <returns> </returns>
        public bool ShowPropertiesDialog(TransparentCanvas parent)
        {
            if (SelectionCount < 1)
            {
                return false;
            }

            GraphicsProperties properties = GetProperties();
//            var dlg = new PropertiesDialog();
//            dlg.Properties = properties;
//
            var c = new CommandChangeState(this);
//
//            if (dlg.ShowDialog(parent) != DialogResult.OK)
//            {
//                return false;
//            }

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

            return true;
        }