예제 #1
0
        private SnipPagePart[] GetPartsAtEx(IPartContainer container, Rectangle rect)
        {
            List <SnipPagePart> list = new List <SnipPagePart>();

            //bool hasHited = false;
            foreach (SnipPagePart part in container.ChildParts)
            {
                if (part.HitTest(rect))
                {
                    //hasHited = true;
                    list.Add(part);

                    ///递归检测其下的子Part
                    if (part.HasChild)
                    {
                        SnipPagePart[] arrParts = GetPartsAtEx(part, rect);
                        list.AddRange(arrParts);
                    }
                }
                //else if (hasHited)   //若是跳出,则可能出现不连续的选择不成功
                //{
                //    break;
                //}
            }

            return(list.ToArray());
        }
예제 #2
0
        public void AddExecInsertPartCommand(SnipPagePart part, IPartContainer parent, int index)
        {
            InsertPartCommand cmd = new InsertPartCommand(part, parent, index);

            cmd.Execute();
            AddCommand(cmd);
            Designer.IsModified = true;
        }
예제 #3
0
        public void AddExecAddPartCommand(IPartContainer parent, SnipPagePart part)
        {
            AddPartCommand cmd = new AddPartCommand(parent, part);

            cmd.Execute();
            AddCommand(cmd);
            Designer.IsModified = true;
        }
예제 #4
0
        /// <summary>
        /// 判断subContainer是否是当前Part的孙Part
        /// </summary>
        bool IsSub(IPartContainer subContainer)
        {
            IPartContainer subContainerParent = subContainer;

            while (subContainerParent != null && !(subContainerParent is SnipPageDesigner))
            {
                if (subContainerParent == this)
                {
                    return(true);
                }
                subContainerParent = subContainerParent.ParentContainer;
            }

            return(false);
        }
예제 #5
0
        public Point PointToDesigner(Point point)
        {
            int            x         = point.X;
            int            y         = point.Y;
            IPartContainer parentBox = this.ParentContainer;

            while (parentBox != null && !(parentBox is SnipPageDesigner))
            {
                x += parentBox.Bounds.X;
                y += parentBox.Bounds.Y;

                parentBox = parentBox.ParentContainer;
            }

            return(new Point(x, y));
        }
예제 #6
0
        internal void RemoveCore(SnipPagePart part)
        {
            int            index         = _innerList.IndexOf(part);
            IPartContainer partContainer = part.ParentContainer;

            part.ParentContainer = null;
            bool bl = _innerList.Remove(part);

            if (bl)
            {
                ///维护SnipPagePart的Index
                for (int i = index; i < _innerList.Count; i++)
                {
                    _innerList[i].Index = i;
                }

                ///重新布局
                partContainer.LayoutParts();
            }
        }
예제 #7
0
        public void MoveTo(IPartContainer parentContainer, int index)
        {
            ///Index为-1,表示当前Part是新增Part,那么直接放到指定位置并打开编辑窗口
            if (this.Index == -1)
            {
                parentContainer.ChildParts.Insert(index, this);
                Designer.EditPart(this, true);
            }
            ///同一级,位置一样,则直接返回
            else if (ParentContainer == parentContainer && this.Index == index)
            {
                return;
            }
            ///不能把当前Part移到自己的子Part里去
            else if (IsSub(parentContainer))
            {
                return;
            }
            ///位置不一样,移动节点
            else
            {
                ///开始批命令操作
                try
                {
                    ParentContainer.Designer.CmdManager.BeginBatchCommand();

                    ///移动节点
                    if (ParentContainer == parentContainer && this.Index < index)
                    {
                        index--;
                    }
                    this.ParentContainer.ChildParts.Remove(this);
                    parentContainer.ChildParts.Insert(index, this);
                }
                finally
                {
                    ///结束批命令操作
                    ParentContainer.Designer.CmdManager.EndBatchCommand();
                }
            }
        }
예제 #8
0
        public ClassPartContainer(IPartContainer parentContainer)
        {
            ResourcesReader.SetObjectResourcesHelper(this);

            PartContainer       = parentContainer;
            DisplaySpace        = SoftwareOption.SnipDesigner.DisplaySpace;
            BoxFillColor        = SoftwareOption.SnipDesigner.BoxFillColor;
            TextColor           = SoftwareOption.SnipDesigner.TextColor;
            SelectedPenColor    = SoftwareOption.SnipDesigner.SelectedPenColor;
            ItemPenColor        = SoftwareOption.SnipDesigner.ItemPenColor;
            BoxPenColor         = SoftwareOption.SnipDesigner.BoxPenColor;
            StaticPartColor     = SoftwareOption.SnipDesigner.StaticPartColor;
            NavagationPartColor = SoftwareOption.SnipDesigner.NavagationPartColor;
            AttributePartColor  = SoftwareOption.SnipDesigner.AttributePartColor;
            PathPartColor       = SoftwareOption.SnipDesigner.PathPartColor;

            PathPartForeColor       = SoftwareOption.SnipDesigner.PathPartForeColor;
            AttributePartForeColor  = SoftwareOption.SnipDesigner.AttributePartForeColor;
            NavagationPartForeColor = SoftwareOption.SnipDesigner.NavagationPartForeColor;
            StaticPartForeColor     = SoftwareOption.SnipDesigner.StaticPartForeColor;
            BoxForeColor            = SoftwareOption.SnipDesigner.BoxForeColor;
            PieRadii            = SoftwareOption.SnipDesigner.PieRadii; //需要添加到选项里
            UsingLinearGradient = SoftwareOption.SnipDesigner.UsingLinearGradient;
        }
예제 #9
0
 public InsertPartCommand(SnipPagePart part, IPartContainer parent, int index)
     : base(part)
 {
     this._parent = parent;
     this._index  = index;
 }
예제 #10
0
 public AddPartCommand(IPartContainer parent, SnipPagePart part)
     : base(part)
 {
     this._parent = parent;
 }
예제 #11
0
 public SnipPagePartCollection(IPartContainer parentContainer)
 {
     ParentContainer = parentContainer;
 }
예제 #12
0
 public RemovePartCommand(SnipPagePart part)
     : base(part)
 {
     this._parent = Part.ParentContainer;
     _position    = Parent.ChildParts.IndexOf(Part);
 }