private void createArrayPropertyEditor(int itemIndex, Type editorType, bool isSelected)
        {
            Debug.Check(_arrayProperty != null);

            string propertyName = string.Format("{0}", itemIndex);
            Label  label        = propertyGrid.AddProperty(propertyName, editorType, _arrayProperty.ReadOnly);

            label.BackColor   = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56)))));
            label.MouseClick += new MouseEventHandler(label_MouseClick);

            DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag;

            if (Plugin.IsCustomClassType(_arrayProperty.ItemType))
            {
                editor.SetStructProperty(new DesignerStructPropertyInfo(
                                             _arrayProperty.ItemType.Name, _arrayProperty.ItemType, _arrayProperty.ItemList[itemIndex], itemIndex),
                                         _object);
            }
            else
            {
                DesignerArrayPropertyInfo arrayProperty = new DesignerArrayPropertyInfo(_arrayProperty);
                arrayProperty.ItemIndex = itemIndex;

                editor.SetArrayProperty(arrayProperty, _object);
            }

            editor.ValueWasAssigned();
            editor.ValueWasChanged += editor_ValueWasChanged;

            if (isSelected)
            {
                selectLabel(label);
            }
        }
Exemplo n.º 2
0
 public DesignerArrayPropertyInfo(DesignerArrayPropertyInfo arrayProperty)
 {
     _name      = arrayProperty.Name;
     _itemType  = arrayProperty.ItemType;
     _itemList  = arrayProperty.ItemList;
     _itemIndex = arrayProperty.ItemIndex;
     _readOnly  = arrayProperty.ReadOnly;
 }
Exemplo n.º 3
0
        public void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj) {
            Debug.Check(arrayProperty != null);

            _arrayProperty = arrayProperty;
            setObject(obj);

            buildPropertyGrid();
        }
Exemplo n.º 4
0
        public void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            Debug.Check(arrayProperty != null);

            _arrayProperty = arrayProperty;
            setObject(obj);

            buildPropertyGrid();
        }
Exemplo n.º 5
0
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj) {
            base.SetArrayProperty(arrayProperty, obj);

            textBox.Text = (arrayProperty.Value != null) ? trimQuotes(arrayProperty.Value.ToString()) : string.Empty;

            if (Plugin.IsCharType(arrayProperty.Value.GetType())) {
                textBox.MaxLength = 1;
            }
        }
Exemplo n.º 6
0
        public void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            Debug.Check(arrayProperty != null);

            _arrayProperty = arrayProperty;
            _object = obj;
            _node = _object as Nodes.Node;

            buildPropertyGrid();
        }
Exemplo n.º 7
0
        public void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            Debug.Check(arrayProperty != null);

            _arrayProperty = arrayProperty;
            _object        = obj;
            _node          = _object as Nodes.Node;

            buildPropertyGrid();
        }
Exemplo n.º 8
0
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            textBox.Text = (arrayProperty.Value != null) ? trimQuotes(arrayProperty.Value.ToString()) : string.Empty;

            if (Plugin.IsCharType(arrayProperty.Value.GetType()))
            {
                textBox.MaxLength = 1;
            }
        }
Exemplo n.º 9
0
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            clear();

            Array list = Enum.GetValues(arrayProperty.ItemType);
            string enumName = DesignerEnum.GetDisplayName(arrayProperty.Value);

            foreach(object enumVal in list) {
                _allValues.Add(enumVal);

                if (DesignerEnum.GetDisplayName(enumVal) == enumName) {
                    _values.Add(enumVal);
                    comboBox.Items.Add(enumName);
                }
            }

            comboBox.Text = enumName;
        }
Exemplo n.º 10
0
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            clear();

            Array  list     = Enum.GetValues(arrayProperty.ItemType);
            string enumName = DesignerEnum.GetDisplayName(arrayProperty.Value);

            foreach (object enumVal in list)
            {
                _allValues.Add(enumVal);

                if (DesignerEnum.GetDisplayName(enumVal) == enumName)
                {
                    _values.Add(enumVal);
                    comboBox.Items.Add(enumName);
                }
            }

            comboBox.Text = enumName;
        }
Exemplo n.º 11
0
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            checkBox.Checked = (arrayProperty.Value != null) ? (bool)arrayProperty.Value : false;
        }
Exemplo n.º 12
0
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            update();
        }
Exemplo n.º 13
0
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            decimal value = 0;

            if (arrayProperty.ItemType == typeof(float))
            {
                const float maxValue = 1000000000000;
                SetRange(2,
                         (decimal)(-maxValue),
                         (decimal)maxValue,
                         (decimal)0.01);

                float val = (float)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(double))
            {
                const double maxValue = 1000000000000;
                SetRange(2,
                         (decimal)(-maxValue),
                         (decimal)maxValue,
                         (decimal)0.01);

                double val = (double)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(int))
            {
                SetRange(0,
                         (decimal)int.MinValue,
                         (decimal)int.MaxValue,
                         (decimal)1);

                int val = (int)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(uint))
            {
                SetRange(0,
                         (decimal)uint.MinValue,
                         (decimal)uint.MaxValue,
                         (decimal)1);

                int val = (int)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(short))
            {
                SetRange(0,
                         (decimal)short.MinValue,
                         (decimal)short.MaxValue,
                         (decimal)1);

                short val = (short)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(ushort))
            {
                SetRange(0,
                         (decimal)ushort.MinValue,
                         (decimal)ushort.MaxValue,
                         (decimal)1);

                ushort val = (ushort)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(sbyte))
            {
                SetRange(0,
                         (decimal)sbyte.MinValue,
                         (decimal)sbyte.MaxValue,
                         (decimal)1);

                sbyte val = (sbyte)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(byte))
            {
                SetRange(0,
                         (decimal)byte.MinValue,
                         (decimal)byte.MaxValue,
                         (decimal)1);

                byte val = (byte)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(long))
            {
                SetRange(0,
                         (decimal)long.MinValue,
                         (decimal)long.MaxValue,
                         (decimal)1);

                long val = (long)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(ulong))
            {
                SetRange(0,
                         (decimal)ulong.MinValue,
                         (decimal)ulong.MaxValue,
                         (decimal)1);

                ulong val = (ulong)arrayProperty.Value;
                value = (decimal)val;
            }
            else
            {
                Debug.Check(false);
            }

            numericUpDown.Value = Math.Max(numericUpDown.Minimum, Math.Min(numericUpDown.Maximum, value));
        }
Exemplo n.º 14
0
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            update();
        }
Exemplo n.º 15
0
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj) {
            base.SetArrayProperty(arrayProperty, obj);

            decimal value = 0;

            if (arrayProperty.ItemType == typeof(float)) {
                const float maxValue = 1000000000000;
                SetRange(2,
                         (decimal)(-maxValue),
                         (decimal)maxValue,
                         (decimal)0.01);

                float val = (float)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(double)) {
                const double maxValue = 1000000000000;
                SetRange(2,
                         (decimal)(-maxValue),
                         (decimal)maxValue,
                         (decimal)0.01);

                double val = (double)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(int)) {
                SetRange(0,
                         (decimal)int.MinValue,
                         (decimal)int.MaxValue,
                         (decimal)1);

                int val = (int)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(uint)) {
                SetRange(0,
                         (decimal)uint.MinValue,
                         (decimal)uint.MaxValue,
                         (decimal)1);

                int val = (int)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(short)) {
                SetRange(0,
                         (decimal)short.MinValue,
                         (decimal)short.MaxValue,
                         (decimal)1);

                short val = (short)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(ushort)) {
                SetRange(0,
                         (decimal)ushort.MinValue,
                         (decimal)ushort.MaxValue,
                         (decimal)1);

                ushort val = (ushort)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(sbyte)) {
                SetRange(0,
                         (decimal)sbyte.MinValue,
                         (decimal)sbyte.MaxValue,
                         (decimal)1);

                sbyte val = (sbyte)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(byte)) {
                SetRange(0,
                         (decimal)byte.MinValue,
                         (decimal)byte.MaxValue,
                         (decimal)1);

                byte val = (byte)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(long)) {
                SetRange(0,
                         (decimal)long.MinValue,
                         (decimal)long.MaxValue,
                         (decimal)1);

                long val = (long)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(ulong)) {
                SetRange(0,
                         (decimal)ulong.MinValue,
                         (decimal)ulong.MaxValue,
                         (decimal)1);

                ulong val = (ulong)arrayProperty.Value;
                value = (decimal)val;

            } else {
                Debug.Check(false);
            }

            numericUpDown.Value = Math.Max(numericUpDown.Minimum, Math.Min(numericUpDown.Maximum, value));
        }
Exemplo n.º 16
0
 public virtual void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
 {
     _arrayProperty = arrayProperty;
     _object        = obj;
 }
Exemplo n.º 17
0
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj) {
            base.SetArrayProperty(arrayProperty, obj);

            checkBox.Checked = (arrayProperty.Value != null) ? (bool)arrayProperty.Value : false;
        }
Exemplo n.º 18
0
        private void createArrayPropertyEditor(int itemIndex, Type editorType, bool isSelected) {
            Debug.Check(_arrayProperty != null);

            string propertyName = string.Format("{0}", itemIndex);
            Label label = propertyGrid.AddProperty(propertyName, editorType, _arrayProperty.ReadOnly);
            label.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56)))));
            label.MouseClick += new MouseEventHandler(label_MouseClick);

            DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag;

            if (Plugin.IsCustomClassType(_arrayProperty.ItemType)) {
                editor.SetStructProperty(new DesignerStructPropertyInfo(
                                             _arrayProperty.ItemType.Name, _arrayProperty.ItemType, _arrayProperty.ItemList[itemIndex], itemIndex),
                                         _object);

            } else {
                DesignerArrayPropertyInfo arrayProperty = new DesignerArrayPropertyInfo(_arrayProperty);
                arrayProperty.ItemIndex = itemIndex;

                editor.SetArrayProperty(arrayProperty, _object);
            }

            editor.ValueWasAssigned();
            editor.ValueWasChanged += editor_ValueWasChanged;

            if (isSelected)
            { selectLabel(label); }
        }
Exemplo n.º 19
0
 public DesignerArrayPropertyInfo(DesignerArrayPropertyInfo arrayProperty)
 {
     _name = arrayProperty.Name;
     _itemType = arrayProperty.ItemType;
     _itemList = arrayProperty.ItemList;
     _itemIndex = arrayProperty.ItemIndex;
     _readOnly = arrayProperty.ReadOnly;
 }
Exemplo n.º 20
0
 public virtual void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
 {
     _arrayProperty = arrayProperty;
     _object = obj;
 }