UnityMol  0.9.6-875
UnityMol viewer / In developement
SugarOldGUI.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using System.Collections;
3 using UI;
4 using Molecule.Model;
5 using Molecule.View;
6 
7 public class SugarOldGUI {
8 
9  //T.T RingBlending visu - public for remove visu when CLEAR (reset to false)
10  public static bool toggle_RING_BLENDING = false;
11  public static bool toggle_SUGAR_ONLY=true;
12  public static bool toggle_TWISTER=false;
13 
14  public static bool toggle_SHOW_HB_W_SR=false;
15  public static bool toggle_SHOW_HB_NOT_SUGAR=false;
16 
17  public static bool oxyToggled = false;
18  public static bool toggle_OXYGEN=false;
19 
20  public static bool showSugarChainMenu = false; // T.T Sugar menu
21  public static bool showSugarRibbonsTuneMenu = false;
22  public static bool showColorTuneMenu = false;
23 
24  //Sugar Menu
25  public static void SugarM (int a){
26  showSugarChainMenu = LoadTypeGUI.SetTitleExit("Sugar");
27  bool ssToggled = toggle_RING_BLENDING;
28 
29  if((UIData.atomtype != UIData.AtomType.hyperball && UIData.atomtype != UIData.AtomType.optihb) || (UIData.bondtype != UIData.BondType.hyperstick && UIData.bondtype != UIData.BondType.optihs)){
31  }
32  /*************************************************/
33  GUILayout.BeginHorizontal();
34  toggle_RING_BLENDING = UIData.hasMoleculeDisplay && GUILayout.Toggle(toggle_RING_BLENDING,
35  new GUIContent("Enable RingBlending", "enable RingBlending visualisation"));
36 
37  if(!ssToggled && toggle_RING_BLENDING) { // enabling the SugarBlending
39  }else {
40  if (ssToggled && !toggle_RING_BLENDING) { // destroying the SugarBlending
42  }
43  }
44  GUILayout.EndHorizontal();
45  /*************************************************/
46 
47  //------- Twister
48  bool twToggled = toggle_TWISTER;
49  /*************************************************/
50  GUILayout.BeginHorizontal();
51  toggle_TWISTER = UIData.hasMoleculeDisplay && GUILayout.Toggle(toggle_TWISTER,
52  new GUIContent("Enable SugarRibbons", "Switch between all-atoms and SugarRibbons representation"));
53 
54 
55  if(!twToggled && toggle_TWISTER) { // enabling the ribbons
56 
57 
58  SugarManager.CreateSugarRibs(toggle_SUGAR_ONLY);
59 
63  else
65 
66 
67  toggle_SHOW_HB_NOT_SUGAR = false;
68  toggle_SHOW_HB_W_SR = false;
70 
71 
72  } else if (twToggled && !toggle_TWISTER) { // destroying the ribbons
76  else
79 
80  }
81 
82  GUILayout.EndHorizontal();
83  /*************************************************/
84  /*************************************************/
85  GUILayout.BeginHorizontal();
86  bool hydroToggled = LoadTypeGUI.toggle_HIDE_HYDROGEN;
88  new GUIContent("Hide Hydrogens", "hide hydrogens atoms"));
89  if(!hydroToggled && LoadTypeGUI.toggle_HIDE_HYDROGEN )
91  else if (hydroToggled && !LoadTypeGUI.toggle_HIDE_HYDROGEN && !LoadTypeGUI.toggle_NA_HIDE)
93  GUILayout.EndHorizontal();
94  /*************************************************/
95  GUILayout.BeginHorizontal();
96  GUILayout.Label(">> Hiding atoms");
97  GUILayout.EndHorizontal();
98  /*************************************************/
99 
100  GUILayout.BeginHorizontal();
101  bool hb_w_sb_toggled = toggle_SHOW_HB_W_SR;
102  toggle_SHOW_HB_W_SR = UIData.hasMoleculeDisplay && GUILayout.Toggle(toggle_SHOW_HB_W_SR,
103  new GUIContent("Sugar", "Hide sugar atoms"));
104 
105  bool hb_not_sugar_toggled = toggle_SHOW_HB_NOT_SUGAR;
106  toggle_SHOW_HB_NOT_SUGAR = UIData.hasMoleculeDisplay && GUILayout.Toggle(toggle_SHOW_HB_NOT_SUGAR,
107  new GUIContent("Non Sugar", "Hide Non sugar Atoms"));
108 
109 
110  // if(hb_w_sb_toggled != toggle_SHOW_HB_W_SR || hb_not_sugar_toggled != toggle_SHOW_HB_NOT_SUGAR){
111  // SugarManager.Reset
112  // }
113 
114 
115  if(!hb_w_sb_toggled && toggle_SHOW_HB_W_SR)
117  else if (hb_w_sb_toggled && !toggle_SHOW_HB_W_SR)
119 
120  if(!hb_not_sugar_toggled && toggle_SHOW_HB_NOT_SUGAR)
122  else if (hb_not_sugar_toggled && !toggle_SHOW_HB_NOT_SUGAR)
124 
125  GUILayout.EndHorizontal();
126 
127  /*************************************************/
128  /*************************************************/
129  GUILayout.BeginHorizontal();
130  if(GUILayout.Button(new GUIContent("Tune Menu"))) {
131  showSugarRibbonsTuneMenu = !showSugarRibbonsTuneMenu;
132  }
133 
134  GUI.enabled = true;
135  GUILayout.EndHorizontal();
136  /*************************************************/
137 
138 
139  GUILayout.FlexibleSpace();
140  GUI.DragWindow();
141  }
142 
143 
144  public static void SugarRibbonsTune(int a){
145  showSugarRibbonsTuneMenu = LoadTypeGUI.SetTitleExit("Tune Menu");
146  if (!showSugarChainMenu)
147  showSugarRibbonsTuneMenu = false;
148 
149  int labelWidth = (int) (0.2f * Rectangles.SugarRibbonsTuneWidth);
150  int sliderWidth = (int) (0.73f * Rectangles.SugarRibbonsTuneWidth);
151 
152  /*************************************************/
153  GUILayout.BeginHorizontal();
154  bool oxyToggled = toggle_OXYGEN; //to avoid to create all sphere to each frames
155  toggle_OXYGEN = UIData.hasMoleculeDisplay && GUILayout.Toggle(toggle_OXYGEN,
156  new GUIContent("Show Oxygens", "show ring oxygens with a red sphere"));
157 
158  if (toggle_TWISTER && toggle_OXYGEN && !oxyToggled) {
160  oxyToggled = true;
161  } else if (toggle_RING_BLENDING && toggle_OXYGEN && !oxyToggled) {
163  oxyToggled = true;
164  }else{
165  if (oxyToggled && !toggle_OXYGEN){
167  }
168  }
169 
170  toggle_SUGAR_ONLY = UIData.hasMoleculeDisplay && GUILayout.Toggle(toggle_SUGAR_ONLY,
171  new GUIContent("Sugar Only?", "use only sugar for RingBlending and SugarRibbons"));
172 
173  GUILayout.EndHorizontal();
174  /*************************************************/
175  GUILayout.BeginHorizontal();
176  if(GUILayout.Button(new GUIContent("Change Coloration"))) {
177  showColorTuneMenu = !showColorTuneMenu;
178  }
179 
180  GUI.enabled = true;
181  GUILayout.EndHorizontal();
182 
183  /*************************************************/
184  GUILayout.BeginHorizontal();
185  GUILayout.Label("Oxygen Sphere Size");
186  GUILayout.EndHorizontal();
187  GUILayout.BeginHorizontal();
189  SugarManager.OxySphereSize.ToString("0.00"), "", true, sliderWidth, labelWidth, true);
190 
195 
196  }
197 
198 
199  GUILayout.EndHorizontal();
200  /*************************************************/
201  /*************************************************/
202  GUILayout.BeginHorizontal();
203  GUILayout.Label("Ribbons Thickness");
204  GUILayout.EndHorizontal();
205  GUILayout.BeginHorizontal();
207  SugarManager.RibbonsThickness.ToString("0.00"), "", true, sliderWidth, labelWidth, true);
208  GUILayout.EndHorizontal();
209  /*************************************************/
210  /*************************************************/
211  GUILayout.BeginHorizontal();
212  GUILayout.Label("Inner Ring Thickness");
213  GUILayout.EndHorizontal();
214  GUILayout.BeginHorizontal();
216  SugarManager.thickness_Little.ToString("0.00"), "", true, sliderWidth, labelWidth, true);
217  GUILayout.EndHorizontal();
218  /*************************************************/
219  /*************************************************/
220  GUILayout.BeginHorizontal();
221  GUILayout.Label("Outer Ring Thickness");
222  GUILayout.EndHorizontal();
223  GUILayout.BeginHorizontal();
225  SugarManager.thickness_BIG.ToString("0.00"), "", true, sliderWidth, labelWidth, true);
226  GUILayout.EndHorizontal();
227  /*************************************************/
228  /*************************************************/
229  GUILayout.BeginHorizontal();
230  GUILayout.Label("Pyranose (6) : C1,C4 Bond Thickness");
231  GUILayout.EndHorizontal();
232  GUILayout.BeginHorizontal();
234  SugarManager.thickness_bond_6_C1_C4.ToString("0.00"), "", true, sliderWidth, labelWidth, true);
235  GUILayout.EndHorizontal();
236  /*************************************************/
237  /*************************************************/
238  GUILayout.BeginHorizontal();
239  GUILayout.Label("Pyranose (6) : Other Bond Thickness");
240  GUILayout.EndHorizontal();
241  GUILayout.BeginHorizontal();
243  SugarManager.thickness_6_other.ToString("0.00"), "", true, sliderWidth, labelWidth, true);
244  GUILayout.EndHorizontal();
245  /*************************************************/
246  /*************************************************/
247  GUILayout.BeginHorizontal();
248  GUILayout.Label("Furanose (5) : Bond Thickness");
249  GUILayout.EndHorizontal();
250  GUILayout.BeginHorizontal();
252  SugarManager.thickness_bond_5.ToString("0.00"), "", true, sliderWidth, labelWidth, true);
253  GUILayout.EndHorizontal();
254  /*************************************************/
255 
256  /*************************************************/
257  GUI.enabled = toggle_TWISTER;
258  GUILayout.BeginHorizontal();
259  if(GUILayout.Button(new GUIContent("Apply changes"))) {
260  // Destroying the ribbons
262  }
263  GUI.enabled = true;
264  GUILayout.EndHorizontal();
265  /*************************************************/
266  /*************************************************/
267  GUILayout.BeginHorizontal();
268  if(GUILayout.Button(new GUIContent("Reset parameters"))) {
269  // Destroying the ribbons
271  }
272  GUILayout.EndHorizontal();
273  /*************************************************/
274 
275  GUILayout.FlexibleSpace();
276  GUI.DragWindow();
277  }
278 
279  //FOR SUGAR RIBBONS ONLY
280  public static void ColorTuneMenu(int a){
281  showColorTuneMenu = LoadTypeGUI.SetTitleExit("ColorTune Menu");
282  if (!showSugarChainMenu)
283  showColorTuneMenu = false;
284  int labelWidth = (int) (0.2f * Rectangles.ColorTuneWidth);
285  int sliderWidth = (int) (0.73f * Rectangles.ColorTuneWidth);
286 
287  /*************************************************/
288 
289  GUILayout.BeginHorizontal();
290  GUILayout.Label("OXYGEN SPHERE");
291  GUILayout.EndHorizontal();
292  GUILayout.BeginHorizontal ();
293  if (GUILayout.Button (new GUIContent ("Sugar", "Coloration by sugar Type"))) {
294  oxyToggled = true;
295 
298  toggle_OXYGEN=true;
299  }
300  if (GUILayout.Button (new GUIContent ("Chain", "Coloration by Chain"))) {
301  oxyToggled = true;
304  toggle_OXYGEN=true;
305  }
306  GUILayout.EndHorizontal();
307  GUILayout.BeginHorizontal ();
308  if (GUILayout.Button (new GUIContent ("Custom", "Choose a custom Color"))) {
309  if (LoadTypeGUI.m_colorPicker != null)
310  LoadTypeGUI.m_colorPicker = null;
311 
312  LoadTypeGUI.m_colorPicker = new ColorPicker(Rectangles.colorPickerRect, SugarManager.OxySphereColor, null, "All", "All", "Color Picket");
313  }
314  GUILayout.EndHorizontal ();
317 
318  if (SugarManager.OxySphereCount()>0){
320 
321  }else{
323  toggle_OXYGEN=true;
324  }
325 
326  }
327  /*************************************************/
328  /*************************************************/
329  GUILayout.BeginHorizontal();
330  GUILayout.Label("RINGS");
331  GUILayout.EndHorizontal();
332 
333 
334  GUILayout.BeginHorizontal();
335  if (GUILayout.Button (new GUIContent ("Sugar", "Coloration by sugar Type"))) {
337  //ResetSugarRibbons();
339  }
340 
341  if (GUILayout.Button (new GUIContent ("Chain", "Coloration by Chain"))) {
343  //ResetSugarRibbons();
345  }
346  GUILayout.EndHorizontal();
347  /*************************************************/
348  /*************************************************/
349  GUILayout.BeginHorizontal ();
350  if (GUILayout.Button (new GUIContent ("Custom Color", "Choose a custom Color"))) {
351  if (LoadTypeGUI.m_colorPicker != null)
352  LoadTypeGUI.m_colorPicker = null;
353 
354  LoadTypeGUI.m_colorPicker = new ColorPicker(Rectangles.colorPickerRect, SugarManager.RingColor, null, "All", "All", "Color Picket");
355 
356  }
357  GUILayout.EndHorizontal ();
358 
363  }
364  /*************************************************/
365  /*************************************************/
366  GUILayout.BeginHorizontal();
367  GUILayout.Label("Lighter Color Factor");
368  GUILayout.EndHorizontal();
369  GUILayout.BeginHorizontal();
371  SugarManager.lighter_color_factor_ring.ToString("0.00"), "", true, sliderWidth, labelWidth, true);
372  GUILayout.EndHorizontal();
373 
377 
380  else
382 
383  }
384 
385  /*************************************************/
386  /*************************************************/
387  GUILayout.BeginHorizontal();
388  GUILayout.Label("BONDS");
389  GUILayout.EndHorizontal();
390 
391 
392  /*************************************************/
393  GUILayout.BeginHorizontal();
394  if (GUILayout.Button (new GUIContent ("Sugar", "Coloration by sugar Type"))) {
396  SugarManager.UpdateSugarRibsBondColor(SugarManager.ColorationModeBond); //TODO find a way to retreive vertex coloration with side sugar type.
397  //ResetSugarRibbons();
398  }
399 
400  if (GUILayout.Button (new GUIContent ("Chain", "Coloration by Chain"))) {
403  }
404  GUILayout.EndHorizontal ();
405  /*************************************************/
406  /*************************************************/
407  GUILayout.BeginHorizontal ();
408  if (GUILayout.Button (new GUIContent ("Custom Color", "Choose a custom Color"))) {
409  if (LoadTypeGUI.m_colorPicker != null)
410  LoadTypeGUI.m_colorPicker = null;
411 
412  LoadTypeGUI.m_colorPicker = new ColorPicker(Rectangles.colorPickerRect, SugarManager.BondColor, null, "All", "All", "Color Picket");
413  }
414  GUILayout.EndHorizontal ();
417 
420  }
421  /*************************************************/
422  /*************************************************/
423  GUILayout.BeginHorizontal();
424  GUILayout.Label("Lighter Color Factor");
425  GUILayout.EndHorizontal();
426  GUILayout.BeginHorizontal();
428  SugarManager.lighter_color_factor_bond.ToString("0.00"), "", true, sliderWidth, labelWidth, true);
429  GUILayout.EndHorizontal();
430 
436  else
438 
439 
440  }
441 
442  /*************************************************/
443 
444  GUILayout.FlexibleSpace();
445  GUI.DragWindow();
446  }
447 
448 
449 
450 
451 
452 
453 }
static void UpdateOxySphereSize()
static void ShowRingOxySphere()
Definition: SugarManager.cs:95
static void CreateRingBlending()
Definition: SugarManager.cs:46
static bool toggle_TWISTER
Definition: SugarOldGUI.cs:12
static void DestroyOxySphere()
Definition: SugarManager.cs:98
static int ColorationModeBond
Definition: SugarManager.cs:24
static float OxySphereSizeCheck
Definition: SugarManager.cs:13
static int ColorTuneWidth
Definition: Rectangles.cs:282
static void ResetSugarRibbons(bool sugaronly=false)
float LIGHTER_COLOR_FACTOR_BOND
Definition: SugarRibbons.cs:54
static float lighter_color_factor_bond
Definition: SugarManager.cs:19
static void DestroySugarRibs()
Definition: SugarManager.cs:78
static float thickness_6_other
Definition: SugarManager.cs:17
static bool toggle_OXYGEN
Definition: SugarOldGUI.cs:18
static float thickness_bond_6_C1_C4
Definition: SugarManager.cs:16
static Rect colorPickerRect
Definition: Rectangles.cs:246
static bool oxyToggled
Definition: SugarOldGUI.cs:17
static bool showColorTuneMenu
Definition: SugarOldGUI.cs:22
static void UpdateSugarRibsBondColor(int mode=-1)
static ColorPicker m_colorPicker
static void ShowOxySphere(int colotype=0)
Definition: SugarManager.cs:92
static bool toggle_SHOW_HB_W_SR
Definition: SugarOldGUI.cs:14
static void show_HyperBalls_Sugar(bool show)
static void UpdateSugarRibsRingColor(int mode=-1)
static void DestroyRingBlending()
Definition: SugarManager.cs:51
static ColorObject OxySphereColorCheck
Definition: SugarManager.cs:34
static ColorObject RingColorcheck
Definition: SugarManager.cs:35
Color color
Definition: ColorObject.cs:72
static void SugarRibbonsTune(int a)
Definition: SugarOldGUI.cs:144
static int OxySphereCount()
static ColorObject BondColor
Definition: SugarManager.cs:30
static float RibbonsThickness
Definition: SugarManager.cs:11
static void showHydrogens(bool hide)
static void CreateSugarRibs(bool sugaronly)
Definition: SugarManager.cs:57
static float lighter_color_factor_bond_check
Definition: SugarManager.cs:20
static float thickness_bond_5
Definition: SugarManager.cs:18
static float LabelSlider(float sliderValue, float sliderMinValue, float sliderMaxValue, string labelText, string toolTip, bool enable, int sliderwidth, int labelwidth=100, bool newLine=false)
static bool toggle_RING_BLENDING
Definition: SugarOldGUI.cs:10
static float lighter_color_factor_ring
Definition: SugarManager.cs:21
static bool showSugarRibbonsTuneMenu
Definition: SugarOldGUI.cs:21
static void SugarM(int a)
Definition: SugarOldGUI.cs:25
static void ColorTuneMenu(int a)
Definition: SugarOldGUI.cs:280
static bool showSugarChainMenu
Definition: SugarOldGUI.cs:20
!WiP Includes FLAGS of GUI.
Definition: UIData.cs:78
static void ChangeRepresentation(UIData.AtomType newAtomType, UIData.BondType newBondType=UIData.BondType.nobond)
static bool SetTitleExit(string s)
This is a somewhat odd but very convenient function.
Definition: LoadTypeGUI.cs:153
static BondType bondtype
Definition: UIData.cs:141
static ColorObject RingColor
Definition: SugarManager.cs:32
static void UpdateOxySphereColor()
static ColorObject OxySphereColor
Definition: SugarManager.cs:33
static AtomType atomtype
Definition: UIData.cs:139
static void ResetDefaultParametersSugarRibbons()
static int SugarRibbonsTuneWidth
Definition: Rectangles.cs:273
static bool hasMoleculeDisplay
Definition: UIData.cs:96
static float thickness_BIG
Definition: SugarManager.cs:15
static float lighter_color_factor_ring_check
Definition: SugarManager.cs:22
float OXYSPHERESIZE
Definition: SugarRibbons.cs:55
static float thickness_Little
Definition: SugarManager.cs:14
static void Hide_No_Sugar_Hyperballs(bool show)
static float OxySphereSize
Definition: SugarManager.cs:12
static int ColorationModeRing
Definition: SugarManager.cs:23
static ColorObject BondColorcheck
Definition: SugarManager.cs:31
static bool toggle_SUGAR_ONLY
Definition: SugarOldGUI.cs:11
static bool toggle_SHOW_HB_NOT_SUGAR
Definition: SugarOldGUI.cs:15
Definition: GUIDisplay.cs:66
static SugarRibbons SR
Definition: SugarManager.cs:27
float LIGHTER_COLOR_FACTOR_RING
Definition: SugarRibbons.cs:53