Rev 266 | Rev 269 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 266 | Rev 267 | ||
---|---|---|---|
1 | /*************************************************************** |
1 | /*************************************************************** |
2 | * |
2 | * |
3 | * Settings related Part of DUBwise |
3 | * Settings related Part of DUBwise |
4 | * ( e.g. saving to / reading from RMS ) |
4 | * ( e.g. saving to / reading from RMS ) |
5 | * |
5 | * |
6 | * Author: Marcus -LiGi- Bueschleb |
6 | * Author: Marcus -LiGi- Bueschleb |
7 | * Mailto: LiGi @at@ LiGi DOTT de |
7 | * Mailto: LiGi @at@ LiGi DOTT de |
8 | * |
8 | * |
9 | ***************************************************************/ |
9 | ***************************************************************/ |
10 | 10 | ||
11 | import javax.microedition.rms.*; |
11 | import javax.microedition.rms.*; |
12 | 12 | ||
13 | import java.io.*; |
13 | import java.io.*; |
14 | 14 | ||
15 | public class DUBwiseSettings |
15 | public class DUBwiseSettings |
16 | extends org.ligi.ufo.ParamsClass |
16 | extends org.ligi.ufo.ParamsClass |
17 | implements org.ligi.ufo.DUBwiseDefinitions,DUBwiseUIDefinitions,org.ligi.ufo.DUBwiseLangDefs |
17 | implements org.ligi.ufo.DUBwiseDefinitions,DUBwiseUIDefinitions,org.ligi.ufo.DUBwiseLangDefs |
18 | { |
18 | { |
19 | // name/handle for the recordStore to memorize some stuff |
19 | // name/handle for the recordStore to memorize some stuff |
20 | private final static String RECORD_STORE_NAME="DUBSETT_V4"; |
20 | private final static String RECORD_STORE_NAME="DUBSETT_V4"; |
21 | 21 | ||
22 | /* all settings hold here */ |
22 | /* all settings hold here */ |
23 | //holds id of actual skin |
23 | //holds id of actual skin |
24 | public byte act_skin=SKINID_DARK; |
24 | public byte act_skin=SKINID_DARK; |
25 | 25 | ||
26 | public int key_back; |
26 | public int key_back; |
27 | public int key_fullscreen; |
27 | public int key_fullscreen; |
28 | public int key_clear; |
28 | public int key_clear; |
29 | 29 | ||
30 | public int voice_delay; |
30 | public int voice_delay; |
31 | public int voice_volume; |
31 | public int voice_volume; |
32 | 32 | ||
33 | 33 | ||
34 | public byte graph_interval=1; |
34 | public byte graph_interval=1; |
35 | 35 | ||
36 | 36 | ||
37 | public int remote_cam_stick; |
37 | public int remote_cam_stick; |
38 | 38 | ||
39 | public String connection_name=""; |
39 | public String connection_name=""; |
40 | public String connection_url=""; |
40 | public String connection_url=""; |
41 | 41 | ||
42 | public boolean do_vibra=true; |
42 | public boolean do_vibra=true; |
43 | public boolean do_sound=true; |
43 | public boolean do_sound=true; |
44 | public boolean do_volts_sound=true; |
44 | public boolean do_volts_sound=true; |
45 | public boolean do_altimeter_sound=true; |
45 | public boolean do_altimeter_sound=true; |
46 | 46 | ||
47 | 47 | ||
48 | public boolean horizon_invert_nick=true; |
48 | public boolean horizon_invert_nick=true; |
49 | public boolean horizon_invert_roll=true; |
49 | public boolean horizon_invert_roll=true; |
50 | public boolean horizon_display_altitude=true; |
50 | public boolean horizon_display_altitude=true; |
51 | public boolean horizon_display_flytime=true; |
51 | public boolean horizon_display_flytime=true; |
52 | 52 | ||
53 | public boolean fullscreen=false; |
53 | public boolean fullscreen=false; |
54 | public boolean do_scrollbg=false; |
54 | public boolean do_scrollbg=false; |
55 | public boolean expert_mode=false; |
55 | public boolean expert_mode=false; |
56 | public boolean dev_mode=false; |
56 | public boolean dev_mode=false; |
57 | 57 | ||
58 | public boolean reload_settings=false; |
58 | public boolean reload_settings=false; |
59 | - | ||
- | 59 | public boolean instant_error_show=false; |
|
60 | 60 | ||
61 | public boolean graph_legend; |
61 | public boolean graph_legend; |
62 | public boolean graph_scale; |
62 | public boolean graph_scale; |
63 | 63 | ||
64 | //#if devicecontrol=="on" |
64 | //#if devicecontrol=="on" |
65 | public boolean keep_lighton=false; |
65 | public boolean keep_lighton=false; |
66 | //#endif |
66 | //#endif |
67 | 67 | ||
68 | int[] act_proxy_ip=default_ip; // { ip , ip , ip , ip , port } |
68 | int[] act_proxy_ip=default_ip; // { ip , ip , ip , ip , port } |
69 | int[] act_conn_ip=default_ip; // { ip , ip , ip , ip , port } |
69 | int[] act_conn_ip=default_ip; // { ip , ip , ip , ip , port } |
70 | 70 | ||
71 | 71 | ||
72 | // public byte gps_format=GPS_FORMAT_DECIMAL; |
72 | // public byte gps_format=GPS_FORMAT_DECIMAL; |
73 | // public byte speed_format=SPEED_FORMAT_KMH; |
73 | // public byte speed_format=SPEED_FORMAT_KMH; |
74 | 74 | ||
75 | 75 | ||
76 | int[] settings_field; |
76 | int[] settings_field; |
77 | 77 | ||
78 | public int get_field_from_act(int pos) { return settings_field[pos];} |
78 | public int get_field_from_act(int pos) { return settings_field[pos];} |
79 | public void set_field_from_act(int pos,int val){ |
79 | public void set_field_from_act(int pos,int val){ |
80 | 80 | ||
81 | settings_field[pos]=val; |
81 | settings_field[pos]=val; |
82 | field2setting(pos,val); |
82 | field2setting(pos,val); |
83 | } |
83 | } |
84 | 84 | ||
85 | public void toggle_fullscreen() |
85 | public void toggle_fullscreen() |
86 | { |
86 | { |
87 | // fullscreen=!fullscreen; |
87 | // fullscreen=!fullscreen; |
88 | set_field_from_act(1,settings_field[1]^1); |
88 | set_field_from_act(1,settings_field[1]^1); |
89 | // if (fullscreen)canvas.setFullScreenMode(true); |
89 | // if (fullscreen)canvas.setFullScreenMode(true); |
90 | } |
90 | } |
91 | 91 | ||
92 | public final static int SETTINGS_POS_SKIN=0; |
92 | public final static int SETTINGS_POS_SKIN=0; |
93 | public final static int SETTINGS_POS_BITFIELD1=1; |
93 | public final static int SETTINGS_POS_BITFIELD1=1; |
94 | public final static int SETTINGS_POS_GPS_FORMAT=2; |
94 | public final static int SETTINGS_POS_GPS_FORMAT=2; |
95 | public final static int SETTINGS_POS_SPEED_FORMAT=3; |
95 | public final static int SETTINGS_POS_SPEED_FORMAT=3; |
96 | public final static int SETTINGS_POS_EXTERN_NICK=4; |
96 | public final static int SETTINGS_POS_EXTERN_NICK=4; |
97 | public final static int SETTINGS_POS_EXTERN_ROLL=5; |
97 | public final static int SETTINGS_POS_EXTERN_ROLL=5; |
98 | public final static int SETTINGS_POS_EXTERN_GIER=6; |
98 | public final static int SETTINGS_POS_EXTERN_GIER=6; |
99 | public final static int SETTINGS_POS_EXTERN_GAS=7; |
99 | public final static int SETTINGS_POS_EXTERN_GAS=7; |
100 | public final static int SETTINGS_POS_EXTERN_HIGHT=8; |
100 | public final static int SETTINGS_POS_EXTERN_HIGHT=8; |
101 | public final static int SETTINGS_POS_KEY_BACK=9; |
101 | public final static int SETTINGS_POS_KEY_BACK=9; |
102 | public final static int SETTINGS_POS_KEY_FULL=10; |
102 | public final static int SETTINGS_POS_KEY_FULL=10; |
103 | public final static int SETTINGS_POS_KEY_CLEAR=11; |
103 | public final static int SETTINGS_POS_KEY_CLEAR=11; |
104 | public final static int SETTINGS_POS_VOICEVOLUME=12; |
104 | public final static int SETTINGS_POS_VOICEVOLUME=12; |
105 | public final static int SETTINGS_POS_VOICEDELAY=13; |
105 | public final static int SETTINGS_POS_VOICEDELAY=13; |
106 | public final static int SETTINGS_POS_BITFIELD2=14; |
106 | public final static int SETTINGS_POS_BITFIELD2=14; |
107 | public final static int SETTINGS_POS_LANG=15; |
107 | public final static int SETTINGS_POS_LANG=15; |
108 | public final static int SETTINGS_POS_GRAPHINTERVAL=16; |
108 | public final static int SETTINGS_POS_GRAPHINTERVAL=16; |
- | 109 | public final static int SETTINGS_POS_BITFIELD3=17; |
|
109 | 110 | ||
110 | 111 | ||
111 | public void field2setting(int pos,int val) |
112 | public void field2setting(int pos,int val) |
112 | { |
113 | { |
113 | 114 | ||
114 | if (pos==SETTINGS_POS_GRAPHINTERVAL) |
115 | if (pos==SETTINGS_POS_GRAPHINTERVAL) |
115 | { |
116 | { |
116 | if (val<1) |
117 | if (val<1) |
117 | graph_interval=1; |
118 | graph_interval=1; |
118 | else |
119 | else |
119 | graph_interval=(byte)val; |
120 | graph_interval=(byte)val; |
120 | } |
121 | } |
121 | 122 | ||
122 | if (pos==SETTINGS_POS_LANG) |
123 | if (pos==SETTINGS_POS_LANG) |
123 | { |
124 | { |
124 | canvas.act_lang=(byte)val; |
125 | canvas.act_lang=(byte)val; |
125 | canvas.load_strings(); |
126 | canvas.load_strings(); |
126 | } |
127 | } |
127 | 128 | ||
128 | 129 | ||
129 | if (pos==SETTINGS_POS_SKIN) |
130 | if (pos==SETTINGS_POS_SKIN) |
130 | { |
131 | { |
131 | act_skin=(byte)val; |
132 | act_skin=(byte)val; |
132 | canvas.load_skin_images(); |
133 | canvas.load_skin_images(); |
133 | } |
134 | } |
134 | 135 | ||
135 | if ((pos==SETTINGS_POS_BITFIELD1)&&((val&1)==1)&&(!fullscreen)) |
136 | if ((pos==SETTINGS_POS_BITFIELD1)&&((val&1)==1)&&(!fullscreen)) |
136 | { |
137 | { |
137 | fullscreen=true; |
138 | fullscreen=true; |
138 | canvas.setFullScreenMode(fullscreen); |
139 | canvas.setFullScreenMode(fullscreen); |
139 | } |
140 | } |
140 | 141 | ||
141 | if ((pos==SETTINGS_POS_BITFIELD1)&&((val&1)==0)&&(fullscreen)) |
142 | if ((pos==SETTINGS_POS_BITFIELD1)&&((val&1)==0)&&(fullscreen)) |
142 | { |
143 | { |
143 | fullscreen=false; |
144 | fullscreen=false; |
144 | canvas.setFullScreenMode(fullscreen); |
145 | canvas.setFullScreenMode(fullscreen); |
145 | } |
146 | } |
146 | 147 | ||
147 | if ((pos==SETTINGS_POS_BITFIELD1)&&((val&2)==2)&&(!do_scrollbg)) |
148 | if ((pos==SETTINGS_POS_BITFIELD1)&&((val&2)==2)&&(!do_scrollbg)) |
148 | { |
149 | { |
149 | do_scrollbg=true; |
150 | do_scrollbg=true; |
150 | canvas.load_skin_images(); |
151 | canvas.load_skin_images(); |
151 | } |
152 | } |
152 | 153 | ||
153 | if ((pos==SETTINGS_POS_BITFIELD1)&&((val&2)==0)&&(do_scrollbg)) |
154 | if ((pos==SETTINGS_POS_BITFIELD1)&&((val&2)==0)&&(do_scrollbg)) |
154 | { |
155 | { |
155 | do_scrollbg=false; |
156 | do_scrollbg=false; |
156 | canvas.load_skin_images(); |
157 | canvas.load_skin_images(); |
157 | } |
158 | } |
158 | 159 | ||
159 | 160 | ||
160 | if (pos==SETTINGS_POS_BITFIELD1) |
161 | if (pos==SETTINGS_POS_BITFIELD1) |
161 | do_sound=((val&4)!=0); |
162 | do_sound=((val&4)!=0); |
162 | 163 | ||
163 | if (pos==SETTINGS_POS_BITFIELD1) |
164 | if (pos==SETTINGS_POS_BITFIELD1) |
164 | do_vibra=((val&8)!=0); |
165 | do_vibra=((val&8)!=0); |
165 | 166 | ||
166 | if (pos==SETTINGS_POS_BITFIELD1) |
167 | if (pos==SETTINGS_POS_BITFIELD1) |
167 | expert_mode=((val&16)!=0); |
168 | expert_mode=((val&16)!=0); |
168 | 169 | ||
169 | if (pos==SETTINGS_POS_BITFIELD1) |
170 | if (pos==SETTINGS_POS_BITFIELD1) |
170 | keep_lighton=((val&32)!=0); |
171 | keep_lighton=((val&32)!=0); |
171 | 172 | ||
172 | if (pos==SETTINGS_POS_BITFIELD1) |
173 | if (pos==SETTINGS_POS_BITFIELD1) |
173 | graph_legend=((val&64)!=0); |
174 | graph_legend=((val&64)!=0); |
174 | 175 | ||
175 | if (pos==SETTINGS_POS_BITFIELD1) |
176 | if (pos==SETTINGS_POS_BITFIELD1) |
176 | graph_scale=((val&128)!=0); |
177 | graph_scale=((val&128)!=0); |
177 | 178 | ||
178 | 179 | ||
179 | 180 | ||
180 | if (pos==SETTINGS_POS_GPS_FORMAT) |
181 | if (pos==SETTINGS_POS_GPS_FORMAT) |
181 | canvas.mk.gps_position.act_gps_format=(byte)val; |
182 | canvas.mk.gps_position.act_gps_format=(byte)val; |
182 | 183 | ||
183 | if (pos==SETTINGS_POS_SPEED_FORMAT) |
184 | if (pos==SETTINGS_POS_SPEED_FORMAT) |
184 | canvas.mk.gps_position.act_speed_format=(byte)val; |
185 | canvas.mk.gps_position.act_speed_format=(byte)val; |
185 | 186 | ||
186 | if (pos==SETTINGS_POS_EXTERN_NICK) |
187 | if (pos==SETTINGS_POS_EXTERN_NICK) |
187 | default_extern_control[EXTERN_CONTROL_NICK]=(byte)val; |
188 | default_extern_control[EXTERN_CONTROL_NICK]=(byte)val; |
188 | 189 | ||
189 | if (pos==SETTINGS_POS_EXTERN_ROLL) |
190 | if (pos==SETTINGS_POS_EXTERN_ROLL) |
190 | default_extern_control[EXTERN_CONTROL_ROLL]=(byte)val; |
191 | default_extern_control[EXTERN_CONTROL_ROLL]=(byte)val; |
191 | 192 | ||
192 | if (pos==SETTINGS_POS_EXTERN_GIER) |
193 | if (pos==SETTINGS_POS_EXTERN_GIER) |
193 | default_extern_control[EXTERN_CONTROL_GIER]=(byte)val; |
194 | default_extern_control[EXTERN_CONTROL_GIER]=(byte)val; |
194 | 195 | ||
195 | if (pos==SETTINGS_POS_EXTERN_GAS) |
196 | if (pos==SETTINGS_POS_EXTERN_GAS) |
196 | default_extern_control[EXTERN_CONTROL_GAS]=(byte)val; |
197 | default_extern_control[EXTERN_CONTROL_GAS]=(byte)val; |
197 | 198 | ||
198 | if (pos==SETTINGS_POS_EXTERN_HIGHT) |
199 | if (pos==SETTINGS_POS_EXTERN_HIGHT) |
199 | default_extern_control[EXTERN_CONTROL_HIGHT]=(byte)val; |
200 | default_extern_control[EXTERN_CONTROL_HIGHT]=(byte)val; |
200 | 201 | ||
201 | 202 | ||
202 | if (pos==SETTINGS_POS_KEY_BACK) |
203 | if (pos==SETTINGS_POS_KEY_BACK) |
203 | key_back=val; |
204 | key_back=val; |
204 | 205 | ||
205 | if (pos==SETTINGS_POS_KEY_FULL) |
206 | if (pos==SETTINGS_POS_KEY_FULL) |
206 | key_fullscreen=val; |
207 | key_fullscreen=val; |
207 | 208 | ||
208 | if (pos==SETTINGS_POS_KEY_CLEAR) |
209 | if (pos==SETTINGS_POS_KEY_CLEAR) |
209 | key_clear=val; |
210 | key_clear=val; |
210 | 211 | ||
211 | if (pos==12) |
212 | if (pos==12) |
212 | remote_cam_stick=val; |
213 | remote_cam_stick=val; |
213 | 214 | ||
214 | 215 | ||
215 | if(pos==SETTINGS_POS_VOICEVOLUME) |
216 | if(pos==SETTINGS_POS_VOICEVOLUME) |
216 | { |
217 | { |
217 | voice_volume=val; |
218 | voice_volume=val; |
218 | //#if voice_mode!="no_voice" |
219 | //#if voice_mode!="no_voice" |
219 | canvas.status_voice.volume=voice_volume; |
220 | canvas.status_voice.volume=voice_volume; |
220 | 221 | ||
221 | //#endif |
222 | //#endif |
222 | } |
223 | } |
223 | if(pos==SETTINGS_POS_VOICEDELAY) |
224 | if(pos==SETTINGS_POS_VOICEDELAY) |
224 | { |
225 | { |
225 | voice_delay=val; |
226 | voice_delay=val; |
226 | //#if voice_mode!="no_voice" |
227 | //#if voice_mode!="no_voice" |
227 | canvas.status_voice.delay=voice_delay; |
228 | canvas.status_voice.delay=voice_delay; |
228 | 229 | ||
229 | //#endif |
230 | //#endif |
230 | } |
231 | } |
231 | 232 | ||
232 | if (pos==SETTINGS_POS_BITFIELD2) |
233 | if (pos==SETTINGS_POS_BITFIELD2) |
233 | do_volts_sound=((val&1)!=0); |
234 | do_volts_sound=((val&1)!=0); |
234 | 235 | ||
235 | if (pos==SETTINGS_POS_BITFIELD2) |
236 | if (pos==SETTINGS_POS_BITFIELD2) |
236 | reload_settings=((val&2)!=0); |
237 | reload_settings=((val&2)!=0); |
237 | 238 | ||
238 | if (pos==SETTINGS_POS_BITFIELD2) |
239 | if (pos==SETTINGS_POS_BITFIELD2) |
239 | do_altimeter_sound=((val&4)!=0); |
240 | do_altimeter_sound=((val&4)!=0); |
240 | 241 | ||
241 | 242 | ||
242 | if (pos==SETTINGS_POS_BITFIELD2) |
243 | if (pos==SETTINGS_POS_BITFIELD2) |
243 | horizon_invert_roll=((val&8)!=0); |
244 | horizon_invert_roll=((val&8)!=0); |
244 | 245 | ||
245 | if (pos==SETTINGS_POS_BITFIELD2) |
246 | if (pos==SETTINGS_POS_BITFIELD2) |
246 | horizon_invert_nick=((val&16)!=0); |
247 | horizon_invert_nick=((val&16)!=0); |
247 | 248 | ||
248 | if (pos==SETTINGS_POS_BITFIELD2) |
249 | if (pos==SETTINGS_POS_BITFIELD2) |
249 | horizon_display_flytime=((val&32)!=0); |
250 | horizon_display_flytime=((val&32)!=0); |
250 | 251 | ||
251 | if (pos==SETTINGS_POS_BITFIELD2) |
252 | if (pos==SETTINGS_POS_BITFIELD2) |
252 | horizon_display_altitude=((val&64)!=0); |
253 | horizon_display_altitude=((val&64)!=0); |
253 | 254 | ||
254 | if (pos==SETTINGS_POS_BITFIELD2) |
255 | if (pos==SETTINGS_POS_BITFIELD2) |
255 | dev_mode=((val&128)!=0); |
256 | dev_mode=((val&128)!=0); |
- | 257 | ||
- | 258 | ||
- | 259 | if (pos==SETTINGS_POS_BITFIELD3) |
|
- | 260 | instant_error_show=((val&1)!=0); |
|
256 | } |
261 | } |
257 | 262 | ||
258 | 263 | ||
259 | public byte[] default_extern_control;//=default_extern_keycontrol ; |
264 | public byte[] default_extern_control;//=default_extern_keycontrol ; |
260 | 265 | ||
261 | 266 | ||
262 | /* end of all settings hold here */ |
267 | /* end of all settings hold here */ |
263 | 268 | ||
264 | // public String[] _tab_names={"User Interface","GPS","Keycontrol","Special Keys","Graph","Voice","Other" }; |
269 | // public String[] _tab_names={"User Interface","GPS","Keycontrol","Special Keys","Graph","Voice","Other" }; |
265 | 270 | ||
266 | 271 | ||
267 | public int[] _tab_stringids={STRINGID_USERINTERFACE,STRINGID_UNITS,STRINGID_KEYCONTROL,STRINGID_SPECIALKEYS,STRINGID_GRAPH,STRINGID_SOUND,STRINGID_COCKPIT,STRINGID_OTHER}; |
272 | public int[] _tab_stringids={STRINGID_USERINTERFACE,STRINGID_UNITS,STRINGID_KEYCONTROL,STRINGID_SPECIALKEYS,STRINGID_GRAPH,STRINGID_SOUND,STRINGID_COCKPIT,STRINGID_OTHER}; |
268 | 273 | ||
269 | 274 | ||
270 | public int[][] _field_stringids ={ |
275 | public int[][] _field_stringids ={ |
271 | { |
276 | { |
272 | STRINGID_LANGUAGE, |
277 | STRINGID_LANGUAGE, |
273 | STRINGID_SKIN, |
278 | STRINGID_SKIN, |
274 | STRINGID_FULLSCREEN, |
279 | STRINGID_FULLSCREEN, |
275 | STRINGID_SCROLLBG |
280 | STRINGID_SCROLLBG |
276 | //#if devicecontrol=="on" |
281 | //#if devicecontrol=="on" |
277 | ,STRINGID_PERMALIGHT |
282 | ,STRINGID_PERMALIGHT |
278 | //#endif |
283 | //#endif |
279 | }, |
284 | }, |
280 | {STRINGID_SPEEDFORMAT,STRINGID_GPSFORMAT}, |
285 | {STRINGID_SPEEDFORMAT,STRINGID_GPSFORMAT}, |
281 | {STRINGID_NICK ,STRINGID_ROLL,STRINGID_GIER,STRINGID_GASINCREASE,STRINGID_HEIGHTINCREASE }, |
286 | {STRINGID_NICK ,STRINGID_ROLL,STRINGID_GIER,STRINGID_GASINCREASE,STRINGID_HEIGHTINCREASE }, |
282 | {STRINGID_BACKTOMAINMENU,STRINGID_FULLSCREEN,STRINGID_CLEAR }, |
287 | {STRINGID_BACKTOMAINMENU,STRINGID_FULLSCREEN,STRINGID_CLEAR }, |
283 | {STRINGID_LEGEND,STRINGID_SCALEGRID,STRINGID_GRAPHINTERVAL}, |
288 | {STRINGID_LEGEND,STRINGID_SCALEGRID,STRINGID_GRAPHINTERVAL}, |
284 | {STRINGID_SOUND,STRINGID_VOLTS,STRINGID_DELAYINS,STRINGID_ALTIMETER,STRINGID_VOLUME}, |
289 | {STRINGID_SOUND,STRINGID_VOLTS,STRINGID_DELAYINS,STRINGID_ALTIMETER,STRINGID_VOLUME}, |
285 | {STRINGID_SHOWALTITUDE,STRINGID_SHOWFLIGHTTIME,STRINGID_INVERTROLL,STRINGID_INVERTNICK}, |
290 | {STRINGID_SHOWALTITUDE,STRINGID_SHOWFLIGHTTIME,STRINGID_INVERTROLL,STRINGID_INVERTNICK}, |
286 | {STRINGID_VIBRA,STRINGID_REMOTECAMSTICK,STRINGID_ALWAYSRELOADPARAMS,STRINGID_EXPERTMODE,STRINGID_DEVMODE}}; |
291 | {STRINGID_INSTANTERRORSHOW,STRINGID_VIBRA,STRINGID_REMOTECAMSTICK,STRINGID_ALWAYSRELOADPARAMS,STRINGID_EXPERTMODE,STRINGID_DEVMODE}}; |
287 | 292 | ||
288 | 293 | ||
289 | 294 | ||
290 | 295 | ||
291 | public int[][] _choice_stringids={ {STRINGID_LANG0,STRINGID_LANG1}, /* FIXME - make dynamic */{ STRINGID_DARK,STRINGID_LIGHT } , {STRINGID_KMH,STRINGID_MPH,STRINGID_CMS},{STRINGID_DECIMAL,STRINGID_MINSEC} } ; |
296 | public int[][] _choice_stringids={ {STRINGID_LANG0,STRINGID_LANG1}, /* FIXME - make dynamic */{ STRINGID_DARK,STRINGID_LIGHT } , {STRINGID_KMH,STRINGID_MPH,STRINGID_CMS},{STRINGID_DECIMAL,STRINGID_MINSEC} } ; |
292 | 297 | ||
293 | 298 | ||
294 | 299 | ||
295 | public int[][] _field_positions= { |
300 | public int[][] _field_positions= { |
296 | {SETTINGS_POS_LANG,SETTINGS_POS_SKIN,8,9 |
301 | {SETTINGS_POS_LANG,SETTINGS_POS_SKIN,8,9 |
297 | //#if devicecontrol=="on" |
302 | //#if devicecontrol=="on" |
298 | 303 | ||
299 | ,13 |
304 | ,13 |
300 | //#endif |
305 | //#endif |
301 | } , {2,3 } , {4,5,6,7,8} , {9,10,11},{SETTINGS_POS_BITFIELD1*8 +6,SETTINGS_POS_BITFIELD1*8 +7, SETTINGS_POS_GRAPHINTERVAL} , |
306 | } , {2,3 } , {4,5,6,7,8} , {9,10,11},{SETTINGS_POS_BITFIELD1*8 +6,SETTINGS_POS_BITFIELD1*8 +7, SETTINGS_POS_GRAPHINTERVAL} , |
302 | {10,SETTINGS_POS_BITFIELD2*8+0,SETTINGS_POS_VOICEDELAY,SETTINGS_POS_BITFIELD2*8+2,SETTINGS_POS_VOICEVOLUME }, |
307 | {10,SETTINGS_POS_BITFIELD2*8+0,SETTINGS_POS_VOICEDELAY,SETTINGS_POS_BITFIELD2*8+2,SETTINGS_POS_VOICEVOLUME }, |
303 | {SETTINGS_POS_BITFIELD2*8+6,SETTINGS_POS_BITFIELD2*8+5,SETTINGS_POS_BITFIELD2*8+3,SETTINGS_POS_BITFIELD2*8+4}, |
308 | {SETTINGS_POS_BITFIELD2*8+6,SETTINGS_POS_BITFIELD2*8+5,SETTINGS_POS_BITFIELD2*8+3,SETTINGS_POS_BITFIELD2*8+4}, |
304 | {SETTINGS_POS_BITFIELD1*8+3,12,SETTINGS_POS_BITFIELD2*8+1,SETTINGS_POS_BITFIELD1*8+4,SETTINGS_POS_BITFIELD2*8+7} |
309 | {SETTINGS_POS_BITFIELD3*8+0,SETTINGS_POS_BITFIELD1*8+3,12,SETTINGS_POS_BITFIELD2*8+1,SETTINGS_POS_BITFIELD1*8+4,SETTINGS_POS_BITFIELD2*8+7} |
305 | }; |
310 | }; |
306 | public int[][] _field_types={ {PARAMTYPE_CHOICE+0,PARAMTYPE_CHOICE+1,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH |
311 | public int[][] _field_types={ {PARAMTYPE_CHOICE+0,PARAMTYPE_CHOICE+1,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH |
307 | //#if devicecontrol=="on" |
312 | //#if devicecontrol=="on" |
308 | ,PARAMTYPE_BITSWITCH |
313 | ,PARAMTYPE_BITSWITCH |
309 | //#endif |
314 | //#endif |
310 | } , {PARAMTYPE_CHOICE+2,PARAMTYPE_CHOICE+3} , {PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, {PARAMTYPE_KEY,PARAMTYPE_KEY,PARAMTYPE_KEY} , {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BYTE}, |
315 | } , {PARAMTYPE_CHOICE+2,PARAMTYPE_CHOICE+3} , {PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, {PARAMTYPE_KEY,PARAMTYPE_KEY,PARAMTYPE_KEY} , {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BYTE}, |
311 | {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BYTE,PARAMTYPE_BITSWITCH,PARAMTYPE_BYTE} , |
316 | {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BYTE,PARAMTYPE_BITSWITCH,PARAMTYPE_BYTE} , |
312 | {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH}, |
317 | {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH}, |
313 | {PARAMTYPE_BITSWITCH,PARAMTYPE_STICK,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH} |
318 | {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_STICK,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH} |
314 | }; |
319 | }; |
315 | DUBwiseCanvas canvas; |
320 | DUBwiseCanvas canvas; |
316 | 321 | ||
317 | 322 | ||
318 | 323 | ||
319 | public final static int SETTINGS_FIELD_LENGTH=42; |
324 | public final static int SETTINGS_FIELD_LENGTH=42; |
320 | public DUBwiseSettings(DUBwiseCanvas _canvas) |
325 | public DUBwiseSettings(DUBwiseCanvas _canvas) |
321 | { |
326 | { |
322 | canvas= _canvas; |
327 | canvas= _canvas; |
323 | settings_field=new int[SETTINGS_FIELD_LENGTH]; |
328 | settings_field=new int[SETTINGS_FIELD_LENGTH]; |
324 | default_extern_control=new byte[11]; |
329 | default_extern_control=new byte[11]; |
325 | // set defaults |
330 | // set defaults |
326 | settings_field[4]=42; // nick |
331 | settings_field[4]=42; // nick |
327 | settings_field[5]=42; // roll |
332 | settings_field[5]=42; // roll |
328 | settings_field[6]=42; // gier |
333 | settings_field[6]=42; // gier |
329 | settings_field[7]=1; // gas |
334 | settings_field[7]=1; // gas |
330 | settings_field[8]=1; // hight |
335 | settings_field[8]=1; // hight |
331 | 336 | ||
332 | settings_field[9]=-4242; // no key |
337 | settings_field[9]=-4242; // no key |
333 | settings_field[10]=-4242; // no key |
338 | settings_field[10]=-4242; // no key |
334 | settings_field[11]=-4242; // no key |
339 | settings_field[11]=-4242; // no key |
335 | 340 | ||
336 | } |
341 | } |
337 | 342 | ||
338 | public void load() |
343 | public void load() |
339 | { |
344 | { |
340 | tab_stringids=_tab_stringids; |
345 | tab_stringids=_tab_stringids; |
341 | 346 | ||
342 | // tab_names=_tab_names; |
347 | // tab_names=_tab_names; |
343 | 348 | ||
344 | field_positions=_field_positions; |
349 | field_positions=_field_positions; |
345 | field_types=_field_types; |
350 | field_types=_field_types; |
346 | 351 | ||
347 | choice_stringids=_choice_stringids; |
352 | choice_stringids=_choice_stringids; |
348 | 353 | ||
349 | field_stringids=_field_stringids; |
354 | field_stringids=_field_stringids; |
350 | //choice_strings=new String[_choice_strings.length+1][]; |
355 | //choice_strings=new String[_choice_strings.length+1][]; |
351 | /* |
356 | /* |
352 | // FIXME |
357 | // FIXME |
353 | choice_strings[0]=new String[2]; |
358 | choice_strings[0]=new String[2]; |
354 | choice_strings[0][0]="English"; |
359 | choice_strings[0][0]="English"; |
355 | choice_strings[0][1]="Deutsch"; |
360 | choice_strings[0][1]="Deutsch"; |
356 | for ( int i=1; i<_choice_strings.length+1;i++) |
361 | for ( int i=1; i<_choice_strings.length+1;i++) |
357 | { |
362 | { |
358 | choice_strings[i]=new String[_choice_strings[i-1].length+1]; |
363 | choice_strings[i]=new String[_choice_strings[i-1].length+1]; |
359 | for ( int ii=0; ii<_choice_strings[i-1].length;ii++) |
364 | for ( int ii=0; ii<_choice_strings[i-1].length;ii++) |
360 | choice_strings[i][ii]=canvas.l(_choice_strings[i-1][ii]); |
365 | choice_strings[i][ii]=canvas.l(_choice_strings[i-1][ii]); |
361 | } |
366 | } |
362 | */ |
367 | */ |
363 | // choice_strings=_choice_strings; |
368 | // choice_strings=_choice_strings; |
364 | try |
369 | try |
365 | { |
370 | { |
366 | RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME , true ); |
371 | RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME , true ); |
367 | 372 | ||
368 | if (recStore.getNumRecords()==1) |
373 | if (recStore.getNumRecords()==1) |
369 | { |
374 | { |
370 | ByteArrayInputStream bin = new ByteArrayInputStream(recStore.getRecord(1)); |
375 | ByteArrayInputStream bin = new ByteArrayInputStream(recStore.getRecord(1)); |
371 | DataInputStream din = new DataInputStream( bin ); |
376 | DataInputStream din = new DataInputStream( bin ); |
372 | 377 | ||
373 | 378 | ||
374 | connection_url=din.readUTF(); |
379 | connection_url=din.readUTF(); |
375 | connection_name=din.readUTF(); |
380 | connection_name=din.readUTF(); |
376 | // reserve utf's |
381 | // reserve utf's |
377 | din.readUTF(); |
382 | din.readUTF(); |
378 | din.readUTF(); |
383 | din.readUTF(); |
379 | din.readUTF(); |
384 | din.readUTF(); |
380 | 385 | ||
381 | 386 | ||
382 | 387 | ||
383 | for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
388 | for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
384 | settings_field[i]=din.readInt(); |
389 | settings_field[i]=din.readInt(); |
385 | 390 | ||
386 | for ( int i=0;i<5;i++) |
391 | for ( int i=0;i<5;i++) |
387 | 392 | ||
388 | { |
393 | { |
389 | act_proxy_ip[i]=din.readInt(); |
394 | act_proxy_ip[i]=din.readInt(); |
390 | act_conn_ip[i]=din.readInt(); |
395 | act_conn_ip[i]=din.readInt(); |
391 | } |
396 | } |
392 | 397 | ||
393 | } |
398 | } |
394 | recStore.closeRecordStore(); |
399 | recStore.closeRecordStore(); |
395 | } |
400 | } |
396 | catch (Exception e) |
401 | catch (Exception e) |
397 | { } |
402 | { } |
398 | 403 | ||
399 | 404 | ||
400 | for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
405 | for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
401 | field2setting(i,settings_field[i]); |
406 | field2setting(i,settings_field[i]); |
402 | 407 | ||
403 | } |
408 | } |
404 | 409 | ||
405 | 410 | ||
406 | public void save() |
411 | public void save() |
407 | { |
412 | { |
408 | try |
413 | try |
409 | { |
414 | { |
410 | RecordStore.deleteRecordStore(RECORD_STORE_NAME); |
415 | RecordStore.deleteRecordStore(RECORD_STORE_NAME); |
411 | } |
416 | } |
412 | catch (Exception e) |
417 | catch (Exception e) |
413 | { } |
418 | { } |
414 | 419 | ||
415 | try { |
420 | try { |
416 | RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME, true ); |
421 | RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME, true ); |
417 | 422 | ||
418 | ByteArrayOutputStream bout = new ByteArrayOutputStream(); |
423 | ByteArrayOutputStream bout = new ByteArrayOutputStream(); |
419 | DataOutputStream dout = new DataOutputStream( bout ); |
424 | DataOutputStream dout = new DataOutputStream( bout ); |
420 | 425 | ||
421 | dout.writeUTF(connection_url); |
426 | dout.writeUTF(connection_url); |
422 | dout.writeUTF(connection_name); |
427 | dout.writeUTF(connection_name); |
423 | 428 | ||
424 | dout.writeUTF(""); |
429 | dout.writeUTF(""); |
425 | dout.writeUTF(""); |
430 | dout.writeUTF(""); |
426 | dout.writeUTF(""); |
431 | dout.writeUTF(""); |
427 | 432 | ||
428 | 433 | ||
429 | for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
434 | for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
430 | dout.writeInt(settings_field[i]); |
435 | dout.writeInt(settings_field[i]); |
431 | for ( int i=0;i<5;i++) |
436 | for ( int i=0;i<5;i++) |
432 | { |
437 | { |
433 | dout.writeInt(act_proxy_ip[i]); |
438 | dout.writeInt(act_proxy_ip[i]); |
434 | dout.writeInt(act_conn_ip[i]); |
439 | dout.writeInt(act_conn_ip[i]); |
435 | } |
440 | } |
436 | recStore.addRecord(bout.toByteArray(),0,bout.size()); |
441 | recStore.addRecord(bout.toByteArray(),0,bout.size()); |
437 | 442 | ||
438 | recStore.closeRecordStore(); |
443 | recStore.closeRecordStore(); |
439 | 444 | ||
440 | 445 | ||
441 | } |
446 | } |
442 | catch (Exception e) |
447 | catch (Exception e) |
443 | { } |
448 | { } |
444 | 449 | ||
445 | } |
450 | } |
446 | 451 | ||
447 | } |
452 | } |
448 | 453 |