Beispiel #1
0
 public PropertyValue GetDistinctProperty(PropertyId id)
 {
     if (FlagProperties.IsFlagProperty(id))
     {
         return(distinctFlagProperties.GetPropertyValue(id));
     }
     else if (distinctPropertyMask.IsSet(id))
     {
         return(properties[(int)(id - PropertyBitMask.FirstNonFlag)]);
     }
     return(PropertyValue.Null);
 }
        // Token: 0x06001BC8 RID: 7112 RVA: 0x000D53E0 File Offset: 0x000D35E0
        public void AddProperties(int precedence, FlagProperties flagProperties, PropertyBitMask propertyMask, Property[] propList)
        {
            int entry = this.GetEntry(precedence);

            this.entries[entry].FlagProperties.Merge(flagProperties);
            if (propList != null)
            {
                foreach (Property property in propList)
                {
                    if (propertyMask.IsSet(property.Id))
                    {
                        if (property.Value.IsRefCountedHandle)
                        {
                            this.Store.AddRefValue(property.Value);
                        }
                        this.SetPropertyImpl(entry, property.Id, property.Value);
                    }
                }
            }
        }
Beispiel #3
0
        public int ApplyProperties(FlagProperties flagProperties, Property[] propList, FlagProperties flagInheritanceMask, PropertyBitMask propertyInheritanceMask)
        {
            int undoStackPosition = this.propertyUndoStackTop;

            FlagProperties allInheritedFlagProperties = this.flagProperties & flagInheritanceMask;

            FlagProperties newEffectiveFlagProperties = allInheritedFlagProperties | flagProperties;

            if (newEffectiveFlagProperties != this.flagProperties)
            {
                this.PushUndoEntry(PropertyUndoEntry.FlagPropertiesFakeId, this.flagProperties);
                this.flagProperties = newEffectiveFlagProperties;
            }


            FlagProperties overridenFlagsPropertiesMask = allInheritedFlagProperties ^ flagProperties;

            FlagProperties newDistinctFlagProperties = (flagProperties & overridenFlagsPropertiesMask) | (flagProperties & ~allInheritedFlagProperties);

            if (newDistinctFlagProperties != this.distinctFlagProperties)
            {
                this.PushUndoEntry(PropertyUndoEntry.DistinctFlagPropertiesFakeId, this.distinctFlagProperties);
                this.distinctFlagProperties = newDistinctFlagProperties;
            }

            PropertyBitMask maskedOutProperties = this.propertyMask & ~propertyInheritanceMask;

            foreach (PropertyId propId in maskedOutProperties)
            {
                this.PushUndoEntry(propId, this.properties[(int)(propId - PropertyBitMask.FirstNonFlag)]);
            }

            PropertyBitMask newDistinctPropertyMask = PropertyBitMask.AllOff;

            this.propertyMask &= propertyInheritanceMask;

            if (propList != null)
            {
                foreach (Property prop in propList)
                {
                    if (this.propertyMask.IsSet(prop.Id))
                    {
                        if (this.properties[(int)(prop.Id - PropertyBitMask.FirstNonFlag)] != prop.Value)
                        {
                            this.PushUndoEntry(prop.Id, this.properties[(int)(prop.Id - PropertyBitMask.FirstNonFlag)]);

                            if (prop.Value.IsNull)
                            {
                                this.propertyMask.Clear(prop.Id);
                            }
                            else
                            {
                                this.properties[(int)(prop.Id - PropertyBitMask.FirstNonFlag)] = prop.Value;
                                newDistinctPropertyMask.Set(prop.Id);
                            }
                        }
                    }
                    else if (!prop.Value.IsNull)
                    {
                        if (!maskedOutProperties.IsSet(prop.Id))
                        {
                            this.PushUndoEntry(prop.Id, PropertyValue.Null);
                        }

                        this.properties[(int)(prop.Id - PropertyBitMask.FirstNonFlag)] = prop.Value;

                        this.propertyMask.Set(prop.Id);

                        newDistinctPropertyMask.Set(prop.Id);
                    }
                }
            }

            if (newDistinctPropertyMask != this.distinctPropertyMask)
            {
                this.PushUndoEntry(this.distinctPropertyMask);
                this.distinctPropertyMask = newDistinctPropertyMask;
            }

            return(undoStackPosition);
        }
        public int ApplyProperties(FlagProperties flagProperties, Property[] propList, FlagProperties flagInheritanceMask, PropertyBitMask propertyInheritanceMask)
        {
            int            result = this.propertyUndoStackTop;
            FlagProperties x      = this.flagProperties & flagInheritanceMask;
            FlagProperties x2     = x | flagProperties;

            if (x2 != this.flagProperties)
            {
                this.PushUndoEntry(PropertyId.MaxValue, this.flagProperties);
                this.flagProperties = x2;
            }
            FlagProperties y  = x ^ flagProperties;
            FlagProperties x3 = (flagProperties & y) | (flagProperties & ~x);

            if (x3 != this.distinctFlagProperties)
            {
                this.PushUndoEntry((PropertyId)74, this.distinctFlagProperties);
                this.distinctFlagProperties = x3;
            }
            PropertyBitMask propertyBitMask = this.propertyMask & ~propertyInheritanceMask;

            foreach (PropertyId propertyId in propertyBitMask)
            {
                this.PushUndoEntry(propertyId, this.properties[(int)(propertyId - PropertyId.FontColor)]);
            }
            PropertyBitMask allOff = PropertyBitMask.AllOff;

            this.propertyMask &= propertyInheritanceMask;
            if (propList != null)
            {
                foreach (Property property in propList)
                {
                    if (this.propertyMask.IsSet(property.Id))
                    {
                        if (this.properties[(int)(property.Id - PropertyId.FontColor)] != property.Value)
                        {
                            this.PushUndoEntry(property.Id, this.properties[(int)(property.Id - PropertyId.FontColor)]);
                            if (property.Value.IsNull)
                            {
                                this.propertyMask.Clear(property.Id);
                            }
                            else
                            {
                                this.properties[(int)(property.Id - PropertyId.FontColor)] = property.Value;
                                allOff.Set(property.Id);
                            }
                        }
                    }
                    else if (!property.Value.IsNull)
                    {
                        if (!propertyBitMask.IsSet(property.Id))
                        {
                            this.PushUndoEntry(property.Id, PropertyValue.Null);
                        }
                        this.properties[(int)(property.Id - PropertyId.FontColor)] = property.Value;
                        this.propertyMask.Set(property.Id);
                        allOff.Set(property.Id);
                    }
                }
            }
            if (allOff != this.distinctPropertyMask)
            {
                this.PushUndoEntry(this.distinctPropertyMask);
                this.distinctPropertyMask = allOff;
            }
            return(result);
        }