コード例 #1
0
        public virtual void CopyTo(IStyleGroup other)
        {
            base.CopyTo(other);

            other.DefaultStyle  = MakeCopy(this.DefaultStyle, other);
            other.SelectedStyle = MakeCopy(this.SelectedStyle, other);
            other.HoveredStyle  = MakeCopy(this.HoveredStyle, other);
        }
コード例 #2
0
 public void ReportStyleGroup(IStyleGroup stylegroup)
 {
     ReportDetail("{0}", stylegroup.Name);
     ReportDetail("\tParent\t{0}", stylegroup.ParentStyle.Name);
     ReportDetail("\tDefault\t{0}\t{1}", stylegroup.DefaultStyle.Name, stylegroup.DefaultStyle.ParentStyle.Name);
     ReportDetail("\tSelected\t{0}t{1}", stylegroup.SelectedStyle.Name, stylegroup.SelectedStyle.ParentStyle.Name);
     ReportDetail("\tHovered\t{0}t{1}", stylegroup.HoveredStyle.Name, stylegroup.HoveredStyle.ParentStyle.Name);
 }
コード例 #3
0
        public void TestPaintData(IStyleGroup stylegroup)
        {
            ReportStyleGroup(stylegroup);
            var baseData = stylegroup.ParentStyle.PaintData;
            var toggle   = stylegroup.PaintData;

            stylegroup.PaintData = !toggle;
            Assert.IsTrue(stylegroup.ParentStyle.PaintData == baseData);
            Assert.IsTrue(stylegroup.PaintData != toggle);
            Assert.IsTrue(stylegroup.DefaultStyle.PaintData != toggle);
            Assert.IsTrue(stylegroup.SelectedStyle.PaintData != toggle);
            Assert.IsTrue(stylegroup.HoveredStyle.PaintData != toggle);
        }
コード例 #4
0
ファイル: LayoutToolbar.cs プロジェクト: git-thinh/limada
        public void StyleChange(IStyleGroup style)
        {
            var currentDisplay = this.CurrentDisplay;

            if (currentDisplay != null)
            {
                foreach (var visual in currentDisplay.Data.Selected.Elements)
                {
                    SceneExtensions.ChangeStyle(currentDisplay.Data, visual, style);
                }
                currentDisplay.Perform();
                currentDisplay.Backend.QueueDraw();
            }
        }
コード例 #5
0
 public StyleKeeper(IStyleHelper styleHelper)
 {
     if (styleHelper == null)
     {
         throw new ArgumentNullException("styleHelper");
     }
     _Helper = styleHelper;
     _Local  = new LocalStyleGroup {
         Name = "Local", Helper = _Helper.Local
     };
     _Remote = new RemoteStyleGroup {
         Name = "Remote"
     };
     _Embedded = new EmbeddedStyleGroup {
         Name = "Embedded"
     };
 }
コード例 #6
0
        public void TestMemberCascade <T> (IStyleGroup stylegroup, Expression <Func <IStyle, T> > member)
        {
            var    memberI  = member.MemberInfo() as PropertyInfo;
            object oldValue = null;
            object newValue = null;

            if (memberI.PropertyType == typeof(bool))
            {
                var value = (bool)memberI.GetValue(stylegroup, null);
                oldValue = value;
                newValue = !value;
            }

            if (memberI.PropertyType == typeof(Color))
            {
                var value = (Color)memberI.GetValue(stylegroup, null);
                oldValue = value;
                newValue = value.WithIncreasedContrast(.05);
            }

            // set everything go parentStyle == stylegroup
            foreach (var style in stylegroup)
            {
                memberI.SetValue(style, oldValue, null);
            }
            memberI.SetValue(stylegroup, newValue, null);
            // now everything should have stylegroups value:
            foreach (var style in stylegroup)
            {
                var val = memberI.GetValue(style, null);
                Assert.AreEqual(newValue, val, memberI.Name);
            }

            // set individual value:
            foreach (var style in stylegroup.Where(s => s != stylegroup))
            {
                memberI.SetValue(style, oldValue, null);

                var val = memberI.GetValue(style, null);
                Assert.AreEqual(oldValue, val, memberI.Name);
            }
            // styleGroup should have old value:
            var baseVal = memberI.GetValue(stylegroup, null);

            Assert.AreEqual(newValue, baseVal, memberI.Name);
        }
コード例 #7
0
        public virtual void CopyTo(IStyleSheet other)
        {
            base.CopyTo(other);
            other.BackColor = this.BackColor;

            other.ParentStyle = MakeCopy(this.ParentStyle, null);
            other.BaseStyle   = MakeCopy(this.BaseStyle, other.ParentStyle);

            Func <IStyleGroup, IStyleGroup> makeCopy = (source) => {
                IStyleGroup sink = null;
                if (source != null)
                {
                    sink = new StyleGroup(source.Name, other.BaseStyle);
                    source.CopyTo(sink);
                }
                return(sink);
            };

            other.ItemStyle = makeCopy(this.ItemStyle);
            other.EdgeStyle = makeCopy(this.EdgeStyle);
        }
コード例 #8
0
ファイル: SceneExtensions.cs プロジェクト: git-thinh/limada
        public static void ChangeStyle(IGraphScene <IVisual, IVisualEdge> scene, IVisual visual, IStyleGroup newStyle)
        {
            if (visual == null || newStyle == null)
            {
                return;
            }

            var changeStyle =
                new ActionCommand <IVisual, IStyleGroup> (visual, newStyle, (target, style) => target.Style = style);

            scene.Requests.Add(changeStyle);
            if (visual.Shape is VectorShape)
            {
                scene.Requests.Add(new LayoutCommand <IVisual> (visual, LayoutActionType.Justify));
            }
            foreach (var edge in scene.Twig(visual))
            {
                scene.Requests.Add(new LayoutCommand <IVisual> (edge, LayoutActionType.Justify));
            }
        }