Update Turkish translation
[dasher.git] / Src / DasherCore / Parameters.h
blobde844abaefe685bf1f17817ea14823e00fe7ee43
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 struct CParameterChange {
94 CParameterChange(int parameter, bool value)
95 :iParameter(parameter), bool_value(value) {}
96 CParameterChange(int parameter, long value)
97 :iParameter(parameter), long_value(value) {}
98 CParameterChange(int parameter, const char* value)
99 :iParameter(parameter),string_value(value){}
100 int iParameter;
101 bool bool_value = false;
102 long long_value = 0;
103 const char* string_value = "";
106 namespace Dasher {
107 ///Namespace containing all static (i.e. fixed/constant) data about
108 /// settings, that is _not_ dependent on the storage mechanism,
109 /// the SettingsStore in use, or platform-specific details.
110 /// (Except, some defaults are #ifdef'd according to platform).
111 /// This data does NOT change at runtime.
112 namespace Settings {
113 ///Structure storing fixed data about bool settings...
114 struct bp_table {
115 int key;
116 const char *regName;
117 Persistence persistent;
118 bool defaultValue;
119 const char *humanReadable;
121 ///One bp_table per bool param, in the same order as the enum declarations
122 /// (i.e.: boolparamtable[x]->key == x-FIRST_BP)
123 extern const bp_table boolparamtable[NUM_OF_BPS];
125 ///Structure storing fixed data about long settings...
126 struct lp_table {
127 int key;
128 const char *regName;
129 Persistence persistent;
130 long defaultValue;
131 const char *humanReadable;
133 ///One lp_table per long param, in the same order as the enum declarations
134 /// (i.e.: longparamtable[x]->key == x-FIRST_LP)
135 extern const lp_table longparamtable[NUM_OF_LPS];
137 ///Structure storing fixed data about string settings...
138 struct sp_table {
139 int key;
140 const char *regName;
141 Persistence persistent;
142 const char *defaultValue;
143 const char *humanReadable;
146 ///One sp_table per string param, in the same order as the enum declarations
147 /// (i.e.: stringparamtable[x]->key == x-FIRST_SP)
148 extern const sp_table stringparamtable[NUM_OF_SPS];
150 // Types that are parameters can be
151 enum ParameterType {
152 ParamBool,
153 ParamLong,
154 ParamString,
155 ParamInvalid
158 ///Get the type of a parameter by its key.
159 /// \param iParameter one of the BP_*, LP_* or SP_* enum constants
160 /// \return ParamBool, ParamLong or ParamString, respectively; or
161 /// ParamInvalid if iParameter is not in the range of those enums.
162 ParameterType GetParameterType(int iParameter);
164 ///Gets the regName member of the struct for a parameter (of any of the 3 types).
165 /// This is appropriate for use as a key for storing the setting value into e.g. a registry.
166 /// Note - returns a string not a reference to one, because the table stores only a char*.
167 /// \param iParameter one of the BP_*, LP_* or SP_* enum constants
168 /// \return the regName member of the corresponding bp_table, lp_table,
169 /// or sp_table struct.
170 std::string GetParameterName(int iParameter);
173 #endif