1 /* 2 * PreferencesApp.h 3 * 4 * Copyright (C) 1999 Stephen F. White, 2003 J. "MUFTI" Scheurich 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program (see the file "COPYING" for details); if 18 * not, write to the Free Software Foundation, Inc., 675 Mass Ave, 19 * Cambridge, MA 02139, USA. 20 */ 21 22 #pragma once 23 24 #include "swttypedef.h" 25 #include "MyString.h" 26 #include "StringArray.h" 27 28 typedef enum { 29 MOUSE_FLY, 30 MOUSE_WALK, 31 MOUSE_EXAMINE, 32 MOUSE_ROLL, 33 MOUSE_FOLLOW 34 } MouseMode; 35 36 class PreferencesApp { 37 public: 38 39 PreferencesApp(); 40 41 void SavePreferences(void); 42 getPrefs()43 STABLE getPrefs() { return m_prefs; } 44 45 // PreferencesApp data GetMouseMode()46 MouseMode GetMouseMode() const { return m_mouseMode; } GetX11ErrorsLimit(void)47 int GetX11ErrorsLimit(void) 48 { return m_X11ErrorsLimit; } 49 50 void SetMouseMode(MouseMode mouseMode); SetX11ErrorsLimit(int limit)51 void SetX11ErrorsLimit(int limit) 52 { m_X11ErrorsLimit = limit; } 53 getTtfFile(void)54 const char *getTtfFile(void) { return m_ttfFile; } 55 setCrashFile(MyString file)56 void setCrashFile(MyString file) 57 { 58 m_crashFile = ""; 59 m_crashFile += file; 60 if (file.length() == 0) 61 m_crashFile += "Untitled.x3dv"; 62 } 63 64 void SetInputDeviceString(const char *string); GetNumInputDeviceStrings(void)65 int GetNumInputDeviceStrings(void) 66 { return m_inputDeviceString.size(); } GetInputDeviceString(int i)67 const char *GetInputDeviceString(int i) 68 { return m_inputDeviceString[i]; } 69 70 void PreferencesDefaults(); 71 72 bool GetBoolPreference(const char *key, bool defaultValue); 73 int GetIntPreference(const char *key, int defaultValue); 74 const char *GetPreference(const char *key, 75 const char *defaultValue); 76 const char *GetArrayPreference(const char *key, int index); 77 78 79 void SetBoolPreference(const char *key, bool value); 80 void SetIntPreference(const char *key, int value); 81 void SetPreference(const char *key, const char *value); 82 void SetArrayPreference(const char *key, int index, 83 const char *value); 84 85 void unInstall(void); 86 void initCallback(void); 87 88 private: 89 90 STABLE m_prefs; 91 92 bool m_showAllFields; 93 int m_rotationOrder; 94 const char *m_rotationTitle; 95 MouseMode m_mouseMode; 96 int m_X11ErrorsLimit; 97 StringArray m_inputDeviceString; 98 MyString m_ttfFile; 99 MyString m_crashFile; 100 }; 101 102