Changeset 1513
- Timestamp:
- 12/29/11 04:24:30 (18 months ago)
- Location:
- branches/reyalp-flt
- Files:
-
- 34 edited
-
core/dng.c (modified) (1 diff)
-
core/gui.c (modified) (21 diffs)
-
core/gui_4wins.c (modified) (2 diffs)
-
core/gui_4wins.h (modified) (1 diff)
-
core/gui_bench.c (modified) (2 diffs)
-
core/gui_calendar.c (modified) (2 diffs)
-
core/gui_calendar.h (modified) (1 diff)
-
core/gui_debug.c (modified) (2 diffs)
-
core/gui_draw.h (modified) (1 diff)
-
core/gui_fselect.c (modified) (5 diffs)
-
core/gui_fselect.h (modified) (1 diff)
-
core/gui_mastermind.c (modified) (2 diffs)
-
core/gui_mastermind.h (modified) (1 diff)
-
core/gui_mbox.c (modified) (3 diffs)
-
core/gui_mbox.h (modified) (1 diff)
-
core/gui_menu.c (modified) (1 diff)
-
core/gui_mpopup.c (modified) (4 diffs)
-
core/gui_mpopup.h (modified) (1 diff)
-
core/gui_osd.c (modified) (2 diffs)
-
core/gui_osd.h (modified) (1 diff)
-
core/gui_palette.c (modified) (4 diffs)
-
core/gui_palette.h (modified) (1 diff)
-
core/gui_read.c (modified) (3 diffs)
-
core/gui_read.h (modified) (1 diff)
-
core/gui_reversi.c (modified) (2 diffs)
-
core/gui_reversi.h (modified) (1 diff)
-
core/gui_snake.c (modified) (2 diffs)
-
core/gui_sokoban.c (modified) (2 diffs)
-
core/gui_sokoban.h (modified) (1 diff)
-
core/gui_tetris.c (modified) (2 diffs)
-
core/luascript.c (modified) (1 diff)
-
core/module_exportlist.c (modified) (2 diffs)
-
core/modules/module_inspector.c (modified) (2 diffs)
-
include/gui.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/reyalp-flt/core/dng.c
r1512 r1513 714 714 } 715 715 716 gui_set_mode( GUI_MODE_ALT);716 gui_set_mode(&altGuiHandler); 717 717 action_stack_create(&badpixel_task_stack, BADPIX_START); 718 718 } -
branches/reyalp-flt/core/gui.c
r1511 r1513 155 155 #endif 156 156 static void gui_draw_fselect(int arg); 157 static void gui_draw_osd_le(int arg);158 157 #ifdef OPT_TEXTREADER 159 158 static void gui_draw_read(int arg); … … 1588 1587 1589 1588 //------------------------------------------------------------------- 1590 static volatile gui_mode_t gui_mode; // current gui mode. if <GUI_MODE_LASTIDX - idx in guiHandlers (core modes), otherwise pointer to gui_handler object (module modes)1589 static gui_handler *gui_mode; // current gui mode. pointer to gui_handler structure 1591 1590 1592 1591 static volatile int gui_restore; … … 1598 1597 #endif 1599 1598 1600 extern gui_handler guiHandlers[];1601 1602 1599 //------------------------------------------------------------------- 1603 1600 void gui_init() 1604 1601 { 1605 gui_set_mode( GUI_MODE_NONE);1602 gui_set_mode(&defaultGuiHandler); 1606 1603 gui_restore = 0; 1607 1604 gui_in_redraw = 0; … … 1662 1659 1663 1660 1664 // Small hack: use understandable name to reused data member 1665 #define binded_gui_mode_ptr kbd_process 1666 1667 //------------------------------------------------------------------- 1668 gui_mode_t gui_get_mode() { 1669 if ( gui_mode >= GUI_MODE_COUNT ) 1670 { 1671 int mode; 1672 for (mode=0;mode<GUI_MODE_COUNT;mode++) 1673 { 1674 if ( (guiHandlers[mode].flags & GUI_MODE_FLAG_ALIAS) && 1675 guiHandlers[mode].binded_gui_mode_ptr == (void*)gui_mode ) 1676 return mode; 1677 } 1678 } 1679 return gui_mode; 1680 } 1681 1682 //------------------------------------------------------------------- 1683 void gui_set_mode(gui_mode_t mode) 1661 //------------------------------------------------------------------- 1662 gui_mode_t gui_get_mode() { return ((gui_handler*)gui_mode)->mode; } 1663 1664 //------------------------------------------------------------------- 1665 // Set new GUI mode, returns old mode 1666 gui_handler* gui_set_mode(gui_handler *mode) 1684 1667 { 1685 1668 if ( gui_mode == mode ) 1686 return; 1687 1688 if ( mode < GUI_MODE_COUNT && 1689 (guiHandlers[mode].flags & GUI_MODE_FLAG_ALIAS) ) 1690 { 1691 mode = (unsigned int)guiHandlers[mode].binded_gui_mode_ptr; 1692 } 1669 return gui_mode; 1693 1670 1694 1671 // Sanity check for case module pointer - is this really gui_handler 1695 if ( mode >= GUI_MODE_COUNT && ((gui_handler*)mode)->magicnum != GUI_MODE_MAGICNUM ) {1672 if ( mode->magicnum != GUI_MODE_MAGICNUM ) { 1696 1673 // If sanity failed (module is unload) - set to default mode 1697 gui_mode = GUI_MODE_NONE;1674 gui_mode = &defaultGuiHandler; 1698 1675 draw_restore(); 1699 return ;1676 return gui_mode; 1700 1677 } 1701 1678 1702 1679 #ifdef CAM_TOUCHSCREEN_UI 1703 if (((gui_mode == 0) != (mode == 0)) ||// Change from GUI_MODE_NONE to any other or vice-versa1704 ((gui_mode > GUI_MODE_MENU) != (mode > GUI_MODE_MENU)))// Switch in & out of menu mode1680 if (((gui_mode->mode == GUI_MODE_NONE) != (mode->mode == GUI_MODE_NONE)) || // Change from GUI_MODE_NONE to any other or vice-versa 1681 ((gui_mode->mode > GUI_MODE_MENU) != (mode->mode > GUI_MODE_MENU))) // Switch in & out of menu mode 1705 1682 redraw_buttons = 1; 1706 1683 #endif 1684 1685 gui_handler *old_mode = gui_mode; 1707 1686 gui_mode = mode; 1708 } 1709 1710 //------------------------------------------------------------------- 1711 // PURPOSE: bind module struct to 1712 // RETUN: 0 - fail, 1 - ok 1713 int gui_bind_mode(int core_mode, gui_handler* handler) { 1714 1715 // sanity checks 1716 if ( core_mode >= GUI_MODE_COUNT || 1717 (guiHandlers[core_mode].flags & GUI_MODE_FLAG_ALIAS)==0 1718 ) 1719 return 0; 1720 1721 if ( handler && handler->magicnum != GUI_MODE_MAGICNUM ) 1722 return 0; 1723 1724 // check is this module is already binded (loaded with different name) 1725 gui_handler* bind_gui_handler = (gui_handler*)guiHandlers[core_mode].binded_gui_mode_ptr; 1726 if ( bind_gui_handler && bind_gui_handler->magicnum == GUI_MODE_MAGICNUM ) 1727 return 0; 1728 1729 guiHandlers[core_mode].binded_gui_mode_ptr = (void*)handler; 1730 return 1; 1731 } 1732 1733 #undef binded_gui_mode_ptr 1734 1687 1688 return old_mode; 1689 } 1735 1690 1736 1691 //------------------------------------------------------------------- … … 1768 1723 gui_draw_splash(logo,logo_size); 1769 1724 // conf.show_osd = 0; 1770 } else if (gui_splash==1 && (mode_get()&MODE_MASK) == gui_splash_mode && (gui_ mode==GUI_MODE_NONE || gui_mode==GUI_MODE_ALT)) {1725 } else if (gui_splash==1 && (mode_get()&MODE_MASK) == gui_splash_mode && (gui_get_mode()==GUI_MODE_NONE || gui_get_mode()==GUI_MODE_ALT)) { 1771 1726 draw_restore(); 1772 1727 // conf.show_osd = 1; //had to uncomment in order to fix a bug with disappearing osd... … … 1806 1761 1807 1762 #ifdef CAM_DISP_ALT_TEXT 1808 draw_txt_string(20, 14, "<ALT>", MAKE_COLOR(COLOR_ ALT_BG, COLOR_FG));1763 draw_txt_string(20, 14, "<ALT>", MAKE_COLOR(COLOR_RED, COLOR_WHITE)); 1809 1764 #endif 1810 1765 … … 1829 1784 void gui_default_kbd_process_menu_btn() 1830 1785 { 1831 gui_set_mode( GUI_MODE_MENU);1786 gui_set_mode(&menuGuiHandler); 1832 1787 draw_restore(); 1833 1788 } … … 2003 1958 if (gui_user_menu_flag) 2004 1959 { 2005 gui_set_mode( GUI_MODE_MENU);1960 gui_set_mode(&menuGuiHandler); 2006 1961 gui_user_menu_flag = 0; 2007 1962 gui_menu_init(&root_menu); 2008 1963 } 2009 1964 else 2010 gui_set_mode( GUI_MODE_ALT);1965 gui_set_mode(&altGuiHandler); 2011 1966 draw_restore(); 2012 1967 } 2013 1968 2014 1969 //------------------------------------------------------------------- 2015 // GUI handler table (entries must be in the same order and have the same number of entries as Gui_Mode enum) 2016 gui_handler guiHandlers[GUI_MODE_COUNT] = 2017 { 2018 /*GUI_MODE_NONE*/ { gui_draw_osd, 0, 0, 0, GUI_MODE_MAGICNUM }, 2019 /*GUI_MODE_ALT*/ { gui_chdk_draw, gui_chdk_kbd_process, gui_chdk_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM }, 2020 /*GUI_MODE_MENU*/ { gui_menu_draw, gui_menu_kbd_process, gui_menu_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM }, 2021 /*GUI_MODE_ALIAS_PALETTE*/ { 0, 0, 0, GUI_MODE_FLAG_ALIAS, GUI_MODE_MAGICNUM }, 2022 /*GUI_MODE_MBOX*/ { gui_mbox_draw, gui_mbox_kbd_process, 0, GUI_MODE_FLAG_NORESTORE_ON_SWITCH, GUI_MODE_MAGICNUM }, 2023 /*GUI_MODE_ALIAS_FSELECT*/ { 0, 0, 0, GUI_MODE_FLAG_ALIAS, GUI_MODE_MAGICNUM }, 2024 /*GUI_MODE_OSD*/ { gui_osd_draw, gui_osd_kbd_process, gui_default_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM }, // THIS IS OSD LAYOUT EDITOR 2025 /*GUI_MODE_ALIAS_MPOPUP*/ { 0, 0, 0, GUI_MODE_FLAG_ALIAS, GUI_MODE_MAGICNUM }, 2026 }; 2027 1970 // GUI handlers 1971 gui_handler defaultGuiHandler = { GUI_MODE_NONE, gui_draw_osd, 0, 0, 0, GUI_MODE_MAGICNUM }; 1972 gui_handler altGuiHandler = { GUI_MODE_ALT, gui_chdk_draw, gui_chdk_kbd_process, gui_chdk_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM }; 1973 gui_handler menuGuiHandler = { GUI_MODE_MENU, gui_menu_draw, gui_menu_kbd_process, gui_menu_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM }; 2028 1974 2029 1975 //------------------------------------------------------------------- … … 2037 1983 2038 1984 #ifdef CAM_DETECT_SCREEN_ERASE 2039 if (!draw_test_guard() && gui_ mode) // Attempt to detect screen erase in <Alt> mode, redraw if needed1985 if (!draw_test_guard() && gui_get_mode()) // Attempt to detect screen erase in <Alt> mode, redraw if needed 2040 1986 { 2041 1987 draw_set_guard(); 2042 1988 2043 flag_gui_enforce_redraw |= GUI_REDRAWFLAG_ERASEGUARD;1989 flag_gui_enforce_redraw |= GUI_REDRAWFLAG_ERASEGUARD; 2044 1990 //gui_menu_force_redraw(); 2045 1991 //gui_fselect_force_redraw(); //@tsv … … 2054 2000 2055 2001 gui_in_redraw = 1; 2056 gui_mode_old = gui_ mode;2002 gui_mode_old = gui_get_mode(); 2057 2003 2058 2004 #ifdef CAM_TOUCHSCREEN_UI … … 2062 2008 2063 2009 // Call redraw handler 2064 gui_handler* cur_gui_handler = (gui_mode<GUI_MODE_COUNT)? (&guiHandlers[gui_mode]) : (gui_handler*)gui_mode; 2065 if (cur_gui_handler->redraw) cur_gui_handler->redraw(flag_gui_enforce_redraw); 2010 if (gui_mode->redraw) gui_mode->redraw(flag_gui_enforce_redraw); 2066 2011 flag_gui_enforce_redraw=0; 2067 2012 2068 2013 // Forced redraw if needed 2069 2014 gui_in_redraw = 0; 2070 cur_gui_handler = (gui_mode<GUI_MODE_COUNT)? (&guiHandlers[gui_mode]) : (gui_handler*)gui_mode; 2071 if ((gui_mode_old != gui_mode 2015 if ((gui_mode_old != gui_get_mode() 2072 2016 && (gui_mode_old != GUI_MODE_NONE && gui_mode_old != GUI_MODE_ALT) 2073 && !( cur_gui_handler->flags & GUI_MODE_FLAG_NORESTORE_ON_SWITCH))2017 && !(gui_mode->flags & GUI_MODE_FLAG_NORESTORE_ON_SWITCH)) 2074 2018 || gui_restore ) 2075 2019 { 2076 2077 2020 if (gui_restore) 2078 2021 flag_gui_enforce_redraw |= GUI_REDRAWFLAG_DRAW_RESTORED; 2079 2022 gui_restore = 0; 2080 2023 2081 if ( !( cur_gui_handler->flags & GUI_MODE_FLAG_NODRAWRESTORE) )2024 if ( !( gui_mode->flags & GUI_MODE_FLAG_NODRAWRESTORE) ) 2082 2025 draw_restore(); 2083 2026 } 2084 2027 2085 if ( gui_mode_prev_tick != gui_ mode) {2028 if ( gui_mode_prev_tick != gui_get_mode() ) { 2086 2029 flag_gui_enforce_redraw |= GUI_REDRAWFLAG_MODE_WAS_CHANGED; 2087 gui_mode_prev_tick = gui_ mode;2030 gui_mode_prev_tick = gui_get_mode(); 2088 2031 } 2089 2032 } … … 2093 2036 void gui_kbd_process() 2094 2037 { 2095 gui_handler* cur_gui_handler = (gui_mode<GUI_MODE_COUNT)? (&guiHandlers[gui_mode]) : (gui_handler*)gui_mode;2096 2097 2038 // Call menu button handler if menu button pressed 2098 2039 if (kbd_is_key_clicked(KEY_MENU)) 2099 2040 { 2100 if ( cur_gui_handler->kbd_process_menu_btn) cur_gui_handler->kbd_process_menu_btn();2041 if (gui_mode->kbd_process_menu_btn) gui_mode->kbd_process_menu_btn(); 2101 2042 return; 2102 2043 } 2103 2044 2104 2045 // Call mode handler for other buttons 2105 if ( cur_gui_handler->kbd_process) cur_gui_handler->kbd_process();2046 if (gui_mode->kbd_process) gui_mode->kbd_process(); 2106 2047 } 2107 2048 … … 2113 2054 conf_store_old_settings(); 2114 2055 #endif 2115 gui_set_mode( GUI_MODE_ALT);2056 gui_set_mode(&altGuiHandler); 2116 2057 2117 2058 conf_update_prevent_shutdown(); … … 2125 2066 if ((conf.user_menu_enable == 2) && !state_kbd_script_run) { 2126 2067 gui_menu_init(&user_submenu); 2127 gui_set_mode( GUI_MODE_MENU);2068 gui_set_mode(&menuGuiHandler); 2128 2069 draw_restore(); 2129 2070 gui_user_menu_flag = 1; … … 2145 2086 rbf_set_codepage(FONT_CP_WIN); 2146 2087 vid_turn_on_updates(); 2147 gui_set_mode( GUI_MODE_NONE);2088 gui_set_mode(&defaultGuiHandler); 2148 2089 2149 2090 // Unload all modules which are marked as safe to unload … … 2426 2367 2427 2368 #if CAM_SWIVEL_SCREEN 2428 if (conf.flashlight && (m&MODE_SCREEN_OPENED) && (m&MODE_SCREEN_ROTATED) && (gui_ mode==GUI_MODE_NONE /* || gui_mode==GUI_MODE_ALT */)) {2369 if (conf.flashlight && (m&MODE_SCREEN_OPENED) && (m&MODE_SCREEN_ROTATED) && (gui_get_mode()==GUI_MODE_NONE /* || gui_get_mode()==GUI_MODE_ALT */)) { 2429 2370 draw_filled_rect(0, 0, screen_width-1, screen_height-1, MAKE_COLOR(COLOR_WHITE, COLOR_WHITE)); 2430 2371 flashlight = 1; 2431 2372 } 2432 2373 if (flashlight) { 2433 if ((!((m&MODE_SCREEN_OPENED) && (m&MODE_SCREEN_ROTATED))) || (gui_ mode!=GUI_MODE_NONE /* && gui_mode!=GUI_MODE_ALT */)) {2374 if ((!((m&MODE_SCREEN_OPENED) && (m&MODE_SCREEN_ROTATED))) || (gui_get_mode()!=GUI_MODE_NONE /* && gui_get_mode()!=GUI_MODE_ALT */)) { 2434 2375 flashlight = 0; 2435 2376 need_restore = 1; … … 2498 2439 return; 2499 2440 2500 if (gui_osd_draw_zebra(conf.zebra_draw && gui_ mode==GUI_MODE_NONE &&2441 if (gui_osd_draw_zebra(conf.zebra_draw && gui_get_mode()==GUI_MODE_NONE && 2501 2442 kbd_is_key_pressed(KEY_SHOOT_HALF) && mode_photo && 2502 2443 !state_kbd_script_run)) {// no zebra when script running, to save mem … … 2510 2451 2511 2452 2512 if ((gui_ mode==GUI_MODE_NONE || gui_mode==GUI_MODE_ALT) && (2453 if ((gui_get_mode()==GUI_MODE_NONE || gui_get_mode()==GUI_MODE_ALT) && ( 2513 2454 (kbd_is_key_pressed(KEY_SHOOT_HALF) && ((conf.show_histo==SHOW_HALF)/* || (m&MODE_MASK) == MODE_PLAY*/)) || 2514 2455 ((conf.show_histo==SHOW_ALWAYS) && !((m&MODE_MASK) == MODE_PLAY) && (recreview_hold==0)) … … 2522 2463 gui_grid_draw_osd(1); 2523 2464 } 2524 if ((gui_ mode==GUI_MODE_NONE || gui_mode==GUI_MODE_ALT) && (((kbd_is_key_pressed(KEY_SHOOT_HALF) || (state_kbd_script_run) || (shooting_get_common_focus_mode())) && (mode_photo || (m&MODE_SHOOTING_MASK)==MODE_STITCH )) || ((mode_video || movie_status > 1) && conf.show_values_in_video) )) {2465 if ((gui_get_mode()==GUI_MODE_NONE || gui_get_mode()==GUI_MODE_ALT) && (((kbd_is_key_pressed(KEY_SHOOT_HALF) || (state_kbd_script_run) || (shooting_get_common_focus_mode())) && (mode_photo || (m&MODE_SHOOTING_MASK)==MODE_STITCH )) || ((mode_video || movie_status > 1) && conf.show_values_in_video) )) { 2525 2466 2526 2467 if (conf.show_dof!=DOF_DONT_SHOW) gui_osd_calc_dof(); … … 2558 2499 if ( conf.show_movie_time > 0 && (mode_video || movie_status > 1)) gui_osd_draw_movie_time_left(); 2559 2500 #if CAM_DRAW_EXPOSITION 2560 if (gui_ mode==GUI_MODE_NONE && kbd_is_key_pressed(KEY_SHOOT_HALF) && ((m&MODE_MASK)==MODE_REC) && ((m&MODE_SHOOTING_MASK))!=MODE_VIDEO_STD && (m&MODE_SHOOTING_MASK)!=MODE_VIDEO_COMPACT) {2501 if (gui_get_mode()==GUI_MODE_NONE && kbd_is_key_pressed(KEY_SHOOT_HALF) && ((m&MODE_MASK)==MODE_REC) && ((m&MODE_SHOOTING_MASK))!=MODE_VIDEO_STD && (m&MODE_SHOOTING_MASK)!=MODE_VIDEO_COMPACT) { 2561 2502 strcpy(osd_buf,shooting_get_tv_str()); 2562 2503 strcat(osd_buf,"\" F"); … … 2706 2647 void gui_grid_lines_load(int arg) { 2707 2648 module_fselect_init(LANG_STR_SELECT_GRID_FILE, conf.grid_lines_file, "A/CHDK/GRIDS", gui_grid_lines_load_selected); 2708 }2709 2710 //-------------------------------------------------------------------2711 void gui_draw_osd_le(int arg) {2712 gui_set_mode(GUI_MODE_OSD);2713 gui_osd_init();2714 2649 } 2715 2650 -
branches/reyalp-flt/core/gui_4wins.c
r1512 r1513 15 15 16 16 #include "module_load.h" 17 17 18 void gui_module_menu_kbd_process(); 19 void gui_4wins_kbd_process(); 20 void gui_4wins_draw(int enforce_redraw); 18 21 19 22 gui_handler GUI_MODE_4WINS = 20 /*GUI_MODE_4WINS*/ {gui_4wins_draw, gui_4wins_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM };23 /*GUI_MODE_4WINS*/ { GUI_MODE_MODULE, gui_4wins_draw, gui_4wins_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM }; 21 24 22 25 … … 339 342 if(cur_player==2&&!mode_rival) set(); 340 343 341 gui_set_mode( (unsigned int)&GUI_MODE_4WINS);344 gui_set_mode(&GUI_MODE_4WINS); 342 345 343 346 return 1; -
branches/reyalp-flt/core/gui_4wins.h
r1467 r1513 4 4 //------------------------------------------------------------------- 5 5 extern int gui_4wins_init(); 6 extern void gui_4wins_kbd_process();7 extern void gui_4wins_draw(int enforce_redraw);8 6 9 7 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_bench.c
r1494 r1513 14 14 15 15 gui_handler GUI_MODE_BENCH = 16 /*GUI_MODE_BENCH*/ {gui_bench_draw_callback, gui_bench_kbd_process, gui_bench_menu_kbd_process, 0, GUI_MODE_MAGICNUM };16 /*GUI_MODE_BENCH*/ { GUI_MODE_MODULE, gui_bench_draw_callback, gui_bench_kbd_process, gui_bench_menu_kbd_process, 0, GUI_MODE_MAGICNUM }; 17 17 18 18 … … 244 244 int basic_module_init() { 245 245 gui_bench_init(); 246 gui_set_mode( (unsigned int)&GUI_MODE_BENCH);246 gui_set_mode(&GUI_MODE_BENCH); 247 247 return 1; 248 248 } -
branches/reyalp-flt/core/gui_calendar.c
r1512 r1513 11 11 12 12 #include "module_load.h" 13 13 14 void gui_calendar_menu_kbd_process(); 15 void gui_calendar_kbd_process(); 16 void gui_calendar_draw(int enforce_redraw); 14 17 15 18 gui_handler GUI_MODE_CALENDAR = 16 /*GUI_MODE_CALENDAR*/ {gui_calendar_draw, gui_calendar_kbd_process, gui_calendar_menu_kbd_process, 0, GUI_MODE_MAGICNUM };19 /*GUI_MODE_CALENDAR*/ { GUI_MODE_MODULE, gui_calendar_draw, gui_calendar_kbd_process, gui_calendar_menu_kbd_process, 0, GUI_MODE_MAGICNUM }; 17 20 18 21 //------------------------------------------------------------------- … … 83 86 int basic_module_init() { 84 87 85 gui_set_mode( (unsigned int)&GUI_MODE_CALENDAR);88 gui_set_mode(&GUI_MODE_CALENDAR); 86 89 87 90 calendar_goto_today(); -
branches/reyalp-flt/core/gui_calendar.h
r1467 r1513 4 4 //------------------------------------------------------------------- 5 5 extern void gui_calendar_init(); 6 extern void gui_calendar_kbd_process();7 extern void gui_calendar_draw(int enforce_redraw);8 6 9 7 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_debug.c
r1494 r1513 14 14 15 15 gui_handler GUI_MODE_DEBUG = 16 /*GUI_MODE_DEBUG*/ {gui_debug_draw, gui_debug_kbd_process, gui_module_menu_kbd_process, 0, GUI_MODE_MAGICNUM };16 /*GUI_MODE_DEBUG*/ { GUI_MODE_MODULE, gui_debug_draw, gui_debug_kbd_process, gui_module_menu_kbd_process, 0, GUI_MODE_MAGICNUM }; 17 17 18 18 //------------------------------------------------------------------- … … 30 30 debug_cont_update = 1; 31 31 step = 4; 32 gui_set_mode( (unsigned int)&GUI_MODE_DEBUG);32 gui_set_mode(&GUI_MODE_DEBUG); 33 33 } 34 34 -
branches/reyalp-flt/core/gui_draw.h
r1498 r1513 790 790 extern color draw_get_pixel(coord x, coord y); 791 791 792 extern void draw_pixel(coord x, coord y, color cl); 793 792 794 extern void draw_line(coord x1, coord y1, coord x2, coord y2, color cl); 793 795 extern void draw_hline(coord x, coord y, int len, color cl); -
branches/reyalp-flt/core/gui_fselect.c
r1511 r1513 17 17 #include "module_load.h" 18 18 19 void gui_fselect_kbd_process(); 20 void gui_fselect_draw(int enforce_redraw); 21 19 22 gui_handler GUI_MODE_FSELECT_MODULE = 20 /*GUI_MODE_FSELECT*/ {gui_fselect_draw, gui_fselect_kbd_process, gui_fselect_kbd_process, 0, GUI_MODE_MAGICNUM };23 /*GUI_MODE_FSELECT*/ { GUI_MODE_FSELECT, gui_fselect_draw, gui_fselect_kbd_process, gui_fselect_kbd_process, 0, GUI_MODE_MAGICNUM }; 21 24 22 25 extern int module_idx; … … 60 63 static char selected_file[100]; // This full path to current file. So it is return value 61 64 static char buf[100]; 62 static gui_ mode_tgui_fselect_mode_old; // stored previous gui_mode65 static gui_handler *gui_fselect_mode_old; // stored previous gui_mode 63 66 64 67 // basic element of file list … … 390 393 fselect_on_select = on_select; 391 394 marked_operation = MARKED_OP_NONE; 392 gui_fselect_mode_old = gui_get_mode();393 395 gui_fselect_redraw = 2; 394 gui_ set_mode((unsigned int)&GUI_MODE_FSELECT_MODULE);396 gui_fselect_mode_old = gui_set_mode(&GUI_MODE_FSELECT_MODULE); 395 397 gui_fselect_set_key_redraw(0); 396 398 } … … 1327 1329 CONF_BIND_INT(210, conf_sub_batch_ext); 1328 1330 1329 // Try to bind to generic gui mode alias1330 if (!gui_bind_mode( GUI_MODE_FSELECT, &GUI_MODE_FSELECT_MODULE))1331 return 1;1332 1333 1331 return 0; 1334 1332 } … … 1347 1345 GUI_MODE_FSELECT_MODULE.magicnum = 0; 1348 1346 1349 // Unbind generic alias1350 gui_bind_mode( GUI_MODE_FSELECT, 0);1351 1352 1347 return 0; 1353 1348 } -
branches/reyalp-flt/core/gui_fselect.h
r1467 r1513 5 5 extern void gui_fselect_init(int title, const char* prev_dir, const char* default_dir, void (*on_select)(const char *fn)); 6 6 extern char* gui_fselect_result(); 7 extern void gui_fselect_kbd_process();8 extern void gui_fselect_draw(int enforce_redraw);9 7 extern void gui_fselect_force_redraw(); 10 8 extern void finalize_fselect(); -
branches/reyalp-flt/core/gui_mastermind.c
r1512 r1513 13 13 14 14 #include "module_load.h" 15 15 16 void gui_module_menu_kbd_process(); 17 void gui_mastermind_kbd_process(); 18 void gui_mastermind_draw(int enforce_redraw); 16 19 17 20 gui_handler GUI_MODE_MASTERMIND = 18 /*GUI_MODE_MASTERMIND*/ {gui_mastermind_draw, gui_mastermind_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM };21 /*GUI_MODE_MASTERMIND*/ { GUI_MODE_MODULE, gui_mastermind_draw, gui_mastermind_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM }; 19 22 20 23 … … 140 143 for(i=0;i<4;i++) curr_color[i]=99; 141 144 142 gui_set_mode( (unsigned int)&GUI_MODE_MASTERMIND);145 gui_set_mode(&GUI_MODE_MASTERMIND); 143 146 return 1; 144 147 } -
branches/reyalp-flt/core/gui_mastermind.h
r1467 r1513 4 4 //------------------------------------------------------------------- 5 5 extern int gui_mastermind_init(); 6 extern void gui_mastermind_kbd_process();7 extern void gui_mastermind_draw(int enforce_redraw);8 6 9 7 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_mbox.c
r1467 r1513 11 11 12 12 //------------------------------------------------------------------- 13 static gui_mode_t gui_mbox_mode_old; 13 void gui_mbox_draw(int enforce_redraw); 14 void gui_mbox_kbd_process(); 15 16 static gui_handler mboxGuiHandler = { GUI_MODE_MBOX, gui_mbox_draw, gui_mbox_kbd_process, 0, GUI_MODE_FLAG_NORESTORE_ON_SWITCH, GUI_MODE_MAGICNUM }; 17 18 static gui_handler *gui_mbox_mode_old; 14 19 static const char* mbox_title; 15 20 static const char* mbox_msg; … … 56 61 } 57 62 58 gui_mbox_mode_old = gui_get_mode();59 63 mbox_title = lang_str(title); 60 64 mbox_msg = lang_str(msg); … … 62 66 mbox_flags = flags; 63 67 mbox_on_select = on_select; 64 gui_ set_mode(GUI_MODE_MBOX);68 gui_mbox_mode_old = gui_set_mode(&mboxGuiHandler); 65 69 } 66 70 -
branches/reyalp-flt/core/gui_mbox.h
r1467 r1513 26 26 //------------------------------------------------------------------- 27 27 extern void gui_mbox_init(int title, int msg, const unsigned int flags, void (*on_select)(unsigned int btn)); 28 extern void gui_mbox_kbd_process();29 extern void gui_mbox_draw(int enforce_redraw);30 28 31 29 extern void gui_browser_progress_show(const char* msg, const unsigned int perc); -
branches/reyalp-flt/core/gui_menu.c
r1467 r1513 111 111 // Occurs when script menu opened using 'Func/Set' button 112 112 // Return to normal <ALT> mode. 113 gui_set_mode( GUI_MODE_ALT);113 gui_set_mode(&altGuiHandler); 114 114 kbd_reset_autoclicked_key(); // Need this to stop 'Func/Set' registering twice??? 115 115 draw_restore(); -
branches/reyalp-flt/core/gui_mpopup.c
r1483 r1513 13 13 extern int module_idx; 14 14 15 void gui_mpopup_kbd_process(); 16 void gui_mpopup_draw(int enforce_redraw); 17 15 18 gui_handler GUI_MODE_MPOPUP_MODULE = 16 /*GUI_MODE_MPOPUP*/ {gui_mpopup_draw, gui_mpopup_kbd_process, gui_mpopup_kbd_process, GUI_MODE_FLAG_NORESTORE_ON_SWITCH, GUI_MODE_MAGICNUM };19 /*GUI_MODE_MPOPUP*/ { GUI_MODE_MPOPUP, gui_mpopup_draw, gui_mpopup_kbd_process, gui_mpopup_kbd_process, GUI_MODE_FLAG_NORESTORE_ON_SWITCH, GUI_MODE_MAGICNUM }; 17 20 18 21 // Simple popup menu. No title, no separators, only processing items 19 22 20 23 //------------------------------------------------------------------- 21 static gui_ mode_tgui_mpopup_mode_old;24 static gui_handler *gui_mpopup_mode_old; 22 25 static char mpopup_to_draw; 23 26 … … 51 54 mpopup_actions_active = 0; 52 55 53 gui_mpopup_mode_old = gui_get_mode();54 56 mpopup_to_draw = 1; 55 57 mpopup_on_select = on_select; 56 gui_ set_mode((unsigned int)&GUI_MODE_MPOPUP_MODULE);58 gui_mpopup_mode_old = gui_set_mode(&GUI_MODE_MPOPUP_MODULE); 57 59 } 58 60 … … 171 173 return 1; 172 174 173 // Try to bind to generic gui mode alias174 if (!gui_bind_mode( GUI_MODE_MPOPUP, &GUI_MODE_MPOPUP_MODULE))175 return 1;176 177 175 return 0; 178 176 } … … 191 189 //sanity clean to prevent accidentaly assign/restore guimode to unloaded module 192 190 GUI_MODE_MPOPUP_MODULE.magicnum = 0; 193 194 // unbind generic alias195 gui_bind_mode( GUI_MODE_MPOPUP, 0 );196 191 197 192 return 0; -
branches/reyalp-flt/core/gui_mpopup.h
r1467 r1513 13 13 //------------------------------------------------------------------- 14 14 extern void gui_mpopup_init(struct mpopup_item* popup_actions, const unsigned int flags, void (*on_select)(unsigned int actn), int mode); 15 extern void gui_mpopup_kbd_process();16 extern void gui_mpopup_draw(int enforce_redraw);17 15 18 16 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_osd.c
r1512 r1513 15 15 #include "gui_grid.h" 16 16 #include "gui_osd.h" 17 18 //------------------------------------------------------------------- 19 void gui_osd_kbd_process(); 20 void gui_osd_draw(int enforce_redraw); 21 22 gui_handler layoutGuiHandler = { GUI_MODE_OSD, gui_osd_draw, gui_osd_kbd_process, gui_default_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM }; // THIS IS OSD LAYOUT EDITOR 17 23 18 24 //------------------------------------------------------------------- … … 102 108 step = 10; 103 109 draw_restore(); 110 } 111 112 //------------------------------------------------------------------- 113 void gui_draw_osd_le(int arg) { 114 gui_set_mode(&layoutGuiHandler); 115 gui_osd_init(); 104 116 } 105 117 -
branches/reyalp-flt/core/gui_osd.h
r1467 r1513 34 34 35 35 //------------------------------------------------------------------- 36 extern void gui_osd_init(); 37 extern void gui_osd_kbd_process(); 38 extern void gui_osd_draw(int enforce_redraw); 36 extern void gui_draw_osd_le(int arg); 39 37 40 38 extern void gui_osd_draw_histo(); -
branches/reyalp-flt/core/gui_palette.c
r1512 r1513 12 12 13 13 #include "module_load.h" 14 14 15 void gui_module_menu_kbd_process(); 16 void gui_palette_kbd_process(); 17 void gui_palette_draw(int enforce_redraw); 15 18 16 19 gui_handler GUI_MODE_PALETTE_MODULE = 17 /*GUI_MODE_PALETTE*/ {gui_palette_draw, gui_palette_kbd_process, gui_module_menu_kbd_process, 0, GUI_MODE_MAGICNUM };20 /*GUI_MODE_PALETTE*/ { GUI_MODE_PALETTE, gui_palette_draw, gui_palette_kbd_process, gui_module_menu_kbd_process, 0, GUI_MODE_MAGICNUM }; 18 21 19 22 //------------------------------------------------------------------- … … 30 33 palette_on_select = on_select; 31 34 gui_palette_redraw = 1; 32 gui_set_mode( (unsigned int)&GUI_MODE_PALETTE_MODULE);35 gui_set_mode(&GUI_MODE_PALETTE_MODULE); 33 36 } 34 37 … … 148 151 return 1; 149 152 150 // Try to bind to generic gui mode alias151 if (!gui_bind_mode( GUI_MODE_PALETTE, &GUI_MODE_PALETTE_MODULE))152 return 1;153 154 153 return 0; 155 154 } … … 165 164 //sanity clean to prevent accidentaly assign/restore guimode to unloaded module 166 165 GUI_MODE_PALETTE_MODULE.magicnum = 0; 167 168 // unbind generic alias169 gui_bind_mode( GUI_MODE_PALETTE, 0);170 166 171 167 return 0; -
branches/reyalp-flt/core/gui_palette.h
r1467 r1513 11 11 //------------------------------------------------------------------- 12 12 extern void gui_palette_init(int mode, color st_color, void (*on_select)(color clr)); 13 extern void gui_palette_kbd_process();14 extern void gui_palette_draw(int enforce_redraw);15 13 16 14 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_read.c
r1512 r1513 14 14 15 15 extern void gui_read_kbd_process_menu_btn(); 16 void gui_read_kbd_process(); 17 void gui_read_draw(int enforce_redraw); 18 void gui_read_kbd_leave(); 16 19 17 20 int *conf_reader_autoscroll; … … 24 27 25 28 gui_handler GUI_MODE_READ = 26 /*GUI_MODE_READ*/ {gui_read_draw, gui_read_kbd_process, gui_read_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM };29 /*GUI_MODE_READ*/ { GUI_MODE_MODULE, gui_read_draw, gui_read_kbd_process, gui_read_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM }; 27 30 28 31 //------------------------------------------------------------------- … … 85 88 86 89 reader_is_active=1; 87 gui_set_mode( (unsigned int)&GUI_MODE_READ);90 gui_set_mode(&GUI_MODE_READ); 88 91 89 92 draw_filled_rect(0, 0, screen_width-1, y-1, MAKE_COLOR(COLOR_BLACK, COLOR_BLACK)); -
branches/reyalp-flt/core/gui_read.h
r1467 r1513 3 3 4 4 //------------------------------------------------------------------- 5 6 //-------------------------------------------------------------------7 5 extern int gui_read_init(const char* file); 8 extern void gui_read_kbd_process();9 extern void gui_read_draw(int enforce_redraw);10 extern void gui_read_kbd_leave();11 6 12 7 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_reversi.c
r1512 r1513 12 12 13 13 #include "module_load.h" 14 14 15 void gui_module_menu_kbd_process(); 16 void gui_reversi_kbd_process(); 17 void gui_reversi_draw(int enforce_redraw); 15 18 16 19 gui_handler GUI_MODE_REVERSI = 17 /*GUI_MODE_REVERSI*/ {gui_reversi_draw, gui_reversi_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM };20 /*GUI_MODE_REVERSI*/ { GUI_MODE_MODULE, gui_reversi_draw, gui_reversi_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM }; 18 21 19 22 … … 352 355 //------------------------------------------------------------------- 353 356 int basic_module_init() { 354 gui_set_mode( (unsigned int)&GUI_MODE_REVERSI);357 gui_set_mode(&GUI_MODE_REVERSI); 355 358 InitMainWindow(); 356 359 NewGame(); -
branches/reyalp-flt/core/gui_reversi.h
r1467 r1513 4 4 //------------------------------------------------------------------- 5 5 extern void gui_reversi_init(); 6 extern void gui_reversi_kbd_process();7 extern void gui_reversi_draw(int enforce_redraw);8 6 9 7 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_snake.c
r1494 r1513 18 18 19 19 gui_handler GUI_MODE_SNAKE = 20 /*GUI_MODE_SNAKE*/ {gui_snake_draw, gui_snake_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM };20 /*GUI_MODE_SNAKE*/ { GUI_MODE_MODULE, gui_snake_draw, gui_snake_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM }; 21 21 22 22 … … 425 425 draw_filled_rect(0,0,screen_width,screen_height, COLOR_WHITE); 426 426 snake_start(); 427 gui_set_mode( (unsigned int)&GUI_MODE_SNAKE);427 gui_set_mode(&GUI_MODE_SNAKE); 428 428 return 1; 429 429 } -
branches/reyalp-flt/core/gui_sokoban.c
r1512 r1513 13 13 14 14 #include "module_load.h" 15 15 16 void gui_module_menu_kbd_process(); 17 void gui_sokoban_kbd_process(); 18 void gui_sokoban_draw(int enforce_redraw); 16 19 17 20 int *conf_sokoban_level; 18 21 19 22 gui_handler GUI_MODE_SOKOBAN = 20 /*GUI_MODE_SOKOBAN*/ {gui_sokoban_draw, gui_sokoban_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM };23 /*GUI_MODE_SOKOBAN*/ { GUI_MODE_MODULE, gui_sokoban_draw, gui_sokoban_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM }; 21 24 22 25 … … 333 336 need_redraw_all = 1; 334 337 335 gui_set_mode( (unsigned int)&GUI_MODE_SOKOBAN);338 gui_set_mode(&GUI_MODE_SOKOBAN); 336 339 return 1; 337 340 } -
branches/reyalp-flt/core/gui_sokoban.h
r1467 r1513 4 4 //------------------------------------------------------------------- 5 5 extern int gui_sokoban_init(); 6 extern void gui_sokoban_kbd_process();7 extern void gui_sokoban_draw(int enforce_redraw);8 6 9 7 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_tetris.c
r1512 r1513 17 17 18 18 gui_handler GUI_MODE_TETRIS = 19 /*GUI_MODE_TETRIS*/ {gui_tetris_draw, gui_tetris_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM };19 /*GUI_MODE_TETRIS*/ { GUI_MODE_MODULE, gui_tetris_draw, gui_tetris_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM }; 20 20 21 21 … … 783 783 module_idx=moduleidx; 784 784 785 gui_set_mode ((unsigned int)&GUI_MODE_TETRIS);785 gui_set_mode(&GUI_MODE_TETRIS); 786 786 gui_tetris_init(); 787 787 -
branches/reyalp-flt/core/luascript.c
r1511 r1513 2356 2356 FUNC(draw_string) 2357 2357 2358 FUNC(draw_pixel)2359 FUNC(draw_line)2360 FUNC(draw_rect)2361 FUNC(draw_rect_filled)2362 FUNC(draw_ellipse)2363 FUNC(draw_ellipse_filled)2364 FUNC(draw_clear)2365 FUNC(draw_string)2366 2367 2358 FUNC(set_yield) 2368 2359 -
branches/reyalp-flt/core/module_exportlist.c
r1512 r1513 235 235 TurnOffBackLight, 236 236 mkdir, 237 238 gui_bind_mode,239 237 240 238 // modlist.flt … … 303 301 304 302 &camera_info, 303 &altGuiHandler, 305 304 0 306 305 }; -
branches/reyalp-flt/core/modules/module_inspector.c
r1510 r1513 94 94 95 95 gui_handler GUI_MODE_MODULE_INSPECTOR = 96 /*GUI_MODE_MODULE_INSPECTOR*/ {gui_module_draw, gui_module_kbd_process, gui_module_menu_kbd_process, 0, GUI_MODE_MAGICNUM };96 /*GUI_MODE_MODULE_INSPECTOR*/ { GUI_MODE_MODULE, gui_module_draw, gui_module_kbd_process, gui_module_menu_kbd_process, 0, GUI_MODE_MAGICNUM }; 97 97 98 98 99 99 int modinspect_redraw; 100 intmodinspect_old_guimode;100 gui_handler *modinspect_old_guimode; 101 101 102 102 static void modinspect_unload_cb(unsigned int btn) { 103 103 if (btn==MBOX_BTN_YES) { 104 104 module_async_unload_allrunned(0); 105 if (modinspect_old_guimode<GUI_MODE_COUNT) 106 gui_set_mode(modinspect_old_guimode); // if core gui - return to it 107 else 108 gui_default_kbd_process_menu_btn(); // if not - return to menu 105 gui_set_mode(modinspect_old_guimode); // if core gui - return to it 109 106 } 110 107 modinspect_redraw=2; … … 128 125 int basic_module_init() { 129 126 modinspect_redraw=2; 130 modinspect_old_guimode=gui_get_mode(); 131 gui_set_mode( (unsigned int)&GUI_MODE_MODULE_INSPECTOR ); 127 modinspect_old_guimode = gui_set_mode(&GUI_MODE_MODULE_INSPECTOR); 132 128 return 1; 133 129 } -
branches/reyalp-flt/include/gui.h
r1489 r1513 7 7 #define MAKE_COLOR(bg, fg) ((color)((((char)(bg))<<8)|((char)(fg)))) 8 8 9 // Don't delete or re-order entries unless guiHandlers (gui.c) table is updated to match 9 // Module ID's for specific modules that we need to be able to detect 10 // use GUI_MODE_MODULE for generic module modes (e.g.games) 10 11 enum Gui_Mode_ { 11 12 GUI_MODE_NONE = 0, 12 13 GUI_MODE_ALT, 13 14 GUI_MODE_MENU, 15 GUI_MODE_MBOX, 16 GUI_MODE_OSD, 14 17 GUI_MODE_PALETTE, 15 GUI_MODE_MBOX,16 18 GUI_MODE_FSELECT, 17 GUI_MODE_OSD,18 19 GUI_MODE_MPOPUP, 19 GUI_MODE_COUNT 20 GUI_MODE_MODULE, // generic module 20 21 }; 21 22 … … 40 41 typedef struct 41 42 { 43 // Gui_Mode enum value 44 int mode; 45 42 46 // Called to redraw screen. Argument is GUI_REDRAWFLAG_* set 43 47 void (*redraw)(int); 44 48 45 49 // Main button handler for mode 46 // Note: this pointer reused as gui_handler* for47 // GUI_MODE_FLAG_ALIAS entries48 // Do not use union because warning on initializer49 50 void (*kbd_process)(void); 50 51 … … 58 59 } gui_handler; 59 60 60 61 extern gui_handler defaultGuiHandler; 62 extern gui_handler altGuiHandler; 63 extern gui_handler menuGuiHandler; 61 64 62 65 void gui_default_kbd_process_menu_btn(); … … 65 68 extern void gui_force_restore(); 66 69 67 extern void draw_pixel(coord x, coord y, color cl);68 69 70 extern gui_mode_t gui_get_mode(); 70 extern void gui_set_mode(gui_mode_t mode); 71 72 extern int gui_bind_mode(int core_mode, gui_handler* handler); 73 71 extern gui_handler* gui_set_mode(gui_handler *mode); 74 72 75 73
Note: See TracChangeset
for help on using the changeset viewer.