public SyncFormatDialogItem(FormatTreeNode node) : base() { this.node = node; checkBox.IsChecked = node.IsChecked; checkBox.Checked += new RoutedEventHandler(CheckBoxCheckChange); checkBox.Unchecked += new RoutedEventHandler(CheckBoxCheckChange); checkBox.Indeterminate += new RoutedEventHandler(CheckBoxCheckChange); }
private Object DialogItemFromFormatTree(Shape shape, FormatTreeNode node) { if (node.Format != null) { SyncFormatDialogItem result = new SyncFormatDialogItem(node); if (!node.Format.CanCopy(shape)) { return(null); } result.Text = node.Name; result.IsChecked = node.IsChecked; result.Image = node.Format.DisplayImage(shape); return(result); } else { SyncFormatDialogItem header = new SyncFormatDialogItem(node); header.Text = node.Name; header.IsChecked = node.IsChecked; TreeViewItem result = new TreeViewItem(); result.Header = header; List <SyncFormatDialogItem> children = new List <SyncFormatDialogItem>(); foreach (FormatTreeNode childNode in node.ChildrenNodes) { Object treeItem = DialogItemFromFormatTree(shape, childNode); if (treeItem != null) { if (treeItem is SyncFormatDialogItem) { children.Add((SyncFormatDialogItem)treeItem); } else if (treeItem is TreeViewItem) { children.Add((SyncFormatDialogItem)((TreeViewItem)treeItem).Header); } result.Items.Add(treeItem); } } header.ItemChildren = children.ToArray <SyncFormatDialogItem>(); foreach (SyncFormatDialogItem child in children) { child.ItemParent = header; } result.ExpandSubtree(); if (result.Items.Count == 0) { return(null); } return(result); } }
private string GetNamesOfCheckedNodes(string rootName, FormatTreeNode node) { if (node.IsChecked ?? false) { return((node.Name.Equals(rootName) ? "" : rootName + SyncFormatConstants.FormatNameSeparator) + node.Name + "\n"); } StringBuilder result = new StringBuilder(); foreach (FormatTreeNode child in node.ChildrenNodes ?? new FormatTreeNode[] { }) { result.Append(GetNamesOfCheckedNodes(rootName, child)); } return(result.ToString()); }
private void ApplyFormats(FormatTreeNode node, Shape formatShape, Shape newShape) { if (node.Format != null) { if (!node.IsChecked.HasValue || !node.IsChecked.Value) { return; } node.Format.SyncFormat(formatShape, newShape); } else { ApplyFormats(node.ChildrenNodes, formatShape, newShape); } }
/** * Check if custom perspective shadow was used & show a warning if so * We cannot handle it accurately, see ShadowEffectFormat.cs for more information */ private void ShowWarningMessageForMixedStylePerspective() { // check if custom perspective shadow was used, FormatTreeNode shadowNode = GetNodeWithFormatType(Formats, typeof(ShadowEffectFormat)); if (shadowNode == null) { return; } bool shadowNodeIsChecked = shadowNode.IsChecked != null && shadowNode.IsChecked.Value; if (ShadowEffectFormat.MightHaveCustomPerspectiveShadow(shape) && shadowNodeIsChecked) { MessageBox.Show(SyncLabText.WarningSyncPerspectiveShadow, SyncLabText.WarningDialogTitle); } }
public FormatTreeNode Clone(FormatTreeNode parent) { FormatTreeNode cloned = null; if (this.IsFormatNode) { cloned = new FormatTreeNode(name, format); } else { FormatTreeNode[] clonedChildren = new FormatTreeNode[childrenNodes.Length]; for (int i = 0; i < clonedChildren.Length; i++) { clonedChildren[i] = childrenNodes[i].Clone(); } cloned = new FormatTreeNode(name, clonedChildren); } return(cloned); }