/* This file is part of moth. moth is a program for creating and editing textured 3D models. Copyright (C) 2004 Peter Uray. moth is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. moth is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with moth; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __MPREFERENCES_H__ #define __MPREFERENCES_H__ #include class MPreferences { public: static void initialize(void); static MPreferences *get(void); bool writePreferences(void); bool readPreferences(void); void setToDefault(void); // Data access methods // Global data: inline QString getDocumentFile(void) { return _documentFile; } inline void setDocumentFile(const char *file) { _documentFile = file; } // General tab inline int getUndoSteps(void) { return _undoSteps; } inline void setUndoSteps(int value) { _undoSteps = value; } inline QString getProjectLocation(void) { return _projectLocation; } inline void setProjectLocation(const char *value) { _projectLocation = value; } // Grid / units tab inline float getGridX(void) { return _gridX; } inline float getGridY(void) { return _gridY; } inline float getGridZ(void) { return _gridZ; } inline void setGridPosition(float x, float y, float z) { _gridX = x; _gridY = y; _gridZ = z; } inline float getGridDX(void) { return _gridDX; } inline float getGridDY(void) { return _gridDY; } inline float getGridDZ(void) { return _gridDZ; } inline void setGridDistances(float dx, float dy, float dz) { _gridDX = dx; _gridDY = dy; _gridDZ = dz; } inline float getSnapX(void) { return _snapX; } inline float getSnapY(void) { return _snapY; } inline float getSnapZ(void) { return _snapZ; } inline void setSnap(float x, float y, float z) { _snapX = x; _snapY = y; _snapZ = z; } inline float getAngleSnapX(void) { return _snapAngleX; } inline float getAngleSnapY(void) { return _snapAngleY; } inline float getAngleSnapZ(void) { return _snapAngleZ; } inline void setSnapAngles(float x, float y, float z) { _snapAngleX = x; _snapAngleY = y; _snapAngleZ = z; } inline bool getDisplayXY(void) { return _displayXY; } inline void setDisplayXY(bool value) { _displayXY = value; } inline bool getDisplayYZ(void) { return _displayYZ; } inline void setDisplayYZ(bool value) { _displayYZ = value; } inline bool getDisplayZX(void) { return _displayZX; } inline void setDisplayZX(bool value) { _displayZX = value; } inline bool getDisplayAxes(void) { return _displayAxes; } inline void setDisplayAxes(bool value) { _displayAxes = value; } inline bool getSnap(void) { return _snap; } inline void setSnap(bool value) { _snap = value; } inline bool getSnapAngles(void) { return _snapAngles; } inline void setSnapAngles(bool value) { _snapAngles = value; } inline float getSize(void) { return _size; } inline void setSize(float value) { _size = value; } inline int getTexSize(void) { return _texSize; } inline void setTexSize(int value) { _texSize = value; } // Camera tab inline float getCameraAngle(void) { return _angle; } inline void setCameraAngle(float value) { _angle = value; } inline float getNCD(void) { return _ncd; } inline void setNCD(float value) { _ncd = value; } inline float getFCD(void) { return _fcd; } inline void setFCD(float value) { _fcd = value; } inline float getRDefault(void) { return _rDefault; } inline void setRDefault(float value) { _rDefault = value; } inline float getPhiDefault(void) { return _phiDefault; } inline void setPhiDefault(float value) { _phiDefault = value; } inline float getThetaDefault(void) { return _thetaDefault; } inline void setThetaDefault(float value) { _thetaDefault = value; } protected: MPreferences(void); virtual ~MPreferences(void); QString getPreferenceFileLocation(void); int extractParami(const char *line); float extractParamf(const char *line); void extractParam3f(const char *line, float *x, float *y, float *z); QString extractParams(const char *line); static MPreferences *_this; // Data fields: // Global data QString _documentFile; // General tab int _undoSteps; QString _projectLocation; // Grid / units tab float _gridX; float _gridY; float _gridZ; float _gridDX; float _gridDY; float _gridDZ; float _snapX; float _snapY; float _snapZ; float _snapAngleX; float _snapAngleY; float _snapAngleZ; bool _displayXY; bool _displayYZ; bool _displayZX; bool _displayAxes; bool _snap; bool _snapAngles; float _size; int _texSize; // Camera tab float _angle; float _ncd; float _fcd; float _rDefault; float _phiDefault; float _thetaDefault; }; #endif