Example #1
0
        //------------------------------------------------------------------------------

        private void DisplayPanel_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                mNewPath_Click(sender, e);
                MovingButtonIdx = -1;
            }
            else if (displayPanel.Cursor == Cursors.Hand)
            {
                MovingButtonIdx = GetButtonIndex(new IntPoint(e.X * scale, e.Y * scale), out MovingButtonSeg);
                BmpUpdateNeeded();
            }
            else
            {
                //Add a new control point ...

                CurveType rbPathType = GetRadiobuttonPathType();
                MultiPath mp         = GetActivePath();
                if (mp.Count == 0)
                {
                    mp.NewMultiPathSegment(rbPathType, new Path());
                }
                else if (rbPathType != GetCurrentPathType(mp))
                {
                    if (rbPathType != GetCurrentPathType(mp))
                    {
                        Path tmp = new Path();
                        if (!mp.IsValid())
                        {
                            MultiPathSegment mps = mp[mp.Count - 1];
                            foreach (IntPoint ip in mps)
                            {
                                tmp.Add(ip);
                            }
                            mp.RemoveLast();
                        }
                        mp.NewMultiPathSegment(rbPathType, tmp);
                    }
                }
                if (!mp[mp.Count - 1].Add(new IntPoint(e.X * scale, e.Y * scale)))
                {
                    mp.NewMultiPathSegment(rbPathType, new Path());
                    mp[mp.Count - 1].Add(new IntPoint(e.X * scale, e.Y * scale));
                }

                UpdateBtnAndMenuState();
                BmpUpdateNeeded();
                MovingButtonIdx = -1;
            }
            LeftButtonPressed = (e.Button == MouseButtons.Left);
        }
Example #2
0
        //------------------------------------------------------------------------------

        private void mNewPath_Click(object sender, EventArgs e)
        {
            MultiPath mp = GetActivePath();

            if (!mp.IsValid())
            {
                return;
            }
            int refID = (rbClipPoly.Checked ? CLIP : SUBJECT);

            mp.owner.NewMultiPath((UInt16)refID, mp.IsClosed);
            UpdateBtnAndMenuState();
            BmpUpdateNeeded();
        }
Example #3
0
        //------------------------------------------------------------------------------

        private void UpdateBtnAndMenuState()
        {
            mClear.Enabled = allPaths.Count > 0;
            MultiPath mp     = GetActivePath();
            int       cnt    = allPaths.Count;
            MultiPath subjMp = GetCurrentSubjMultiPath();

            cbSubjClosed.Checked = (subjMp != null && subjMp.IsClosed);
            if (mp.Count == 0)
            {
                mUndo.Enabled    = mp.owner.Count > 0;
                mNewPath.Enabled = false;
                bNewPath.Enabled = false;
                return;
            }
            int j = mp[mp.Count - 1].Count;

            mUndo.Enabled    = (mp.Count > 1 || j > 0);
            bNewPath.Enabled = mp.IsValid();
            mNewPath.Enabled = bNewPath.Enabled;
        }