Updated German translation
[dasher.git] / Src / DasherCore / Parameters.h
blob4021ad5865c398c88e95f3b5e5a4667fac5fe3a4
1 // Parameters.h
2 //
3 // Copyright (c) 2007 The Dasher Team
4 //
5 // This file is part of Dasher.
6 //
7 // Dasher is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
12 // Dasher is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with Dasher; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef __parameters_h__
22 #define __parameters_h__
24 #include "../Common/Common.h"
26 #include <string>
28 // All parameters go into the enums here
29 // They are unique across the different types
30 enum {
31 BP_DRAW_MOUSE_LINE, BP_DRAW_MOUSE, BP_CURVE_MOUSE_LINE,
32 BP_START_MOUSE,
33 BP_START_SPACE, BP_CONTROL_MODE,
34 BP_MOUSEPOS_MODE,
35 BP_PALETTE_CHANGE, BP_TURBO_MODE, BP_EXACT_DYNAMICS,
36 BP_AUTOCALIBRATE, BP_REMAP_XTREME,
37 BP_AUTO_SPEEDCONTROL,
38 BP_LM_ADAPTIVE, BP_SOCKET_DEBUG,
39 BP_CIRCLE_START, BP_GLOBAL_KEYBOARD, BP_NONLINEAR_Y,
40 BP_STOP_OUTSIDE, BP_BACKOFF_BUTTON,
41 BP_TWOBUTTON_REVERSE, BP_2B_INVERT_DOUBLE, BP_SLOW_START,
42 BP_COPY_ALL_ON_STOP, BP_SPEAK_ALL_ON_STOP, BP_SPEAK_WORDS,
43 BP_GAME_HELP_DRAW_PATH, BP_TWO_PUSH_RELEASE_TIME,
44 BP_SLOW_CONTROL_BOX,
45 END_OF_BPS
48 enum {
49 LP_ORIENTATION = END_OF_BPS, LP_MAX_BITRATE, LP_FRAMERATE,
50 LP_LANGUAGE_MODEL_ID, LP_DASHER_FONTSIZE, LP_MESSAGE_FONTSIZE, LP_SHAPE_TYPE,
51 LP_UNIFORM, LP_YSCALE, LP_MOUSEPOSDIST, LP_PY_PROB_SORT_THRES, LP_MESSAGE_TIME,
52 LP_LM_MAX_ORDER, LP_LM_EXCLUSION,
53 LP_LM_UPDATE_EXCLUSION, LP_LM_ALPHA, LP_LM_BETA,
54 LP_LM_MIXTURE, LP_LINE_WIDTH, LP_GEOMETRY,
55 LP_LM_WORD_ALPHA, LP_USER_LOG_LEVEL_MASK,
56 LP_ZOOMSTEPS, LP_B, LP_S, LP_BUTTON_SCAN_TIME, LP_R, LP_RIGHTZOOM,
57 LP_NODE_BUDGET, LP_OUTLINE_WIDTH, LP_MIN_NODE_SIZE, LP_NONLINEAR_X,
58 LP_AUTOSPEED_SENSITIVITY, LP_SOCKET_PORT, LP_SOCKET_INPUT_X_MIN, LP_SOCKET_INPUT_X_MAX,
59 LP_SOCKET_INPUT_Y_MIN, LP_SOCKET_INPUT_Y_MAX,
60 LP_CIRCLE_PERCENT, LP_TWO_BUTTON_OFFSET, LP_HOLD_TIME, LP_MULTIPRESS_TIME,
61 LP_SLOW_START_TIME,
62 LP_TWO_PUSH_OUTER, LP_TWO_PUSH_LONG, LP_TWO_PUSH_SHORT, LP_TWO_PUSH_TOLERANCE,
63 LP_DYNAMIC_BUTTON_LAG, LP_STATIC1B_TIME, LP_STATIC1B_ZOOM,
64 LP_DEMO_SPRING, LP_DEMO_NOISE_MEM, LP_DEMO_NOISE_MAG, LP_MAXZOOM,
65 LP_DYNAMIC_SPEED_INC, LP_DYNAMIC_SPEED_FREQ, LP_DYNAMIC_SPEED_DEC,
66 LP_TAP_TIME, LP_MARGIN_WIDTH, LP_TARGET_OFFSET, LP_X_LIMIT_SPEED,
67 LP_GAME_HELP_DIST, LP_GAME_HELP_TIME,
68 END_OF_LPS
71 enum {
72 SP_ALPHABET_ID = END_OF_LPS, SP_ALPHABET_1, SP_ALPHABET_2, SP_ALPHABET_3, SP_ALPHABET_4,
73 SP_COLOUR_ID, SP_CONTROL_BOX_ID, SP_DASHER_FONT, SP_GAME_TEXT_FILE,
74 SP_SOCKET_INPUT_X_LABEL, SP_SOCKET_INPUT_Y_LABEL, SP_INPUT_FILTER, SP_INPUT_DEVICE,
75 SP_BUTTON_0, SP_BUTTON_1, SP_BUTTON_2, SP_BUTTON_3, SP_BUTTON_4, SP_BUTTON_10, SP_JOYSTICK_DEVICE,
76 END_OF_SPS
79 // Define first int value of the first element of each type.
80 // Useful for offsetting into specific arrays,
81 // since each setting is a unique int, but all 3 arrays start at 0
82 #define FIRST_BP 0
83 #define FIRST_LP END_OF_BPS
84 #define FIRST_SP END_OF_LPS
86 // Define the number of each type of setting
87 #define NUM_OF_BPS END_OF_BPS
88 #define NUM_OF_LPS (END_OF_LPS - END_OF_BPS)
89 #define NUM_OF_SPS (END_OF_SPS - END_OF_LPS)
91 enum class Persistence { PERSISTENT, EPHEMERAL };
93 namespace Dasher {
94 ///Namespace containing all static (i.e. fixed/constant) data about
95 /// settings, that is _not_ dependent on the storage mechanism,
96 /// the SettingsStore in use, or platform-specific details.
97 /// (Except, some defaults are #ifdef'd according to platform).
98 /// This data does NOT change at runtime.
99 namespace Settings {
100 ///Structure storing fixed data about bool settings...
101 struct bp_table {
102 int key;
103 const char *regName;
104 Persistence persistent;
105 bool defaultValue;
106 const char *humanReadable;
108 ///One bp_table per bool param, in the same order as the enum declarations
109 /// (i.e.: boolparamtable[x]->key == x-FIRST_BP)
110 extern const bp_table boolparamtable[NUM_OF_BPS];
112 ///Structure storing fixed data about long settings...
113 struct lp_table {
114 int key;
115 const char *regName;
116 Persistence persistent;
117 long defaultValue;
118 const char *humanReadable;
120 ///One lp_table per long param, in the same order as the enum declarations
121 /// (i.e.: longparamtable[x]->key == x-FIRST_LP)
122 extern const lp_table longparamtable[NUM_OF_LPS];
124 ///Structure storing fixed data about string settings...
125 struct sp_table {
126 int key;
127 const char *regName;
128 Persistence persistent;
129 const char *defaultValue;
130 const char *humanReadable;
133 ///One sp_table per string param, in the same order as the enum declarations
134 /// (i.e.: stringparamtable[x]->key == x-FIRST_SP)
135 extern const sp_table stringparamtable[NUM_OF_SPS];
137 // Types that are parameters can be
138 enum ParameterType {
139 ParamBool,
140 ParamLong,
141 ParamString,
142 ParamInvalid
145 ///Get the type of a parameter by its key.
146 /// \param iParameter one of the BP_*, LP_* or SP_* enum constants
147 /// \return ParamBool, ParamLong or ParamString, respectively; or
148 /// ParamInvalid if iParameter is not in the range of those enums.
149 ParameterType GetParameterType(int iParameter);
151 ///Gets the regName member of the struct for a parameter (of any of the 3 types).
152 /// This is appropriate for use as a key for storing the setting value into e.g. a registry.
153 /// Note - returns a string not a reference to one, because the table stores only a char*.
154 /// \param iParameter one of the BP_*, LP_* or SP_* enum constants
155 /// \return the regName member of the corresponding bp_table, lp_table,
156 /// or sp_table struct.
157 std::string GetParameterName(int iParameter);
160 #endif