Example #1
0
        /// <summary>
        /// Show Properties dialog. Return true if list is changed
        /// </summary>
        /// <param name="parent"></param>
        /// <returns></returns>
        public bool ShowPropertiesDialog(MkaDocument parent)
        {
            if (SelectionCount < 1)
            {
                return(false);
            }

            MkaMokkanInfo      info       = new MkaMokkanInfo();
            GraphicsProperties properties = new GraphicsProperties();
            bool multi = (SelectionCount > 1);

            // get properties from selected object
            GetProperties(ref info, ref properties);

            MkaPropertiesMokkan dlg = new MkaPropertiesMokkan(this, info, properties, multi);
            CommandChange       c   = new CommandChange(this);

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

            if (ApplyProperties(dlg.MokkanProperty, dlg.Properties))
            {
                c.NewState(this);
                parent.AddCommandToHistory(c);
                return(true);
            }

            return(false);
        }
Example #2
0
        /// <summary>
        /// Right mouse button is released
        /// </summary>
        public override void OnMouseUp(MkaDocument docArea, MouseEventArgs e)
        {
            if (selectMode == SelectionMode.NetSelection)
            {
                // Remove old selection rectangle
                ControlPaint.DrawReversibleFrame(
                    docArea.RectangleToScreen(DrawRectangle.GetNormalizedRectangle(startPoint, lastPoint)),
                    Color.Black,
                    FrameStyle.Dashed);

                // Make group selection
                docArea.MokkanList.SelectInRectangle(
                    DrawRectangle.GetNormalizedRectangle(startPoint, lastPoint));

                selectMode = SelectionMode.None;
            }

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

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

            if (commandChangeState != null && wasMove)
            {
                // Keep state after moving/resizing and add command to history
                commandChangeState.NewState(docArea.MokkanList);
                docArea.AddCommandToHistory(commandChangeState);
                commandChangeState = null;
            }
        }
Example #3
0
        /// <summary>
        /// Left mouse is released.
        /// New object is created and resized.
        /// </summary>
        public override void OnMouseUp(MkaDocument docArea, MouseEventArgs e)
        {
            docArea.MokkanList[0].Normalize();
            List <DrawObject> list = new List <DrawObject>();

            list.Add(docArea.MokkanList[0]);
            docArea.AddCommandToHistory(new CommandAdd(list));
            docArea.ActiveTool = ToolType.Pointer;

            docArea.Capture = false;
            docArea.Refresh();
        }