1 /*
2  *  (c) 2004 Iowa State University
3  *      see the LICENSE file in the top level directory
4  */
5 
6 /*	PrefPanes.h    -- on wxWidgets
7 */
8 
9 #ifndef __PrefPanes__
10 #define __PrefPanes__
11 
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma interface "PrefsPanes.h"
14 #endif
15 
16 /*!
17  * Includes
18  */
19 
20 ////@begin includes
21 #include "wx/wx.h"
22 #include <wx/bookctrl.h>
23 #include <wx/fontdlg.h>
24 #include "MolDisplayWin.h"
25 #include <wx/spinctrl.h>
26 ////@end includes
27 
28 class colorArea;
29 class colorPatternArea;
30 
31 #define NUM_ATOM_LABELS 6
32 
33 class PrefsPane : public wxPanel {
34 	public:
35 		//Constructor should add the needed pane items and do one time inits
36 		PrefsPane(MolDisplayWin* targetWindow, WinPrefs* targetPrefs, short PaneID, Boolean GlobalPrefs, wxBookCtrlBase *parent);
37 
38 		~PrefsPane();
39 
40 		//setupitems should do all inits that might/can be done more than once
41 		//like setting control values
42 		virtual void SetupPaneItems(MolDisplayWin* targetWindow)=0;
43 
44 		virtual void saveToTempPrefs()=0;
45 
PrefsAreGlobal(void)46 		Boolean PrefsAreGlobal(void) {return isGlobalPrefs;};
47 
48 	private:
49 		Boolean isGlobalPrefs;
50 
51 	protected:
52 		WinPrefs* mTargetPrefs;
53 };
54 
55 class AtomPrefsPane : public PrefsPane {
56 	public:
57 		AtomPrefsPane(MolDisplayWin* targetWindow, wxBookCtrlBase *parent, WinPrefs* targetPrefs, Boolean GlobalPrefs);
58 		~AtomPrefsPane();
59 		virtual void SetupPaneItems(MolDisplayWin* targetWindow);
60 		virtual void saveToTempPrefs();
61 
62 	private:
63 		wxScrolledWindow *scroll_win;
64 		short	ActiveEdit;
65 		wxString mLabels[NUM_ATOM_LABELS];
66 
67 		wxFlexGridSizer* mMainSizer;
68 
69 		wxTextCtrl* mEleNames[kMaxAtomTypes];
70 		wxTextCtrl* mEleSizes[kMaxAtomTypes];
71 		wxTextCtrl* mEleMasses[kMaxAtomTypes];
72 		colorArea* mColorArea[kMaxAtomTypes];
73 		colorPatternArea* mPatternArea[kMaxAtomTypes];
74 };
75 
76 
77 class BondPrefsPane : public PrefsPane {
78 	public:
79 		BondPrefsPane(MolDisplayWin* targetWindow, wxBookCtrlBase *parent, WinPrefs* targetPrefs, Boolean GlobalPrefs);
80 		~BondPrefsPane();
81 		virtual void SetupPaneItems(MolDisplayWin* targetWindow);
82 		virtual void saveToTempPrefs();
83 
84 		/// Event handler for the bond order choice
85 		void OnChoice( wxCommandEvent &event );
86 		/// Event handler for the normal mode sclaing slider
87 		void OnSliderUpdate( wxCommandEvent &event);
88 		/// Event handler for the Gradient scaling slider
89 		void OnGradientSliderUpdate(wxCommandEvent & event);
90 		/// Event Handler for Gradient display radio box
91 		void OnGradientRadioUpdate(wxCommandEvent & event);
92 		void OnToggleAnim(wxCommandEvent& event);
93 		void OnToggleRotation(wxCommandEvent& event);
94 
95 	private:
96 		wxCheckBox* mChkAnim;
97 		wxCheckBox* mChkRotation;
98 		wxRadioBox* mGradientBox;
99 		wxSlider* mSldScale;
100 		wxSlider* mGradientSlider;
101 		wxChoice* mBondChoice;
102 		colorArea *mColorArea, *mNormColorArea, *mGradientColorArea;
103 
104 		int mChoiceId;
105 
106 		DECLARE_EVENT_TABLE()
107 };
108 
109 class DisplayPrefsPane : public PrefsPane {
110 	public:
111 		DisplayPrefsPane(MolDisplayWin* targetWindow, wxBookCtrlBase *parent, WinPrefs* targetPrefs, Boolean GlobalPrefs);
112 		virtual void SetupPaneItems(MolDisplayWin* targetWindow);
113 		virtual void saveToTempPrefs();
114 
115 		void OnRadio( wxCommandEvent &event );
116 		void OnLabelsRadio( wxCommandEvent &event );
117 		void OnCheckBox( wxCommandEvent& WXUNUSED(event));
118 		void OnAtomLabelSlider(wxCommandEvent &event);
119 		void OnAnnotationLabelSlider(wxCommandEvent &event);
120 
121 	private:
122 		wxBoxSizer* mMainSizer;
123 
124 		wxRadioBox* mRdoBox;
125 		wxCheckBox* mChkColor;
126 		wxRadioBox*	mAtomLabels;
127 		wxSlider*	mAtomLabelSizeSlider;
128 		wxSlider*	mAnnotationLabelSizeSlider;
129 
130 		DECLARE_EVENT_TABLE()
131 };
132 
133 
134 class EnergyPrefsPane : public PrefsPane {
135 	public:
136 		EnergyPrefsPane(MolDisplayWin* targetWindow, wxBookCtrlBase *parent, WinPrefs* targetPrefs, Boolean GlobalPrefs);
137 		~EnergyPrefsPane();
138 		virtual void SetupPaneItems(MolDisplayWin* targetWindow);
139 		virtual void saveToTempPrefs();
140 
141 		void OnSliderUpdate( wxCommandEvent &WXUNUSED(event) );
142 		void OnRadio( wxCommandEvent &event );
143 		void OnCheckBox( wxCommandEvent& event);
144 
145 	private:
146 
147 		void setHiddenCtrls();
148 
149 		wxBoxSizer* mMainSizer;
150 		wxBoxSizer* mUpperSizer;
151 		wxGridSizer* mLowerSizer;
152 		wxBoxSizer* mBottomSizer;
153 		wxBoxSizer* mLeftBottomSizer;
154 		wxBoxSizer* mRightBottomSizer;
155 		wxGridSizer* mRight1BottomSizer;
156 		wxGridSizer* mRight2BottomSizer;
157 
158 		wxSlider* mSldBallSize;
159 		wxTextCtrl* mNumDigitsArea;
160 		colorArea* mEColor;
161 		colorArea* mMPColor;
162 		colorArea* mPEColor;
163 		colorArea* mOtherColor;
164 		wxTextCtrl* mY1pt;
165 		wxTextCtrl* mY2pt;
166 		wxCheckBox* mTotalEny;
167 		wxCheckBox* mMP2Eny;
168 		wxCheckBox* mPotEny;
169 		wxRadioBox* mRdoUnit;
170 		wxRadioBox* mRdoMisc;
171 		wxTextCtrl* mAtomText[3];
172 
173 		short	ActiveEdit;
174 
175 		DECLARE_EVENT_TABLE()
176 };
177 
178 
179 class FilePrefsPane : public PrefsPane {
180 	public:
181 		FilePrefsPane(MolDisplayWin* targetWindow, wxBookCtrlBase *parent, WinPrefs* targetPrefs, Boolean GlobalPrefs);
182 		virtual void SetupPaneItems(MolDisplayWin* targetWindow);
183 		virtual void saveToTempPrefs();
184 
185 		void OnCheckBox( wxCommandEvent& WXUNUSED(event));
186 		void OnSliderUpdate( wxCommandEvent &WXUNUSED(event) );
187 
188 	private:
189 		wxBoxSizer* mMainSizer;
190 
191 		wxCheckBox* mChkBox[9];
192 		wxSlider* mSldTol;
193 		wxTextCtrl* mPointSkip;
194 
195 		short	ActiveEdit;
196 		DECLARE_EVENT_TABLE()
197 };
198 
199 
200 class ScalingPrefsPane : public PrefsPane {
201 	public:
202 		ScalingPrefsPane(MolDisplayWin* targetWindow, wxBookCtrlBase *parent, WinPrefs* targetPrefs, Boolean GlobalPrefs);
203 		virtual void SetupPaneItems(MolDisplayWin* targetWindow);
204 		virtual void saveToTempPrefs();
205 
206 		void OnSliderUpdate( wxCommandEvent &event );
207 
208 	private:
209 		wxFlexGridSizer* mMainSizer;
210 
211 		wxSlider* mSld[3];
212 
213 		DECLARE_EVENT_TABLE()
214 };
215 
216 
217 class StereoPrefsPane : public PrefsPane {
218 	public:
219 		StereoPrefsPane(MolDisplayWin* targetWindow, wxBookCtrlBase *parent, WinPrefs* targetPrefs, Boolean GlobalPrefs);
220 		virtual void SetupPaneItems(MolDisplayWin* targetWindow);
221 		virtual void saveToTempPrefs();
222 
223 		void OnCheckBox( wxCommandEvent& WXUNUSED(event));
224 
225 	private:
226 		wxBoxSizer* mMainSizer;
227 		wxBoxSizer* mMiddleSizer;
228 
229 		wxCheckBox* mChkActive;
230 		wxTextCtrl* mOffDegree;
231 
232 		short	ActiveEdit;
233 
234 		DECLARE_EVENT_TABLE()
235 };
236 
237 
238 class SurfacePrefsPane : public PrefsPane {
239 	public:
240 		SurfacePrefsPane(MolDisplayWin* targetWindow, wxBookCtrlBase *parent, WinPrefs* targetPrefs, Boolean GlobalPrefs);
241 		~SurfacePrefsPane();
242 		virtual void SetupPaneItems(MolDisplayWin* targetWindow);
243 		virtual void saveToTempPrefs();
244 
245 		void OnCheckBox( wxCommandEvent& event);
246 		void OnSliderUpdate( wxCommandEvent &event );
247 
248 	private:
249 		wxBoxSizer* mMainSizer;
250 		wxBoxSizer* mLeftSizer;
251 		wxBoxSizer* mRightSizer;
252 		wxGridSizer* mLeftMidSizer;
253 		wxBoxSizer* mRightUpperSizer;
254 		wxFlexGridSizer* mRightMidSizer;
255 
256 		colorArea* mSurfColor[2];
257 		wxSlider* mSldGridPoint;
258 		wxSlider* mSldGridSize;
259 		wxTextCtrl* mNumContour;
260 		wxTextCtrl* mMaxContourValue;
261 		wxCheckBox* mZeroContour;
262 		wxCheckBox* mAtomPosition;
263 
264 		short	ActiveEdit;
265 
266 		DECLARE_EVENT_TABLE()
267 };
268 
269 
270 class QD3DPrefsPane : public PrefsPane {
271 	public:
272 		QD3DPrefsPane(MolDisplayWin* targetWindow, wxBookCtrlBase *parent, WinPrefs* targetPrefs, Boolean GlobalPrefs);
273 		virtual void SetupPaneItems(MolDisplayWin* targetWindow);
274 		virtual void saveToTempPrefs();
275 
276 		void OnShaderChoice(wxCommandEvent& event);
277 		void OnSliderUpdate( wxCommandEvent &event );
278 		void OnSpinChange(wxSpinEvent & event);
279 
280 	private:
281 		wxFlexGridSizer *mMainSizer;
282 
283 		colorArea* mBackgrdColor;
284 		wxChoice *mShaderChooser;
285 		wxSlider* mSld[6];
286 		wxCheckBox* mAutoRotateCheck;
287 
288 		DECLARE_EVENT_TABLE()
289 };
290 
291 #endif
292