Example #1
0
 public override DiagramShape Pick(PointF p, bool selectableOnly)
 {
     if (this.CanView())
     {
         if (!DiagramShape.ContainsRect(this.Bounds, p))
         {
             return(null);
         }
         foreach (DiagramShape obj1 in base.Backwards)
         {
             DiagramShape obj2 = obj1.Pick(p, selectableOnly);
             if (obj2 != null)
             {
                 return(obj2);
             }
         }
         if (!selectableOnly)
         {
             return(this);
         }
         if (this.CanSelect())
         {
             return(this);
         }
     }
     return(null);
 }
Example #2
0
        private void CalculatePaintBounds(DiagramView view)
        {
            base.InternalFlags &= -1048577;
            RectangleF      ef1         = this.Bounds;
            float           single1     = ef1.X;
            float           single2     = ef1.Y;
            float           single3     = single1 + ef1.Width;
            float           single4     = single2 + ef1.Height;
            GroupEnumerator enumerator2 = this.GetEnumerator();
            GroupEnumerator enumerator1 = enumerator2.GetEnumerator();

            while (enumerator1.MoveNext())
            {
                DiagramShape obj1 = enumerator1.Current;
                RectangleF   ef2  = obj1.Bounds;
                ef2     = obj1.ExpandPaintBounds(ef2, view);
                single1 = System.Math.Min(single1, ef2.X);
                single2 = System.Math.Min(single2, ef2.Y);
                single3 = System.Math.Max(single3, (float)(ef2.X + ef2.Width));
                single4 = System.Math.Max(single4, (float)(ef2.Y + ef2.Height));
            }
            if (view != null)
            {
                this.myPaintBoundsShadowOffset = this.GetShadowOffset(view);
            }
            this.myLeft   = ef1.X - single1;
            this.myTop    = ef1.Y - single2;
            this.myRight  = single3 - (ef1.X + ef1.Width);
            this.myBottom = single4 - (ef1.Y + ef1.Height);
        }
Example #3
0
        internal static void setAllNoClear(DiagramShape obj, bool b)
        {
            DiagramPort port1 = obj as DiagramPort;

            if (port1 != null)
            {
                port1.NoClearLinks = b;
            }
            else
            {
                LineGraph link1 = obj as LineGraph;
                if (link1 != null)
                {
                    link1.NoClearPorts = b;
                }
                else
                {
                    GroupShape group1 = obj as GroupShape;
                    if (group1 != null)
                    {
                        GroupEnumerator enumerator1 = group1.GetEnumerator();
                        while (enumerator1.MoveNext())
                        {
                            GroupShape.setAllNoClear(enumerator1.Current, b);
                        }
                    }
                }
            }
        }
Example #4
0
        public override void Paint(Graphics g, DiagramView view)
        {
            bool            flag1       = view.IsPrinting;
            RectangleF      ef1         = g.ClipBounds;
            bool            flag2       = DiagramShape.ContainsRect(ef1, this.Bounds);
            GroupEnumerator enumerator2 = this.GetEnumerator();
            GroupEnumerator enumerator1 = enumerator2.GetEnumerator();

            while (enumerator1.MoveNext())
            {
                DiagramShape obj1 = enumerator1.Current;
                if (flag1 ? obj1.CanPrint() : obj1.CanView())
                {
                    bool flag3 = flag2;
                    if (!flag3)
                    {
                        RectangleF ef2 = obj1.Bounds;
                        ef2   = obj1.ExpandPaintBounds(ef2, view);
                        flag3 = DiagramShape.IntersectsRect(ef2, ef1);
                    }
                    if (flag3)
                    {
                        obj1.Paint(g, view);
                    }
                }
            }
        }
Example #5
0
        public virtual void InsertPoint(int i, PointF p)
        {
            if (i < 0)
            {
                throw new ArgumentException("GoPolygon.InsertPoint given an invalid index, less than zero");
            }
            if (i > this.myPointsCount)
            {
                i = this.myPointsCount;
            }
            base.ResetPath();
            int num1 = this.myPoints.Length;

            if (this.myPointsCount >= num1)
            {
                PointF[] tfArray1 = new PointF[System.Math.Max((int)(num1 * 2), (int)(this.myPointsCount + 1))];
                Array.Copy(this.myPoints, 0, tfArray1, 0, num1);
                this.myPoints = tfArray1;
            }
            if (this.myPointsCount > i)
            {
                Array.Copy(this.myPoints, i, this.myPoints, (int)(i + 1), (int)(this.myPointsCount - i));
            }
            this.myPointsCount++;
            this.myPoints[i]   = p;
            base.InvalidBounds = true;
            this.Changed(0x579, i, null, DiagramShape.MakeRect(p), i, null, DiagramShape.MakeRect(p));
        }
Example #6
0
 public override RectangleF ExpandPaintBounds(RectangleF rect, DiagramView view)
 {
     if (this.Pen != null)
     {
         float single1 = System.Math.Max(System.Math.Max(this.InternalPenWidth, (float)1f), (float)(this.PenInfo.MiterLimit + 1f));
         DiagramShape.InflateRect(ref rect, single1, single1);
     }
     if (this.Shadowed)
     {
         SizeF ef1 = this.GetShadowOffset(view);
         if (ef1.Width < 0f)
         {
             rect.X     += ef1.Width;
             rect.Width -= ef1.Width;
         }
         else
         {
             rect.Width += ef1.Width;
         }
         if (ef1.Height < 0f)
         {
             rect.Y      += ef1.Height;
             rect.Height -= ef1.Height;
             return(rect);
         }
         rect.Height += ef1.Height;
     }
     return(rect);
 }
Example #7
0
        /// <summary>
        /// Removes the object from the model.
        /// </summary>
        public void Remove()
        {
            try
            {
                if (_entityTypeElement.ParentNode != null)
                {
                    if (DiagramShape != null)
                    {
                        DiagramShape.Remove();
                    }

                    _entityTypeElement.ParentNode.RemoveChild(_entityTypeElement);

                    if (Removed != null)
                    {
                        Removed(this, new EventArgs());
                    }
                }
            }
            catch (Exception ex)
            {
                try
                {
                    ExceptionTools.AddExceptionData(ex, this);
                }
                catch { }
                throw;
            }
        }
Example #8
0
        private void moveTo(int newidx, DiagramShape obj, int oldidx)
        {
            RectangleF ef1 = obj.Bounds;

            this.myObjects.Insert(newidx, obj);
            this.Changed(0x41d, oldidx, obj, ef1, newidx, obj, ef1);
        }
Example #9
0
 public override void AddSelectionHandles(DiagramSelection sel, DiagramShape selectedObj)
 {
     base.AddSelectionHandles(sel, selectedObj);
     if (this.CanReshape() && this.ResizableRadius)
     {
         RectangleF ef1     = this.Bounds;
         PointF     tf1     = new PointF();
         float      single1 = this.MinorRadius;
         if (this.Orientation == System.Windows.Forms.Orientation.Vertical)
         {
             if ((this.Perspective == Perspective.TopLeft) || (this.Perspective == Perspective.TopRight))
             {
                 tf1 = new PointF(ef1.X + (ef1.Width / 2f), ef1.Y + (2f * single1));
             }
             else
             {
                 tf1 = new PointF(ef1.X + (ef1.Width / 2f), (ef1.Y + ef1.Height) - (2f * single1));
             }
         }
         else if ((this.Perspective == Perspective.TopLeft) || (this.Perspective == Perspective.BottomLeft))
         {
             tf1 = new PointF(ef1.X + (2f * single1), ef1.Y + (ef1.Height / 2f));
         }
         else
         {
             tf1 = new PointF((ef1.X + ef1.Width) - (2f * single1), ef1.Y + (ef1.Height / 2f));
         }
         IShapeHandle handle1 = sel.CreateResizeHandle(this, selectedObj, tf1, 0x408, true);
         base.MakeDiamondResizeHandle(handle1, (this.Orientation == System.Windows.Forms.Orientation.Horizontal) ? 0x40 : 0x80);
     }
 }
Example #10
0
 public override void LayoutChildren(DiagramShape childchanged)
 {
     if (!base.Initializing)
     {
         DiagramShape obj1 = this.Icon;
         if (obj1 != null)
         {
             DiagramText text1 = this.Label;
             if (text1 != null)
             {
                 if (this.DraggableLabel && (childchanged == text1))
                 {
                     this.myLabelOffset = new SizeF(text1.Left - obj1.Left, text1.Top - obj1.Top);
                     return;
                 }
                 if (this.myLabelOffset.Width > -99999f)
                 {
                     text1.Position = new PointF(obj1.Left + this.myLabelOffset.Width, obj1.Top + this.myLabelOffset.Height);
                 }
                 else
                 {
                     text1.SetSpotLocation(0x20, obj1, 0x80);
                 }
             }
             if (this.Port != null)
             {
                 this.Port.SetSpotLocation(1, obj1, 1);
             }
         }
     }
 }
Example #11
0
 public override void Remove(DiagramShape obj)
 {
     base.Remove(obj);
     if (obj == this.myBack)
     {
         this.myBack = null;
     }
     else if (obj == this.myLabel)
     {
         this.myLabel = null;
     }
     else if (obj == this.myTopPort)
     {
         this.myTopPort = null;
     }
     else if (obj == this.myRightPort)
     {
         this.myRightPort = null;
     }
     else if (obj == this.myBottomPort)
     {
         this.myBottomPort = null;
     }
     else if (obj == this.myLeftPort)
     {
         this.myLeftPort = null;
     }
 }
Example #12
0
        internal static DiagramText FindLabel(DiagramShape obj)
        {
            DiagramText text1 = obj as DiagramText;

            if (text1 != null)
            {
                return(text1);
            }
            GroupShape group1 = obj as GroupShape;

            if (group1 != null)
            {
                GroupEnumerator enumerator2 = group1.GetEnumerator();
                GroupEnumerator enumerator1 = enumerator2.GetEnumerator();
                while (enumerator1.MoveNext())
                {
                    DiagramText text2 = DiagramNode.FindLabel(enumerator1.Current);
                    if (text2 != null)
                    {
                        return(text2);
                    }
                }
            }
            return(null);
        }
Example #13
0
 /// <summary>
 /// 新增流程图状态节点
 /// </summary>
 /// <param name="dShape">状态节点的实例</param>
 /// <param name="autoIdInt">流程图Id</param>
 private int InsertWorkFlowsNode(SqlCommand cmd, DiagramShape dShape, int autoIdInt)
 {
     cmd.CommandText = string.Format("insert into BS_WorkFlowsNode (WorkFlowsId, NodeText, Creator, GetTime, PositionX, PositionY, Width, Height, BackColor, ForeColor, FontName, FontSize) values ({0}, '{1}', {2}, getdate(), {3}, {4}, {5}, {6}, '{7}', '{8}', '{9}', {10})", autoIdInt, dShape.Content, SystemInfo.user.AutoId, dShape.Position.X, dShape.Position.Y, dShape.Width, dShape.Height, DataTypeConvert.ColorToString(dShape.Appearance.BackColor), DataTypeConvert.ColorToString(dShape.Appearance.ForeColor), dShape.Appearance.Font.Name, DataTypeConvert.GetInt(dShape.Appearance.Font.Size));
     cmd.ExecuteNonQuery();
     cmd.CommandText = "select @@IDENTITY";
     return(DataTypeConvert.GetInt(cmd.ExecuteScalar()));
 }
Example #14
0
 public virtual void Remove(DiagramShape obj)
 {
     if (obj != null)
     {
         DiagramShapeCollection.fastRemove(this.myObjects, obj);
     }
 }
Example #15
0
 public virtual void Add(DiagramShape obj)
 {
     if ((obj != null) && !this.Contains(obj))
     {
         this.myObjects.Add(obj);
     }
 }
        private DiagramShape _OverlayShape;           // What is it that we're using to show where the shape will end up?

        public SimpleShapeDragger(DiagramSurface surface, MainWindow window, Point startPoint, DiagramShape originalShape)
            : base(surface, window, startPoint)
        {
            _OriginalShape = originalShape;

            SetupMouse();
        }
Example #17
0
        /// <summary>
        /// 设置流程图里面所有项目的状态
        /// </summary>
        private void diagramMainState(bool state)
        {
            foreach (DiagramItem item in diagramMain.Items)
            {
                switch (item.GetType().ToString())
                {
                case "DevExpress.XtraDiagram.DiagramConnector":
                    DiagramConnector dConn = (DiagramConnector)item;
                    dConn.CanSelect = state;
                    break;

                case "DevExpress.XtraDiagram.DiagramShape":
                    DiagramShape dShape = (DiagramShape)item;
                    dShape.CanCopy   = state;
                    dShape.CanDelete = state;
                    dShape.CanMove   = state;
                    dShape.CanResize = state;
                    break;
                }
            }

            if (!state)
            {
                diagramPointerToolBarItem1.Checked = true;
            }

            diagramDocumentRibbonPageGroup1.Enabled  = state;
            diagramClipboardRibbonPageGroup1.Enabled = state;
            diagramFontRibbonPageGroup1.Enabled      = state;

            diagramConnectorToolBarItem1.Enabled      = state;
            diagramShapeToolSelectionBarItem1.Enabled = state;
        }
Example #18
0
 public virtual bool Contains(DiagramShape obj)
 {
     if (obj == null)
     {
         return(false);
     }
     return(this.myObjects.Contains(obj));
 }
Example #19
0
 public virtual void Clear()
 {
     for (int num1 = this.myObjects.Count; num1 > 0; num1 = System.Math.Min(num1, this.myObjects.Count))
     {
         DiagramShape obj1 = (DiagramShape)this.myObjects[--num1];
         this.Remove(obj1);
     }
 }
Example #20
0
        public override void CopyObjectDelayed(CopyDictionary env, DiagramShape newobj)
        {
            base.CopyObjectDelayed(env, newobj);
            Balloon balloon1 = (Balloon)newobj;

            balloon1.myAnchor = env[this.myAnchor] as DiagramShape;
            balloon1.LayoutChildren(null);
        }
Example #21
0
        public virtual DiagramShapeBuilder Add()
        {
            var item = new DiagramShape();

            container.Add(item);

            return(new DiagramShapeBuilder(item));
        }
Example #22
0
        public override bool GetNearestIntersectionPoint(PointF p1, PointF p2, out PointF result)
        {
            RectangleF ef1     = this.Bounds;
            float      single1 = base.InternalPenWidth / 2f;

            DiagramShape.InflateRect(ref ef1, single1, single1);
            return(EllipseGraph.NearestIntersectionOnEllipse(ef1, p1, p2, out result));
        }
Example #23
0
 private void ClearPrimaryShape()
 {
     if (selectedShape != null)
     {
         selectedShape.IsSelected = false;
     }
     selectedShape = null;
 }
Example #24
0
        public override bool ContainsPoint(PointF p)
        {
            RectangleF ef1     = this.Bounds;
            float      single1 = this.InternalPenWidth;

            DiagramShape.InflateRect(ref ef1, single1 / 2f, single1 / 2f);
            return(DiagramShape.ContainsRect(ef1, p));
        }
Example #25
0
        public virtual DiagramShapeBuilder Add()
        {
            var item = new DiagramShape();

            container.Add(item);

            return new DiagramShapeBuilder(item);
        }
Example #26
0
 protected override void OnObservedChanged(DiagramShape observed, int subhint, int oldI, object oldVal, RectangleF oldRect, int newI, object newVal, RectangleF newRect)
 {
     base.OnObservedChanged(observed, subhint, oldI, oldVal, oldRect, newI, newVal, newRect);
     if ((subhint == 0x5dd) && (observed == this.Label))
     {
         this.Text = (string)newVal;
     }
 }
Example #27
0
        public override bool GetNearestIntersectionPoint(PointF p1, PointF p2, out PointF result)
        {
            RectangleF ef1     = this.Bounds;
            float      single1 = this.InternalPenWidth;

            DiagramShape.InflateRect(ref ef1, single1 / 2f, single1 / 2f);
            return(DiagramShape.GetNearestIntersectionPoint(ef1, p1, p2, out result));
        }
Example #28
0
 public static void TidyAllConnections_AndConnectedShapes(DiagramShape shape)
 {
     TidyAllConnections(shape);
     foreach (var s in shape.ConnectedShapes)
     {
         TidyAllConnections(s);
     }
 }
Example #29
0
 public virtual bool Contains(DiagramShape obj)
 {
     if (obj != null)
     {
         return(obj.Parent == this);
     }
     return(false);
 }
Example #30
0
 protected override void OnObservedChanged(DiagramShape observed, int subhint, int oldI, object oldVal, RectangleF oldRect, int newI, object newVal, RectangleF newRect)
 {
     base.OnObservedChanged(observed, subhint, oldI, oldVal, oldRect, newI, newVal, newRect);
     if ((subhint == 0x3e9) && (observed == this.Anchor))
     {
         this.LayoutChildren(null);
     }
 }
Example #31
0
        protected override RectangleF ComputeBounds()
        {
            GroupEnumerator enumerator1;
            RectangleF      ef1     = this.Bounds;
            SizeF           ef2     = this.TopLeftMargin;
            SizeF           ef3     = this.BottomRightMargin;
            float           single1 = 0f;
            float           single2 = 0f;
            float           single3 = this.Spacing;

            if (this.LinePenInfo != null)
            {
                single3 = System.Math.Max(this.LinePenInfo.Width, single3);
            }
            if (this.Orientation == System.Windows.Forms.Orientation.Vertical)
            {
                enumerator1 = base.GetEnumerator();
                while (enumerator1.MoveNext())
                {
                    DiagramShape obj1 = enumerator1.Current;
                    if (obj1 != null)
                    {
                        single1 = System.Math.Max(single1, obj1.Width);
                        if (obj1.CanView())
                        {
                            if (single2 > 0f)
                            {
                                single2 += single3;
                            }
                            single2 += obj1.Height;
                        }
                    }
                }
            }
            else
            {
                enumerator1 = base.GetEnumerator();
                while (enumerator1.MoveNext())
                {
                    DiagramShape obj2 = enumerator1.Current;
                    if (obj2 != null)
                    {
                        single2 = System.Math.Max(single2, obj2.Height);
                        if (obj2.CanView())
                        {
                            if (single1 > 0f)
                            {
                                single1 += single3;
                            }
                            single1 += obj2.Width;
                        }
                    }
                }
            }
            ef1.Width  = (single1 + ef2.Width) + ef3.Width;
            ef1.Height = (single2 + ef2.Height) + ef3.Height;
            return(ef1);
        }
Example #32
0
 public DiagramShapeBuilder(DiagramShape settings)
 {
     container = settings;
 }
Example #33
0
        private ShowNodesEventParameter CreateShowNodesEventParameter(PointFloat pnt,bool singleSelect,DiagramShape currentShape)
        {
            var para = new ShowNodesEventParameter();
            para.MouseClickPoint = pnt;
            para.Application = Application;
            para.CreateShape = (x) =>
            {
                var rst = new DiagramShapeEx(SDLDiagramShapes.Procedure, x.X, x.Y, x.Width, x.Height);
                rst.Image = x.GetImage();
                _diagram.Items.Add(rst);
                _diagram.SelectItem(rst);
                return rst;
            };
            para.ObjectSpace = _os;
            para.SelectedForms = _diagram.Items.OfType<DiagramShape>().Select(x => (x.Tag as IFlowNode)).ToArray();
            para.Shape = currentShape;
            para.SingleSelect = singleSelect;
            para.UpdateShape = (node, shape) =>
            {
                var s = shape as DiagramShape;
                s.Content = node.Caption;
                s.Tag = node;
            };

            para.DoShowNavigationItem = (x) =>
            {
                var snc = Application.MainWindow.GetController<SubSystemNavigationController>();
                var sname = x.Split('/');
                if (sname.Length > 3)
                    snc.NavigationToSystem(sname[3]);
                var ctrl = Application.MainWindow.GetController<ShowNavigationItemController>().ShowNavigationItemAction;
                var toItem = FindChoiceActionItemByModelPath(ctrl.Items, x);
                ctrl.SelectedItem = toItem;
                ctrl.DoExecute(toItem);

                //ctrl.FindItemByIdPath()
            };

            if (currentShape != null)
                para.SelectedNode = currentShape.Tag as IFlowNode;

            para.DeletSelectedNode = () => { _diagram.DeleteSelectedItems(); };
            para.ViewParameter = new ShowViewParameters();
            Flow.ShowNodesView(para);
            return para;
        }
Example #34
0
 private void _diagram_DeleteShape(object sender, DiagramShape e)
 {
     if (!_isRefreshing)
     {
         var t = e.Tag as IFlowNode;
         if (t != null)
         {
             Flow.RemoveNode(t);
             t.Delete();
         }
     }
 }
Example #35
0
 private void _diagram_EditShape(object sender, DiagramShape e)
 {
     var para = CreateShowNodesEventParameter(new PointFloat(0, 0), true, e);
     Application.ShowViewStrategy.ShowView(para.ViewParameter, new ShowViewSource(null,null));
 }