Rev 266 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 266 | Rev 382 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | 24 | ||
25 | public String[] menu_items; |
25 | public String[] menu_items; |
26 | 26 | ||
27 | org.ligi.ufo.ParamsClass edit_source; |
27 | org.ligi.ufo.ParamsClass edit_source; |
28 | 28 | ||
- | 29 | boolean select_mode; |
|
- | 30 | ||
- | 31 | ||
29 | 32 | ||
30 | public MKParamsEditor(DUBwiseCanvas _canvas,org.ligi.ufo.ParamsClass _edit_source,byte _nextstate) |
33 | public MKParamsEditor(DUBwiseCanvas _canvas,org.ligi.ufo.ParamsClass _edit_source,byte _nextstate) |
31 | { |
34 | { |
32 | nextstate=_nextstate; |
35 | nextstate=_nextstate; |
33 | edit_source=_edit_source; |
36 | edit_source=_edit_source; |
34 | 37 | ||
35 | canvas=_canvas; |
38 | canvas=_canvas; |
36 | lcd_lines=new String[40]; |
39 | lcd_lines=new String[40]; |
- | 40 | ||
- | 41 | ||
- | 42 | System.out.println("initing params_editor"); |
|
- | 43 | select_mode=(edit_source.tab_stringids!=null); |
|
37 | // refresh_lcd(); |
44 | // refresh_lcd(); |
38 | } |
45 | } |
39 | 46 | ||
40 | 47 | ||
41 | boolean select_mode=true; |
- | |
42 | - | ||
43 | 48 | ||
44 | public void paint ( Graphics g) |
49 | public void paint ( Graphics g) |
45 | { |
50 | { |
46 | if (select_mode) |
51 | if (select_mode) |
47 | { |
52 | { |
Line 68... | Line 73... | ||
68 | 73 | ||
69 | public void refresh_lcd() |
74 | public void refresh_lcd() |
70 | { |
75 | { |
71 | 76 | ||
72 | try { |
77 | try { |
73 | act_lcd_lines=edit_source.field_stringids[act_tab].length*2+2; |
78 | act_lcd_lines=edit_source.field_types[act_tab].length*2+2; |
74 | 79 | ||
75 | for ( int i=0;i<act_lcd_lines;i++) |
80 | for ( int i=0;i<act_lcd_lines;i++) |
76 | lcd_lines[i]=""; |
81 | lcd_lines[i]=""; |
77 | 82 | ||
78 | 83 | ||
79 | 84 | ||
80 | // lcd_lines[0]=(act_tab==0?" ":"< ") + edit_source.tab_stringids[act_tab] + (act_tab==(edit_source.tab_stringids.length-1)?" ":" >"); |
85 | // lcd_lines[0]=(act_tab==0?" ":"< ") + edit_source.tab_stringids[act_tab] + (act_tab==(edit_source.tab_stringids.length-1)?" ":" >"); |
81 | 86 | ||
82 | for (int i=0;i<edit_source.field_stringids[act_tab].length;i++) |
87 | for (int i=0;i<edit_source.field_types[act_tab].length;i++) |
83 | { |
88 | { |
- | 89 | if (edit_source.field_stringids!=null) |
|
84 | lcd_lines[2*i]=canvas.l(edit_source.field_stringids[act_tab][i]); |
90 | lcd_lines[2*i]=canvas.l(edit_source.field_stringids[act_tab][i]); |
85 | 91 | else |
|
- | 92 | lcd_lines[2*i]=edit_source.field_strings[act_tab][i]; |
|
86 | switch(edit_source.field_types[act_tab][i]) |
93 | switch(edit_source.field_types[act_tab][i]) |
87 | { |
94 | { |
88 | case PARAMTYPE_BITSWITCH: |
95 | case PARAMTYPE_BITSWITCH: |
89 | lcd_lines[1+2*i]=" " + (((edit_source.get_field_from_act(edit_source.field_positions[act_tab][i]/8)&(1<<edit_source.field_positions[act_tab][i]%8))==0)?canvas.l(STRINGID_OFF):canvas.l(STRINGID_ON) ) ; |
96 | lcd_lines[1+2*i]=" " + (((edit_source.get_field_from_act(edit_source.field_positions[act_tab][i]/8)&(1<<edit_source.field_positions[act_tab][i]%8))==0)?canvas.l(STRINGID_OFF):canvas.l(STRINGID_ON) ) ; |
90 | break; |
97 | break; |
Line 162... | Line 169... | ||
162 | 169 | ||
163 | public final static int KEYCODE_CLEAR=-8; |
170 | public final static int KEYCODE_CLEAR=-8; |
164 | 171 | ||
165 | public boolean editing_number=false; |
172 | public boolean editing_number=false; |
166 | 173 | ||
167 | public void pointer_press(int x,int row) |
174 | public void pointer_press(int x,byte row) |
168 | { |
175 | { |
- | 176 | ||
- | 177 | ||
- | 178 | ||
- | 179 | System.out.println("pointer row " + row + " lcd_off" + canvas.lcd_off); |
|
169 | if (select_mode) |
180 | if (select_mode) |
170 | { |
181 | { |
- | 182 | if (canvas.act_menu_select!=row) |
|
171 | canvas.act_menu_select=row; |
183 | canvas.act_menu_select=row; |
- | 184 | else |
|
172 | keypress (-4242,Canvas.FIRE); |
185 | keypress (-4242,Canvas.FIRE); |
173 | 186 | ||
174 | } |
187 | } |
175 | else |
188 | else |
176 | { |
189 | { |
177 | if ((row%2)==0) |
190 | if ((row%2)==0) |
178 | act_y=row+1; |
191 | act_y=row+1; |
179 | else |
192 | else |
180 | { |
193 | { |
181 | act_y=row; |
194 | act_y=row; |
182 | 195 | ||
- | 196 | System.out.println("y:" + act_y); |
|
183 | if (act_y==(canvas.lcd_lines.length-1)) |
197 | if (act_y==(canvas.lcd_lines.length-1)) |
184 | keypress (-4242,Canvas.FIRE); |
198 | keypress (-4242,Canvas.FIRE); |
185 | else |
199 | else |
186 | { |
200 | { |
187 | if (x<(canvas.canvas_width/2)) |
201 | if (x<(canvas.canvas_width/2)) |
Line 194... | Line 208... | ||
194 | } |
208 | } |
195 | 209 | ||
196 | 210 | ||
197 | public void keypress (int keyCode,int action) |
211 | public void keypress (int keyCode,int action) |
198 | { |
212 | { |
199 | - | ||
200 | if (select_mode) |
213 | if (select_mode) |
201 | { |
214 | { |
202 | if (action== Canvas.FIRE) |
215 | if (action== Canvas.FIRE) |
203 | { |
216 | { |
204 | 217 | ||
Line 325... | Line 338... | ||
325 | if (action== Canvas.FIRE) |
338 | if (action== Canvas.FIRE) |
326 | { |
339 | { |
327 | act_y=1; |
340 | act_y=1; |
328 | // canvas.act_menu_select=0; |
341 | // canvas.act_menu_select=0; |
329 | canvas.menu_items[0]=""; |
342 | canvas.menu_items[0]=""; |
330 | select_mode=true; |
- | |
331 | 343 | ||
- | 344 | if (edit_source.tab_stringids==null) |
|
- | 345 | canvas.chg_state(nextstate); |
|
- | 346 | else |
|
- | 347 | select_mode=true; |
|
332 | } |
348 | } |
333 | } |
349 | } |
334 | 350 | ||
335 | 351 | ||
336 | // if (!select_mode)refresh_lcd(); |
352 | // if (!select_mode)refresh_lcd(); |