Rev 220 | Rev 222 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 220 | Rev 221 | ||
---|---|---|---|
Line 11... | Line 11... | ||
11 | 11 | ||
12 | import javax.microedition.media.*; |
12 | import javax.microedition.media.*; |
Line 13... | Line -... | ||
13 | import javax.microedition.media.control.*; |
- | |
14 | - | ||
15 | - | ||
16 | //#if fileapi=="on" |
- | |
17 | import javax.microedition.io.*; |
- | |
18 | import javax.microedition.midlet.*; |
- | |
19 | import javax.microedition.io.file.*; |
- | |
20 | - | ||
Line 21... | Line 13... | ||
21 | import java.io.*; |
13 | import javax.microedition.media.control.*; |
22 | import java.util.*; |
14 | |
23 | //#endif |
15 | |
24 | 16 | ||
Line 25... | Line 17... | ||
25 | public class DUBwiseCanvas |
17 | public class DUBwiseCanvas |
26 | extends Canvas |
- | |
27 | implements Runnable,org.ligi.ufo.DUBwiseDefinitions , DUBwiseUIDefinitions |
- | |
28 | { |
- | |
29 | - | ||
30 | //#if fileapi=="on" |
- | |
31 | public final static int MAX_FILELIST_LENGTH=100; |
- | |
32 | public final static int MAX_PATH_DEPTH=10; |
- | |
33 | - | ||
34 | byte act_path_depth=0; |
- | |
35 | String[] act_path_arr; |
- | |
36 | - | ||
37 | - | ||
38 | public String act_path() |
- | |
39 | { |
- | |
40 | String res=""; |
- | |
41 | for (int i=0;i<act_path_depth;i++) |
18 | extends Canvas |
42 | res+=act_path_arr[i]; |
- | |
43 | return res; |
19 | implements Runnable,org.ligi.ufo.DUBwiseDefinitions , DUBwiseUIDefinitions |
Line 44... | Line 20... | ||
44 | } |
20 | { |
Line 45... | Line 21... | ||
45 | 21 | ||
Line 63... | Line 39... | ||
63 | 39 | ||
64 | 40 | ||
Line 65... | Line -... | ||
65 | int heading_offset=0; |
- | |
66 | int act_wp; |
- | |
67 | 41 | int heading_offset=0; |
|
68 | 42 | int act_wp; |
|
69 | 43 | ||
Line 70... | Line 44... | ||
70 | //#if bluetooth=="on" |
44 | //#if bluetooth=="on" |
Line 106... | Line 80... | ||
106 | public final static int GRAPH_COUNT=4; |
80 | public final static int GRAPH_COUNT=4; |
107 | public final static int[] graph_colors={0x156315,0xCC1315,0xf8ef02,0x19194d}; |
81 | public final static int[] graph_colors={0x156315,0xCC1315,0xf8ef02,0x19194d}; |
108 | public int[] graph_sources={0,1,2,3}; |
82 | public int[] graph_sources={0,1,2,3}; |
109 | public String[] graph_names={"nick int","roll int","nick acc","roll acc"}; |
83 | public String[] graph_names={"nick int","roll int","nick acc","roll acc"}; |
110 | public int[][] graph_data; |
84 | public int[][] graph_data; |
- | 85 | public int graph_offset=0; |
|
Line 111... | Line 86... | ||
111 | 86 | ||
112 | public int lcd_char_width=0; |
87 | public int lcd_char_width=0; |
Line 113... | Line 88... | ||
113 | public int lcd_char_height=0; |
88 | public int lcd_char_height=0; |
Line 293... | Line 268... | ||
293 | else |
268 | else |
294 | lcd_lines[i]=" " + menu_items[i]; |
269 | lcd_lines[i]=" " + menu_items[i]; |
Line 295... | Line 270... | ||
295 | 270 | ||
296 | 271 | ||
297 | } |
272 | } |
Line 298... | Line 273... | ||
298 | paint_lcd(g,true); |
273 | paint_lcd(g); |
299 | } |
274 | } |
300 | 275 | ||
Line 321... | Line 296... | ||
321 | 296 | ||
Line 322... | Line 297... | ||
322 | } |
297 | } |
323 | 298 | ||
324 | public boolean cam_condition() |
299 | public boolean cam_condition() |
325 | { |
300 | { |
Line 326... | Line 301... | ||
326 | return (mk.stick_data.stick[5]>100); |
301 | return (mk.stick_data.stick[settings.remote_cam_stick]>100); |
Line 327... | Line 302... | ||
327 | } |
302 | } |
328 | 303 | ||
Line 329... | Line 304... | ||
329 | // int lcd_top=25; |
304 | // int lcd_top=25; |
Line 330... | Line 305... | ||
330 | 305 | ||
331 | public void paint_lcd(Graphics g,boolean bottomup) |
306 | public void paint_lcd(Graphics g) |
332 | { |
307 | { |
Line 333... | Line 308... | ||
333 | 308 | ||
334 | int y; |
309 | int y; |
Line 335... | Line 310... | ||
335 | 310 | ||
Line 347... | Line 322... | ||
347 | if ( lcd_off<0) lcd_off=0; |
322 | if ( lcd_off<0) lcd_off=0; |
Line 348... | Line 323... | ||
348 | 323 | ||
349 | for(int i=0;i<display_lines;i++) |
324 | for(int i=0;i<display_lines;i++) |
350 | for (int pos=0;pos<20;pos++) |
325 | for (int pos=0;pos<20;pos++) |
351 | { |
326 | { |
352 | if (bottomup) |
- | |
353 | y=canvas_height-(display_lines-i)*lcd_char_height; |
- | |
354 | else |
327 | /*if (!bottomup) |
- | 328 | y=i*lcd_char_height; |
|
- | 329 | else*/ |
|
- | 330 | y=canvas_height-(display_lines-i)*lcd_char_height; |
|
355 | y=i*lcd_char_height; |
331 | |
356 | g.setClip((lcd_img.getWidth()/222)*pos+spacer_left_right,y,(lcd_img.getWidth()/222),lcd_img.getHeight()); |
332 | g.setClip((lcd_img.getWidth()/222)*pos+spacer_left_right,y,(lcd_img.getWidth()/222),lcd_img.getHeight()); |
Line 357... | Line 333... | ||
357 | g.drawImage(lcd_img,spacer_left_right+(lcd_img.getWidth()/222)*pos-((pos<lcd_lines[i+lcd_off].length()?lcd_lines[i+lcd_off].charAt(pos):' ')-' ')*(lcd_img.getWidth()/222),y,g.TOP | g.LEFT); |
333 | g.drawImage(lcd_img,spacer_left_right+(lcd_img.getWidth()/222)*pos-((pos<lcd_lines[i+lcd_off].length()?lcd_lines[i+lcd_off].charAt(pos):' ')-' ')*(lcd_img.getWidth()/222),y,g.TOP | g.LEFT); |
358 | 334 | ||
Line 359... | Line 335... | ||
359 | } |
335 | } |
360 | } |
336 | } |
361 | 337 | ||
362 | public void load_images() |
338 | public void load_skin_images() |
363 | { |
339 | { |
364 | try |
340 | try |
Line 369... | Line 345... | ||
369 | // load all needed images |
345 | // load all needed images |
370 | switch (settings.act_skin) |
346 | switch (settings.act_skin) |
371 | { |
347 | { |
372 | case SKINID_DARK: |
348 | case SKINID_DARK: |
373 | lcd_img=Image.createImage("/lcd_green.png"); |
349 | lcd_img=Image.createImage("/lcd_green.png"); |
374 | if (settings.do_scrollbg) bg_img=Image.createImage("/starfield.jpg"); break; |
350 | if (settings.do_scrollbg) bg_img=Image.createImage("/starfield.jpg"); |
- | 351 | break; |
|
- | 352 | ||
Line 375... | Line 353... | ||
375 | 353 | ||
376 | case SKINID_LIGHT: |
354 | case SKINID_LIGHT: |
377 | lcd_img=Image.createImage("/lcd_blue.png"); |
355 | lcd_img=Image.createImage("/lcd_blue.png"); |
378 | if (settings.do_scrollbg) bg_img=Image.createImage("/clouds.jpg"); |
356 | if (settings.do_scrollbg) bg_img=Image.createImage("/clouds.jpg"); |
379 | break; |
357 | break; |
380 | } |
- | |
381 | - | ||
382 | - | ||
383 | // bt_img=Image.createImage("/bt.png"); |
- | |
384 | symbols_img=Image.createImage("/symbols.png"); |
- | |
385 | // load_img=Image.createImage("/load.png"); |
- | |
386 | 358 | } |
|
387 | lcd_char_width=lcd_img.getWidth()/222; |
359 | lcd_char_width=lcd_img.getWidth()/222; |
- | 360 | lcd_char_height=lcd_img.getHeight(); |
|
Line -... | Line 361... | ||
- | 361 | } |
|
- | 362 | ||
- | 363 | catch (Exception e) |
|
- | 364 | { |
|
- | 365 | debug.err(e.toString()); |
|
- | 366 | } |
|
- | 367 | ||
- | 368 | } |
|
- | 369 | public void load_global_images() |
|
- | 370 | { |
|
- | 371 | try |
|
Line 388... | Line 372... | ||
388 | lcd_char_height=lcd_img.getHeight(); |
372 | { |
389 | 373 | symbols_img=Image.createImage("/symbols.png"); |
|
390 | 374 | ||
391 | - | ||
392 | if (bg_img!=null) |
- | |
393 | graph_data=new int[GRAPH_COUNT][bg_img.getWidth()]; |
- | |
394 | else |
- | |
395 | graph_data=new int[GRAPH_COUNT][this.getWidth()*2]; |
- | |
396 | - | ||
397 | for (int c=0;c<graph_data[0].length;c++) |
- | |
398 | for (int d=0;d<GRAPH_COUNT;d++) |
- | |
399 | graph_data[d][c]=-1; |
- | |
400 | 375 | ||
401 | try { |
- | |
Line 402... | Line 376... | ||
402 | err_img=null; |
376 | /* if (bg_img!=null) |
Line 403... | Line 377... | ||
403 | err_img=Image.createImage("/preflight.jpg"); |
377 | graph_data=new int[GRAPH_COUNT][bg_img.getWidth()]; |
404 | } |
378 | else |
405 | catch (Exception e) { } |
379 | */ |
406 | 380 | ||
Line 407... | Line 381... | ||
407 | } |
381 | } |
Line -... | Line 382... | ||
- | 382 | ||
408 | 383 | catch (Exception e) |
|
409 | catch (Exception e) |
384 | { |
Line 410... | Line 385... | ||
410 | { |
385 | debug.err(e.toString()); |
411 | debug.err(e.toString()); |
386 | } |
412 | } |
- | |
413 | 387 | ||
Line 414... | Line 388... | ||
414 | } |
388 | } |
Line 415... | Line 389... | ||
415 | 389 | ||
416 | public DUBwiseCanvas(DUBwise _root) |
390 | // construct |
417 | { |
391 | public DUBwiseCanvas(DUBwise _root) |
418 | 392 | { |
|
- | 393 | ||
419 | //#if fileapi=="on" |
394 | //#if fileapi=="on" |
Line 420... | Line 395... | ||
420 | file_list= new String[MAX_FILELIST_LENGTH]; |
395 | file_access=new DUBwiseFileAccess(this); |
421 | act_path_arr=new String[MAX_PATH_DEPTH]; |
396 | //#endif |
422 | //#endif |
397 | |
Line 423... | Line -... | ||
423 | - | ||
424 | root=_root; |
- | |
425 | 398 | root=_root; |
|
426 | mk = new org.ligi.ufo.MKCommunicator(); |
399 | |
427 | helper = new DUBwiseHelper(); |
400 | mk = new org.ligi.ufo.MKCommunicator(); |
Line 428... | Line -... | ||
428 | settings = new DUBwiseSettings(this); |
- | |
Line 429... | Line -... | ||
429 | settings.load(); |
- | |
430 | debug = new DUBwiseDebug(this); |
- | |
Line 431... | Line 401... | ||
431 | 401 | helper = new DUBwiseHelper(); |
|
432 | //#if bluetooth=="on" |
402 | settings = new DUBwiseSettings(this); |
Line 433... | Line 403... | ||
433 | bt_scanner = new BTSearcher(); |
403 | settings.load(); |
Line 434... | Line 404... | ||
434 | //#endif |
404 | load_global_images(); |
Line -... | Line 405... | ||
- | 405 | debug = new DUBwiseDebug(this); |
|
- | 406 | ||
435 | 407 | //#if bluetooth=="on" |
|
Line 436... | Line -... | ||
436 | - | ||
437 | - | ||
438 | 408 | bt_scanner = new BTSearcher(); |
|
439 | //#if voice_mode!="no_voice" |
409 | //#endif |
440 | status_voice=new MKStatusVoice(mk,this); |
410 | |
441 | //#endif |
411 | |
442 | - | ||
443 | - | ||
444 | // load_images(); |
412 | //#if voice_mode!="no_voice" |
445 | 413 | status_voice=new MKStatusVoice(mk,this); |
|
446 | if (settings.connection_url!="") |
414 | //#endif |
Line 494... | Line 462... | ||
494 | } |
462 | } |
Line 495... | Line 463... | ||
495 | 463 | ||
496 | 464 | ||
- | 465 | switch(state) |
|
- | 466 | { |
|
- | 467 | ||
- | 468 | case STATEID_GRAPH: |
|
- | 469 | graph_offset--; |
|
- | 470 | if (graph_offset==-graph_data[0].length) |
|
- | 471 | graph_offset=0; |
|
497 | switch(state) |
472 | break; |
Line 498... | Line 473... | ||
498 | { |
473 | |
499 | case STATEID_CAMMODE: |
474 | case STATEID_CAMMODE: |
500 | 475 | ||
501 | try |
476 | try |
502 | { |
477 | { |
503 | if(cam_condition()) |
478 | if(cam_condition()) |
504 | { |
479 | { |
Line -... | Line 480... | ||
- | 480 | cam_img=null; |
|
505 | cam_img=null; |
481 | debug.log("get snap\n"); |
506 | debug.log("get snap\n"); |
482 | cam_raw = mVideoControl.getSnapshot(null); |
507 | cam_raw = mVideoControl.getSnapshot(null); |
483 | |
508 | 484 | ||
Line 509... | Line 485... | ||
509 | try { Thread.sleep(4000); } |
485 | try { Thread.sleep(4000); } |
- | 486 | catch (Exception e) |
|
510 | catch (Exception e) |
487 | { |
511 | { |
488 | debug.log("Problem Sleeping "); |
512 | debug.log("Problem Sleeping "); |
489 | |
513 | 490 | } |
|
514 | } |
491 | cam_img = Image.createImage(cam_raw, 0, cam_raw.length); |
515 | } |
492 | } |
516 | else |
493 | else |
517 | { |
494 | { |
518 | if (cam_img==null) |
495 | if (cam_img==null) |
519 | cam_img = Image.createImage(cam_raw, 0, cam_raw.length); |
496 | ;; |
Line 630... | Line 607... | ||
630 | settings.gps_format=mk.gps_position.act_gps_format; |
607 | settings.gps_format=mk.gps_position.act_gps_format; |
631 | settings.save(); |
608 | settings.save(); |
632 | root.quit(); |
609 | root.quit(); |
633 | } |
610 | } |
Line 634... | Line 611... | ||
634 | 611 | ||
635 | try { |
612 | |
- | 613 | //rescan=false; |
|
- | 614 | ||
- | 615 | if (bg_img!=null) |
|
636 | //rescan=false; |
616 | { |
637 | bg_offset--; |
617 | bg_offset--; |
638 | if (bg_offset==-graph_data[0].length) |
618 | if (bg_offset==-bg_img.getWidth()) |
- | 619 | bg_offset=0; |
|
- | 620 | } |
|
- | 621 | ||
- | 622 | ||
- | 623 | ||
639 | bg_offset=0; |
624 | |
- | 625 | //#if devicecontrol=="on" |
|
- | 626 | ||
640 | //#if devicecontrol=="on" |
627 | try { |
641 | if (settings.keep_lighton) com.nokia.mid.ui.DeviceControl.setLights(0,100); |
628 | if (settings.keep_lighton) com.nokia.mid.ui.DeviceControl.setLights(0,100); |
642 | //#endif |
629 | //#endif |
643 | } |
630 | } |
Line 745... | Line 732... | ||
745 | //default Font |
732 | //default Font |
746 | g.setFont(f1); |
733 | g.setFont(f1); |
Line 747... | Line 734... | ||
747 | 734 | ||
748 | 735 | ||
749 | //draw background |
736 | //draw background |
750 | if ((!settings.do_scrollbg) || (state==STATEID_EDIT_PARAMS)) |
737 | if (!settings.do_scrollbg) |
751 | { |
738 | { |
Line 752... | Line 739... | ||
752 | g.setColor(0xdedfff); |
739 | g.setColor(0xdedfff); |
Line 877... | Line 864... | ||
877 | int err_img_left=(canvas_width-err_img.getWidth()/2)/2; |
864 | int err_img_left=(canvas_width-err_img.getWidth()/2)/2; |
878 | int err_img_top=(canvas_height-err_img.getHeight())/2; |
865 | int err_img_top=(canvas_height-err_img.getHeight())/2; |
879 | g.setClip(err_img_left,err_img_top,err_img.getWidth()/2,err_img.getHeight()); |
866 | g.setClip(err_img_left,err_img_top,err_img.getWidth()/2,err_img.getHeight()); |
880 | g.drawImage(err_img,err_img_left-err_img.getWidth()/2,err_img_top, g.TOP | g.LEFT); |
867 | g.drawImage(err_img,err_img_left-err_img.getWidth()/2,err_img_top, g.TOP | g.LEFT); |
881 | } |
868 | } |
882 | paint_lcd(g,true); |
869 | paint_lcd(g); |
Line 883... | Line 870... | ||
883 | 870 | ||
Line 884... | Line 871... | ||
884 | break; |
871 | break; |
Line 1063... | Line 1050... | ||
1063 | break; |
1050 | break; |
Line 1064... | Line 1051... | ||
1064 | 1051 | ||
1065 | //#if fileapi=="on" |
1052 | //#if fileapi=="on" |
1066 | case STATEID_FILEOPEN: |
1053 | case STATEID_FILEOPEN: |
1067 | y_off+=spacer; |
1054 | y_off+=spacer; |
1068 | g.drawString("act_path" + act_path() ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1055 | g.drawString("act_path" + file_access.act_path() ,0,y_off,Graphics.TOP | Graphics.LEFT); |
1069 | paint_menu(g); |
1056 | paint_menu(g); |
1070 | break; |
1057 | break; |
1071 | //#endif |
1058 | //#endif |
1072 | case STATEID_STRINGINPUT: |
1059 | case STATEID_STRINGINPUT: |
1073 | case STATEID_ABOUT: |
1060 | case STATEID_ABOUT: |
1074 | case STATEID_IPINPUT: |
1061 | case STATEID_IPINPUT: |
1075 | paint_lcd(g,true); |
1062 | paint_lcd(g); |
Line 1076... | Line 1063... | ||
1076 | break; |
1063 | break; |
1077 | 1064 | ||
1078 | case STATEID_READ_PARAMS: |
1065 | case STATEID_READ_PARAMS: |
Line 1079... | Line 1066... | ||
1079 | paint_lcd(g,true); |
1066 | paint_lcd(g); |
1080 | break; |
1067 | break; |
1081 | 1068 | ||
1082 | 1069 | ||
1083 | //#if bluetooth=="on" |
1070 | //#if bluetooth=="on" |
1084 | case STATEID_SCANNING: |
1071 | case STATEID_SCANNING: |
1085 | paint_lcd(g,true); |
1072 | paint_lcd(g); |
1086 | break; |
1073 | break; |
Line 1239... | Line 1226... | ||
1239 | for (int gr=0;gr<GRAPH_COUNT;gr++) |
1226 | for (int gr=0;gr<GRAPH_COUNT;gr++) |
1240 | { |
1227 | { |
Line 1241... | Line 1228... | ||
1241 | 1228 | ||
1242 | g.setColor(graph_colors[gr]); |
1229 | g.setColor(graph_colors[gr]); |
1243 | try { |
1230 | try { |
1244 | graph_data[gr][-bg_offset]=mk.debug_data.analog[graph_sources[gr]]; |
1231 | graph_data[gr][-graph_offset]=mk.debug_data.analog[graph_sources[gr]]; |
1245 | } |
1232 | } |
1246 | catch (Exception e) |
1233 | catch (Exception e) |
1247 | { |
1234 | { |
Line 1251... | Line 1238... | ||
1251 | 1238 | ||
1252 | 1239 | ||
1253 | 1240 | ||
1254 | for ( int x=0;x<canvas_width;x++) |
1241 | for ( int x=0;x<canvas_width;x++) |
1255 | { |
1242 | { |
1256 | int p= (((-bg_offset+x-canvas_width-5))); |
1243 | int p= (((-graph_offset+x-canvas_width-5))); |
Line 1257... | Line 1244... | ||
1257 | if (p<1) |
1244 | if (p<1) |
Line 1332... | Line 1319... | ||
1332 | 1319 | ||
1333 | } |
1320 | } |
1334 | Player mPlayer; |
1321 | Player mPlayer; |
1335 | VideoControl mVideoControl; |
1322 | VideoControl mVideoControl; |
- | 1323 | Image cam_img; |
|
1336 | Image cam_img; |
1324 | Image last_cam_img; |
1337 | int cam_img_seq=0; |
1325 | int cam_img_seq=0; |
Line 1338... | Line 1326... | ||
1338 | byte[] cam_raw; |
1326 | byte[] cam_raw; |
1339 | 1327 | ||
Line 1380... | Line 1368... | ||
1380 | 1368 | ||
1381 | public void chg_state(byte next_state) |
1369 | public void chg_state(byte next_state) |
1382 | { |
1370 | { |
1383 | settings_editor = null; |
1371 | settings_editor = null; |
- | 1372 | params_editor = null; |
|
- | 1373 | err_img=null; |
|
- | 1374 | graph_data=null; |
|
Line 1384... | Line 1375... | ||
1384 | params_editor = null; |
1375 | |
1385 | 1376 | ||
1386 | if (next_state!=state)act_menu_select=0; |
1377 | if (next_state!=state)act_menu_select=0; |
1387 | // prepare next state |
1378 | // prepare next state |
- | 1379 | switch(next_state) |
|
- | 1380 | { |
|
- | 1381 | case STATEID_NC_ERRORS: |
|
- | 1382 | lcd_lines=new String[1]; |
|
- | 1383 | lcd_lines[0]=""+mk.error_str; |
|
- | 1384 | try |
|
- | 1385 | { |
|
- | 1386 | err_img=Image.createImage("/preflight.jpg"); |
|
- | 1387 | } |
|
- | 1388 | catch (Exception e) |
|
- | 1389 | { |
|
- | 1390 | debug.log("problem loading error image"); |
|
- | 1391 | } |
|
1388 | switch(next_state) |
1392 | |
1389 | { |
1393 | break; |
1390 | case STATEID_EDIT_PARAMS: |
1394 | case STATEID_EDIT_PARAMS: |
1391 | params_editor = new MKParamsEditor(this,mk.params,STATEID_HANDLE_PARAMS); |
1395 | params_editor = new MKParamsEditor(this,mk.params,STATEID_HANDLE_PARAMS); |
1392 | break; |
1396 | break; |
Line 1405... | Line 1409... | ||
1405 | mk.init_bootloader=true; |
1409 | mk.init_bootloader=true; |
1406 | break; |
1410 | break; |
Line 1407... | Line 1411... | ||
1407 | 1411 | ||
1408 | //#if fileapi=="on" |
1412 | //#if fileapi=="on" |
1409 | case STATEID_FILEOPEN: |
- | |
1410 | if (act_path_depth==0) |
- | |
1411 | { |
- | |
1412 | Enumeration drives = FileSystemRegistry.listRoots(); |
- | |
1413 | int tmp_i=0; |
- | |
1414 | while(drives.hasMoreElements()) |
- | |
1415 | { |
- | |
1416 | file_list[tmp_i]= (String) drives.nextElement(); |
- | |
1417 | tmp_i++; |
- | |
1418 | - | ||
1419 | if (MAX_FILELIST_LENGTH<tmp_i) |
- | |
1420 | break; |
- | |
1421 | } |
- | |
1422 | menu_items=new String[tmp_i]; |
- | |
1423 | lcd_lines=new String[tmp_i]; |
1413 | case STATEID_FILEOPEN: |
1424 | file_list_length=tmp_i; |
- | |
1425 | - | ||
1426 | for(tmp_i=0;tmp_i<file_list_length;tmp_i++) |
- | |
1427 | menu_items[tmp_i]=file_list[tmp_i]; |
- | |
1428 | - | ||
1429 | } |
- | |
1430 | else |
- | |
1431 | { |
- | |
1432 | - | ||
1433 | try { |
- | |
1434 | FileConnection fc = (FileConnection) Connector.open("file:///"+act_path()); |
- | |
1435 | Enumeration filelist = fc.list("*", true); |
- | |
1436 | int tmp_i=0; |
- | |
1437 | while(filelist.hasMoreElements()) { |
- | |
1438 | file_list[tmp_i] = (String) filelist.nextElement(); |
- | |
1439 | tmp_i++; |
- | |
1440 | /* fc = (FileConnection) |
- | |
1441 | Connector.open("file:///CFCard/" + fileName); |
- | |
1442 | if(fc.isDirectory()) { |
- | |
1443 | System.out.println("\tDirectory Name: " + fileName); |
- | |
1444 | } else { |
- | |
1445 | System.out.println |
- | |
1446 | ("\tFile Name: " + fileName + |
- | |
1447 | "\tSize: "+fc.fileSize()); |
- | |
1448 | }*/ |
- | |
1449 | - | ||
1450 | } |
- | |
1451 | - | ||
1452 | menu_items=new String[tmp_i+1]; |
- | |
1453 | lcd_lines=new String[tmp_i+1]; |
- | |
1454 | file_list_length=tmp_i+1; |
- | |
1455 | - | ||
1456 | menu_items[0]=".."; |
- | |
1457 | for(tmp_i=1;tmp_i<file_list_length;tmp_i++) |
- | |
1458 | menu_items[tmp_i]=file_list[tmp_i-1]; |
- | |
1459 | - | ||
1460 | - | ||
1461 | fc.close(); |
- | |
1462 | } catch (IOException ioe) { |
- | |
1463 | System.out.println(ioe.getMessage()); |
- | |
1464 | } |
- | |
1465 | } |
- | |
1466 | - | ||
1467 | 1414 | file_access.trigger(); |
|
1468 | break; |
1415 | break; |
Line 1469... | Line 1416... | ||
1469 | //#endif |
1416 | //#endif |
1470 | 1417 | ||
Line 1483... | Line 1430... | ||
1483 | 1430 | ||
1484 | menu_items[5]="back"; |
1431 | menu_items[5]="back"; |
Line 1485... | Line -... | ||
1485 | break; |
- | |
1486 | - | ||
1487 | - | ||
1488 | case STATEID_NC_ERRORS: |
- | |
1489 | lcd_lines=new String[1]; |
- | |
1490 | lcd_lines[0]=""+mk.error_str; |
1432 | break; |
1491 | break; |
1433 | |
1492 | 1434 | ||
1493 | case STATEID_ABOUT: |
1435 | case STATEID_ABOUT: |
1494 | lcd_lines=credits; |
1436 | lcd_lines=credits; |
1495 | lcd_lines[1]=" ufo-lib: " + mk.lib_version_str(); |
1437 | lcd_lines[1]=" ufo-lib: " + mk.lib_version_str(); |
1496 | act_menu_select=max_lines-1; |
1438 | act_menu_select=max_lines-1; |
1497 | break; |
1439 | break; |
1498 | case STATEID_CONN_DETAILS: |
- | |
1499 | setup_menu(conn_details_menu_items,conn_details_menu_actions); |
- | |
1500 | break; |
- | |
1501 | 1440 | case STATEID_CONN_DETAILS: |
|
1502 | 1441 | setup_menu(conn_details_menu_items,conn_details_menu_actions); |
|
1503 | 1442 | break; |
|
1504 | case STATEID_TRAFFIC: |
1443 | case STATEID_TRAFFIC: |
1505 | setup_menu(onlyback_menu_items,back_to_conndetails_actions); |
- | |
- | 1444 | setup_menu(onlyback_menu_items,back_to_conndetails_actions); |
|
1506 | break; |
1445 | break; |
1507 | case STATEID_CAMMODE: |
1446 | case STATEID_CAMMODE: |
1508 | 1447 | mk.user_intent=USER_INTENT_RCDATA; |
|
1509 | if (mVideoControl==null) |
1448 | if (mVideoControl==null) |
1510 | try |
1449 | try |
Line 1625... | Line 1564... | ||
1625 | mk.user_intent=USER_INTENT_RAWDEBUG; |
1564 | mk.user_intent=USER_INTENT_RAWDEBUG; |
1626 | break; |
1565 | break; |
Line 1627... | Line 1566... | ||
1627 | 1566 | ||
- | 1567 | ||
- | 1568 | case STATEID_GRAPH: |
|
- | 1569 | graph_data=new int[GRAPH_COUNT][this.getWidth()*2]; |
|
- | 1570 | ||
- | 1571 | for (int c=0;c<graph_data[0].length;c++) |
|
- | 1572 | for (int d=0;d<GRAPH_COUNT;d++) |
|
- | 1573 | graph_data[d][c]=-1; |
|
1628 | 1574 | ||
1629 | case STATEID_GRAPH: |
1575 | |
Line 1630... | Line 1576... | ||
1630 | mk.user_intent=USER_INTENT_GRAPH; |
1576 | mk.user_intent=USER_INTENT_GRAPH; |
1631 | break; |
1577 | break; |
Line 1761... | Line 1707... | ||
1761 | debug.log("KeyCode:"+keyCode); |
1707 | debug.log("KeyCode:"+keyCode); |
1762 | // key-actions common in all states |
1708 | // key-actions common in all states |
1763 | debug.process_key(keyCode); |
1709 | debug.process_key(keyCode); |
Line 1764... | Line 1710... | ||
1764 | 1710 | ||
1765 | 1711 | ||
1766 | if (((keyCode==KEY_STAR) || (keyCode==113) ))//&&(state!= STATEID_STRINGINPUT)) |
1712 | if ((keyCode==KEY_STAR) || (keyCode==settings.key_back) )//&&(state!= STATEID_STRINGINPUT)) |
1767 | { |
1713 | { |
1768 | if (state==STATEID_EDIT_PARAMS) |
1714 | if (state==STATEID_EDIT_PARAMS) |
1769 | { |
1715 | { |
Line 1778... | Line 1724... | ||
1778 | } |
1724 | } |
Line 1779... | Line 1725... | ||
1779 | 1725 | ||
Line 1780... | Line 1726... | ||
1780 | } |
1726 | } |
1781 | 1727 | ||
1782 | 1728 | ||
Line 1783... | Line 1729... | ||
1783 | if ((keyCode==KEY_POUND)&&(state!=STATEID_KEYCONTROL)) |
1729 | if (((keyCode==KEY_POUND)||(keyCode==settings.key_fullscreen))&&(state!=STATEID_KEYCONTROL)) |
1784 | { |
1730 | { |
Line 2078... | Line 2024... | ||
2078 | */ |
2024 | */ |
2079 | //#if fileapi=="on" |
2025 | //#if fileapi=="on" |
2080 | case STATEID_FILEOPEN: |
2026 | case STATEID_FILEOPEN: |
2081 | if ( getGameAction (keyCode)==FIRE ) |
2027 | if ( getGameAction (keyCode)==FIRE ) |
2082 | { |
2028 | { |
2083 | if ((act_menu_select==0)&&(act_path_depth!=0)) |
- | |
2084 | { |
- | |
2085 | act_path_depth--; |
- | |
2086 | //act_path=act_path.substring(0,act_path.substring(0,act_path.length()-2).indexOf('/') ); |
- | |
2087 | - | ||
2088 | //act_path=last_path; |
- | |
2089 | } |
- | |
2090 | else |
- | |
2091 | { |
- | |
2092 | //last_path=act_path; |
- | |
2093 | if (act_path_depth==0) |
- | |
2094 | act_path_arr[act_path_depth++]=file_list[act_menu_select]; |
- | |
2095 | else |
- | |
2096 | act_path_arr[act_path_depth++]=file_list[act_menu_select-1]; |
- | |
2097 | } |
- | |
2098 | act_menu_select=0; |
2029 | file_access.fire(); |
2099 | chg_state(STATEID_FILEOPEN); |
- | |
2100 | - | ||
2101 | } |
2030 | } |
2102 | else |
2031 | else |
2103 | menu_keypress(keyCode); |
2032 | menu_keypress(keyCode); |
2104 | break; |
2033 | break; |