private void CreateControls() { const int startY = 5; const int height = 35; CreateColorControl("Red", startY); CreateColorControl("Green", startY + height); CreateColorControl("Blue", startY + height * 2); CreateColorControl("Alpha", startY + height * 3); GroupBox finalGroup = new GroupBox(this); finalGroup.SetPosition(180, 40); finalGroup.SetSize(60, 60); finalGroup.SetText("Result"); finalGroup.Name = "ResultGroupBox"; ColorDisplay disp = new ColorDisplay(finalGroup); disp.Name = "Result"; disp.SetBounds(0, 10, 32, 32); //disp.DrawCheckers = true; //UpdateControls(); }
private void CreateColorSlider(string name, int y) { HorizontalSlider slider = new HorizontalSlider(this); slider.Min = 0f; slider.Max = 255f; slider.SetPosition(0f, y); slider.SetSize(150, 20); slider.ValueChanged += OnSliderValueChanged; slider.Name = $"{name}Slider"; IntNumericUpDown upDown = new IntNumericUpDown(this); upDown.Min = 0; upDown.Max = 255; upDown.SetPosition(160, y + 2); upDown.SetSize(32, 16); upDown.ValueChanged += OnUpDownValueChanged; upDown.Name = $"{name}UpDown"; ColorDisplay colorDisplay = new ColorDisplay(this); colorDisplay.SetPosition(200, y + 3); colorDisplay.SetSize(16, 16); colorDisplay.Color = Color.White; colorDisplay.Name = $"{name}Display"; }
private void CreateColorControl(ControlBase parent, string name) { GroupBox colorGroup = new GroupBox(parent); colorGroup.Text = name; colorGroup.Name = name + "groupbox"; DockLayout layout = new DockLayout(colorGroup); ColorDisplay disp = new ColorDisplay(layout); disp.Height = Util.Ignore; disp.Dock = Dock.Left; disp.Name = name; TextBoxNumeric numeric = new TextBoxNumeric(layout); numeric.Dock = Dock.Right; numeric.FitToText = "000"; numeric.Name = name + "Box"; numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; HorizontalSlider slider = new HorizontalSlider(layout); slider.Dock = Dock.Fill; slider.VerticalAlignment = VerticalAlignment.Center; slider.SetRange(0, 255); slider.Name = name + "Slider"; slider.ValueChanged += SlidersMoved; }
private void CreateColorControl(String name, int y) { const int colorSize = 12; GroupBox colorGroup = new GroupBox(this); colorGroup.SetPosition(10, y); colorGroup.SetText(name); colorGroup.SetSize(160, 35); colorGroup.Name = name + "groupbox"; ColorDisplay disp = new ColorDisplay(colorGroup); disp.Name = name; disp.SetBounds(0, 10, colorSize, colorSize); TextBoxNumeric numeric = new TextBoxNumeric(colorGroup); numeric.Name = name + "Box"; numeric.SetPosition(105, 7); numeric.SetSize(26, 16); numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; HorizontalSlider slider = new HorizontalSlider(colorGroup); slider.SetPosition(colorSize + 5, 10); slider.SetRange(0, 255); slider.SetSize(80, colorSize); slider.Name = name + "Slider"; slider.ValueChanged += SlidersMoved; }
private void CreateControls() { VerticalLayout colorControlLayout = new VerticalLayout(this); colorControlLayout.Dock = Dock.Fill; CreateColorControl(colorControlLayout, "Red"); CreateColorControl(colorControlLayout, "Green"); CreateColorControl(colorControlLayout, "Blue"); CreateColorControl(colorControlLayout, "Alpha"); GroupBox finalGroup = new GroupBox(this); finalGroup.Dock = Dock.Right; finalGroup.Text = "Result"; finalGroup.Name = "ResultGroupBox"; DockLayout finalLayout = new DockLayout(finalGroup); ColorDisplay disp = new ColorDisplay(finalLayout); disp.Dock = Dock.Fill; disp.Name = "Result"; disp.Width = Util.Ignore; disp.Height = Util.Ignore; }
public override void DisplayMol(ColorDisplay c, TypeDisplay t,int f) { type = t; color = c; frame = f; switch (t) { case TypeDisplay.Points : DisplayMolPoints();break; //case TypeDisplay.Lines : DisplayMolLines();break; case TypeDisplay.VDW : DisplayMolPoints();break; default:DisplayMolPoints(); break; } }
private void CreateControls() { CreateColorSlider("Red", 0); CreateColorSlider("Green", 25); CreateColorSlider("Blue", 50); ColorDisplay totalDisplay = new ColorDisplay(this); totalDisplay.SetPosition(220, 1); totalDisplay.SetSize(70, 70); totalDisplay.Color = Color.White; totalDisplay.Name = $"TotalDisplay"; }
private void UpdateColorControls(String name, Color col, int sliderVal) { ColorDisplay disp = FindChildByName(name, true) as ColorDisplay; disp.Color = col; HorizontalSlider slider = FindChildByName(name + "Slider", true) as HorizontalSlider; slider.Value = sliderVal; TextBoxNumeric box = FindChildByName(name + "Box", true) as TextBoxNumeric; box.Value = sliderVal; }
public override void DisplayMol(ColorDisplay c, TypeDisplay t,int f) { type = t; color = c; frame = f; switch (t) { case TypeDisplay.Points : DisplayMolPointCloud();break; case TypeDisplay.Lines : DisplayMolLines();break; //case TypeDisplay.CPK : DisplayMolPointCloud();DisplayMolLines();break; case TypeDisplay.Surface : DisplayMolSurface();break; case TypeDisplay.Trace : DisplayMolTrace();break; default: break; } }
private void UpdateControls() { //This is a little weird, but whatever for now UpdateColorControls("Red", Color.FromArgb(255, SelectedColor.R, 0, 0), SelectedColor.R); UpdateColorControls("Green", Color.FromArgb(255, 0, SelectedColor.G, 0), SelectedColor.G); UpdateColorControls("Blue", Color.FromArgb(255, 0, 0, SelectedColor.B), SelectedColor.B); UpdateColorControls("Alpha", Color.FromArgb(SelectedColor.A, 255, 255, 255), SelectedColor.A); ColorDisplay disp = FindChildByName("Result", true) as ColorDisplay; disp.Color = SelectedColor; if (ColorChanged != null) { ColorChanged.Invoke(this); } }
public override void DisplayMol(ColorDisplay c, TypeDisplay t,int f) { type = t; color = c; frame = f; switch (t) { case TypeDisplay.Points : if(!Main.options.oldUnityObj) DisplayMolSpheres(); else DisplayMolSpheresOld(); break; case TypeDisplay.VDW : if(!Main.options.oldUnityObj) DisplayMolSpheres(); else DisplayMolSpheresOld(); break; case TypeDisplay.Lines : if(!Main.options.oldUnityObj) DisplayMolCylinders(); else DisplayMolCylindersOld(); break; case TypeDisplay.CPK : if(!Main.options.oldUnityObj){ DisplayMolSpheres();DisplayMolCylinders(); } else{ DisplayMolSpheresOld();DisplayMolCylindersOld(); } break; case TypeDisplay.Trace :DisplayMolTubes();break; default: if(!Main.options.oldUnityObj) DisplayMolSpheres(); else DisplayMolSpheresOld(); break; } }
protected Color setColorAtm(Atom a,ColorDisplay color) { switch (color) { case ColorDisplay.Name: return a.ObjColor; case ColorDisplay.Charges: /*if(a.AtomCharge >= 0){ return (new Color((a.AtomCharge)/maxCharges,0f,1f,1f)); } else{ return(new Color((a.AtomCharge)/-minCharges,0f,1f,1f)); } */ return(new Color(UnityEngine.Random.Range(0f,1f),0f,1f,1f)); case ColorDisplay.ResName: return a.AtomResidue.ObjColor; case ColorDisplay.ResID: return a.AtomResidue.ObjColor; case ColorDisplay.ChainID:return a.AtomChain.ObjColor; default:return Color.white; } }
/// <summary> /// Initializes a new instance of the <see cref="HSVColorPicker"/> class. /// </summary> /// <param name="parent">Parent control.</param> public HSVColorPicker(ControlBase parent) : base(parent) { MouseInputEnabled = true; SetSize(256, 128); //ShouldCacheToTexture = true; m_LerpBox = new ColorLerpBox(this); m_LerpBox.ColorChanged += ColorBoxChanged; m_LerpBox.Dock = Pos.Left; m_ColorSlider = new ColorSlider(this); m_ColorSlider.SetPosition(m_LerpBox.Width + 15, 5); m_ColorSlider.ColorChanged += ColorSliderChanged; m_ColorSlider.Dock = Pos.Left; m_After = new ColorDisplay(this); m_After.SetSize(48, 24); m_After.SetPosition(m_ColorSlider.X + m_ColorSlider.Width + 15, 5); m_Before = new ColorDisplay(this); m_Before.SetSize(48, 24); m_Before.SetPosition(m_After.X, 28); int x = m_Before.X; int y = m_Before.Y + 30; { Label label = new Label(this); label.SetText("R:"); label.SizeToContents(); label.SetPosition(x, y); TextBoxNumeric numeric = new TextBoxNumeric(this); numeric.Name = "RedBox"; numeric.SetPosition(x + 15, y - 1); numeric.SetSize(26, 16); numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; } y += 20; { Label label = new Label(this); label.SetText("G:"); label.SizeToContents(); label.SetPosition(x, y); TextBoxNumeric numeric = new TextBoxNumeric(this); numeric.Name = "GreenBox"; numeric.SetPosition(x + 15, y - 1); numeric.SetSize(26, 16); numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; } y += 20; { Label label = new Label(this); label.SetText("B:"); label.SizeToContents(); label.SetPosition(x, y); TextBoxNumeric numeric = new TextBoxNumeric(this); numeric.Name = "BlueBox"; numeric.SetPosition(x + 15, y - 1); numeric.SetSize(26, 16); numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; } SetColor(DefaultColor); }
private Window CreateEditWindowForType(Type memberType) { Window toReturn = null; #region ComboBox if (memberType.IsEnum || memberType == typeof(bool)) { ComboBox comboBox = new ComboBox(GuiManager.Cursor); comboBox.ScaleX = 8; toReturn = comboBox; comboBox.ItemClick += UpdateComboBoxValue; if (memberType == typeof(bool)) { comboBox.AddItem("true", true); comboBox.AddItem("false", false); } else { string[] options = Enum.GetNames(memberType); Array values = Enum.GetValues(memberType); int i = 0; foreach (object value in values) { comboBox.AddItem(options[i], value); ++i; } } } #endregion #region UpDown else if ( memberType == typeof(byte) || memberType == typeof(float) || memberType == typeof(double) || memberType == typeof(int)) { UpDown upDown = new UpDown(GuiManager.Cursor); upDown.ValueChanged += new GuiMessage(UpdateUpDownValue); toReturn = upDown; upDown.ScaleX = 8; } #endregion #region Vector3 else if ( memberType == typeof(Vector3)) { Vector3Display vecDisplay = new Vector3Display(GuiManager.Cursor); vecDisplay.LosingFocus += UpdateVector3Display; vecDisplay.ValueChanged += UpdateVector3Display; toReturn = vecDisplay; } #endregion #region ColorDisplay else if ( memberType == typeof(System.Drawing.Color)) { ColorDisplay cDisplay = new ColorDisplay(GuiManager.Cursor); cDisplay.ValueChanged += UpdateColorDisplayValue; cDisplay.LosingFocus += UpdateColorDisplayValue; toReturn = cDisplay; } #endregion #region Textbox else if ( memberType == typeof(string) || memberType == typeof(long)) { TextBox textBox = new TextBox(GuiManager.Cursor); textBox.ScaleX = 8; if (memberType == typeof(long)) { textBox.Format = TextBox.FormatTypes.Integer; } textBox.LosingFocus += UpdateTextBoxValue; toReturn = textBox; } #endregion return(toReturn); }
public abstract void DisplayMol(ColorDisplay color,TypeDisplay type,int frame);
protected Material setMaterialAtm(Atom a,ColorDisplay color) { switch (color) { case ColorDisplay.Name: return a.ObjMaterial; case ColorDisplay.Charges: Material m =new Material(mat); /*if(a.AtomCharge >= 0){ m.color = (new Color((a.AtomCharge)/maxCharges,0f,1f,1f)); return m; } else{ m.color =(new Color((a.AtomCharge)/-minCharges,0f,1f,1f)); return m; }*/ m.color =new Color(UnityEngine.Random.Range(0f,1f),0f,1f,1f); return m; case ColorDisplay.ResName: return a.AtomResidue.ObjMaterial; case ColorDisplay.ResID: return a.AtomResidue.ObjMaterial; case ColorDisplay.ChainID:return a.AtomChain.ObjMaterial; default: return mat; } }
public Molecule(Molecule m) : base(m) { chains = new List<Chain> (); residues = new List<Residue> (); atoms = new List<Atom> (); for (int i = 0; i<m.Chains.Count; i++) { Chain c= new Chain(m.Chains[i]); this.Chains.Add(c); for (int j = 0; j<m.Chains[i].Residues.Count; j++) { Residue r = new Residue(m.Chains[i].Residues[j],c); this.Chains[i].Residues.Add(r); this.Residues.Add(r); for (int k =0; k<m.Chains[i].Residues[j].Atoms.Count; k++) { Atom a = new Atom(m.Chains[i].Residues[j].Atoms[k],r,c); this.Chains[i].Residues[j].Atoms.Add(a); this.Chains[i].Atoms.Add(a); this.Atoms.Add(a); } } } bonds = new List<int[]> (m.Bonds); chainsBonds = new List<List<int>> (m.chainsBonds); color = m.color; type = m.type; render = m.render; select = m.select; energies = m.energies; }
/// <summary> /// Initializes a new instance of the <see cref="HSVColorPicker"/> class. /// </summary> /// <param name="parent">Parent control.</param> public HSVColorPicker(ControlBase parent) : base(parent) { MouseInputEnabled = true; int baseSize = BaseUnit; m_LerpBox = new ColorLerpBox(this); m_LerpBox.Margin = Margin.Two; m_LerpBox.ColorChanged += ColorBoxChanged; m_LerpBox.Dock = Dock.Fill; ControlBase values = new VerticalLayout(this); values.Dock = Dock.Right; { m_After = new ColorDisplay(values); m_After.Size = new Size(baseSize * 5, baseSize * 2); m_Before = new ColorDisplay(values); m_Before.Margin = new Margin(2, 0, 2, 2); m_Before.Size = new Size(baseSize * 5, baseSize * 2); GridLayout grid = new GridLayout(values); grid.Margin = new Margin(2, 0, 2, 2); grid.SetColumnWidths(GridLayout.AutoSize, GridLayout.Fill); { { Label label = new Label(grid); label.Text = "R: "; label.Alignment = Alignment.Left | Alignment.CenterV; m_Red = new NumericUpDown(grid); m_Red.Min = 0; m_Red.Max = 255; m_Red.SelectAllOnFocus = true; m_Red.ValueChanged += NumericTyped; } { Label label = new Label(grid); label.Text = "G: "; label.Alignment = Alignment.Left | Alignment.CenterV; m_Green = new NumericUpDown(grid); m_Green.Min = 0; m_Green.Max = 255; m_Green.SelectAllOnFocus = true; m_Green.ValueChanged += NumericTyped; } { Label label = new Label(grid); label.Text = "B: "; label.Alignment = Alignment.Left | Alignment.CenterV; m_Blue = new NumericUpDown(grid); m_Blue.Min = 0; m_Blue.Max = 255; m_Blue.SelectAllOnFocus = true; m_Blue.ValueChanged += NumericTyped; } } } m_ColorSlider = new ColorSlider(this); m_ColorSlider.Margin = Margin.Two; m_ColorSlider.ColorChanged += ColorSliderChanged; m_ColorSlider.Dock = Dock.Right; EnableDefaultColor = false; SetColor(DefaultColor); }