// preferences.hpp -- management of general preferences // // Written by Frederic Bouvier, started March 2002. // // Copyright (C) 2002 Frederic Bouvier - fredb@users.sourceforge.net // // This program 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. // // This program 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 this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // // $Id: preferences.hpp,v 1.11 2005/06/25 16:31:14 fredb2 Exp $ #ifndef _preferences_hpp_ #define _preferences_hpp_ #include #include class FGSD_Preferences { public: typedef std::list FileList; FGSD_Preferences(); ~FGSD_Preferences(); void load(); void save(); size_t historySize() const; std::string getFileFromHistory( size_t n ) const; size_t historyLength() const; void historyLength( size_t __len ); void addFileToHistory( const char *__file ); void addFileToHistory( const std::string &__file ); std::string outputPath() const; void outputPath( const char *__path ); void outputPath( const std::string &__path ); std::string fgRootPath() const; void fgRootPath( const char *__path ); void fgRootPath( const std::string &__path ); std::string fgSceneryPath() const; void fgSceneryPath( const char *__path ); void fgSceneryPath( const std::string &__path ); std::string fgCommandLine() const; void fgCommandLine( const char *__path ); void fgCommandLine( const std::string &__path ); int zoomLevel() const; void zoomLevel( int l ); bool showOutline() const; void showOutline( bool f ); bool showLevelCurve() const; void showLevelCurve( bool f ); bool showTiles() const; void showTiles( bool f ); bool showStatic() const; void showStatic( bool f ); bool showTileFrames() const; void showTileFrames( bool f ); std::string viewMode() const; void viewMode( const char *m ); void viewMode( const std::string &m ); bool showConstraints() const; void showConstraints( bool f ); bool showVertices() const; void showVertices( bool f ); bool showInfiniteEdges() const; void showInfiniteEdges( bool f ); double alphaValue() const; void alphaValue( double a ); size_t airportNumber() const; void airportNumber( size_t n ); std::string currentMainDirectory() const; void currentMainDirectory( const char * ); void currentMainDirectory( const std::string & ); std::string currentInputDirectory() const; void currentInputDirectory( const char * ); void currentInputDirectory( const std::string & ); private: size_t _historyLength; FileList _history; std::string _outputPath; std::string _fgRootPath; std::string _fgSceneryPath; std::string _fgCommandLine; int _zoomLevel; bool _showOutline; bool _showLevelCurve; bool _showTiles; bool _showStatic; bool _showTileFrames; std::string _viewMode; bool _showConstraints; bool _showVertices; bool _showInfiniteEdges; double _alphaValue; size_t _airportNumber; std::string _currentMainDirectory; std::string _currentInputDirectory; }; inline size_t FGSD_Preferences::historySize() const { return _history.size(); } inline size_t FGSD_Preferences::historyLength() const { return _historyLength; } inline void FGSD_Preferences::addFileToHistory( const char *__file ) { addFileToHistory( std::string( __file ) ); } inline std::string FGSD_Preferences::outputPath() const { return _outputPath; } inline void FGSD_Preferences::outputPath( const char *__path ) { _outputPath = __path; } inline void FGSD_Preferences::outputPath( const std::string &__path ) { _outputPath = __path; } inline std::string FGSD_Preferences::fgRootPath() const { return _fgRootPath; } inline void FGSD_Preferences::fgRootPath( const char *__path ) { _fgRootPath = __path; } inline void FGSD_Preferences::fgRootPath( const std::string &__path ) { _fgRootPath = __path; } inline std::string FGSD_Preferences::fgSceneryPath() const { return _fgSceneryPath; } inline void FGSD_Preferences::fgSceneryPath( const char *__path ) { _fgSceneryPath = __path; } inline void FGSD_Preferences::fgSceneryPath( const std::string &__path ) { _fgSceneryPath = __path; } inline std::string FGSD_Preferences::fgCommandLine() const { return _fgCommandLine; } inline void FGSD_Preferences::fgCommandLine( const char *__line ) { _fgCommandLine = __line; } inline void FGSD_Preferences::fgCommandLine( const std::string &__line ) { _fgCommandLine = __line; } inline int FGSD_Preferences::zoomLevel() const { return _zoomLevel; } inline void FGSD_Preferences::zoomLevel( int l ) { _zoomLevel = l; } inline bool FGSD_Preferences::showOutline() const { return _showOutline; } inline void FGSD_Preferences::showOutline( bool f ) { _showOutline = f; } inline bool FGSD_Preferences::showLevelCurve() const { return _showLevelCurve; } inline void FGSD_Preferences::showLevelCurve( bool f ) { _showLevelCurve = f; } inline bool FGSD_Preferences::showTiles() const { return _showTiles; } inline void FGSD_Preferences::showTiles( bool f ) { _showTiles = f; } inline bool FGSD_Preferences::showStatic() const { return _showStatic; } inline void FGSD_Preferences::showStatic( bool f ) { _showStatic = f; } inline bool FGSD_Preferences::showTileFrames() const { return _showTileFrames; } inline void FGSD_Preferences::showTileFrames( bool f ) { _showTileFrames = f; } inline std::string FGSD_Preferences::viewMode() const { return _viewMode; } inline void FGSD_Preferences::viewMode( const char *m ) { _viewMode = m; } inline void FGSD_Preferences::viewMode( const std::string &m ) { _viewMode = m; } inline bool FGSD_Preferences::showConstraints() const { return _showConstraints; } inline void FGSD_Preferences::showConstraints( bool f ) { _showConstraints = f; } inline bool FGSD_Preferences::showVertices() const { return _showVertices; } inline void FGSD_Preferences::showVertices( bool f ) { _showVertices = f; } inline bool FGSD_Preferences::showInfiniteEdges() const { return _showInfiniteEdges; } inline void FGSD_Preferences::showInfiniteEdges( bool f ) { _showInfiniteEdges = f; } inline double FGSD_Preferences::alphaValue() const { return _alphaValue; } inline void FGSD_Preferences::alphaValue( double a ) { _alphaValue = a; } inline size_t FGSD_Preferences::airportNumber() const { return _airportNumber; } inline void FGSD_Preferences::airportNumber( size_t n ) { _airportNumber = n; } inline std::string FGSD_Preferences::currentMainDirectory() const { return _currentMainDirectory; } inline void FGSD_Preferences::currentMainDirectory( const char *d ) { _currentMainDirectory = d; } inline void FGSD_Preferences::currentMainDirectory( const std::string &d ) { _currentMainDirectory = d; } inline std::string FGSD_Preferences::currentInputDirectory() const { return _currentInputDirectory; } inline void FGSD_Preferences::currentInputDirectory( const char *d ) { _currentInputDirectory = d; } inline void FGSD_Preferences::currentInputDirectory( const std::string &d ) { _currentInputDirectory = d; } #endif