public override void UnregisterPropertyChangedHandler(PropertyReference propertyReference, Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler handler) { SceneNodeObjectSet sceneNodeObjectSet = (SceneNodeObjectSet)this; for (SceneNodeCollectionObjectSet collectionObjectSet = this; collectionObjectSet != null; collectionObjectSet = sceneNodeObjectSet as SceneNodeCollectionObjectSet) { sceneNodeObjectSet = collectionObjectSet.parent; } PropertyReference propertyReference1; if (!this.RegisteredReferences.TryGetValue(handler, out propertyReference1)) { return; } this.RegisteredReferences.Remove(handler); sceneNodeObjectSet.UnregisterPropertyChangedHandler(propertyReference1, handler); }
private IProject GetCurrentProject(out IProjectManager projectManager) { projectManager = (IProjectManager)null; if (this.editingValue != null) { SceneNodeProperty sceneNodeProperty = this.editingProperty as SceneNodeProperty; if (sceneNodeProperty != null) { SceneNodeObjectSet sceneNodeObjectSet = sceneNodeProperty.SceneNodeObjectSet; if (sceneNodeObjectSet != null && sceneNodeObjectSet.DocumentContext != null) { projectManager = sceneNodeObjectSet.DesignerContext.ProjectManager; return(ProjectHelper.GetProject(sceneNodeObjectSet.DesignerContext.ProjectManager, sceneNodeObjectSet.DocumentContext)); } } } return((IProject)null); }
internal static ReferenceStep FilterProperty(SceneNode node, ReferenceStep referenceStep) { if (node is RichTextBoxRangeElement) { return(referenceStep); } RichTextBoxElement richTextBoxElement = node as RichTextBoxElement; if (richTextBoxElement != null) { foreach (IPropertyId propertyId in !node.ProjectContext.IsCapabilitySet(PlatformCapability.IsWpf) ? RichTextBoxParagraphsRangeElement.SilverlightTextParagraphProperties : RichTextBoxParagraphsRangeElement.WpfTextParagraphProperties) { if (referenceStep.Equals((object)richTextBoxElement.ProjectContext.ResolveProperty(propertyId))) { return(referenceStep); } } } StyleNode styleNode = node as StyleNode; IType typeId = styleNode == null || styleNode.Platform.Metadata.IsNullType((ITypeId)styleNode.StyleTargetTypeId) ? node.Type : styleNode.StyleTargetTypeId; Type runtimeType = typeId.NearestResolvedType.RuntimeType; if (referenceStep.TargetType.IsAssignableFrom(runtimeType) && (PlatformTypeHelper.GetDeclaringType((IMember)referenceStep) == runtimeType || referenceStep.MemberType == MemberType.DesignTimeProperty)) { return(referenceStep); } ReferenceStep referenceStep1; if (typeId == SceneNodeObjectSet.FilteredPropertiesType) { if (SceneNodeObjectSet.FilteredProperties.TryGetValue(referenceStep, out referenceStep1)) { return(referenceStep1); } } else { SceneNodeObjectSet.FilteredPropertiesType = (ITypeId)typeId; SceneNodeObjectSet.FilteredProperties.Clear(); } referenceStep1 = SceneNodeObjectSet.FilterPropertyInternal((ITypeResolver)node.ProjectContext, typeId, referenceStep); SceneNodeObjectSet.FilteredProperties.Add(referenceStep, referenceStep1); return(referenceStep1); }
private void Rebuild() { if (!this.editingProperty.IsMixedValue) { object obj = this.editingProperty.GetValue(); if (PlatformTypes.IsInstance(obj, PlatformTypes.GridLength, (ITypeResolver)((SceneNodeProperty)this.editingProperty).SceneNodeObjectSet.ProjectContext)) { SceneNodeObjectSet sceneNodeObjectSet = ((SceneNodeProperty)this.editingProperty).SceneNodeObjectSet; GridLength gridLength = (GridLength)sceneNodeObjectSet.DesignerContext.PlatformConverter.ConvertToWpf(((SceneNodeProperty)this.editingProperty).SceneNodeObjectSet.DocumentContext, obj); this.value = JoltHelper.RoundDouble(sceneNodeObjectSet.ProjectContext, gridLength.Value); this.gridUnitType = gridLength.GridUnitType; this.OnPropertyChanged("Value"); } } else { this.gridUnitType = GridUnitType.Star; } this.OnPropertyChanged("GridUnitType"); }
private void Rebuild() { PropertyValue propertyValue = this.DataContext as PropertyValue; PropertyReferenceProperty referenceProperty = (PropertyReferenceProperty)null; if (propertyValue != null) { referenceProperty = (PropertyReferenceProperty)propertyValue.get_ParentProperty(); } if (referenceProperty == this.editingProperty) { return; } this.Unhook(); this.editingProperty = referenceProperty; if (this.editingProperty == null) { return; } PropertyReference reference = this.editingProperty.Reference; SceneNodeObjectSet sceneNodeObjectSet = (SceneNodeObjectSet)this.editingProperty.ObjectSet; IPlatformMetadata platformMetadata = reference.PlatformMetadata; ReferenceStep step1 = (ReferenceStep)platformMetadata.ResolveProperty(ThicknessNode.TopProperty); ReferenceStep step2 = (ReferenceStep)platformMetadata.ResolveProperty(ThicknessNode.LeftProperty); ReferenceStep step3 = (ReferenceStep)platformMetadata.ResolveProperty(ThicknessNode.RightProperty); ReferenceStep step4 = (ReferenceStep)platformMetadata.ResolveProperty(ThicknessNode.BottomProperty); Type runtimeType = platformMetadata.ResolveType(PlatformTypes.Thickness).RuntimeType; this.top = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step1), step1.Attributes); this.left = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step2), step2.Attributes); this.right = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step3), step3.Attributes); this.bottom = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step4), step4.Attributes); ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.left, "Left"); ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.top, "Top"); ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.right, "Right"); ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.bottom, "Bottom"); this.TopPropertyContainer.set_PropertyEntry((PropertyEntry)this.top); this.LeftPropertyContainer.set_PropertyEntry((PropertyEntry)this.left); this.RightPropertyContainer.set_PropertyEntry((PropertyEntry)this.right); this.BottomPropertyContainer.set_PropertyEntry((PropertyEntry)this.bottom); }
private void Rebuild() { this.Unload(); SceneNodePropertyValue nodePropertyValue = this.DataContext as SceneNodePropertyValue; if (nodePropertyValue == null) { return; } this.sceneNodeObjectSet = ((SceneNodeProperty)nodePropertyValue.get_ParentProperty()).SceneNodeObjectSet; this.projectContext = this.sceneNodeObjectSet.ProjectContext; this.projectFontFamilies = this.projectContext.ProjectFonts; this.projectFontFamilies.CollectionChanged += new NotifyCollectionChangedEventHandler(this.projectFontFamilies_CollectionChanged); this.fontFamilyEditor.FontFamilies = FontFamilyValueEditor.GetFontFamilies(this.sceneNodeObjectSet); SelectedElementsObjectSet elementsObjectSet = this.sceneNodeObjectSet as SelectedElementsObjectSet; if (elementsObjectSet == null) { return; } elementsObjectSet.ViewModelChanged += new EventHandler(this.objectSet_ViewModelChanged); }
public override void SelectElement(SceneElement element, SceneNodeProperty editingProperty) { if (element == null || editingProperty == null || (editingProperty.SceneNodeObjectSet == null || editingProperty.IsMixedValue)) { return; } SceneNodeObjectSet sceneNodeObjectSet = editingProperty.SceneNodeObjectSet; BindingSceneNode bindingSceneNode = sceneNodeObjectSet.ViewModel.CreateSceneNode(PlatformTypes.Binding) as BindingSceneNode; LayoutPathNode layoutPathNode = sceneNodeObjectSet.ViewModel.CreateSceneNode(ProjectNeutralTypes.LayoutPath) as LayoutPathNode; using (SceneEditTransaction editTransaction = sceneNodeObjectSet.ViewModel.CreateEditTransaction(StringTable.AddLayoutPathUndo)) { using (sceneNodeObjectSet.ViewModel.ForceBaseValue()) { element.EnsureNamed(); editTransaction.Update(); bindingSceneNode.ElementName = element.Name; layoutPathNode.SetValue(LayoutPathNode.SourceElementProperty, (object)bindingSceneNode.DocumentNode); editingProperty.AddValue((object)layoutPathNode.DocumentNode); editTransaction.Commit(); } } }
public override DocumentNode GetLocalValueAsDocumentNode(SceneNodeProperty property, GetLocalValueFlags flags, out bool isMixed) { DocumentNode documentNode = (DocumentNode)null; bool flag = false; foreach (SceneNode sceneNode1 in this.Objects) { PropertyReference propertyReference1 = SceneNodeObjectSet.FilterProperty(sceneNode1, property.Reference); if (propertyReference1 != null) { DocumentNode other = (DocumentNode)null; if ((flags & GetLocalValueFlags.CheckKeyframes) != GetLocalValueFlags.None && sceneNode1.ViewModel.AnimationEditor.ActiveStoryboardTimeline != null && this.ShouldAllowAnimation) { SceneNode ancestor = (SceneNode)null; PropertyReference propertyReference2 = propertyReference1; SceneNode sceneNode2 = sceneNode1; if (this.FindAncestor(sceneNode1, out ancestor, ref propertyReference2, new Predicate <SceneNode>(SceneNodeObjectSetBase.IsAnimationParent))) { sceneNode2 = ancestor; } foreach (TimelineSceneNode timelineSceneNode in (IEnumerable <TimelineSceneNode>)sceneNode1.ViewModel.AnimationEditor.ActiveStoryboardTimeline.Children) { TimelineSceneNode.PropertyNodePair elementAndProperty = timelineSceneNode.TargetElementAndProperty; if (elementAndProperty.SceneNode == sceneNode2 && elementAndProperty.PropertyReference != null) { PropertyReference propertyReference3 = SceneNodeObjectSet.FilterProperty(elementAndProperty.SceneNode, elementAndProperty.PropertyReference); if (propertyReference2.Equals((object)propertyReference3)) { KeyFrameAnimationSceneNode animationSceneNode1 = timelineSceneNode as KeyFrameAnimationSceneNode; FromToAnimationSceneNode animationSceneNode2 = timelineSceneNode as FromToAnimationSceneNode; if (animationSceneNode1 != null) { KeyFrameSceneNode keyFrameAtTime = animationSceneNode1.GetKeyFrameAtTime(sceneNode1.ViewModel.AnimationEditor.AnimationTime); if (keyFrameAtTime != null) { using ((flags & GetLocalValueFlags.Resolve) == GetLocalValueFlags.None ? this.ViewModel.ForceBaseValue() : (IDisposable)null) { other = keyFrameAtTime.ValueNode; break; } } else { break; } } else if (animationSceneNode2 != null) { double animationTime = sceneNode1.ViewModel.AnimationEditor.AnimationTime; using ((flags & GetLocalValueFlags.Resolve) == GetLocalValueFlags.None ? this.ViewModel.ForceBaseValue() : (IDisposable)null) { DocumentNodePath documentNodePath = (DocumentNodePath)null; if (animationTime == animationSceneNode2.Begin + animationSceneNode2.Duration) { documentNodePath = animationSceneNode2.GetLocalValueAsDocumentNode(animationSceneNode2.ToProperty); } else if (animationTime == animationSceneNode2.Begin) { documentNodePath = animationSceneNode2.GetLocalValueAsDocumentNode(animationSceneNode2.FromProperty); } other = documentNodePath != null ? documentNodePath.Node : (DocumentNode)null; break; } } else { break; } } } } } if (other == null) { if ((flags & GetLocalValueFlags.Resolve) != GetLocalValueFlags.None) { DocumentNodePath valueAsDocumentNode = sceneNode1.GetLocalValueAsDocumentNode(propertyReference1); if (valueAsDocumentNode != null) { other = valueAsDocumentNode.Node; } } else { other = (DocumentNode)sceneNode1.GetLocalValue(propertyReference1, PropertyContext.AsDocumentNodes); } } if (!flag) { if (other == null && (flags & GetLocalValueFlags.SkipCheckIfMixed) != GetLocalValueFlags.None) { isMixed = false; return((DocumentNode)null); } flag = true; documentNode = other; } else if (documentNode == null && other != null || documentNode != null && !documentNode.Equals(other)) { isMixed = true; return((DocumentNode)null); } } } isMixed = false; return(documentNode); }
private static List <SourcedFontFamilyItem> GetFontFamilies(IEnumerable <SystemFontFamily> systemFonts, ICollection <IProjectFont> projectFonts, SceneNodeObjectSet sceneNodeObjectSet) { Dictionary <string, ProjectFontFamilyItem> dictionary = new Dictionary <string, ProjectFontFamilyItem>(); List <SourcedFontFamilyItem> list1 = new List <SourcedFontFamilyItem>(); foreach (ProjectFont projectFont in (IEnumerable <IProjectFont>)projectFonts) { ProjectFontFamilyItem projectFontFamilyItem = new ProjectFontFamilyItem(projectFont, sceneNodeObjectSet); projectFontFamilyItem.IsInEmbeddedFontSection = true; list1.Add((SourcedFontFamilyItem)projectFontFamilyItem); dictionary[projectFontFamilyItem.FamilyName] = projectFontFamilyItem; } List <SourcedFontFamilyItem> list2 = new List <SourcedFontFamilyItem>(); foreach (SystemFontFamily systemFontFamily in systemFonts) { SystemFontFamilyItem systemFontFamilyItem = new SystemFontFamilyItem(systemFontFamily, sceneNodeObjectSet); ProjectFontFamilyItem projectFontFamilyItem; if (dictionary.TryGetValue(systemFontFamily.FontFamilyName, out projectFontFamilyItem)) { projectFontFamilyItem = new ProjectFontFamilyItem(projectFontFamilyItem.ProjectFont, sceneNodeObjectSet); projectFontFamilyItem.SystemFontFamilyItem = systemFontFamilyItem; list2.Add((SourcedFontFamilyItem)projectFontFamilyItem); } else { list2.Add((SourcedFontFamilyItem)systemFontFamilyItem); } } list1.AddRange((IEnumerable <SourcedFontFamilyItem>)list2); list1.Sort((IComparer <SourcedFontFamilyItem>) new FontFamilyValueEditor.FontFamilyComparer()); return(list1); }
public static List <SourcedFontFamilyItem> GetFontFamilies(SceneNodeObjectSet sceneNodeObjectSet) { return(FontFamilyValueEditor.GetFontFamilies(FontEmbedder.GetSystemFonts(sceneNodeObjectSet.DocumentContext.TypeResolver), (ICollection <IProjectFont>)sceneNodeObjectSet.ProjectContext.ProjectFonts, sceneNodeObjectSet)); }
public TypedSceneNodeProperty(SceneNodeObjectSet objectSet, PropertyReference propertyReference, AttributeCollection attributeCollection, Type valueType, ITypeResolver typeResolver) : base(objectSet, propertyReference, attributeCollection, (PropertyValue)null, valueType) { this.valueType = valueType; this.valueTypeId = typeResolver.GetType(valueType); }
internal static ReferenceStep FilterProperty(ITypeResolver typeResolver, IType type, ReferenceStep referenceStep) { return(SceneNodeObjectSet.FilterPropertyInternal(typeResolver, type, referenceStep)); }
public ProjectFontFamilyItem(ProjectFont projectFont, SceneNodeObjectSet sceneNodeObjectSet) : base(projectFont.FontFamily, "Project Font", sceneNodeObjectSet) { this.projectFont = projectFont; }
public UnknownSourceFontFamilyItem(FontFamily runtimeFontFamily, FontFamily serializeFontFamily, SceneNodeObjectSet sceneNodeObjectSet) : base(runtimeFontFamily, "Project Font", sceneNodeObjectSet) { this.serializeFontFamily = serializeFontFamily; }
protected SourcedFontFamilyItem(FontFamily fontFamily, string category, SceneNodeObjectSet sceneNodeObjectSet) : base(FontFamilyItem.EnsureFamilyName(FontEmbedder.GetFontNameFromSource(fontFamily)), category, SourcedFontFamilyItem.DefaultPreviewFontFamilyName, SourcedFontFamilyItem.ConvertToWpfFontFamily(fontFamily, sceneNodeObjectSet.DocumentContext)) { this.sceneNodeObjectSet = sceneNodeObjectSet; }
private void Rebuild() { PropertyValue propertyValue = this.DataContext as PropertyValue; PropertyReferenceProperty referenceProperty = (PropertyReferenceProperty)null; if (propertyValue != null) { referenceProperty = (PropertyReferenceProperty)propertyValue.get_ParentProperty(); } if (referenceProperty == this.editingProperty) { return; } this.Unhook(); this.editingProperty = referenceProperty; if (this.editingProperty == null) { return; } PropertyReference reference = this.editingProperty.Reference; SceneNodeObjectSet sceneNodeObjectSet = (SceneNodeObjectSet)this.editingProperty.ObjectSet; ITypeResolver typeResolver = (ITypeResolver)sceneNodeObjectSet.ProjectContext; ((PropertyEntry)this.editingProperty).get_PropertyType(); IPropertyId propertyId1; IPropertyId propertyId2; if (PlatformTypes.Vector.IsAssignableFrom((ITypeId)this.editingProperty.PropertyTypeId)) { propertyId1 = Point2DEditor.VectorXProperty; propertyId2 = Point2DEditor.VectorYProperty; } else if (PlatformTypes.Point.IsAssignableFrom((ITypeId)this.editingProperty.PropertyTypeId)) { propertyId1 = Point2DEditor.PointXProperty; propertyId2 = Point2DEditor.PointYProperty; } else { Type nullableType = PlatformTypeHelper.GetNullableType(((PropertyEntry)this.editingProperty).get_PropertyType()); if (nullableType == (Type)null) { return; } IType type = typeResolver.GetType(nullableType); if (PlatformTypes.Vector.IsAssignableFrom((ITypeId)type)) { propertyId1 = Point2DEditor.VectorXProperty; propertyId2 = Point2DEditor.VectorYProperty; } else { if (!PlatformTypes.Point.IsAssignableFrom((ITypeId)type)) { return; } propertyId1 = Point2DEditor.PointXProperty; propertyId2 = Point2DEditor.PointYProperty; } } ReferenceStep step1 = (ReferenceStep)typeResolver.ResolveProperty(propertyId1); ReferenceStep step2 = (ReferenceStep)typeResolver.ResolveProperty(propertyId2); this.xProperty = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step1), step1.Attributes); this.yProperty = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step2), step2.Attributes); this.XPropertyContainer.set_PropertyEntry((PropertyEntry)this.xProperty); this.YPropertyContainer.set_PropertyEntry((PropertyEntry)this.yProperty); ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.xProperty, "X"); ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.yProperty, "Y"); }
public SystemFontFamilyItem(SystemFontFamily systemFontFamily, SceneNodeObjectSet sceneNodeObjectSet) : base(systemFontFamily.FontFamily, "System Font", sceneNodeObjectSet) { this.systemFontFamily = systemFontFamily; this.PropertyChanged += new PropertyChangedEventHandler(this.SystemFontFamilyItem_PropertyChanged); }
public SceneNodePropertyLookup(SceneNodeObjectSet objectSet, PropertyReference baseReference) { this.objectSet = objectSet; this.objectSet.SetChanged += new EventHandler(this.OnObjectSetSetChanged); this.baseReference = baseReference; }
public KeyframeSceneNodeProperty(SceneNodeObjectSet objectSet, PropertyReference propertyReference, AttributeCollection attributes, Type proxyType) : base(objectSet, propertyReference, attributes, (PropertyValue)null, proxyType) { }
protected override void ModifyValue(PropertyReferenceProperty property, object valueToSet, Modification modification, int index) { if (this.ViewModel == null) { return; } string description = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.PropertyChangeUndoDescription, new object[1] { (object)((PropertyEntry)property).get_PropertyName() }); if (!this.ViewModel.DefaultView.Document.IsEditable) { return; } using (SceneEditTransaction editTransaction = this.ViewModel.CreateEditTransaction(description, false, SceneEditTransactionType.NestedInAutoClosing)) { try { foreach (SceneNode sceneNode1 in this.Objects) { PropertyReference propertyReference1 = SceneNodeObjectSet.FilterProperty(sceneNode1, property.Reference); if (propertyReference1 != null) { SceneNode sceneNode2 = sceneNode1; if (this.ShouldAllowAnimation) { SceneNode ancestor = (SceneNode)null; PropertyReference propertyReference2 = propertyReference1; if (this.FindAncestor(sceneNode1, out ancestor, ref propertyReference2, new Predicate <SceneNode>(SceneNodeObjectSetBase.IsAnimationParent))) { sceneNode2 = ancestor; propertyReference1 = propertyReference2; } } using (SceneNode.DisableEnsureTransform(PlatformTypes.TransformGroup.IsAssignableFrom((ITypeId)propertyReference1.LastStep.DeclaringType))) { if (modification == Modification.InsertValue) { sceneNode2.InsertValue(propertyReference1, index, valueToSet); } else if (modification == Modification.ClearValue) { this.ClearAnimations(sceneNode2, propertyReference1); sceneNode2.ClearValue(propertyReference1); } else if (modification == Modification.RemoveValue) { SceneElement element = sceneNode2.GetLocalValueAsSceneNode(propertyReference1).GetChildren()[index] as SceneElement; if (element != null) { element.ViewModel.AnimationEditor.DeleteAllAnimationsInSubtree(element); } sceneNode2.RemoveValueAt(propertyReference1, index); } else if (modification == Modification.SetValue) { this.ClearAnimations(sceneNode2, propertyReference1); using (LayoutRoundingHelper.IsUseLayoutRoundingProperty(sceneNode2, (IProperty)propertyReference1.LastStep) ? sceneNode2.ViewModel.ForceDefaultSetValue() : (IDisposable)null) sceneNode2.SetValue(propertyReference1, valueToSet); } LayoutRoundingHelper.ExplicitlyChangeLayoutRounding(sceneNode2, propertyReference1); } } } editTransaction.Commit(); } catch (Exception ex) { if (editTransaction != null) { editTransaction.Cancel(); } int num = (int)this.DesignerContext.MessageDisplayService.ShowMessage(new MessageBoxArgs() { Message = StringTable.InvalidPropertyValueErrorNoException, Button = MessageBoxButton.OK, Image = MessageBoxImage.Hand }); } } this.TransactionContext.UpdateTransaction(); }
public UnknownSourceFontFamilyItem(FontFamily fontFamily, SceneNodeObjectSet sceneNodeObjectSet) : base(fontFamily, "System Font", sceneNodeObjectSet) { this.serializeFontFamily = fontFamily; }
public WrapperTypedSceneNodeProperty(SceneNodeObjectSet objectSet, PropertyReference propertyReference, string propertyName, AttributeCollection attributeCollection, Type valueType, ITypeResolver typeResolver) : base(objectSet, propertyReference, attributeCollection, valueType, typeResolver) { this.InitializeConverter(propertyName); }