예제 #1
0
        public GenericBindingVector4Editor(string Name = "", bool isColor = false) : base()
        {
            _value = new PropertyBinding <Vector4>();

            IsColor = isColor;

            MaximumSize = new System.Drawing.Size(int.MaxValue, 32);

            NameLabel      = new Label();
            NameLabel.Text = Name;

            Controls.Add(NameLabel, 0, 0);

            if (isColor)
            {
                ColorSelect        = new SBButton("");
                ColorSelect.Click += SelectColor;
                Controls.Add(ColorSelect);
                Controls.Add(ColorSelect, 1, 0);
            }
            else
            {
                XEdit = new GenericBindingTextBox <float>();
                YEdit = new GenericBindingTextBox <float>();
                ZEdit = new GenericBindingTextBox <float>();
                WEdit = new GenericBindingTextBox <float>();
                System.Drawing.Size MaxSize = new System.Drawing.Size(64, 32);
                XEdit.MaximumSize = MaxSize;
                YEdit.MaximumSize = MaxSize;
                ZEdit.MaximumSize = MaxSize;
                WEdit.MaximumSize = MaxSize;
                Controls.Add(XEdit, 1, 0);
                Controls.Add(YEdit, 2, 0);
                Controls.Add(ZEdit, 3, 0);
                Controls.Add(WEdit, 4, 0);
            }

            RowStyles.Add(new RowStyle()
            {
                SizeType = SizeType.AutoSize
            });
        }
예제 #2
0
        public SBRenderSettingsEditor()
        {
            ApplicationSettings.SkinControl(this);

            Text = "Application Settings";

            TopMost = true;

            Dictionary <SettingsGroupType, SBPopoutPanel> Groups = new Dictionary <SettingsGroupType, SBPopoutPanel>();

            toolTips = new ToolTip();
            // Set up the delays for the ToolTip.
            toolTips.AutoPopDelay = 5000;
            toolTips.InitialDelay = 1000;
            toolTips.ReshowDelay  = 500;
            // Force the ToolTip text to be displayed whether or not the form is active.
            toolTips.ShowAlways = true;

            foreach (var e in (SettingsGroupType[])Enum.GetValues(typeof(SettingsGroupType)))
            {
                if (e == SettingsGroupType.Application)
                {
                    continue;
                }
                var panel = new SBPopoutPanel(PopoutSide.Bottom, e.ToString(), e.ToString())
                {
                    Dock = DockStyle.Top
                };
                Groups.Add(e, panel);
                Controls.Add(panel);
            }

            foreach (var prop in typeof(ApplicationSettings).GetProperties().Reverse())
            {
                SettingsGroup attr = (SettingsGroup)prop.GetCustomAttribute(typeof(SettingsGroup));
                if (attr != null && attr.Type != SettingsGroupType.Application)
                {
                    Control control    = null;
                    string  ExtraLabel = null;
                    if (prop.PropertyType == typeof(Color))
                    {
                        var tb = new GenericColorEditor(attr.Name);
                        tb.Bind(typeof(ApplicationSettings), prop.Name);
                        control = tb;
                    }
                    else
                    if (prop.PropertyType == typeof(int))
                    {
                        var tb = new GenericBindingTextBox <int>();
                        tb.Bind(typeof(ApplicationSettings), prop.Name);
                        control             = tb;
                        control.MaximumSize = new Size(64, 32);
                        ExtraLabel          = attr.Name + ":";
                    }
                    else
                    if (prop.PropertyType == typeof(bool))
                    {
                        var tb = new GenericBindingCheckBox(attr.Name);
                        tb.Bind(typeof(ApplicationSettings), prop.Name);
                        control = tb;
                    }
                    else
                    if (prop.PropertyType.IsEnum)
                    {
                        // this feel so weird, but it works
                        Type genericClass     = typeof(GenericBindingComboBox <>);
                        Type constructedClass = genericClass.MakeGenericType(prop.PropertyType);
                        var  tb = (Control)Activator.CreateInstance(constructedClass, prop.Name);
                        tb.GetType().GetMethod("Bind").Invoke(tb, new object[] { typeof(ApplicationSettings), prop.Name });
                        control             = tb;
                        control.MaximumSize = new Size(128, 32);
                        ExtraLabel          = prop.Name + ":";
                    }
                    else
                    {
                        control = new Label()
                        {
                            Text = attr.Name, Dock = DockStyle.Top
                        }
                    };

                    toolTips.SetToolTip(control, attr.Description);
                    control.Dock = DockStyle.Top;
                    Groups[attr.Type].Contents.Add(control);
                    if (ExtraLabel != null)
                    {
                        Groups[attr.Type].Contents.Add(new Label()
                        {
                            Text = ExtraLabel, Dock = DockStyle.Top
                        });
                    }
                }
            }

            SaveSettings        = new SBButton("Save Settings");
            SaveSettings.Dock   = DockStyle.Bottom;
            SaveSettings.Click += Editor_SaveSettings;
            Controls.Add(SaveSettings);

            FormClosing += Editor_FormClosing;
        }
예제 #3
0
        public SBBoneEditor()
        {
            ApplicationSettings.SkinControl(this);

            X      = new GenericBindingTextBox <float>();
            X.Size = BoxSize;
            Y      = new GenericBindingTextBox <float>();
            Y.Size = BoxSize;
            Z      = new GenericBindingTextBox <float>();
            Z.Size = BoxSize;

            RX      = new GenericBindingTextBox <float>();
            RX.Size = BoxSize;
            RY      = new GenericBindingTextBox <float>();
            RY.Size = BoxSize;
            RZ      = new GenericBindingTextBox <float>();
            RZ.Size = BoxSize;

            SX      = new GenericBindingTextBox <float>();
            SX.Size = BoxSize;
            SY      = new GenericBindingTextBox <float>();
            SY.Size = BoxSize;
            SZ      = new GenericBindingTextBox <float>();
            SZ.Size = BoxSize;

            panel         = new TableLayoutPanel();
            panel.Padding = new Padding(2, 2, 2, 2);
            panel.Margin  = new Padding(2, 2, 2, 2);
            panel.Controls.Add(new Label()
            {
                Text = "Trans", AutoSize = true, Anchor = AnchorStyles.Bottom
            }, 1, 0);
            panel.Controls.Add(new Label()
            {
                Text = "Rot", AutoSize = true, Anchor = AnchorStyles.Bottom
            }, 2, 0);
            panel.Controls.Add(new Label()
            {
                Text = "Scale", AutoSize = true, Anchor = AnchorStyles.Bottom
            }, 3, 0);
            panel.Controls.Add(new Label()
            {
                Text = "X", MaximumSize = LabelSize, Anchor = AnchorStyles.Right
            }, 0, 1);
            panel.Controls.Add(new Label()
            {
                Text = "Y", MaximumSize = LabelSize, Anchor = AnchorStyles.Right
            }, 0, 2);
            panel.Controls.Add(new Label()
            {
                Text = "Z", MaximumSize = LabelSize, Anchor = AnchorStyles.Right
            }, 0, 3);
            panel.Controls.Add(X, 1, 1);
            panel.Controls.Add(Y, 1, 2);
            panel.Controls.Add(Z, 1, 3);
            panel.Controls.Add(RX, 2, 1);
            panel.Controls.Add(RY, 2, 2);
            panel.Controls.Add(RZ, 2, 3);
            panel.Controls.Add(SX, 3, 1);
            panel.Controls.Add(SY, 3, 2);
            panel.Controls.Add(SZ, 3, 3);

            panel.RowStyles.Clear();
            for (int i = 0; i < panel.RowCount; i++)
            {
                panel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            }
            transformPanel           = new SBPopoutPanel(PopoutSide.Bottom, "Transform");
            transformPanel.OpenText  = "Transform";
            transformPanel.CloseText = "Transform";
            transformPanel.Contents.Add(panel);
            transformPanel.Dock = DockStyle.Top;

            NameLabel = new Label()
            {
                Dock = DockStyle.Top
            };

            Controls.Add(transformPanel);
            Controls.Add(NameLabel);
        }