1 #ifndef __parameters_h__
2 #define __parameters_h__
6 // All parameters go into the enums here
7 // They are unique across the different types
9 BP_DRAW_MOUSE_LINE
, BP_DRAW_MOUSE
,
10 BP_SHOW_SLIDER
, BP_START_MOUSE
,
11 BP_START_SPACE
, BP_START_STYLUS
, BP_STOP_IDLE
, BP_KEY_CONTROL
, BP_CONTROL_MODE
,
12 BP_COLOUR_MODE
, BP_MOUSEPOS_MODE
,
13 BP_OUTLINE_MODE
, BP_PALETTE_CHANGE
, BP_NUMBER_DIMENSIONS
,
14 BP_EYETRACKER_MODE
, BP_AUTOCALIBRATE
, BP_DASHER_PAUSED
,
15 BP_GAME_MODE
, BP_TRAINING
, BP_REDRAW
, BP_LM_DICTIONARY
,
16 BP_LM_LETTER_EXCLUSION
, BP_AUTO_SPEEDCONTROL
, BP_CLICK_MODE
,
17 BP_LM_ADAPTIVE
, BP_BUTTONONESTATIC
, BP_BUTTONONEDYNAMIC
,
18 BP_BUTTONMENU
, BP_BUTTONPULSING
, BP_BUTTONSTEADY
,
19 BP_BUTTONDIRECT
, BP_BUTTONFOURDIRECT
, BP_BUTTONALTERNATINGDIRECT
,
20 BP_COMPASSMODE
, BP_SOCKET_INPUT_ENABLE
, BP_SOCKET_DEBUG
,
21 BP_OLD_STYLE_PUSH
, BP_CIRCLE_START
, END_OF_BPS
25 LP_ORIENTATION
= END_OF_BPS
, LP_REAL_ORIENTATION
, LP_MAX_BITRATE
,
26 LP_VIEW_ID
, LP_LANGUAGE_MODEL_ID
, LP_DASHER_FONTSIZE
,
27 LP_UNIFORM
, LP_YSCALE
, LP_MOUSEPOSDIST
, LP_STOP_IDLETIME
, LP_TRUNCATION
,
28 LP_TRUNCATIONTYPE
, LP_LM_MAX_ORDER
, LP_LM_EXCLUSION
,
29 LP_LM_UPDATE_EXCLUSION
, LP_LM_ALPHA
, LP_LM_BETA
,
30 LP_LM_MIXTURE
, LP_MOUSE_POS_BOX
, LP_NORMALIZATION
, LP_LINE_WIDTH
,
31 LP_LM_WORD_ALPHA
, LP_USER_LOG_LEVEL_MASK
, LP_SPEED_DIVISOR
,
32 LP_ZOOMSTEPS
, LP_B
, LP_S
, LP_Z
, LP_R
, LP_RIGHTZOOM
,
33 LP_BOOSTFACTOR
, LP_AUTOSPEED_SENSITIVITY
, LP_SOCKET_PORT
, LP_SOCKET_INPUT_X_MIN
, LP_SOCKET_INPUT_X_MAX
,
34 LP_SOCKET_INPUT_Y_MIN
, LP_SOCKET_INPUT_Y_MAX
, LP_OX
, LP_OY
, LP_MAX_Y
, LP_INPUT_FILTER
, END_OF_LPS
38 SP_ALPHABET_ID
= END_OF_LPS
, SP_ALPHABET_1
, SP_ALPHABET_2
, SP_ALPHABET_3
, SP_ALPHABET_4
,
39 SP_COLOUR_ID
, SP_DEFAULT_COLOUR_ID
, SP_DASHER_FONT
, SP_SYSTEM_LOC
, SP_USER_LOC
, SP_GAME_TEXT_FILE
,
40 SP_TRAIN_FILE
, SP_SOCKET_INPUT_X_LABEL
, SP_SOCKET_INPUT_Y_LABEL
, SP_INPUT_FILTER
, SP_INPUT_DEVICE
,
44 // Define first int value of the first element of each type.
45 // Useful for offsetting into specific arrays,
46 // since each setting is a unique int, but all 3 arrays start at 0
48 #define FIRST_LP END_OF_BPS
49 #define FIRST_SP END_OF_LPS
51 // Define the number of each type of setting
52 #define NUM_OF_BPS END_OF_BPS
53 #define NUM_OF_LPS (END_OF_LPS - END_OF_BPS)
54 #define NUM_OF_SPS (END_OF_SPS - END_OF_LPS)
58 // First level structures with only basic data types because you
59 // cannot initialize struct tables with objects
60 // These will be turned into std::strings in the ParamTables() object
66 const char *humanReadable
;
73 const char *humanReadable
;
79 const char *defaultValue
;
80 const char *humanReadable
;
83 // The only important thing here is that these are in the same order
84 // as the enum declarations (could add check in class that enforces this instead)
85 static bp_table boolparamtable
[] = {
86 {BP_DRAW_MOUSE_LINE
, "DrawMouseLine", PERS
, false, "Draw Mouse Line"},
87 {BP_DRAW_MOUSE
, "DrawMouse", PERS
, true, "Draw Mouse Position"},
89 {BP_SHOW_SLIDER
, "ShowSpeedSlider", PERS
, false, "ShowSpeedSlider"},
91 {BP_SHOW_SLIDER
, "ShowSpeedSlider", PERS
, true, "ShowSpeedSlider"},
93 {BP_START_MOUSE
, "StartOnLeft", PERS
, true, "StartOnLeft"},
94 {BP_START_SPACE
, "StartOnSpace", PERS
, false, "StartOnSpace"},
95 {BP_START_STYLUS
, "StartOnStylus", PERS
, false, "StartOnStylus"},
96 {BP_STOP_IDLE
, "StopOnIdle", PERS
, false, "StopOnIdle"},
97 {BP_KEY_CONTROL
, "KeyControl", PERS
, false, "KeyControl"},
98 {BP_CONTROL_MODE
, "ControlMode", PERS
, false, "ControlMode"},
99 {BP_COLOUR_MODE
, "ColourMode", PERS
, true, "ColourMode"},
100 {BP_MOUSEPOS_MODE
, "StartOnMousePosition", PERS
, false, "StartOnMousePosition"},
101 {BP_OUTLINE_MODE
, "OutlineBoxes", PERS
, true, "OutlineBoxes"},
102 {BP_PALETTE_CHANGE
, "PaletteChange", PERS
, true, "PaletteChange"},
103 {BP_NUMBER_DIMENSIONS
, "NumberDimensions", PERS
, false, "NumberDimensions"},
104 {BP_EYETRACKER_MODE
, "EyetrackerMode", PERS
, false, "EyetrackerMode"},
105 {BP_AUTOCALIBRATE
, "Autocalibrate", PERS
, false, "Autocalibrate"},
106 {BP_DASHER_PAUSED
, "DasherPaused", !PERS
, true, "Dasher Paused"},
107 {BP_GAME_MODE
, "GameMode", PERS
, false, "Dasher Game Mode"},
108 {BP_TRAINING
, "Training", !PERS
, false, "Provides locking during training"},
109 {BP_REDRAW
, "Redraw", !PERS
, false, "Force a full redraw at the next timer event"},
110 {BP_LM_DICTIONARY
, "Dictionary", PERS
, true, "Whether the word-based language model uses a dictionary"},
111 {BP_LM_LETTER_EXCLUSION
, "LetterExclusion", PERS
, true, "Whether to do letter exclusion in the word-based model"},
112 {BP_AUTO_SPEEDCONTROL
, "AutoSpeedControl", PERS
, true, "AutoSpeedControl"},
113 {BP_CLICK_MODE
, "ClickMode", PERS
, false, "Dasher Click Mode"},
114 {BP_LM_ADAPTIVE
, "LMAdaptive", PERS
, true, "Whether language model should learn as you enter text"},
115 {BP_BUTTONONESTATIC
, "ButtonOneStaticMode", PERS
, false, "One-button static mode"},
116 {BP_BUTTONONEDYNAMIC
, "ButtonOneDynamicMode", PERS
, false, "One-button dynamic mode"},
117 {BP_BUTTONMENU
, "ButtonMenuMode", PERS
, false, "Button menu mode"},
118 {BP_BUTTONPULSING
, "ButtonPulsingMode", PERS
, false, "One-button dynamic pulsing mode"},
119 {BP_BUTTONSTEADY
, "ButtonSteadyMode", PERS
, true, "One-button dynamic steady mode"},
120 {BP_BUTTONDIRECT
, "ButtonDirectMode", PERS
, false, "Three-button direct mode"},
121 {BP_BUTTONFOURDIRECT
, "ButtonFourDirectMode", PERS
, false, "Four-button direct mode"},
122 {BP_BUTTONALTERNATINGDIRECT
, "ButtonAlternatingDirectMode", PERS
, true, "Alternating direct mode"},
123 {BP_COMPASSMODE
, "ButtonCompassMode", PERS
, false, "Compass mode"},
124 {BP_SOCKET_INPUT_ENABLE
, "SocketInputEnable", PERS
, false, "Read pointer coordinates from network socket instead of mouse"},
125 {BP_SOCKET_DEBUG
, "SocketInputDebug", PERS
, false, "Print information about socket input processing to console"},
126 {BP_OLD_STYLE_PUSH
, "OldStylePush", PERS
, false, "Old style node pushing algorithm"},
127 {BP_CIRCLE_START
, "CircleStart", PERS
, false, "Start on circle mode"}
130 static lp_table longparamtable
[] = {
131 {LP_ORIENTATION
, "ScreenOrientation", PERS
, -2, "Screen Orientation"},
132 {LP_REAL_ORIENTATION
, "RealOrientation", !PERS
, 0, "Actual screen orientation (allowing for alphabet default)"},
133 {LP_MAX_BITRATE
, "MaxBitRateTimes100", PERS
, 80, "Max Bit Rate Times 100"},
134 {LP_VIEW_ID
, "ViewID", PERS
, 1, "ViewID"},
135 {LP_LANGUAGE_MODEL_ID
, "LanguageModelID", PERS
, 0, "LanguageModelID"},
136 {LP_DASHER_FONTSIZE
, "DasherFontSize", PERS
, 2, "DasherFontSize"},
137 {LP_UNIFORM
, "UniformTimes1000", PERS
, 50, "UniformTimes1000"},
138 {LP_YSCALE
, "YScaling", PERS
, 0, "YScaling"},
139 {LP_MOUSEPOSDIST
, "MousePositionBoxDistance", PERS
, 50, "MousePositionBoxDistance"},
140 {LP_STOP_IDLETIME
, "StopIdleTime", PERS
, 1000, "StopIdleTime" },
141 {LP_TRUNCATION
, "Truncation", PERS
, 0, "Truncation"},
142 {LP_TRUNCATIONTYPE
, "TruncationType", PERS
, 0, "TruncationType"},
143 {LP_LM_MAX_ORDER
, "LMMaxOrder", PERS
, 5, "LMMaxOrder"},
144 {LP_LM_EXCLUSION
, "LMExclusion", PERS
, 0, "LMExclusion"},
145 {LP_LM_UPDATE_EXCLUSION
, "LMUpdateExclusion", PERS
, 1, "LMUpdateExclusion"},
146 {LP_LM_ALPHA
, "LMAlpha", PERS
, 100, "LMAlpha"},
147 {LP_LM_BETA
, "LMBeta", PERS
, 100, "LMBeta"},
148 {LP_LM_MIXTURE
, "LMMixture", PERS
, 50, "LMMixture"},
149 {LP_MOUSE_POS_BOX
, "MousePosBox", !PERS
, -1, "Mouse Position Box Indicator"},
150 {LP_NORMALIZATION
, "Normalization", !PERS
, 1 << 16, "Interval for child nodes"},
151 {LP_LINE_WIDTH
, "LineWidth", PERS
, 1, "Width to draw crosshair and mouse line"},
152 {LP_LM_WORD_ALPHA
, "WordAlpha", PERS
, 50, "Alpha value for word-based model"},
153 {LP_USER_LOG_LEVEL_MASK
, "UserLogLevelMask", PERS
, 0, "Controls level of user logging, 0 = none, 1 = short, 2 = detailed, 3 = both"},
154 {LP_SPEED_DIVISOR
, "SpeedDivisor", !PERS
, 100, "Factor by which to slow down (multiplied by 100)"},
155 {LP_ZOOMSTEPS
, "Zoomsteps", PERS
, 32, "Integerised ratio of zoom size for click/button mode, denom 64."},
156 {LP_B
, "ButtonMenuBoxes", PERS
, 4, "Number of boxes for button menu mode"},
157 {LP_S
, "ButtonMenuSafety", PERS
, 25, "Safety parameter for button mode, in percent."},
158 {LP_Z
, "ButtonMenuBackwardsBox", PERS
, 1, "Number of back-up boxes for button menu mode"},
159 {LP_R
, "ButtonModeNonuniformity", PERS
, 0, "Button mode box non-uniformity"},
160 {LP_RIGHTZOOM
, "ButtonCompassModeRightZoom", PERS
, 5120, "Zoomfactor (*1024) for compass mode"},
161 {LP_BOOSTFACTOR
, "BoostFactor", !PERS
, 100, "Boost/brake factor (multiplied by 100)"},
162 {LP_AUTOSPEED_SENSITIVITY
, "AutospeedSensitivity", PERS
, 100, "Sensitivity of automatic speed control (percent)"},
163 {LP_SOCKET_PORT
, "SocketPort", PERS
, 20320, "UDP/TCP socket to use for network socket input"},
164 {LP_SOCKET_INPUT_X_MIN
, "SocketInputXMinTimes1000", PERS
, 0, "Bottom of range of X values expected from network input"},
165 {LP_SOCKET_INPUT_X_MAX
, "SocketInputXMaxTimes1000", PERS
, 1000, "Top of range of X values expected from network input"},
166 {LP_SOCKET_INPUT_Y_MIN
, "SocketInputYMinTimes1000", PERS
, 0, "Bottom of range of Y values expected from network input"},
167 {LP_SOCKET_INPUT_Y_MAX
, "SocketInputYMaxTimes1000", PERS
, 1000, "Top of range of Y values expected from network input"},
168 {LP_OX
, "OX", PERS
, 2048, "X coordinate of crosshair"},
169 {LP_OY
, "OY", PERS
, 2048, "Y coordinate of crosshair"},
170 {LP_MAX_Y
, "MaxY", PERS
, 4096, "Maximum Y coordinate"},
171 {LP_INPUT_FILTER
, "InputFilterID", PERS
, 3, "Module ID of input filter"}
174 static sp_table stringparamtable
[] = {
175 {SP_ALPHABET_ID
, "AlphabetID", PERS
, "", "AlphabetID"},
176 {SP_ALPHABET_1
, "Alphabet1", PERS
, "", "Alphabet History 1"},
177 {SP_ALPHABET_2
, "Alphabet2", PERS
, "", "Alphabet History 2"},
178 {SP_ALPHABET_3
, "Alphabet3", PERS
, "", "Alphabet History 3"},
179 {SP_ALPHABET_4
, "Alphabet4", PERS
, "", "Alphabet History 4"},
180 {SP_COLOUR_ID
, "ColourID", PERS
, "", "ColourID"},
181 {SP_DEFAULT_COLOUR_ID
, "DefaultColourID", !PERS
, "", "Default Colour ID (Used for auto-colour mode)"},
182 {SP_DASHER_FONT
, "DasherFont", PERS
, "", "DasherFont"},
183 {SP_SYSTEM_LOC
, "SystemLocation", !PERS
, "sys_", "System Directory"},
184 {SP_USER_LOC
, "UserLocation", !PERS
, "usr_", "User Directory"},
185 {SP_GAME_TEXT_FILE
, "GameTextFile", !PERS
, "gamemode_english_GB.txt", "File with strings to practice writing"},
186 {SP_TRAIN_FILE
, "TrainingFile", !PERS
, "", "Training text for alphabet"},
187 {SP_SOCKET_INPUT_X_LABEL
, "SocketInputXLabel", PERS
, "x", "Label preceding X values for network input"},
188 {SP_SOCKET_INPUT_Y_LABEL
, "SocketInputYLabel", PERS
, "y", "Label preceding Y values for network input"},
189 {SP_INPUT_FILTER
, "InputFilter", PERS
, "Normal Control", "Input filter used to provide the current control mode"},
190 {SP_INPUT_DEVICE
, "InputDevice", PERS
, "Mouse Input", "Driver for the input device"}
193 // This is the structure of each table that the settings will access
194 // Everything is const except the current value of the setting
201 std::string humanReadable
;
209 std::string humanReadable
;
216 std::string defaultVal
;
217 std::string humanReadable
;
224 class Dasher::CParamTables
{
226 // These are the parameter tables that store everything
228 bp_info BoolParamTable
[NUM_OF_BPS
];
229 lp_info LongParamTable
[NUM_OF_LPS
];
230 sp_info StringParamTable
[NUM_OF_SPS
];
234 // Initialize all the tables with default values
235 // and convert the char* to std::string in the object
236 for(int ii
= 0; ii
< NUM_OF_BPS
; ii
++) {
237 BoolParamTable
[ii
].key
= boolparamtable
[ii
].key
;
238 BoolParamTable
[ii
].value
= boolparamtable
[ii
].defaultValue
;
239 BoolParamTable
[ii
].defaultVal
= boolparamtable
[ii
].defaultValue
;
240 BoolParamTable
[ii
].humanReadable
= boolparamtable
[ii
].humanReadable
;
241 BoolParamTable
[ii
].persistent
= boolparamtable
[ii
].persistent
;
242 BoolParamTable
[ii
].regName
= boolparamtable
[ii
].regName
;
245 for(int ij
= 0; ij
< NUM_OF_LPS
; ij
++) {
246 LongParamTable
[ij
].key
= longparamtable
[ij
].key
;
247 LongParamTable
[ij
].value
= longparamtable
[ij
].defaultValue
;
248 LongParamTable
[ij
].defaultVal
= longparamtable
[ij
].defaultValue
;
249 LongParamTable
[ij
].humanReadable
= longparamtable
[ij
].humanReadable
;
250 LongParamTable
[ij
].persistent
= longparamtable
[ij
].persistent
;
251 LongParamTable
[ij
].regName
= longparamtable
[ij
].regName
;
254 for(int ik
= 0; ik
< NUM_OF_SPS
; ik
++) {
255 StringParamTable
[ik
].key
= stringparamtable
[ik
].key
;
256 StringParamTable
[ik
].value
= stringparamtable
[ik
].defaultValue
;
257 StringParamTable
[ik
].defaultVal
= stringparamtable
[ik
].defaultValue
;
258 StringParamTable
[ik
].humanReadable
= stringparamtable
[ik
].humanReadable
;
259 StringParamTable
[ik
].persistent
= stringparamtable
[ik
].persistent
;
260 StringParamTable
[ik
].regName
= stringparamtable
[ik
].regName
;