public SBCustomDialog(object Value) { this.Value = Value; Text = "Settings"; Done = new SBButton("Okay"); Done.Dock = DockStyle.Bottom; Done.Click += delegate { DialogResult = DialogResult.OK; Close(); }; Controls.Add(Done); propGrid = new PropertyGrid(); ApplicationSettings.SkinControl(propGrid); propGrid.SelectedObject = Value; propGrid.Dock = DockStyle.Fill; Controls.Add(propGrid); Width = 400; Height = propGrid.Size.Height + 100; CenterToScreen(); }
public SBAnimationBar() { ApplicationSettings.SkinControl(this); animationTrack = new TrackBar(); animationTrack.Dock = DockStyle.Top; animationTrack.ValueChanged += FrameChanged; playButton = new SBButton(PlayText); playButton.Dock = DockStyle.Top; playButton.Click += PlayPause; Controls.Add(playButton); Controls.Add(animationTrack); Frame = new PropertyBinding <float>(); }
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 }); }
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; }
public SBPopoutPanel(PopoutSide PopoutSide, string OpenText = "Open", string CloseText = "Close") { ApplicationSettings.SkinControl(this); this.OpenText = OpenText; this.CloseText = CloseText; this.PopoutSide = PopoutSide; _contentPanel = new Panel(); if (PopoutSide == PopoutSide.Top) { _contentPanel.Dock = DockStyle.Top; _popOutButton = new SBButton(OpenText); _popOutButton.Dock = DockStyle.Bottom; _popOutButton.MaximumSize = new System.Drawing.Size(int.MaxValue, 24); } else if (PopoutSide == PopoutSide.Bottom) { _contentPanel.Dock = DockStyle.Bottom; _popOutButton = new SBButton(OpenText); _popOutButton.Dock = DockStyle.Top; _popOutButton.MaximumSize = new System.Drawing.Size(int.MaxValue, 24); } else if (PopoutSide == PopoutSide.Right) { _contentPanel.Dock = DockStyle.Right; _popOutButton = new SBButton(OpenText); _popOutButton.Dock = DockStyle.Left; _popOutButton.MaximumSize = new System.Drawing.Size(24, int.MaxValue); } else { _contentPanel.Dock = DockStyle.Left; _popOutButton = new SBButton(OpenText); _popOutButton.Dock = DockStyle.Right; _popOutButton.MaximumSize = new System.Drawing.Size(24, int.MaxValue); } _popOutButton.Click += Expand; _popOutButton.BackColor = ApplicationSettings.PoppedInColor; //_contentPanel.BackColor = ApplicationSettings.MiddleColor; _contentPanel.MinimumSize = new System.Drawing.Size(290, 32); _contentPanel.MaximumSize = new System.Drawing.Size(int.MaxValue, int.MaxValue); //_contentPanel.AutoSize = true; _contentPanel.AutoScroll = true; Controls.Add(_popOutButton); Controls.Add(_contentPanel); if (PopoutSide == PopoutSide.Left || PopoutSide == PopoutSide.Right) { Width = _popOutButton.Width; } else { Height = _popOutButton.Height; } }
public SBMeshList() : base() { Text = "Object List"; Dock = DockStyle.Fill; ApplicationSettings.SkinControl(this); meshObjectList = new SBListView(); meshObjectList.CheckBoxes = true; meshObjectList.View = View.Details; meshObjectList.Scrollable = true; meshObjectList.HeaderStyle = ColumnHeaderStyle.None; ColumnHeader header = new ColumnHeader(); header.Text = ""; header.Name = "Meshes"; header.Width = 1000; meshObjectList.Columns.Add(header); meshObjectList.LabelEdit = true; meshObjectList.HideSelection = false; meshObjectList.AfterLabelEdit += listview_AfterLabelEdit; meshObjectList.ItemChecked += CheckChanged; meshObjectList.MouseUp += SelectedChanged; meshObjectList.Dock = DockStyle.Top; meshObjectList.Size = new System.Drawing.Size(400, 200); MeshPanel = new SBMeshPanel(); MeshPanel.Dock = DockStyle.Fill; DeleteButton = new SBButton("Delete Selected Mesh"); DeleteButton.Click += (sender, args) => { if (MessageBox.Show("Delete Selected Mesh", "This cannot be undone", MessageBoxButtons.OKCancel) == DialogResult.OK) { MeshPanel.DeleteSelectedMesh(); LoadFromScene(MeshPanel.SelectedScene); } }; DeleteButton.Dock = DockStyle.Top; HideVISButton = new SBButton("Hide VIS Objects"); HideVISButton.Dock = DockStyle.Top; HideVISButton.Click += (sender, args) => { HideVISObjects(); }; MoveUpButton = new SBButton("Move Selected Up"); MoveUpButton.Dock = DockStyle.Top; MoveUpButton.Click += (sender, args) => { if (meshObjectList.Items.Count > 0 && !meshObjectList.Items[0].Selected) { foreach (ListViewItem lvi in meshObjectList.SelectedItems) { if (lvi.Index > 0) { int index = lvi.Index - 1; meshObjectList.Items.RemoveAt(lvi.Index); meshObjectList.Items.Insert(index, lvi); } } RefreshMeshItemsFromList(); } }; MoveDownButton = new SBButton("Move Selected Down"); MoveDownButton.Dock = DockStyle.Top; MoveDownButton.Click += (sender, args) => { if (meshObjectList.Items.Count > 0 && !meshObjectList.Items[meshObjectList.Items.Count - 1].Selected) { foreach (ListViewItem lvi in meshObjectList.SelectedItems) { if (lvi.Index < meshObjectList.Items.Count) { int index = lvi.Index + 1; meshObjectList.Items.RemoveAt(lvi.Index); meshObjectList.Items.Insert(index, lvi); } } RefreshMeshItemsFromList(); } }; Controls.Add(MeshPanel); Controls.Add(MoveDownButton); Controls.Add(MoveUpButton); Controls.Add(DeleteButton); Controls.Add(new Splitter() { Dock = DockStyle.Top, Height = 10 }); Controls.Add(meshObjectList); Controls.Add(HideVISButton); }
public SBBoneTree() : base() { //CheckBoxes = true; //ImageList = new System.Windows.Forms.ImageList(); //ImageList.ImageSize = new System.Drawing.Size(24, 24); Text = "Bone List"; Dock = DockStyle.Fill; ApplicationSettings.SkinControl(this); BoneList = new SBTreeView(); BoneList.Indent = 16; BoneList.LabelEdit = true; BoneList.AfterSelect += SelectBone; BoneList.AfterLabelEdit += treeView_AfterLabelEdit; BoneList.Dock = DockStyle.Top; BoneList.Size = new System.Drawing.Size(400, 300); BoneEditor = new SBBoneEditor(); BoneEditor.Dock = DockStyle.Fill; LoadJOBJNames = new SBButton("Load Bone Labels from File"); LoadJOBJNames.Dock = DockStyle.Top; LoadJOBJNames.Click += (sender, args) => { string f = ""; if (FileTools.TryOpenFile(out f, "Bone Name INI(*.ini)|*.ini")) { var skel = SelectedSkeleton; Dictionary <string, string> newNames = new Dictionary <string, string>(); foreach (var line in System.IO.File.ReadAllLines(f)) { var name = line.Split('='); if (name.Length > 1) { var bname = name[0].Trim(); var newName = name[1].Trim(); var bone = skel[bname]; if (bone != null) { bone.Name = newName; } newNames.Add(bname, newName); } } foreach (var v in Scene.GetMeshObjects()) { if (v.ParentBone != null && newNames.ContainsKey(v.ParentBone)) { v.ParentBone = newNames[v.ParentBone]; } } RefreshBoneList(); } }; Dock = DockStyle.Fill; Controls.Add(BoneEditor); Controls.Add(new Splitter() { Dock = DockStyle.Top, Height = 10 }); Controls.Add(BoneList); Controls.Add(LoadJOBJNames); }