Rev 219 | Rev 221 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 219 | Rev 220 | ||
---|---|---|---|
Line 72... | Line 72... | ||
72 | //#endif |
72 | //#endif |
Line 73... | Line 73... | ||
73 | 73 | ||
74 | public org.ligi.ufo.MKCommunicator mk=null; |
74 | public org.ligi.ufo.MKCommunicator mk=null; |
75 | // private MKStatistics mk_stat=null; |
75 | // private MKStatistics mk_stat=null; |
- | 76 | private MKParamsEditor params_editor=null; |
|
76 | private MKParamsEditor params_editor=null; |
77 | private MKParamsEditor settings_editor=null; |
77 | public DUBwiseDebug debug=null; |
78 | public DUBwiseDebug debug=null; |
Line 78... | Line 79... | ||
78 | public DUBwiseHelper helper=null; |
79 | public DUBwiseHelper helper=null; |
Line 301... | Line 302... | ||
301 | { |
302 | { |
302 | debug.log("Menu with KeyCode:"+keyCode); |
303 | debug.log("Menu with KeyCode:"+keyCode); |
303 | switch (getGameAction (keyCode)) |
304 | switch (getGameAction (keyCode)) |
304 | { |
305 | { |
305 | case UP: |
306 | case UP: |
306 | if (act_menu_select!=0) act_menu_select--; |
307 | if (act_menu_select!=0) |
- | 308 | act_menu_select--; |
|
307 | else |
309 | else |
308 | act_menu_select=menu_items.length-1; |
310 | act_menu_select=menu_items.length-1; |
309 | break; |
311 | break; |
Line 310... | Line 312... | ||
310 | 312 | ||
311 | case DOWN: |
313 | case DOWN: |
- | 314 | if (act_menu_select<(menu_items.length-1)) |
|
- | 315 | act_menu_select++; |
|
312 | if (act_menu_select<(menu_items.length-1)) act_menu_select++; |
316 | else |
313 | else act_menu_select=0; |
317 | act_menu_select=0; |
Line 314... | Line 318... | ||
314 | break; |
318 | break; |
Line 315... | Line 319... | ||
315 | 319 | ||
Line 327... | Line 331... | ||
327 | public void paint_lcd(Graphics g,boolean bottomup) |
331 | public void paint_lcd(Graphics g,boolean bottomup) |
328 | { |
332 | { |
Line 329... | Line 333... | ||
329 | 333 | ||
Line 330... | Line 334... | ||
330 | int y; |
334 | int y; |
- | 335 | ||
331 | 336 | // int lcd_top= (state==STATEID_EDIT_PARAMS?0:25); |
|
Line 332... | Line 337... | ||
332 | int lcd_top= (state==STATEID_EDIT_PARAMS?0:25); |
337 | int lcd_top= 25; |
333 | max_lines=(canvas_height-lcd_top)/lcd_char_height; |
338 | max_lines=(canvas_height-lcd_top)/lcd_char_height; |
Line 334... | Line 339... | ||
334 | 339 | ||
Line 335... | Line 340... | ||
335 | int spacer_left_right=(canvas_width-(20*(lcd_img.getWidth()/222)))/2; |
340 | int spacer_left_right=(canvas_width-(20*(lcd_img.getWidth()/222)))/2; |
336 | // for(int i=0;i<lcd_lines.length;i++) |
341 | // for(int i=0;i<lcd_lines.length;i++) |
Line 337... | Line 342... | ||
337 | 342 | ||
338 | int display_lines=(lcd_lines.length>max_lines?max_lines:lcd_lines.length); |
343 | int display_lines=(lcd_lines.length>max_lines?max_lines:lcd_lines.length); |
339 | 344 | ||
Line 418... | Line 423... | ||
418 | 423 | ||
Line 419... | Line 424... | ||
419 | root=_root; |
424 | root=_root; |
420 | 425 | ||
421 | mk = new org.ligi.ufo.MKCommunicator(); |
426 | mk = new org.ligi.ufo.MKCommunicator(); |
- | 427 | helper = new DUBwiseHelper(); |
|
422 | helper = new DUBwiseHelper(); |
428 | settings = new DUBwiseSettings(this); |
Line 423... | Line 429... | ||
423 | settings = new DUBwiseSettings(); |
429 | settings.load(); |
424 | debug = new DUBwiseDebug(this); |
430 | debug = new DUBwiseDebug(this); |
425 | 431 | ||
Line 426... | Line -... | ||
426 | //#if bluetooth=="on" |
- | |
- | 432 | //#if bluetooth=="on" |
|
- | 433 | bt_scanner = new BTSearcher(); |
|
Line 427... | Line 434... | ||
427 | bt_scanner = new BTSearcher(); |
434 | //#endif |
428 | //#endif |
435 | |
429 | 436 | ||
Line 430... | Line 437... | ||
430 | params_editor = new MKParamsEditor(this); |
437 | |
Line 431... | Line 438... | ||
431 | 438 | ||
432 | //#if voice_mode!="no_voice" |
439 | //#if voice_mode!="no_voice" |
Line 433... | Line 440... | ||
433 | status_voice=new MKStatusVoice(mk,this); |
440 | status_voice=new MKStatusVoice(mk,this); |
Line 1173... | Line 1180... | ||
1173 | 1180 | ||
Line -... | Line 1181... | ||
- | 1181 | ||
- | 1182 | ||
- | 1183 | break; |
|
- | 1184 | ||
1174 | 1185 | case STATEID_SETTINGSMENU: |
|
1175 | 1186 | ||
1176 | break; |
1187 | settings_editor.paint(g); |
1177 | 1188 | break; |
|
Line 1178... | Line -... | ||
1178 | // falltru wanted |
- | |
- | 1189 | // falltru wanted |
|
Line 1179... | Line 1190... | ||
1179 | case STATEID_SELECT_SPEED_FORMAT: |
1190 | // case STATEID_SELECT_SPEED_FORMAT: |
1180 | case STATEID_SELECT_GPS_FORMAT: |
1191 | // case STATEID_SELECT_GPS_FORMAT: |
Line 1181... | Line 1192... | ||
1181 | case STATEID_MAINMENU: |
1192 | case STATEID_MAINMENU: |
Line 1367... | Line 1378... | ||
1367 | // int intro_str_delay=3; |
1378 | // int intro_str_delay=3; |
1368 | // boolean init_bootloader=false; |
1379 | // boolean init_bootloader=false; |
Line 1369... | Line 1380... | ||
1369 | 1380 | ||
1370 | public void chg_state(byte next_state) |
1381 | public void chg_state(byte next_state) |
- | 1382 | { |
|
- | 1383 | settings_editor = null; |
|
- | 1384 | params_editor = null; |
|
1371 | { |
1385 | |
1372 | if (next_state!=state)act_menu_select=0; |
1386 | if (next_state!=state)act_menu_select=0; |
1373 | // prepare next state |
1387 | // prepare next state |
1374 | switch(next_state) |
1388 | switch(next_state) |
- | 1389 | { |
|
- | 1390 | case STATEID_EDIT_PARAMS: |
|
- | 1391 | params_editor = new MKParamsEditor(this,mk.params,STATEID_HANDLE_PARAMS); |
|
1375 | { |
1392 | break; |
1376 | case STATEID_STRINGINPUT: |
1393 | case STATEID_STRINGINPUT: |
1377 | lcd_lines=new String[2]; |
1394 | lcd_lines=new String[2]; |
1378 | lcd_lines[0]=act_input_str; |
1395 | lcd_lines[0]=act_input_str; |
Line 1480... | Line 1497... | ||
1480 | break; |
1497 | break; |
1481 | case STATEID_CONN_DETAILS: |
1498 | case STATEID_CONN_DETAILS: |
1482 | setup_menu(conn_details_menu_items,conn_details_menu_actions); |
1499 | setup_menu(conn_details_menu_items,conn_details_menu_actions); |
1483 | break; |
1500 | break; |
Line 1484... | Line -... | ||
1484 | - | ||
1485 | case STATEID_SELECT_GPS_FORMAT: |
- | |
1486 | setup_menu(set_gps_format_menu_items,set_gps_format_menu_actions); |
- | |
1487 | - | ||
Line 1488... | Line -... | ||
1488 | break; |
- | |
1489 | - | ||
1490 | - | ||
1491 | case STATEID_SELECT_SPEED_FORMAT: |
- | |
1492 | setup_menu(set_speed_format_menu_items,set_speed_format_menu_actions); |
- | |
1493 | 1501 | ||
1494 | break; |
1502 | |
1495 | 1503 | ||
1496 | case STATEID_TRAFFIC: |
1504 | case STATEID_TRAFFIC: |
Line 1589... | Line 1597... | ||
1589 | setup_main_menu(); |
1597 | setup_main_menu(); |
Line 1590... | Line 1598... | ||
1590 | 1598 | ||
Line 1591... | Line 1599... | ||
1591 | break; |
1599 | break; |
- | 1600 | ||
1592 | 1601 | case STATEID_SETTINGSMENU: |
|
1593 | case STATEID_SETTINGSMENU: |
1602 | settings_editor = new MKParamsEditor(this,settings,STATEID_MAINMENU); |
1594 | 1603 | /* |
|
1595 | menu_items=new String[settings_menu_items.length]; |
1604 | menu_items=new String[settings_menu_items.length]; |
Line 1596... | Line 1605... | ||
1596 | for(int cnt=0;cnt<settings_menu_items.length;cnt++) |
1605 | for(int cnt=0;cnt<settings_menu_items.length;cnt++) |
Line 1607... | Line 1616... | ||
1607 | //#if devicecontrol=="on" |
1616 | //#if devicecontrol=="on" |
1608 | menu_items[7]+=(!settings.keep_lighton)?"Off":"On"; |
1617 | menu_items[7]+=(!settings.keep_lighton)?"Off":"On"; |
1609 | //#endif |
1618 | //#endif |
1610 | menu_items[8]+=(!settings.expert_mode)?" Off":" On"; |
1619 | menu_items[8]+=(!settings.expert_mode)?" Off":" On"; |
1611 | menu_actions=settings_menu_actions; |
1620 | menu_actions=settings_menu_actions; |
1612 | lcd_lines=new String[menu_items.length]; |
1621 | lcd_lines=new String[menu_items.length];*/ |
1613 | break; |
1622 | break; |
Line 1614... | Line 1623... | ||
1614 | 1623 | ||
1615 | case STATEID_RAWDEBUG: |
1624 | case STATEID_RAWDEBUG: |
1616 | mk.user_intent=USER_INTENT_RAWDEBUG; |
1625 | mk.user_intent=USER_INTENT_RAWDEBUG; |
Line 1663... | Line 1672... | ||
1663 | mk.extern_control[EXTERN_CONTROL_GIER]=(byte)(-mul*settings.default_extern_control[EXTERN_CONTROL_GIER]); |
1672 | mk.extern_control[EXTERN_CONTROL_GIER]=(byte)(-mul*settings.default_extern_control[EXTERN_CONTROL_GIER]); |
1664 | else if (keyCode==this.KEY_NUM3) |
1673 | else if (keyCode==this.KEY_NUM3) |
1665 | mk.extern_control[EXTERN_CONTROL_GIER]=(byte)(mul*settings.default_extern_control[EXTERN_CONTROL_GIER]); |
1674 | mk.extern_control[EXTERN_CONTROL_GIER]=(byte)(mul*settings.default_extern_control[EXTERN_CONTROL_GIER]); |
Line 1666... | Line 1675... | ||
1666 | 1675 | ||
1667 | else if (keyCode==this.KEY_NUM1) |
1676 | else if (keyCode==this.KEY_NUM1) |
1668 | mk.extern_control[EXTERN_CONTROL_HIGHT]+=mul; |
1677 | mk.extern_control[EXTERN_CONTROL_HIGHT]+=mul*settings.default_extern_control[EXTERN_CONTROL_HIGHT]; |
1669 | else if (keyCode==this.KEY_NUM4) |
1678 | else if (keyCode==this.KEY_NUM4) |
Line 1670... | Line 1679... | ||
1670 | mk.extern_control[EXTERN_CONTROL_HIGHT]-=mul; |
1679 | mk.extern_control[EXTERN_CONTROL_HIGHT]-=mul*settings.default_extern_control[EXTERN_CONTROL_HIGHT]; |
1671 | 1680 | ||
1672 | 1681 | ||
1673 | else if (keyCode==this.KEY_NUM6) |
1682 | else if (keyCode==this.KEY_NUM6) |
Line 1674... | Line 1683... | ||
1674 | { if ( mk.extern_control[EXTERN_CONTROL_GAS]<255) mk.extern_control[EXTERN_CONTROL_GAS]+=mul; } |
1683 | { if ( mk.extern_control[EXTERN_CONTROL_GAS]<255) mk.extern_control[EXTERN_CONTROL_GAS]+=mul*settings.default_extern_control[EXTERN_CONTROL_GAS]; } |
1675 | else if (keyCode==this.KEY_NUM9) |
1684 | else if (keyCode==this.KEY_NUM9) |
1676 | { if ( mk.extern_control[EXTERN_CONTROL_GAS]>0) mk.extern_control[EXTERN_CONTROL_GAS]-=mul; } |
1685 | { if ( mk.extern_control[EXTERN_CONTROL_GAS]>0) mk.extern_control[EXTERN_CONTROL_GAS]-=mul*settings.default_extern_control[EXTERN_CONTROL_GAS]; } |
1677 | 1686 | ||
Line 1771... | Line 1780... | ||
1771 | } |
1780 | } |
Line 1772... | Line 1781... | ||
1772 | 1781 | ||
1773 | 1782 | ||
1774 | if ((keyCode==KEY_POUND)&&(state!=STATEID_KEYCONTROL)) |
1783 | if ((keyCode==KEY_POUND)&&(state!=STATEID_KEYCONTROL)) |
1775 | { |
- | |
- | 1784 | { |
|
1776 | settings.fullscreen=!settings.fullscreen; |
1785 | settings.toggle_fullscreen(); |
1777 | setFullScreenMode(settings.fullscreen); |
1786 | |
Line 1778... | Line 1787... | ||
1778 | return; |
1787 | return; |
1779 | } |
1788 | } |
Line 2094... | Line 2103... | ||
2094 | menu_keypress(keyCode); |
2103 | menu_keypress(keyCode); |
2095 | break; |
2104 | break; |
Line 2096... | Line 2105... | ||
2096 | 2105 | ||
Line -... | Line 2106... | ||
- | 2106 | //#endif |
|
- | 2107 | ||
- | 2108 | case STATEID_SETTINGSMENU: |
|
Line 2097... | Line 2109... | ||
2097 | //#endif |
2109 | settings_editor.keypress(keyCode,getGameAction (keyCode)) ; |
2098 | 2110 | break; |
|
2099 | 2111 | ||
2100 | // handle menue |
2112 | // handle menue |
2101 | case STATEID_SELECT_SPEED_FORMAT: |
2113 | // case STATEID_SELECT_SPEED_FORMAT: |
2102 | case STATEID_SELECT_GPS_FORMAT: |
2114 | // case STATEID_SELECT_GPS_FORMAT: |
2103 | case STATEID_TRAFFIC: |
- | |
- | 2115 | case STATEID_TRAFFIC: |
|
2104 | case STATEID_CONN_DETAILS: |
2116 | case STATEID_CONN_DETAILS: |
Line 2105... | Line 2117... | ||
2105 | case STATEID_HANDLE_PARAMS: |
2117 | case STATEID_HANDLE_PARAMS: |
2106 | case STATEID_SETTINGSMENU: |
2118 | |
2107 | case STATEID_MAINMENU: |
2119 | case STATEID_MAINMENU: |
2108 | 2120 | ||
2109 | if ( getGameAction (keyCode)==FIRE ) |
2121 | if ( getGameAction (keyCode)==FIRE ) |
2110 | { |
2122 | { |
2111 | switch(menu_actions[act_menu_select]) |
2123 | switch(menu_actions[act_menu_select]) |
2112 | { |
2124 | { |
2113 | 2125 | /* |
|
- | 2126 | case ACTIONID_TOGGLE_EXPERT: |
|
2114 | case ACTIONID_TOGGLE_EXPERT: |
2127 | settings.expert_mode=!settings.expert_mode; |
2115 | settings.expert_mode=!settings.expert_mode; |
2128 | chg_state(STATEID_SETTINGSMENU); |
2116 | chg_state(STATEID_SETTINGSMENU); |
2129 | break; |
2117 | break; |
2130 | */ |
2118 | case ACTIONID_RENAME_PARAMS: |
2131 | case ACTIONID_RENAME_PARAMS: |
- | 2132 | act_input_str=mk.params.names[mk.params.act_paramset]; |
|
- | 2133 | ipinput_pos=0; |
|
2119 | act_input_str=mk.params.names[mk.params.act_paramset]; |
2134 | chg_state(STATEID_STRINGINPUT); |
2120 | ipinput_pos=0; |
2135 | break; |
2121 | chg_state(STATEID_STRINGINPUT); |
2136 | |
2122 | break; |
2137 | /* |
Line 2151... | Line 2166... | ||
2151 | break; |
2166 | break; |
Line 2152... | Line 2167... | ||
2152 | 2167 | ||
2153 | 2168 | ||
2154 | case ACTIONID_SELECT_GPS_FORMAT: |
2169 | case ACTIONID_SELECT_GPS_FORMAT: |
Line 2155... | Line 2170... | ||
2155 | chg_state(STATEID_SELECT_GPS_FORMAT); |
2170 | chg_state(STATEID_SELECT_GPS_FORMAT); |
2156 | break; |
2171 | break; */ |
2157 | 2172 | ||
Line 2259... | Line 2274... | ||
2259 | else |
2274 | else |
2260 | chg_state(STATEID_SELECT_PARAMSET); |
2275 | chg_state(STATEID_SELECT_PARAMSET); |
Line 2261... | Line 2276... | ||
2261 | 2276 | ||
Line 2262... | Line -... | ||
2262 | break; |
- | |
2263 | - | ||
2264 | case ACTIONID_CHANGESKIN: |
- | |
2265 | settings.act_skin++; |
- | |
2266 | settings.act_skin=(byte)(settings.act_skin%2); |
- | |
2267 | load_images(); |
2277 | break; |
2268 | chg_state(STATEID_SETTINGSMENU); |
2278 | |
2269 | break; |
2279 | |
2270 | case ACTIONID_SOUNDTOGGLE: |
2280 | case ACTIONID_SOUNDTOGGLE: |
2271 | settings.do_sound=!settings.do_sound; |
2281 | settings.do_sound=!settings.do_sound; |
2272 | chg_state(STATEID_SETTINGSMENU); |
2282 | chg_state(STATEID_SETTINGSMENU); |
2273 | break; |
2283 | break; |
2274 | case ACTIONID_VIBRATOGGLE: |
2284 | case ACTIONID_VIBRATOGGLE: |
2275 | settings.do_vibra=!settings.do_vibra; |
2285 | settings.do_vibra=!settings.do_vibra; |
Line 2276... | Line -... | ||
2276 | chg_state(STATEID_SETTINGSMENU); |
- | |
2277 | break; |
- | |
2278 | - | ||
2279 | case ACTIONID_GRAPHTOGGLE: |
- | |
2280 | settings.do_scrollbg=!settings.do_scrollbg; |
- | |
2281 | load_images(); |
- | |
2282 | chg_state(STATEID_SETTINGSMENU); |
- | |
2283 | break; |
- | |
2284 | - | ||
2285 | - | ||
2286 | case ACTIONID_FULLSCREENTOGGLE: |
- | |
2287 | settings.fullscreen=!settings.fullscreen; |
- | |
2288 | setFullScreenMode(settings.fullscreen); |
- | |
2289 | chg_state(STATEID_SETTINGSMENU); |
2286 | chg_state(STATEID_SETTINGSMENU); |
2290 | break; |
2287 | break; |
2291 | 2288 | ||
2292 | //#if devicecontrol=="on" |
2289 | //#if devicecontrol=="on" |
2293 | case ACTIONID_LIGHTTOGGLE: |
2290 | case ACTIONID_LIGHTTOGGLE: |