1 |
cebix |
1.1 |
/* |
2 |
|
|
* prefs.h - Preferences handling |
3 |
|
|
* |
4 |
gbeauche |
1.11 |
* Basilisk II (C) 1997-2008 Christian Bauer |
5 |
cebix |
1.1 |
* |
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; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
#ifndef PREFS_H |
22 |
|
|
#define PREFS_H |
23 |
|
|
|
24 |
|
|
#include <stdio.h> |
25 |
|
|
|
26 |
asvitkine |
1.12 |
extern void PrefsInit(const char *vmdir, int &argc, char **&argv); |
27 |
cebix |
1.1 |
extern void PrefsExit(void); |
28 |
|
|
|
29 |
cebix |
1.6 |
extern void PrefsPrintUsage(void); |
30 |
|
|
|
31 |
cebix |
1.3 |
extern void AddPrefsDefaults(void); |
32 |
cebix |
1.1 |
extern void AddPlatformPrefsDefaults(void); |
33 |
|
|
|
34 |
|
|
// Preferences loading/saving |
35 |
asvitkine |
1.12 |
extern void LoadPrefs(const char *vmdir); |
36 |
cebix |
1.1 |
extern void SavePrefs(void); |
37 |
|
|
|
38 |
|
|
extern void LoadPrefsFromStream(FILE *f); |
39 |
|
|
extern void SavePrefsToStream(FILE *f); |
40 |
|
|
|
41 |
|
|
// Public preferences access functions |
42 |
|
|
extern void PrefsAddString(const char *name, const char *s); |
43 |
|
|
extern void PrefsAddBool(const char *name, bool b); |
44 |
|
|
extern void PrefsAddInt32(const char *name, int32 val); |
45 |
|
|
|
46 |
|
|
extern void PrefsReplaceString(const char *name, const char *s, int index = 0); |
47 |
|
|
extern void PrefsReplaceBool(const char *name, bool b); |
48 |
|
|
extern void PrefsReplaceInt32(const char *name, int32 val); |
49 |
|
|
|
50 |
|
|
extern const char *PrefsFindString(const char *name, int index = 0); |
51 |
|
|
extern bool PrefsFindBool(const char *name); |
52 |
|
|
extern int32 PrefsFindInt32(const char *name); |
53 |
|
|
|
54 |
|
|
extern void PrefsRemoveItem(const char *name, int index = 0); |
55 |
|
|
|
56 |
asvitkine |
1.10 |
#ifdef SHEEPSHAVER |
57 |
|
|
// Platform specific functions: |
58 |
|
|
extern void prefs_init(); |
59 |
|
|
extern void prefs_exit(); |
60 |
|
|
#endif |
61 |
cebix |
1.1 |
|
62 |
|
|
/* |
63 |
|
|
* Definition of preferences items |
64 |
|
|
*/ |
65 |
|
|
|
66 |
|
|
// Item types |
67 |
|
|
enum prefs_type { |
68 |
|
|
TYPE_STRING, // char[] |
69 |
|
|
TYPE_BOOLEAN, // bool |
70 |
|
|
TYPE_INT32, // int32 |
71 |
|
|
TYPE_ANY, // Wildcard for find_node |
72 |
|
|
TYPE_END = TYPE_ANY // Terminator for prefs_desc list |
73 |
|
|
}; |
74 |
|
|
|
75 |
|
|
// Item descriptor |
76 |
|
|
struct prefs_desc { |
77 |
|
|
const char *name; // Name of keyword |
78 |
|
|
prefs_type type; // Type (see above) |
79 |
|
|
bool multiple; // Can this item occur multiple times (only for TYPE_STRING)? |
80 |
cebix |
1.6 |
const char *help; // Help/descriptive text about this item |
81 |
cebix |
1.1 |
}; |
82 |
|
|
|
83 |
|
|
// List of common preferences items (those which exist on all platforms) |
84 |
|
|
extern prefs_desc common_prefs_items[]; |
85 |
|
|
|
86 |
|
|
// List of platform-specific preferences items |
87 |
|
|
extern prefs_desc platform_prefs_items[]; |
88 |
|
|
|
89 |
|
|
#endif |