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); }
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); }
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); }
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(); } }
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" }; }
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); }
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); }
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)); } }