Пример #1
0
 private void init()
 {
     this.modified        = false;
     this.multiSelected   = new ArrayList();
     this.selectedShape   = null;
     this.tempLine        = null;
     this.arrowLong       = 10.0;
     this.arrowAngle      = 0.52359877559829882;
     this.isCaptured      = false;
     this.wantLine        = false;
     this.breakLine       = false;
     this.wantMoveShape   = false;
     this.wantMovePoint   = -1;
     this.wantInput       = false;
     this.inputBox        = new TextBox();
     this.turningPosition = -2;
     this.CursorFlag      = true;
     this.RecFlag         = false;
     this.ReserveFlag     = false;
     this.CursorDown      = false;
     this.RecDown         = false;
     this.ReserveDown     = false;
     this.myPen           = new Pen(Color.Black);
     this.dataDoc         = new VMDoc1((DEViewModel)this.mainWindow.Tag);
     this.BackColor       = SystemColors.Window;
     base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
     base.SetStyle(ControlStyles.UserPaint, true);
     base.SetStyle(ControlStyles.DoubleBuffer, true);
     this.inputBox.KeyDown += new KeyEventHandler(this.inputBox_KeyDown);
 }
Пример #2
0
        public bool deleteObject()
        {
            string str;

            if (((DEViewModel)this.mainWindow.Tag).Locker != ClientData.LogonUser.Oid)
            {
                return(false);
            }
            if ((this.selectedShape != null) && ((str = this.selectedShape.GetType().Name.ToString()) != null))
            {
                if (str == "VMLine1")
                {
                    this.dataDoc.DelLine((VMLine1)this.selectedShape);
                    this.selectedShape = null;
                    this.Refresh();
                }
                else if (str == "VMNode1")
                {
                    try
                    {
                        this.dataDoc.RemoveNode((VMNode1)this.selectedShape);
                        this.selectedShape = null;
                        this.Refresh();
                    }
                    catch (ViewException exception)
                    {
                        MessageBox.Show(exception.Message, "删除视图节点", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return(false);
                    }
                }
            }
            return(true);
        }
Пример #3
0
 private void VMView_MouseUp(object sender, MouseEventArgs e)
 {
     this.mousePosition = new Point(e.X, e.Y);
     if (e.Button == MouseButtons.Left)
     {
         this.isCaptured = false;
         if (this.wantLine)
         {
             this.endShape = this.inShape(this.mousePosition);
             if (((this.endShape != null) && !(this.endShape is VMText1)) && (this.startShape != this.endShape))
             {
                 ErrorDetective1 detective = new ErrorDetective1(this.dataDoc, this.startShape, this.endShape);
                 if (detective.ErrorFree())
                 {
                     VMLine1 line = new VMLine1(Guid.NewGuid(), this.startShape, this.endShape);
                     this.addLine(line);
                 }
                 else
                 {
                     MessageBox.Show("逻辑错误!!!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 }
                 this.startShape = null;
                 this.endShape   = null;
             }
             this.wantLine = false;
             this.moveBase = this.mousePosition;
         }
         else if (this.RecFlag)
         {
             VMNode1 node = new VMNode1(Guid.NewGuid(), this.mousePosition);
             if (this.selectedShape != null)
             {
                 this.selectedShape.isSelected = false;
             }
             this.selectedShape = node;
             this.addNode(node);
             this.RecFlag = false;
             this.mainWindow.controlTBButton(TagForViewWork.TOOLBAR_REC);
             this.moveBase = this.mousePosition;
         }
         else if (this.breakLine && (this.turningPosition != -2))
         {
             this.addPoint(this.turningPosition, this.mousePosition);
             this.breakLine       = false;
             this.turningPosition = -2;
             this.moveBase        = this.mousePosition;
         }
         else if (this.wantMulSelect)
         {
             Rectangle rec = this.createRec(this.moveBase, this.mousePosition);
             this.multiSelected = this.getMulSelect(rec);
             this.setMulSelectSymbol();
             if (this.multiSelected.Count == 1)
             {
                 this.selectedShape = (VMNode1)this.multiSelected[0];
                 this.multiSelected.RemoveAt(0);
             }
             this.wantMulSelect = false;
             this.moveBase      = this.mousePosition;
             this.mulSelRec     = this.createRec(this.moveBase, this.mousePosition);
         }
     }
     this.wantMovePoint = -1;
     this.Refresh();
 }
Пример #4
0
        private void VMView_MouseDown(object sender, MouseEventArgs e)
        {
            base.Focus();
            this.mousePosition = new Point(e.X, e.Y);
            VMShape1 selectedShape = this.whichSelected(this.mousePosition, ref this.wantLine, ref this.wantMoveShape);

            if (e.Button == MouseButtons.Left)
            {
                this.isCaptured = true;
                this.moveBase   = this.mousePosition;
                this.mulSelRec  = this.createRec(this.moveBase, this.mousePosition);
                if (!this.wantInput)
                {
                    if (selectedShape != null)
                    {
                        if (this.multiSelected.Count > 0)
                        {
                            if (!this.inMulSel(this.mousePosition))
                            {
                                this.releaseMulSelected();
                                if ((this.selectedShape != null) && !this.inMulSel(this.selectedShape))
                                {
                                    this.selectedShape.isSelected = false;
                                }
                                this.selectedShape            = selectedShape;
                                this.selectedShape.isSelected = true;
                            }
                            this.wantLine = false;
                        }
                        else
                        {
                            if (this.selectedShape != null)
                            {
                                this.selectedShape.isSelected = false;
                            }
                            this.selectedShape            = selectedShape;
                            this.selectedShape.isSelected = true;
                        }
                        if (this.selectedShape != null)
                        {
                            this.wantMovePoint = this.selectedShape.isPointInSymbol(this.mousePosition);
                        }
                        if (this.wantLine)
                        {
                            this.startShape = this.selectedShape;
                        }
                    }
                    else if (this.multiSelected.Count > 0)
                    {
                        this.releaseMulSelected();
                        this.wantMulSelect = true;
                    }
                    else
                    {
                        this.wantMulSelect = true;
                        if (this.selectedShape != null)
                        {
                            this.selectedShape.isSelected = false;
                            this.selectedShape            = null;
                        }
                        else
                        {
                            this.wantMulSelect = true;
                        }
                    }
                    this.Refresh();
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                string type = "";
                if (selectedShape is VMNode1)
                {
                    this.selectedShape = selectedShape;
                    type = "Node";
                }
                else if (selectedShape is VMLine1)
                {
                    this.selectedShape = selectedShape;
                    type = "Line";
                }
                else if (selectedShape is VMText1)
                {
                    type = "Text";
                }
                else
                {
                    type = "Empty";
                }
                this.BuildMenu(type, selectedShape);
                if (this.cmuCommon.MenuItems.Count > 0)
                {
                    this.cmuCommon.Show(this, this.mousePosition);
                }
            }
        }
Пример #5
0
 private bool inMulSel(VMShape1 nodeShape)
 {
     return(this.multiSelected.Contains(nodeShape));
 }
Пример #6
0
 private int deleteAssociatedLine(VMShape1 shape)
 {
     return(this.dataDoc.DelAssociatedLine(shape));
 }
Пример #7
0
        public void BuildMenu(string type, VMShape1 selectedShape)
        {
            this.cmuCommon.MenuItems.Clear();
            string str = type;

            if (str != null)
            {
                if (str != "Node")
                {
                    if (str != "Line")
                    {
                        if (str != "Text")
                        {
                            if (str != "Empty")
                            {
                                return;
                            }
                            ViewFrameMenuProcess process3 = new ViewFrameMenuProcess(this, (VMText1)selectedShape, ClientData.LogonUser);
                            int num = 0;
                            if (!((DEViewModel)this.mainWindow.Tag).Locker.Equals(Guid.Empty))
                            {
                                if (((DEViewModel)this.mainWindow.Tag).Locker.Equals(ClientData.LogonUser.Oid))
                                {
                                    num = 1;
                                }
                                else
                                {
                                    num = 2;
                                }
                            }
                            switch (num)
                            {
                            case 1:
                                this.cmuCommon.MenuItems.AddRange(process3.BuildSelfEditMenuItems());
                                return;

                            case 2:
                                this.cmuCommon.MenuItems.AddRange(process3.BuildEditMenuItems());
                                break;

                            case 0:
                                if (((DEViewModel)this.mainWindow.Tag).IsActive == 'A')
                                {
                                    this.cmuCommon.MenuItems.AddRange(process3.BuiltInitMenuItemOfActivedVM());
                                    return;
                                }
                                this.cmuCommon.MenuItems.AddRange(process3.BuiltInitMenuItemOfUnActivedVM());
                                return;
                            }
                        }
                        return;
                    }
                }
                else
                {
                    ViewFrameMenuProcess process = new ViewFrameMenuProcess(this, (VMNode1)selectedShape, ClientData.LogonUser);
                    this.cmuCommon.MenuItems.AddRange(process.BuildViewMenuItems());
                    return;
                }
                ViewFrameMenuProcess process2 = new ViewFrameMenuProcess(this, (VMLine1)selectedShape, ClientData.LogonUser);
                this.cmuCommon.MenuItems.AddRange(process2.BuildViewRelationMenuItems());
            }
        }
Пример #8
0
 public ViewFrameMenuProcess(VMViewPanal panal, VMShape1 selectedShape, DEUser oper)
 {
     this.thePanal = panal;
     this.theShape = selectedShape;
     this.theOper  = oper;
 }