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