Debian Codegraph @

src/MyTab.cpp

raw symbols ◀ ▶
Source reconstructed at patch state 2 of 3 — not the installed (fully patched) source.
3 Debian patches touch this file
1 #ifndef WX_PRECOMP
2 #include "wx/wx.h"
3 #endif
4
5 //#include "wx/artprov.h"
6 #include <wx/slider.h>
7 /*
8 #include <wx/defs.h>
9 #include <wx/app.h>
10 #include <wx/menu.h>
11 #include <wx/dcclient.h>
12 */
13
14 //#include <wx/image.h>
15 #include <GL/glew.h>
16
17 #include "MyTab.h"
18
19 #include "CgUtil.h"
20 #include "Common.h"
21
22 #include<wx/colordlg.h>
23 #include<wx/utils.h>
24 #include<wx/stdpaths.h>
25
26 const float MAX_BLEND = 0.25; // maximal blend factor for colors (when per chain)
27
28 // GEOM TAB
29 ////////////
30
31 static enum { ID_SetBallnstick=500, ID_SetSpacefill, ID_SetLicorice,
32 ID_SetLicoriceRadius, ID_SetBallnstickRadius,
33
34 ID_SetBallnstickSmoothcolor,ID_SetBallnstickBicolor, ID_SetBallnstickConstantcolor,
35
36 ID_ChooseBallnstickConstantcolor,ID_SetFog,
37
38 ID_SetHetatm,
39 ID_ChooseBgcolor,
40 ID_ChooseHAcolor,
41 ID_SetBgbrightness,
42 ID_SetBaseColorSat,
43 ID_SetBaseColorBri,
44 ID_SetShine,
45 ID_SetShineSize,
46 ID_SetLight,
47 ID_SetLightBase,
48 ID_SetHalo,
49 ID_SetAO,
50 ID_SetHaloStr,
51 ID_SetHaloAware,
52 ID_SetAutobalance,
53
54 // atom colors
55 ID_SetColorPerChain,
56 ID_SetColorPerAtom,
57 ID_ChangeColorSchema,
58 ID_SetColorBlend,
59
60 // ID_SetShadow,
61 ID_SetShadowStr,
62 ID_SetSem,
63 ID_SetDoubleShadows,
64 ID_SetBorderFixed,
65 ID_SetBorderVariable,
66 ID_SetBorderDepthAware,
67 ID_WebButton,
68 ID_FirstPreset,
69 } ID;
70
71
72 static wxRadioButton *buttonSetLicorice, *buttonSetSpacefill, *buttonSetBallnstick,
73 *buttonSetColorPerChain, *buttonSetColorPerAtom ;
74
75 static wxRadioButton *buttonSetBallnstickBicolor, *buttonSetBallnstickConstantcolor, *buttonSetBallnstickSmoothcolor;
76
77 static wxString qutemolwebsite=_T("http://qutemol.sourceforge.net/");
78 static wxColor colDisabled, colSticks, colBg(255,255,255);
79 static float bgbrightness=0.5;
80
81 // why not? :-(
82 //#include<wx/clrpicker.h>
83 //static wxColourPickerCtrl *buttonChooseBallnstickConstantcolor;
84 // fall back:
85 static wxButton *buttonChooseBallnstickConstantcolor;
86 static wxButton *buttonChooseBgcolor;
87 static wxButton *buttonChooseHAcolor;
88 static wxButton *buttonChangeColorSchema;
89
90 static wxCheckBox *buttonAutobalance;
91 static wxCheckBox *buttonDoubleShadows;
92 static wxCheckBox *buttonSem;
93 static wxCheckBox *buttonSetHetatm;
94
95 static wxSlider *sliderLicorice, *sliderBallnstick,
96 //*sliderSetBaseColor ,
97 *sliderShineSize,
98 *sliderAwaren ,
99 *sliderSetBgbrightness,
100 *sliderLightBase, *sliderLighting, *sliderAO,
101 *sliderShadowStr,*sliderHaloAware,
102 *sliderHaloSize, *sliderHaloStr,*sliderColorBlend;
103
104
105
106 static wxStaticText *textLicorice, *textBallnstick, *textShadowStr,
107 *textBallnstick2, *textShineSize, *textDoubleShadows,
108 *textAwaren, *textSem, *textLightBase, *textSetHetatm,
109 *textHaloSize, *textHaloStr, *textHaloAware, *textHaloColor,
110 *textColorBlend;
111
112 static wxColor normalButtonBg;
113 static wxColor currentButtonBg;
114
115 const int NPreset=15;
116 static wxButton* preset[NPreset];
117
118 static const char* presetFile[NPreset] = {
119 "real.preset",
120 "real2.preset",
121 "direct.preset",
122
123 "illustr.preset",
124 "illustr_new.preset",
125 "illustr_motm.preset",
126
127 "qutemol1.preset",
128 "qutemol2.preset",
129 "qutemol3.preset",
130
131 "coolb.preset",
132 "coold.preset",
133 "borders_cool.preset",
134
135 "sem.preset",
136 "sem2.preset",
137 "shape.preset",
138 };
139
140
141 static const char* presetName[NPreset]={
142 "Realistic 1",
143 "Realistic 2",
144 "Direct\nLight Only",
145
146 "Illustr-\native 1",
147 "Illustr-\native 2",
148 "Molecule of\nthe Month",
149
150 "Mixed 1",
151 "Mixed 2",
152 "Mixed 3",
153
154 "Cool\n(bright)",
155 "Cool\n(dark)",
156 "Cool\nborders",
157
158 "Simulated\nS.E.M. 1",
159 "Simulated\nS.E.M. 2",
160 "Shape\nPerception"
161 };
162
163 static bool presetEndOfLine[NPreset] = {
164 false, true,
165 true,
166 false, true,
167 true,
168 false, false, true,
169 false, true,
170 true,
171 false, true,
172 true
173 };
174
175 Byte f2b(float x){
176 return (Byte)(x*255.0);
177 }
178
179 float b2f(Byte x){
180 return ((float)x)/255.0;
181 }
182
183 // quick hack
184 class SliderTable {
185 enum {MAX=100};
186 int n;
187 wxWindowID id[MAX];
188 public:
189 float* data[MAX];
190 wxSlider* slider[MAX];
191 SliderTable(){n=0;}
192
193 void Add(wxWindowID x, float* y, wxSlider* w){
194 if (n<MAX) {
195 id[n]=x;
196 data[n]=y;
197 slider[n]=w;
198 n++;
199 }
200 }
201 int operator[](wxWindowID i){
202 for (int j=0; j<n; j++) {
203 if (id[j]==i) return j;
204 }
205 return -1;
206 }
207
208 void UpdateAll(){
209 for (int i=0; i<n; i++){
210 slider[i]->SetValue(int( (*data[i]*100.0) ) );
211 }
212 }
213
214 } sliderTable;
215
216
217 class ButtonTable {
218 enum {MAX=100};
219 int n;
220 wxWindowID id[MAX];
221 public:
222 bool* data[MAX];
223 wxCheckBox* chk[MAX];
224 ButtonTable(){n=0;}
225
226 void Add(wxWindowID x, bool* y, wxCheckBox* w){
227 if (n<MAX) {
228 id[n]=x;
229 data[n]=y;
230 chk[n]=w;
231 n++;
232 }
233 }
234 int operator[](wxWindowID i){
235 for (int j=0; j<n; j++) {
236 if (id[j]==i) return j;
237 }
238 return -1;
239 }
240
241 void UpdateAll(){
242 for (int i=0; i<n; i++){
243 chk[i]->SetValue(*(data[i]));
244 }
245 }
246
247 } buttonTable;
248
249
250 wxWindow *MyTab::frame2redraw;
251
252 bool doAutobalance(int lastChanged){
253 if (buttonAutobalance->GetValue()) {
254 float* a[2];
255 //a[0]=&cgSettings.P_light_base;
256 a[0]=&cgSettings.P_lighting;
257 a[1]=&cgSettings.P_texture;
258
259 wxSlider* s[2];
260 //s[0]=sliderLightBase;
261 s[0]=sliderLighting;
262 s[1]=sliderAO;
263
264 int fixed=-1;
265 switch (lastChanged){
266 //case ID_SetLightBase:fixed=0; break;
267 case ID_SetLight:fixed=0; break;
268 case ID_SetAO:fixed=1; break;
269 }
270 float sum=0, sump=0;
271 for (int i=0; i<2; i++) {
272 sum+=*(a[i]);
273 if (i==fixed) sump+=*(a[i]);
274 }
275
276 if (fixed==-1) {
277 if (sum!=0) for (int i=0; i<2; i++) {
278 *(a[i])/=sum;
279 s[i]->SetValue( (int)((*a[i])*100.0) );
280 }
281
282 } else {
283 for (int i=0; i<2; i++) if (i!=fixed) {
284 *(a[i])=1-sump;
285 s[i]->SetValue( (int)((*a[i])*100.0) );
286 }
287 }
288
289 }
290 return false;
291 }
292
293 void MyTab::OnSlider(wxScrollEvent & event){
294 wxWindowID id=event.GetId();
295
296 if ( (id==ID_SetHalo) || (id==ID_SetHaloStr) ) cgSettings.ResetHalo();
297
298 switch ( id ) {
299 case ID_SetLicoriceRadius: {
300
301 geoSettings.SetLicoRadiusPercentage( sliderLicorice->GetValue() );
302 geoSettings.Apply();
303 SceneChanged();
304 break;
305 }
306 case ID_SetBallnstickRadius: {
307 geoSettings.SetStickRadiusPercentage( sliderBallnstick->GetValue() );
308 geoSettings.Apply();
309 SceneChanged();
310 break;
311 }
312
313 case ID_SetColorBlend: {
314 SetColMode( sliderColorBlend->GetValue()*0.01f* MAX_BLEND );
315 SceneChanged();
316 break;
317 }
318
319 default:
320 int i=sliderTable[id];
321
322
323 if (i!=-1) {
324 float k=(sliderTable.slider[i]->GetValue())/100.0;
325 *sliderTable.data[i]=k;
326
327 //if ((id==ID_SetAO) && (k>0)) mol.ShowingAO=false;
328
329 if (id==ID_SetBgbrightness) {
330 setSceneBgbrightness(bgbrightness);
331 }
332
333 doAutobalance(id);
334
335 cgSettings.UpdateShaders();
336 SceneChanged();
337 //geoSettings.Apply();
338 EnableCustom();
339 } //else wxWindow::OnScroll(event); // default actions.
340 }
341 }
342
343 void MyTab::OnRadioButton(wxCommandEvent & event){
344 int id=event.GetId();
345 switch ( id ) {
346
347 case ID_SetBallnstick:
348 geoSettings.mode=GeoSettings::BALL_N_STICKS;
349 geoSettings.Apply();
350 break;
351
352 case ID_SetLicorice:
353 geoSettings.mode=GeoSettings::LICORICE;
354 geoSettings.Apply();
355 break;
356
357 case ID_SetSpacefill:
358 geoSettings.mode=GeoSettings::SPACE_FILL;
359 geoSettings.Apply();
360 break;
361
362 case ID_SetBallnstickSmoothcolor:
363 geoSettings.use_stick_const_color=false;
364 geoSettings.stick_smooth_color=true;
365 geoSettings.ApplyColor();
366 break;
367
368 case ID_SetBallnstickBicolor:
369 geoSettings.use_stick_const_color=false;
370 geoSettings.stick_smooth_color=false;
371 geoSettings.ApplyColor();
372 break;
373
374 case ID_SetBallnstickConstantcolor:
375 geoSettings.use_stick_const_color=true;
376 geoSettings.ApplyColor();
377 break;
378
379 case ID_SetColorPerChain:
380 SetColMode(sliderColorBlend->GetValue()*0.01f* MAX_BLEND );
381 SceneChanged();
382 break;
383
384 case ID_SetColorPerAtom:
385 SetColMode(1);
386 SceneChanged();
387 break;
388
389 }
390 EnableGeom();
391 }
392
393 void MyTab::OnCheckBox(wxCommandEvent & event){
394 int id=event.GetId();
395 int i=buttonTable[id];
396
397
398 switch ( id ) {
399 case ID_SetAutobalance:
400 if (doAutobalance(ID_SetAutobalance)) {
401 SceneChanged();
402 cgSettings.UpdateShaders();
403 }
404 break;
405 case ID_SetHetatm:
406 geoSettings.Apply();
407 break;
408 case ID_SetDoubleShadows:
409 UpdateShadowmap();
410 break;
411 }
412
413 if (i!=-1) {
414 bool k=(buttonTable.chk[i]->GetValue());
415 *buttonTable.data[i]=k;
416
417 cgSettings.UpdateShaders();
418 SceneChanged();
419 EnableCustom();
420 }
421
422 }
423
424 void MyTab::OnButton(wxCommandEvent & event){
425 wxColourDialog* dialog;
426 wxColourData data;
427
428 int id=event.GetId();
429
430 switch ( id ) {
431
432 case ID_ChangeColorSchema:
433 ChangeColorSchema();
434 ResetColMode();
435 SceneChanged();
436 break;
437
438 case ID_WebButton:
439 if (!wxLaunchDefaultBrowser(qutemolwebsite)) {
440 wxMessageBox(_T("Browser, browser,\nwhere art thou?"), _T(":-("), wxOK | wxICON_EXCLAMATION, this);
441 }
442 break;
443
444 case ID_ChooseBallnstickConstantcolor:
445 data.SetChooseFull(true);
446 data.SetCustomColour(0, colBg );
447 data.SetColour(colSticks);
448
449 dialog=new wxColourDialog(this,&data);
450 dialog->SetTitle(_T("Choose stick color:"));
451 if (dialog->ShowModal() == wxID_OK)
452 {
453 colSticks = dialog->GetColourData().GetColour();
454 geoSettings.stick_const_color_R=b2f(colSticks.Red());
455 geoSettings.stick_const_color_G=b2f(colSticks.Green());
456 geoSettings.stick_const_color_B=b2f(colSticks.Blue());
457 buttonChooseBallnstickConstantcolor->SetBackgroundColour(colSticks);
458 geoSettings.ApplyColor();
459 SceneChanged();
460 }
461 break;
462
463 case ID_ChooseHAcolor:
464 {
465 cgSettings.P_halo_col=1.0*(cgSettings.P_halo_col!=1);
466 int k=(int)(cgSettings.P_halo_col*255.0);
467 buttonChooseHAcolor->SetBackgroundColour(wxColor(k,k,k));
468
469 cgSettings.ResetHalo();
470 cgSettings.UpdateShaders();
471 SceneChanged();
472 }
473 break;
474
475 case ID_ChooseBgcolor:
476
477 data.SetChooseFull(true);
478 data.SetCustomColour(0, colBg);
479 data.SetColour(colBg);
480
481 dialog=new wxColourDialog(this,&data);
482 dialog->SetTitle(_T("Choose background color:"));
483 if (dialog->ShowModal() == wxID_OK)
484 {
485 setSceneBgcolor(dialog->GetColourData().GetColour());
486 cgSettings.UpdateShaders();
487 SceneChanged();
488 }
489 break;
490
491 default:
492 int pid=id-ID_FirstPreset;
493 if ( (pid>=0) && (pid<NPreset) ) {
494 #ifndef _WIN32
495 wxString presetPath = _T(PKGDATADIR"/presets/") + wxString::FromAscii(presetFile[pid]);
496 if (!cgSettings.Load( (const char *)presetPath.ToAscii() )) {
497 #else
498 if (!cgSettings.Load( presetFile[pid] )) {
499 #endif
500 wxMessageBox(_T("Unable to load presets!"), _T(":-("), wxOK | wxICON_EXCLAMATION, this);
501 }
502 emphCurrentPreset(pid);
503 //cgSettings.Set();
504
505 UpdateAll();
506
507 cgSettings.ResetHalo();
508 cgSettings.UpdateShaders();
509 SceneChanged();
510 }
511 break;
512
513
514 }
515 }
516
517 void MyTab::emphCurrentPreset(int j){
518 /* for (int i=0; i<NPreset; i++) {
519 if (i!=j) preset[i]->SetForegroundColour(normalButtonBg);
520 else preset[i]->SetForegroundColour(currentButtonBg);
521 }
522 */
523 // preset[j]->Press();
524 }
525
526
527 void MyTab::setSceneBgcolor(wxColor c){
528 float r=b2f(c.Red()),
529 g=b2f(c.Green()),
530 b=b2f(c.Blue());
531 float max=(r<g)?g:r;
532 max=(max<b)?b:max;
533
534 bgbrightness = max;
535
536 cgSettings.P_bg_color_R=r;
537 cgSettings.P_bg_color_G=g;
538 cgSettings.P_bg_color_B=b;
539
540 if (bgbrightness==0) colBg.Set(255,255,255); else
541 colBg.Set( Byte(r/max*255.0), Byte(g/max*255.0), Byte(b/max*255.0));
542
543 buttonChooseBgcolor->SetBackgroundColour(c);
544 sliderSetBgbrightness->SetValue(int(bgbrightness*100));
545 }
546
547 wxColor col(float r, float g, float b){
548 wxColor c( Byte(r*255.0), Byte(g*255.0), Byte(b*255.0));
549 return c;
550 }
551
552 wxColor col(float r){
553 return col(r,r,r);
554 }
555
556 void MyTab::setSceneBgbrightness(float br){
557
558 bgbrightness=br;
559
560 float r=colBg.Red()*bgbrightness/255.0,
561 g=colBg.Green()*bgbrightness/255.0,
562 b=colBg.Blue()*bgbrightness/255.0;
563
564 //if (r+b+g<0.01) r=g=b=bgbrightness/255.0;
565
566 cgSettings.P_bg_color_R=r;
567 cgSettings.P_bg_color_G=g;
568 cgSettings.P_bg_color_B=b;
569
570 buttonChooseBgcolor->SetBackgroundColour( col(r,g,b) );
571 }
572
573 void MyTab::EnableCustom(){
574
575 bool b=(cgSettings.P_phong>0);
576 sliderShineSize->Enable(b);
577 textShineSize->Enable(b);
578
579 b=(cgSettings.P_border_outside>0);
580 sliderAwaren->Enable(b);
581 textAwaren->Enable(b);
582
583 b=(cgSettings.P_lighting>0)||(cgSettings.P_phong>0);
584 textShadowStr->Enable(b);
585 sliderShadowStr->Enable(b);
586
587 b=(cgSettings.P_lighting>0);
588 textLightBase->Enable(b);
589 sliderLightBase->Enable(b);
590
591 b=( cgSettings.can_use_doubleshadow() );
592
593 if (!b) buttonDoubleShadows->SetValue(false);
594 else buttonDoubleShadows->SetValue(cgSettings.P_double_shadows);
595
596 buttonDoubleShadows->Enable(b);
597 textDoubleShadows->Enable(b);
598
599 b = cgSettings.P_halo_size>0;
600 sliderHaloStr->Enable(b);
601 sliderHaloAware->Enable(b);
602 textHaloStr->Enable(b);
603 textHaloAware->Enable(b);
604 textHaloColor->Enable(cgSettings.UseHalo());
605 buttonChooseHAcolor->Enable(cgSettings.UseHalo());
606
607 }
608
609
610 void MyTab::EnableGeom(){
611
612
613
614
615 bool lico=false, bns=false, sf=false;
616 if (geoSettings.mode == GeoSettings::SPACE_FILL) sf=true;
617 if (geoSettings.mode == GeoSettings::LICORICE) lico=true;
618 if (geoSettings.mode == GeoSettings::BALL_N_STICKS) bns=true;
619
620 buttonSetLicorice->SetValue(lico);
621 buttonSetSpacefill->SetValue(sf);
622 buttonSetBallnstick->SetValue(bns);
623 sliderBallnstick->Enable(bns);
624 textBallnstick->Enable(bns);
625 textBallnstick2->Enable(bns);
626 sliderLicorice->Enable(lico);
627 textLicorice->Enable(lico);
628
629 float c=GetColMode();
630
631 //sliderColorBlend->SetValue(int(c*100*1.0f));
632 buttonSetColorPerChain->SetValue(c!=1);
633 buttonChangeColorSchema->Enable(c!=1);
634 sliderColorBlend->Enable(c!=1);
635 textColorBlend->Enable(c!=1);
636 buttonSetColorPerAtom->SetValue(c==1);
637
638 buttonSetBallnstickBicolor->Enable(bns);
639 buttonSetBallnstickConstantcolor->Enable(bns);
640 buttonSetBallnstickSmoothcolor->Enable(bns);
641
642 //buttonChooseBallnstickConstantcolor->Enable(bns && constant);
643
644
645 if (bns) {
646 bool bi, constant, smooth;
647 constant = (geoSettings.use_stick_const_color);
648 smooth = (!constant) & (geoSettings.stick_smooth_color);
649 bi = (!smooth) && (!constant);
650
651 buttonSetBallnstickBicolor->SetValue(bi);
652 buttonSetBallnstickConstantcolor->SetValue(constant);
653 buttonSetBallnstickSmoothcolor->SetValue(smooth);
654
655 buttonChooseBallnstickConstantcolor->Enable(constant);
656 if (constant) {
657 colSticks.Set(
658 f2b(geoSettings.stick_const_color_R),
659 f2b(geoSettings.stick_const_color_G),
660 f2b(geoSettings.stick_const_color_B)
661 );
662 buttonChooseBallnstickConstantcolor->SetBackgroundColour(colSticks);
663 } else
664 buttonChooseBallnstickConstantcolor->SetBackgroundColour(colDisabled);
665 } else {
666 buttonChooseBallnstickConstantcolor->SetBackgroundColour(colDisabled);
667 buttonChooseBallnstickConstantcolor->Enable(false);
668 }
669
670 /*bool b=
671 sliderColorBlend()->GetValue()*0.01f *0.1f);*/
672
673 int h=GetCurrentHetatm();
674 int a=GetCurrentAtm();
675 bool e=true, set=geoSettings.showHetatm;
676 if ((h==0) && (a!=0)) {e=false;set=false;}
677 if ((h!=0) && (a==0)) {e=false;set=true;}
678 buttonSetHetatm->Enable(e);
679 textSetHetatm->Enable(e);
680 buttonSetHetatm->SetValue(set);
681
682 SceneChanged();
683
684 }
685
686 int MyTab::Count(){
687 return 4;
688 }
689
690
691
692 wxString MyTab::Title(int i)
693 {
694 switch (i) {
695 case 0: return wxString(_T("Presets")); break;
696 case 1: return wxString(_T("Geometry")); break;
697 case 2: return wxString(_T("Customize")); break;
698 case 3: return wxString(_T("Info")); break;
699 }
700 return wxString(_T(""));
701 }
702
703 BEGIN_EVENT_TABLE(MyTab, wxPanel)
704 EVT_RADIOBUTTON(-1, MyTab::OnRadioButton)
705 /*EVT_RADIOBUTTON(ID_SetLicorice, MyTab::OnSetLicorice)
706 EVT_RADIOBUTTON(ID_SetSpacefill, MyTab::OnSetSpacefill)
707
708 EVT_RADIOBUTTON(ID_SetBallnstickSmoothcolor, MyTab::OnSetBallnstickSmoothcolor)
709 EVT_RADIOBUTTON(ID_SetBallnstickBicolor, MyTab::OnSetBallnstickBicolor)
710 EVT_RADIOBUTTON(ID_SetBallnstickConstantcolor, MyTab::OnSetBallnstickConstantcolor)*/
711
712 EVT_BUTTON(-1, MyTab::OnButton)
713 EVT_COMMAND_SCROLL_THUMBTRACK(-1, MyTab::OnSlider)
714 EVT_CHECKBOX(-1, MyTab::OnCheckBox)
715 //EVT_BUTTON(ID_ChooseBallnstickConstantcolor, MyTab::OnChooseBallnstickConstantcolor)
716 //EVT_COMMAND_SCROLL(ID_SetLicoriceRadius, MyTab::OnSetLicoriceRadius)
717 //EVT_COMMAND_SCROLL(ID_SetBallnstickRadius, MyTab::OnSetBallnstickRadius)
718 END_EVENT_TABLE()
719
720 wxBitmap *LoadPngImage(wxString st);
721
722 wxSlider* tmpSlider;
723 wxCheckBox* tmpChk;
724 wxStaticText* tmpStaticText;
725
726 static int SLIDERSIZE=80;
727
728 wxSizer *newLabelledSlider( wxWindow* parent, wxWindowID idSlider,
729 const wxString& labelString,
730 int pos ,
731 wxSlider* &slider=tmpSlider,
732 wxStaticText* &label = tmpStaticText) {
733 //
734 wxSizer *res = new wxBoxSizer(wxHORIZONTAL);
735 label=new wxStaticText(parent, wxID_ANY, labelString);
736 slider=new wxSlider(parent,idSlider, pos, 0, 100, wxDefaultPosition, wxSize(SLIDERSIZE,wxDefaultSize.y), wxNO_FULL_REPAINT_ON_RESIZE );
737 res->Add(label, 0);
738 res->Add(slider, 1, wxEXPAND);
739 return res;
740 }
741
742 wxSizer *newAutoSlider( wxWindow* parent, wxWindowID idSlider,
743 const wxString& labelString,
744 float *pos ,
745 wxSlider* &slider=tmpSlider,
746 wxStaticText* &label=tmpStaticText) {
747 //
748 wxSizer *res = new wxBoxSizer(wxHORIZONTAL);
749 label=new wxStaticText(parent, wxID_ANY, labelString);
750 slider=new wxSlider(parent,idSlider,
751 int((*pos)*100.0f), 0, 100, wxDefaultPosition, wxSize(SLIDERSIZE,wxDefaultSize.y), wxNO_FULL_REPAINT_ON_RESIZE
752 );
753 res->Add(label, 0);
754 res->Add(slider, 0);
755
756 sliderTable.Add(idSlider, pos, slider);
757 return res;
758 }
759
760 #define AUTO_TEXT_ON_RIGHT 1
761
762 wxSizer *newAutoCheckBox(wxWindow* parent, wxWindowID idChk,
763 const wxString& labelString,
764 bool *value,
765 wxCheckBox* &chk=tmpChk,
766 wxStaticText* &label=tmpStaticText,
767 int flags=0) {
768 //
769 wxSizer *res = new wxBoxSizer(wxHORIZONTAL);
770 label=new wxStaticText(parent, wxID_ANY, labelString);
771 chk=new wxCheckBox(parent,idChk, _T(""));
772 chk->SetValue(*value);
773
774 if (flags&AUTO_TEXT_ON_RIGHT) {
775 //res->Add(SLIDERSIZE - 10 - chk->GetSize().x ,0,1);
776 res->Add(chk, 0, wxBOTTOM | wxTOP, 3);
777 res->Add(10 ,0,0);
778 res->Add(label, 0, wxALIGN_CENTER);
779 }
780 else {
781 res->Add(label, 0, wxALIGN_CENTER);
782 res->Add(10 ,0,0);
783 res->Add(chk, 0, wxBOTTOM | wxTOP, 3);
784 res->Add(SLIDERSIZE - 10 - chk->GetSize().x ,0,1);
785 }
786
787 buttonTable.Add(idChk, value, chk);
788 return res;
789 }
790
791 static wxSizer *globalSizerH=NULL;
792 static wxSizer *globalSizerV=NULL;
793 static wxBoxSizer *sizerR, *sizerL;
794
795 // returns an emphatized version of a given color
796 wxColor emphColor(wxColor c){
797 unsigned char rgb[3];
798 rgb[0]=c.Red();
799 rgb[1]=c.Green();
800 rgb[2]=c.Blue();
801 for (int i=0; i<3; i++)
802 {
803 int K=100;
804 if (rgb[i]>255-K) rgb[i]-=K;
805 else if (rgb[i]>128) rgb[i]+=K;
806 else if (rgb[i]>K) rgb[i]-=K;
807 else rgb[i]+=K;
808 }
809 return wxColor(rgb[0],rgb[1],rgb[2]);
810 }
811
812 int _TH;
813 //wxSizer *obj1, *obj2;
814
815 // remove newlines from a strings
816 wxString noNewLine(wxString x){
817 static wxString res;
818 res.Clear();
819
820 for (int i=0; i< (int)x.Length(); i++){
821 if ((x[i]=='-')&&(x[i+1]=='\n')) {
822 i++; i++;
823 }
824 if (x[i] != '\n') {
825 res.Append(x[i]);
826 } else {
827 res.Append(' ');
828 }
829 }
830 return res;
831 }
832
833 MyTab::MyTab(wxWindow *parent , int n): wxPanel( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
834 /*wxNO_FULL_REPAINT_ON_RESIZE |*/ wxCLIP_CHILDREN | wxTAB_TRAVERSAL)
835 {
836
837 //int i;
838
839 bool thinButtons=false;
840 #ifndef _WIN32
841 thinButtons=true; // unsupported newlines in wxButtons under MAC! :(
842 #endif
843
844 if (n==0) { // presets tab (visual presets)
845 wxSizer *sizer,*subSizer=NULL;
846 if (thinButtons) sizer = new wxBoxSizer(wxVERTICAL);
847 else sizer = new wxGridSizer(5,3,15,15);
848
849 wxSize butSize;
850 //if (thinButtons) butSize= wxSize(90,-1); // -1 = use default button height
851 if (thinButtons) butSize= wxSize(90,24); // -1 = use default button height
852 else butSize= wxSize(70,50);
853
854 for (int i=0; i<NPreset; i++) {
855 printf ("presetname: %s\n", presetName[i]);
856 /*
857 preset[i]=new wxButton(this, ID_FirstPreset + i,
858 thinButtons? noNewLine(wxString::FromAscii(presetName[i])):wxString::FromAscii(presetName[i]),
859 wxDefaultPosition); //, butSize );
860 */
861 preset[i] = new wxButton(this,
862 ID_FirstPreset + i,
863 noNewLine(wxString::FromAscii(presetName[i])),
864 wxDefaultPosition);
865
866 preset[i]->SetMinSize(butSize);
867 //if (presetName[i]==wxEmptyString) preset[i]->Show(false);
868 if (!presetName[i]) preset[i]->Show(false);
869 if (thinButtons) {
870 if (!subSizer) subSizer=new wxBoxSizer(wxHORIZONTAL);
871 subSizer->Add( preset[i], 1, wxALIGN_CENTER|wxEXPAND|wxALL,4 );
872 if (presetEndOfLine[i]) {
873 sizer->Add( subSizer, 1, wxALIGN_CENTER|wxEXPAND);
874 subSizer=NULL;
875 }
876 } else {
877 sizer->Add( preset[i], 1, wxALIGN_CENTER );
878 }
879 }
880
881 normalButtonBg=preset[0]->GetForegroundColour();
882 currentButtonBg=emphColor(normalButtonBg);
883
884 wxSizer *topLvlSizer = new wxBoxSizer(wxVERTICAL);
885 // topLvlSizer->Add(10,10,0);
886 topLvlSizer->Add(1,1,1);
887 topLvlSizer->Add(sizer,0, wxALIGN_CENTER); //|wxEXPAND);
888 topLvlSizer->Add(1,1,1);
889 SetSizer(topLvlSizer);
890 }
891 if (n==1) { // geometry tab (ball and stick, stick radius, etc)
892
893
894
895 wxStaticBox *box1 = new wxStaticBox(this, wxID_ANY, _T("Space-Fill") );
896 wxSizer *sizer1 = new wxStaticBoxSizer(box1, wxHORIZONTAL);
897
898 buttonSetSpacefill = new wxRadioButton(this, ID_SetSpacefill, _T(""), wxDefaultPosition, wxDefaultSize, wxRB_SINGLE );
899
900 wxStaticBitmap *bitmap1 = new wxStaticBitmap(this, wxID_ANY, *LoadPngImage(_T("geo1")), wxDefaultPosition );
901
902 sizer1->Add(bitmap1);
903 sizer1->Add(5, 5, 1, wxALL, 5); // spacer
904
905 wxSizer *sizerMode1 = new wxBoxSizer(wxHORIZONTAL);
906 sizerMode1->Add(buttonSetSpacefill, 0, wxRIGHT|wxALIGN_CENTER, 4);
907 sizerMode1->Add(sizer1, 1);
908
909
910
911 wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, _T("Balls'n'Sticks") );
912 wxSizer *sizer2 = new wxStaticBoxSizer(box2, wxHORIZONTAL);
913 //sizer2->Enable(false);
914
915 buttonSetBallnstick= new wxRadioButton(this, ID_SetBallnstick, _T(""), wxDefaultPosition, wxDefaultSize, wxRB_SINGLE );
916 wxStaticBitmap *bitmap2 = new wxStaticBitmap(this, wxID_ANY, *LoadPngImage(_T("geo2")), wxDefaultPosition );
917
918 wxSizer *sizer2r = new wxBoxSizer(wxVERTICAL);
919 sizer2r->Add( newLabelledSlider(
920 this, ID_SetBallnstickRadius,
921 _T("Stick size:"),
922 geoSettings.GetStickRadiusPercentage(),
923 sliderBallnstick,
924 textBallnstick
925 ) );
926
927 {
928 wxSizer *sizer2rr = new wxBoxSizer(wxHORIZONTAL);
929 textBallnstick2=new wxStaticText(this, wxID_ANY, _T("Stick color:"));
930 sizer2rr->Add(textBallnstick2, 0);
931 wxSizer *sizerColbox = new wxBoxSizer(wxVERTICAL);
932 buttonSetBallnstickBicolor = new wxRadioButton
933 (this, ID_SetBallnstickBicolor, _T("Split"), wxDefaultPosition, wxDefaultSize, wxRB_SINGLE );
934 sizerColbox->Add( buttonSetBallnstickBicolor, 1, wxALL, 1);
935 buttonSetBallnstickSmoothcolor = new wxRadioButton
936 (this, ID_SetBallnstickSmoothcolor, _T("Blended"), wxDefaultPosition, wxDefaultSize, wxRB_SINGLE );
937 sizerColbox->Add( buttonSetBallnstickSmoothcolor, 1, wxALL, 1);
938 buttonSetBallnstickConstantcolor = new wxRadioButton
939 (this, ID_SetBallnstickConstantcolor, _T("Constant:"), wxDefaultPosition, wxDefaultSize, wxRB_SINGLE );
940 sizerColbox->Add( buttonSetBallnstickConstantcolor, 1, wxALL, 1);
941
942 buttonChooseBallnstickConstantcolor = new wxButton(this, ID_ChooseBallnstickConstantcolor,
943 wxEmptyString, wxDefaultPosition, wxSize(16,16),wxNO_BORDER);
944 colDisabled = this->GetBackgroundColour();
945 // wxColor col(255,0,0);
946 // buttonChooseBallnstickConstantcolor ->SetBackgroundColour(col);
947 /*
948 :-(
949 buttonChooseBallnstickConstantcolor = new wxColourPickerCtrl(this, ID_ChooseBallnstickConstantcolor);
950 */
951
952 sizer2rr->Add(sizerColbox, 1);
953 sizer2rr->Add( buttonChooseBallnstickConstantcolor, 0, wxALL|wxALIGN_BOTTOM, 1);
954 //sizer2r->Add(5, 5, 0, wxALL, 5); // spacer
955 sizer2r->Add(sizer2rr, 0);
956 }
957
958 sizer2->Add(bitmap2);
959 sizer2->Add(5, 5, 0, wxALL, 5); // spacer
960 sizer2->Add(sizer2r, 1);
961
962
963 wxSizer *sizerMode2 = new wxBoxSizer(wxHORIZONTAL);
964 sizerMode2->Add(buttonSetBallnstick, 0, wxRIGHT|wxALIGN_CENTER, 4);
965 sizerMode2->Add(sizer2, 1);
966
967
968 wxStaticBox *box3 = new wxStaticBox(this, wxID_ANY, _T("Licorice") );
969 wxSizer *sizer3 = new wxStaticBoxSizer(box3, wxHORIZONTAL);
970
971 buttonSetLicorice = new wxRadioButton(this, ID_SetLicorice, _T(""), wxDefaultPosition, wxDefaultSize, wxRB_SINGLE );
972 wxStaticBitmap *bitmap3 = new wxStaticBitmap(this, wxID_ANY, *LoadPngImage(_T("geo3")), wxDefaultPosition );
973
974 wxSizer *sizer3r = new wxBoxSizer(wxVERTICAL);
975 /*wxSizer *sizer3rr = new wxBoxSizer(wxHORIZONTAL);
976 textLicorice=new wxStaticText(this, wxID_ANY, _T("Thickness:"));
977 sizer3rr->Add(textLicorice, 0);
978 sizer3rr->Add(sliderLicorice, 1);
979 sizer3r->Add(5, 5, 0, wxALL, 5); // spacer*/
980 sizer3r->Add( newLabelledSlider(
981 this, ID_SetLicoriceRadius,
982 _T("Thickness:"),
983 geoSettings.GetLicoRadiusPercentage(),
984 sliderLicorice,
985 textLicorice
986 ) , 0, wxALIGN_BOTTOM);
987
988
989 sizer3->Add(bitmap3, 0);
990 sizer3->Add(5, 5, 0, wxALL, 5); // spacer
991 sizer3->Add(sizer3r, 1, wxALIGN_CENTER);
992
993
994 wxStaticBoxSizer *sizerColors = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _T("Material Color") ) , wxHORIZONTAL );
995
996 wxSizer *subsizerColors = new wxBoxSizer(wxVERTICAL);
997 buttonSetColorPerChain =
998 new wxRadioButton(this, ID_SetColorPerChain, _T("Per chain"), wxDefaultPosition, wxDefaultSize, wxRB_SINGLE );
999
1000 buttonSetColorPerAtom =
1001 new wxRadioButton(this, ID_SetColorPerAtom, _T("Per atom"), wxDefaultPosition, wxDefaultSize, wxRB_SINGLE );
1002
1003 buttonChangeColorSchema =
1004 new wxButton(this, ID_ChangeColorSchema, _T("Change cols") ); //_T("Change\ncolor\nschema")
1005 subsizerColors->Add( buttonSetColorPerAtom );
1006 subsizerColors->Add( buttonSetColorPerChain );
1007 subsizerColors->Add(2,2);
1008 subsizerColors->Add(
1009 newLabelledSlider(
1010 this, ID_SetColorBlend,
1011 _T("Diff:"),
1012 0,
1013 sliderColorBlend,
1014 textColorBlend
1015 ), 1, wxLEFT|wxALIGN_RIGHT,30
1016 );
1017 sizerColors->Add( subsizerColors );
1018 sizerColors->Add(2,2);
1019 sizerColors->Add( buttonChangeColorSchema, 1, wxRIGHT|wxALIGN_RIGHT|wxALIGN_BOTTOM,5 );
1020
1021 wxSizer *sizerMode3 = new wxBoxSizer(wxHORIZONTAL);
1022 sizerMode3->Add(buttonSetLicorice, 0, wxRIGHT|wxALIGN_CENTER, 5);
1023 sizerMode3->Add(sizer3, 1);
1024
1025 wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
1026 sizer->Add(sizerMode1, 0, wxGROW | wxALL , 4);
1027 sizer->Add(sizerMode3, 0, wxGROW | wxALL , 4);
1028 sizer->Add(sizerMode2, 0, wxGROW | wxALL , 4);
1029
1030 wxSizer *sizerG = new wxBoxSizer(wxVERTICAL);
1031 sizer->Add(5,5,0); // spacer
1032 sizer->Add(newAutoCheckBox(
1033 this,ID_SetHetatm,
1034 _T("Show 'HET' atoms"),
1035 &(geoSettings.showHetatm),
1036 buttonSetHetatm, textSetHetatm,
1037 AUTO_TEXT_ON_RIGHT
1038 ), 0 , wxALIGN_LEFT | wxLEFT,8
1039 );
1040 sizer->Add(5,5,0); // spacer
1041 sizer->Add(sizerColors, 0 , wxALIGN_RIGHT);
1042
1043 sizerG->Add(sizer,0,wxALIGN_CENTER );
1044 SetSizer(sizerG);
1045
1046 EnableGeom();
1047
1048 }
1049 if (n==2) { // customize tab (sliders for all graphic fxs)
1050
1051
1052 wxStaticText *label1=new wxStaticText(this, wxID_ANY, _T("Color:"));
1053 buttonChooseBgcolor=new wxButton(this, ID_ChooseBgcolor,
1054 wxEmptyString, wxDefaultPosition, wxSize(16,16),wxNO_BORDER);
1055 wxSizer *sizerBgcolor = new wxBoxSizer(wxHORIZONTAL);
1056
1057 sizerBgcolor->Add(label1,0,wxALL, 5);
1058 sizerBgcolor->Add(buttonChooseBgcolor,0,wxALL, 5);
1059 setSceneBgbrightness(bgbrightness);
1060
1061
1062 wxStaticBox *boxBG = new wxStaticBox(this, wxID_ANY, _T("Background") );
1063 wxSizer *sizerBG = new wxStaticBoxSizer(boxBG, wxVERTICAL);
1064
1065 sizerBG->Add(newAutoSlider(
1066 this, ID_SetBgbrightness,
1067 _T("Brightn.:"),
1068 &(bgbrightness),
1069 sliderSetBgbrightness
1070 ), 0 , wxALIGN_RIGHT );
1071
1072 sizerBG->Add(sizerBgcolor,0 , wxALIGN_CENTER);
1073
1074 wxStaticBox *boxBC = new wxStaticBox(this, wxID_ANY, _T("Base Colors") );
1075 wxSizer *sizerBC = new wxStaticBoxSizer(boxBC, wxVERTICAL);
1076
1077 sizerBC->Add(newAutoSlider(
1078 this, ID_SetBaseColorSat,
1079 _T("Saturation:"),
1080 &(cgSettings.P_col_atoms_sat)
1081 ), 0 , wxALIGN_RIGHT );
1082
1083 /*
1084 // Useless! Redundant with basic light
1085 sizerBC->Add(newAutoSlider(
1086 this, ID_SetBaseColorBri,
1087 _T("Brightness:"),
1088 &(cgSettings.P_col_atoms_bri)
1089 ), 0 , wxALIGN_RIGHT );
1090 */
1091
1092 wxStaticBox *boxPL = new wxStaticBox(this, wxID_ANY, _T("Point Light"));
1093 wxSizer *sizerPL = new wxStaticBoxSizer(boxPL, wxVERTICAL);
1094
1095
1096 sizerPL->Add(newAutoSlider(
1097 this, ID_SetLight,
1098 _T("Intensity*:"),
1099 &(cgSettings.P_lighting),
1100 sliderLighting
1101 ), 0 , wxALIGN_RIGHT );
1102
1103 sizerPL->Add(newAutoSlider(
1104 this, ID_SetLightBase,
1105 _T("Flatten:"),
1106 &(cgSettings.P_light_base),
1107 sliderLightBase, textLightBase
1108 ), 0 , wxALIGN_RIGHT );
1109
1110 sizerPL->Add(newAutoSlider(
1111 this, ID_SetShine,
1112 _T("Shininess:"),
1113 &(cgSettings.P_phong)
1114 ), 0 , wxALIGN_RIGHT );
1115
1116 sizerPL->Add(newAutoSlider(
1117 this, ID_SetShineSize,
1118 _T("Glossiness:"),
1119 &(cgSettings.P_phong_size),
1120 sliderShineSize, textShineSize
1121 ), 0 , wxALIGN_RIGHT
1122 );
1123
1124 /* sizerPL->Add(newAutoCheckBox(
1125 this,ID_SetShadow,
1126 _T("Cast Shadows:"),
1127 &(cgSettings.P_use_shadowmap()),
1128 buttonShadow, textShadow
1129 ), 0 , wxALIGN_RIGHT
1130 );*/
1131
1132
1133 sizerPL->Add(newAutoSlider(
1134 this, ID_SetShadowStr,
1135 _T("Shadows:"),
1136 &(cgSettings.P_shadowstrenght),
1137 sliderShadowStr, textShadowStr
1138 ), 0 , wxALIGN_RIGHT
1139 );
1140
1141 sizerPL->Add(newAutoCheckBox(
1142 this,ID_SetDoubleShadows,
1143 _T("2way Light:"),
1144 &(cgSettings.P_double_shadows ),
1145 buttonDoubleShadows, textDoubleShadows
1146 ), 0 , wxALIGN_RIGHT
1147 );
1148
1149 sizerPL->Add(newAutoCheckBox(
1150 this,ID_SetSem,
1151 _T("Fake SEM:"),
1152 &(cgSettings.P_sem_effect),
1153 buttonSem, textSem
1154 ), 0 , wxALIGN_RIGHT
1155 );
1156
1157 wxStaticBox *boxDB = new wxStaticBox(this, wxID_ANY, _T("Depth Cueing") );
1158 wxSizer *sizerDB = new wxStaticBoxSizer(boxDB, wxVERTICAL);
1159
1160 sizerDB->Add(newAutoSlider(
1161 this, ID_SetFog,
1162 _T("Strength:"),
1163 &(cgSettings.P_fog)
1164 ), 0 , wxALIGN_RIGHT );
1165
1166
1167 wxStaticBox *boxHA = new wxStaticBox(this, wxID_ANY, _T("Halos") );
1168 wxSizer *sizerHA = new wxStaticBoxSizer(boxHA, wxVERTICAL);
1169
1170 sizerHA->Add(newAutoSlider(
1171 this, ID_SetHalo,
1172 _T("Size:"),
1173 &(cgSettings.P_halo_size),
1174 sliderHaloSize, textHaloSize
1175 ), 0 , wxALIGN_RIGHT );
1176
1177 sizerHA->Add(newAutoSlider(
1178 this, ID_SetHaloStr,
1179 _T("Strength:"),
1180 &(cgSettings.P_halo_str),
1181 sliderHaloStr, textHaloStr
1182 ), 0 , wxALIGN_RIGHT );
1183
1184 sizerHA->Add(newAutoSlider(
1185 this, ID_SetHaloAware,
1186 _T("Variance:"),
1187 &(cgSettings.P_halo_aware),
1188 sliderHaloAware, textHaloAware
1189 ), 0 , wxALIGN_RIGHT );
1190
1191 textHaloColor=new wxStaticText(this, wxID_ANY, _T("Color:"));
1192 buttonChooseHAcolor=new wxButton(this, ID_ChooseHAcolor,
1193 wxEmptyString, wxDefaultPosition, wxSize(16,16),wxNO_BORDER);
1194 buttonChooseHAcolor->SetBackgroundColour( col(cgSettings.P_halo_col) );
1195
1196
1197 wxSizer *sizerHAcolor = new wxBoxSizer(wxHORIZONTAL);
1198
1199
1200
1201
1202 sizerHAcolor->Add(textHaloColor,0,wxALL, 5);
1203 sizerHAcolor->Add(buttonChooseHAcolor,0,wxALL, 5);
1204
1205 sizerHA->Add(sizerHAcolor, 0 , wxALIGN_CENTER);
1206
1207
1208 // borders
1209
1210 wxStaticBox *boxBR = new wxStaticBox(this, wxID_ANY, _T("Borders") );
1211 wxSizer *sizerBR = new wxStaticBoxSizer(boxBR, wxVERTICAL);
1212
1213 /*
1214 sizerBR->Add(newAutoSlider(
1215 this, ID_SetBorderFixed,
1216 _T("Fixed Size:"),
1217 &(cgSettings.P_border_inside)
1218 ), 0 , wxALIGN_RIGHT );*/
1219
1220 sizerBR->Add(newAutoSlider(
1221 this, ID_SetBorderVariable,
1222 _T("Size:"),
1223 &(cgSettings.P_border_outside)
1224 ), 0 , wxALIGN_RIGHT );
1225
1226 sizerBR->Add(newAutoSlider(
1227 this, ID_SetBorderDepthAware,
1228 _T("Variance:"),
1229 &(cgSettings.P_depth_full),
1230 sliderAwaren, textAwaren
1231 ), 0 , wxALIGN_RIGHT );
1232
1233
1234
1235
1236 wxStaticBox *boxAO = new wxStaticBox(this, wxID_ANY, _T("Ambient Light") );
1237 wxSizer *sizerAO = new wxStaticBoxSizer(boxAO, wxVERTICAL);
1238
1239 sizerAO->Add(newAutoSlider(
1240 this, ID_SetAO,
1241 _T("Intensity*:"),
1242 &(cgSettings.P_texture),
1243 sliderAO
1244 ), 0 , wxALIGN_RIGHT );
1245
1246
1247 wxSizer *sizerAB = new wxBoxSizer(wxVERTICAL);
1248 buttonAutobalance = new wxCheckBox(this, ID_SetAutobalance, _T("* Autobalance") );
1249 buttonAutobalance->SetValue(false);
1250 sizerAB->Add(buttonAutobalance, 1, wxALIGN_CENTER );
1251 buttonTable.Add(ID_SetAutobalance, &(cgSettings.auto_normalize), buttonAutobalance);
1252
1253 int SPACE=6;
1254
1255 sizerL = new wxBoxSizer(wxVERTICAL);
1256 sizerL->Add(sizerBC, 0, wxEXPAND);
1257 sizerL->Add(SPACE,SPACE, 0);
1258 sizerL->Add(sizerPL, 0, wxEXPAND);
1259 sizerL->Add(SPACE,SPACE, 0);
1260 sizerL->Add(sizerAO, 0, wxEXPAND);
1261 sizerL->Add(SPACE,SPACE, 0);
1262 sizerL->Add(sizerAB, 0, wxEXPAND|wxALIGN_CENTER );
1263
1264
1265 /*wxBoxSizer */sizerR = new wxBoxSizer(wxVERTICAL);
1266 sizerR->Add(sizerBG, 0, wxEXPAND);
1267 sizerR->Add(SPACE,SPACE, 0);
1268 sizerR->Add(sizerDB, 0, wxEXPAND);
1269 sizerR->Add(SPACE,SPACE, 0);
1270 sizerR->Add(sizerHA, 0, wxEXPAND);
1271 sizerR->Add(SPACE,SPACE, 0);
1272 sizerR->Add(sizerBR, 0, wxEXPAND);
1273
1274 globalSizerV = new wxBoxSizer(wxVERTICAL);
1275 globalSizerV->Add(sizerL, 1, wxEXPAND);
1276
1277 globalSizerH = new wxBoxSizer(wxHORIZONTAL);
1278 globalSizerH->Add(globalSizerV, 1);
1279 globalSizerH->Add(sizerR,1, wxEXPAND|wxLEFT, 5);
1280
1281
1282 _TH=sizerL->GetMinSize().y + sizerR->GetMinSize().y;
1283
1284 SetSizer(globalSizerH);
1285
1286 EnableCustom();
1287
1288 }
1289 if (n==3) { // info tab (about, trackball instructions, and a button for advanced properties)
1290
1291 wxSizer *sizerA = new wxBoxSizer(wxVERTICAL);
1292 sizerA->Add(new wxStaticText(this, wxID_ANY,_T("by"))
1293 ,0, wxALIGN_CENTER );
1294 sizerA->Add(new wxStaticText(this, wxID_ANY,_T("Marco Tarini"))
1295 ,0, wxALIGN_CENTER );
1296 sizerA->Add(new wxStaticText(this, wxID_ANY,_T("and"))
1297 ,0, wxALIGN_CENTER );
1298 sizerA->Add(new wxStaticText(this, wxID_ANY,_T("Paolo Cignoni"))
1299 ,0, wxALIGN_CENTER );
1300
1301
1302 wxSizer *sizerB = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _T("Instructions") ), wxVERTICAL);
1303 sizerB->Add(new wxStaticText(this, wxID_ANY,_T("\
1304 Left Mouse Button: rotate molecule\n\
1305 Mouse wheel / Shift+Left: zoom molecule\n\
1306 Middle Mouse / Ctrl+Left Mouse : pan molecule\n\
1307 Right Mouse Button: move Light\n\
1308 "), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER)
1309 ,0, wxALIGN_CENTER );
1310
1311
1312 wxSizer *sizerC = new wxBoxSizer( wxHORIZONTAL);
1313 wxStaticBitmap *bitmap = new wxStaticBitmap(this, wxID_ANY, *LoadPngImage(_T("logo")), wxDefaultPosition );
1314 sizerC->Add(bitmap, 0, wxALIGN_BOTTOM);
1315 sizerC->Add(1,1,1);
1316 sizerC->Add(new wxStaticText(this, wxID_ANY,
1317 _T("ver 0.4.1 ("__DATE__")")
1318 ),0, wxALIGN_BOTTOM|wxALL,10);
1319
1320 wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
1321 sizer->Add(1,1,1);
1322 sizer->Add(sizerA,0, wxEXPAND|wxLEFT|wxRIGHT,10);
1323 sizer->Add(1,1,1);
1324 sizer->Add(
1325 new wxButton(this, ID_WebButton, /*_T("visit ")+*/qutemolwebsite )
1326 ,0, wxALIGN_CENTER|wxALL/*|wxEXPAND,10*/);
1327 sizer->Add(1,1,1);
1328
1329 sizer->Add(sizerB,0, wxEXPAND|wxLEFT|wxRIGHT,10);
1330 sizer->Add(1,1,1);
1331 sizer->Add(sizerC,0, wxEXPAND);
1332
1333 SetSizer(sizer);
1334 }
1335 }
1336
1337 bool MyTab::Redispose(int wy){
1338 bool res=false;
1339 if (globalSizerH) {
1340 if (_TH<wy) {
1341 if (globalSizerH->Detach(sizerR)) {
1342 globalSizerV->Detach(sizerL);
1343 globalSizerV->Add(sizerL,1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP,10);
1344 globalSizerV->Add(sizerR,1, wxEXPAND|wxLEFT|wxRIGHT,10);
1345 res=true;
1346 }
1347 }
1348 else
1349 {
1350 if (globalSizerV->Detach(sizerR)) {
1351 globalSizerV->Detach(sizerL);
1352 globalSizerV->Add(sizerL,1, wxEXPAND);
1353 globalSizerH->Add(sizerR,1, wxEXPAND|wxLEFT, 5);
1354 res=true;
1355 }
1356 }
1357 globalSizerV->Layout();
1358 globalSizerV->CalcMin();
1359 globalSizerV->RecalcSizes();
1360 globalSizerH->Layout();
1361 globalSizerH->CalcMin();
1362 globalSizerH->RecalcSizes();
1363 }
1364 return res;
1365 }
1366
1367 void MyTab::UpdateAll(){
1368 setSceneBgcolor( col(cgSettings.P_bg_color_R,cgSettings.P_bg_color_G, cgSettings.P_bg_color_B) );
1369 int k=(int)(cgSettings.P_halo_col*255.0);
1370 buttonChooseHAcolor->SetBackgroundColour(wxColor(k,k,k));
1371 sliderTable.UpdateAll();
1372 buttonTable.UpdateAll();
1373 //EnableGeom();
1374 EnableCustom();
1375 }
1376