Пример #1
0
 public void AddDynamicEnum(DynamicEnumerationData typeData)
 {
     m_hidden[typeData.TypeId] = false;
     m_dynamicEnums.Add(typeData.TypeId, typeData);
     m_types.Add(typeData.TypeId, new TypeData((a, b, c, document) => typeData.Make(a, b, c, GetDynamicEnumSource(typeData.TypeId)), typeData.Name));
     Modified.Execute(typeData.TypeId);
 }
Пример #2
0
 public void AddLocalDynamicEnum(LocalDynamicEnumerationData typeData)
 {
     m_hidden[typeData.TypeId] = false;
     m_localDynamicEnums.Add(typeData.TypeId, typeData);
     m_types.Add(typeData.TypeId, new TypeData((name, id, defaultValue, document) => typeData.Make(name, id, defaultValue, GetLocalDynamicEnumSource(typeData.TypeId, document)), typeData.Name));
     Modified.Execute(typeData.TypeId);
 }
Пример #3
0
 public void AddInteger(IntegerData typeData)
 {
     m_hidden[typeData.TypeId] = false;
     m_integers.Add(typeData.TypeId, typeData);
     m_types.Add(typeData.TypeId, new TypeData((name, id, defaultValue, document) => new IntegerParameter(name, id, typeData.TypeId, m_integers[typeData.TypeId].Definition(), defaultValue), typeData.Name));
     Modified.Execute(typeData.TypeId);
 }
Пример #4
0
 public void Add(T item)
 {
     Inserting.Execute(item);
     m_base.Add(item);
     Inserted.Execute(item);
     Modified.Execute();
 }
Пример #5
0
 public void AddDecimal(DecimalData typeData)
 {
     m_hidden[typeData.TypeId] = false;
     m_decimals.Add(typeData.TypeId, typeData);
     m_types.Add(typeData.TypeId, new TypeData((name, id, defaultValue, document) => new DecimalParameter(name, id, typeData.TypeId, m_decimals[typeData.TypeId].Definition(), defaultValue), typeData.Name));
     Modified.Execute(typeData.TypeId);
 }
Пример #6
0
 public void AddLocalizedString(LocalizedStringData typeData)
 {
     m_hidden[typeData.TypeId] = false;
     m_localizedStrings.Add(typeData.TypeId, typeData);
     m_types.Add(typeData.TypeId, new TypeData((name, id, defaultValue, document) => new LocalizedStringParameter(name, id, typeData.TypeId), typeData.Name));
     Modified.Execute(typeData.TypeId);
 }
Пример #7
0
 public void Insert(int index, T item)
 {
     Inserting.Execute(item);
     m_base.Insert(index, item);
     Inserted.Execute(item);
     Modified.Execute();
 }
Пример #8
0
 public void Change()
 {
     if (!m_lastChanged)
     {
         m_lastChanged = m_changed();
         SaveStateChanged.Execute();
     }
     Modified.Execute();
 }
Пример #9
0
 public void Change()
 {
     if (!m_changed)
     {
         m_changed = true;
         SaveStateChanged.Execute();
     }
     Modified.Execute();
 }
Пример #10
0
        public void Change(SimpleUndoPair actions, string description)
        {
            var action = new GenericUndoAction(new SimpleUndoPair
            {
                Redo = () => { actions.Redo(); Modified.Execute(); },
                Undo = () => { actions.Undo(); Modified.Execute(); }
            }, description);

            action.Redo();
            m_undoQueue.Queue(action);
        }
Пример #11
0
 public void Remove(ParameterType id)
 {
     m_types.Remove(id);
     m_types.Remove(ParameterType.ValueSetType.Of(id));
     m_integers.Remove(id);
     m_decimals.Remove(id);
     m_enums.Remove(id);
     m_dynamicEnums.Remove(id);
     m_localDynamicEnums.Remove(id);
     m_localizedStrings.Remove(id);
     Modified.Execute(id);
 }
Пример #12
0
 public void ModifyEnum(EnumerationData typeData)
 {
     if (m_enums.ContainsKey(typeData.TypeId)) //If we're removing an entire domain file, an enum declaration can be removed before its values. In this circumstance, when the values are removed, this method will be called but the enum wont exist.
     {
         m_types[typeData.TypeId].Name = typeData.Name;
         m_types[ParameterType.ValueSetType.Of(typeData.TypeId)].Name = "Set of " + typeData.Name;
         m_enums[typeData.TypeId] = Tuple.Create(typeData.Name, m_enums[typeData.TypeId].Item2);
         MutableEnumeration e = m_enums[typeData.TypeId].Item2;
         e.SetOptions(typeData.Elements);
         Modified.Execute(typeData.TypeId);
     }
 }
Пример #13
0
        public bool Remove(TKey key)
        {
            if (!ContainsKey(key))
            {
                return(false);
            }
            Removing.Execute(key, this[key]);
            bool result = m_data.Remove(key);

            Modified.Execute();
            return(result);
        }
Пример #14
0
        public void Modify(List <NodeTypeData> nodeTypes, List <DynamicEnumerationData> dynamicEnumerations, List <EnumerationData> enumerations, List <DecimalData> decimals, List <IntegerData> integers, List <NodeData> nodes)
        {
            Data.NodeTypes           = nodeTypes;
            Data.DynamicEnumerations = dynamicEnumerations;
            Data.Enumerations        = enumerations;
            Data.Decimals            = decimals;
            Data.Integers            = integers;
            Data.Nodes = nodes;

            Changed = true;
            Modified.Execute();
        }
Пример #15
0
        public void AddEnum(EnumerationData typeData, bool hidden)
        {
            var enumType = typeData.TypeId;
            var setType  = ParameterType.ValueSetType.Of(enumType);

            m_hidden[enumType] = hidden;
            var elements = typeData.Elements.Select(e => Tuple.Create(e.Guid, e.Name));
            MutableEnumeration enumeration = new MutableEnumeration(elements, enumType, "");

            m_enums.Add(enumType, Tuple.Create(typeData.Name, enumeration));
            m_types.Add(enumType, new TypeData((a, b, c, d) => m_enums[enumType].Item2.ParameterEnum(a, b, c), typeData.Name));
            m_types.Add(setType, new TypeData((a, b, c, d) => m_enums[enumType].Item2.ParameterSet(a, b, c), "Set of " + typeData.Name));
            Modified.Execute(enumType);
        }
Пример #16
0
 public bool Remove(T item)
 {
     if (m_base.Contains(item))
     {
         Removing.Execute(item);
         bool result = m_base.Remove(item);
         Modified.Execute();
         return(result);
     }
     else
     {
         return(false);
     }
 }
Пример #17
0
 public T this[int index]
 {
     get
     {
         return(m_base[index]);
     }
     set
     {
         Removing.Execute(m_base[index]);
         Inserting.Execute(value);
         m_base[index] = value;
         Inserted.Execute(value);
         Modified.Execute();
     }
 }
Пример #18
0
 public TValue this[TKey key]
 {
     get
     {
         return(m_data[key]);
     }
     set
     {
         if (ContainsKey(key))
         {
             Removing.Execute(key, this[key]);
             m_data.Remove(key);
         }
         Inserting.Execute(key, value);
         m_data[key] = value;
         Modified.Execute();
     }
 }
Пример #19
0
        public ConfigureResult Configure(NodeEditOperation configureData)
        {
            ConfigureResult result = configureData(Data);

            return(result.Transformed <ConfigureResult>(sup => new SimpleUndoPair
            {
                Redo = () =>
                {
                    sup.Redo();
                    UpdateRendererCorruption();
                    Modified.Execute();
                },
                Undo = () =>
                {
                    sup.Undo();
                    UpdateRendererCorruption();
                    Modified.Execute();
                }
            }, crno => crno));
        }
Пример #20
0
 public void RenameType(ParameterType guid, string name)
 {
     m_types[guid].Name = name;
     if (IsInteger(guid))
     {
         IntegerData data = m_integers[guid];
         data             = new IntegerData(name, data.TypeId, data.Max, data.Min);
         m_integers[guid] = data;
     }
     else if (IsDecimal(guid))
     {
         DecimalData data = m_decimals[guid];
         data             = new DecimalData(name, data.TypeId, data.Max, data.Min);
         m_decimals[guid] = data;
     }
     else if (IsLocalizedString(guid))
     {
         LocalizedStringData data = m_localizedStrings[guid];
         data = new LocalizedStringData(name, data.TypeId /*, data.File*/);
         m_localizedStrings[guid] = data;
     }
     else if (IsEnum(guid))
     {
         var data = m_enums[guid];
         m_enums[guid] = Tuple.Create(name, data.Item2);
     }
     else if (IsDynamicEnum(guid))
     {
         DynamicEnumerationData data = m_dynamicEnums[guid];
         data = new DynamicEnumerationData(name, data.TypeId);
         m_dynamicEnums[guid] = data;
     }
     else if (IsLocalDynamicEnum(guid))
     {
         LocalDynamicEnumerationData data = m_localDynamicEnums[guid];
         data = new LocalDynamicEnumerationData(name, data.TypeId);
         m_localDynamicEnums[guid] = data;
     }
     Modified.Execute(guid);
 }
Пример #21
0
 public void Clear()
 {
     Clearing.Execute();
     m_data.Clear();
     Modified.Execute();
 }
Пример #22
0
 public void Clear()
 {
     Clearing.Execute();
     m_base.Clear();
     Modified.Execute();
 }
Пример #23
0
 public void AddOther(ParameterType id, string name, ParameterGenerator factory)
 {
     m_types.Add(id, new TypeData(factory, name));
     Modified.Execute(id);
 }
Пример #24
0
 public void Add(TKey key, TValue value)
 {
     Inserting.Execute(key, value);
     m_data.Add(key, value);
     Modified.Execute();
 }
Пример #25
0
 public void RemoveAt(int index)
 {
     Removing.Execute(this[index]);
     m_base.RemoveAt(index);
     Modified.Execute();
 }
Пример #26
0
 public void ModifyInteger(IntegerData typeData)
 {
     m_types[typeData.TypeId]    = new TypeData((name, id, defaultValue, document) => new IntegerParameter(name, id, typeData.TypeId, typeData.Definition(), defaultValue), typeData.Name);
     m_integers[typeData.TypeId] = typeData;
     Modified.Execute(typeData.TypeId);
 }
Пример #27
0
 public void ModifyDecimal(DecimalData typeData)
 {
     m_types[typeData.TypeId]    = new TypeData((name, id, defaultValue, document) => new DecimalParameter(name, id, typeData.TypeId, m_decimals[typeData.TypeId].Definition(), defaultValue), typeData.Name);
     m_decimals[typeData.TypeId] = typeData;
     Modified.Execute(typeData.TypeId);
 }
Пример #28
0
 public void ModifyLocalizedString(LocalizedStringData typeData)
 {
     m_types[typeData.TypeId]            = new TypeData((name, id, defaultValue, document) => new LocalizedStringParameter(name, id, typeData.TypeId), typeData.Name);
     m_localizedStrings[typeData.TypeId] = typeData;
     Modified.Execute(typeData.TypeId);
 }