Example #1
0
        public override void BuildControl(Engine.Effects.VisualPropertyItem pi)
        {
            Name         = pi.ActualPropertyName;
            PropertyName = pi.ActualPropertyName;
            LabelText    = pi.DisplayName;
            DataType     = pi.DataType;
            DefaultValue = pi.DefaultValue;

            if (pi.ValidatorType != Engine.Attributes.Meta.ValidatorTypes.Undefined)
            {
                switch (pi.ValidatorType)
                {
                case Engine.Attributes.Meta.ValidatorTypes.Int:
                    Validators.Add(new Engine.Validators.IntValidator());

                    if (pi.RangeMinimumValue != null && pi.RangeMaximumValue != null)
                    {
                        Validators.Add(new Engine.Validators.RangeIntValidator(pi.RangeMinimumValue.Value, pi.RangeMaximumValue.Value));
                    }
                    break;

                default:
                    throw new Exception(String.Format("In TPropertyIntBox, the validator type '{0}' is not supported.", pi.ValidatorType));
                }
            }
        }
 public override void BuildControl(Engine.Effects.VisualPropertyItem pi)
 {
     Name         = pi.ActualPropertyName;
     PropertyName = pi.ActualPropertyName;
     LabelText    = pi.DisplayName;
     DataType     = pi.DataType;
 }
        private void FillPropertyRadioButtons(Engine.Effects.VisualPropertyItem pi)
        {
            PaintualUI.Controls.PropertyPage.TPropertyRadioButtons prb = (PaintualUI.Controls.PropertyPage.TPropertyRadioButtons) this.FlowPanelContainer.Children[pi.Index];

            // get collected values from tool or effects
            Engine.Attributes.IAttribute attr = t_properties.Get(pi.ActualPropertyName);
            prb.DefaultValue = attr.Value;
            prb.UpdateVisual();
        }
Example #4
0
        public override void BuildControl(Engine.Effects.VisualPropertyItem pi)
        {
            Name         = pi.ActualPropertyName;
            PropertyName = pi.ActualPropertyName;
            LabelText    = pi.DisplayName;
            DataType     = pi.DataType;

            t_colorVariance = new Engine.Color.ColorVariance(Engine.Application.UISelectedValues.SelectedColor);
        }
        private void FillPropertyFolderSelector(Engine.Effects.VisualPropertyItem pi)
        {
            PaintualUI.Controls.PropertyPage.TPropertyFolderSelector pfs = (PaintualUI.Controls.PropertyPage.TPropertyFolderSelector) this.FlowPanelContainer.Children[pi.Index];

            // get collected values from tool or effect
            Engine.Attributes.IAttribute attr = t_properties.Get(pi.ActualPropertyName);

            pfs.DefaultValue = (string)attr.Value;
            pfs.UpdateVisual();
        }
        private void FillPropertyDoubleBox(Engine.Effects.VisualPropertyItem pi)
        {
            PaintualUI.Controls.PropertyPage.TPropertyDoubleBox pdb = (PaintualUI.Controls.PropertyPage.TPropertyDoubleBox) this.FlowPanelContainer.Children[pi.Index];

            // get collected values from tool or effect
            Engine.Attributes.IAttribute attr = t_properties.Get(pi.ActualPropertyName);

            pdb.DefaultValue = ((double)attr.Value).ToString();
            pdb.UpdateVisual();
        }
        private void BuildControl(KeyValuePair <string, Engine.Effects.VisualPropertyItem> key)
        {
            Engine.Effects.VisualPropertyItem pi = key.Value;

            PaintualUI.Controls.PropertyPage.TPropertyControl ctrl = null;

            switch (pi.DisplayControlType)
            {
            case Engine.Attributes.Meta.DisplayControlTypes.Textbox:
                switch (pi.DataType)
                {
                case Engine.PropertyDataTypes.Int:
                    ctrl = BuildPropertyIntBox(pi);
                    break;

                case Engine.PropertyDataTypes.Double:
                    ctrl = BuildPropertyDoubleBox(pi);
                    break;

                case Engine.PropertyDataTypes.Text:
                    ctrl = BuildPropertyTextBox(pi);
                    break;

                default:
                    throw new Exception();
                }

                break;

            case Engine.Attributes.Meta.DisplayControlTypes.ColorVariance:
                ctrl = BuildPropertyObject(pi);
                break;

            case Engine.Attributes.Meta.DisplayControlTypes.RadioButtons:
                ctrl = BuildPropertyRadioButtons(pi);
                break;

            case Engine.Attributes.Meta.DisplayControlTypes.FolderSelector:
                ctrl = BuildPropertyFolderSelector(pi);
                break;

            case Engine.Attributes.Meta.DisplayControlTypes.Checkbox:
                ctrl = BuildPropertyCheckBox(pi);
                break;

            default:
                throw new ArgumentException(String.Format("Either the control type is set to 'None' or the type \"{0}\" is not supported in the VisualBuilder", pi.DisplayControlType.ToString()));
            }

            FlowPanelContainer.Children.Add(ctrl);

            // since getting control by name seems not to work, can retrieve later by index from pi instance.
            pi.Index = FlowPanelContainer.Children.Count - 1;
        }
Example #8
0
        public override void BuildControl(Engine.Effects.VisualPropertyItem pi)
        {
            Name         = pi.ActualPropertyName;
            PropertyName = pi.ActualPropertyName;
            LabelText    = pi.DisplayName;
            DataType     = pi.DataType;

            if (pi.ValidatorType != Engine.Attributes.Meta.ValidatorTypes.Undefined)
            {
                switch (pi.ValidatorType)
                {
                case Engine.Attributes.Meta.ValidatorTypes.StringNotEmpty:
                    Validators.Add(new Engine.Validators.StringValidator());
                    break;

                default:
                    throw new Exception(String.Format("In TPropertyFolderSelector, the validator type '{0}' is not supported", pi.ValidatorType));
                }
            }
        }
        public override void BuildControl(Engine.Effects.VisualPropertyItem pi)
        {
            Name         = pi.ActualPropertyName;
            PropertyName = pi.ActualPropertyName;
            LabelText    = pi.DisplayName;
            DataType     = pi.DataType;
            ValueList    = pi.ValueList;
            DefaultValue = pi.DefaultValue;

            if (pi.ValidatorType != Engine.Attributes.Meta.ValidatorTypes.Undefined)
            {
                switch (pi.ValidatorType)
                {
                case Engine.Attributes.Meta.ValidatorTypes.ValueList:
                    Validators.Add(new Engine.Validators.ValueListValidator(pi.ValueList));
                    break;

                default:
                    throw new Exception(String.Format("In TPropertyRadioButton, the validator type '{0}' is not supported.", pi.ValidatorType));
                }
            }
        }
        private void FillControl(KeyValuePair <string, Engine.Effects.VisualPropertyItem> key)
        {
            Engine.Effects.VisualPropertyItem pi = key.Value;

            switch (pi.DisplayControlType)
            {
            case Engine.Attributes.Meta.DisplayControlTypes.Textbox:
                switch (pi.DataType)
                {
                case Engine.PropertyDataTypes.Int:
                    FillPropertyIntBox(pi);
                    break;

                case Engine.PropertyDataTypes.Double:
                    FillPropertyDoubleBox(pi);
                    break;

                case Engine.PropertyDataTypes.Text:
                    FillPropertyTextBox(pi);
                    break;

                default:
                    throw new Exception();
                }

                break;

            case Engine.Attributes.Meta.DisplayControlTypes.RadioButtons:
                FillPropertyRadioButtons(pi);
                break;

            case Engine.Attributes.Meta.DisplayControlTypes.FolderSelector:
                FillPropertyFolderSelector(pi);
                break;

            default:
                throw new ArgumentException(String.Format("In VisualPropertyPage.FillControl() : either the control type is set to 'None' or the type \"{0}\" is not supported in the VisualBuilder", pi.DisplayControlType.ToString()));
            }
        }
Example #11
0
        public override void BuildControl(Engine.Effects.VisualPropertyItem pi)
        {
            Name         = pi.ActualPropertyName;
            PropertyName = pi.ActualPropertyName;
            LabelText    = pi.DisplayName;
            DataType     = pi.DataType;

            if (pi.ValidatorType != Engine.Attributes.Meta.ValidatorTypes.Undefined)
            {
                switch (pi.ValidatorType)
                {
                case Engine.Attributes.Meta.ValidatorTypes.StringNotEmpty:
                    Engine.Validators.StringValidator strValid = new Engine.Validators.StringValidator(pi.RegularExpression);
                    strValid.CannotBeEmpty = true;
                    Validators.Add(strValid);
                    break;

                default:
                    throw new Exception(String.Format("In TPropertyTextBox, the validator type '{0}' is not supported", pi.ValidatorType));
                }
            }
        }
        private PaintualUI.Controls.PropertyPage.TPropertyControl BuildPropertyDoubleBox(Engine.Effects.VisualPropertyItem pi)
        {
            PaintualUI.Controls.PropertyPage.TPropertyDoubleBox pdb = new TPropertyDoubleBox();
            pdb.BuildControl(pi);

            t_properties.Add(pi.ActualPropertyName, new Engine.Attributes.DoubleAttribute());

            return(pdb);
        }
        private PaintualUI.Controls.PropertyPage.TPropertyControl BuildPropertyObject(Engine.Effects.VisualPropertyItem pi)
        {
            PaintualUI.Controls.PropertyPage.TPropertyControl ctrl;

            switch (pi.TypeDeclaration.Name)
            {
            case "ColorVariance":
                ctrl = new PaintualUI.Controls.PropertyPage.TPropertyColorVariance();
                ctrl.BuildControl(pi);
                break;

            default:
                throw new Exception(String.Format("In VisualPropertyPage, the type declaration '{0}' is not supported.", pi.TypeDeclaration.Name));
            }

            return(ctrl);
        }
        private PaintualUI.Controls.PropertyPage.TPropertyControl BuildPropertyCheckBox(Engine.Effects.VisualPropertyItem pi)
        {
            PaintualUI.Controls.PropertyPage.TPropertyCheckBox ctrl = new TPropertyCheckBox();
            ctrl.BuildControl(pi);

            return(ctrl);
        }
        private PaintualUI.Controls.PropertyPage.TPropertyControl BuildPropertyTextBox(Engine.Effects.VisualPropertyItem pi)
        {
            PaintualUI.Controls.PropertyPage.TPropertyTextBox ptb = new TPropertyTextBox();
            ptb.BuildControl(pi);

            t_properties.Add(pi.ActualPropertyName, new Engine.Attributes.StringAttribute());

            return(ptb);
        }
        private PaintualUI.Controls.PropertyPage.TPropertyControl BuildPropertyRadioButtons(Engine.Effects.VisualPropertyItem pi)
        {
            PaintualUI.Controls.PropertyPage.TPropertyRadioButtons prb = new PropertyPage.TPropertyRadioButtons();
            prb.BuildControl(pi);

            // in this case we only store the selected value for future usage
            t_properties.Add(pi.ActualPropertyName, new Engine.Attributes.IntAttribute());

            return(prb);
        }
Example #17
0
 public virtual void BuildControl(Engine.Effects.VisualPropertyItem pi)
 {
 }
        private PaintualUI.Controls.PropertyPage.TPropertyControl BuildPropertyFolderSelector(Engine.Effects.VisualPropertyItem pi)
        {
            PaintualUI.Controls.PropertyPage.TPropertyFolderSelector pfs = new PropertyPage.TPropertyFolderSelector();
            pfs.BuildControl(pi);

            t_properties.Add(pi.ActualPropertyName, new Engine.Attributes.StringAttribute());

            return(pfs);
        }