Debian Codegraph @

src/MyTab.cpp

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