1 /*
2  *  (c) 2004-2006 Iowa State University
3  *      see the LICENSE file in the top level directory
4  */
5 
6 /* Prefs.h
7 
8 	classes related to display and other user definable preferences.
9 
10 	BMB 4/1998
11 	Added flag for setting creator type, BMB 1/2001
12 	Fixed 2 prefs accessors to return true boolean values, BMB 9/2001
13 	All prefs accessors should now return true boolean values, BMB 11/2001
14 */
15 
16 #ifndef __Prefs__
17 #define __Prefs__
18 
19 #ifdef __wxBuild__
20 #include "wx/wx.h"
21 
22 #endif
23 
24 class SurfaceOptions {
25 	private:
26 		long			NumContours;		// Max. # of contours (+ or -) in 2D map
27 		long			NumGridPoints;		// Default # of grid points
28 		float			GridSize;			// size of grid box
29 		float			MaxContourValue;	// Maximum 2D contour value;
30 		RGBColor		PosColor;			// color for + part of contour
31 		RGBColor		NegColor;			// color for - part of contour
32 		char			Options;			// bit 1 - show zero value contour
33 											// bit 2 - rotate 2D map
34 											// bit 3 - show 2D hash marks
35 	public:
SurfaceOptions()36 		SurfaceOptions() { Options = 0; }
GetNumContours(void)37 		long GetNumContours(void) const {return NumContours;};
38 		long SetNumContours(long NewNum);
GetNumGridPoints(void)39 		long GetNumGridPoints(void) const {return NumGridPoints;};
40 		long SetNumGridPoints(long NewNum);
GetGridSize(void)41 		float GetGridSize(void) const {return GridSize;};
42 		float SetGridSize(float NewSize);
GetMaxContour(void)43 		float GetMaxContour(void) const {return MaxContourValue;};
44 		float SetMaxContour(float NewMax);
GetPosColor(RGBColor * Color)45 		void GetPosColor(RGBColor *Color) const {*Color = PosColor;};
SetPosColor(RGBColor * Color)46 		void SetPosColor(RGBColor *Color) {PosColor = *Color;};
47 #ifndef __wxBuild__
SetPosColor(void)48 		void SetPosColor(void) const {RGBForeColor(&PosColor);};
49 #endif
GetNegColor(RGBColor * Color)50 		void GetNegColor(RGBColor *Color) const {*Color = NegColor;};
SetNegColor(RGBColor * Color)51 		void SetNegColor(RGBColor *Color) {NegColor = *Color;};
52 #ifndef __wxBuild__
SetNegColor(void)53 		void SetNegColor(void) const {RGBForeColor(&NegColor);};
54 #endif
SetPosColor(const RGBColor & color)55 		void SetPosColor(const RGBColor & color) {PosColor = color;};
SetNegColor(const RGBColor & color)56 		void SetNegColor(const RGBColor & color) {NegColor = color;};
57 
GetShowZeroContour(void)58 		bool GetShowZeroContour(void) const {return (Options & 1);};
59 		bool SetShowZeroContour(bool State);
GetRotate2DMap(void)60 		bool GetRotate2DMap(void) const {return ((Options & (1<<1))?true:false);};
61 		bool SetRotate2DMap(bool State);
Get2DHashMarks(void)62 		bool Get2DHashMarks(void) const {return ((Options & (1<<2))?true:false);};
63 		bool Set2DHashMarks(bool State);
64 };
65 
66 class EnergyOptions {
67 	public:
EnergyOptions(void)68 	EnergyOptions(void) {nDigits=4; eUnits=kDefault; PlotFlag=0;};
PlotEnergy(void)69 		bool PlotEnergy(void) const {return (PlotFlag & 1);};
PlotMPEnergy(void)70 		bool PlotMPEnergy(void) const {return ((PlotFlag & 2)?true:false);};
PlotKEnergy(void)71 		bool PlotKEnergy(void) const {return ((PlotFlag & 4)?true:false);};
PlotPEnergy(void)72 		bool PlotPEnergy(void) const {return ((PlotFlag & 8)?true:false);};
PlotOther(void)73 		bool PlotOther(void) const {return ((PlotFlag & 32)?true:false);};
GetDisplayUnits(void)74 		EnergyUnit GetDisplayUnits(void) const {return eUnits;};
SetPlotEnergy(bool State)75 		void SetPlotEnergy(bool State) {if (PlotFlag & 1) PlotFlag--; if (State) PlotFlag++;};
SetPlotMPEnergy(bool State)76 		void SetPlotMPEnergy(bool State) {if (PlotFlag & 2) PlotFlag-=2; if (State) PlotFlag+=2;};
SetPlotKEnergy(bool State)77 		void SetPlotKEnergy(bool State) {if (PlotFlag & 4) PlotFlag-=4; if (State) PlotFlag+=4;};
SetPlotPEnergy(bool State)78 		void SetPlotPEnergy(bool State) {if (PlotFlag & 8) PlotFlag-=8; if (State) PlotFlag+=8;};
SetDisplayUnits(EnergyUnit NewUnits)79 		void SetDisplayUnits(EnergyUnit NewUnits) {eUnits = NewUnits;};
SetPlotOther(bool State)80 		void SetPlotOther(bool State) {PlotFlag = (PlotFlag & 0xDF) + (State?32:0);};
GetY1Zero(void)81 		float GetY1Zero(void) const {return y1Zero;};
GetY2Zero(void)82 		float GetY2Zero(void) const {return y2Zero;};
SetY1Zero(float NewValue)83 		void SetY1Zero(float NewValue) {y1Zero = NewValue;};
SetY2Zero(float NewValue)84 		void SetY2Zero(float NewValue) {y2Zero = NewValue;};
85 		/// Get the number of digits to print as labels
GetNumDigits(void)86 		short GetNumDigits(void) const {return nDigits;};
87 		/// Set the number of digits to print as labels ( > 0)
SetNumDigits(const short & newValue)88 		void SetNumDigits(const short & newValue) {
89 			if ((newValue>0)&&(newValue<20)) nDigits = newValue;};
90 		/// Get the screen space indicator point size
GetEPlotPointSize(void)91 		long GetEPlotPointSize(void) const {return EPlotBallSize;};
92 		///Set the screen space indicator size (1 to 20)
SetEPlotPointSize(const long & NewSize)93 		long SetEPlotPointSize(const long & NewSize) {
94 			if ((NewSize >= 1)&&(NewSize <= 20)) EPlotBallSize = NewSize;
95 			return EPlotBallSize;};
96 #ifndef __wxBuild__
SetTEColor(void)97 		void SetTEColor(void) {RGBForeColor(&TEColor);};
SetMPColor(void)98 		void SetMPColor(void) {RGBForeColor(&MPColor);};
SetKEColor(void)99 		void SetKEColor(void) {RGBForeColor(&KEColor);};
SetPEColor(void)100 		void SetPEColor(void) {RGBForeColor(&PEColor);};
101 #endif
SetTEColor(const RGBColor & color)102 		void SetTEColor(const RGBColor & color) {TEColor = color;};
SetMPColor(const RGBColor & color)103 		void SetMPColor(const RGBColor & color) {MPColor = color;};
SetKEColor(const RGBColor & color)104 		void SetKEColor(const RGBColor & color) {KEColor = color;};
SetPEColor(const RGBColor & color)105 		void SetPEColor(const RGBColor & color) {PEColor = color;};
106 
GetTEColorPtr(void)107 		const RGBColor * GetTEColorPtr(void) const {return &TEColor;};
GetMPColorPtr(void)108 		const RGBColor * GetMPColorPtr(void) const {return &MPColor;};
GetKEColorPtr(void)109 		const RGBColor * GetKEColorPtr(void) const {return &KEColor;};
GetPEColorPtr(void)110 		const RGBColor * GetPEColorPtr(void) const {return &PEColor;};
GetTEColor(void)111 		RGBColor * GetTEColor(void) {return &TEColor;};
GetMPColor(void)112 		RGBColor * GetMPColor(void) {return &MPColor;};
GetKEColor(void)113 		RGBColor * GetKEColor(void) {return &KEColor;};
GetPEColor(void)114 		RGBColor * GetPEColor(void) {return &PEColor;};
GetYAdjustment(void)115 		float GetYAdjustment(void) const {return yAdjustFactor;};
SetYAdjustment(float newval)116 		void SetYAdjustment(float newval) {yAdjustFactor = newval;};
117     private:
118 		float		y1Zero;
119 		float		y2Zero;
120 		float		yAdjustFactor;
121 		float		xAdjustFactor;
122 		long		EPlotBallSize;
123 		RGBColor	TEColor;
124 		RGBColor	MPColor;
125 		RGBColor	KEColor;
126 		RGBColor	PEColor;
127 		short		nDigits;
128 		EnergyUnit	eUnits;
129 		char		PlotFlag;	//indicates what to plot (1=TE,2=MP,3=KE,4=PE,5=kcal/mol,
130 								//6=other-use graph options)
131 };
132 
133 class GraphOptions {
134 	public:
GraphOptions(void)135 		GraphOptions(void) {Options=0; atom1 = atom2 = atom3 = atom4 = 0;};
PlotRMSGradient(void)136 		bool PlotRMSGradient(void) const {return (Options & 1);};
PlotMaxGradient(void)137 		bool PlotMaxGradient(void) const {return ((Options & 2)?true:false);};
PlotBondLength(void)138 		bool PlotBondLength(void) const {return ((Options & 4)?true:false);};
PlotBondAngle(void)139 		bool PlotBondAngle(void) const {return ((Options & 8)?true:false);};
PlotDihedral(void)140 		bool PlotDihedral(void) const {return ((Options & 16)?true:false);};
SetPlotRMSGradient(bool State)141 		void SetPlotRMSGradient(bool State) {Options = (Options & 0xFFFFFFFE) + (State?1:0);};
SetPlotMaxGradient(bool State)142 		void SetPlotMaxGradient(bool State) {Options = (Options & 0xFFFFFFFD) + (State?2:0);};
SetPlotBondLength(bool State)143 		void SetPlotBondLength(bool State) {Options = (Options & 0xFFFFFFFB) + (State?4:0);};
SetPlotBondAngle(bool State)144 		void SetPlotBondAngle(bool State) {Options = (Options & 0xFFFFFFF7) + (State?8:0);};
SetPlotDihedral(bool State)145 		void SetPlotDihedral(bool State) {Options = (Options & 0xFFFFFFEF) + (State?16:0);};
Get1stAtom(void)146 		long Get1stAtom(void) const {return atom1;};
Get2ndAtom(void)147 		long Get2ndAtom(void) const {return atom2;};
Get3rdAtom(void)148 		long Get3rdAtom(void) const {return atom3;};
Get4thAtom(void)149 		long Get4thAtom(void) const {return atom4;};
Set1stAtom(long a1)150 		void Set1stAtom(long a1) {atom1 = a1;};
Set2ndAtom(long a2)151 		void Set2ndAtom(long a2) {atom2 = a2;};
Set3rdAtom(long a3)152 		void Set3rdAtom(long a3) {atom3 = a3;};
Set4thAtom(long a4)153 		void Set4thAtom(long a4) {atom4 = a4;};
154 	private:
155 		long	Options;	//flags on what to plot: 1=rms, 2=max grad, 3=bond length,
156 							//4=bond angle, 5=dihedral
157 		long	atom1;
158 		long	atom2;
159 		long	atom3;
160 		long	atom4;
161 };
162 
163 class FrequencyWindowOptions {
164 private:
165 	float	YScaleFactor;
166 	bool	ShowRaman;
167 	bool	ShowIR;
168 public:
169 	FrequencyWindowOptions(void);
GetYScaleFactor(void)170 	float GetYScaleFactor(void) const {return YScaleFactor;};
SetYScaleFactor(const float & val)171 	void SetYScaleFactor(const float & val) {YScaleFactor = val;};
ShowRamanIntensity(void)172 	bool ShowRamanIntensity(void) const {return ShowRaman;};
ShowIRIntensity(void)173 	bool ShowIRIntensity(void) const {return ShowIR;};
ShowRamanIntensity(bool val)174 	void ShowRamanIntensity(bool val) {ShowRaman = val;};
ShowIRIntensity(bool val)175 	void ShowIRIntensity(bool val) {ShowIR = val;};
176 };
177 
178 typedef class XMLElement XMLElement;
179 typedef class wxString wxString;
180 
181 class WinPrefs {
182 	private:
183 		RGBColor		AtomColors[kMaxAtomTypes], BondColors[kMaxBondTypes], VectorColor, BackColor,
184 						GradientColor;	///< Color to be used for gradient vectors
185 		long			AtomSizes[kMaxAtomTypes], AnimateTime, DRCnFileSkip,
186 						QD3DAtomQuality, BitOptions;
187 				//bit 1: prompt4save, bit 2: show angles, bit 3: use QD3D hardware
188 				//bit 4: Stereo, bit 5: color bond halves, bit6: Wireframe mode
189 				//bit 7: Outline bonds, bit 8: Use cylinders for lines
190 				//bit 9: Look for H bonds, bit 10: determine bond order
191 				//bit 11: Default for 3D mode, bit 12: native EOL chars
192 				//bit 13: Create custom file icon, bit 14: Show 2D atom patterns
193 				//bit 15: Show EFP atoms in wireframe mode
194 
195 		float			AtomMasses[kMaxAtomTypes], AutoBondScale, BondWidth, AtomScale,
196 						GLFOV, VectorScale, QD3DFillBrightness, QD3DPointBrightness,
197 						MaxBondLength, QD3DLineWidth, AtomLabelSize, AnnotationLabelSize,
198 						GradientScale;		///< Scalefactor for the gradient display vectors
199 		short			AtomPatterns[kMaxAtomTypes], LabelFontID, LabelSize, VectorPattern,
200 						BondPatterns[kMaxBondTypes], AnimationSpeed, StereoOffset;
201 		unsigned char	AtomLabels[kMaxAtomTypes][3];
202 		char *			RendererName;
203 		Boolean			RotateMode, AnimateMode, AutoBondFlag, HHBondFlag, SetCreator;
204 		bool			FitToPage, CenterOnPage, FrameOnPage, SymbolLabels, NumberLabels, ShowSymOps,
205 						ShowGradient,		///< Toggle display of gradient
206 						FlipGradient,		///< Invert the gradient to display the force
207 						AutoRotating,		///< Is the window set to auto-rotate?
208 						AllowAutoRotation;	///< Flag to enable/disable autorotation
209 		EnergyOptions	EnergyPlotOptions;
210 		GraphOptions	PlotOptions;
211 		SurfaceOptions	SurfaceOpts;
212 		FrequencyWindowOptions	FreqWinOpts;
213 		bool show_toolbar;
214 		int shader_mode;
215 		int lineWidth, autoSpeedX, autoSpeedY, autoSpeedZ;
216 
217 	public:
218 		WinPrefs(void);
219 		~WinPrefs(void);
220 		void WriteUserPrefs(void) const;
221 		long WriteMMPPrefs(XMLElement * root) const;
222 		long ReadMMPPrefs(XMLElement * root);
223 		void ReadDefaultPrefs(void);
224 		void ReadUserPrefs_old(void);
225 		bool ReadUserPrefs(void);
226 		void resetAllDefaults(void);
227 		void ReadAtomDefaults(void);
228 		void ReadBondDefaults(void);
229 		void ReadDisplayDefaults(void);
230 		void ReadEnergyDefaults(void);
231 		void ReadFontDefaults(void);
232 		void ReadFileDefaults(void);
233 		void ReadScalingDefaults(void);
234 		void ReadStereoDefaults(void);
235 		void ReadSurfaceDefaults(void);
236 		void ReadQD3DDefaults(void);
237 		void CopyAtomPrefs(WinPrefs * Orig);
238 		void CopyBondPrefs(WinPrefs * Orig);
239 		void CopyDisplayPrefs(WinPrefs * Orig);
240 		void CopyEnergyPrefs(WinPrefs * Orig);
241 		void CopyFontPrefs(WinPrefs * Orig);
242 		void CopyFilePrefs(WinPrefs * Orig);
243 		void CopyScalingPrefs(WinPrefs * Orig);
244 		void CopySurfacePrefs(WinPrefs * Orig);
CopyStereoPrefs(WinPrefs * Orig)245 		inline void CopyStereoPrefs(WinPrefs * Orig) {UseStereo(Orig->UseStereo()); SetStereoOffset(Orig->GetStereoOffset());};
246 		void CopyQD3DPrefs(WinPrefs * Orig);
247 		void ReadFilePrefs(short fileRef);
248 		void WriteFilePrefs(short fileRef);
249 		void WriteAllPrefs(short FileRef);
GetFrequencyWindowOptions(void)250 		inline FrequencyWindowOptions * GetFrequencyWindowOptions(void) {return &FreqWinOpts;};
GetRendererName(void)251 		inline char * GetRendererName(void) const {return RendererName;};
252 		void SetRendererName(char * NewName);
Get2DHashMarks(void)253 		inline Boolean Get2DHashMarks(void) {return SurfaceOpts.Get2DHashMarks();};
GetPrompt4Save(void)254 		inline Boolean GetPrompt4Save(void) const {return (BitOptions & 1);};
SetPrompt4Save(Boolean State)255 		inline Boolean SetPrompt4Save(Boolean State) {if (BitOptions&1) BitOptions--; if (State) BitOptions++; return State;};
GetShowAngles(void)256 		inline Boolean GetShowAngles(void) const {return ((BitOptions&(1<<1)?true:false));};
SetShowAngles(Boolean state)257 		inline Boolean SetShowAngles(Boolean state) {if (BitOptions&(1<<1)) BitOptions-=(1<<1); if (state) BitOptions+=(1<<1); return state;};
UseQD3DHardware(void)258 		inline Boolean UseQD3DHardware(void) const {return ((BitOptions & (1<<2)?true:false));};
UseQD3DHardware(Boolean State)259 		inline void UseQD3DHardware(Boolean State) {BitOptions = (BitOptions & 0xFFFFFFFB) + (State?4:0);};
UseStereo(void)260 		inline Boolean UseStereo(void) const {return ((BitOptions & (1<<3))?true:false);};
UseStereo(Boolean State)261 		inline void UseStereo(Boolean State) {BitOptions = (BitOptions & 0xFFFFFFF7) + (State?8:0);};
ColorBondHalves(void)262 		inline Boolean ColorBondHalves(void) const {return ((BitOptions & (1<<4))?true:false);};
ColorBondHalves(Boolean State)263 		inline void ColorBondHalves(Boolean State) {BitOptions = (BitOptions & 0xFFFFFFEF) + (State?16:0);};
DrawBallnStick(void)264 		inline Boolean DrawBallnStick(void) const {return ((BitOptions & (1<<5))==0);};
DrawBallnStick(Boolean State)265 		inline void DrawBallnStick(Boolean State) {BitOptions = (BitOptions & 0xFFFFFFDF) + (State?0:32);};
DrawWireFrame(void)266 		inline Boolean DrawWireFrame(void) const {return ((BitOptions & (1<<5))?true:false);};
DrawWireFrame(Boolean State)267 		inline void DrawWireFrame(Boolean State) {BitOptions = (BitOptions & 0xFFFFFFDF) + (State?32:0);};
OutLineBonds(void)268 		inline Boolean OutLineBonds(void) const {return ((BitOptions & (1<<6))?true:false);};
OutLineBonds(Boolean State)269 		inline void OutLineBonds(Boolean State) {BitOptions = (BitOptions & 0xFFFFFFBF) + (State?64:0);};
CylindersForLines(void)270 		inline bool CylindersForLines(void) const {return ((BitOptions & (1<<7))?true:false); };
CylindersForLines(bool newVal)271 		inline void CylindersForLines(bool newVal) {BitOptions = (BitOptions & 0xFFFFFF7F) + (newVal?128:0);};
AllowHydrogenBonds(void)272 		inline Boolean AllowHydrogenBonds(void) const {return ((BitOptions & (1<<8))?true:false); };
AllowHydrogenBonds(Boolean newVal)273 		inline void AllowHydrogenBonds(Boolean newVal) {BitOptions = (BitOptions & 0xFFFFFEFF) + (newVal?256:0);};
DetermineBondOrder(void)274 		inline Boolean DetermineBondOrder(void) const {return ((BitOptions & (1<<9))?true:false); };
DetermineBondOrder(Boolean newVal)275 		inline void DetermineBondOrder(Boolean newVal) {BitOptions = (BitOptions & 0xFFFFFDFF) + (newVal?(1<<9):0);};
Default3DOn(void)276 		inline Boolean Default3DOn(void) const { return ((BitOptions & (1<<10))?true:false); };
Default3DOn(Boolean newVal)277 		inline void Default3DOn(Boolean newVal) {BitOptions = (BitOptions & 0xFFFFFBFF) + (newVal?(1<<10):0);};
GetCenterOnPage(void)278 		inline bool GetCenterOnPage(void) const {return CenterOnPage;};
SetCenterOnPage(bool v)279 		inline void SetCenterOnPage(bool v) {CenterOnPage = v;};
GetFitToPage(void)280 		inline bool GetFitToPage(void) const {return FitToPage;};
SetFitToPage(bool v)281 		inline void SetFitToPage(bool v) {FitToPage = v;};
GetFramePage(void)282 		inline bool GetFramePage(void) const {return FrameOnPage;};
SetFramePage(bool v)283 		inline void SetFramePage(bool v) {FrameOnPage = v;};
ShowAtomicSymbolLabels(void)284 		inline bool ShowAtomicSymbolLabels(void) const {return SymbolLabels;};
ShowAtomicSymbolLabels(bool v)285 		inline void ShowAtomicSymbolLabels(bool v) {SymbolLabels = v;};
ShowAtomNumberLabels(void)286 		inline bool ShowAtomNumberLabels(void) const {return NumberLabels;};
ShowAtomNumberLabels(bool v)287 		inline void ShowAtomNumberLabels(bool v) {NumberLabels = v;};
ShowSymmetryOperators(void)288 		inline bool ShowSymmetryOperators(void) const {return ShowSymOps;};
ShowSymmetryOperators(bool v)289 		inline void ShowSymmetryOperators(bool v) {ShowSymOps = v;};
290 		/// Flag to determine whether to show the first derivative of the energy (gradient)
DisplayGradient(void)291 		inline bool DisplayGradient(void) const {return ShowGradient;};
292 		/// Set function for display of the first derivative of the energy
DisplayGradient(bool v)293 		inline void DisplayGradient(bool v) {ShowGradient = v;};
294 		/// Flag to for inverting (-1) the first derivative of the energy to show the force
InvertGradient(void)295 		inline bool InvertGradient(void) const {return FlipGradient;};
296 		/// Set function for inverting of the first derivative of the energy to show the force
InvertGradient(bool v)297 		inline void InvertGradient(bool v) {FlipGradient = v;};
298 		/// Flag to determine wether to allow the auto rotate feature
AutoRotationEnabled(void)299 		inline bool AutoRotationEnabled(void) const {return AllowAutoRotation;};
300 		/// Set function to allow auto rotation via the click and drag method
EnableAutoRotation(bool v)301 		inline void EnableAutoRotation(bool v) {AllowAutoRotation = v;};
302 		/// Is the window set to be auto-rotating
isAutoRotating(void)303 		inline bool isAutoRotating(void) const {return AutoRotating;};
304 		/// Set function for the auto rotation feature
SetAutoRotating(bool v)305 		inline void SetAutoRotating(bool v) {AutoRotating = v;};
306 		/// Set the x, y and z components for the auto rotation direction
SetAutoRotationVector(int x,int y,int z)307 		inline void SetAutoRotationVector(int x, int y, int z) {autoSpeedX = x; autoSpeedY = y; autoSpeedZ = z;};
308 		/// Get the components for the auto rotation vector
GetAutoRotationVector(int & x,int & y,int & z)309 		inline void GetAutoRotationVector(int & x, int & y, int & z) {x = autoSpeedX; y = autoSpeedY; z = autoSpeedZ;};
310 		//Note the meaning of the Native EOL bit is reversed
NativeEOLChar(void)311 		inline bool NativeEOLChar(void) const {return ((BitOptions & (1<<11))?false:true); };
NativeEOLChar(bool newVal)312 		inline void NativeEOLChar(bool newVal) {BitOptions = (BitOptions & 0xFFFFF7FF) + (newVal?0:(1<<11));};
313 		//Set to indicate a custom thumbnail should be created when saving
CreateCustomIcon(void)314 		inline bool CreateCustomIcon(void) const {return ((BitOptions & (1<<12))?false:true); };
CreateCustomIcon(bool newVal)315 		inline void CreateCustomIcon(bool newVal) {BitOptions = (BitOptions & 0xFFFFEFFF) + (newVal?0:(1<<12));};
316 		//Set to overlay a 2D pattern on the atoms in ball and stick mode
Show2DPattern(void)317 		inline bool Show2DPattern(void) const {return ((BitOptions & (1<<13))?true:false); };
Show2DPattern(bool newVal)318 		inline void Show2DPattern(bool newVal) {BitOptions = (BitOptions & 0xFFFFDFFF) + (newVal?(1<<13):0);};
319 		/**
320 		 Display EFP atoms in wireframe mode
321 		 */
ShowEFPWireFrame(void)322 		inline bool ShowEFPWireFrame(void) const {return ((BitOptions & (1<<14))?true:false); };
323 		/**
324 		 Set the EFP atoms display mode.
325 		 @param newVal If true this will overide the general wireframe mode setting for EFP atoms.
326 		 */
ShowEFPWireFrame(bool newVal)327 		inline void ShowEFPWireFrame(bool newVal) {BitOptions = (BitOptions & 0xFFFFBFFF) + (newVal?(1<<14):0);};
ChangeFileType(void)328 		inline Boolean ChangeFileType(void) const {return (SetCreator); };
ChangeFileType(Boolean newVal)329 		inline void ChangeFileType(Boolean newVal) {SetCreator = (newVal != 0);};
GetStereoOffset(void)330 		inline short GetStereoOffset(void) const {return StereoOffset;};
SetStereoOffset(short newval)331 		inline void SetStereoOffset(short newval) {StereoOffset = newval;};
332 		/// Obtain the hi-res model space line width
GetQD3DLineWidth(void)333 		inline float GetQD3DLineWidth(void) const {return (CylindersForLines() ? QD3DLineWidth : 0.0F);};
334 		/// Set the hi-red model space line width (0 to 0.2)
SetQD3DLineWidth(float newVal)335 		inline void SetQD3DLineWidth(float newVal) {if ((newVal >= 0)&&(newVal<=0.2)) QD3DLineWidth = newVal;};
GetEnergyOptions(void)336 		inline EnergyOptions * GetEnergyOptions(void) {return &EnergyPlotOptions;};
GetGraphOptions(void)337 		inline GraphOptions * GetGraphOptions(void) {return &PlotOptions;};
GetSurfaceOptions(void)338 		inline SurfaceOptions * GetSurfaceOptions(void) {return &SurfaceOpts;};
339 		/// Set the maximum inter atomic distance to be considered a bond (>0)
SetMaxBondLength(const float & NewLength)340 		inline float SetMaxBondLength(const float & NewLength) {
341 			if (NewLength >= 0.0) MaxBondLength = NewLength;
342 			return MaxBondLength;};
343 		/// the maximum inter atomic distance to be deemed a bond
GetMaxBondLength(void)344 		inline float GetMaxBondLength(void) const {return MaxBondLength;}
345 		/// Obtain the model space bond width
GetQD3DBondWidth(void)346 		inline float GetQD3DBondWidth(void) const {return BondWidth;};
347 		/// Set the model space bond width (values 0.001 to 0.2)
SetQD3DBondWidth(float NewValue)348 		inline float SetQD3DBondWidth(float NewValue) {
349 			if ((NewValue>=0.001)&&(NewValue<=0.2)) BondWidth=NewValue;
350 			return BondWidth;};
351 		///Obtain the atom (ie sphere) quality for the 3D display
GetQD3DAtomQuality(void)352 		inline long GetQD3DAtomQuality(void) const {return QD3DAtomQuality;};
353 		///Set the # of divisions for 3D spheres (ie the quality). values should be between 2 and 40
SetQD3DAtomQuality(long NewValue)354 		inline long SetQD3DAtomQuality(long NewValue) {
355 			if ((NewValue >= 2)&&(NewValue <= 40)) QD3DAtomQuality = NewValue;
356 			return QD3DAtomQuality;};
357 		/// Obtain the fill light brightness
GetQD3DFillBrightness(void)358 		inline float GetQD3DFillBrightness(void) const {return QD3DFillBrightness;};
359 		/// Set the fill light brightness (0 to 1)
SetQD3DFillBrightness(float NewValue)360 		inline float SetQD3DFillBrightness(float NewValue) {
361 			if ((NewValue >= 0.0)&&(NewValue<=1.0)) QD3DFillBrightness = NewValue;
362 			return QD3DFillBrightness;};
363 		/// Obtain the point light brightness
GetQD3DPointBrightness(void)364 		inline float GetQD3DPointBrightness(void) const {return QD3DPointBrightness;};
365 		/// Set the point light brightness (0 to 1)
SetQD3DPointBrightness(float NewValue)366 		inline float SetQD3DPointBrightness(float NewValue) {
367 			if ((NewValue >= 0.0)&&(NewValue <= 1.0)) QD3DPointBrightness = NewValue;
368 			return QD3DPointBrightness;};
369 		/** Obtain the master atom size scale factor in model space.
370 		 * This includes the conversion from picometers to angstroms for the individual atom sizes.
371 		 */
GetAtomScale(void)372 		inline float GetAtomScale(void) const {return AtomScale;};
373 		/// Set the model space global atom (sphere) scale factor (0 - 0.025)
SetAtomScale(float NewValue)374 		inline float SetAtomScale(float NewValue) {
375 			if ((NewValue >= 0)&&(NewValue <= 0.025)) AtomScale=NewValue;
376 			return AtomScale;};
377 		//Note the GL FOV is really stored as FOV/2
GetGLFOV(void)378 		inline float GetGLFOV(void) const {return GLFOV;};
SetGLFOV(float NewValue)379 		inline float SetGLFOV(float NewValue) {return GLFOV=((NewValue>0)&&(NewValue<90)?NewValue:30);};
380 		/// Obtain the inter frame time delay for frame animations
GetAnimateTime(void)381 		inline long GetAnimateTime(void) const {return AnimateTime;};
382 		/// Set the interframe delay for frame animations (values should be between 0 and 120).
SetAnimateTime(long NewValue)383 		inline long SetAnimateTime(long NewValue) {
384 			if ((NewValue>=0)&&(NewValue<120)) AnimateTime=NewValue;
385 			return AnimateTime;};
386 		/// Obtain the normal mode animation quality value
GetAnimationSpeed(void)387 		inline short GetAnimationSpeed(void) const {return AnimationSpeed;};
388 		/// set the normal mode animation quality setting ( 1 to 16 )
SetAnimationSpeed(short NewValue)389 		inline short SetAnimationSpeed(short NewValue) {
390 			if ((NewValue>=1)&&(NewValue<=16)) AnimationSpeed=NewValue;
391 			return AnimationSpeed;};
GetAutoBond(void)392 		inline Boolean GetAutoBond(void) const {return AutoBondFlag;};
SetAutoBond(Boolean state)393 		inline Boolean SetAutoBond(Boolean state) {return AutoBondFlag = state;};
GetHHBondFlag(void)394 		inline Boolean GetHHBondFlag(void) const {return HHBondFlag;};
SetHHBondFlag(Boolean state)395 		inline Boolean SetHHBondFlag(Boolean state) {return HHBondFlag = state;};
396 		/// obtain the tolerance factor (like a percentage) for determining bonding
GetAutoBondScale(void)397 		inline float GetAutoBondScale(void) const {return AutoBondScale;};
398 		/// set the bonding tolerance factor (0.005 to 0.015)
SetAutoBondScale(const float & NewValue)399 		inline float SetAutoBondScale(const float & NewValue) {
400 			if ((NewValue>= 0.005)&&(NewValue <= 0.015)) AutoBondScale = NewValue;
401 			return AutoBondScale;};
402 		/// Obtain the model space size for atom labels
GetAtomLabelSize(void)403 		inline float GetAtomLabelSize(void) const {return AtomLabelSize;};
404 		/// Set the model space size for atom labels ( 0.25 to 4.0)
SetAtomLabelSize(const float & s)405 		inline void SetAtomLabelSize(const float & s) {if ((s>0.0)&&(s<= 4.0)) AtomLabelSize = s;};
406 		/// Obtain the model space size for atom labels
GetAnnotationLabelSize(void)407 		inline float GetAnnotationLabelSize(void) const {return AnnotationLabelSize;};
408 		/// Set the model space size for annotation labels ( 0.25 to 4.0)
SetAnnotationLabelSize(const float & s)409 		inline void SetAnnotationLabelSize(const float & s) {if ((s>0.0)&&(s<= 4.0)) AnnotationLabelSize = s;};
410 		/// Indicates how many geometries to skip between ones kept (normally 0)
GetDRCSkip(void)411 		inline long GetDRCSkip(void) const {return DRCnFileSkip;};
412 		/// Set the # of geometries to skip between ones kept (normally 0)
SetDRCSkip(long NewValue)413 		inline long SetDRCSkip(long NewValue) {if (NewValue >=0) DRCnFileSkip=NewValue; return DRCnFileSkip;};
GetLabelFontID(void)414 		inline short GetLabelFontID(void) const {return LabelFontID;};
SetLabelFontID(short NewID)415 		inline short SetLabelFontID(short NewID) {return LabelFontID=NewID;};
GetLabelSize(void)416 		inline short GetLabelSize(void) const {return LabelSize;};
SetLabelSize(short NewValue)417 		inline short SetLabelSize(short NewValue) {return LabelSize=NewValue;};
SetAtomColor(long AtomNum,const RGBColor & color)418 		inline void SetAtomColor(long AtomNum, const RGBColor & color) {AtomColors[AtomNum] = color; };
ToolbarShown()419 		inline bool ToolbarShown() const { return show_toolbar; }
420 		/* inline bool ToggleToolbar() { show_toolbar = !show_toolbar; } */
SetToolbarShown(bool enable)421 		inline void SetToolbarShown(bool enable) { show_toolbar = enable; }
GetShaderMode()422 		inline int GetShaderMode() const { return shader_mode; }
SetShaderMode(int mode)423 		inline void SetShaderMode(int mode) { shader_mode = mode; }
424 
425 		//void SetAtomPattern(long AtomNum);
SetAtomPattern(long AtomType,short pat)426 		void SetAtomPattern(long AtomType, short pat) {
427 		  AtomPatterns[AtomType] = pat;
428 		}
429 
GetAtomPattern(long AtomType)430 		short GetAtomPattern(long AtomType) const {
431 			if ((AtomType>=0)&&(AtomType<kMaxAtomTypes))
432 				return AtomPatterns[AtomType];
433 			return 0;
434 		};
GetAtomColorLoc(long AtomNum)435 		inline RGBColor * GetAtomColorLoc(long AtomNum) {return &(AtomColors[AtomNum]);};
GetAtomPatternLoc(long AtomNum)436 		inline short * GetAtomPatternLoc(long AtomNum) {return &(AtomPatterns[AtomNum]);};
GetBondColorLoc(long BondOrder)437 		inline RGBColor * GetBondColorLoc(long BondOrder) {return &(BondColors[BondOrder]);};
GetBondPatternLoc(long BondOrder)438 		inline short * GetBondPatternLoc(long BondOrder) {return &(BondPatterns[BondOrder]);};
GetVectorColorLoc(void)439 		inline RGBColor * GetVectorColorLoc(void) {return &VectorColor;};
GetGradientColorLoc(void)440 		inline RGBColor * GetGradientColorLoc(void) {return &GradientColor;};
GetBackgroundColorLoc(void)441 		inline RGBColor * GetBackgroundColorLoc(void) {return &BackColor;};
SetBackgroundColorLoc(const RGBColor & color)442 		inline void SetBackgroundColorLoc(const RGBColor & color) {BackColor = color;};
GetVectorPatternLoc(void)443 		inline short * GetVectorPatternLoc(void) {return &VectorPattern;};
444 		/// Changes the GL color to be the color for the specified bond order.
445 		void ChangeColorBondColor(long BondOrder) const;
446 		/// Changes the GL color to be the color for vectors
447 		void ChangeColorVectorColor(void) const;
448 		/// Changes the GL color to be the color for the gradient
449 		void ChangeColorGradientColor(void) const;
450 		/// Changes the GL color to be the color for the specified element with the optional alpha.
451 		void ChangeColorAtomColor(long atomtype, float alpha = 1.0) const;
452 		/// Compute the color space inverse for the specified element.
453 		/**
454 		 * @param[in] atomtype The atomic number for the desired element
455 		 * @param[out] rgb A vector of three floats (red, green, blue) that will contain the result upon exit.
456 		 */
457 		void GetAtomColorInverse(long atomtype, float rgb[3]) const;
SetBondColor(long BondOrder,const RGBColor & color)458 		inline void SetBondColor(long BondOrder, const RGBColor & color) {BondColors[BondOrder] = color;};
SetVectorColor(const RGBColor & color)459 		inline void SetVectorColor(const RGBColor & color) {VectorColor = color; };
460 		void SetBondPattern(long BondOrder);
461 		void SetVectorPattern(void);
462 		/// Obtain the normal mode length scale factor
GetVectorScale(void)463 		inline float GetVectorScale(void) const {return VectorScale;};
464 		/// Set the normal mode length scale factor (0.1 to 2.5)
SetVectorScale(float NewValue)465 		inline float SetVectorScale(float NewValue) {
466 			if ((NewValue >= 0.1)&&(NewValue<= 2.5)) VectorScale = NewValue;
467 			return VectorScale;};
468 		/// Obtain the gradient vector length scale factor
GetGradientScale(void)469 		inline float GetGradientScale(void) const {return GradientScale;};
470 		/// Set the gradient length scale factor
SetGradientScale(float NewValue)471 		inline float SetGradientScale(float NewValue) {
472 			if ((NewValue >= 0.01)&&(NewValue<= 2000000.0)) GradientScale = NewValue;
473 			return GradientScale;};
GetAtomLabelLoc(void)474 		inline unsigned char * GetAtomLabelLoc(void) {return &(AtomLabels[0][0]);};
475 		void GetAtomLabel(long AtomNum, Str255 text);
476 #ifdef __wxBuild__
477 		void GetAtomLabel(long AtomNum, wxString & text) const;
478 		void SetAtomLabel(long AtomNum, const wxString& text);
479 #endif
480 		void SetAtomLabel(long AtomNum, Str255 text);
GetAtomSizeLoc(void)481 		inline long * GetAtomSizeLoc(void) {return AtomSizes;};
GetAtomSize(long AtomNum)482 		inline long GetAtomSize(long AtomNum) const {return AtomSizes[AtomNum];};
483 		long SetAtomSize(long AtomNum, long NewSize);
GetAtomMassLoc(void)484 		inline float * GetAtomMassLoc(void) {return AtomMasses;};
GetAtomMass(long AtomNum)485 		inline float GetAtomMass(long AtomNum) const {return (AtomMasses[AtomNum]*AtomMasses[AtomNum]);};
GetSqrtAtomMass(long AtomNum)486 		inline float GetSqrtAtomMass(long AtomNum) const {return AtomMasses[AtomNum];};
487 		float SetAtomMass(long AtomNum, float NewMass);
GetRotateMode(void)488 		inline Boolean GetRotateMode(void) const {return RotateMode;};
SetRotateMode(Boolean state)489 		inline Boolean SetRotateMode(Boolean state) {return RotateMode = state;};
GetAnimateMode(void)490 		inline Boolean GetAnimateMode(void) const {return AnimateMode;};
SetAnimateMode(Boolean state)491 		inline Boolean SetAnimateMode(Boolean state) {return AnimateMode=state;};
GetBitOpt()492 		inline long GetBitOpt() { return  BitOptions; } //for debugging
493 		unsigned char GetOxidationNumber(int atomic_number);
494 		void SetOxidationNumber(int atomic_number, int ox_num);
GetLineWidth(void)495 		int GetLineWidth(void) const {return lineWidth;};
SetLineWidth(int newVal)496 		void SetLineWidth(int newVal) {lineWidth = newVal;};
497 };
498 
499 //Simple class to save window visibility and positioning data
500 class WindowData {
501 public:
502 	WindowData();
503 	static void Validate(wxRect & t);
504 
505 	void WriteXML(XMLElement * parent) const;
506 	void ReadXML(XMLElement * parent);
507 
BondsWindowVisible()508 	bool BondsWindowVisible() const {return BondsVis;}
BondsWindowVisible(bool v)509 	void BondsWindowVisible(bool v) {BondsVis = v;}
CoordsWindowVisible()510 	bool CoordsWindowVisible() const {return CoordsVis;}
CoordsWindowVisible(bool v)511 	void CoordsWindowVisible(bool v) {CoordsVis = v;}
EnergyWindowVisible()512 	bool EnergyWindowVisible() const {return EnergyVis;}
EnergyWindowVisible(bool v)513 	void EnergyWindowVisible(bool v) {EnergyVis = v;}
FreqWindowVisible()514 	bool FreqWindowVisible() const {return FreqVis;}
FreqWindowVisible(bool v)515 	void FreqWindowVisible(bool v) {FreqVis = v;}
SurfacesWindowVisible()516 	bool SurfacesWindowVisible() const {return SurfacesVis;}
SurfacesWindowVisible(bool v)517 	void SurfacesWindowVisible(bool v) {SurfacesVis = v;}
InputBWindowVisible()518 	bool InputBWindowVisible() const {return InputBVis;}
InputBWindowVisible(bool v)519 	void InputBWindowVisible(bool v) {InputBVis = v;}
PrefsWindowVisible()520 	bool PrefsWindowVisible() const {return PrefVis;}
PrefsWindowVisible(bool v)521 	void PrefsWindowVisible(bool v) {PrefVis = v;}
ZMatWindowVisible()522 	bool ZMatWindowVisible() const {return ZMatVis;}
ZMatWindowVisible(bool v)523 	void ZMatWindowVisible(bool v) {ZMatVis = v;}
524 
GetMolWinRect()525 	const wxRect & GetMolWinRect() const {return MolWinRect;}
SetMolWinRect(const wxRect & v)526 	void SetMolWinRect(const wxRect & v) {MolWinRect = v;}
GetBondsWinRect()527 	const wxRect & GetBondsWinRect() const {return BondsWinRect;}
SetBondsWinRect(const wxRect & v)528 	void SetBondsWinRect(const wxRect & v) {BondsWinRect = v;}
GetCoordsWinRect()529 	const wxRect & GetCoordsWinRect() const {return CoordsWinRect;}
SetCoordsWinRect(const wxRect & v)530 	void SetCoordsWinRect(const wxRect & v) {CoordsWinRect = v;}
GetEnergyWinRect()531 	const wxRect & GetEnergyWinRect() const {return EnergyWinRect;}
SetEnergyWinRect(const wxRect & v)532 	void SetEnergyWinRect(const wxRect & v) {EnergyWinRect = v;}
GetFrequencyWinRect()533 	const wxRect & GetFrequencyWinRect() const {return FreqWinRect;}
SetFrequencyWinRect(const wxRect & v)534 	void SetFrequencyWinRect(const wxRect & v) {FreqWinRect = v;}
GetSurfacesWinRect()535 	const wxRect & GetSurfacesWinRect() const {return SurfacesWinRect;}
SetSurfacesWinRect(const wxRect & v)536 	void SetSurfacesWinRect(const wxRect & v) {SurfacesWinRect = v;}
GetInputBWinRect()537 	const wxRect & GetInputBWinRect() const {return InputBuilderRect;}
SetInputBWinRect(const wxRect & v)538 	void SetInputBWinRect(const wxRect & v) {InputBuilderRect = v;}
GetPrefsWinRect()539 	const wxRect & GetPrefsWinRect() const {return PreferenceWinRect;}
SetPrefsWinRect(const wxRect & v)540 	void SetPrefsWinRect(const wxRect & v) {PreferenceWinRect = v;}
GetZMatWinRect()541 	const wxRect & GetZMatWinRect() const {return ZMatRect;}
SetZMatWinRect(const wxRect & v)542 	void SetZMatWinRect(const wxRect & v) {ZMatRect = v;}
543 private:
544 	wxRect	MolWinRect;
545 	wxRect	BondsWinRect;
546 	wxRect	CoordsWinRect;
547 	wxRect	EnergyWinRect;
548 	wxRect	FreqWinRect;
549 	wxRect	SurfacesWinRect;
550 	wxRect	InputBuilderRect;
551 	wxRect	PreferenceWinRect;
552 	wxRect	ZMatRect;
553 	bool	BondsVis, CoordsVis, EnergyVis, FreqVis, SurfacesVis, InputBVis, PrefVis, ZMatVis;
554 };
555 
556 // New preferences classes below here..
557 /*
558 class FileOptions {
559 private:
560     long    DRCnFileSkip;
561     bool    SetCreator;
562     bool    CreateCustomFileIcon;
563     bool    Prompt4Save;
564     bool    EOLCharMode;
565     bool    SetBondOrder;
566     bool    CreateHBonds;
567 public:
568 //  FileOptions(void);
569     FileOptions(const FileOptions * source);
570 //  ~FileOptions(void);
571     bool SetFileCreator(void) const {return SetCreator;};
572     void SetFileCreator(bool v) {SetCreator = v;};
573     bool CreateCustomFileIconOnSave(void) const {return CreateCustomFileIcon;};
574     void CreateCustomFileIconOnSave(bool v) {CreateCustomFileIcon = v;};
575     bool GetPrompt4Save(void) const {return Prompt4Save;};
576     void SetPrompt4Save(bool v) {Prompt4Save = v;};
577     bool GetEOLCharMode(void) const {return EOLCharMode;};
578     void SetEOLCharMode(bool v) {EOLCharMode = v;};
579     bool DetermineBondOrder(void) const {return SetBondOrder;};
580     void DetermineBondOrder(bool v) {SetBondOrder = v;};
581     bool AllowHydrogenBonds(void) const {return CreateHBonds;};
582     void AllowHydrogenBonds(bool v) {CreateHBonds = v;};
583 };
584 
585 //class to hold various attributes related to elements
586 class AtomOptions {
587 private:
588     RGBColor    AtomColor;  //Ok should this stay the Carbon specific RGBColor or move to floats?
589     long        AtomicNumber;
590     long        AtomSize;
591     float       AtomMass;
592     string      AtomLabel;
593     short       AtomPattern;
594 public:
595 };
596 
597 class CoordWindowOptions {
598 private:
599     //Only thing I can think of is store the size and position for the window
600     Rect    CoordWindowRect;
601 public:
602 };
603 
604 class BondsWindowOptions {
605 private:
606     //Only thing I can think of is store the size and position for the window
607     Rect    BondsWindowRect;
608 public:
609 };
610 
611 class SurfaceWindowOptions {
612 private:
613     Rect            SurfaceWindowRect;
614     long            NumContours;        // Max. # of contours (+ or -) in 2D map
615     long            NumGridPoints;      // Default # of grid points
616     float           GridSize;           // size of grid box
617     float           MaxContourValue;    // Maximum 2D contour value;
618     RGBColor        PosColor;           // color for + part of contour
619     RGBColor        NegColor;           // color for - part of contour
620     char            Options;            // bit 1 - show zero value contour
621                                         // bit 2 - rotate 2D map
622                                         // bit 3 - show 2D hash marks
623 public:
624 };
625 */
626 
627 #endif
628