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